File tree 2 files changed +18
-4
lines changed 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,5 @@ node_modules
2
2
dist
3
3
yarn.lock
4
4
package-lock.json
5
+
6
+ .idea
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ export = plugin(
4
4
function containerQueries ( { matchUtilities, matchVariant, theme } ) {
5
5
let values : Record < string , string > = theme ( 'containers' ) ?? { }
6
6
7
- function parseValue ( value : string ) {
7
+ function parseNumberValue ( value : string ) {
8
8
let numericValue = value . match ( / ^ ( \d + \. \d + | \d + | \. \d + ) \D + / ) ?. [ 1 ] ?? null
9
9
if ( numericValue === null ) return null
10
10
@@ -24,17 +24,29 @@ export = plugin(
24
24
values : {
25
25
DEFAULT : 'inline-size' ,
26
26
normal : 'normal' ,
27
+ size : 'size'
27
28
} ,
28
29
modifiers : 'any' ,
29
30
}
30
31
)
31
-
32
32
matchVariant (
33
33
'@' ,
34
34
( value = '' , { modifier } ) => {
35
- let parsed = parseValue ( value )
35
+ let parsedNumber = null ;
36
+ let parsedObject = null ;
37
+
38
+ if ( typeof value === 'object' ) {
39
+ parsedObject = JSON . parse ( JSON . stringify ( value ) ) || null ;
40
+ } else {
41
+ parsedNumber = parseNumberValue ( value ) ;
42
+ }
43
+
44
+
45
+ if ( parsedObject !== null ) {
46
+ return `@container ${ modifier ?? '' } ${ parsedObject . raw } `
47
+ }
36
48
37
- return parsed !== null ? `@container ${ modifier ?? '' } (min-width: ${ value } )` : [ ]
49
+ return parsedNumber !== null ? `@container ${ modifier ?? '' } (min-width: ${ value } )` : [ ]
38
50
} ,
39
51
{
40
52
values,
You can’t perform that action at this time.
0 commit comments