Skip to content

Commit 74ac68c

Browse files
authored
Merge branch 'next' into details-content
2 parents ab9c3df + f1221b3 commit 74ac68c

File tree

12 files changed

+2984
-147
lines changed

12 files changed

+2984
-147
lines changed

CHANGELOG.md

+2,764-1
Large diffs are not rendered by default.

packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap

-2
Original file line numberDiff line numberDiff line change
@@ -4719,7 +4719,6 @@ exports[`getClassList 1`] = `
47194719
"min-h-lvw",
47204720
"min-h-max",
47214721
"min-h-min",
4722-
"min-h-none",
47234722
"min-h-px",
47244723
"min-h-screen",
47254724
"min-h-svh",
@@ -4767,7 +4766,6 @@ exports[`getClassList 1`] = `
47674766
"min-w-lvw",
47684767
"min-w-max",
47694768
"min-w-min",
4770-
"min-w-none",
47714769
"min-w-px",
47724770
"min-w-screen",
47734771
"min-w-svh",

packages/tailwindcss/src/candidate.test.ts

+23
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,13 @@ it('should parse a utility with an arbitrary value with parens', () => {
570570
`)
571571
})
572572

573+
it('should not parse a utility with an arbitrary value with parens that does not start with --', () => {
574+
let utilities = new Utilities()
575+
utilities.functional('bg', () => [])
576+
577+
expect(run('bg-(my-color)', { utilities })).toMatchInlineSnapshot(`[]`)
578+
})
579+
573580
it('should parse a utility with an arbitrary value including a typehint', () => {
574581
let utilities = new Utilities()
575582
utilities.functional('bg', () => [])
@@ -616,6 +623,13 @@ it('should parse a utility with an arbitrary value with parens including a typeh
616623
`)
617624
})
618625

