Skip to content

Commit 1d83f09

Browse files
author
Sam Goody
committed
BREAKING: .child class no longer needed on child element.
1 parent 4493c7b commit 1d83f09

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,30 @@ The idea was to set a flag that the styles and events that applied to the first
276276
4. No custom attributes, which excludes the "better children solution" above.
277277
I might eventually implement it, even though it is not a tailwind style rule at all. Feel free to not use.
278278

279+
## Changes from earlier versions.
280+
281+
#### Matching selector on child
282+
283+
Earlier versions limitted matching children to those havng a class `.child`.
284+
Basically opt-in to have a style applied.
285+
286+
This matched the styles in peer, group, theme, etc.
287+
288+
```html
289+
<body class="dark">
290+
<p class="dark:shadow">p has shadow when dark theme enabled</p>
291+
</body>
292+
293+
<input class="peer">
294+
<p class="peer-hover:shadow">p has shadow when hovering on input</p>
295+
296+
<div class="group">
297+
<p class="group-hover:shadow">p has shadow when hovering over div</p>
298+
</div>
299+
```
300+
301+
However, we now offer much more flexibility with limitations and overrides, and the old sytax was usually not the desired one, so we dropped it. Besides, this matches typography. :)
302+
279303
# Contributing
280304

281305
Please open issues, file bug reports, give me your opinions on variant names, default styles and behaviors, and whatever else you can think of. There are a lot of good things input can add!

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ let variants = psuedo.flatMap(([pstate, pclass, pselector]) => aliases.flatMap((
8484
`${newvariant}-${pstate}`,
8585
`${prefix} .${newvariant}` + (pselector || `:${pclass}`)
8686
])));
87-
let basic = aliases.flatMap(([k, v]) => v.map((i) => [i, `${k} .${i}`]));
87+
let basic = aliases.flatMap(([k, v]) => v.map((i) => [i, `${k} :where(:not(.not-${i}))`]));
8888
variants.unshift(...basic);
8989
const els = [
9090
"address",

src/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ let variants = psuedo.flatMap(([pstate, pclass, pselector]) =>
4545
])))
4646

4747
let basic = aliases
48-
.flatMap(([k, v]) => v.map(i => [i, `${k} :where(.${i})`]));
48+
.flatMap(([k, v]) => v.map(i => [i, `${k} :where(:not(.not-${i}))`]));
4949

5050
variants.unshift(...basic);
5151

0 commit comments

Comments
 (0)