mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-01-18 16:17:36 +00:00
This PR migrates `max-w-screen-*` candidates to the v4 equivalent relying on the breakpoint var: `max-w-[var(--breakpoint-*)]`
27 lines
741 B
TypeScript
27 lines
741 B
TypeScript
import type { Config } from 'tailwindcss'
|
|
import type { DesignSystem } from '../../../../tailwindcss/src/design-system'
|
|
import { printCandidate } from '../candidates'
|
|
|
|
export function maxWidthScreen(
|
|
designSystem: DesignSystem,
|
|
_userConfig: Config,
|
|
rawCandidate: string,
|
|
): string {
|
|
for (let candidate of designSystem.parseCandidate(rawCandidate)) {
|
|
if (
|
|
candidate.kind === 'functional' &&
|
|
candidate.root === 'max-w' &&
|
|
candidate.value?.value.startsWith('screen-')
|
|
) {
|
|
return printCandidate(designSystem, {
|
|
...candidate,
|
|
value: {
|
|
...candidate.value,
|
|
value: `[theme(screens.${candidate.value.value.slice(7)})]`,
|
|
},
|
|
})
|
|
}
|
|
}
|
|
return rawCandidate
|
|
}
|