@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.
@@ -5,6 +5,7 @@ export type TransformEnv = {
5
5
  filePath: string;
6
6
  root: string;
7
7
  styleProp: string;
8
+ classProp?: string;
8
9
  propertyPolicy: PropertyPolicy | undefined;
9
10
  isDev: boolean;
10
11
  collectOndemandSheets: boolean;
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 === 'className');
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: `className={${replacement}}${styleAttr}`,
2190
+ content: `${classProp}={${replacement}}${styleAttr}`,
2190
2191
  });
2191
2192
  }
2192
2193
  else {
2193
2194
  const keptClass = existingClassExpr
2194
- ? `className={${existingClassExpr}}`
2195
+ ? `${classProp}={${existingClassExpr}}`
2195
2196
  : '';
2196
2197
  replacements.push({
2197
2198
  start: node.span.start - baseByteOffset,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/utils",
3
- "version": "19.2.13",
3
+ "version": "19.2.14",
4
4
  "description": "Plumeria Utils",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",