diff --git a/CHANGELOG.md b/CHANGELOG.md index ddc452a3ee6b..e81f75b988f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Export `tailwindcss/lib/util/flattenColorPalette.js` for backward compatibility ([#16411](https://github.com/tailwindlabs/tailwindcss/pull/16411)) - Fix sorting numeric utilities when they have different magnitudes ([#16414](https://github.com/tailwindlabs/tailwindcss/pull/16414)) +- Show suggestions for fractions in IntelliSense ([#16353](https://github.com/tailwindlabs/tailwindcss/pull/16353)) ## [4.0.6] - 2025-02-10 diff --git a/packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap b/packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap index d58d605473a1..62c5f49a4a51 100644 --- a/packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap +++ b/packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap @@ -252,6 +252,32 @@ exports[`getClassList 1`] = ` "-bottom-72", "-bottom-80", "-bottom-96", + "-bottom-1/2", + "-bottom-1/3", + "-bottom-1/4", + "-bottom-1/5", + "-bottom-1/6", + "-bottom-1/12", + "-bottom-2/3", + "-bottom-2/4", + "-bottom-2/5", + "-bottom-2/6", + "-bottom-2/12", + "-bottom-3/4", + "-bottom-3/5", + "-bottom-3/6", + "-bottom-3/12", + "-bottom-4/5", + "-bottom-4/6", + "-bottom-4/12", + "-bottom-5/6", + "-bottom-5/12", + "-bottom-6/12", + "-bottom-7/12", + "-bottom-8/12", + "-bottom-9/12", + "-bottom-10/12", + "-bottom-11/12", "-bottom-full", "-bottom-px", "-col-end-1", @@ -314,6 +340,32 @@ exports[`getClassList 1`] = ` "-end-72", "-end-80", "-end-96", + "-end-1/2", + "-end-1/3", + "-end-1/4", + "-end-1/5", + "-end-1/6", + "-end-1/12", + "-end-2/3", + "-end-2/4", + "-end-2/5", + "-end-2/6", + "-end-2/12", + "-end-3/4", + "-end-3/5", + "-end-3/6", + "-end-3/12", + "-end-4/5", + "-end-4/6", + "-end-4/12", + "-end-5/6", + "-end-5/12", + "-end-6/12", + "-end-7/12", + "-end-8/12", + "-end-9/12", + "-end-10/12", + "-end-11/12", "-end-full", "-end-px", "-indent-0", @@ -385,6 +437,32 @@ exports[`getClassList 1`] = ` "-inset-72", "-inset-80", "-inset-96", + "-inset-1/2", + "-inset-1/3", + "-inset-1/4", + "-inset-1/5", + "-inset-1/6", + "-inset-1/12", + "-inset-2/3", + "-inset-2/4", + "-inset-2/5", + "-inset-2/6", + "-inset-2/12", + "-inset-3/4", + "-inset-3/5", + "-inset-3/6", + "-inset-3/12", + "-inset-4/5", + "-inset-4/6", + "-inset-4/12", + "-inset-5/6", + "-inset-5/12", + "-inset-6/12", + "-inset-7/12", + "-inset-8/12", + "-inset-9/12", + "-inset-10/12", + "-inset-11/12", "-inset-full", "-inset-px", "-inset-x-0", @@ -421,6 +499,32 @@ exports[`getClassList 1`] = ` "-inset-x-72", "-inset-x-80", "-inset-x-96", + "-inset-x-1/2", + "-inset-x-1/3", + "-inset-x-1/4", + "-inset-x-1/5", + "-inset-x-1/6", + "-inset-x-1/12", + "-inset-x-2/3", + "-inset-x-2/4", + "-inset-x-2/5", + "-inset-x-2/6", + "-inset-x-2/12", + "-inset-x-3/4", + "-inset-x-3/5", + "-inset-x-3/6", + "-inset-x-3/12", + "-inset-x-4/5", + "-inset-x-4/6", + "-inset-x-4/12", + "-inset-x-5/6", + "-inset-x-5/12", + "-inset-x-6/12", + "-inset-x-7/12", + "-inset-x-8/12", + "-inset-x-9/12", + "-inset-x-10/12", + "-inset-x-11/12", "-inset-x-full", "-inset-x-px", "-inset-y-0", @@ -457,6 +561,32 @@ exports[`getClassList 1`] = ` "-inset-y-72", "-inset-y-80", "-inset-y-96", + "-inset-y-1/2", + "-inset-y-1/3", + "-inset-y-1/4", + "-inset-y-1/5", + "-inset-y-1/6", + "-inset-y-1/12", + "-inset-y-2/3", + "-inset-y-2/4", + "-inset-y-2/5", + "-inset-y-2/6", + "-inset-y-2/12", + "-inset-y-3/4", + "-inset-y-3/5", + "-inset-y-3/6", + "-inset-y-3/12", + "-inset-y-4/5", + "-inset-y-4/6", + "-inset-y-4/12", + "-inset-y-5/6", + "-inset-y-5/12", + "-inset-y-6/12", + "-inset-y-7/12", + "-inset-y-8/12", + "-inset-y-9/12", + "-inset-y-10/12", + "-inset-y-11/12", "-inset-y-full", "-inset-y-px", "-left-0", @@ -493,6 +623,32 @@ exports[`getClassList 1`] = ` "-left-72", "-left-80", "-left-96", + "-left-1/2", + "-left-1/3", + "-left-1/4", + "-left-1/5", + "-left-1/6", + "-left-1/12", + "-left-2/3", + "-left-2/4", + "-left-2/5", + "-left-2/6", + "-left-2/12", + "-left-3/4", + "-left-3/5", + "-left-3/6", + "-left-3/12", + "-left-4/5", + "-left-4/6", + "-left-4/12", + "-left-5/6", + "-left-5/12", + "-left-6/12", + "-left-7/12", + "-left-8/12", + "-left-9/12", + "-left-10/12", + "-left-11/12", "-left-full", "-left-px", "-m-0", @@ -861,6 +1017,32 @@ exports[`getClassList 1`] = ` "-right-72", "-right-80", "-right-96", + "-right-1/2", + "-right-1/3", + "-right-1/4", + "-right-1/5", + "-right-1/6", + "-right-1/12", + "-right-2/3", + "-right-2/4", + "-right-2/5", + "-right-2/6", + "-right-2/12", + "-right-3/4", + "-right-3/5", + "-right-3/6", + "-right-3/12", + "-right-4/5", + "-right-4/6", + "-right-4/12", + "-right-5/6", + "-right-5/12", + "-right-6/12", + "-right-7/12", + "-right-8/12", + "-right-9/12", + "-right-10/12", + "-right-11/12", "-right-full", "-right-px", "-rotate-0", @@ -1406,6 +1588,32 @@ exports[`getClassList 1`] = ` "-start-72", "-start-80", "-start-96", + "-start-1/2", + "-start-1/3", + "-start-1/4", + "-start-1/5", + "-start-1/6", + "-start-1/12", + "-start-2/3", + "-start-2/4", + "-start-2/5", + "-start-2/6", + "-start-2/12", + "-start-3/4", + "-start-3/5", + "-start-3/6", + "-start-3/12", + "-start-4/5", + "-start-4/6", + "-start-4/12", + "-start-5/6", + "-start-5/12", + "-start-6/12", + "-start-7/12", + "-start-8/12", + "-start-9/12", + "-start-10/12", + "-start-11/12", "-start-full", "-start-px", "-top-0", @@ -1442,6 +1650,32 @@ exports[`getClassList 1`] = ` "-top-72", "-top-80", "-top-96", + "-top-1/2", + "-top-1/3", + "-top-1/4", + "-top-1/5", + "-top-1/6", + "-top-1/12", + "-top-2/3", + "-top-2/4", + "-top-2/5", + "-top-2/6", + "-top-2/12", + "-top-3/4", + "-top-3/5", + "-top-3/6", + "-top-3/12", + "-top-4/5", + "-top-4/6", + "-top-4/12", + "-top-5/6", + "-top-5/12", + "-top-6/12", + "-top-7/12", + "-top-8/12", + "-top-9/12", + "-top-10/12", + "-top-11/12", "-top-full", "-top-px", "-translate-0", @@ -1478,6 +1712,32 @@ exports[`getClassList 1`] = ` "-translate-72", "-translate-80", "-translate-96", + "-translate-1/2", + "-translate-1/3", + "-translate-1/4", + "-translate-1/5", + "-translate-1/6", + "-translate-1/12", + "-translate-2/3", + "-translate-2/4", + "-translate-2/5", + "-translate-2/6", + "-translate-2/12", + "-translate-3/4", + "-translate-3/5", + "-translate-3/6", + "-translate-3/12", + "-translate-4/5", + "-translate-4/6", + "-translate-4/12", + "-translate-5/6", + "-translate-5/12", + "-translate-6/12", + "-translate-7/12", + "-translate-8/12", + "-translate-9/12", + "-translate-10/12", + "-translate-11/12", "-translate-full", "-translate-px", "-translate-x-0", @@ -1514,6 +1774,32 @@ exports[`getClassList 1`] = ` "-translate-x-72", "-translate-x-80", "-translate-x-96", + "-translate-x-1/2", + "-translate-x-1/3", + "-translate-x-1/4", + "-translate-x-1/5", + "-translate-x-1/6", + "-translate-x-1/12", + "-translate-x-2/3", + "-translate-x-2/4", + "-translate-x-2/5", + "-translate-x-2/6", + "-translate-x-2/12", + "-translate-x-3/4", + "-translate-x-3/5", + "-translate-x-3/6", + "-translate-x-3/12", + "-translate-x-4/5", + "-translate-x-4/6", + "-translate-x-4/12", + "-translate-x-5/6", + "-translate-x-5/12", + "-translate-x-6/12", + "-translate-x-7/12", + "-translate-x-8/12", + "-translate-x-9/12", + "-translate-x-10/12", + "-translate-x-11/12", "-translate-x-full", "-translate-x-px", "-translate-y-0", @@ -1550,6 +1836,32 @@ exports[`getClassList 1`] = ` "-translate-y-72", "-translate-y-80", "-translate-y-96", + "-translate-y-1/2", + "-translate-y-1/3", + "-translate-y-1/4", + "-translate-y-1/5", + "-translate-y-1/6", + "-translate-y-1/12", + "-translate-y-2/3", + "-translate-y-2/4", + "-translate-y-2/5", + "-translate-y-2/6", + "-translate-y-2/12", + "-translate-y-3/4", + "-translate-y-3/5", + "-translate-y-3/6", + "-translate-y-3/12", + "-translate-y-4/5", + "-translate-y-4/6", + "-translate-y-4/12", + "-translate-y-5/6", + "-translate-y-5/12", + "-translate-y-6/12", + "-translate-y-7/12", + "-translate-y-8/12", + "-translate-y-9/12", + "-translate-y-10/12", + "-translate-y-11/12", "-translate-y-full", "-translate-y-px", "-translate-z-0", @@ -1799,6 +2111,32 @@ exports[`getClassList 1`] = ` "basis-full", "basis-lg", "basis-md", + "basis-1/2", + "basis-1/3", + "basis-1/4", + "basis-1/5", + "basis-1/6", + "basis-1/12", + "basis-2/3", + "basis-2/4", + "basis-2/5", + "basis-2/6", + "basis-2/12", + "basis-3/4", + "basis-3/5", + "basis-3/6", + "basis-3/12", + "basis-4/5", + "basis-4/6", + "basis-4/12", + "basis-5/6", + "basis-5/12", + "basis-6/12", + "basis-7/12", + "basis-8/12", + "basis-9/12", + "basis-10/12", + "basis-11/12", "basis-px", "bg-auto", "bg-blend-color", @@ -3194,6 +3532,32 @@ exports[`getClassList 1`] = ` "bottom-72", "bottom-80", "bottom-96", + "bottom-1/2", + "bottom-1/3", + "bottom-1/4", + "bottom-1/5", + "bottom-1/6", + "bottom-1/12", + "bottom-2/3", + "bottom-2/4", + "bottom-2/5", + "bottom-2/6", + "bottom-2/12", + "bottom-3/4", + "bottom-3/5", + "bottom-3/6", + "bottom-3/12", + "bottom-4/5", + "bottom-4/6", + "bottom-4/12", + "bottom-5/6", + "bottom-5/12", + "bottom-6/12", + "bottom-7/12", + "bottom-8/12", + "bottom-9/12", + "bottom-10/12", + "bottom-11/12", "bottom-auto", "bottom-full", "bottom-px", @@ -3647,6 +4011,32 @@ exports[`getClassList 1`] = ` "end-72", "end-80", "end-96", + "end-1/2", + "end-1/3", + "end-1/4", + "end-1/5", + "end-1/6", + "end-1/12", + "end-2/3", + "end-2/4", + "end-2/5", + "end-2/6", + "end-2/12", + "end-3/4", + "end-3/5", + "end-3/6", + "end-3/12", + "end-4/5", + "end-4/6", + "end-4/12", + "end-5/6", + "end-5/12", + "end-6/12", + "end-7/12", + "end-8/12", + "end-9/12", + "end-10/12", + "end-11/12", "end-auto", "end-full", "end-px", @@ -3721,6 +4111,32 @@ exports[`getClassList 1`] = ` "fill-transparent/100", "fixed", "flex", + "flex-1/2", + "flex-1/3", + "flex-1/4", + "flex-1/5", + "flex-1/6", + "flex-1/12", + "flex-2/3", + "flex-2/4", + "flex-2/5", + "flex-2/6", + "flex-2/12", + "flex-3/4", + "flex-3/5", + "flex-3/6", + "flex-3/12", + "flex-4/5", + "flex-4/6", + "flex-4/12", + "flex-5/6", + "flex-5/12", + "flex-6/12", + "flex-7/12", + "flex-8/12", + "flex-9/12", + "flex-10/12", + "flex-11/12", "flex-auto", "flex-col", "flex-col-reverse", @@ -4029,6 +4445,32 @@ exports[`getClassList 1`] = ` "h-72", "h-80", "h-96", + "h-1/2", + "h-1/3", + "h-1/4", + "h-1/5", + "h-1/6", + "h-1/12", + "h-2/3", + "h-2/4", + "h-2/5", + "h-2/6", + "h-2/12", + "h-3/4", + "h-3/5", + "h-3/6", + "h-3/12", + "h-4/5", + "h-4/6", + "h-4/12", + "h-5/6", + "h-5/12", + "h-6/12", + "h-7/12", + "h-8/12", + "h-9/12", + "h-10/12", + "h-11/12", "h-auto", "h-dvh", "h-dvw", @@ -4126,6 +4568,32 @@ exports[`getClassList 1`] = ` "inset-72", "inset-80", "inset-96", + "inset-1/2", + "inset-1/3", + "inset-1/4", + "inset-1/5", + "inset-1/6", + "inset-1/12", + "inset-2/3", + "inset-2/4", + "inset-2/5", + "inset-2/6", + "inset-2/12", + "inset-3/4", + "inset-3/5", + "inset-3/6", + "inset-3/12", + "inset-4/5", + "inset-4/6", + "inset-4/12", + "inset-5/6", + "inset-5/12", + "inset-6/12", + "inset-7/12", + "inset-8/12", + "inset-9/12", + "inset-10/12", + "inset-11/12", "inset-auto", "inset-full", "inset-px", @@ -4304,6 +4772,32 @@ exports[`getClassList 1`] = ` "inset-x-72", "inset-x-80", "inset-x-96", + "inset-x-1/2", + "inset-x-1/3", + "inset-x-1/4", + "inset-x-1/5", + "inset-x-1/6", + "inset-x-1/12", + "inset-x-2/3", + "inset-x-2/4", + "inset-x-2/5", + "inset-x-2/6", + "inset-x-2/12", + "inset-x-3/4", + "inset-x-3/5", + "inset-x-3/6", + "inset-x-3/12", + "inset-x-4/5", + "inset-x-4/6", + "inset-x-4/12", + "inset-x-5/6", + "inset-x-5/12", + "inset-x-6/12", + "inset-x-7/12", + "inset-x-8/12", + "inset-x-9/12", + "inset-x-10/12", + "inset-x-11/12", "inset-x-auto", "inset-x-full", "inset-x-px", @@ -4341,6 +4835,32 @@ exports[`getClassList 1`] = ` "inset-y-72", "inset-y-80", "inset-y-96", + "inset-y-1/2", + "inset-y-1/3", + "inset-y-1/4", + "inset-y-1/5", + "inset-y-1/6", + "inset-y-1/12", + "inset-y-2/3", + "inset-y-2/4", + "inset-y-2/5", + "inset-y-2/6", + "inset-y-2/12", + "inset-y-3/4", + "inset-y-3/5", + "inset-y-3/6", + "inset-y-3/12", + "inset-y-4/5", + "inset-y-4/6", + "inset-y-4/12", + "inset-y-5/6", + "inset-y-5/12", + "inset-y-6/12", + "inset-y-7/12", + "inset-y-8/12", + "inset-y-9/12", + "inset-y-10/12", + "inset-y-11/12", "inset-y-auto", "inset-y-full", "inset-y-px", @@ -4448,6 +4968,32 @@ exports[`getClassList 1`] = ` "left-72", "left-80", "left-96", + "left-1/2", + "left-1/3", + "left-1/4", + "left-1/5", + "left-1/6", + "left-1/12", + "left-2/3", + "left-2/4", + "left-2/5", + "left-2/6", + "left-2/12", + "left-3/4", + "left-3/5", + "left-3/6", + "left-3/12", + "left-4/5", + "left-4/6", + "left-4/12", + "left-5/6", + "left-5/12", + "left-6/12", + "left-7/12", + "left-8/12", + "left-9/12", + "left-10/12", + "left-11/12", "left-auto", "left-full", "left-px", @@ -4538,6 +5084,32 @@ exports[`getClassList 1`] = ` "max-h-72", "max-h-80", "max-h-96", + "max-h-1/2", + "max-h-1/3", + "max-h-1/4", + "max-h-1/5", + "max-h-1/6", + "max-h-1/12", + "max-h-2/3", + "max-h-2/4", + "max-h-2/5", + "max-h-2/6", + "max-h-2/12", + "max-h-3/4", + "max-h-3/5", + "max-h-3/6", + "max-h-3/12", + "max-h-4/5", + "max-h-4/6", + "max-h-4/12", + "max-h-5/6", + "max-h-5/12", + "max-h-6/12", + "max-h-7/12", + "max-h-8/12", + "max-h-9/12", + "max-h-10/12", + "max-h-11/12", "max-h-auto", "max-h-dvh", "max-h-dvw", @@ -4596,6 +5168,32 @@ exports[`getClassList 1`] = ` "max-w-lvw", "max-w-max", "max-w-md", + "max-w-1/2", + "max-w-1/3", + "max-w-1/4", + "max-w-1/5", + "max-w-1/6", + "max-w-1/12", + "max-w-2/3", + "max-w-2/4", + "max-w-2/5", + "max-w-2/6", + "max-w-2/12", + "max-w-3/4", + "max-w-3/5", + "max-w-3/6", + "max-w-3/12", + "max-w-4/5", + "max-w-4/6", + "max-w-4/12", + "max-w-5/6", + "max-w-5/12", + "max-w-6/12", + "max-w-7/12", + "max-w-8/12", + "max-w-9/12", + "max-w-10/12", + "max-w-11/12", "max-w-min", "max-w-none", "max-w-px", @@ -4708,6 +5306,32 @@ exports[`getClassList 1`] = ` "min-h-72", "min-h-80", "min-h-96", + "min-h-1/2", + "min-h-1/3", + "min-h-1/4", + "min-h-1/5", + "min-h-1/6", + "min-h-1/12", + "min-h-2/3", + "min-h-2/4", + "min-h-2/5", + "min-h-2/6", + "min-h-2/12", + "min-h-3/4", + "min-h-3/5", + "min-h-3/6", + "min-h-3/12", + "min-h-4/5", + "min-h-4/6", + "min-h-4/12", + "min-h-5/6", + "min-h-5/12", + "min-h-6/12", + "min-h-7/12", + "min-h-8/12", + "min-h-9/12", + "min-h-10/12", + "min-h-11/12", "min-h-auto", "min-h-dvh", "min-h-dvw", @@ -4765,6 +5389,32 @@ exports[`getClassList 1`] = ` "min-w-lvw", "min-w-max", "min-w-md", + "min-w-1/2", + "min-w-1/3", + "min-w-1/4", + "min-w-1/5", + "min-w-1/6", + "min-w-1/12", + "min-w-2/3", + "min-w-2/4", + "min-w-2/5", + "min-w-2/6", + "min-w-2/12", + "min-w-3/4", + "min-w-3/5", + "min-w-3/6", + "min-w-3/12", + "min-w-4/5", + "min-w-4/6", + "min-w-4/12", + "min-w-5/6", + "min-w-5/12", + "min-w-6/12", + "min-w-7/12", + "min-w-8/12", + "min-w-9/12", + "min-w-10/12", + "min-w-11/12", "min-w-min", "min-w-px", "min-w-screen", @@ -5653,6 +6303,32 @@ exports[`getClassList 1`] = ` "right-72", "right-80", "right-96", + "right-1/2", + "right-1/3", + "right-1/4", + "right-1/5", + "right-1/6", + "right-1/12", + "right-2/3", + "right-2/4", + "right-2/5", + "right-2/6", + "right-2/12", + "right-3/4", + "right-3/5", + "right-3/6", + "right-3/12", + "right-4/5", + "right-4/6", + "right-4/12", + "right-5/6", + "right-5/12", + "right-6/12", + "right-7/12", + "right-8/12", + "right-9/12", + "right-10/12", + "right-11/12", "right-auto", "right-full", "right-px", @@ -6717,6 +7393,32 @@ exports[`getClassList 1`] = ` "size-72", "size-80", "size-96", + "size-1/2", + "size-1/3", + "size-1/4", + "size-1/5", + "size-1/6", + "size-1/12", + "size-2/3", + "size-2/4", + "size-2/5", + "size-2/6", + "size-2/12", + "size-3/4", + "size-3/5", + "size-3/6", + "size-3/12", + "size-4/5", + "size-4/6", + "size-4/12", + "size-5/6", + "size-5/12", + "size-6/12", + "size-7/12", + "size-8/12", + "size-9/12", + "size-10/12", + "size-11/12", "size-auto", "size-dvh", "size-dvw", @@ -6868,6 +7570,32 @@ exports[`getClassList 1`] = ` "start-72", "start-80", "start-96", + "start-1/2", + "start-1/3", + "start-1/4", + "start-1/5", + "start-1/6", + "start-1/12", + "start-2/3", + "start-2/4", + "start-2/5", + "start-2/6", + "start-2/12", + "start-3/4", + "start-3/5", + "start-3/6", + "start-3/12", + "start-4/5", + "start-4/6", + "start-4/12", + "start-5/6", + "start-5/12", + "start-6/12", + "start-7/12", + "start-8/12", + "start-9/12", + "start-10/12", + "start-11/12", "start-auto", "start-full", "start-px", @@ -7157,6 +7885,32 @@ exports[`getClassList 1`] = ` "top-72", "top-80", "top-96", + "top-1/2", + "top-1/3", + "top-1/4", + "top-1/5", + "top-1/6", + "top-1/12", + "top-2/3", + "top-2/4", + "top-2/5", + "top-2/6", + "top-2/12", + "top-3/4", + "top-3/5", + "top-3/6", + "top-3/12", + "top-4/5", + "top-4/6", + "top-4/12", + "top-5/6", + "top-5/12", + "top-6/12", + "top-7/12", + "top-8/12", + "top-9/12", + "top-10/12", + "top-11/12", "top-auto", "top-full", "top-px", @@ -7225,6 +7979,32 @@ exports[`getClassList 1`] = ` "translate-72", "translate-80", "translate-96", + "translate-1/2", + "translate-1/3", + "translate-1/4", + "translate-1/5", + "translate-1/6", + "translate-1/12", + "translate-2/3", + "translate-2/4", + "translate-2/5", + "translate-2/6", + "translate-2/12", + "translate-3/4", + "translate-3/5", + "translate-3/6", + "translate-3/12", + "translate-4/5", + "translate-4/6", + "translate-4/12", + "translate-5/6", + "translate-5/12", + "translate-6/12", + "translate-7/12", + "translate-8/12", + "translate-9/12", + "translate-10/12", + "translate-11/12", "translate-full", "translate-none", "translate-px", @@ -7262,6 +8042,32 @@ exports[`getClassList 1`] = ` "translate-x-72", "translate-x-80", "translate-x-96", + "translate-x-1/2", + "translate-x-1/3", + "translate-x-1/4", + "translate-x-1/5", + "translate-x-1/6", + "translate-x-1/12", + "translate-x-2/3", + "translate-x-2/4", + "translate-x-2/5", + "translate-x-2/6", + "translate-x-2/12", + "translate-x-3/4", + "translate-x-3/5", + "translate-x-3/6", + "translate-x-3/12", + "translate-x-4/5", + "translate-x-4/6", + "translate-x-4/12", + "translate-x-5/6", + "translate-x-5/12", + "translate-x-6/12", + "translate-x-7/12", + "translate-x-8/12", + "translate-x-9/12", + "translate-x-10/12", + "translate-x-11/12", "translate-x-full", "translate-x-px", "translate-y-0", @@ -7298,6 +8104,32 @@ exports[`getClassList 1`] = ` "translate-y-72", "translate-y-80", "translate-y-96", + "translate-y-1/2", + "translate-y-1/3", + "translate-y-1/4", + "translate-y-1/5", + "translate-y-1/6", + "translate-y-1/12", + "translate-y-2/3", + "translate-y-2/4", + "translate-y-2/5", + "translate-y-2/6", + "translate-y-2/12", + "translate-y-3/4", + "translate-y-3/5", + "translate-y-3/6", + "translate-y-3/12", + "translate-y-4/5", + "translate-y-4/6", + "translate-y-4/12", + "translate-y-5/6", + "translate-y-5/12", + "translate-y-6/12", + "translate-y-7/12", + "translate-y-8/12", + "translate-y-9/12", + "translate-y-10/12", + "translate-y-11/12", "translate-y-full", "translate-y-px", "translate-z-0", @@ -7477,6 +8309,32 @@ exports[`getClassList 1`] = ` "w-lvw", "w-max", "w-md", + "w-1/2", + "w-1/3", + "w-1/4", + "w-1/5", + "w-1/6", + "w-1/12", + "w-2/3", + "w-2/4", + "w-2/5", + "w-2/6", + "w-2/12", + "w-3/4", + "w-3/5", + "w-3/6", + "w-3/12", + "w-4/5", + "w-4/6", + "w-4/12", + "w-5/6", + "w-5/12", + "w-6/12", + "w-7/12", + "w-8/12", + "w-9/12", + "w-10/12", + "w-11/12", "w-min", "w-px", "w-screen", diff --git a/packages/tailwindcss/src/intellisense.ts b/packages/tailwindcss/src/intellisense.ts index 006a0195e953..ca9c1a386099 100644 --- a/packages/tailwindcss/src/intellisense.ts +++ b/packages/tailwindcss/src/intellisense.ts @@ -2,19 +2,34 @@ import { styleRule, walkDepth } from './ast' import { applyVariant } from './compile' import type { DesignSystem } from './design-system' import { compare } from './utils/compare' +import { DefaultMap } from './utils/default-map' interface ClassMetadata { modifiers: string[] } +export type ClassItem = { + name: string + utility: string + fraction: boolean + modifiers: string[] +} + export type ClassEntry = [string, ClassMetadata] +const IS_FRACTION = /^\d+\/\d+$/ + export function getClassList(design: DesignSystem): ClassEntry[] { - let list: [string, ClassMetadata][] = [] + let list: ClassItem[] = [] // Static utilities only work as-is for (let utility of design.utilities.keys('static')) { - list.push([utility, { modifiers: [] }]) + list.push({ + name: utility, + utility, + fraction: false, + modifiers: [], + }) } // Functional utilities have their own list of completions @@ -23,20 +38,99 @@ export function getClassList(design: DesignSystem): ClassEntry[] { for (let group of completions) { for (let value of group.values) { + let fraction = value !== null && IS_FRACTION.test(value) + let name = value === null ? utility : `${utility}-${value}` - list.push([name, { modifiers: group.modifiers }]) + list.push({ + name, + utility, + fraction, + modifiers: group.modifiers, + }) if (group.supportsNegative) { - list.push([`-${name}`, { modifiers: group.modifiers }]) + list.push({ + name: `-${name}`, + utility: `-${utility}`, + fraction, + modifiers: group.modifiers, + }) } } } } - list.sort((a, b) => compare(a[0], b[0])) + if (list.length === 0) return [] - return list + // Sort utilities by their class name + list.sort((a, b) => compare(a.name, b.name)) + + let entries = sortFractionsLast(list) + + return entries +} + +function sortFractionsLast(list: ClassItem[]) { + type Bucket = { + utility: string + items: ClassItem[] + } + + // 1. Create "buckets" for each utility group + let buckets: Bucket[] = [] + let current: Bucket | null = null + + // 2. Determine the last bucket for each utility group + let lastUtilityBucket = new Map() + + // 3. Collect all fractions in a given utility group + let fractions = new DefaultMap(() => []) + + for (let item of list) { + let { utility, fraction } = item + + if (!current) { + current = { utility, items: [] } + lastUtilityBucket.set(utility, current) + } + + if (utility !== current.utility) { + buckets.push(current) + + current = { utility, items: [] } + lastUtilityBucket.set(utility, current) + } + + if (fraction) { + fractions.get(utility).push(item) + } else { + current.items.push(item) + } + } + + if (current && buckets[buckets.length - 1] !== current) { + buckets.push(current) + } + + // 4. Add fractions to their respective last utility buckets + for (let [utility, items] of fractions) { + let bucket = lastUtilityBucket.get(utility) + if (!bucket) continue + + bucket.items.push(...items) + } + + // 5. Flatten the buckets into a single list + let entries: ClassEntry[] = [] + + for (let bucket of buckets) { + for (let entry of bucket.items) { + entries.push([entry.name, { modifiers: entry.modifiers }]) + } + } + + return entries } interface SelectorOptions { diff --git a/packages/tailwindcss/src/utilities.ts b/packages/tailwindcss/src/utilities.ts index 3dadacac113d..57e753be1dcf 100644 --- a/packages/tailwindcss/src/utilities.ts +++ b/packages/tailwindcss/src/utilities.ts @@ -42,6 +42,7 @@ type SuggestionDefinition = | string | { supportsNegative?: boolean + supportsFractions?: boolean values?: string[] modifiers?: string[] valueThemeKeys?: ThemeKey[] @@ -225,6 +226,35 @@ export function createUtilities(theme: Theme) { } } + let suggestedFractions = [ + '1/2', + '1/3', + '2/3', + '1/4', + '2/4', + '3/4', + '1/5', + '2/5', + '3/5', + '4/5', + '1/6', + '2/6', + '3/6', + '4/6', + '5/6', + '1/12', + '2/12', + '3/12', + '4/12', + '5/12', + '6/12', + '7/12', + '8/12', + '9/12', + '10/12', + '11/12', + ] + utilities.suggest(classRoot, () => { let groups: SuggestionGroup[] = [] @@ -238,8 +268,13 @@ export function createUtilities(theme: Theme) { ...(defn.values ?? []), ...resolve(defn.valueThemeKeys ?? []), ] + let modifiers = [...(defn.modifiers ?? []), ...resolve(defn.modifierThemeKeys ?? [])] + if (defn.supportsFractions) { + values.push(...suggestedFractions) + } + if (defn.hasDefaultValue) { values.unshift(null) } @@ -341,6 +376,7 @@ export function createUtilities(theme: Theme) { supportsNegative: desc.supportsNegative, valueThemeKeys: desc.themeKeys ?? [], hasDefaultValue: desc.defaultValue !== undefined && desc.defaultValue !== null, + supportsFractions: desc.supportsFractions, }, ]) } @@ -467,6 +503,7 @@ export function createUtilities(theme: Theme) { ] : [], supportsNegative, + supportsFractions, valueThemeKeys: themeKeys, }, ]) @@ -966,6 +1003,8 @@ export function createUtilities(theme: Theme) { } }) + suggest('flex', () => [{ supportsFractions: true }]) + /** * @css `flex-shrink` */