fix firefox
This commit is contained in:
parent
51b62be34d
commit
7f9ab03447
|
@ -122,16 +122,28 @@ export const applyTheme = (input, onFinish = (data) => {}, debug) => {
|
||||||
const eagerStyles = createStyleSheet(EAGER_STYLE_ID)
|
const eagerStyles = createStyleSheet(EAGER_STYLE_ID)
|
||||||
const lazyStyles = createStyleSheet(LAZY_STYLE_ID)
|
const lazyStyles = createStyleSheet(LAZY_STYLE_ID)
|
||||||
|
|
||||||
|
const insertRule = (styles, rule) => {
|
||||||
|
if (rule.indexOf('webkit') >= 0) {
|
||||||
|
try {
|
||||||
|
styles.sheet.insertRule(rule, 'index-max')
|
||||||
|
styles.rules.push(rule)
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Can\'t insert rule due to lack of support', e)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
styles.sheet.insertRule(rule, 'index-max')
|
||||||
|
styles.rules.push(rule)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const { lazyProcessFunc } = generateTheme(
|
const { lazyProcessFunc } = generateTheme(
|
||||||
input,
|
input,
|
||||||
{
|
{
|
||||||
onNewRule (rule, isLazy) {
|
onNewRule (rule, isLazy) {
|
||||||
if (isLazy) {
|
if (isLazy) {
|
||||||
lazyStyles.sheet.insertRule(rule, 'index-max')
|
insertRule(lazyStyles, rule)
|
||||||
lazyStyles.rules.push(rule)
|
|
||||||
} else {
|
} else {
|
||||||
eagerStyles.sheet.insertRule(rule, 'index-max')
|
insertRule(eagerStyles, rule)
|
||||||
eagerStyles.rules.push(rule)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onEagerFinished () {
|
onEagerFinished () {
|
||||||
|
|
|
@ -82,7 +82,7 @@ export const getCssRules = (rules, debug) => rules.map(rule => {
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
if (v === 'transparent') {
|
if (v === 'transparent') {
|
||||||
if (rule.component === 'Root') return []
|
if (rule.component === 'Root') return null
|
||||||
return [
|
return [
|
||||||
rule.directives.backgroundNoCssColor !== 'yes' ? ('background-color: ' + v) : '',
|
rule.directives.backgroundNoCssColor !== 'yes' ? ('background-color: ' + v) : '',
|
||||||
' --background: ' + v
|
' --background: ' + v
|
||||||
|
@ -114,7 +114,7 @@ export const getCssRules = (rules, debug) => rules.map(rule => {
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if (k.startsWith('--')) {
|
if (k.startsWith('--')) {
|
||||||
const [type, value] = v.split('|').map(x => x.trim()) // woah, Extreme!
|
const [type, value] = v.split('|').map(x => x.trim())
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'color': {
|
case 'color': {
|
||||||
const color = rule.dynamicVars[k]
|
const color = rule.dynamicVars[k]
|
||||||
|
@ -127,21 +127,20 @@ export const getCssRules = (rules, debug) => rules.map(rule => {
|
||||||
case 'generic':
|
case 'generic':
|
||||||
return k + ': ' + value
|
return k + ': ' + value
|
||||||
default:
|
default:
|
||||||
return ''
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ''
|
return null
|
||||||
}
|
}
|
||||||
}).filter(x => x).map(x => ' ' + x).join(';\n')
|
}).filter(x => x).map(x => ' ' + x + ';').join('\n')
|
||||||
|
|
||||||
return [
|
return [
|
||||||
header,
|
header,
|
||||||
directives + ';',
|
directives,
|
||||||
(rule.component === 'Text' && rule.state.indexOf('faint') < 0 && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '',
|
(rule.component === 'Text' && rule.state.indexOf('faint') < 0 && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '',
|
||||||
'',
|
|
||||||
virtualDirectives,
|
virtualDirectives,
|
||||||
footer
|
footer
|
||||||
].join('\n')
|
].filter(x => x).join('\n')
|
||||||
}).filter(x => x)
|
}).filter(x => x)
|
||||||
|
|
||||||
export const getScopedVersion = (rules, newScope) => {
|
export const getScopedVersion = (rules, newScope) => {
|
||||||
|
|
Loading…
Reference in a new issue