fix states rules not being filtered properly.

This commit is contained in:
Henry Jameson 2024-10-28 21:22:56 +02:00
parent 7314092d19
commit 3d78a7377e

View file

@ -672,8 +672,10 @@ export default {
const rule = parentComponentMatch ? r.parent : r const rule = parentComponentMatch ? r.parent : r
if (rule.component !== selectedComponentName.value) return false if (rule.component !== selectedComponentName.value) return false
if (rule.variant !== selectedVariant.value) return false if (rule.variant !== selectedVariant.value) return false
return r.state.filter(x => x !== 'normal').every(x => selectedState.has(x)) && const ruleState = new Set(rule.state.filter(x => x !== 'normal'))
[...selectedState.values()].every(x => r.state.indexOf(x) >= 0) const differenceA = [...ruleState].filter(x => !selectedState.has(x))
const differenceB = [...selectedState].filter(x => !ruleState.has(x))
return (differenceA.length + differenceB.length) === 0
}) })
const sorted = [...filtered] const sorted = [...filtered]
.filter(x => x.component === selectedComponentName.value) .filter(x => x.component === selectedComponentName.value)
@ -715,7 +717,6 @@ export default {
}) })
const dynamicVars = computed(() => { const dynamicVars = computed(() => {
console.log('ERR', selectedComponentName.value)
return previewRules.value[0].dynamicVars return previewRules.value[0].dynamicVars
}) })