@symbo.ls/scratch 0.6.1 → 0.6.4
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 +1 -1
- package/src/config/index.js +1 -0
- package/src/config/responsive.js +1 -1
- package/src/system/color.js +2 -0
- package/src/system/theme.js +2 -2
- package/src/utils/sequence.js +9 -2
package/package.json
CHANGED
package/src/config/index.js
CHANGED
package/src/config/responsive.js
CHANGED
package/src/system/color.js
CHANGED
|
@@ -23,6 +23,8 @@ export const getColor = (value, key) => {
|
|
|
23
23
|
return
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
if (value.slice(0, 2) === '--') return `var(${value})`
|
|
27
|
+
|
|
26
28
|
if (key && value[key]) value = value[key]
|
|
27
29
|
const [name, alpha, tone] = isArray(value) ? value : value.split(' ')
|
|
28
30
|
const { COLOR, GRADIENT } = CONFIG
|
package/src/system/theme.js
CHANGED
|
@@ -186,12 +186,12 @@ const recursiveTheme = val => {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
export const getMediaTheme = (val, key, themeObj) => {
|
|
189
|
-
if (!isString(val)) {
|
|
189
|
+
if (!val || !isString(val)) {
|
|
190
190
|
if ((ENV === 'test' || ENV === 'development') && CONFIG.verbose) console.warn(val, '- type for color is not valid')
|
|
191
191
|
return
|
|
192
192
|
}
|
|
193
193
|
const [name, modifier] = isArray(val) ? val : val.split(' ')
|
|
194
194
|
let value = CONFIG.THEME[name]
|
|
195
|
-
if (modifier && value[modifier]) value = value[modifier]
|
|
195
|
+
if (value && modifier && value[modifier]) value = value[modifier]
|
|
196
196
|
return recursiveTheme(value)
|
|
197
197
|
}
|
package/src/utils/sequence.js
CHANGED
|
@@ -45,7 +45,14 @@ const setSequenceValue = ({ key, variable, value, scaling, state, index }) => {
|
|
|
45
45
|
state.vars[variable] = scaling + state.unit
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export const getSequenceValue = ({
|
|
48
|
+
export const getSequenceValue = ({
|
|
49
|
+
type,
|
|
50
|
+
prop,
|
|
51
|
+
val = 'A',
|
|
52
|
+
prefix = '--font-size-',
|
|
53
|
+
unit = UNIT.default,
|
|
54
|
+
useVariable
|
|
55
|
+
}) => {
|
|
49
56
|
if (typeof val !== 'string') console.warn(prop, val, 'is not a string')
|
|
50
57
|
|
|
51
58
|
if (val === '-' || val === '') return ({ })
|
|
@@ -74,7 +81,7 @@ export const getSequenceValue = ({ type, prop, val = 'A', prefix = '--font-size-
|
|
|
74
81
|
const value = type ? type[pureVal] : null
|
|
75
82
|
if (!value) return console.warn('can\'t find', type, pureVal)
|
|
76
83
|
|
|
77
|
-
if (CONFIG.useVariable) {
|
|
84
|
+
if (useVariable || CONFIG.useVariable) {
|
|
78
85
|
const varVal = `var(${prefix}${pureVal}${mediaName})`
|
|
79
86
|
return isNegative ? {
|
|
80
87
|
[prop]: `calc(${varVal} * -1)`
|