smbls 0.8.39 → 0.9.0

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.39",
6
+ "version": "0.9.0",
7
7
  "repository": "https://github.com/symbo-ls/smbls",
8
8
  "main": "src/index.js",
9
9
  "files": [
@@ -20,14 +20,14 @@
20
20
  "reinstall": "rm yarn.lock && rm -rf node_modules/rackai && yarn",
21
21
  "bump": "npx np"
22
22
  },
23
- "dependencies": {},
23
+ "dependencies": {
24
+ "@domql/utils": "latest",
25
+ "@symbo.ls/scratch": "latest"
26
+ },
24
27
  "devDependencies": {
25
- "@babel/core": "^7.14.6",
26
- "babel-eslint": "^10.0.3",
27
- "emotion": "^10.0.27",
28
- "np": "^7.2.0",
29
- "parcel-bundler": "^1.12.3",
30
- "parcel-plugin-svg-sprite": "^1.4.1",
28
+ "@babel/core": "^7.18.10",
29
+ "@babel/preset-env": "^7.18.10",
30
+ "babel-eslint": "^10.1.0",
31
31
  "standard": "^13.1.0"
32
32
  },
33
33
  "standard": {
package/src/Button.js CHANGED
@@ -51,5 +51,3 @@ export const KangorooButton = {
51
51
  iconText: { proto: IconText },
52
52
  child: { proto: IconText }
53
53
  }
54
-
55
- export default Button
package/src/Media.js CHANGED
@@ -47,13 +47,15 @@ const convertPropsToClass = (props, result, element) => {
47
47
  const applyMediaProps = (key, props, result, element) => {
48
48
  const mediaName = CONFIG_MEDIA[key.slice(1)]
49
49
  const generatedClass = convertPropsToClass(props, result, element)
50
+
50
51
  const rootState = element.__root ? element.__root.state : element.state
51
52
  const { globalTheme } = rootState
52
53
  const name = key.slice(1)
54
+ const isTheme = ['dark', 'light'].includes(name)
53
55
  const matchesGlobal = name === globalTheme
54
56
 
55
- if (globalTheme) {
56
- if (matchesGlobal) merge(result, generatedClass)
57
+ if (globalTheme && isTheme) {
58
+ if (matchesGlobal) return merge(result, generatedClass)
57
59
  return
58
60
  }
59
61
 
package/src/Pseudo.js ADDED
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ export const Pseudo = {
4
+ class: {
5
+ content: ({ props }) => props.content && ({ content: props.content })
6
+ }
7
+ }
@@ -1,42 +1,57 @@
1
1
  'use strict'
2
2
 
3
3
  import style from './style'
4
- import { set, opacify } from '@symbo.ls/scratch'
4
+ import { opacify } from '@symbo.ls/scratch'
5
5
  import { isFunction } from '@domql/utils'
6
6
 
7
- import { SquareButton, Shape } from '..'
7
+ import { SquareButton } from '..'
8
8
 
9
- set({
10
- theme: {
11
- sliderThumb: {
12
- background: 'white 0.2',
9
+ const theme = {
10
+ '@dark': {
11
+ background: 'white 0.2',
13
12
 
14
- '&::-webkit-slider-thumb': {
15
- background: '#232526',
16
- borderColor: opacify('#454646', 0.75)
17
- },
13
+ '::-webkit-slider-thumb': {
14
+ background: '#232526',
15
+ borderColor: opacify('#454646', 0.75)
16
+ },
17
+
18
+ ':hover': {
19
+ '::-webkit-slider-thumb': {
20
+ borderColor: opacify('#fff', 0.35)
21
+ }
22
+ },
23
+
24
+ ':focus': {
25
+ '::-webkit-slider-thumb': {
26
+ borderColor: '#3C6AC0'
27
+ }
28
+ }
29
+ },
30
+ '@light': {
31
+ background: 'gray9',
18
32
 
19
- '&:hover': {
20
- '&::-webkit-slider-thumb': {
21
- borderColor: opacify('#fff', 0.35)
22
- }
23
- },
33
+ '::-webkit-slider-thumb': {
34
+ background: 'white',
35
+ borderColor: 'gray9'
36
+ },
24
37
 
25
- '&:focus, &:active': {
26
- '&::-webkit-slider-thumb': {
27
- borderColor: '#3C6AC0'
28
- }
38
+ ':hover': {
39
+ '::-webkit-slider-thumb': {
40
+ borderColor: 'gray7'
41
+ }
42
+ },
43
+
44
+ ':focus': {
45
+ '::-webkit-slider-thumb': {
46
+ borderColor: 'blue'
29
47
  }
30
48
  }
31
49
  }
32
- })
50
+ }
33
51
 
34
52
  export const RangeSlider = {
35
53
  style,
36
- proto: Shape,
37
- props: {
38
- theme: 'sliderThumb'
39
- },
54
+ props: theme,
40
55
 
41
56
  tag: 'input',
42
57
  attr: { type: 'range' }
@@ -45,7 +60,6 @@ export const RangeSlider = {
45
60
  const listenProp = (el, prop, def) => {
46
61
  const val = el.props && el.props[prop]
47
62
  const r = (isFunction(val) ? val() : val) || (def !== undefined ? def : 50)
48
- // if (prop === 'value') console.log(r)
49
63
  return r
50
64
  }
51
65
 
package/src/Theme.js CHANGED
@@ -27,6 +27,14 @@ const diffStroke = stroke => {
27
27
  return { WebkitTextStroke }
28
28
  }
29
29
 
30
+ const diffShadow = stroke => {
31
+ const boxShadow = stroke.split(', ').map(v => {
32
+ if (v.includes('px')) return v
33
+ else if (getColor(v)) return getColor(v)
34
+ }).join(' ')
35
+ return { boxShadow }
36
+ }
37
+
30
38
  export const Theme = {
31
39
  class: {
32
40
  depth: ({ props }) => depth[props.depth],
@@ -52,6 +60,8 @@ export const Theme = {
52
60
  borderRight: ({ props }) => props.borderRight ? diffBorder(props.borderRight, 'borderRight') : null,
53
61
  borderBottom: ({ props }) => props.borderBottom ? diffBorder(props.borderBottom, 'borderBottom') : null,
54
62
 
63
+ shadow: ({ props }) => props.shadow ? diffShadow(props.shadow) : null,
64
+
55
65
  opacity: ({ props }) => props.opacity && ({ opacity: props.opacity }),
56
66
  visibility: ({ props }) => props.visibility && ({ visibility: props.visibility })
57
67
  }
@@ -4,7 +4,7 @@ export default {
4
4
  textAlign: 'center',
5
5
  padding: '1.2em',
6
6
  caption: {
7
- whiteSpace: 'nowrap',
7
+ whiteSpace: 'nowrap'
8
8
  },
9
9
  span: {
10
10
  opacity: '.5'
package/src/index.js CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  import './styles.js'
4
4
 
5
+ export * from '@symbo.ls/init'
6
+
5
7
  export * from './styles'
6
8
 
7
9
  export * from './Text'
@@ -10,6 +12,7 @@ export * from './Shape'
10
12
  export * from './Theme'
11
13
  export * from './Flex'
12
14
  export * from './Grid'
15
+ export * from './Pseudo'
13
16
  export * from './Direction'
14
17
  export * from './Position'
15
18
  export * from './Overflow'