@ng-native/tailwind 0.5.0 → 0.7.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 (2) hide show
  1. package/flatten.cjs +7 -28
  2. package/package.json +3 -3
package/flatten.cjs CHANGED
@@ -311,7 +311,7 @@ function markUnitlessReverse(css) {
311
311
 
312
312
  /** Properties whose `var()` the engine resolves per node, from the tokens in scope there. */
313
313
  const RESOLVED_PER_NODE =
314
- /^(translate|scale|rotate|transform|box-shadow|text-shadow|filter|font-variant-numeric)$/;
314
+ /^(translate|scale|rotate|transform|box-shadow|text-shadow|filter|font-variant-numeric|touch-action)$/;
315
315
 
316
316
  /**
317
317
  * A shadow slot, whose own parts another class may set: `ring-blue-500` its colour,
@@ -491,6 +491,9 @@ function fold(css) {
491
491
  Features.OklabColors |
492
492
  Features.LabColors |
493
493
  Features.ColorFunction |
494
+ // `light-dark()` is the compiler's too: a light rule and a dark one. Lowered, it is a pair
495
+ // of `var()`s no rule sets, and a token written with one is no colour at all.
496
+ Features.LightDark |
494
497
  // `:dir()` is answered from the app's layout direction; lowered, it is a list of languages.
495
498
  Features.DirSelector,
496
499
  }).code.toString();
@@ -582,32 +585,6 @@ function combine(a, b, op) {
582
585
  return { n: a.n / b.n, unit: a.unit };
583
586
  }
584
587
 
585
- /**
586
- * Turn a unitless `line-height` into a length, using the font size beside it.
587
- *
588
- * CSS reads `line-height: 1.5` as a ratio of the element's font size, and inherits the *ratio*;
589
- * React Native's `lineHeight` is a number of points and there is no ratio to inherit. Tailwind
590
- * always emits the two together - `.text-lg` is a size and its leading - so the multiplication can
591
- * be done here, once, where both are in the same rule. A ratio with no font size beside it is left
592
- * alone for the compiler to refuse, because guessing an inherited size would be worse than saying
593
- * nothing.
594
- */
595
- function resolveUnitlessLineHeight(css) {
596
- return css.replace(/\{([^{}]*)\}/g, (whole, body) => {
597
- const ratio = /(^|;)\s*line-height\s*:\s*([0-9]*\.?[0-9]+)\s*(?=;|$)/.exec(body);
598
- if (!ratio) return whole;
599
- const size = /(^|;)\s*font-size\s*:\s*([0-9]*\.?[0-9]+)(rem|px)\s*(?=;|$)/.exec(body);
600
- if (!size) return whole;
601
- // In points, rounded there: a ratio rounded at build time and then multiplied by 16 again,
602
- // as a height in rem is, came out at 31.99984 where a browser draws 32.
603
- const points = Number(size[2]) * Number(ratio[2]) * (size[3] === 'rem' ? REM : 1);
604
- return whole.replace(
605
- ratio[0],
606
- `${ratio[1]} line-height: ${Math.round(points * 1000) / 1000}px`,
607
- );
608
- });
609
- }
610
-
611
588
  /**
612
589
  * Five decimal places, as the compiler keeps. Three is finer than a point on any screen, but not
613
590
  * for a line height that is a factor a font size multiplies back up: `calc(1.25 / .875)` at three
@@ -1060,7 +1037,9 @@ function flattenTailwind(css, { onSettled = () => {} } = {}) {
1060
1037
  out = dropRedundantBorderStyles(out);
1061
1038
  out = dropEmptyDeclarations(out);
1062
1039
  return settleWhereRefused(
1063
- resolveUnitlessLineHeight(fold(out)),
1040
+ // A unitless line-height is left as the number it is: the compiler has the device work it
1041
+ // out against the element's own font size, which another rule may give.
1042
+ fold(out),
1064
1043
  theme,
1065
1044
  settled,
1066
1045
  runtime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/tailwind",
3
- "version": "0.5.0",
3
+ "version": "0.7.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.5.0",
20
+ "@ng-native/metro": "0.7.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.5.0",
35
+ "@ng-native/metro": "0.7.0",
36
36
  "@tailwindcss/cli": "^4.3.3",
37
37
  "tailwindcss": "^3.4.1 || ^4.3.3"
38
38
  },