@ng-native/tailwind 0.22.2 → 0.23.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/README.md +1 -1
- package/flatten.cjs +2 -2
- package/native.css +20 -20
- package/package.json +3 -3
- package/shared.css +5 -2
- package/tailwind-3-preset.cjs +17 -19
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ On the web, a Tailwind 3 build uses `web-preset.cjs` in place of `preset.cjs`. S
|
|
|
85
85
|
## What's in the package
|
|
86
86
|
|
|
87
87
|
- `./native.css` - the preset: platform variants, safe-area and hairline utilities, and
|
|
88
|
-
|
|
88
|
+
`hover:` and `focus-visible:` variants that also answer a touch.
|
|
89
89
|
- `./web.css` - the same preset's web entry point, for `@ng-native/web`.
|
|
90
90
|
- `./preset.cjs` - the native preset for Tailwind 3, used from `tailwind.config.js`.
|
|
91
91
|
- `./web-preset.cjs` - the web preset for Tailwind 3, for `@ng-native/web`.
|
package/flatten.cjs
CHANGED
|
@@ -828,7 +828,7 @@ const STACKED = new RegExp(
|
|
|
828
828
|
* Tailwind 3's spelling of the same thing, `.dark .platform-ios .x`, which has no `:is()`. Only
|
|
829
829
|
* the preset's own ancestor classes, so a selector an app wrote is never rewritten.
|
|
830
830
|
*/
|
|
831
|
-
const ANCESTOR = String.raw`\.(?:dark|platform-(?:ios|android|web))`;
|
|
831
|
+
const ANCESTOR = String.raw`\.(?:dark|platform-(?:ios|android|web|macos))`;
|
|
832
832
|
const STACKED_PLAIN_ONE = new RegExp(
|
|
833
833
|
String.raw`^\s*(${ANCESTOR})\s+(${ANCESTOR})\s+([^\s].*?)\s*$`,
|
|
834
834
|
);
|
|
@@ -849,7 +849,7 @@ function unprefixAncestors(css) {
|
|
|
849
849
|
if (!recorded) return css;
|
|
850
850
|
const prefix = JSON.parse(`"${recorded[1]}"`).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
851
851
|
const prefixed = new RegExp(
|
|
852
|
-
String.raw`\.${prefix}(dark|platform-(?:ios|android|web))(?![\w-]|\\)`,
|
|
852
|
+
String.raw`\.${prefix}(dark|platform-(?:ios|android|web|macos))(?![\w-]|\\)`,
|
|
853
853
|
'g',
|
|
854
854
|
);
|
|
855
855
|
return css.replace(PREFIX_RECORD, '').replace(prefixed, '.$1');
|
package/native.css
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* `active:` needs nothing added: it lands on the `:active` the engine already tracks. Everything
|
|
9
9
|
* that is not about the input device lives in `shared.css`, which this imports - the safe-area
|
|
10
10
|
* and hairline utilities, and the platform, disabled and dark variants. What is left here is the
|
|
11
|
-
* four variants
|
|
11
|
+
* four variants about the pointer and focus, and the monospace font.
|
|
12
12
|
*
|
|
13
13
|
* `web.css` is the counterpart, and the two files are worth reading side by side: the difference
|
|
14
14
|
* between them is the whole of what this platform is missing and what it has instead.
|
|
@@ -16,37 +16,34 @@
|
|
|
16
16
|
@import './shared.css';
|
|
17
17
|
|
|
18
18
|
/*
|
|
19
|
-
* `hover:` is
|
|
19
|
+
* `hover:` is a real hover where there is a pointer, and the pressed state as well.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* ancestors, is what lets those strings port unedited.
|
|
21
|
+
* The same form as `web.css`. The engine answers `:hover` from the pointer events of a view a
|
|
22
|
+
* `:hover` rule could match: a Mac's mouse, or an iPad's trackpad or pencil, never a finger. A phone
|
|
23
|
+
* has no pointer, so there `:active`, which the engine sets on the touched view and its ancestors,
|
|
24
|
+
* is what lets class strings written for the web port unedited.
|
|
26
25
|
*
|
|
27
|
-
* `data-hover` is for
|
|
28
|
-
*
|
|
29
|
-
* those events can. `press:` and `hovered:` say one half each, for code that would rather be
|
|
30
|
-
* precise than portable.
|
|
26
|
+
* `data-hover` is for a component that tracks a pointer itself and says so. `press:` and `hovered:`
|
|
27
|
+
* say one half each, for code that would rather be precise than portable.
|
|
31
28
|
*/
|
|
32
|
-
@custom-variant hover (&:active, &[data-hover]:where(:not([data-hover="false"])));
|
|
29
|
+
@custom-variant hover (&:hover, &:active, &[data-hover]:where(:not([data-hover="false"])));
|
|
33
30
|
@custom-variant press (&:active);
|
|
34
|
-
@custom-variant hovered (&[data-hover]:where(:not([data-hover="false"])));
|
|
31
|
+
@custom-variant hovered (&:hover, &[data-hover]:where(:not([data-hover="false"])));
|
|
35
32
|
|
|
36
33
|
/*
|
|
37
|
-
* `focus-visible:` is
|
|
34
|
+
* `focus-visible:` is the focus a ring is for, as on the web.
|
|
38
35
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
36
|
+
* A Mac has clicking, so a ring is for focus the keyboard moved there, which the host reports. A
|
|
37
|
+
* focused text field matches as well, as it does in a browser: it takes the keyboard however it
|
|
38
|
+
* was focused. A phone focuses anything else only from a keyboard, a remote or an assistive
|
|
39
|
+
* technology, the cases a ring is for, so there every focus matches, as `focus:` does.
|
|
43
40
|
*
|
|
44
41
|
* `data-focus` is there because focus lands on the control and the ring belongs on the box around
|
|
45
42
|
* it. A text field is the native view that takes focus; the border, the radius and the padding are
|
|
46
43
|
* on a view wrapping it, and that view can only know it is focused because the primitive told it.
|
|
47
44
|
* The same idea as `hovered:` matching `data-hover`.
|
|
48
45
|
*/
|
|
49
|
-
@custom-variant focus-visible (&:focus, &[data-focus]:where(:not([data-focus="false"])));
|
|
46
|
+
@custom-variant focus-visible (&:focus-visible, &[data-focus]:where(:not([data-focus="false"])));
|
|
50
47
|
@custom-variant focus (&:focus, &[data-focus]:where(:not([data-focus="false"])));
|
|
51
48
|
|
|
52
49
|
/*
|
|
@@ -66,7 +63,7 @@
|
|
|
66
63
|
* silent failure in a new shape.
|
|
67
64
|
*
|
|
68
65
|
* The two platform rules then upgrade it to the font each platform actually uses for code -
|
|
69
|
-
* Menlo on iOS, and Android's own `monospace` alias, which maps to Roboto Mono. They set a custom
|
|
66
|
+
* Menlo on iOS and macOS, and Android's own `monospace` alias, which maps to Roboto Mono. They set a custom
|
|
70
67
|
* property on the root rather than `font-family` on `.font-mono`, so an app's own
|
|
71
68
|
* `@theme { --font-mono: ... }` replaces the whole chain and keeps its font on every platform, and
|
|
72
69
|
* a `prefix()` on Tailwind's imports leaves them working.
|
|
@@ -87,3 +84,6 @@
|
|
|
87
84
|
.platform-android {
|
|
88
85
|
--platform-font-mono: monospace;
|
|
89
86
|
}
|
|
87
|
+
.platform-macos {
|
|
88
|
+
--platform-font-mono: Menlo;
|
|
89
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-native/tailwind",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.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.
|
|
20
|
+
"@ng-native/metro": "0.23.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.
|
|
35
|
+
"@ng-native/metro": "0.23.0",
|
|
36
36
|
"@tailwindcss/cli": "^4.3.3",
|
|
37
37
|
"tailwindcss": "^3.4.1 || ^4.3.3"
|
|
38
38
|
},
|
package/shared.css
CHANGED
|
@@ -31,8 +31,11 @@
|
|
|
31
31
|
@custom-variant ios (.platform-ios &);
|
|
32
32
|
@custom-variant android (.platform-android &);
|
|
33
33
|
@custom-variant web (.platform-web &);
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
@custom-variant macos (.platform-macos &);
|
|
35
|
+
/** A desktop OS: macOS today. */
|
|
36
|
+
@custom-variant desktop (.platform-macos &);
|
|
37
|
+
/** Any native OS, for a rule that is about not being a browser: a desktop counts. */
|
|
38
|
+
@custom-variant native (.platform-ios &, .platform-android &, .platform-macos &);
|
|
36
39
|
|
|
37
40
|
/*
|
|
38
41
|
* `disabled:` follows the state attribute, not the pseudo-class.
|
package/tailwind-3-preset.cjs
CHANGED
|
@@ -37,25 +37,16 @@ const firstFamily = (value) =>
|
|
|
37
37
|
const on = (attribute) => `[${attribute}]:where(:not([${attribute}="false"]))`;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* The states each variant reads
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* The states each variant reads, the same on native as in a browser, as in `native.css` and
|
|
41
|
+
* `web.css`: the engine answers `:hover` from a pointer and `:focus-visible` from the keyboard, so
|
|
42
|
+
* they lead, and the pressed state and the attributes a component sets stay beside them.
|
|
43
43
|
*/
|
|
44
44
|
const STATES = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
disabled: [on('data-disabled'), ':disabled'],
|
|
51
|
-
},
|
|
52
|
-
web: {
|
|
53
|
-
hover: [':hover', ':active', on('data-hover')],
|
|
54
|
-
hovered: [':hover', on('data-hover')],
|
|
55
|
-
focus: [':focus', on('data-focus')],
|
|
56
|
-
'focus-visible': [':focus-visible', on('data-focus')],
|
|
57
|
-
disabled: [on('data-disabled'), ':disabled'],
|
|
58
|
-
},
|
|
45
|
+
hover: [':hover', ':active', on('data-hover')],
|
|
46
|
+
hovered: [':hover', on('data-hover')],
|
|
47
|
+
focus: [':focus', on('data-focus')],
|
|
48
|
+
'focus-visible': [':focus-visible', on('data-focus')],
|
|
49
|
+
disabled: [on('data-disabled'), ':disabled'],
|
|
59
50
|
};
|
|
60
51
|
|
|
61
52
|
/**
|
|
@@ -91,7 +82,7 @@ function presetPlugin(
|
|
|
91
82
|
platform,
|
|
92
83
|
{ addBase, addUtilities, addVariant, config, matchUtilities, theme },
|
|
93
84
|
) {
|
|
94
|
-
const states = STATES
|
|
85
|
+
const states = STATES;
|
|
95
86
|
const on = (selectors) => selectors.map((s) => `&${s}`);
|
|
96
87
|
addVariant('hover', on(states.hover));
|
|
97
88
|
addVariant('press', '&:active');
|
|
@@ -117,7 +108,13 @@ function presetPlugin(
|
|
|
117
108
|
addVariant('ios', beneath(platform, 'platform-ios'));
|
|
118
109
|
addVariant('android', beneath(platform, 'platform-android'));
|
|
119
110
|
addVariant('web', beneath(platform, 'platform-web'));
|
|
120
|
-
addVariant('
|
|
111
|
+
addVariant('macos', beneath(platform, 'platform-macos'));
|
|
112
|
+
addVariant('desktop', beneath(platform, 'platform-macos'));
|
|
113
|
+
addVariant('native', [
|
|
114
|
+
beneath(platform, 'platform-ios'),
|
|
115
|
+
beneath(platform, 'platform-android'),
|
|
116
|
+
beneath(platform, 'platform-macos'),
|
|
117
|
+
]);
|
|
121
118
|
if (platform === 'web') addBase(WEB_BASE);
|
|
122
119
|
else if (config('prefix')) {
|
|
123
120
|
// Read by `flattenTailwind`, which takes the prefix back off the root classes.
|
|
@@ -180,6 +177,7 @@ function presetPlugin(
|
|
|
180
177
|
'.font-mono': { 'font-family': 'Courier New' },
|
|
181
178
|
'.platform-ios .font-mono': { 'font-family': 'Menlo' },
|
|
182
179
|
'.platform-android .font-mono': { 'font-family': 'monospace' },
|
|
180
|
+
'.platform-macos .font-mono': { 'font-family': 'Menlo' },
|
|
183
181
|
});
|
|
184
182
|
}
|
|
185
183
|
}
|