Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Ensure `color-mix(…)` polyfills do not cause used CSS variables to be removed ([#17555](https://github.com/tailwindlabs/tailwindcss/pull/17555))
- Ensure the `color-mix(…)` polyfill creates fallbacks for theme variables that reference other theme variables ([#17562](https://github.com/tailwindlabs/tailwindcss/pull/17562))
- Fix brace expansion in `@source inline('z-{10..0}')` with range going down ([#17591](https://github.com/tailwindlabs/tailwindcss/pull/17591))

## [4.1.3] - 2025-04-04

Expand Down
11 changes: 5 additions & 6 deletions packages/tailwindcss/src/utils/brace-expansion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ describe('expand(…)', () => {
['a/{0..5}/b', ['a/0/b', 'a/1/b', 'a/2/b', 'a/3/b', 'a/4/b', 'a/5/b']],
['a/{-5..0}/b', ['a/-5/b', 'a/-4/b', 'a/-3/b', 'a/-2/b', 'a/-1/b', 'a/0/b']],
['a/{0..-5}/b', ['a/0/b', 'a/-1/b', 'a/-2/b', 'a/-3/b', 'a/-4/b', 'a/-5/b']],
[
'a/{0..10..5}/b',
['a/0/b', 'a/5/b', 'a/10/b'],
['a/{10..0..5}/b', ['a/10/b', 'a/5/b', 'a/0/b']],
],
['a/{0..10..5}/b', ['a/0/b', 'a/5/b', 'a/10/b']],
['a/{0..10..-5}/b', ['a/10/b', 'a/5/b', 'a/0/b']],
['a/{10..0..5}/b', ['a/10/b', 'a/5/b', 'a/0/b']],
['a/{10..0..-5}/b', ['a/0/b', 'a/5/b', 'a/10/b']],

// Numeric range with padding (we do not support padding)
['a/{00..05}/b', ['a/0/b', 'a/1/b', 'a/2/b', 'a/3/b', 'a/4/b', 'a/5/b']],
Expand Down Expand Up @@ -64,7 +63,7 @@ describe('expand(…)', () => {

// Should not try to expand ranges with decimals
['{1.1..2.2}', ['1.1..2.2']],
])('should expand %s', (input, expected) => {
])('should expand %s (%#)', (input, expected) => {
expect(expand(input).sort()).toEqual(expected.sort())
})

Expand Down
17 changes: 7 additions & 10 deletions packages/tailwindcss/src/utils/brace-expansion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,13 @@ function expandSequence(seq: string): string[] {
if (step === 0) {
throw new Error('Step cannot be zero in sequence expansion.')
}
if (step > 0) {
for (let i = startNum; i <= endNum; i += step) {
let numStr = i.toString()
result.push(numStr)
}
} else {
for (let i = startNum; i >= endNum; i += step) {
let numStr = i.toString()
result.push(numStr)
}

let increasing = startNum < endNum
if (increasing && step < 0) step = -step
if (!increasing && step > 0) step = -step

for (let i = startNum; increasing ? i <= endNum : i >= endNum; i += step) {
result.push(i.toString())
}
}
return result
Expand Down