-
@@ -89,19 +91,13 @@ If you have configured Tailwind to use a prefix, make sure to prefix both the `@
By default we ship with the following configured values:
-| Name | CSS |
-| ------ | -------------------------------------------- |
-| `@xs` | `@container (min-width: 20rem /* 320px */)` |
-| `@sm` | `@container (min-width: 24rem /* 384px */)` |
-| `@md` | `@container (min-width: 28rem /* 448px */)` |
-| `@lg` | `@container (min-width: 32rem /* 512px */)` |
-| `@xl` | `@container (min-width: 36rem /* 576px */)` |
-| `@2xl` | `@container (min-width: 42rem /* 672px */)` |
-| `@3xl` | `@container (min-width: 48rem /* 768px */)` |
-| `@4xl` | `@container (min-width: 56rem /* 896px */)` |
-| `@5xl` | `@container (min-width: 64rem /* 1024px */)` |
-| `@6xl` | `@container (min-width: 72rem /* 1152px */)` |
-| `@7xl` | `@container (min-width: 80rem /* 1280px */)` |
+| Name | CSS |
+| -------- | -------------------------------------------- |
+| `qc-sm` | `@container (min-width: 640px)` |
+| `qc-md` | `@container (min-width: 768px)` |
+| `qc-lg` | `@container (min-width: 1024px)` |
+| `qc-xl` | `@container (min-width: 1280px)` |
+| `qc-2xl` | `@container (min-width: 1536px)` |
You can configure which values are available for this plugin under the `containers` key in your `tailwind.config.js` file:
diff --git a/package.json b/package.json
index 7cab5f6..ad920d4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@krzysztof318/tw-container-queries",
- "version": "0.1.2",
+ "version": "0.2.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
diff --git a/src/index.ts b/src/index.ts
index 84b9869..c502b3a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -13,7 +13,7 @@ export = plugin(
matchUtilities(
{
- '@container': (value, { modifier }) => {
+ 'qc-container': (value, { modifier }) => {
return {
'container-type': value,
'container-name': modifier,
@@ -30,7 +30,7 @@ export = plugin(
)
matchVariant(
- '@',
+ 'qc-',
(value = '', { modifier }) => {
let parsed = parseValue(value)
@@ -68,17 +68,11 @@ export = plugin(
{
theme: {
containers: {
- xs: '20rem',
- sm: '24rem',
- md: '28rem',
- lg: '32rem',
- xl: '36rem',
- '2xl': '42rem',
- '3xl': '48rem',
- '4xl': '56rem',
- '5xl': '64rem',
- '6xl': '72rem',
- '7xl': '80rem',
+ sm: '640px',
+ md: '768px',
+ lg: '1024px',
+ xl: '1280px',
+ '2xl': '1536px',
},
},
}
diff --git a/tests/index.test.ts b/tests/index.test.ts
index 077b628..f5da801 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -7,29 +7,29 @@ it('container queries', () => {
{
raw: html`
`,
},
@@ -50,116 +50,116 @@ it('container queries', () => {
return run(input, config).then((result) => {
expect(result.css).toMatchFormattedCss(css`
- .\@container {
+ .qc-container {
container-type: inline-size;
}
- .\@container-normal {
+ .qc-container-normal {
container-type: normal;
}
- .\@container\/sidebar {
+ .qc-container\/sidebar {
container-type: inline-size;
container-name: sidebar;
}
- .\@container-normal\/sidebar {
+ .qc-container-normal\/sidebar {
container-type: normal;
container-name: sidebar;
}
@container (min-width: 123px) {
- .\@\[123px\]\:underline {
+ .qc-\[123px\]\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 200rem) {
- .\@\[200rem\]\:underline {
+ .qc-\[200rem\]\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 312px) {
- .\@\[312px\]\:underline {
+ .qc-\[312px\]\:underline {
text-decoration-line: underline;
}
}
@container container1 (min-width: 320px) {
- .\@sm\/container1\:underline {
+ .qc-sm\/container1\:underline {
text-decoration-line: underline;
}
}
@container container2 (min-width: 320px) {
- .\@sm\/container2\:underline {
+ .qc-sm\/container2\:underline {
text-decoration-line: underline;
}
}
@container container10 (min-width: 320px) {
- .\@sm\/container10\:underline {
+ .qc-sm\/container10\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 320px) {
- .\@sm\:underline {
+ .qc-sm\:underline {
text-decoration-line: underline;
}
}
@container container1 (min-width: 768px) {
- .\@md\/container1\:underline {
+ .qc-md\/container1\:underline {
text-decoration-line: underline;
}
}
@container container2 (min-width: 768px) {
- .\@md\/container2\:underline {
+ .qc-md\/container2\:underline {
text-decoration-line: underline;
}
}
@container container10 (min-width: 768px) {
- .\@md\/container10\:underline {
+ .qc-md\/container10\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 768px) {
- .\@md\:underline {
+ .qc-md\:underline {
text-decoration-line: underline;
}
}
@container container1 (min-width: 1024px) {
- .\@lg\/container1\:underline {
+ .qc-lg\/container1\:underline {
text-decoration-line: underline;
}
- .\@\[1024px\]\/container1\:underline {
+ .qc-\[1024px\]\/container1\:underline {
text-decoration-line: underline;
}
}
@container container2 (min-width: 1024px) {
- .\@lg\/container2\:underline {
+ .qc-lg\/container2\:underline {
text-decoration-line: underline;
}
}
@container container10 (min-width: 1024px) {
- .\@lg\/container10\:underline {
+ .qc-lg\/container10\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 1024px) {
- .\@lg\:underline {
+ .qc-lg\:underline {
text-decoration-line: underline;
}
- .\@\[1024px\]\:underline {
+ .qc-\[1024px\]\:underline {
text-decoration-line: underline;
}
}
@@ -173,14 +173,11 @@ it('should be possible to use default container queries', () => {
{
raw: html`
-
-
-
-
-
-
-
-
+
+
+
+
+
`,
},
@@ -196,49 +193,49 @@ it('should be possible to use default container queries', () => {
return run(input, config).then((result) => {
expect(result.css).toMatchFormattedCss(css`
@container (min-width: 20rem) {
- .\@xs\:underline {
+ .qc-xs\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 24rem) {
- .\@sm\:underline {
+ .qc-sm\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 28rem) {
- .\@md\:underline {
+ .qc-md\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 32rem) {
- .\@lg\:underline {
+ .qc-lg\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 48rem) {
- .\@3xl\:underline {
+ .qc-3xl\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 64rem) {
- .\@5xl\:underline {
+ .qc-5xl\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 72rem) {
- .\@6xl\:underline {
+ .qc-6xl\:underline {
text-decoration-line: underline;
}
}
@container (min-width: 80rem) {
- .\@7xl\:underline {
+ .qc-7xl\:underline {
text-decoration-line: underline;
}
}
From c6c07e89da4b2489164513b5c54e4545a9e2b2b2 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 19:45:44 +0200
Subject: [PATCH 06/36] Fixed tests
---
tests/index.test.ts | 40 +++++++++++-----------------------------
1 file changed, 11 insertions(+), 29 deletions(-)
diff --git a/tests/index.test.ts b/tests/index.test.ts
index f5da801..d9c5438 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -86,25 +86,25 @@ it('container queries', () => {
}
}
- @container container1 (min-width: 320px) {
+ @container container1 (min-width: 640px) {
.qc-sm\/container1\:underline {
text-decoration-line: underline;
}
}
- @container container2 (min-width: 320px) {
+ @container container2 (min-width: 640px) {
.qc-sm\/container2\:underline {
text-decoration-line: underline;
}
}
- @container container10 (min-width: 320px) {
+ @container container10 (min-width: 640px) {
.qc-sm\/container10\:underline {
text-decoration-line: underline;
}
}
- @container (min-width: 320px) {
+ @container (min-width: 640px) {
.qc-sm\:underline {
text-decoration-line: underline;
}
@@ -192,50 +192,32 @@ it('should be possible to use default container queries', () => {
return run(input, config).then((result) => {
expect(result.css).toMatchFormattedCss(css`
- @container (min-width: 20rem) {
- .qc-xs\:underline {
- text-decoration-line: underline;
- }
- }
-
- @container (min-width: 24rem) {
+ @container (min-width: 640px) {
.qc-sm\:underline {
text-decoration-line: underline;
}
}
- @container (min-width: 28rem) {
+ @container (min-width: 768px) {
.qc-md\:underline {
text-decoration-line: underline;
}
}
- @container (min-width: 32rem) {
+ @container (min-width: 1024px) {
.qc-lg\:underline {
text-decoration-line: underline;
}
}
- @container (min-width: 48rem) {
- .qc-3xl\:underline {
- text-decoration-line: underline;
- }
- }
-
- @container (min-width: 64rem) {
- .qc-5xl\:underline {
- text-decoration-line: underline;
- }
- }
-
- @container (min-width: 72rem) {
- .qc-6xl\:underline {
+ @container (min-width: 1280px) {
+ .qc-xl\:underline {
text-decoration-line: underline;
}
}
- @container (min-width: 80rem) {
- .qc-7xl\:underline {
+ @container (min-width: 1536px) {
+ .qc-2xl\:underline {
text-decoration-line: underline;
}
}
From c8afa2faaf5805f1c2fe7cb191c7a3ac81237aaa Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 19:54:09 +0200
Subject: [PATCH 07/36] Fixed test again...
---
tests/index.test.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/index.test.ts b/tests/index.test.ts
index d9c5438..91d45db 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -36,7 +36,7 @@ it('container queries', () => {
],
theme: {
containers: {
- sm: '320px',
+ sm: '640px',
md: '768px',
lg: '1024px',
},
From 73ff9651cc2d1d6d7502cdbb0c73940244b6dab8 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 20:07:40 +0200
Subject: [PATCH 08/36] Minor
---
src/index.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/index.ts b/src/index.ts
index c502b3a..0932461 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -30,7 +30,7 @@ export = plugin(
)
matchVariant(
- 'qc-',
+ 'qc',
(value = '', { modifier }) => {
let parsed = parseValue(value)
From ab56515c53fb8ecaa9569fc86625b0d868ed4c5c Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 20:19:01 +0200
Subject: [PATCH 09/36] test fix?
---
tests/index.test.ts | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/index.test.ts b/tests/index.test.ts
index 91d45db..3ad1e06 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -68,6 +68,11 @@ it('container queries', () => {
container-name: sidebar;
}
+ .qc-container-\[size\]\/sidebar {
+ container-type: size;
+ container-name: sidebar;
+ }
+
@container (min-width: 123px) {
.qc-\[123px\]\:underline {
text-decoration-line: underline;
From a42d9d493efc6832b3b190a605cd889c96931b25 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 21:50:59 +0200
Subject: [PATCH 10/36] Added max & range containers.
---
CHANGELOG.md | 4 +++
README.md | 40 ++++++++++++++++++++------
package.json | 2 +-
src/index.ts | 62 +++++++++++++++++++++++++--------------
tests/index.test.ts | 70 +++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 147 insertions(+), 31 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a10fb0a..42fb8ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Nothing yet!
+## [0.2.1] - 2023-10-25
+
+- Added suport for max values and ranges
+
## [0.2.0] - 2023-10-25
- Updated package.json after fork
diff --git a/README.md b/README.md
index 6a9145d..7b61023 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
A plugin for Tailwind CSS v3.2+ that provides utilities for container queries.
This is fork of original repo https://github.com/tailwindlabs/tailwindcss-container-queries
-I modificated prefix '@' to 'qc-' so now it works better with Razor syntax and I changed default breakpoints to same as tailwind breakpoints.
+I modificated prefix '@' to 'qc-' so now it works better with Razor syntax and I changed default breakpoints to same as tailwind breakpoints. This version also have max and range modifiers.
## Installation
@@ -34,13 +34,37 @@ Start by marking an element as a container using the `qc-container` class, and t
```html
```
By default we provide [container sizes](#configuration) from `qc-sm` (`640px`) to `qc-2xl` (`1536px`).
+### Max modifiers
+
+You can mark an element with `qc-max-{breakpoint}` class, for example `qc-max-md` (width < 768px), `qc-max-lg` (width < 1024px>).
+
+```html
+
+```
+
+### Range modifiers
+
+You can mark an element with `qc-{breakpoint}:qc-max-{breakpoint}` class, for example `qc-sm:qc-max-lg` (min-width: 640px and width < 1024px).
+
+```html
+
+```
+
### Named containers
You can optionally name containers using a `qc-container/{name}` class, and then include that name in the container variants using classes like `qc-lg/{name}:underline`:
@@ -49,7 +73,7 @@ You can optionally name containers using a `qc-container/{name}` class, and then
```
@@ -93,11 +117,11 @@ By default we ship with the following configured values:
| Name | CSS |
| -------- | -------------------------------------------- |
-| `qc-sm` | `@container (min-width: 640px)` |
-| `qc-md` | `@container (min-width: 768px)` |
-| `qc-lg` | `@container (min-width: 1024px)` |
-| `qc-xl` | `@container (min-width: 1280px)` |
-| `qc-2xl` | `@container (min-width: 1536px)` |
+| `qc-sm` | `@container (min-width: 640px)` |
+| `qc-md` | `@container (min-width: 768px)` |
+| `qc-lg` | `@container (min-width: 1024px)` |
+| `qc-xl` | `@container (min-width: 1280px)` |
+| `qc-2xl` | `@container (min-width: 1536px)` |
You can configure which values are available for this plugin under the `containers` key in your `tailwind.config.js` file:
diff --git a/package.json b/package.json
index ad920d4..9f4e7e4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@krzysztof318/tw-container-queries",
- "version": "0.2.0",
+ "version": "0.2.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
diff --git a/src/index.ts b/src/index.ts
index 0932461..c343807 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -29,6 +29,34 @@ export = plugin(
}
)
+ const sort: (
+ a: { value: string; modifier: string | null },
+ b: { value: string; modifier: string | null }
+ ) => number = (aVariant, zVariant) => {
+ let a = parseFloat(aVariant.value)
+ let z = parseFloat(zVariant.value)
+
+ if (a === null || z === null) return 0
+
+ // Sort values themselves regardless of unit
+ if (a - z !== 0) return a - z
+
+ let aLabel = aVariant.modifier ?? ''
+ let zLabel = zVariant.modifier ?? ''
+
+ // Explicitly move empty labels to the end
+ if (aLabel === '' && zLabel !== '') {
+ return 1
+ } else if (aLabel !== '' && zLabel === '') {
+ return -1
+ }
+
+ // Sort labels alphabetically in the English locale
+ // We are intentionally overriding the locale because we do not want the sort to
+ // be affected by the machine's locale (be it a developer or CI environment)
+ return aLabel.localeCompare(zLabel, 'en', { numeric: true })
+ }
+
matchVariant(
'qc',
(value = '', { modifier }) => {
@@ -38,30 +66,20 @@ export = plugin(
},
{
values,
- sort(aVariant, zVariant) {
- let a = parseFloat(aVariant.value)
- let z = parseFloat(zVariant.value)
-
- if (a === null || z === null) return 0
-
- // Sort values themselves regardless of unit
- if (a - z !== 0) return a - z
-
- let aLabel = aVariant.modifier ?? ''
- let zLabel = zVariant.modifier ?? ''
+ sort,
+ }
+ )
- // Explicitly move empty labels to the end
- if (aLabel === '' && zLabel !== '') {
- return 1
- } else if (aLabel !== '' && zLabel === '') {
- return -1
- }
+ matchVariant(
+ 'qc-max',
+ (value = '', { modifier }) => {
+ let parsed = parseValue(value)
- // Sort labels alphabetically in the English locale
- // We are intentionally overriding the locale because we do not want the sort to
- // be affected by the machine's locale (be it a developer or CI environment)
- return aLabel.localeCompare(zLabel, 'en', { numeric: true })
- },
+ return parsed !== null ? `@container ${modifier ?? ''} (width < ${value})` : []
+ },
+ {
+ values,
+ sort,
}
)
},
diff --git a/tests/index.test.ts b/tests/index.test.ts
index 3ad1e06..570c84f 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -229,3 +229,73 @@ it('should be possible to use default container queries', () => {
`)
})
})
+
+it('container max & range queries', () => {
+ let config = {
+ content: [
+ {
+ raw: html`
+
+ `,
+ },
+ ],
+ theme: {
+ containers: {
+ sm: '640px',
+ md: '768px',
+ lg: '1024px',
+ xl: '1280px',
+ '2xl': '1536px',
+ },
+ },
+ corePlugins: { preflight: false },
+ }
+
+ let input = css`
+ @tailwind utilities;
+ `
+
+ return run(input, config).then((result) => {
+ expect(result.css).toMatchFormattedCss(css`
+ .qc-container {
+ container-type: inline-size;
+ }
+
+ @container (width < 1024px) {
+ .qc-max-lg\:underline {
+ text-decoration-line: underline;
+ }
+ }
+
+ @container (width < 1280px) {
+ .qc-max-xl\:underline {
+ text-decoration-line: underline;
+ }
+ }
+
+ @container (min-width: 640px) {
+ @container (width < 1024px) {
+ .qc-sm\:qc-max-lg\:underline {
+ text-decoration-line: underline;
+ }
+ }
+ }
+
+ @container container1 (min-width: 768px) {
+ @container container1 (width < 1280px) {
+ .qc-md\/container1\:qc-max-xl\/container1\:underline {
+ text-decoration-line: underline;
+ }
+ }
+ }
+ `)
+ })
+})
\ No newline at end of file
From e923c5ab0133d6bbf8a3f49b6018b58568c5928e Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 20:49:40 +0000
Subject: [PATCH 11/36] Fixed sorting modifiers
---
src/index.ts | 34 +++++++++++++++++++++++++++++++---
tests/index.test.ts | 22 +++++++++++-----------
2 files changed, 42 insertions(+), 14 deletions(-)
diff --git a/src/index.ts b/src/index.ts
index c343807..040bcf1 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -29,7 +29,7 @@ export = plugin(
}
)
- const sort: (
+ const sortMin: (
a: { value: string; modifier: string | null },
b: { value: string; modifier: string | null }
) => number = (aVariant, zVariant) => {
@@ -57,6 +57,34 @@ export = plugin(
return aLabel.localeCompare(zLabel, 'en', { numeric: true })
}
+ const sortMax: (
+ a: { value: string; modifier: string | null },
+ b: { value: string; modifier: string | null }
+ ) => number = (aVariant, zVariant) => {
+ let a = parseFloat(aVariant.value)
+ let z = parseFloat(zVariant.value)
+
+ if (a === null || z === null) return 0
+
+ // Sort values themselves regardless of unit
+ if (z - a !== 0) return z - a
+
+ let aLabel = aVariant.modifier ?? ''
+ let zLabel = zVariant.modifier ?? ''
+
+ // Explicitly move empty labels to the end
+ if (aLabel === '' && zLabel !== '') {
+ return 1
+ } else if (aLabel !== '' && zLabel === '') {
+ return -1
+ }
+
+ // Sort labels opposite to alphabetically in the English locale
+ // We are intentionally overriding the locale because we do not want the sort to
+ // be affected by the machine's locale (be it a developer or CI environment)
+ return zLabel.localeCompare(aLabel, 'en', { numeric: true })
+ }
+
matchVariant(
'qc',
(value = '', { modifier }) => {
@@ -66,7 +94,7 @@ export = plugin(
},
{
values,
- sort,
+ sort: sortMin,
}
)
@@ -79,7 +107,7 @@ export = plugin(
},
{
values,
- sort,
+ sort: sortMax,
}
)
},
diff --git a/tests/index.test.ts b/tests/index.test.ts
index 570c84f..56cba47 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -269,9 +269,11 @@ it('container max & range queries', () => {
container-type: inline-size;
}
- @container (width < 1024px) {
- .qc-max-lg\:underline {
- text-decoration-line: underline;
+ @container container1 (min-width: 768px) {
+ @container container1 (width < 1280px) {
+ .qc-md\/container1\:qc-max-xl\/container1\:underline {
+ text-decoration-line: underline;
+ }
}
}
@@ -281,17 +283,15 @@ it('container max & range queries', () => {
}
}
- @container (min-width: 640px) {
- @container (width < 1024px) {
- .qc-sm\:qc-max-lg\:underline {
- text-decoration-line: underline;
- }
+ @container (width < 1024px) {
+ .qc-max-lg\:underline {
+ text-decoration-line: underline;
}
}
- @container container1 (min-width: 768px) {
- @container container1 (width < 1280px) {
- .qc-md\/container1\:qc-max-xl\/container1\:underline {
+ @container (min-width: 640px) {
+ @container (width < 1024px) {
+ .qc-sm\:qc-max-lg\:underline {
text-decoration-line: underline;
}
}
From b5651d987b9cc85bbdc278e759b19484522f5efd Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 22:55:13 +0200
Subject: [PATCH 12/36] updated changelog
---
CHANGELOG.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 42fb8ad..de19bfa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,4 +19,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changed '@' to 'qc-'
- Changed breakpoints to same as in tailwind
-[unreleased]: https://github.com/tailwindlabs/tailwindcss-container-queries/compare/v0.1.1...HEAD
+[unreleased]: https://github.com/Krzysztof318/tailwindcss-container-queries/compare/v0.2.1...HEAD
+[0.2.1]: https://github.com/tailwindlabs/tailwindcss-container-queries/compare/v0.2.0...v0.2.1
+[0.2.0]: https://github.com/tailwindlabs/tailwindcss-container-queries/releases/tag/v0.2.0
\ No newline at end of file
From 2135d644daa2b83a6cdbe1ca37575fc0b8bd6ac0 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 22:56:05 +0200
Subject: [PATCH 13/36] Updated changelog
---
CHANGELOG.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de19bfa..b6cd64c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,5 +20,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changed breakpoints to same as in tailwind
[unreleased]: https://github.com/Krzysztof318/tailwindcss-container-queries/compare/v0.2.1...HEAD
-[0.2.1]: https://github.com/tailwindlabs/tailwindcss-container-queries/compare/v0.2.0...v0.2.1
-[0.2.0]: https://github.com/tailwindlabs/tailwindcss-container-queries/releases/tag/v0.2.0
\ No newline at end of file
+[0.2.1]: https://github.com/Krzysztof318/tailwindcss-container-queries/compare/v0.2.0...v0.2.1
+[0.2.0]: https://github.com/Krzysztof318/tailwindcss-container-queries/releases/tag/v0.2.0
\ No newline at end of file
From 9b4c556df2680e60456dc4ee8ab965e75a870e64 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 23:39:07 +0200
Subject: [PATCH 14/36] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 7b61023..8401a1b 100644
--- a/README.md
+++ b/README.md
@@ -113,7 +113,7 @@ If you have configured Tailwind to use a prefix, make sure to prefix both the `q
## Configuration
-By default we ship with the following configured values:
+By default we ship with the following configured breakpoints:
| Name | CSS |
| -------- | -------------------------------------------- |
From 122683d7e7c34607942ec0efd88a495c122433d3 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 23:42:58 +0200
Subject: [PATCH 15/36] Update README.md
---
README.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 8401a1b..7640836 100644
--- a/README.md
+++ b/README.md
@@ -115,13 +115,13 @@ If you have configured Tailwind to use a prefix, make sure to prefix both the `q
By default we ship with the following configured breakpoints:
-| Name | CSS |
-| -------- | -------------------------------------------- |
-| `qc-sm` | `@container (min-width: 640px)` |
-| `qc-md` | `@container (min-width: 768px)` |
-| `qc-lg` | `@container (min-width: 1024px)` |
-| `qc-xl` | `@container (min-width: 1280px)` |
-| `qc-2xl` | `@container (min-width: 1536px)` |
+| Name | CSS | Name | CSS |
+| -------- | -------------------------------------------- | ------------ | -------------------------------------------- |
+| `qc-sm` | `@container (min-width: 640px)` | `qc-max-sm` | `@container (width < 640px)` |
+| `qc-md` | `@container (min-width: 768px)` | `qc-max-md` | `@container (width < 768px)` |
+| `qc-lg` | `@container (min-width: 1024px)` | `qc-max-lg` | `@container (width < 1024px)` |
+| `qc-xl` | `@container (min-width: 1280px)` | `qc-max-xl` | `@container (width < 1280px)` |
+| `qc-2xl` | `@container (min-width: 1536px)` | `qc-max-2xl` | `@container (width < 1536px)` |
You can configure which values are available for this plugin under the `containers` key in your `tailwind.config.js` file:
From 71de75f0718a98e538c2ffe1a2bb0c81ff2a4179 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 23:46:00 +0200
Subject: [PATCH 16/36] Update README.md
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 7640836..09afcaa 100644
--- a/README.md
+++ b/README.md
@@ -123,7 +123,8 @@ By default we ship with the following configured breakpoints:
| `qc-xl` | `@container (min-width: 1280px)` | `qc-max-xl` | `@container (width < 1280px)` |
| `qc-2xl` | `@container (min-width: 1536px)` | `qc-max-2xl` | `@container (width < 1536px)` |
-You can configure which values are available for this plugin under the `containers` key in your `tailwind.config.js` file:
+You can configure which breakpoints are available for this plugin under the `containers` key in your `tailwind.config.js` file:
+It will be applied to `qc-{breakpoint}` and `qc-max-{breakpoint}`.
```js
// tailwind.config.js
From e82bfeb4baf60e31235e162606ac4bb56074f4ed Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 23:48:10 +0200
Subject: [PATCH 17/36] Update README.md
---
README.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 09afcaa..7884a6d 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,9 @@
# @krzysztof318/tw-container-queries
A plugin for Tailwind CSS v3.2+ that provides utilities for container queries.
-This is fork of original repo https://github.com/tailwindlabs/tailwindcss-container-queries
+
+This is fork of original repo [LINK](https://github.com/tailwindlabs/tailwindcss-container-queries)
+
I modificated prefix '@' to 'qc-' so now it works better with Razor syntax and I changed default breakpoints to same as tailwind breakpoints. This version also have max and range modifiers.
## Installation
From 0170826d8c7115fb764628f41ceee1526586e223 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 23:49:34 +0200
Subject: [PATCH 18/36] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 7884a6d..db97221 100644
--- a/README.md
+++ b/README.md
@@ -126,6 +126,7 @@ By default we ship with the following configured breakpoints:
| `qc-2xl` | `@container (min-width: 1536px)` | `qc-max-2xl` | `@container (width < 1536px)` |
You can configure which breakpoints are available for this plugin under the `containers` key in your `tailwind.config.js` file:
+
It will be applied to `qc-{breakpoint}` and `qc-max-{breakpoint}`.
```js
From 5993f6c3ae379c899b659e676a5198ae4ac9585d Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 23:54:24 +0200
Subject: [PATCH 19/36] Update LICENSE
---
LICENSE | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/LICENSE b/LICENSE
index f5f9341..441bc9d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,30 @@
MIT License
-Copyright (c) 2023 Tailwind Labs
+Copyright (c) 2023 Krzysztof318
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+Base software:
+
+MIT License
+
+Copyright (c) 2023 Tailwind Labs (code to commit c287ac75d50ad71f7f4813c9007e33029a50358e)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
From b9a47d3dab927efce4efbcb86e449df6517ea2e5 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 23:58:06 +0200
Subject: [PATCH 20/36] Update README.md
---
README.md | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index db97221..c7c5d80 100644
--- a/README.md
+++ b/README.md
@@ -125,7 +125,7 @@ By default we ship with the following configured breakpoints:
| `qc-xl` | `@container (min-width: 1280px)` | `qc-max-xl` | `@container (width < 1280px)` |
| `qc-2xl` | `@container (min-width: 1536px)` | `qc-max-2xl` | `@container (width < 1536px)` |
-You can configure which breakpoints are available for this plugin under the `containers` key in your `tailwind.config.js` file:
+You can add breakpoints which are available for this plugin under the `containers` key in your `tailwind.config.js` file:
It will be applied to `qc-{breakpoint}` and `qc-max-{breakpoint}`.
@@ -141,3 +141,16 @@ module.exports = {
},
}
```
+
+Or override all breakpoints with yours:
+
+```js
+// tailwind.config.js
+module.exports = {
+ theme: {
+ containers: {
+ '2xs': '16rem',
+ },
+ },
+}
+```
From 76795478cb708d5254e4d75fab6de4da267915de Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Wed, 25 Oct 2023 23:59:09 +0200
Subject: [PATCH 21/36] Update README.md
---
README.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index c7c5d80..23e7e0a 100644
--- a/README.md
+++ b/README.md
@@ -149,7 +149,9 @@ Or override all breakpoints with yours:
module.exports = {
theme: {
containers: {
- '2xs': '16rem',
+ 'xs': '16rem',
+ 'md': '32rem',
+ 'lg': '48rem',
},
},
}
From 8207e09ea3739ac81d1078e83ead4e7db711a7a4 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Thu, 26 Oct 2023 00:05:36 +0200
Subject: [PATCH 22/36] Update README.md
---
README.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/README.md b/README.md
index 23e7e0a..b1282c5 100644
--- a/README.md
+++ b/README.md
@@ -100,6 +100,23 @@ To stop an element from acting as a container, use the `qc-container-normal` cla
+### Arbitrary container
+
+You can create container with arbitary value:
+
+```html
+
+```
+This will be compiled to:
+
+```css
+.qc-container-\[size\] {
+ container-type: size;
+}
+```
+
### With a prefix
If you have configured Tailwind to use a prefix, make sure to prefix both the `qc-container` class and any classes where you are using a container query modifier:
From a3432a5ec2df84cc6a597dd94f50fd920eeba629 Mon Sep 17 00:00:00 2001
From: Krzysztof <60486987+Krzysztof318@users.noreply.github.com>
Date: Thu, 26 Oct 2023 00:07:48 +0200
Subject: [PATCH 23/36] Update README.md
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index b1282c5..42ad67e 100644
--- a/README.md
+++ b/README.md
@@ -41,6 +41,8 @@ Start by marking an element as a container using the `qc-container` class, and t