Commit 250c843
authored
Add suggestions when
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--spacing(--value(integer, number)) is used (#17308)1 parent a3316f2 commit 250c843
File tree
3 files changed
+149
-68
lines changed- packages/tailwindcss/src
3 files changed
+149
-68
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
479 | 482 | | |
480 | 483 | | |
481 | 484 | | |
| |||
488 | 491 | | |
489 | 492 | | |
490 | 493 | | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
491 | 506 | | |
492 | 507 | | |
493 | 508 | | |
| |||
515 | 530 | | |
516 | 531 | | |
517 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
518 | 551 | | |
519 | 552 | | |
520 | 553 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
32 | 69 | | |
33 | 70 | | |
34 | 71 | | |
| |||
476 | 513 | | |
477 | 514 | | |
478 | 515 | | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
| 516 | + | |
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
| |||
4731 | 4731 | | |
4732 | 4732 | | |
4733 | 4733 | | |
4734 | | - | |
4735 | | - | |
4736 | | - | |
4737 | | - | |
4738 | | - | |
| 4734 | + | |
| 4735 | + | |
| 4736 | + | |
| 4737 | + | |
| 4738 | + | |
| 4739 | + | |
| 4740 | + | |
| 4741 | + | |
| 4742 | + | |
| 4743 | + | |
| 4744 | + | |
| 4745 | + | |
| 4746 | + | |
| 4747 | + | |
4739 | 4748 | | |
4740 | 4749 | | |
4741 | 4750 | | |
| |||
4762 | 4771 | | |
4763 | 4772 | | |
4764 | 4773 | | |
| 4774 | + | |
| 4775 | + | |
| 4776 | + | |
| 4777 | + | |
| 4778 | + | |
| 4779 | + | |
| 4780 | + | |
| 4781 | + | |
| 4782 | + | |
| 4783 | + | |
| 4784 | + | |
| 4785 | + | |
| 4786 | + | |
| 4787 | + | |
| 4788 | + | |
| 4789 | + | |
| 4790 | + | |
| 4791 | + | |
| 4792 | + | |
| 4793 | + | |
| 4794 | + | |
| 4795 | + | |
| 4796 | + | |
| 4797 | + | |
| 4798 | + | |
| 4799 | + | |
| 4800 | + | |
| 4801 | + | |
| 4802 | + | |
| 4803 | + | |
| 4804 | + | |
| 4805 | + | |
| 4806 | + | |
| 4807 | + | |
| 4808 | + | |
4765 | 4809 | | |
4766 | 4810 | | |
4767 | 4811 | | |
| |||
4796 | 4840 | | |
4797 | 4841 | | |
4798 | 4842 | | |
4799 | | - | |
4800 | | - | |
4801 | | - | |
4802 | | - | |
4803 | | - | |
4804 | | - | |
| 4843 | + | |
4805 | 4844 | | |
4806 | 4845 | | |
4807 | 4846 | | |
4808 | 4847 | | |
4809 | 4848 | | |
4810 | | - | |
4811 | | - | |
4812 | | - | |
4813 | | - | |
4814 | | - | |
4815 | | - | |
| 4849 | + | |
4816 | 4850 | | |
4817 | 4851 | | |
4818 | 4852 | | |
| |||
4949 | 4983 | | |
4950 | 4984 | | |
4951 | 4985 | | |
4952 | | - | |
4953 | | - | |
4954 | | - | |
4955 | | - | |
4956 | | - | |
4957 | | - | |
4958 | | - | |
| 4986 | + | |
| 4987 | + | |
| 4988 | + | |
| 4989 | + | |
| 4990 | + | |
| 4991 | + | |
| 4992 | + | |
| 4993 | + | |
| 4994 | + | |
| 4995 | + | |
| 4996 | + | |
4959 | 4997 | | |
4960 | | - | |
4961 | | - | |
4962 | | - | |
4963 | | - | |
4964 | | - | |
4965 | | - | |
| 4998 | + | |
| 4999 | + | |
| 5000 | + | |
| 5001 | + | |
| 5002 | + | |
| 5003 | + | |
| 5004 | + | |
| 5005 | + | |
| 5006 | + | |
| 5007 | + | |
| 5008 | + | |
| 5009 | + | |
| 5010 | + | |
| 5011 | + | |
| 5012 | + | |
4966 | 5013 | | |
4967 | 5014 | | |
4968 | 5015 | | |
| |||
0 commit comments