-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add @container-size utility
#18901
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
Add @container-size utility
#18901
Conversation
This allows you to write `@container-size` instead of `@container-[size]`. While we don't have block-based container query variants, this is still useful for when you are using `cqb` units.
b6a7091 to
d775834
Compare
| return { major: Number(major), minor: Number(minor), patch: Number(patch), prerelease } | ||
| }) | ||
|
|
||
| export function greaterThanOrEqual(a: string, b: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't want to pull in a full semver package just to test the major, minor patch and a pre-release channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we need to ship runtime checks for this, the feature flagging setup we used for preparing the 4.1 branch was also enabling it in the insiders build wasn't it? We'd document the feature as not released yet until we eventually cut the 4.2 release. This way we avoid any runtime checks and can even compile it out for patch releases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just relying on this env: https://github.com/tailwindlabs/tailwindcss/blob/main/packages/tailwindcss/tsup.config.ts#L16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did it ship for insiders as well? 🤔
If that's the case, then yeah that's even better. I think we got rid of all that code though, right?
This is semi-runtime, it does a runtime check, but the version of package.json is inlined at build-time already so there is no IO involved anymore.
Will update this with the build-time feature flags instead 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah defaults to insiders unless running a stable release job: https://github.com/search?q=repo%3Atailwindlabs%2Ftailwindcss%20FEATURES_ENV&type=code
| } else if (candidate.value.kind === 'named' && candidate.value.value === 'normal') { | ||
| value = 'normal' | ||
| } else if ( | ||
| featureFlagVersion('4.2.0', '0.0.0-insiders') && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason I added this is such that we can merge these kinds of PRs instead of keeping them open until we are ready to release a 4.2.x with new features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also ensures that if we want to make changes to the API, that we can do that until we release a next minor version.
CHANGELOG.md
Outdated
|
|
||
| ### Added | ||
|
|
||
| - Add `@container-size` utility ([#18901](https://github.com/tailwindlabs/tailwindcss/pull/18901)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this here, but open to suggestions on how we would tackle this because this should only be released once we release 4.2.x, not in a 4.1.x patch release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what we did in the past was to prefix this with _Experimental_ so we'd not forget: https://github.com/tailwindlabs/tailwindcss/pull/17389/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
This PR adds a new
@container-sizeutility instead of@container-[size].The main reason we didn't do this before is because we only have container width related container queries, and not block based ones so we never needed
sizeandinline-sizewas enough.However,
@container-sizeis still useful if you are using container query related units such ascqbwhich are using the block size of the container not the inline size.I also added a little helper such that
@container-sizeis only available ininsidersand4.2.0(and later) so4.1.xreleases won't have this utility yet. This will require some CHANGELOG changes such that we don't include this when releasing the next minor release.