File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
packages/transformer-attributify-jsx/src Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export interface TransformerAttributifyJsxOptions {
37
37
exclude ?: FilterPattern
38
38
}
39
39
40
- const elementRE = / < ( [ ^ > \s ] * \s ) ( (?: ' . * ?' | " . * ?" | ` . * ?` | \{ . * ?\} | [ ^ > ] * ?) * ) / g
40
+ const elementRE = / ( < \w [ \w : \. $ - ] * \s ) ( (?: ' [ ^ > ] * ?' | " [ ^ > ] * ?" | ` (?: [ ^ > ] | [ \S ] ) * ?` | \{ (?: [ ^ > ] | [ \S ] ) * ?\} | [ ^ > ] * ?) * ) / g
41
41
const attributeRE = / ( [ a - z A - Z ( ) # ] [ \[ ? a - z A - Z 0 - 9 - _ : ( ) # % \] ? ] * ) (?: \s * = \s * ( (?: ' [ ^ ' ] * ' ) | (?: " [ ^ " ] * " ) | \S + ) ) ? / g
42
42
const valuedAttributeRE = / ( (? ! \d | - { 2 } | - \d ) [ a - z A - Z 0 - 9 \u00A0 - \uFFFF - _ : ! % - .~ < ] + ) = (?: [ " ] ( [ ^ " ] * ) [ " ] | [ ' ] ( [ ^ ' ] * ) [ ' ] | [ { ] ( (?: [ ` ( ] (?: [ ^ ` ) ] * ) [ ` ) ] | [ ^ } ] ) + ) [ } ] ) / gms
43
43
@@ -85,7 +85,7 @@ export default function transformerAttributifyJsx(options: TransformerAttributif
85
85
tasks . push ( uno . parseToken ( matchedRule ) . then ( ( matched ) => {
86
86
if ( matched ) {
87
87
const tag = item [ 1 ]
88
- const startIdx = ( item . index || 0 ) + ( attr . index || 0 ) + tag . length + 1
88
+ const startIdx = ( item . index || 0 ) + ( attr . index || 0 ) + tag . length
89
89
const endIdx = startIdx + matchedRule . length
90
90
code . overwrite ( startIdx , endIdx , `${ matchedRule } =""` )
91
91
}
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ describe('transformerAttributifyJs', () => {
31
31
mr-10
32
32
className={cn({ 'c-red': variable > 0 }, 'mr-10')}
33
33
></section>
34
+ <div
35
+ label={
36
+ <b>1</b>
37
+ }
38
+ ></div>
34
39
<div absolute bottom-5 right-0 left-0 text-center op30 fw300>
35
40
on-demand · instant · fully customizable
36
41
</div>
@@ -72,6 +77,11 @@ describe('transformerAttributifyJs', () => {
72
77
mr-10=\\"\\"
73
78
className={cn({ 'c-red': variable > 0 }, 'mr-10')}
74
79
></section>
80
+ <div
81
+ label={
82
+ <b>1</b>
83
+ }
84
+ ></div>
75
85
<div absolute=\\"\\" bottom-5=\\"\\" right-0=\\"\\" left-0=\\"\\" text-center=\\"\\" op30=\\"\\" fw300=\\"\\">
76
86
on-demand · instant · fully customizable
77
87
</div>"
@@ -111,6 +121,11 @@ describe('transformerAttributifyJs', () => {
111
121
mr-10=\\"\\"
112
122
className={cn({ 'c-red': variable > 0 }, 'mr-10')}
113
123
></section>
124
+ <div
125
+ label={
126
+ <b>1</b>
127
+ }
128
+ ></div>
114
129
<div absolute bottom-5=\\"\\" right-0=\\"\\" left-0=\\"\\" text-center=\\"\\" op30=\\"\\" fw300=\\"\\">
115
130
on-demand · instant · fully customizable
116
131
</div>"
You can’t perform that action at this time.
0 commit comments