@kuma-ui/compiler
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -327,15 +327,26 @@ "use strict"; | ||
} else if (import_ts_morph7.Node.isCallExpression(tag) && tag.getExpressionIfKind(import_ts_morph7.SyntaxKind.Identifier)?.getText() === bindings["styled"]) { | ||
const className = extractClassName(node.getTemplate()); | ||
if (className) { | ||
const componentArg = tag.getArguments()[0]; | ||
const component = import_ts_morph7.Node.isStringLiteral(componentArg) ? componentArg.getLiteralText() : "div"; | ||
node.replaceWithText(`props => { | ||
const existingClassName = props.className || ""; | ||
const newClassName = "${className || ""}"; | ||
const combinedClassName = [existingClassName, newClassName].filter(Boolean).join(" "); | ||
return <${bindings["Box"]} as="${component}" {...props} className={combinedClassName} IS_KUMA_DEFAULT />; | ||
}`); | ||
const componentArg = tag.getArguments()[0]; | ||
if (import_ts_morph7.Node.isStringLiteral(componentArg)) { | ||
const componentName = componentArg.getLiteralText(); | ||
replaceTaggedTemplate(node, getBoxComponent(componentName, bindings)); | ||
} else { | ||
replaceTaggedTemplate(node, componentArg.getFullText()); | ||
} | ||
} else if (import_ts_morph7.Node.isPropertyAccessExpression(tag) && tag.getExpressionIfKind(import_ts_morph7.SyntaxKind.Identifier)?.getText() === bindings["styled"]) { | ||
replaceTaggedTemplate(node, getBoxComponent(tag.getName(), bindings)); | ||
} | ||
}; | ||
function getBoxComponent(intrinsicComponentName, bindings) { | ||
return `${bindings["Box"]} as="${intrinsicComponentName}"`; | ||
} | ||
function replaceTaggedTemplate(node, component) { | ||
const className = extractClassName(node.getTemplate()); | ||
if (className) { | ||
const replacement = `props => { | ||
const combinedClassName = [props.className, "${className}"].filter(Boolean).join(" "); | ||
return <${component} {...props} className={combinedClassName} IS_KUMA_DEFAULT />; | ||
}`; | ||
node.replaceWithText(replacement); | ||
} | ||
} | ||
@@ -342,0 +353,0 @@ // src/compile.ts |
@@ -329,15 +329,26 @@ "use strict"; | ||
} else if (import_ts_morph7.Node.isCallExpression(tag) && tag.getExpressionIfKind(import_ts_morph7.SyntaxKind.Identifier)?.getText() === bindings["styled"]) { | ||
const className = extractClassName(node.getTemplate()); | ||
if (className) { | ||
const componentArg = tag.getArguments()[0]; | ||
const component = import_ts_morph7.Node.isStringLiteral(componentArg) ? componentArg.getLiteralText() : "div"; | ||
node.replaceWithText(`props => { | ||
const existingClassName = props.className || ""; | ||
const newClassName = "${className || ""}"; | ||
const combinedClassName = [existingClassName, newClassName].filter(Boolean).join(" "); | ||
return <${bindings["Box"]} as="${component}" {...props} className={combinedClassName} IS_KUMA_DEFAULT />; | ||
}`); | ||
const componentArg = tag.getArguments()[0]; | ||
if (import_ts_morph7.Node.isStringLiteral(componentArg)) { | ||
const componentName = componentArg.getLiteralText(); | ||
replaceTaggedTemplate(node, getBoxComponent(componentName, bindings)); | ||
} else { | ||
replaceTaggedTemplate(node, componentArg.getFullText()); | ||
} | ||
} else if (import_ts_morph7.Node.isPropertyAccessExpression(tag) && tag.getExpressionIfKind(import_ts_morph7.SyntaxKind.Identifier)?.getText() === bindings["styled"]) { | ||
replaceTaggedTemplate(node, getBoxComponent(tag.getName(), bindings)); | ||
} | ||
}; | ||
function getBoxComponent(intrinsicComponentName, bindings) { | ||
return `${bindings["Box"]} as="${intrinsicComponentName}"`; | ||
} | ||
function replaceTaggedTemplate(node, component) { | ||
const className = extractClassName(node.getTemplate()); | ||
if (className) { | ||
const replacement = `props => { | ||
const combinedClassName = [props.className, "${className}"].filter(Boolean).join(" "); | ||
return <${component} {...props} className={combinedClassName} IS_KUMA_DEFAULT />; | ||
}`; | ||
node.replaceWithText(replacement); | ||
} | ||
} | ||
@@ -344,0 +355,0 @@ // src/compile.ts |
@@ -43,15 +43,26 @@ "use strict"; | ||
} else if (import_ts_morph.Node.isCallExpression(tag) && tag.getExpressionIfKind(import_ts_morph.SyntaxKind.Identifier)?.getText() === bindings["styled"]) { | ||
const className = extractClassName(node.getTemplate()); | ||
if (className) { | ||
const componentArg = tag.getArguments()[0]; | ||
const component = import_ts_morph.Node.isStringLiteral(componentArg) ? componentArg.getLiteralText() : "div"; | ||
node.replaceWithText(`props => { | ||
const existingClassName = props.className || ""; | ||
const newClassName = "${className || ""}"; | ||
const combinedClassName = [existingClassName, newClassName].filter(Boolean).join(" "); | ||
return <${bindings["Box"]} as="${component}" {...props} className={combinedClassName} IS_KUMA_DEFAULT />; | ||
}`); | ||
const componentArg = tag.getArguments()[0]; | ||
if (import_ts_morph.Node.isStringLiteral(componentArg)) { | ||
const componentName = componentArg.getLiteralText(); | ||
replaceTaggedTemplate(node, getBoxComponent(componentName, bindings)); | ||
} else { | ||
replaceTaggedTemplate(node, componentArg.getFullText()); | ||
} | ||
} else if (import_ts_morph.Node.isPropertyAccessExpression(tag) && tag.getExpressionIfKind(import_ts_morph.SyntaxKind.Identifier)?.getText() === bindings["styled"]) { | ||
replaceTaggedTemplate(node, getBoxComponent(tag.getName(), bindings)); | ||
} | ||
}; | ||
function getBoxComponent(intrinsicComponentName, bindings) { | ||
return `${bindings["Box"]} as="${intrinsicComponentName}"`; | ||
} | ||
function replaceTaggedTemplate(node, component) { | ||
const className = extractClassName(node.getTemplate()); | ||
if (className) { | ||
const replacement = `props => { | ||
const combinedClassName = [props.className, "${className}"].filter(Boolean).join(" "); | ||
return <${component} {...props} className={combinedClassName} IS_KUMA_DEFAULT />; | ||
}`; | ||
node.replaceWithText(replacement); | ||
} | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -58,0 +69,0 @@ 0 && (module.exports = { |
{ | ||
"name": "@kuma-ui/compiler", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "🐻 Kuma UI is a utility-first, zero-runtime CSS-in-JS library that offers an outstanding developer experience and optimized performance.", | ||
@@ -34,3 +34,3 @@ "repository": { | ||
"ts-pattern": "^5.0.1", | ||
"@kuma-ui/core": "^1.4.1", | ||
"@kuma-ui/core": "^1.5.0", | ||
"@kuma-ui/sheet": "^1.3.0", | ||
@@ -37,0 +37,0 @@ "@kuma-ui/system": "^1.5.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91228
2273
Updated@kuma-ui/core@^1.5.0