Class: JsxRosetta::IR::CvaBinding
- Inherits:
-
Data
- Object
- Data
- JsxRosetta::IR::CvaBinding
- Includes:
- Node
- Defined in:
- lib/jsx_rosetta/ir/types.rb
Overview
A module-level call to ‘cva()` from class-variance-authority. shadcn components ubiquitously use this builder to attach a base class string plus per-axis variant maps to a JSX component. The translator recognizes the pattern at lowering time so backends can emit real Ruby constants (`FOO_BASE_CLASS`, `FOO_VARIANT_CLASSES`) instead of leaving the call as a TODO comment, and so the use-site `cn(fooVariants({ variant }), className)` translates to a proper Ruby string interpolation.
name : String — the const binding name (e.g. “buttonVariants”). base_class : String — the first string argument to cva(). variants : Hash[String => Hash[String => String]]
— { "variant" => { "default" => "...", "outline" => "..." } }
default_variants : Hash[String => String] — per-axis default value name
(matched against the variant axis keys).
compound_source : String | nil — INTENTIONALLY UNPARSED verbatim JS
source of any `compoundVariants` entry. Field name
reads structural; it isn't — backends only print
it as a TODO comment alongside the constants since
compoundVariants semantics aren't supported in the
first cut.
Instance Attribute Summary collapse
-
#base_class ⇒ Object
readonly
Returns the value of attribute base_class.
-
#compound_source ⇒ Object
readonly
Returns the value of attribute compound_source.
-
#default_variants ⇒ Object
readonly
Returns the value of attribute default_variants.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#variants ⇒ Object
readonly
Returns the value of attribute variants.
Instance Attribute Details
#base_class ⇒ Object (readonly)
Returns the value of attribute base_class
175 176 177 |
# File 'lib/jsx_rosetta/ir/types.rb', line 175 def base_class @base_class end |
#compound_source ⇒ Object (readonly)
Returns the value of attribute compound_source
175 176 177 |
# File 'lib/jsx_rosetta/ir/types.rb', line 175 def compound_source @compound_source end |
#default_variants ⇒ Object (readonly)
Returns the value of attribute default_variants
175 176 177 |
# File 'lib/jsx_rosetta/ir/types.rb', line 175 def default_variants @default_variants end |
#name ⇒ Object (readonly)
Returns the value of attribute name
175 176 177 |
# File 'lib/jsx_rosetta/ir/types.rb', line 175 def name @name end |
#variants ⇒ Object (readonly)
Returns the value of attribute variants
175 176 177 |
# File 'lib/jsx_rosetta/ir/types.rb', line 175 def variants @variants end |