css-in-props 2.29.65 → 2.29.67
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/dist/cjs/props/theme.js +10 -6
- package/package.json +6 -6
- package/src/props/theme.js +22 -14
package/dist/cjs/props/theme.js
CHANGED
|
@@ -39,7 +39,8 @@ const THEME_PROPS = {
|
|
|
39
39
|
const themeAppliedInVal = props.theme.split(" ");
|
|
40
40
|
themeAppliedInVal.splice(1, 0, globalThemeForced);
|
|
41
41
|
return (0, import_scratch.getMediaTheme)(themeAppliedInVal);
|
|
42
|
-
} else if (props.theme.includes("@{globalTheme}"))
|
|
42
|
+
} else if (props.theme.includes("@{globalTheme}"))
|
|
43
|
+
props.theme.replace("@{globalTheme}", globalThemeForced);
|
|
43
44
|
return (0, import_scratch.getMediaTheme)(props.theme, `@${props.themeModifier || globalTheme}`);
|
|
44
45
|
},
|
|
45
46
|
color: (element) => {
|
|
@@ -89,13 +90,13 @@ const THEME_PROPS = {
|
|
|
89
90
|
textStroke: ({ props }) => ({
|
|
90
91
|
WebkitTextStroke: (0, import_scratch.transformTextStroke)(props.textStroke)
|
|
91
92
|
}),
|
|
92
|
-
outline: ({ props }) => ({
|
|
93
|
+
outline: ({ props }) => (0, import_utils.isDefined)(props.outline) && {
|
|
93
94
|
outline: (0, import_scratch.transformBorder)(props.outline)
|
|
94
|
-
}
|
|
95
|
+
},
|
|
95
96
|
outlineOffset: ({ props }) => (0, import_scratch.transformSizeRatio)("outlineOffset", props),
|
|
96
|
-
border: ({ props }) => ({
|
|
97
|
+
border: ({ props }) => (0, import_utils.isDefined)(props.border) && {
|
|
97
98
|
border: (0, import_scratch.transformBorder)(props.border)
|
|
98
|
-
}
|
|
99
|
+
},
|
|
99
100
|
borderColor: (element) => {
|
|
100
101
|
const { props } = element;
|
|
101
102
|
const globalTheme = getSystemGlobalTheme(element);
|
|
@@ -135,7 +136,10 @@ const THEME_PROPS = {
|
|
|
135
136
|
};
|
|
136
137
|
},
|
|
137
138
|
textShadow: ({ props, context }) => ({
|
|
138
|
-
textShadow: (0, import_scratch.transformBoxShadow)(
|
|
139
|
+
textShadow: (0, import_scratch.transformBoxShadow)(
|
|
140
|
+
props.textShadow,
|
|
141
|
+
context.designSystem.globalTheme
|
|
142
|
+
)
|
|
139
143
|
}),
|
|
140
144
|
columnRule: ({ props }) => ({
|
|
141
145
|
columnRule: (0, import_scratch.transformBorder)(props.columnRule)
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "css-in-props",
|
|
3
3
|
"description": "Utilize props as CSS methods",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
|
-
"version": "2.29.
|
|
5
|
+
"version": "2.29.67",
|
|
6
6
|
"repository": "https://github.com/symbo-ls/smbls",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"module": "src/index.js",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@domql/utils": "^2.29.
|
|
29
|
-
"@symbo.ls/atoms": "^2.29.
|
|
30
|
-
"@symbo.ls/emotion": "^2.29.
|
|
31
|
-
"@symbo.ls/scratch": "^2.29.
|
|
28
|
+
"@domql/utils": "^2.29.67",
|
|
29
|
+
"@symbo.ls/atoms": "^2.29.67",
|
|
30
|
+
"@symbo.ls/emotion": "^2.29.67",
|
|
31
|
+
"@symbo.ls/scratch": "^2.29.67"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "b3ebe3aa391f748a5de3534fac1fe6d36b9771b3"
|
|
34
34
|
}
|
package/src/props/theme.js
CHANGED
|
@@ -11,11 +11,13 @@ import {
|
|
|
11
11
|
transformSizeRatio
|
|
12
12
|
} from '@symbo.ls/scratch'
|
|
13
13
|
|
|
14
|
-
import { isString } from '@domql/utils'
|
|
14
|
+
import { isDefined, isString } from '@domql/utils'
|
|
15
15
|
|
|
16
16
|
export const getSystemGlobalTheme = ({ context, state }) => {
|
|
17
17
|
const rootState = state && state.root
|
|
18
|
-
return rootState && rootState.globalTheme
|
|
18
|
+
return rootState && rootState.globalTheme
|
|
19
|
+
? rootState.globalTheme
|
|
20
|
+
: context.designSystem && context.designSystem.globalTheme
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export const THEME_PROPS = {
|
|
@@ -29,7 +31,8 @@ export const THEME_PROPS = {
|
|
|
29
31
|
const themeAppliedInVal = props.theme.split(' ')
|
|
30
32
|
themeAppliedInVal.splice(1, 0, globalThemeForced)
|
|
31
33
|
return getMediaTheme(themeAppliedInVal)
|
|
32
|
-
} else if (props.theme.includes('@{globalTheme}'))
|
|
34
|
+
} else if (props.theme.includes('@{globalTheme}'))
|
|
35
|
+
props.theme.replace('@{globalTheme}', globalThemeForced)
|
|
33
36
|
return getMediaTheme(props.theme, `@${props.themeModifier || globalTheme}`)
|
|
34
37
|
},
|
|
35
38
|
|
|
@@ -67,9 +70,9 @@ export const THEME_PROPS = {
|
|
|
67
70
|
if (!val) return
|
|
68
71
|
const file = ctx.files && ctx.files[val]
|
|
69
72
|
if (file && file.content) val = file.content.src
|
|
70
|
-
return
|
|
73
|
+
return {
|
|
71
74
|
backgroundImage: transformBackgroundImage(val, globalTheme)
|
|
72
|
-
}
|
|
75
|
+
}
|
|
73
76
|
},
|
|
74
77
|
|
|
75
78
|
backgroundSize: ({ props }) => ({
|
|
@@ -88,15 +91,17 @@ export const THEME_PROPS = {
|
|
|
88
91
|
WebkitTextStroke: transformTextStroke(props.textStroke)
|
|
89
92
|
}),
|
|
90
93
|
|
|
91
|
-
outline: ({ props }) =>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
outline: ({ props }) =>
|
|
95
|
+
isDefined(props.outline) && {
|
|
96
|
+
outline: transformBorder(props.outline)
|
|
97
|
+
},
|
|
94
98
|
|
|
95
99
|
outlineOffset: ({ props }) => transformSizeRatio('outlineOffset', props),
|
|
96
100
|
|
|
97
|
-
border: ({ props }) =>
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
border: ({ props }) =>
|
|
102
|
+
isDefined(props.border) && {
|
|
103
|
+
border: transformBorder(props.border)
|
|
104
|
+
},
|
|
100
105
|
|
|
101
106
|
borderColor: (element) => {
|
|
102
107
|
const { props } = element
|
|
@@ -123,9 +128,9 @@ export const THEME_PROPS = {
|
|
|
123
128
|
const { props } = element
|
|
124
129
|
const globalTheme = getSystemGlobalTheme(element)
|
|
125
130
|
if (!props.backgroundImage) return
|
|
126
|
-
return
|
|
131
|
+
return {
|
|
127
132
|
boxShadow: transformShadow(props.shadow, globalTheme)
|
|
128
|
-
}
|
|
133
|
+
}
|
|
129
134
|
},
|
|
130
135
|
|
|
131
136
|
boxShadow: (element, state, context) => {
|
|
@@ -140,7 +145,10 @@ export const THEME_PROPS = {
|
|
|
140
145
|
},
|
|
141
146
|
|
|
142
147
|
textShadow: ({ props, context }) => ({
|
|
143
|
-
textShadow: transformBoxShadow(
|
|
148
|
+
textShadow: transformBoxShadow(
|
|
149
|
+
props.textShadow,
|
|
150
|
+
context.designSystem.globalTheme
|
|
151
|
+
)
|
|
144
152
|
}),
|
|
145
153
|
|
|
146
154
|
columnRule: ({ props }) => ({
|