smbls 2.6.7 → 2.6.9

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": "2.6.7",
6
+ "version": "2.6.9",
7
7
  "repository": "https://github.com/symbo-ls/smbls",
8
8
  "main": "src/index.js",
9
9
  "files": [
package/src/Icon.js CHANGED
@@ -6,7 +6,7 @@ import { toCamelCase } from '@symbo.ls/utils'
6
6
  export const Icon = {
7
7
  extend: SVG,
8
8
  props: ({ key, props, parent, context }) => {
9
- const { ICONS } = context && context.SYSTEM
9
+ const { ICONS } = context && context.system
10
10
  const iconName = props.inheritedString || props.name || props.icon || key
11
11
  const camelCase = toCamelCase(iconName)
12
12
 
@@ -83,7 +83,7 @@ const init = (element, s) => {
83
83
  }
84
84
 
85
85
  export const initUpdate = el => {
86
- // FORCE CLIENT_STATE UPDATE:
86
+ // FORCE PROJECT_STATE UPDATE:
87
87
  const { props, class: className } = el
88
88
  const rootState = el.__root ? el.__root.state : el.state
89
89
  // if (el.key !== 'app') return
@@ -96,7 +96,7 @@ export const initUpdate = el => {
96
96
  if (rootState.globalTheme === parse) {
97
97
  props.theme = getTheme(theme[key])
98
98
  } else props.theme = theme
99
- className.MEDIA_FORCED_BY_CLIENT_STATE = props.theme
99
+ className.MEDIA_FORCED_BY_PROJECT_STATE = props.theme
100
100
  }
101
101
  }
102
102
  }
@@ -8,7 +8,7 @@ const { keyframes } = emotion
8
8
 
9
9
  const applyAnimationProps = (animation, element) => {
10
10
  if (isObject(animation)) return { animationName: keyframes(animation) }
11
- const { ANIMATION } = element.context && element.context.SYSTEM
11
+ const { ANIMATION } = element.context && element.context.system
12
12
  const record = ANIMATION[animation]
13
13
  return keyframes(record)
14
14
  }
@@ -1,6 +1,10 @@
1
1
  'use strict'
2
2
 
3
- import { getSpacingBasedOnRatio, getSpacingByKey } from '@symbo.ls/scratch'
3
+ import { getSpacingBasedOnRatio, getSpacingByKey, isString } from '@symbo.ls/scratch'
4
+
5
+ const transfromGap = gap => isString(gap) && ({
6
+ gap: gap.split(' ').map(v => getSpacingByKey(v, 'gap').gap).join(' ')
7
+ })
4
8
 
5
9
  export const Block = {
6
10
  class: {
@@ -95,7 +99,7 @@ export const Block = {
95
99
  marginBlockStart: ({ props }) => props.marginBlockStart ? getSpacingBasedOnRatio(props, 'marginBlockStart') : null,
96
100
  marginBlockEnd: ({ props }) => props.marginBlockEnd ? getSpacingBasedOnRatio(props, 'marginBlockEnd') : null,
97
101
 
98
- gap: ({ props }) => props.gap ? getSpacingBasedOnRatio(props, 'gap') : null,
102
+ gap: ({ props }) => props.gap ? transfromGap(props.gap) : null,
99
103
  gridArea: ({ props }) => props.gridArea && ({ gridArea: props.gridArea }),
100
104
 
101
105
  flex: ({ props }) => props.flex && ({ flex: props.flex }),
@@ -53,9 +53,9 @@ const convertPropsToClass = (props, result, element) => {
53
53
 
54
54
  const applyMediaProps = (key, props, result, element) => {
55
55
  const { context } = element
56
- if (!context.SYSTEM || !context.SYSTEM.MEDIA) return
56
+ if (!context.system || !context.system.MEDIA) return
57
57
  const globalTheme = getSystemTheme(element)
58
- const { MEDIA } = context.SYSTEM
58
+ const { MEDIA } = context.system
59
59
  const mediaName = MEDIA[key.slice(1)]
60
60
  const generatedClass = convertPropsToClass(props, result, element)
61
61
 
@@ -80,7 +80,7 @@ const applySelectorProps = (key, props, result, element) => {
80
80
  }
81
81
 
82
82
  const applyCaseProps = (key, props, result, element) => {
83
- const { CASES } = element.context && element.context.SYSTEM
83
+ const { CASES } = element.context && element.context.system
84
84
  const caseKey = key.slice(1)
85
85
  const isPropTrue = element.props[caseKey]
86
86
  if (!CASES[caseKey] && !isPropTrue) return
@@ -10,7 +10,7 @@ export const Picture = {
10
10
  attr: {
11
11
  media: element => {
12
12
  const { props, key, context } = element
13
- const { MEDIA } = context.SYSTEM
13
+ const { MEDIA } = context.system
14
14
  const globalTheme = getSystemTheme(element)
15
15
  const mediaName = (props.media || key).slice(1)
16
16
 
@@ -43,7 +43,7 @@ const transformBackgroundImage = (backgroundImage, ctx, globalTheme) => ({
43
43
  backgroundImage: backgroundImage.split(', ').map(v => {
44
44
  if (v.slice(0, 2) === '--') return `var(${v})`
45
45
  if (v.includes('url') || v.includes('gradient')) return v
46
- else if (ctx.SYSTEM.GRADIENT[backgroundImage]) {
46
+ else if (ctx.system.GRADIENT[backgroundImage]) {
47
47
  return getMediaColor(backgroundImage, 'backgroundImage', globalTheme)
48
48
  }
49
49
  return `url(${v})`
@@ -53,7 +53,7 @@ const transformBackgroundImage = (backgroundImage, ctx, globalTheme) => ({
53
53
  export const getSystemTheme = (element, state) => {
54
54
  const { context } = element
55
55
  const rootState = element.__root ? element.__root.state : element.state
56
- return rootState.globalTheme || context.SYSTEM.globalTheme
56
+ return rootState.globalTheme || context.system.globalTheme
57
57
  }
58
58
 
59
59
  export const Theme = {