@@ -45,23 +45,25 @@ export const camelToKebabCase = (property: string) => {
4545 return `.${ afterPropKebab } ` ;
4646 } ;
4747
48- if ( isHasECEType ( property ) ) {
49- const matches = property . match ( hasECERegex ) ;
50- if ( matches ) {
51- const [ , tag1 , tag2 ] = matches ;
52- const tagOrClass1 = pascalCaseHtmlTags . includes ( tag1 ) ? tag1 . toLowerCase ( ) : processAfterProp ( tag1 ) ;
53- const tagOrClass2 = pascalCaseHtmlTags . includes ( tag2 ) ? tag2 . toLowerCase ( ) : processAfterProp ( tag2 ) ;
54- return `:has(${ tagOrClass1 } > ${ tagOrClass2 } )` ;
55- }
48+ if ( property . includes ( 'hasChild' ) ) {
49+ const afterProp = property . replace ( 'hasChild' , '' ) ;
50+ const tagOrClass = pascalCaseHtmlTags . includes ( afterProp ) ? afterProp . toLowerCase ( ) : processAfterProp ( afterProp ) ;
51+ return `:has(> ${ tagOrClass } )` ;
5652 }
5753
58- if ( isHasEPEType ( property ) ) {
59- const matches = property . match ( hasEPERegex ) ;
54+ if ( property . includes ( 'hasPlus' ) ) {
55+ const afterProp = property . replace ( 'hasPlus' , '' ) ;
56+ const tagOrClass = pascalCaseHtmlTags . includes ( afterProp ) ? afterProp . toLowerCase ( ) : processAfterProp ( afterProp ) ;
57+ return `:has(+ ${ tagOrClass } )` ;
58+ }
59+
60+ if ( isHasECEType ( property ) || isHasEPEType ( property ) ) {
61+ const matches = property . match ( isHasECEType ( property ) ? hasECERegex : hasEPERegex ) ;
6062 if ( matches ) {
6163 const [ , tag1 , tag2 ] = matches ;
6264 const tagOrClass1 = pascalCaseHtmlTags . includes ( tag1 ) ? tag1 . toLowerCase ( ) : processAfterProp ( tag1 ) ;
6365 const tagOrClass2 = pascalCaseHtmlTags . includes ( tag2 ) ? tag2 . toLowerCase ( ) : processAfterProp ( tag2 ) ;
64- return `:has(${ tagOrClass1 } + ${ tagOrClass2 } )` ;
66+ return isHasECEType ( property ) ? `:has( ${ tagOrClass1 } > ${ tagOrClass2 } )` : `:has(${ tagOrClass1 } + ${ tagOrClass2 } )` ;
6567 }
6668 }
6769
@@ -81,13 +83,6 @@ export const camelToKebabCase = (property: string) => {
8183 return `:not(${ tagOrClass } )` ;
8284 }
8385 }
84- if ( prop === 'hasChild' ) {
85- return `:has(> ${ tagOrClass } )` ;
86- }
87-
88- if ( prop === 'hasPlus' ) {
89- return `:has(+ ${ tagOrClass } )` ;
90- }
9186
9287 if ( prop === 'has' ) {
9388 if ( property . includes ( 'has(' ) ) {
0 commit comments