Repository navigation
Commit da4ad13
authored
* fix(css): replace a @value named in an at-rule prelude only once
An ident that `@keyframes` / `@counter-style` / `@container` / `@scope`
localizes in its own prelude was rewritten a second time by the generic
ICSS value walk, and two dependencies over one range concatenate, so
`@value animName: pulseAnim` emitted `@keyframes <scoped>pulseAnimpulseAnim`
while the animation reference read `<scoped>pulseAnim`.
Mark the prelude idents an at-rule's own handler already replaced and skip
them in the value walk, leaving every other prelude ident (a `@container`
condition, a `@media` query) substituted as before.
Closes #22030
* test(css): cover repeated @value animation names in one stylesheet
An overriding second `animation` declaration, a comma-separated
`animation-name` list (with the same value twice), a shorthand list and a
second `@keyframes` block naming the same `@value` each still substitute
per occurrence — the dedupe is keyed by the ident's source offset, so it
suppresses a second dependency over one range, never a later occurrence.
Also reword the changeset: "once" read as once per file.
* test(css): cover an imported @value naming another module's @Keyframes
Raised on the issue thread: `@value imported from "./values.module.css"`
where the other module declares `@keyframes imported`. Resolving the
`@value` first and interpolating second lands the animation shorthand, the
`animation-name` and the local `@keyframes` prelude on the defining
module's scoped name; before the fix the prelude doubled it.
* fix(css): localize a @value standing in for a class or id selector
`@value sel: .globalThing;` used as `sel { }` substituted the text and
stopped there, so the class escaped scoping while every other position
resolved and then hashed. Resolve first and localize the class / id the
value names, as CSS Modules would had the author written it.
A value naming anything else — a type selector, a compound or descendant
selector — has no single localizable ident and is still substituted
verbatim.
* chore(changeset): cover the selector case too
The entry named only the at-rule prelude; the fix now spans both.
* refactor(css): avoid control-character escapes in the @value selector regex
ESLint rejects `[^\x00-\x7F]` under no-control-regex and unicorn/no-hex-escape.
Spell the non-ASCII ident code point as the positive range CSS Syntax 3 defines
it as (>= U+0080), matching the existing spelling in lib/css/syntax.js. Behaviour
is unchanged.
* test(css): cover an imported @value used as a selector
The only line of the new selector path with no case: an imported value keeps
its plain textual substitution, since the defining module owns the scoped
name. Brings the patch to full line coverage.
* fix(css): localize a @value that resolves to a custom property or grid name
Two more positions where a `@value` was resolved but never localized, so the
name it produced could not match the same identifier spelled directly.
A `@value` naming a dashed ident is now scoped like the ident it resolves to,
in `var()` and in the dashed-ident value properties (`anchor-name`,
`view-timeline-name`, `font-palette`, `position-try-fallbacks`, …). Previously
`var(--foo)` scoped and `var(v)` did not, so the two never referred to the same
property.
A grid line's readable suffix now follows the `@value` to its resolved name, so
`[v]` and `[resolved]` select the same line rather than two different ones.
* test(css): cover an imported @value used as a grid line name
The one line of the grid change with no case. An imported value keeps the
written suffix, since the defining module owns the name; what the case pins
is that declaring and referencing the line still agree.
1 parent df72840 commit da4ad13
20 files changed
Lines changed: 1330 additions & 18 deletions
File tree
- .changeset
- lib
- css
- dependencies
- test/configCases/css
- css-modules-value-at-rule-prelude
- __snapshots__
- css-modules-value-resolved-idents
- css-modules/__snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
210 | 214 | | |
211 | 215 | | |
212 | 216 | | |
| |||
994 | 998 | | |
995 | 999 | | |
996 | 1000 | | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
997 | 1014 | | |
998 | 1015 | | |
999 | 1016 | | |
| |||
1024 | 1041 | | |
1025 | 1042 | | |
1026 | 1043 | | |
| 1044 | + | |
1027 | 1045 | | |
1028 | 1046 | | |
1029 | 1047 | | |
| |||
1556 | 1574 | | |
1557 | 1575 | | |
1558 | 1576 | | |
1559 | | - | |
| 1577 | + | |
1560 | 1578 | | |
1561 | 1579 | | |
1562 | 1580 | | |
1563 | 1581 | | |
1564 | 1582 | | |
1565 | 1583 | | |
| 1584 | + | |
| 1585 | + | |
1566 | 1586 | | |
1567 | 1587 | | |
1568 | 1588 | | |
| |||
1580 | 1600 | | |
1581 | 1601 | | |
1582 | 1602 | | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
1583 | 1634 | | |
1584 | 1635 | | |
1585 | 1636 | | |
| |||
1740 | 1791 | | |
1741 | 1792 | | |
1742 | 1793 | | |
1743 | | - | |
1744 | | - | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
1745 | 1797 | | |
1746 | 1798 | | |
1747 | | - | |
1748 | | - | |
| 1799 | + | |
1749 | 1800 | | |
1750 | 1801 | | |
1751 | 1802 | | |
| |||
1763 | 1814 | | |
1764 | 1815 | | |
1765 | 1816 | | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
1766 | 1830 | | |
1767 | 1831 | | |
1768 | 1832 | | |
| |||
1846 | 1910 | | |
1847 | 1911 | | |
1848 | 1912 | | |
1849 | | - | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
1850 | 1923 | | |
1851 | 1924 | | |
1852 | 1925 | | |
| |||
2351 | 2424 | | |
2352 | 2425 | | |
2353 | 2426 | | |
2354 | | - | |
| 2427 | + | |
2355 | 2428 | | |
2356 | 2429 | | |
2357 | | - | |
2358 | | - | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
2359 | 2471 | | |
| 2472 | + | |
2360 | 2473 | | |
2361 | 2474 | | |
2362 | 2475 | | |
| |||
4074 | 4187 | | |
4075 | 4188 | | |
4076 | 4189 | | |
| 4190 | + | |
| 4191 | + | |
| 4192 | + | |
| 4193 | + | |
4077 | 4194 | | |
4078 | 4195 | | |
4079 | 4196 | | |
| |||
4173 | 4290 | | |
4174 | 4291 | | |
4175 | 4292 | | |
| 4293 | + | |
4176 | 4294 | | |
4177 | 4295 | | |
4178 | 4296 | | |
| |||
4777 | 4895 | | |
4778 | 4896 | | |
4779 | 4897 | | |
4780 | | - | |
4781 | | - | |
| 4898 | + | |
| 4899 | + | |
| 4900 | + | |
| 4901 | + | |
| 4902 | + | |
| 4903 | + | |
| 4904 | + | |
| 4905 | + | |
| 4906 | + | |
| 4907 | + | |
| 4908 | + | |
| 4909 | + | |
| 4910 | + | |
| 4911 | + | |
| 4912 | + | |
| 4913 | + | |
4782 | 4914 | | |
| 4915 | + | |
4783 | 4916 | | |
4784 | 4917 | | |
4785 | 4918 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
919 | | - | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
920 | 926 | | |
921 | 927 | | |
922 | 928 | | |
| |||
0 commit comments