@symbo.ls/atoms 2.11.150 → 2.11.162

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/Animation.js CHANGED
@@ -3,9 +3,10 @@
3
3
  import { getTimingByKey, getTimingFunction } from '@symbo.ls/scratch'
4
4
  import { isObject } from '@domql/utils'
5
5
  import { emotion } from '@symbo.ls/emotion'
6
- const { keyframes } = emotion
7
6
 
8
7
  const applyAnimationProps = (animation, element) => {
8
+ const { emotion: ctxEmotion } = element.context
9
+ const { keyframes } = ctxEmotion || emotion
9
10
  if (isObject(animation)) return { animationName: keyframes(animation) }
10
11
  const { ANIMATION } = element.context && element.context.designSystem
11
12
  const record = ANIMATION[animation]
@@ -13,28 +14,29 @@ const applyAnimationProps = (animation, element) => {
13
14
  }
14
15
 
15
16
  export const Animation = {
17
+ deps: { isObject, getTimingByKey, getTimingFunction, applyAnimationProps },
16
18
  class: {
17
19
  animation: (el) => el.props.animation && {
18
- animationName: applyAnimationProps(el.props.animation, el),
19
- animationDuration: getTimingByKey(el.props.animationDuration || 'A').timing,
20
- animationDelay: getTimingByKey(el.props.animationDelay || '0s').timing,
21
- animationTimingFunction: getTimingFunction(el.props.animationTimingFunction || 'ease'),
20
+ animationName: el.deps.applyAnimationProps(el.props.animation, el),
21
+ animationDuration: el.deps.getTimingByKey(el.props.animationDuration || 'A').timing,
22
+ animationDelay: el.deps.getTimingByKey(el.props.animationDelay || '0s').timing,
23
+ animationTimingFunction: el.deps.getTimingFunction(el.props.animationTimingFunction || 'ease'),
22
24
  animationFillMode: el.props.animationFillMode || 'both',
23
25
  animationPlayState: el.props.animationPlayState,
24
26
  animationDirection: el.props.animationDirection
25
27
  },
26
28
  animationName: (el) => el.props.animationName && {
27
- animationName: applyAnimationProps(el.props.animationName, el)
29
+ animationName: el.deps.applyAnimationProps(el.props.animationName, el)
28
30
  },
29
31
 
30
- animationDuration: ({ props }) => props.animationDuration && ({
31
- animationDuration: getTimingByKey(props.animationDuration).timing
32
+ animationDuration: ({ props, deps }) => props.animationDuration && ({
33
+ animationDuration: deps.getTimingByKey(props.animationDuration).timing
32
34
  }),
33
- animationDelay: ({ props }) => props.animationDelay && ({
34
- animationDelay: getTimingByKey(props.animationDelay).timing
35
+ animationDelay: ({ props, deps }) => props.animationDelay && ({
36
+ animationDelay: deps.getTimingByKey(props.animationDelay).timing
35
37
  }),
36
- animationTimingFunction: ({ props }) => props.animationTimingFunction && ({
37
- animationTimingFunction: getTimingFunction(props.animationTimingFunction)
38
+ animationTimingFunction: ({ props, deps }) => props.animationTimingFunction && ({
39
+ animationTimingFunction: deps.getTimingFunction(props.animationTimingFunction)
38
40
  }),
39
41
  animationFillMode: ({ props }) => props.animationFillMode && ({
40
42
  animationFillMode: props.animationFillMode
package/Block.js CHANGED
@@ -3,6 +3,8 @@
3
3
  import { getSpacingBasedOnRatio, getSpacingByKey, transfromGap } from '@symbo.ls/scratch'
4
4
 
5
5
  export const Block = {
6
+ deps: { getSpacingBasedOnRatio, getSpacingByKey, transfromGap },
7
+
6
8
  class: {
7
9
  boxSizing: ({ props }) => props.boxSizing
8
10
  ? ({ boxSizing: props.boxSizing })
@@ -14,36 +16,36 @@ export const Block = {
14
16
 
15
17
  hide: ({ props }) => props.hide && ({ display: 'none !important' }),
16
18
 
17
- width: ({ props }) => props.width && getSpacingBasedOnRatio(props, 'width'),
18
- height: ({ props }) => props.height && getSpacingBasedOnRatio(props, 'height'),
19
- boxSize: ({ props }) => {
19
+ width: ({ props, deps }) => props.width && deps.getSpacingBasedOnRatio(props, 'width'),
20
+ height: ({ props, deps }) => props.height && deps.getSpacingBasedOnRatio(props, 'height'),
21
+ boxSize: ({ props, deps }) => {
20
22
  if (typeof props.boxSize !== 'string') return
21
23
  const [height, width] = props.boxSize.split(' ')
22
24
  return {
23
- ...getSpacingByKey(height, 'height'),
24
- ...getSpacingByKey(width || height, 'width')
25
+ ...deps.getSpacingByKey(height, 'height'),
26
+ ...deps.getSpacingByKey(width || height, 'width')
25
27
  }
26
28
  },
27
29
 
28
- maxWidth: ({ props }) => props.maxWidth && getSpacingBasedOnRatio(props, 'maxWidth'),
29
- minWidth: ({ props }) => props.minWidth && getSpacingBasedOnRatio(props, 'minWidth'),
30
- widthRange: ({ props }) => {
30
+ maxWidth: ({ props, deps }) => props.maxWidth && deps.getSpacingBasedOnRatio(props, 'maxWidth'),
31
+ minWidth: ({ props, deps }) => props.minWidth && deps.getSpacingBasedOnRatio(props, 'minWidth'),
32
+ widthRange: ({ props, deps }) => {
31
33
  if (typeof props.widthRange !== 'string') return
32
34
  const [minWidth, maxWidth] = props.widthRange.split(' ')
33
35
  return {
34
- ...getSpacingByKey(minWidth, 'minWidth'),
35
- ...getSpacingByKey(maxWidth || minWidth, 'maxWidth')
36
+ ...deps.getSpacingByKey(minWidth, 'minWidth'),
37
+ ...deps.getSpacingByKey(maxWidth || minWidth, 'maxWidth')
36
38
  }
37
39
  },
38
40
 
39
- maxHeight: ({ props }) => props.maxHeight && getSpacingBasedOnRatio(props, 'maxHeight'),
40
- minHeight: ({ props }) => props.minHeight && getSpacingBasedOnRatio(props, 'minHeight'),
41
- heightRange: ({ props }) => {
41
+ maxHeight: ({ props, deps }) => props.maxHeight && deps.getSpacingBasedOnRatio(props, 'maxHeight'),
42
+ minHeight: ({ props, deps }) => props.minHeight && deps.getSpacingBasedOnRatio(props, 'minHeight'),
43
+ heightRange: ({ props, deps }) => {
42
44
  if (typeof props.heightRange !== 'string') return
43
45
  const [minHeight, maxHeight] = props.heightRange.split(' ')
44
46
  return {
45
- ...getSpacingByKey(minHeight, 'minHeight'),
46
- ...getSpacingByKey(maxHeight || minHeight, 'maxHeight')
47
+ ...deps.getSpacingByKey(minHeight, 'minHeight'),
48
+ ...deps.getSpacingByKey(maxHeight || minHeight, 'maxHeight')
47
49
  }
48
50
  },
49
51
 
@@ -51,58 +53,58 @@ export const Block = {
51
53
 
52
54
  aspectRatio: ({ props }) => props.aspectRatio && ({ aspectRatio: props.aspectRatio }),
53
55
 
54
- borderWidth: ({ props }) => props.borderWidth ? getSpacingBasedOnRatio(props, 'borderWidth') : null,
56
+ borderWidth: ({ props, deps }) => props.borderWidth ? deps.getSpacingBasedOnRatio(props, 'borderWidth') : null,
55
57
 
56
- padding: ({ props }) => props.padding ? getSpacingBasedOnRatio(props, 'padding') : null,
57
- paddingInline: ({ props }) => {
58
+ padding: ({ props, deps }) => props.padding ? deps.getSpacingBasedOnRatio(props, 'padding') : null,
59
+ paddingInline: ({ props, deps }) => {
58
60
  if (typeof props.paddingInline !== 'string') return
59
61
  const [paddingInlineStart, paddingInlineEnd] = props.paddingInline.split(' ')
60
62
  return {
61
- ...getSpacingByKey(paddingInlineStart, 'paddingInlineStart'),
62
- ...getSpacingByKey(paddingInlineEnd || paddingInlineStart, 'paddingInlineEnd')
63
+ ...deps.getSpacingByKey(paddingInlineStart, 'paddingInlineStart'),
64
+ ...deps.getSpacingByKey(paddingInlineEnd || paddingInlineStart, 'paddingInlineEnd')
63
65
  }
64
66
  },
65
- paddingBlock: ({ props }) => {
67
+ paddingBlock: ({ props, deps }) => {
66
68
  if (typeof props.paddingBlock !== 'string') return
67
69
  const [paddingBlockStart, paddingBlockEnd] = props.paddingBlock.split(' ')
68
70
  return {
69
- ...getSpacingByKey(paddingBlockStart, 'paddingBlockStart'),
70
- ...getSpacingByKey(paddingBlockEnd || paddingBlockStart, 'paddingBlockEnd')
71
+ ...deps.getSpacingByKey(paddingBlockStart, 'paddingBlockStart'),
72
+ ...deps.getSpacingByKey(paddingBlockEnd || paddingBlockStart, 'paddingBlockEnd')
71
73
  }
72
74
  },
73
- paddingInlineStart: ({ props }) => props.paddingInlineStart ? getSpacingBasedOnRatio(props, 'paddingInlineStart') : null,
74
- paddingInlineEnd: ({ props }) => props.paddingInlineEnd ? getSpacingBasedOnRatio(props, 'paddingInlineEnd') : null,
75
- paddingBlockStart: ({ props }) => props.paddingBlockStart ? getSpacingBasedOnRatio(props, 'paddingBlockStart') : null,
76
- paddingBlockEnd: ({ props }) => props.paddingBlockEnd ? getSpacingBasedOnRatio(props, 'paddingBlockEnd') : null,
75
+ paddingInlineStart: ({ props, deps }) => props.paddingInlineStart ? deps.getSpacingBasedOnRatio(props, 'paddingInlineStart') : null,
76
+ paddingInlineEnd: ({ props, deps }) => props.paddingInlineEnd ? deps.getSpacingBasedOnRatio(props, 'paddingInlineEnd') : null,
77
+ paddingBlockStart: ({ props, deps }) => props.paddingBlockStart ? deps.getSpacingBasedOnRatio(props, 'paddingBlockStart') : null,
78
+ paddingBlockEnd: ({ props, deps }) => props.paddingBlockEnd ? deps.getSpacingBasedOnRatio(props, 'paddingBlockEnd') : null,
77
79
 
78
- margin: ({ props }) => props.margin ? getSpacingBasedOnRatio(props, 'margin') : null,
79
- marginInline: ({ props }) => {
80
+ margin: ({ props, deps }) => props.margin ? deps.getSpacingBasedOnRatio(props, 'margin') : null,
81
+ marginInline: ({ props, deps }) => {
80
82
  if (typeof props.marginInline !== 'string') return
81
83
  const [marginInlineStart, marginInlineEnd] = props.marginInline.split(' ')
82
84
  return {
83
- ...getSpacingByKey(marginInlineStart, 'marginInlineStart'),
84
- ...getSpacingByKey(marginInlineEnd || marginInlineStart, 'marginInlineEnd')
85
+ ...deps.getSpacingByKey(marginInlineStart, 'marginInlineStart'),
86
+ ...deps.getSpacingByKey(marginInlineEnd || marginInlineStart, 'marginInlineEnd')
85
87
  }
86
88
  },
87
- marginBlock: ({ props }) => {
89
+ marginBlock: ({ props, deps }) => {
88
90
  if (typeof props.marginBlock !== 'string') return
89
91
  const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(' ')
90
92
  return {
91
- ...getSpacingByKey(marginBlockStart, 'marginBlockStart'),
92
- ...getSpacingByKey(marginBlockEnd || marginBlockStart, 'marginBlockEnd')
93
+ ...deps.getSpacingByKey(marginBlockStart, 'marginBlockStart'),
94
+ ...deps.getSpacingByKey(marginBlockEnd || marginBlockStart, 'marginBlockEnd')
93
95
  }
94
96
  },
95
- marginInlineStart: ({ props }) => props.marginInlineStart ? getSpacingBasedOnRatio(props, 'marginInlineStart') : null,
96
- marginInlineEnd: ({ props }) => props.marginInlineEnd ? getSpacingBasedOnRatio(props, 'marginInlineEnd') : null,
97
- marginBlockStart: ({ props }) => props.marginBlockStart ? getSpacingBasedOnRatio(props, 'marginBlockStart') : null,
98
- marginBlockEnd: ({ props }) => props.marginBlockEnd ? getSpacingBasedOnRatio(props, 'marginBlockEnd') : null,
97
+ marginInlineStart: ({ props, deps }) => props.marginInlineStart ? deps.getSpacingBasedOnRatio(props, 'marginInlineStart') : null,
98
+ marginInlineEnd: ({ props, deps }) => props.marginInlineEnd ? deps.getSpacingBasedOnRatio(props, 'marginInlineEnd') : null,
99
+ marginBlockStart: ({ props, deps }) => props.marginBlockStart ? deps.getSpacingBasedOnRatio(props, 'marginBlockStart') : null,
100
+ marginBlockEnd: ({ props, deps }) => props.marginBlockEnd ? deps.getSpacingBasedOnRatio(props, 'marginBlockEnd') : null,
99
101
 
100
102
  gap: ({ props }) => props.gap
101
103
  ? ({
102
104
  gap: transfromGap(props.gap)
103
105
  })
104
106
  : null,
105
- gridArea: ({ props }) => props.gridArea && ({ gridArea: props.gridArea }),
107
+ gridArea: ({ props, deps }) => props.gridArea && ({ gridArea: props.gridArea }),
106
108
 
107
109
  flex: ({ props }) => props.flex && ({ flex: props.flex }),
108
110
  flexDirection: ({ props }) => props.flexDirection && ({ flexDirection: props.flexDirection }),
@@ -140,17 +142,17 @@ export const Block = {
140
142
  gridRow: ({ props }) => props.gridRow && ({ gridRow: props.gridRow }),
141
143
  gridRowStart: ({ props }) => props.gridRowStart ? ({ gridRowStart: props.gridRowStart }) : null,
142
144
 
143
- size: ({ props }) => {
145
+ size: ({ props, deps }) => {
144
146
  if (typeof props.heightRange !== 'string') return
145
147
  const [minHeight, maxHeight] = props.heightRange.split(' ')
146
148
  return {
147
- ...getSpacingByKey(minHeight, 'minHeight'),
148
- ...getSpacingByKey(maxHeight || minHeight, 'maxHeight')
149
+ ...deps.getSpacingByKey(minHeight, 'minHeight'),
150
+ ...deps.getSpacingByKey(maxHeight || minHeight, 'maxHeight')
149
151
  }
150
152
  },
151
153
 
152
154
  columns: ({ props }) => props.columns && ({ columns: props.columns }),
153
- columnGap: ({ props }) => props.columnGap ? getSpacingBasedOnRatio(props, 'columnGap') : null,
155
+ columnGap: ({ props, deps }) => props.columnGap ? deps.getSpacingBasedOnRatio(props, 'columnGap') : null,
154
156
  columnSpan: ({ props }) => props.columnSpan && ({ columns: props.columnSpan }),
155
157
  columnFill: ({ props }) => props.columnFill && ({ columns: props.columnFill }),
156
158
  columnCount: ({ props }) => props.columnCount && ({ columns: props.columnCount })
@@ -163,23 +165,24 @@ export const Hr = {
163
165
  }
164
166
  export const Br = { tag: 'br' }
165
167
  export const Span = { tag: 'span' }
166
- export const List = {
168
+ export const Ul = {
167
169
  tag: 'ul',
168
170
  childExtend: { tag: 'li' }
169
171
  }
170
172
  // export const Article = { tag: 'article' }
171
173
 
172
174
  export const Gutter = {
175
+ deps: { getSpacingByKey },
173
176
  props: {
174
177
  size: 'C1'
175
178
  },
176
179
  class: {
177
- size: ({ props }) => {
180
+ size: ({ props, deps }) => {
178
181
  if (typeof props.size !== 'string') return
179
182
  const [height, width] = props.size.split(' ')
180
183
  return {
181
- ...getSpacingByKey(height, 'height'),
182
- ...getSpacingByKey(width || height, 'width')
184
+ ...deps.getSpacingByKey(height, 'height'),
185
+ ...deps.getSpacingByKey(width || height, 'width')
183
186
  }
184
187
  }
185
188
  }
package/Grid.js CHANGED
@@ -3,6 +3,8 @@
3
3
  import { getSpacingBasedOnRatio } from '@symbo.ls/scratch'
4
4
 
5
5
  export const Grid = {
6
+ deps: { getSpacingBasedOnRatio },
7
+
6
8
  props: { display: 'grid' },
7
9
 
8
10
  class: {
@@ -24,7 +26,7 @@ export const Grid = {
24
26
 
25
27
  autoFlow: ({ props }) => props.autoFlow ? ({ gridAutoFlow: props.autoFlow }) : null,
26
28
 
27
- columnGap: ({ props }) => props.columnGap ? getSpacingBasedOnRatio(props, 'columnGap') : null,
28
- rowGap: ({ props }) => props.rowGap ? getSpacingBasedOnRatio(props, 'rowGap') : null
29
+ columnGap: ({ props, deps }) => props.columnGap ? deps.getSpacingBasedOnRatio(props, 'columnGap') : null,
30
+ rowGap: ({ props, deps }) => props.rowGap ? deps.getSpacingBasedOnRatio(props, 'rowGap') : null
29
31
  }
30
32
  }
package/Media.js CHANGED
@@ -40,7 +40,7 @@ const execClass = (key, props, result, element) => {
40
40
  props,
41
41
  context: element.context,
42
42
  state: element.state,
43
- deps: element.deps,
43
+ deps: element.deps
44
44
  })
45
45
  if (isArray(classExec)) {
46
46
  classExec = classExec.reduce((a, c) => merge(a, c), {})
package/Picture.js CHANGED
@@ -3,15 +3,16 @@
3
3
  import { getSystemTheme } from './Theme'
4
4
 
5
5
  export const Picture = {
6
+ deps: { getSystemTheme },
6
7
  tag: 'picture',
7
8
 
8
9
  childExtend: {
9
10
  tag: 'source',
10
11
  attr: {
11
12
  media: (element) => {
12
- const { props, key, context } = element
13
+ const { props, key, context, deps } = element
13
14
  const { MEDIA } = context.designSystem
14
- const globalTheme = getSystemTheme(element)
15
+ const globalTheme = deps.getSystemTheme(element)
15
16
  const mediaName = (props.media || key).slice(1)
16
17
 
17
18
  if (mediaName === globalTheme) return '(min-width: 0px)'
package/Position.js CHANGED
@@ -3,19 +3,21 @@
3
3
  import { getSpacingByKey } from '@symbo.ls/scratch'
4
4
 
5
5
  export const Position = {
6
+ deps: { getSpacingByKey },
7
+
6
8
  props: {},
7
9
 
8
10
  class: {
9
11
  position: ({ props }) => props.position && ({ position: props.position }),
10
- inset: ({ props }) => {
12
+ inset: ({ props, deps }) => {
11
13
  const { inset } = props
12
14
  if (typeof inset !== 'string') return
13
- return { inset: inset.split(' ').map(v => getSpacingByKey(v, 'k').k).join(' ') }
15
+ return { inset: inset.split(' ').map(v => deps.getSpacingByKey(v, 'k').k).join(' ') }
14
16
  },
15
17
 
16
- left: ({ props }) => getSpacingByKey(props.left, 'left'),
17
- top: ({ props }) => getSpacingByKey(props.top, 'top'),
18
- right: ({ props }) => getSpacingByKey(props.right, 'right'),
19
- bottom: ({ props }) => getSpacingByKey(props.bottom, 'bottom')
18
+ left: ({ props, deps }) => deps.getSpacingByKey(props.left, 'left'),
19
+ top: ({ props, deps }) => deps.getSpacingByKey(props.top, 'top'),
20
+ right: ({ props, deps }) => deps.getSpacingByKey(props.right, 'right'),
21
+ bottom: ({ props, deps }) => deps.getSpacingByKey(props.bottom, 'bottom')
20
22
  }
21
23
  }
package/Shape/index.js CHANGED
@@ -15,10 +15,12 @@ const transformBorderRadius = (radius, props, propertyName) => {
15
15
  export const Shape = {
16
16
  extend: Pseudo,
17
17
 
18
+ deps: { exec, getSpacingBasedOnRatio, getMediaColor, transformBorderRadius },
19
+
18
20
  class: {
19
- shape: ({ props }) => {
21
+ shape: ({ props, deps }) => {
20
22
  const { shape } = props
21
- return exec(SHAPES[shape], ({ props }))
23
+ return deps.exec(SHAPES[shape], ({ props }))
22
24
  },
23
25
  shapeDirection: ({ props }) => {
24
26
  const { shape, shapeDirection } = props
@@ -26,16 +28,16 @@ export const Shape = {
26
28
  const shapeDir = SHAPES[shape + 'Direction']
27
29
  return shape && shapeDir ? shapeDir[shapeDirection || 'left'] : null
28
30
  },
29
- shapeDirectionColor: ({ props }) => {
31
+ shapeDirectionColor: ({ props, deps }) => {
30
32
  const { background, backgroundColor } = props
31
33
  const borderColor = {
32
- borderColor: getMediaColor(background || backgroundColor)
34
+ borderColor: deps.getMediaColor(background || backgroundColor)
33
35
  }
34
36
  return props.shapeDirection ? borderColor : null
35
37
  },
36
38
 
37
- round: ({ props, key, ...el }) => transformBorderRadius(props.round || props.borderRadius, props, 'round'),
38
- borderRadius: ({ props, key, ...el }) => transformBorderRadius(props.borderRadius || props.round, props, 'borderRadius')
39
+ round: ({ props, key, deps, ...el }) => deps.transformBorderRadius(props.round || props.borderRadius, props, 'round'),
40
+ borderRadius: ({ props, key, deps, ...el }) => deps.transformBorderRadius(props.borderRadius || props.round, props, 'borderRadius')
39
41
  }
40
42
  }
41
43
 
package/Svg.js CHANGED
@@ -1,10 +1,11 @@
1
1
  'use strict'
2
2
 
3
- // import { init } from '@symbo.ls/init'
3
+ import { init } from '@symbo.ls/init'
4
4
 
5
5
  // create SVG symbol
6
6
  export const Svg = {
7
7
  tag: 'svg',
8
+ deps: { init },
8
9
  props: {
9
10
  style: { '*': { fill: 'currentColor' } }
10
11
  },
@@ -12,16 +13,15 @@ export const Svg = {
12
13
  xmlns: 'http://www.w3.org/2000/svg',
13
14
  'xmlns:xlink': 'http://www.w3.org/1999/xlink'
14
15
  },
15
- html: ({ key, props, context, ...el }) => {
16
- const { designSystem, utils } = context
16
+ html: ({ key, props, context, deps, ...el }) => {
17
+ const { designSystem } = context
17
18
  const SVG = designSystem && designSystem.SVG
18
19
  const useSvgSprite = props.spriteId || (context.designSystem && context.designSystem.useSvgSprite)
19
- const useSVGSymbol = icon => `<use xlink:href="#${icon}" />`
20
-
21
- const init = utils && utils.init
22
20
 
23
21
  if (!useSvgSprite && props.src) return props.src
24
22
 
23
+ const useSVGSymbol = icon => `<use xlink:href="#${icon}" />`
24
+
25
25
  const spriteId = props.spriteId
26
26
  if (spriteId) return useSVGSymbol(spriteId)
27
27
 
@@ -31,7 +31,7 @@ export const Svg = {
31
31
 
32
32
  SVGKey = SVG[symbolId] = Math.random()
33
33
  if (props.src) {
34
- init({
34
+ deps.init({
35
35
  svg: { [SVGKey]: props.src }
36
36
  }, {
37
37
  document: context.document,
package/Text.js CHANGED
@@ -4,14 +4,19 @@ import { getFontSizeByKey, getFontFamily } from '@symbo.ls/scratch'
4
4
 
5
5
  export const Text = {
6
6
  deps: { getFontSizeByKey, getFontFamily },
7
+
7
8
  text: ({ key, props, state, deps }) => {
8
9
  if (props.text === true) return (state && state[key]) || (props && props[key])
9
10
  return props.text
10
11
  },
12
+
11
13
  class: {
12
- fontSize: ({ props, deps }) => props.fontSize ? deps.getFontSizeByKey(props.fontSize) : null,
14
+ fontSize: (el) => {
15
+ const { props, deps } = el
16
+ return props.fontSize ? deps.getFontSizeByKey(props.fontSize) : null
17
+ },
13
18
  fontFamily: ({ props, deps }) => props.fontFamily && ({
14
- fontFamily: deps.getFontFamily(props.fontFamily) || props.fontFamily
19
+ fontFamily: deps.getFontFamily(props.fontFamily) || props.fontFamily
15
20
  }),
16
21
  lineHeight: ({ props }) => props.lineHeight && ({ lineHeight: props.lineHeight }),
17
22
  // lineHeight: ({ props }) => props.lineHeight && getSpacingBasedOnRatio(props, 'lineHeight', null, ''),
package/Theme.js CHANGED
@@ -17,49 +17,61 @@ export const getSystemTheme = ({ context, state }) => {
17
17
  }
18
18
 
19
19
  export const Theme = {
20
+ deps: {
21
+ depth,
22
+ getSystemTheme,
23
+ getMediaTheme,
24
+ getMediaColor,
25
+ transformTextStroke,
26
+ transformShadow,
27
+ transformBorder,
28
+ transformBackgroundImage
29
+ },
30
+
20
31
  class: {
21
- depth: ({ props }) => props.depth && depth[props.depth],
32
+ depth: ({ props, deps }) => props.depth && deps.depth[props.depth],
22
33
 
23
34
  theme: (element) => {
24
- const { props } = element
25
- const globalTheme = getSystemTheme(element)
35
+ const { props, deps } = element
36
+ const globalTheme = deps.getSystemTheme(element)
26
37
  if (!props.theme) return
27
- return getMediaTheme(props.theme, `@${props.themeModifier || globalTheme}`)
38
+ const getMediaTheme = deps.getMediaTheme(props.theme, `@${props.themeModifier || globalTheme}`)
39
+ return getMediaTheme
28
40
  },
29
41
 
30
42
  color: (element) => {
31
- const { props } = element
32
- const globalTheme = getSystemTheme(element)
43
+ const { props, deps } = element
44
+ const globalTheme = deps.getSystemTheme(element)
33
45
  if (!props.color) return
34
46
  return {
35
- color: getMediaColor(props.color, globalTheme)
47
+ color: deps.getMediaColor(props.color, globalTheme)
36
48
  }
37
49
  },
38
50
 
39
51
  background: (element) => {
40
- const { props } = element
41
- const globalTheme = getSystemTheme(element)
52
+ const { props, deps } = element
53
+ const globalTheme = deps.getSystemTheme(element)
42
54
  if (!props.background) return
43
55
  return {
44
- background: getMediaColor(props.background, globalTheme)
56
+ background: deps.getMediaColor(props.background, globalTheme)
45
57
  }
46
58
  },
47
59
 
48
60
  backgroundColor: (element) => {
49
- const { props } = element
50
- const globalTheme = getSystemTheme(element)
61
+ const { props, deps } = element
62
+ const globalTheme = deps.getSystemTheme(element)
51
63
  if (!props.backgroundColor) return
52
64
  return {
53
- backgroundColor: getMediaColor(props.backgroundColor, globalTheme)
65
+ backgroundColor: deps.getMediaColor(props.backgroundColor, globalTheme)
54
66
  }
55
67
  },
56
68
 
57
69
  backgroundImage: (element) => {
58
- const { props } = element
59
- const globalTheme = getSystemTheme(element)
70
+ const { props, deps } = element
71
+ const globalTheme = deps.getSystemTheme(element)
60
72
  if (!props.backgroundImage) return
61
73
  return ({
62
- backgroundImage: transformBackgroundImage(props.backgroundImage, globalTheme)
74
+ backgroundImage: deps.transformBackgroundImage(props.backgroundImage, globalTheme)
63
75
  })
64
76
  },
65
77
  backgroundSize: ({ props }) => props.backgroundSize
@@ -73,45 +85,45 @@ export const Theme = {
73
85
  })
74
86
  : null,
75
87
 
76
- textStroke: ({ props }) => props.textStroke
88
+ textStroke: ({ props, deps }) => props.textStroke
77
89
  ? ({
78
- WebkitTextStroke: transformTextStroke(props.textStroke)
90
+ WebkitTextStroke: deps.transformTextStroke(props.textStroke)
79
91
  })
80
92
  : null,
81
93
 
82
- outline: ({ props }) => props.outline && ({
83
- outline: transformBorder(props.outline)
94
+ outline: ({ props, deps }) => props.outline && ({
95
+ outline: deps.transformBorder(props.outline)
84
96
  }),
85
97
 
86
- border: ({ props }) => props.border && ({
87
- border: transformBorder(props.border)
98
+ border: ({ props, deps }) => props.border && ({
99
+ border: deps.transformBorder(props.border)
88
100
  }),
89
- borderColor: ({ props }) => props.borderColor && ({
90
- borderColor: getMediaColor(props.borderColor)
101
+ borderColor: ({ props, deps }) => props.borderColor && ({
102
+ borderColor: deps.getMediaColor(props.borderColor)
91
103
  }),
92
104
  borderStyle: ({ props }) => props.borderStyle && ({
93
105
  borderStyle: props.borderStyle
94
106
  }),
95
107
 
96
- borderLeft: ({ props }) => props.borderLeft && ({
97
- borderLeft: transformBorder(props.borderLeft)
108
+ borderLeft: ({ props, deps }) => props.borderLeft && ({
109
+ borderLeft: deps.transformBorder(props.borderLeft)
98
110
  }),
99
- borderTop: ({ props }) => props.borderTop && ({
100
- borderTop: transformBorder(props.borderTop)
111
+ borderTop: ({ props, deps }) => props.borderTop && ({
112
+ borderTop: deps.transformBorder(props.borderTop)
101
113
  }),
102
- borderRight: ({ props }) => props.borderRight && ({
103
- borderRight: transformBorder(props.borderRight)
114
+ borderRight: ({ props, deps }) => props.borderRight && ({
115
+ borderRight: deps.transformBorder(props.borderRight)
104
116
  }),
105
- borderBottom: ({ props }) => props.borderBottom && ({
106
- borderBottom: transformBorder(props.borderBottom)
117
+ borderBottom: ({ props, deps }) => props.borderBottom && ({
118
+ borderBottom: deps.transformBorder(props.borderBottom)
107
119
  }),
108
120
 
109
- boxShadow: ({ props }) => props.boxShadow && ({
110
- boxShadow: transformShadow(props.boxShadow)
121
+ boxShadow: ({ props, deps }) => props.boxShadow && ({
122
+ boxShadow: deps.transformShadow(props.boxShadow)
111
123
  }),
112
124
 
113
- textShadow: ({ props }) => props.textShadow && ({
114
- textShadow: transformShadow(props.textShadow)
125
+ textShadow: ({ props, deps }) => props.textShadow && ({
126
+ textShadow: deps.transformShadow(props.textShadow)
115
127
  }),
116
128
 
117
129
  opacity: ({ props }) => props.opacity && ({
@@ -121,8 +133,8 @@ export const Theme = {
121
133
  visibility: props.visibility
122
134
  }),
123
135
 
124
- columnRule: ({ props }) => props.columnRule && ({
125
- columnRule: transformBorder(props.columnRule)
136
+ columnRule: ({ props, deps }) => props.columnRule && ({
137
+ columnRule: deps.transformBorder(props.columnRule)
126
138
  }),
127
139
 
128
140
  appearance: ({ props }) => props.appearance && ({
package/Timing.js CHANGED
@@ -7,21 +7,27 @@ import {
7
7
  } from '@symbo.ls/scratch'
8
8
 
9
9
  export const Timing = {
10
+ deps: {
11
+ getTimingFunction,
12
+ splitTransition,
13
+ transformDuration
14
+ },
15
+
10
16
  class: {
11
- transition: ({ props }) => props.transition && ({
12
- transition: splitTransition(props.transition)
17
+ transition: ({ props, deps }) => props.transition && ({
18
+ transition: deps.splitTransition(props.transition)
13
19
  }),
14
20
  willChange: ({ props }) => props.willChange && ({
15
21
  willChange: props.willChange
16
22
  }),
17
- transitionDuration: ({ props }) => props.transitionDuration && ({
18
- transitionDuration: transformDuration(props.transitionDuration)
23
+ transitionDuration: ({ props, deps }) => props.transitionDuration && ({
24
+ transitionDuration: deps.transformDuration(props.transitionDuration)
19
25
  }),
20
- transitionDelay: ({ props }) => props.transitionDelay && ({
21
- transitionDelay: transformDuration(props.transitionDelay)
26
+ transitionDelay: ({ props, deps }) => props.transitionDelay && ({
27
+ transitionDelay: deps.transformDuration(props.transitionDelay)
22
28
  }),
23
- transitionTimingFunction: ({ props }) => props.transitionTimingFunction && ({
24
- transitionTimingFunction: getTimingFunction(props.transitionTimingFunction)
29
+ transitionTimingFunction: ({ props, deps }) => props.transitionTimingFunction && ({
30
+ transitionTimingFunction: deps.getTimingFunction(props.transitionTimingFunction)
25
31
  }),
26
32
  transitionProperty: ({ props }) => props.transitionProperty && ({
27
33
  transitionProperty: props.transitionProperty,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@symbo.ls/atoms",
3
- "version": "2.11.150",
3
+ "version": "2.11.162",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "cd6667cfdf36c4f26203167255e870c26ca36bf1",
6
+ "gitHead": "fe3359a1d6c14d38f45f5e5db10ef2056947a228",
7
7
  "dependencies": {
8
8
  "@domql/state": "latest",
9
9
  "@domql/utils": "latest",