File tree 7 files changed +48
-11
lines changed
7 files changed +48
-11
lines changed Original file line number Diff line number Diff line change 1
1
# @tailwindcss/container-queries
2
2
3
- A plugin that provides utilities for container queries.
4
-
3
+ A plugin for Tailwind CSS v3.2+ that provides utilities for container queries.
5
4
6
5
## Installation
7
6
@@ -28,7 +27,22 @@ module.exports = {
28
27
29
28
## Usage
30
29
31
- TODO
30
+ ``` html
31
+ <!-- Container queries without a specific container name -->
32
+ <div >
33
+ <!-- Container query with a size of `lg` defined in your tailwind.config.js file -->
34
+ <div class =" @lg:underline" ></div >
35
+ <div class =" @[(min-width:_1024px)]:underline" ></div >
36
+ <div class =" @[1024px]:underline" ></div >
37
+ </div >
38
+
39
+ <!-- Container queries that apply for a defined container name -->
40
+ <div class =" container/sidebar" >
41
+ <div class =" @lg/sidebar:underline" ></div >
42
+ <div class =" @[(min-width:_1024px)]/sidebar:underline" ></div >
43
+ <div class =" @[1024px]/sidebar:underline" ></div >
44
+ </div >
45
+ ```
32
46
33
47
## Configuration
34
48
Original file line number Diff line number Diff line change
1
+ declare global {
2
+ namespace jest {
3
+ interface Matchers < R > {
4
+ toMatchFormattedCss ( expected : string ) : CustomMatcherResult
5
+ }
6
+ }
7
+ }
8
+
9
+ declare module 'tailwindcss' {
10
+ export interface Config {
11
+ theme : {
12
+ /** Container queries */
13
+ containers : Record < string , string >
14
+ }
15
+ }
16
+ }
17
+
18
+ export { }
Original file line number Diff line number Diff line change 42
42
"@swc/cli" : " ^0.1.57" ,
43
43
"@swc/core" : " ^1.3.7" ,
44
44
"@swc/jest" : " ^0.2.23" ,
45
+ "@types/jest" : " ^29.1.2" ,
45
46
"jest" : " ^29.1.2" ,
46
47
"postcss" : " ^8.4.17" ,
47
48
"prettier" : " ^2.7.1" ,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import plugin from 'tailwindcss/plugin'
2
2
import { normalize } from 'tailwindcss/lib/util/dataTypes'
3
3
4
4
export = plugin ( function containerQueries ( { matchVariant, theme } ) {
5
- let values = theme ( 'containers' ) ?? { }
5
+ let values : Record < string , string > = theme ( 'containers' ) ?? { }
6
6
7
7
function parseValue ( value : string ) : {
8
8
raw : string
Original file line number Diff line number Diff line change 1
- import { html , css , run } from '~/jest /run'
1
+ import { html , css , run } from '. /run'
2
2
3
3
it ( 'container queries' , ( ) => {
4
4
let config = {
Original file line number Diff line number Diff line change 1
1
import path from 'path'
2
2
import postcss from 'postcss'
3
- import tailwind from 'tailwindcss'
4
- import containerQueries from '~ /src'
3
+ import tailwind , { Config } from 'tailwindcss'
4
+ import containerQueries from '.. /src'
5
5
6
6
export let css = String . raw
7
7
export let html = String . raw
8
8
export let javascript = String . raw
9
9
10
- export function run ( input , config , plugin = tailwind ) {
10
+ export function run ( input : string , config : Config , plugin = tailwind ) {
11
11
let { currentTestName } = expect . getState ( )
12
12
13
13
config . plugins ??= [ ]
Original file line number Diff line number Diff line change 10
10
"esModuleInterop" : true ,
11
11
"moduleResolution" : " node" ,
12
12
"stripInternal" : true ,
13
- "outDir" : " dist"
13
+ "outDir" : " dist" ,
14
+ "allowJs" : true ,
15
+ "types" : [" ./index.d.ts" ]
14
16
},
15
17
"include" : [
16
- " src/**/*.ts"
18
+ " src/index.ts" ,
19
+ " tests/index.ts"
17
20
],
18
21
"exclude" : [
19
- " src/**/* .test.ts"
22
+ " ./tests/index .test.ts"
20
23
]
21
24
}
25
+
You can’t perform that action at this time.
0 commit comments