Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for container query utilities with arbitrary values #12534

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix support for container query utilities with arbitrary values ([#12534](https://github.com/tailwindlabs/tailwindcss/pull/12534))

### Added

- Add `svh`, `lvh`, and `dvh` values to default `height`/`min-height`/`max-height` theme ([#11317](https://github.com/tailwindlabs/tailwindcss/pull/11317))
Expand Down
7 changes: 6 additions & 1 deletion src/lib/defaultExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ function* buildRegExps(context) {
// Utilities
regex.pattern([
// Utility Name / Group Name
/-?(?:\w+)/,
regex.any([
/-?(?:\w+)/,

// This is here to make sure @container supports everything that other utilities do
/@(?:\w+)/,
]),

// Normal/Arbitrary values
regex.optional(
Expand Down
16 changes: 16 additions & 0 deletions tests/parse-candidate-strings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,5 +496,21 @@ describe.each([
expect(extractions).toContain(value)
}
})

it.each([
['@container', ['@container']],
['@container/sidebar', ['@container/sidebar']],
['@container/[sidebar]', ['@container/[sidebar]']],
['@container-size', ['@container-size']],
['@container-size/sidebar', ['@container-size/sidebar']],
['@container-[size]/sidebar', ['@container-[size]/sidebar']],
['@container-[size]/[sidebar]', ['@container-[size]/[sidebar]']],
])('should support utilities starting with @ (%#)', async (content, expectations) => {
let extractions = defaultExtractor(content)

for (let value of expectations) {
expect(extractions).toContain(value)
}
})
})
})