@ng-native/tailwind 0.6.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 +3 -27
  2. package/package.json +3 -3
package/flatten.cjs CHANGED
@@ -585,32 +585,6 @@ function combine(a, b, op) {
585
585
  return { n: a.n / b.n, unit: a.unit };
586
586
  }
587
587
 
588
- /**
589
- * Turn a unitless `line-height` into a length, using the font size beside it.
590
- *
591
- * CSS reads `line-height: 1.5` as a ratio of the element's font size, and inherits the *ratio*;
592
- * React Native's `lineHeight` is a number of points and there is no ratio to inherit. Tailwind
593
- * always emits the two together - `.text-lg` is a size and its leading - so the multiplication can
594
- * be done here, once, where both are in the same rule. A ratio with no font size beside it is left
595
- * alone for the compiler to refuse, because guessing an inherited size would be worse than saying
596
- * nothing.
597
- */
598
- function resolveUnitlessLineHeight(css) {
599
- return css.replace(/\{([^{}]*)\}/g, (whole, body) => {
600
- const ratio = /(^|;)\s*line-height\s*:\s*([0-9]*\.?[0-9]+)\s*(?=;|$)/.exec(body);
601
- if (!ratio) return whole;
602
- const size = /(^|;)\s*font-size\s*:\s*([0-9]*\.?[0-9]+)(rem|px)\s*(?=;|$)/.exec(body);
603
- if (!size) return whole;
604
- // In points, rounded there: a ratio rounded at build time and then multiplied by 16 again,
605
- // as a height in rem is, came out at 31.99984 where a browser draws 32.
606
- const points = Number(size[2]) * Number(ratio[2]) * (size[3] === 'rem' ? REM : 1);
607
- return whole.replace(
608
- ratio[0],
609
- `${ratio[1]} line-height: ${Math.round(points * 1000) / 1000}px`,
610
- );
611
- });
612
- }
613
-
614
588
  /**
615
589
  * Five decimal places, as the compiler keeps. Three is finer than a point on any screen, but not
616
590
  * for a line height that is a factor a font size multiplies back up: `calc(1.25 / .875)` at three
@@ -1063,7 +1037,9 @@ function flattenTailwind(css, { onSettled = () => {} } = {}) {
1063
1037
  out = dropRedundantBorderStyles(out);
1064
1038
  out = dropEmptyDeclarations(out);
1065
1039
  return settleWhereRefused(
1066
- 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),
1067
1043
  theme,
1068
1044
  settled,
1069
1045
  runtime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/tailwind",
3
- "version": "0.6.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.6.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.6.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
  },