@plumeria/utils 19.2.13 → 19.2.14
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/transform.d.ts +1 -0
- package/dist/transform.js +4 -3
- package/package.json +1 -1
package/dist/transform.d.ts
CHANGED
package/dist/transform.js
CHANGED
|
@@ -146,6 +146,7 @@ const foldDynamicVars = (vars) => {
|
|
|
146
146
|
};
|
|
147
147
|
const transformSource = async (env) => {
|
|
148
148
|
const { source, root, styleProp, propertyPolicy, isDev, collectOndemandSheets, addDependency, } = env;
|
|
149
|
+
const classProp = env.classProp ?? 'className';
|
|
149
150
|
const id = env.moduleId;
|
|
150
151
|
const resourcePath = env.moduleId;
|
|
151
152
|
const baseId = env.filePath;
|
|
@@ -2127,7 +2128,7 @@ const transformSource = async (env) => {
|
|
|
2127
2128
|
const attributes = jsxAttributeOwnerMap.get(node.span.start)?.attributes ?? [];
|
|
2128
2129
|
const classNameAttr = attributes.find((attr) => attr.type === 'JSXAttribute' &&
|
|
2129
2130
|
attr.name.type === 'Identifier' &&
|
|
2130
|
-
attr.name.value ===
|
|
2131
|
+
attr.name.value === classProp);
|
|
2131
2132
|
let existingClassExpr = '';
|
|
2132
2133
|
if (classNameAttr) {
|
|
2133
2134
|
replacements.push({
|
|
@@ -2186,12 +2187,12 @@ const transformSource = async (env) => {
|
|
|
2186
2187
|
replacements.push({
|
|
2187
2188
|
start: node.span.start - baseByteOffset,
|
|
2188
2189
|
end: node.span.end - baseByteOffset,
|
|
2189
|
-
content:
|
|
2190
|
+
content: `${classProp}={${replacement}}${styleAttr}`,
|
|
2190
2191
|
});
|
|
2191
2192
|
}
|
|
2192
2193
|
else {
|
|
2193
2194
|
const keptClass = existingClassExpr
|
|
2194
|
-
?
|
|
2195
|
+
? `${classProp}={${existingClassExpr}}`
|
|
2195
2196
|
: '';
|
|
2196
2197
|
replacements.push({
|
|
2197
2198
|
start: node.span.start - baseByteOffset,
|