use actual staticVars instead of staticPallete
This commit is contained in:
parent
3d78a7377e
commit
369ac726c0
|
@ -523,7 +523,7 @@ export default {
|
||||||
})
|
})
|
||||||
|
|
||||||
exports.computeColor = (color) => {
|
exports.computeColor = (color) => {
|
||||||
const computedColor = findColor(color, { dynamicVars: dynamicVars.value, staticVars: selectedPalette.value })
|
const computedColor = findColor(color, { dynamicVars: dynamicVars.value, staticVars: staticVars.value })
|
||||||
if (computedColor) {
|
if (computedColor) {
|
||||||
return rgb2hex(computedColor)
|
return rgb2hex(computedColor)
|
||||||
}
|
}
|
||||||
|
@ -720,6 +720,20 @@ export default {
|
||||||
return previewRules.value[0].dynamicVars
|
return previewRules.value[0].dynamicVars
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const staticVars = computed(() => {
|
||||||
|
const rootComponent = overallPreviewRules.value.find(r => {
|
||||||
|
return r.component === 'Root'
|
||||||
|
})
|
||||||
|
const rootDirectivesEntries = Object.entries(rootComponent.directives)
|
||||||
|
const directives = Object.fromEntries(
|
||||||
|
rootDirectivesEntries
|
||||||
|
.filter(([k, v]) => k.startsWith('--') && v.startsWith('color | '))
|
||||||
|
.map(([k, v]) => [k.substring(2), v.substring('color | '.length)]))
|
||||||
|
return directives
|
||||||
|
})
|
||||||
|
provide('staticVars', staticVars)
|
||||||
|
exports.staticVars = staticVars
|
||||||
|
|
||||||
const previewColors = computed(() => {
|
const previewColors = computed(() => {
|
||||||
const stacked = dynamicVars.value.stacked
|
const stacked = dynamicVars.value.stacked
|
||||||
const background = typeof stacked === 'string' ? stacked : rgb2hex(stacked)
|
const background = typeof stacked === 'string' ? stacked : rgb2hex(stacked)
|
||||||
|
|
|
@ -303,7 +303,7 @@
|
||||||
:disabled="!isShadowPresent"
|
:disabled="!isShadowPresent"
|
||||||
:no-preview="true"
|
:no-preview="true"
|
||||||
:compact="true"
|
:compact="true"
|
||||||
:static-vars="selectedPalette"
|
:static-vars="staticVars"
|
||||||
@subShadowSelected="onSubShadow"
|
@subShadowSelected="onSubShadow"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default {
|
||||||
|
|
||||||
exports.emit = emit
|
exports.emit = emit
|
||||||
exports.computeColor = inject('computeColor')
|
exports.computeColor = inject('computeColor')
|
||||||
exports.selectedPalette = inject('selectedPalette')
|
exports.staticVars = inject('staticVars')
|
||||||
|
|
||||||
const selectedVirtualDirectiveId = ref(0)
|
const selectedVirtualDirectiveId = ref(0)
|
||||||
exports.selectedVirtualDirectiveId = selectedVirtualDirectiveId
|
exports.selectedVirtualDirectiveId = selectedVirtualDirectiveId
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
<ShadowControl
|
<ShadowControl
|
||||||
v-if="selectedVirtualDirectiveValType === 'shadow'"
|
v-if="selectedVirtualDirectiveValType === 'shadow'"
|
||||||
v-model="draftVirtualDirective"
|
v-model="draftVirtualDirective"
|
||||||
:static-vars="selectedPalette"
|
:static-vars="staticVars"
|
||||||
:compact="true"
|
:compact="true"
|
||||||
/>
|
/>
|
||||||
<ColorInput
|
<ColorInput
|
||||||
|
|
Loading…
Reference in a new issue