@plumeria/unplugin 18.3.16 → 18.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js CHANGED
@@ -167,18 +167,18 @@ const foldDynamicVars = (vars) => {
167
167
  return `"${cssVar}": ${value}`;
168
168
  });
169
169
  };
170
- const replaceVarValue = (style, cssVar, next) => {
170
+ const applyVarFallback = (style, cssVar, literal) => {
171
+ const reference = `var(${cssVar})`;
171
172
  for (const [prop, value] of Object.entries(style)) {
172
- if (typeof value === 'string' && value.includes(cssVar)) {
173
- style[prop] = next;
174
- return true;
173
+ if (typeof value === 'string' && value.includes(reference)) {
174
+ style[prop] = value
175
+ .split(reference)
176
+ .join(`var(${cssVar}, ${(0, zss_engine_1.applyCssValue)(literal, (0, zss_engine_1.camelToKebabCase)(prop))})`);
175
177
  }
176
- if (value !== null && typeof value === 'object') {
177
- if (replaceVarValue(value, cssVar, next))
178
- return true;
178
+ else if (value !== null && typeof value === 'object') {
179
+ applyVarFallback(value, cssVar, literal);
179
180
  }
180
181
  }
181
- return false;
182
182
  };
183
183
  const findVarProp = (style, cssVar) => {
184
184
  for (const [prop, value] of Object.entries(style)) {
@@ -1060,7 +1060,7 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
1060
1060
  : undefined;
1061
1061
  if (literal === undefined)
1062
1062
  return;
1063
- replaceVarValue(style, cssVar, `var(${cssVar}, ${(0, zss_engine_1.applyCssValue)(literal, (0, zss_engine_1.camelToKebabCase)(targetProp))})`);
1063
+ applyVarFallback(style, cssVar, literal);
1064
1064
  });
1065
1065
  const vars = [];
1066
1066
  runtime.forEach(({ param, source }) => {
package/dist/core.mjs CHANGED
@@ -131,18 +131,18 @@ const foldDynamicVars = (vars) => {
131
131
  return `"${cssVar}": ${value}`;
132
132
  });
133
133
  };
134
- const replaceVarValue = (style, cssVar, next) => {
134
+ const applyVarFallback = (style, cssVar, literal) => {
135
+ const reference = `var(${cssVar})`;
135
136
  for (const [prop, value] of Object.entries(style)) {
136
- if (typeof value === 'string' && value.includes(cssVar)) {
137
- style[prop] = next;
138
- return true;
137
+ if (typeof value === 'string' && value.includes(reference)) {
138
+ style[prop] = value
139
+ .split(reference)
140
+ .join(`var(${cssVar}, ${applyCssValue(literal, camelToKebabCase(prop))})`);
139
141
  }
140
- if (value !== null && typeof value === 'object') {
141
- if (replaceVarValue(value, cssVar, next))
142
- return true;
142
+ else if (value !== null && typeof value === 'object') {
143
+ applyVarFallback(value, cssVar, literal);
143
144
  }
144
145
  }
145
- return false;
146
146
  };
147
147
  const findVarProp = (style, cssVar) => {
148
148
  for (const [prop, value] of Object.entries(style)) {
@@ -1024,7 +1024,7 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
1024
1024
  : undefined;
1025
1025
  if (literal === undefined)
1026
1026
  return;
1027
- replaceVarValue(style, cssVar, `var(${cssVar}, ${applyCssValue(literal, camelToKebabCase(targetProp))})`);
1027
+ applyVarFallback(style, cssVar, literal);
1028
1028
  });
1029
1029
  const vars = [];
1030
1030
  runtime.forEach(({ param, source }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/unplugin",
3
- "version": "18.3.16",
3
+ "version": "18.3.17",
4
4
  "description": "Universal Plumeria plugin for various build tools",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -94,7 +94,7 @@
94
94
  "dependencies": {
95
95
  "@rollup/pluginutils": "^5.4.0",
96
96
  "unplugin": "^3.0.0",
97
- "@plumeria/utils": "^18.3.16"
97
+ "@plumeria/utils": "^18.3.17"
98
98
  },
99
99
  "devDependencies": {
100
100
  "@swc/core": "1.15.47",