smbls 0.8.5 → 0.8.8

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.5",
6
+ "version": "0.8.8",
7
7
  "repository": "https://github.com/rackai/symbols",
8
8
  "main": "src/index.js",
9
9
  "files": [
package/src/Box/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict'
2
2
 
3
- import { Shape, Position, Block, Text, Responsive } from '..'
3
+ import { Shape, Position, Block, Text, Overflow, Transition, Responsive } from '..'
4
4
 
5
5
  export const Box = {
6
- proto: [Shape, Position, Block, Text, Responsive],
6
+ proto: [Shape, Position, Block, Text, Overflow, Transition, Responsive],
7
7
  class: {
8
8
  fromProps: ({ props }) => props && props.css
9
9
  }
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 = {
@@ -9,10 +10,12 @@ export const Link = {
9
10
  href: '',
10
11
  target: '',
11
12
  theme: 'link',
12
- aria: {}
13
+ aria: {},
14
+ fontWeight: 'bold',
15
+ textDecoration: 'none'
13
16
  },
14
17
  attr: {
15
- href: ({ props }) => props.href,
18
+ href: element => exec(element.props.href, element) || exec(element.props, element).href,
16
19
  target: ({ props }) => props.target,
17
20
  'aria-label': ({ props }) => props.aria.label || props.text
18
21
  }
@@ -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 screenName = screen.slice(1)
17
- const responsiveKey = `@media screen and ${RESPONSIVE[screenName]}`
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,34 @@ 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 = `&${screen}`
45
+
46
+
47
+ for (const prop in underSelectorProps) {
48
+ const classProp = el.class[prop]
49
+ if (typeof classProp !== 'function') continue
50
+ let calculatedProp = classProp({ props: underSelectorProps })
51
+
52
+ if (Array.isArray(calculatedProp)) {
53
+ calculatedProp = Object.assign({}, ...calculatedProp)
54
+ }
55
+
56
+ for (const finalProp in calculatedProp) {
57
+ selectorProps[finalProp] = calculatedProp[finalProp]
58
+ }
59
+ }
60
+
61
+ const { selectors } = el.class
62
+ if (selectors) selectors[selectorKey] = selectorProps
63
+ else {
64
+ el.class.selectors = {
65
+ [selectorKey]: selectorProps
66
+ }
67
+ }
44
68
  }
45
69
  }
46
70
  }
package/src/Text/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import { mapFontSize } from '@symbo.ls/scratch'
3
+ import { mapFontSize, getFontFamily, FONT_FAMILY } from '@symbo.ls/scratch'
4
4
 
5
5
  export const Text = {
6
6
  props: {},
@@ -9,6 +9,7 @@ export const Text = {
9
9
 
10
10
  class: {
11
11
  fontSize: ({ props }) => props.fontSize ? mapFontSize(props.fontSize) : null,
12
+ fontFamily: ({ props }) => props.fontFamily && ({ fontFamily: getFontFamily(FONT_FAMILY, props.fontFamily) || props.fontFamily }),
12
13
  lineHeight: ({ props }) => ({ lineHeight: props.lineHeight }),
13
14
  textDecoration: ({ props }) => ({ textDecoration: props.textDecoration }),
14
15
  textTransform: ({ props }) => ({ textTransform: props.textTransform }),
@@ -0,0 +1,8 @@
1
+ 'use strict'
2
+
3
+ export const Transition = {
4
+ class: {
5
+ transition: ({ props }) => ({ transition: props.transition }),
6
+ transitionProperty: ({ props }) => ({ transitionProperty: props.transitionProperty })
7
+ }
8
+ }
@@ -0,0 +1,2 @@
1
+ 'use strict'
2
+
package/src/index.js CHANGED
@@ -13,6 +13,7 @@ export * from './Direction'
13
13
  export * from './Position'
14
14
  export * from './Overflow'
15
15
  export * from './Transform'
16
+ export * from './Transition'
16
17
  export * from './Responsive'
17
18
 
18
19
  export * from './Box'