@ng-native/tailwind 0.29.0 → 0.30.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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/flatten.cjs +19 -1
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Tailwind CSS preset for Angular Native, for Tailwind 4 and Tailwind 3, on native and on the
4
4
  web: `<view class="flex-1 bg-blue-500 p-4">` works because
5
- [`@ng-native/fabric`](https://github.com/ng-native/ng-native/blob/main/packages/fabric) already has
5
+ [`@ng-native/fabric`](https://github.com/coralogix/ng-native/blob/main/packages/fabric) already has
6
6
  a real cascade, and `class` already matches against it.
7
7
 
8
8
  Alpha: APIs may change before 1.0.
@@ -98,8 +98,8 @@ On the web, a Tailwind 3 build uses `web-preset.cjs` in place of `preset.cjs`. S
98
98
  [Tailwind 3](https://ng-native.com/packages/tailwind#tailwind-3)
99
99
  - [Variants](https://ng-native.com/packages/tailwind/variants) and
100
100
  [safe area and hairlines](https://ng-native.com/packages/tailwind/utilities)
101
- - [Root README](https://github.com/ng-native/ng-native/blob/main/README.md) and
102
- [ARCHITECTURE.md](https://github.com/ng-native/ng-native/blob/main/docs/ARCHITECTURE.md)
101
+ - [Root README](https://github.com/coralogix/ng-native/blob/main/README.md) and
102
+ [ARCHITECTURE.md](https://github.com/coralogix/ng-native/blob/main/docs/ARCHITECTURE.md)
103
103
 
104
104
  ## License
105
105
 
package/flatten.cjs CHANGED
@@ -33,12 +33,30 @@ function rewriteAtRule(css, prelude, keepBody) {
33
33
  if (open === -1) break;
34
34
  const close = blockEnd(out, open);
35
35
  if (close === -1) break;
36
- const body = keepBody ? out.slice(open + 1, close) : '';
36
+ const kept = keepBody && !(prelude === '@supports' && asksForNoUnit(out.slice(at, open)));
37
+ const body = kept ? out.slice(open + 1, close) : '';
37
38
  out = out.slice(0, at) + body + out.slice(close + 1);
38
39
  }
39
40
  return out;
40
41
  }
41
42
 
43
+ /**
44
+ * Length units a browser has and native has no meaning for: a feature test that asks for one is
45
+ * false here, as it is in a browser without the unit, and the block is dropped. Taiga UI's theme
46
+ * sets `--tui-lh: 1.4em`, then `1lh` where `@supports (font-size: 1lh)`. A custom property takes
47
+ * any value, so a test of one is left as it was.
48
+ */
49
+ const NO_UNIT =
50
+ /\(\s*(?!--)[a-z-]+\s*:\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(lh|rlh|cap|rcap|ic|ric|ex|rex|ch|rch|cqw|cqh|cqi|cqb|cqmin|cqmax)\s*\)/i;
51
+
52
+ /**
53
+ * Whether a `@supports` condition is one test of a declaration with such a unit, `(font-size:
54
+ * 1lh)`. A test it is part of, `not` or `and`, is left as it was, unwrapped.
55
+ * ponytail: one test alone; read `not`, `and` and `or` if a library's theme writes them.
56
+ */
57
+ const asksForNoUnit = (condition) =>
58
+ NO_UNIT.test(condition) && /^@supports\s*\([^()]*\)\s*$/i.test(condition.trim());
59
+
42
60
  /**
43
61
  * Put a sheet's rules in the order its cascade layers give them, and take the layers away.
44
62
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/tailwind",
3
- "version": "0.29.0",
3
+ "version": "0.30.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.29.0",
20
+ "@ng-native/metro": "0.30.0",
21
21
  "lightningcss": "^1.30.2"
22
22
  },
23
23
  "nx": {
@@ -29,10 +29,10 @@
29
29
  "license": "MIT",
30
30
  "homepage": "https://ng-native.com/packages/tailwind",
31
31
  "bugs": {
32
- "url": "https://github.com/ng-native/ng-native/issues"
32
+ "url": "https://github.com/coralogix/ng-native/issues"
33
33
  },
34
34
  "peerDependencies": {
35
- "@ng-native/metro": "0.29.0",
35
+ "@ng-native/metro": "0.30.0",
36
36
  "@tailwindcss/cli": "^4.3.3",
37
37
  "tailwindcss": "^3.4.1 || ^4.3.3"
38
38
  },
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "repository": {
45
45
  "type": "git",
46
- "url": "git+https://github.com/ng-native/ng-native.git",
46
+ "url": "git+https://github.com/coralogix/ng-native.git",
47
47
  "directory": "packages/tailwind"
48
48
  },
49
49
  "files": [