66} from '../props/selector'
77import { renderComponent , renderNode } from '../render'
88import type { NodeTree , Props } from '../types'
9+ import { getComponentPropertyDefinitions } from '../utils/get-component-property-definitions'
910import { paddingLeftMultiline } from '../utils/padding-left-multiline'
1011import { perfEnd , perfStart } from '../utils/perf'
1112import {
@@ -399,9 +400,10 @@ export class ResponsiveCodegen {
399400 componentName : string ,
400401 ) : Promise < ReadonlyArray < readonly [ string , string ] > > {
401402 // Find viewport and effect variant keys
403+ const viewportDefs = getComponentPropertyDefinitions ( componentSet )
402404 let viewportKey : string | undefined
403405 let effectKey : string | undefined
404- for ( const key in componentSet . componentPropertyDefinitions ) {
406+ for ( const key in viewportDefs ) {
405407 const lower = key . toLowerCase ( )
406408 if ( lower === 'viewport' ) viewportKey = key
407409 else if ( lower === 'effect' ) effectKey = key
@@ -413,8 +415,8 @@ export class ResponsiveCodegen {
413415
414416 // Get variants excluding viewport
415417 const variants : Record < string , string > = { }
416- for ( const name in componentSet . componentPropertyDefinitions ) {
417- const definition = componentSet . componentPropertyDefinitions [ name ]
418+ for ( const name in viewportDefs ) {
419+ const definition = viewportDefs [ name ]
418420 const lowerName = name . toLowerCase ( )
419421 if ( lowerName !== 'viewport' && lowerName !== 'effect' ) {
420422 const sanitizedName = sanitizePropertyName ( name )
@@ -550,9 +552,10 @@ export class ResponsiveCodegen {
550552 const tTotal = perfStart ( )
551553
552554 // Find viewport and effect variant keys
555+ const variantDefs = getComponentPropertyDefinitions ( componentSet )
553556 let viewportKey : string | undefined
554557 let effectKey : string | undefined
555- for ( const key in componentSet . componentPropertyDefinitions ) {
558+ for ( const key in variantDefs ) {
556559 const lower = key . toLowerCase ( )
557560 if ( lower === 'viewport' ) viewportKey = key
558561 else if ( lower === 'effect' ) effectKey = key
@@ -563,8 +566,8 @@ export class ResponsiveCodegen {
563566 const variants : Record < string , string > = { }
564567 // Map from original name to sanitized name
565568 const variantKeyToSanitized : Record < string , string > = { }
566- for ( const name in componentSet . componentPropertyDefinitions ) {
567- const definition = componentSet . componentPropertyDefinitions [ name ]
569+ for ( const name in variantDefs ) {
570+ const definition = variantDefs [ name ]
568571 if ( definition . type === 'VARIANT' ) {
569572 const lowerName = name . toLowerCase ( )
570573 // Exclude both viewport and effect from variant keys
@@ -794,8 +797,9 @@ export class ResponsiveCodegen {
794797 // Collect BOOLEAN and INSTANCE_SWAP props for the interface
795798 // (effect is handled via pseudo-selectors, VARIANT keys don't exist in effect-only path)
796799 const variants : Record < string , string > = { }
797- for ( const name in componentSet . componentPropertyDefinitions ) {
798- const definition = componentSet . componentPropertyDefinitions [ name ]
800+ const effectDefs = getComponentPropertyDefinitions ( componentSet )
801+ for ( const name in effectDefs ) {
802+ const definition = effectDefs [ name ]
799803 if ( definition . type === 'INSTANCE_SWAP' ) {
800804 variants [ sanitizePropertyName ( name ) ] = 'React.ReactNode'
801805 } else if ( definition . type === 'BOOLEAN' ) {
@@ -831,8 +835,9 @@ export class ResponsiveCodegen {
831835 }
832836
833837 // Check if componentSet has effect variant (pseudo-selector)
838+ const groupVariantDefs = getComponentPropertyDefinitions ( componentSet )
834839 let hasEffect = false
835- for ( const key in componentSet . componentPropertyDefinitions ) {
840+ for ( const key in groupVariantDefs ) {
836841 if ( key . toLowerCase ( ) === 'effect' ) {
837842 hasEffect = true
838843 break
@@ -905,7 +910,7 @@ export class ResponsiveCodegen {
905910 if ( hasEffect ) {
906911 const effectValue =
907912 variantProps [
908- Object . keys ( componentSet . componentPropertyDefinitions ) . find (
913+ Object . keys ( groupVariantDefs ) . find (
909914 ( k ) => k . toLowerCase ( ) === 'effect' ,
910915 ) || ''
911916 ]
0 commit comments