@symbo.ls/scratch 0.7.2 → 0.7.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/defaultConfig/theme.js +0 -7
- package/src/system/theme.js +2 -5
- package/src/utils/theme.js +8 -0
package/package.json
CHANGED
|
@@ -11,10 +11,3 @@ const themeA = { // eslint-disable-line no-unused-vars
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const THEME = {}
|
|
14
|
-
|
|
15
|
-
export const returnSubThemeOrDefault = (orig, theme) => {
|
|
16
|
-
if (!orig) return
|
|
17
|
-
if (orig.themes && orig.themes[theme]) return orig.themes[theme]
|
|
18
|
-
if (orig[theme]) return [orig, orig[theme]]
|
|
19
|
-
return orig
|
|
20
|
-
}
|
package/src/system/theme.js
CHANGED
|
@@ -210,7 +210,7 @@ const findModifier = (val, modifier) => {
|
|
|
210
210
|
// console.log(val)
|
|
211
211
|
// console.log(modifier)
|
|
212
212
|
if (isArray(modifier)) return findModifierFromArray(val, modifier)
|
|
213
|
-
else if (isString(modifier)) return val[modifier]
|
|
213
|
+
else if (isString(modifier) && val[modifier]) return val[modifier]
|
|
214
214
|
else return val
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -225,16 +225,13 @@ export const getMediaTheme = (val, mod, themeObj) => {
|
|
|
225
225
|
if (isString(val) && val.slice(0, 2) === '--') val = getMediaTheme(val.slice(2))
|
|
226
226
|
|
|
227
227
|
if (!val || !isString(val)) {
|
|
228
|
-
|
|
228
|
+
if ((ENV === 'test' || ENV === 'development') && CONFIG.verbose) console.warn(val, '- theme is not string')
|
|
229
229
|
return
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
// console.group(val)
|
|
233
232
|
const [name, ...modifier] = isArray(val) ? val : val.split(' ')
|
|
234
233
|
let value = CONFIG.THEME[name]
|
|
235
234
|
if (value && (modifier || mod)) value = findModifier(value, modifier.length ? modifier : mod)
|
|
236
|
-
// console.log('finalval', value)
|
|
237
|
-
// console.groupEnd(val)
|
|
238
235
|
return recursiveTheme(value)
|
|
239
236
|
}
|
|
240
237
|
|