-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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 support for literal values in --value('…')
and --modifier('…')
#17304
Conversation
Can we either add these to suggest() or make a note to do so later? |
@thecrypticace good idea, added support for that 👍 |
values.push(value) | ||
} | ||
for (let value of designSystem.theme.keysInNamespaces(valueThemeKeys)) { | ||
values.push(value.replaceAll('_', '.')) |
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 we drop the .replaceAll(…) thing elsewhere in the codebase or no? I forget… I just remember something about that changing at some point
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.
Hmm maybe? I copied it from the existing suggestions. Have to double check if this actually still matters or not. 🤔
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.
Yep is covered in the suggest
function itself.
…ions
de461cb
to
ca655f4
Compare
This was removed earlier, see `suggest()` function itself.
…17308) This PR adds suggestions to CSS based functional utilities when the `--spacing(…)` function is used. Given this CSS: ```css @import "tailwindcss"; @theme { --spacing: 0.25rem; --spacing-custom: 123px; } @Utility with-custom-spacing-* { size: --value(--spacing); } @Utility with-integer-spacing-* { size: --spacing(--value(integer)); } @Utility with-number-spacing-* { size: --spacing(--value(number)); } ``` And this HTML: ```html <div class="with-custom-spacing-custom"></div> <div class="with-custom-spacing-0"></div> <div class="with-custom-spacing-0.5"></div> <div class="with-custom-spacing-1"></div> <div class="with-custom-spacing-1.5"></div> <div class="with-integer-spacing-custom"></div> <div class="with-integer-spacing-0"></div> <div class="with-integer-spacing-0.5"></div> <div class="with-integer-spacing-1"></div> <div class="with-integer-spacing-1.5"></div> <div class="with-number-spacing-custom"></div> <div class="with-number-spacing-0"></div> <div class="with-number-spacing-0.5"></div> <div class="with-number-spacing-1"></div> <div class="with-number-spacing-1.5"></div> ``` Play: https://play.tailwindcss.com/tYDaSNiNtS Then you will see the following suggestions: ```json [ "with-custom-spacing-custom", "with-integer-spacing-0", "with-integer-spacing-1", "with-integer-spacing-2", "with-integer-spacing-3", "with-integer-spacing-4", "with-integer-spacing-5", "with-integer-spacing-6", "with-integer-spacing-7", "with-integer-spacing-8", "with-integer-spacing-9", "with-integer-spacing-10", "with-integer-spacing-11", "with-integer-spacing-12", "with-integer-spacing-14", "with-integer-spacing-16", "with-integer-spacing-20", "with-integer-spacing-24", "with-integer-spacing-28", "with-integer-spacing-32", "with-integer-spacing-36", "with-integer-spacing-40", "with-integer-spacing-44", "with-integer-spacing-48", "with-integer-spacing-52", "with-integer-spacing-56", "with-integer-spacing-60", "with-integer-spacing-64", "with-integer-spacing-72", "with-integer-spacing-80", "with-integer-spacing-96", "with-number-spacing-0", "with-number-spacing-0.5", "with-number-spacing-1", "with-number-spacing-1.5", "with-number-spacing-2", "with-number-spacing-2.5", "with-number-spacing-3", "with-number-spacing-3.5", "with-number-spacing-4", "with-number-spacing-5", "with-number-spacing-6", "with-number-spacing-7", "with-number-spacing-8", "with-number-spacing-9", "with-number-spacing-10", "with-number-spacing-11", "with-number-spacing-12", "with-number-spacing-14", "with-number-spacing-16", "with-number-spacing-20", "with-number-spacing-24", "with-number-spacing-28", "with-number-spacing-32", "with-number-spacing-36", "with-number-spacing-40", "with-number-spacing-44", "with-number-spacing-48", "with-number-spacing-52", "with-number-spacing-56", "with-number-spacing-60", "with-number-spacing-64", "with-number-spacing-72", "with-number-spacing-80", "with-number-spacing-96" ] ``` This is because `--spacing(--value(number))` will include all default spacing scale suggestions we use. And `--pacing(--value(integer))` will include the same list but without the floating point numbers. Follow up PR for: #17304
This PR adds support for literal values inside the
--value('…')
and--modifier('…')
functions. This allows you to safelist some known values you want to use:E.g.:
This allows you to use
tab-revert
andtab-initial
for example.