File tree Expand file tree Collapse file tree 7 files changed +48
-11
lines changed
Expand file tree Collapse file tree 7 files changed +48
-11
lines changed Original file line number Diff line number Diff line change 11# @tailwindcss/container-queries
22
3- A plugin that provides utilities for container queries.
4-
3+ A plugin for Tailwind CSS v3.2+ that provides utilities for container queries.
54
65## Installation
76
@@ -28,7 +27,22 @@ module.exports = {
2827
2928## Usage
3029
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+ ```
3246
3347## Configuration
3448
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 4242 "@swc/cli" : " ^0.1.57" ,
4343 "@swc/core" : " ^1.3.7" ,
4444 "@swc/jest" : " ^0.2.23" ,
45+ "@types/jest" : " ^29.1.2" ,
4546 "jest" : " ^29.1.2" ,
4647 "postcss" : " ^8.4.17" ,
4748 "prettier" : " ^2.7.1" ,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import plugin from 'tailwindcss/plugin'
22import { normalize } from 'tailwindcss/lib/util/dataTypes'
33
44export = plugin ( function containerQueries ( { matchVariant, theme } ) {
5- let values = theme ( 'containers' ) ?? { }
5+ let values : Record < string , string > = theme ( 'containers' ) ?? { }
66
77 function parseValue ( value : string ) : {
88 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'
22
33it ( 'container queries' , ( ) => {
44 let config = {
Original file line number Diff line number Diff line change 11import path from 'path'
22import postcss from 'postcss'
3- import tailwind from 'tailwindcss'
4- import containerQueries from '~ /src'
3+ import tailwind , { Config } from 'tailwindcss'
4+ import containerQueries from '.. /src'
55
66export let css = String . raw
77export let html = String . raw
88export let javascript = String . raw
99
10- export function run ( input , config , plugin = tailwind ) {
10+ export function run ( input : string , config : Config , plugin = tailwind ) {
1111 let { currentTestName } = expect . getState ( )
1212
1313 config . plugins ??= [ ]
Original file line number Diff line number Diff line change 1010 "esModuleInterop" : true ,
1111 "moduleResolution" : " node" ,
1212 "stripInternal" : true ,
13- "outDir" : " dist"
13+ "outDir" : " dist" ,
14+ "allowJs" : true ,
15+ "types" : [" ./index.d.ts" ]
1416 },
1517 "include" : [
16- " src/**/*.ts"
18+ " src/index.ts" ,
19+ " tests/index.ts"
1720 ],
1821 "exclude" : [
19- " src/**/* .test.ts"
22+ " ./tests/index .test.ts"
2023 ]
2124}
25+
You can’t perform that action at this time.
0 commit comments