626+
it('should not parse a utility with an arbitrary value with parens including a typehint that does not start with --', () => {
627+
let utilities = new Utilities()
628+
utilities.functional('bg', () => [])
629+
630+
expect(run('bg-(color:my-color)', { utilities })).toMatchInlineSnapshot(`[]`)
631+
})
632+
619633
it('should parse a utility with an arbitrary value with parens and a fallback', () => {
620634
let utilities = new Utilities()
621635
utilities.functional('bg', () => [])
@@ -888,6 +902,8 @@ it('should not parse invalid arbitrary values in variants', () => {
888902

889903
'data-foo-(--value)/(number:--mod):flex',
890904
'data-foo(--value)/(number:--mod):flex',
905+
906+
'data-(value):flex',
891907
]) {
892908
expect(run(candidate, { utilities, variants })).toEqual([])
893909
}
@@ -945,6 +961,13 @@ it('should parse a utility with an implicit variable as the modifier using the s
945961
`)
946962
})
947963

964+
it('should not parse a utility with an implicit invalid variable as the modifier using the shorthand', () => {
965+
let utilities = new Utilities()
966+
utilities.functional('bg', () => [])
967+
968+
expect(run('bg-red-500/(value)', { utilities })).toMatchInlineSnapshot(`[]`)
969+
})
970+
948971
it('should parse a utility with an implicit variable as the modifier that is important', () => {
949972
let utilities = new Utilities()
950973
utilities.functional('bg', () => [])

packages/tailwindcss/src/candidate.ts

+6
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,9 @@ function parseModifier(modifier: string): CandidateModifier | null {
517517
// ^^
518518
if (arbitraryValue.length === 0 || arbitraryValue.trim().length === 0) return null
519519

520+
// Arbitrary values must start with `--` since it represents a CSS variable.
521+
if (arbitraryValue[0] !== '-' && arbitraryValue[1] !== '-') return null
522+
520523
return {
521524
kind: 'arbitrary',
522525
value: `var(${arbitraryValue})`,
@@ -651,6 +654,9 @@ export function parseVariant(variant: string, designSystem: DesignSystem): Varia
651654
// ^^
652655
if (arbitraryValue.length === 0 || arbitraryValue.trim().length === 0) return null
653656

657+
// Arbitrary values must start with `--` since it represents a CSS variable.
658+
if (arbitraryValue[0] !== '-' && arbitraryValue[1] !== '-') return null
659+
654660
return {
655661
kind: 'functional',
656662
root,

packages/tailwindcss/src/utilities.test.ts

+53-23
Original file line numberDiff line numberDiff line change
@@ -14927,6 +14927,7 @@ test('text', async () => {
1492714927
--color-red-500: #ef4444;
1492814928
--text-sm: 0.875rem;
1492914929
--text-sm--line-height: 1.25rem;
14930+
--leading-snug: 1.375;
1493014931
}
1493114932
@tailwind utilities;
1493214933
`,
@@ -14962,6 +14963,9 @@ test('text', async () => {
1496214963
// font-size / line-height / letter-spacing / font-weight
1496314964
'text-sm',
1496414965
'text-sm/6',
14966+
'text-sm/none',
14967+
'text-[10px]/none',
14968+
'text-sm/snug',
1496514969
'text-sm/[4px]',
1496614970
'text-[12px]',
1496714971
'text-[12px]/6',
@@ -14986,13 +14990,19 @@ test('text', async () => {
1498614990
--color-red-500: #ef4444;
1498714991
--text-sm: .875rem;
1498814992
--text-sm--line-height: 1.25rem;
14993+
--leading-snug: 1.375;
1498914994
}
1499014995
1499114996
.text-sm {
1499214997
font-size: var(--text-sm);
1499314998
line-height: var(--tw-leading, var(--text-sm--line-height));
1499414999
}
1499515000
15001+
.text-\\[10px\\]\\/none {
15002+
font-size: 10px;
15003+
line-height: 1;
15004+
}
15005+
1499615006
.text-\\[12px\\]\\/6 {
1499715007
font-size: 12px;
1499815008
line-height: calc(var(--spacing) * 6);
@@ -15028,6 +15038,16 @@ test('text', async () => {
1502815038
line-height: 4px;
1502915039
}
1503015040
15041+
.text-sm\\/none {
15042+
font-size: var(--text-sm);
15043+
line-height: 1;
15044+
}
15045+
15046+
.text-sm\\/snug {
15047+
font-size: var(--text-sm);
15048+
line-height: var(--leading-snug);
15049+
}
15050+
1503115051
.text-\\[12px\\] {
1503215052
font-size: 12px;
1503315053
}
@@ -15121,29 +15141,39 @@ test('text', async () => {
1512115141
}"
1512215142
`)
1512315143
expect(
15124-
await run([
15125-
'text',
15126-
// color
15127-
'-text-red-500',
15128-
'-text-red-500/50',
15129-
'-text-red-500/[0.5]',
15130-
'-text-red-500/[50%]',
15131-
'-text-current',
15132-
'-text-current/50',
15133-
'-text-current/[0.5]',
15134-
'-text-current/[50%]',
15135-
'-text-inherit',
15136-
'-text-transparent',
15137-
'-text-[#0088cc]',
15138-
'-text-[#0088cc]/50',
15139-
'-text-[#0088cc]/[0.5]',
15140-
'-text-[#0088cc]/[50%]',
15141-
15142-
// font-size / line-height / letter-spacing / font-weight
15143-
'-text-sm',
15144-
'-text-sm/6',
15145-
'-text-sm/[4px]',
15146-
]),
15144+
await compileCss(
15145+
css`
15146+
@theme inline reference {
15147+
--text-sm: 0.875rem;
15148+
}
15149+
@tailwind utilities;
15150+
`,
15151+
[
15152+
'text',
15153+
// color
15154+
'-text-red-500',
15155+
'-text-red-500/50',
15156+
'-text-red-500/[0.5]',
15157+
'-text-red-500/[50%]',
15158+
'-text-current',
15159+
'-text-current/50',
15160+
'-text-current/[0.5]',
15161+
'-text-current/[50%]',
15162+
'-text-inherit',
15163+
'-text-transparent',
15164+
'-text-[#0088cc]',
15165+
'-text-[#0088cc]/50',
15166+
'-text-[#0088cc]/[0.5]',
15167+
'-text-[#0088cc]/[50%]',
15168+
15169+
// font-size / line-height / letter-spacing / font-weight
15170+
'-text-sm',
15171+
'-text-sm/6',
15172+
'text-sm/foo',
15173+
'-text-sm/[4px]',
15174+
'text-[10px]/foo',
15175+
],
15176+
),
1514715177
).toEqual('')
1514815178
})
1514915179

packages/tailwindcss/src/utilities.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -896,9 +896,7 @@ export function createUtilities(theme: Theme) {
896896
staticUtility(`min-h-screen`, [['min-height', '100vh']])
897897
staticUtility(`max-h-screen`, [['max-height', '100vh']])
898898

899-
staticUtility(`min-w-none`, [['min-width', 'none']])
900899
staticUtility(`max-w-none`, [['max-width', 'none']])
901-
staticUtility(`min-h-none`, [['min-height', 'none']])
902900
staticUtility(`max-h-none`, [['max-height', 'none']])
903901

904902
spacingUtility(
@@ -4042,9 +4040,16 @@ export function createUtilities(theme: Theme) {
40424040
modifier = `calc(${multiplier} * ${candidate.modifier.value})`
40434041
}
40444042

4043+
// Shorthand for `leading-none`
4044+
if (!modifier && candidate.modifier.value === 'none') {
4045+
modifier = '1'
4046+
}
4047+
40454048
if (modifier) {
40464049
return [decl('font-size', value), decl('line-height', modifier)]
40474050
}
4051+
4052+
return null
40484053
}
40494054

40504055
return [decl('font-size', value)]
@@ -4088,6 +4093,15 @@ export function createUtilities(theme: Theme) {
40884093
modifier = `calc(${multiplier} * ${candidate.modifier.value})`
40894094
}
40904095

4096+
// Shorthand for `leading-none`
4097+
if (!modifier && candidate.modifier.value === 'none') {
4098+
modifier = '1'
4099+
}
4100+
4101+
if (!modifier) {
4102+
return null
4103+
}
4104+
40914105
let declarations = [decl('font-size', fontSize)]
40924106
modifier && declarations.push(decl('line-height', modifier))
40934107
return declarations

packages/tailwindcss/src/variants.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ test('target', async () => {
242242

243243
test('open', async () => {
244244
expect(await run(['open:flex', 'group-open:flex', 'peer-open:flex'])).toMatchInlineSnapshot(`
245-
".group-open\\:flex:is(:where(.group):is([open], :popover-open) *), .peer-open\\:flex:is(:where(.peer):is([open], :popover-open) ~ *), .open\\:flex:is([open], :popover-open) {
245+
".group-open\\:flex:is(:where(.group):is([open], :popover-open, :open) *), .peer-open\\:flex:is(:where(.peer):is([open], :popover-open, :open) ~ *), .open\\:flex:is([open], :popover-open, :open) {
246246
display: flex;
247247
}"
248248
`)
@@ -1482,7 +1482,7 @@ test('not', async () => {
14821482
display: flex;
14831483
}
14841484
1485-
.not-open\\:flex:not([open], :popover-open) {
1485+
.not-open\\:flex:not([open], :popover-open, :open) {
14861486
display: flex;
14871487
}
14881488
@@ -2228,7 +2228,7 @@ test('variant order', async () => {
22282228
display: flex;
22292229
}
22302230
2231-
.first\\:flex:first-child, .last\\:flex:last-child, .only\\:flex:only-child, .odd\\:flex:nth-child(odd), .even\\:flex:nth-child(2n), .first-of-type\\:flex:first-of-type, .last-of-type\\:flex:last-of-type, .only-of-type\\:flex:only-of-type, .visited\\:flex:visited, .target\\:flex:target, .open\\:flex:is([open], :popover-open), .default\\:flex:default, .checked\\:flex:checked, .indeterminate\\:flex:indeterminate, .placeholder-shown\\:flex:placeholder-shown, .autofill\\:flex:autofill, .optional\\:flex:optional, .required\\:flex:required, .valid\\:flex:valid, .invalid\\:flex:invalid, .in-range\\:flex:in-range, .out-of-range\\:flex:out-of-range, .read-only\\:flex:read-only, .empty\\:flex:empty, .focus-within\\:flex:focus-within {
2231+
.first\\:flex:first-child, .last\\:flex:last-child, .only\\:flex:only-child, .odd\\:flex:nth-child(odd), .even\\:flex:nth-child(2n), .first-of-type\\:flex:first-of-type, .last-of-type\\:flex:last-of-type, .only-of-type\\:flex:only-of-type, .visited\\:flex:visited, .target\\:flex:target, .open\\:flex:is([open], :popover-open, :open), .default\\:flex:default, .checked\\:flex:checked, .indeterminate\\:flex:indeterminate, .placeholder-shown\\:flex:placeholder-shown, .autofill\\:flex:autofill, .optional\\:flex:optional, .required\\:flex:required, .valid\\:flex:valid, .invalid\\:flex:invalid, .in-range\\:flex:in-range, .out-of-range\\:flex:out-of-range, .read-only\\:flex:read-only, .empty\\:flex:empty, .focus-within\\:flex:focus-within {
22322232
display: flex;
22332233
}
22342234

packages/tailwindcss/src/variants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ export function createVariants(theme: Theme): Variants {
682682
// State
683683
staticVariant('visited', ['&:visited'])
684684
staticVariant('target', ['&:target'])
685-
staticVariant('open', ['&:is([open], :popover-open)'])
685+
staticVariant('open', ['&:is([open], :popover-open, :open)'])
686686

687687
// Forms
688688
staticVariant('default', ['&:default'])

playgrounds/nextjs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
},
1919
"devDependencies": {
2020
"@types/node": "catalog:",
21-
"@types/react": "^19.0.2",
21+
"@types/react": "^19.0.7",
2222
"@types/react-dom": "^19.0.2",
23-
"eslint": "^9.17.0",
23+
"eslint": "^9.18.0",
2424
"eslint-config-next": "^15.1.3",
2525
"typescript": "^5.5.4"
2626
}

playgrounds/v3/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
},
1717
"devDependencies": {
1818
"@types/node": "^20.14.8",
19-
"@types/react": "^19.0.2",
19+
"@types/react": "^19.0.7",
2020
"@types/react-dom": "^19.0.2",
2121
"autoprefixer": "^10.4.20",
22-
"eslint": "^9.17.0",
22+
"eslint": "^9.18.0",
2323
"eslint-config-next": "^15.1.3",
2424
"typescript": "^5.5.4"
2525
}

playgrounds/vite/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"tailwindcss": "workspace:^"
1717
},
1818
"devDependencies": {
19-
"@types/react": "^19.0.2",
19+
"@types/react": "^19.0.7",
2020
"@types/react-dom": "^19.0.2",
2121
"bun": "^1.1.29",
2222
"vite": "catalog:"

0 commit comments

Comments
 (0)