@symbo.ls/atoms 2.11.375 → 2.11.380
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/Img.js +1 -1
- package/Media.js +4 -4
- package/Picture.js +3 -3
- package/Theme.js +9 -9
- package/package.json +2 -2
package/Img.js
CHANGED
|
@@ -17,7 +17,7 @@ export const Img = {
|
|
|
17
17
|
try { isUrl = new URL(src) } catch (e) {}
|
|
18
18
|
if (isUrl) return src
|
|
19
19
|
const file = context.files && context.files[src]
|
|
20
|
-
if (file) return file.content
|
|
20
|
+
if (file) return file.content && file.content.src
|
|
21
21
|
},
|
|
22
22
|
alt: ({ props }) => props.alt,
|
|
23
23
|
title: ({ props }) => props.title || props.alt
|
package/Media.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { merge, isArray, overwriteDeep, overwriteShallow } from '@domql/utils'
|
|
4
|
-
import {
|
|
4
|
+
import { getSystemGlobalTheme } from './Theme'
|
|
5
5
|
|
|
6
6
|
export const keySetters = {
|
|
7
7
|
'@': (key, props, result, element, isSubtree) => applyMediaProps(
|
|
@@ -83,9 +83,9 @@ const convertPropsToClass = (props, result, element) => {
|
|
|
83
83
|
const applyMediaProps = (key, props, result, element) => {
|
|
84
84
|
const { context } = element
|
|
85
85
|
if (!context.designSystem || !context.designSystem.MEDIA) return
|
|
86
|
-
const globalTheme =
|
|
86
|
+
const globalTheme = getSystemGlobalTheme(element)
|
|
87
87
|
const { MEDIA } = context.designSystem
|
|
88
|
-
const
|
|
88
|
+
const mediaValue = MEDIA[key.slice(1)]
|
|
89
89
|
const generatedClass = convertPropsToClass(props, result, element)
|
|
90
90
|
|
|
91
91
|
const name = key.slice(1)
|
|
@@ -97,7 +97,7 @@ const applyMediaProps = (key, props, result, element) => {
|
|
|
97
97
|
return
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
const mediaKey =
|
|
100
|
+
const mediaKey = mediaValue ? `@media screen and ${mediaValue}` : key
|
|
101
101
|
result[mediaKey] = generatedClass
|
|
102
102
|
return result[mediaKey]
|
|
103
103
|
}
|
package/Picture.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getSystemGlobalTheme } from './Theme'
|
|
4
4
|
|
|
5
5
|
export const Picture = {
|
|
6
|
-
deps: {
|
|
6
|
+
deps: { getSystemGlobalTheme },
|
|
7
7
|
tag: 'picture',
|
|
8
8
|
|
|
9
9
|
childExtend: {
|
|
@@ -12,7 +12,7 @@ export const Picture = {
|
|
|
12
12
|
media: (element) => {
|
|
13
13
|
const { props, key, context, deps } = element
|
|
14
14
|
const { MEDIA } = context.designSystem
|
|
15
|
-
const globalTheme = deps.
|
|
15
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
16
16
|
const mediaName = (props.media || key).slice(1)
|
|
17
17
|
|
|
18
18
|
if (mediaName === globalTheme) return '(min-width: 0px)'
|
package/Theme.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import { depth } from './Shape/style'
|
|
14
14
|
import { isUndefined, isString } from '@domql/utils'
|
|
15
15
|
|
|
16
|
-
export const
|
|
16
|
+
export const getSystemGlobalTheme = ({ context, state }) => {
|
|
17
17
|
const rootState = state && state.root
|
|
18
18
|
return rootState && rootState.globalTheme ? rootState.globalTheme : context.designSystem && context.designSystem.globalTheme
|
|
19
19
|
}
|
|
@@ -21,7 +21,7 @@ export const getSystemTheme = ({ context, state }) => {
|
|
|
21
21
|
export const Theme = {
|
|
22
22
|
deps: {
|
|
23
23
|
depth,
|
|
24
|
-
|
|
24
|
+
getSystemGlobalTheme,
|
|
25
25
|
getMediaTheme,
|
|
26
26
|
getMediaColor,
|
|
27
27
|
transformTextStroke,
|
|
@@ -36,7 +36,7 @@ export const Theme = {
|
|
|
36
36
|
|
|
37
37
|
theme: (element) => {
|
|
38
38
|
const { props, deps } = element
|
|
39
|
-
const globalTheme = deps.
|
|
39
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
40
40
|
if (!props.theme) return
|
|
41
41
|
const hasSubtheme = props.theme.includes(' ') && !props.theme.includes('@')
|
|
42
42
|
const globalThemeForced = `@${props.themeModifier || globalTheme}`
|
|
@@ -50,7 +50,7 @@ export const Theme = {
|
|
|
50
50
|
|
|
51
51
|
color: (element) => {
|
|
52
52
|
const { props, deps } = element
|
|
53
|
-
const globalTheme = deps.
|
|
53
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
54
54
|
if (!props.color) return
|
|
55
55
|
return {
|
|
56
56
|
color: deps.getMediaColor(props.color, globalTheme)
|
|
@@ -59,7 +59,7 @@ export const Theme = {
|
|
|
59
59
|
|
|
60
60
|
background: (element) => {
|
|
61
61
|
const { props, deps } = element
|
|
62
|
-
const globalTheme = deps.
|
|
62
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
63
63
|
if (!props.background) return
|
|
64
64
|
return {
|
|
65
65
|
background: deps.getMediaColor(props.background, globalTheme)
|
|
@@ -68,7 +68,7 @@ export const Theme = {
|
|
|
68
68
|
|
|
69
69
|
backgroundColor: (element) => {
|
|
70
70
|
const { props, deps } = element
|
|
71
|
-
const globalTheme = deps.
|
|
71
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
72
72
|
if (!props.backgroundColor) return
|
|
73
73
|
return {
|
|
74
74
|
backgroundColor: deps.getMediaColor(props.backgroundColor, globalTheme)
|
|
@@ -77,7 +77,7 @@ export const Theme = {
|
|
|
77
77
|
|
|
78
78
|
backgroundImage: (element) => {
|
|
79
79
|
const { props, deps } = element
|
|
80
|
-
const globalTheme = deps.
|
|
80
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
81
81
|
if (!props.backgroundImage) return
|
|
82
82
|
return ({
|
|
83
83
|
backgroundImage: deps.transformBackgroundImage(props.backgroundImage, globalTheme)
|
|
@@ -115,7 +115,7 @@ export const Theme = {
|
|
|
115
115
|
|
|
116
116
|
borderColor: (element) => {
|
|
117
117
|
const { props, deps } = element
|
|
118
|
-
const globalTheme = deps.
|
|
118
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
119
119
|
if (!props.borderColor) return
|
|
120
120
|
return {
|
|
121
121
|
borderColor: deps.getMediaColor(props.borderColor, globalTheme)
|
|
@@ -140,7 +140,7 @@ export const Theme = {
|
|
|
140
140
|
|
|
141
141
|
shadow: (element) => {
|
|
142
142
|
const { props, deps } = element
|
|
143
|
-
const globalTheme = deps.
|
|
143
|
+
const globalTheme = deps.getSystemGlobalTheme(element)
|
|
144
144
|
if (!props.backgroundImage) return
|
|
145
145
|
return ({
|
|
146
146
|
boxShadow: deps.transformShadow(props.shadow, globalTheme)
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/atoms",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.380",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "e7cf06697ab58d0d31fdcafddc125cc03d16dd22",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@domql/state": "latest",
|
|
9
9
|
"@domql/utils": "latest",
|