@ng-native/tailwind 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/tailwind",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Tailwind CSS preset for Angular Native: Tailwind 4 and Tailwind 3, on native and on the web.",
5
5
  "keywords": [
6
6
  "angular",
@@ -17,7 +17,7 @@
17
17
  "type": "commonjs",
18
18
  "main": "flatten.cjs",
19
19
  "dependencies": {
20
- "@ng-native/metro": "0.9.0",
20
+ "@ng-native/metro": "0.10.0",
21
21
  "lightningcss": "^1.30.2"
22
22
  },
23
23
  "nx": {
@@ -32,7 +32,7 @@
32
32
  "url": "https://github.com/ng-native/ng-native/issues"
33
33
  },
34
34
  "peerDependencies": {
35
- "@ng-native/metro": "0.9.0",
35
+ "@ng-native/metro": "0.10.0",
36
36
  "@tailwindcss/cli": "^4.3.3",
37
37
  "tailwindcss": "^3.4.1 || ^4.3.3"
38
38
  },
package/shared.css CHANGED
@@ -50,17 +50,18 @@
50
50
  * Tailwind's own `dark:` is `@media (prefers-color-scheme: dark)`, which the engine answers and
51
51
  * keeps in step with the system. That is one variant short of what a theme needs: a design system
52
52
  * ships its dark palette as `.dark { --background: ... }`, and an app wants a switcher that can
53
- * disagree with the OS. A class does both - put `dark` on the root and everything beneath it
54
- * flips, whatever the system thinks.
53
+ * disagree with the OS. A class does both - put `dark` on the root and it flips, along with
54
+ * everything beneath it, whatever the system thinks.
55
55
  *
56
56
  * Bind it from `ColorScheme` and the default behaviour is unchanged:
57
57
  *
58
58
  * <view [class]="scheme.colorScheme()" style="flex: 1">
59
59
  *
60
- * `.dark &` rather than `&:is(.dark *)`, for the same reason as the platform variants above: the
61
- * compiler refuses a combinator inside `:is()`, and a descendant selector says it plainly.
60
+ * Tailwind's own class-based form, so the view wearing `dark` matches as well as everything inside
61
+ * it, at the same specificity as on the web. The compiler reads the list as two rules, the view
62
+ * itself and an ancestor test.
62
63
  */
63
- @custom-variant dark (.dark &);
64
+ @custom-variant dark (&:where(.dark, .dark *));
64
65
 
65
66
  /*
66
67
  * The safe area, as utilities.
@@ -68,6 +68,12 @@ const STATES = {
68
68
  */
69
69
  const beneath = (platform, name) => (platform === 'web' ? `[class~="${name}"] &` : `.${name} &`);
70
70
 
71
+ /** The same, but matching the element wearing the class too: Tailwind's `&:where(.x, .x *)`. */
72
+ const selfOrBeneath = (platform, name) => {
73
+ const root = platform === 'web' ? `[class~="${name}"]` : `.${name}`;
74
+ return `&:where(${root}, ${root} *)`;
75
+ };
76
+
71
77
  /** `web.css`'s root tokens: the browser's own safe-area insets, and a hairline per density. */
72
78
  const WEB_BASE = {
73
79
  ':root': Object.fromEntries(
@@ -182,7 +188,7 @@ function presetPlugin(
182
188
  function tailwind3Preset(platform) {
183
189
  return {
184
190
  // A class seeded from the OS, so an app can disagree with it.
185
- darkMode: ['variant', beneath(platform, 'dark')],
191
+ darkMode: ['variant', selfOrBeneath(platform, 'dark')],
186
192
  // A browser reset in terms of `html` and `::before`. None of it means anything on a phone, and
187
193
  // in a browser the host's `reset.css` is the reset.
188
194
  corePlugins: { preflight: false },