no more side effects, virtual components have their own css rules
instead of updating lower level
This commit is contained in:
parent
9a24d21bbd
commit
adc47ad38a
|
@ -148,7 +148,6 @@ export const init = (extraRuleset, ultimateBackgroundColor) => {
|
||||||
const staticVars = {}
|
const staticVars = {}
|
||||||
const stacked = {}
|
const stacked = {}
|
||||||
const computed = {}
|
const computed = {}
|
||||||
const rules = []
|
|
||||||
|
|
||||||
const rulesetUnsorted = [
|
const rulesetUnsorted = [
|
||||||
...Object.values(components)
|
...Object.values(components)
|
||||||
|
@ -261,21 +260,24 @@ export const init = (extraRuleset, ultimateBackgroundColor) => {
|
||||||
intendedTextColor,
|
intendedTextColor,
|
||||||
newTextRule.directives.textAuto === 'preserve'
|
newTextRule.directives.textAuto === 'preserve'
|
||||||
)
|
)
|
||||||
|
const virtualDirectives = computed[lowerLevelSelector].virtualDirectives || {}
|
||||||
// Updating previously added rule
|
const virtualDirectivesRaw = computed[lowerLevelSelector].virtualDirectivesRaw || {}
|
||||||
const earlyLowerLevelRules = rules.filter(findRules(combination.parent, true))
|
|
||||||
const earlyLowerLevelRule = earlyLowerLevelRules.slice(-1)[0]
|
|
||||||
|
|
||||||
const virtualDirectives = earlyLowerLevelRule.virtualDirectives || {}
|
|
||||||
const virtualDirectivesRaw = earlyLowerLevelRule.virtualDirectivesRaw || {}
|
|
||||||
|
|
||||||
// Storing color data in lower layer to use as custom css properties
|
// Storing color data in lower layer to use as custom css properties
|
||||||
virtualDirectives[virtualName] = getTextColorAlpha(newTextRule.directives, textColor, dynamicVars)
|
virtualDirectives[virtualName] = getTextColorAlpha(newTextRule.directives, textColor, dynamicVars)
|
||||||
virtualDirectivesRaw[virtualName] = textColor
|
virtualDirectivesRaw[virtualName] = textColor
|
||||||
earlyLowerLevelRule.virtualDirectives = virtualDirectives
|
|
||||||
earlyLowerLevelRule.virtualDirectivesRaw = virtualDirectivesRaw
|
|
||||||
computed[lowerLevelSelector].virtualDirectives = virtualDirectives
|
computed[lowerLevelSelector].virtualDirectives = virtualDirectives
|
||||||
computed[lowerLevelSelector].virtualDirectivesRaw = virtualDirectivesRaw
|
computed[lowerLevelSelector].virtualDirectivesRaw = virtualDirectivesRaw
|
||||||
|
|
||||||
|
return {
|
||||||
|
dynamicVars,
|
||||||
|
selector: cssSelector.split(/ /g).slice(0, -1).join(' '),
|
||||||
|
...combination,
|
||||||
|
directives: {},
|
||||||
|
virtualDirectives,
|
||||||
|
virtualDirectivesRaw
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
computed[selector] = computed[selector] || {}
|
computed[selector] = computed[selector] || {}
|
||||||
|
|
||||||
|
@ -377,7 +379,6 @@ export const init = (extraRuleset, ultimateBackgroundColor) => {
|
||||||
directives: computedDirectives
|
directives: computedDirectives
|
||||||
}
|
}
|
||||||
|
|
||||||
rules.push(rule)
|
|
||||||
return rule
|
return rule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue