@symbo.ls/atoms 2.10.134 → 2.10.158
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 +1 -1
- package/Media.js +4 -4
- package/Picture.js +1 -1
- package/Svg.js +11 -9
- package/Theme.js +6 -5
- package/package.json +2 -2
package/Animation.js
CHANGED
|
@@ -7,7 +7,7 @@ const { keyframes } = emotion
|
|
|
7
7
|
|
|
8
8
|
const applyAnimationProps = (animation, element) => {
|
|
9
9
|
if (isObject(animation)) return { animationName: keyframes(animation) }
|
|
10
|
-
const { ANIMATION } = element.context && element.context.
|
|
10
|
+
const { ANIMATION } = element.context && element.context.designSystem
|
|
11
11
|
const record = ANIMATION[animation]
|
|
12
12
|
return keyframes(record)
|
|
13
13
|
}
|
package/Media.js
CHANGED
|
@@ -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.
|
|
56
|
+
if (!context.designSystem || !context.designSystem.MEDIA) return
|
|
57
57
|
const globalTheme = getSystemTheme(element)
|
|
58
|
-
const { MEDIA } = context.
|
|
58
|
+
const { MEDIA } = context.designSystem
|
|
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.
|
|
83
|
+
const { CASES } = element.context && element.context.designSystem
|
|
84
84
|
const caseKey = key.slice(1)
|
|
85
85
|
const isPropTrue = element.props[caseKey]
|
|
86
86
|
if (!CASES[caseKey] && !isPropTrue) return
|
|
@@ -121,7 +121,7 @@ const beforeClassAssign = (element, s) => {
|
|
|
121
121
|
|
|
122
122
|
export const initUpdate = element => {
|
|
123
123
|
const { props, context, class: className } = element
|
|
124
|
-
const globalTheme = context.
|
|
124
|
+
const globalTheme = context.designSystem.globalTheme
|
|
125
125
|
|
|
126
126
|
const parentProps = element.parent.props
|
|
127
127
|
if (parentProps && parentProps.spacingRatio && parentProps.inheritSpacingRatio) {
|
package/Picture.js
CHANGED
|
@@ -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.
|
|
13
|
+
const { MEDIA } = context.designSystem
|
|
14
14
|
const globalTheme = getSystemTheme(element)
|
|
15
15
|
const mediaName = (props.media || key).slice(1)
|
|
16
16
|
|
package/Svg.js
CHANGED
|
@@ -13,9 +13,9 @@ export const Svg = {
|
|
|
13
13
|
'xmlns:xlink': 'http://www.w3.org/1999/xlink'
|
|
14
14
|
},
|
|
15
15
|
html: ({ key, props, context, ...el }) => {
|
|
16
|
-
const {
|
|
17
|
-
const SVG =
|
|
18
|
-
const useSvgSprite = props.spriteId || (context.
|
|
16
|
+
const { designSystem, packages } = context
|
|
17
|
+
const SVG = designSystem && designSystem.SVG
|
|
18
|
+
const useSvgSprite = props.spriteId || (context.designSystem && context.designSystem.useSvgSprite)
|
|
19
19
|
const useSVGSymbol = icon => `<use xlink:href="#${icon}" />`
|
|
20
20
|
|
|
21
21
|
const init = (packages && packages.init) || require('@symbo.ls/init').init
|
|
@@ -30,12 +30,14 @@ export const Svg = {
|
|
|
30
30
|
if (SVGKey && SVG[SVGKey]) return useSVGSymbol(SVGKey)
|
|
31
31
|
|
|
32
32
|
SVGKey = SVG[symbolId] = Math.random()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
if (props.src) {
|
|
34
|
+
init({
|
|
35
|
+
svg: { [SVGKey]: props.src }
|
|
36
|
+
}, {
|
|
37
|
+
document: context.document,
|
|
38
|
+
emotion: context.emotion
|
|
39
|
+
})
|
|
40
|
+
}
|
|
39
41
|
|
|
40
42
|
return useSVGSymbol(SVGKey)
|
|
41
43
|
}
|
package/Theme.js
CHANGED
|
@@ -43,17 +43,16 @@ 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.
|
|
46
|
+
else if (ctx.designSystem.GRADIENT[backgroundImage]) {
|
|
47
47
|
return getMediaColor(backgroundImage, 'backgroundImage', globalTheme)
|
|
48
48
|
}
|
|
49
49
|
return `url(${v})`
|
|
50
50
|
}).join(' ')
|
|
51
51
|
})
|
|
52
52
|
|
|
53
|
-
export const getSystemTheme = (
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
return rootState ? rootState.globalTheme : context.system && context.system.globalTheme
|
|
53
|
+
export const getSystemTheme = ({ context, state }) => {
|
|
54
|
+
const rootState = state && state.__root
|
|
55
|
+
return rootState ? rootState.globalTheme : context.designSystem && context.designSystem.globalTheme
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
export const Theme = {
|
|
@@ -63,6 +62,8 @@ export const Theme = {
|
|
|
63
62
|
theme: (element) => {
|
|
64
63
|
const { props } = element
|
|
65
64
|
const globalTheme = getSystemTheme(element)
|
|
65
|
+
console.log('globalTheme')
|
|
66
|
+
console.log(globalTheme)
|
|
66
67
|
if (!props.theme) return
|
|
67
68
|
return getMediaTheme(props.theme, `@${props.themeModifier || globalTheme}`)
|
|
68
69
|
},
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/atoms",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.158",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "3a847545c01796c874758c2c2a91e2417bcd29d6",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@domql/utils": "latest",
|
|
9
9
|
"@symbo.ls/create-emotion": "latest",
|