Update sharedUtils.js

pull/5507/head
mertsincan 2024-01-03 13:41:10 +00:00
parent 0837cfb54a
commit ba6d3ff893
1 changed files with 3 additions and 1 deletions

View File

@ -74,13 +74,15 @@ export default {
if (this.isString(value)) {
const regex = /{([^}]*)}/g;
const val = value.trim();
const px = prefix.trim();
if (this.test(regex, val)) {
const computedPx = this.isNotEmpty(px) ? `${px}-` : px;
const _val = val.replaceAll(regex, (v) => {
const path = v.replace(/{|}/g, '');
const keys = path.split('.').filter((_v) => !excludedKeyRegexes.some((_r) => this.test(_r, _v)));
return `var(--${prefix}-${this.toKebabCase(keys.join('-'))})`;
return `var(--${computedPx}${this.toKebabCase(keys.join('-'))})`;
});
const calculationRegex = /(\d+\s+[\+\-\*\/]\s+\d+)/g;