@blotch/rsbuild-plugin-angular-lynx 22.2.3 → 22.2.5

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.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Folds every `calc()` in a value whose terms are all constants, such as the
3
+ * `calc(45deg * -1)` and `calc(calc(1 / 2 * 100%) * -1)` Tailwind writes for
4
+ * negative and fractional transforms, into a single value (`-45deg`, `-50%`).
5
+ *
6
+ * Lynx evaluates `calc()` in lengths, but not everywhere a transform function
7
+ * takes an angle, a number or a percentage, so the transform values are
8
+ * folded before they reach it. A `calc()` with `var()` or mixed units stays
9
+ * as it is. So does `infinity`, which Lynx doesn't read.
10
+ */
11
+ export declare const foldCalc: (value: string) => string;
12
+ /**
13
+ * Replaces a number written with an exponent of 7 or more, with the stand-in
14
+ * for `infinity`. In a production build Tailwind minifies with Lightning CSS,
15
+ * which folds `rounded-full`'s `calc(infinity * 1px)` to the largest float,
16
+ * `3.40282e38px`, and Lynx doesn't read an exponent.
17
+ */
18
+ export declare const clampHugeNumbers: (value: string) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Rewrites every color function in a declaration value that it can evaluate
3
+ * statically. A function with `var()`, `calc()` or another dynamic part stays
4
+ * as it is: Lynx drops it, as before.
5
+ */
6
+ export declare const lowerColors: (value: string, channelVariables?: ReadonlySet<string>) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ import type { Root, Rule } from 'postcss';
2
+ /**
3
+ * Rewrites the declarations Tailwind CSS 4 writes into ones Lynx reads. Each
4
+ * rewrite keeps what the declaration means on the web, so the web preview
5
+ * and the native app keep matching.
6
+ */
7
+ /**
8
+ * The single `transform` the `translate-*`, `rotate-*`, `scale-*`, `skew-*`
9
+ * and `rotate-{x,y,z}-*` utilities all write, composed from the variables
10
+ * each of them sets.
11
+ *
12
+ * Tailwind 4 writes the `translate`, `rotate` and `scale` properties, which
13
+ * Lynx doesn't have, so the utilities would do nothing on device. Lynx's own
14
+ * Tailwind 3 preset composes the same way. The order is the one CSS applies
15
+ * the individual properties in: translate, rotate, scale, then `transform`.
16
+ */
17
+ export declare const COMPOSED_TRANSFORM: string;
18
+ /**
19
+ * The starting values of the variables {@link COMPOSED_TRANSFORM} reads that
20
+ * must be set for it to parse. The others have empty fallbacks.
21
+ */
22
+ export declare const TRANSFORM_DEFAULTS: ReadonlyMap<string, string>;
23
+ /** What lowering a rule's declarations found, for the defaults rule. */
24
+ export type LoweredRule = {
25
+ /** Whether the rule now writes {@link COMPOSED_TRANSFORM}. */
26
+ readonly composesTransform: boolean;
27
+ };
28
+ /**
29
+ * Lowers every declaration of one rule. Works on the rule as a whole because
30
+ * the transform properties collapse into one declaration. `channelVariables`
31
+ * are the colors the stylesheet gives a `-rgb` channel variable (see
32
+ * colors.ts).
33
+ */
34
+ export declare const lowerDeclarations: (rule: Rule, channelVariables?: ReadonlySet<string>) => LoweredRule;
35
+ /**
36
+ * Lowers the values of the transform variables, once the variables in them
37
+ * are resolved (see variables.ts): `calc(0.25rem * 2)` folds to `0.5rem`.
38
+ */
39
+ export declare const lowerTransformVariables: (root: Root) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { PluginCreator, Root, Rule } from 'postcss';
2
+ /**
3
+ * A PostCSS plugin that makes the CSS Tailwind CSS 4 writes work on Lynx. It
4
+ * runs after `@tailwindcss/postcss`, and only on the stylesheets Tailwind
5
+ * compiled, so every other stylesheet reaches Lynx as it was written.
6
+ *
7
+ * Tailwind 4 writes CSS for current browsers: cascade layers, `@property`,
8
+ * nesting, `oklch()` colors, `color-mix()`, logical properties and the
9
+ * individual `translate`/`rotate`/`scale` properties. Lynx reads none of
10
+ * them, and mostly drops them without a warning, while Lynx for Web passes
11
+ * them to the browser, so the web preview looks right and the app doesn't.
12
+ * Lynx's Tailwind preset avoids this for Tailwind 3 by changing the
13
+ * utilities; Tailwind 4 has no switch to turn its core utilities off, so this
14
+ * rewrites its output instead, into CSS with the same meaning that Lynx
15
+ * reads, on native and on the web alike. See
16
+ * investigations/lynx-vs-web-differences.md for what Lynx does with each.
17
+ */
18
+ export declare const tailwindForLynx: PluginCreator<void>;
19
+ /**
20
+ * Lowers a stylesheet Tailwind 4 compiled. `createRule` makes the rule that
21
+ * holds the variables' starting values.
22
+ */
23
+ export declare const lowerForLynx: (root: Root, createRule: (selector: string) => Rule) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Every CSS property Lynx has, from the definitions its CSS engine is
3
+ * generated from (lynx-family/lynx, tools/css_generator/css_defines, as of
4
+ * October 2026). Add a property here when Lynx adds one.
5
+ *
6
+ * Tailwind CSS 4 has no way to turn a core utility off, and it generates
7
+ * every class it finds in the source, even a word in a string such as
8
+ * `uppercase`. Lynx drops a property it doesn't have, with a build warning,
9
+ * but Lynx for Web passes it to the browser, so the web preview would show
10
+ * styles the app never gets. Tailwind 3 avoided this with the Lynx preset's
11
+ * list of core plugins.
12
+ */
13
+ export declare const LYNX_PROPERTIES: ReadonlySet<string>;
14
+ /**
15
+ * The keywords each of Lynx's keyword-only properties takes, from the same
16
+ * definitions. Tailwind 4 writes values Lynx doesn't have for some of them
17
+ * (`display: inline`, `position: static`, `white-space: pre`), which Lynx drops and
18
+ * the web preview would apply; the Lynx preset left those utilities out.
19
+ */
20
+ export declare const LYNX_KEYWORDS: ReadonlyMap<string, ReadonlySet<string>>;
@@ -0,0 +1,6 @@
1
+ import type { Rule } from 'postcss';
2
+ /**
3
+ * Rewrites the selectors Tailwind CSS 4 writes into ones Lynx matches.
4
+ * Returns `false` when no selector is left, so the caller removes the rule.
5
+ */
6
+ export declare const lowerSelectors: (rule: Rule) => boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,51 @@
1
+ import type { Container, Root } from 'postcss';
2
+ /**
3
+ * Unwraps the CSS structure Tailwind CSS 4 writes and Lynx can't read:
4
+ * nesting, `@layer` blocks and `@property` registrations.
5
+ */
6
+ /**
7
+ * Moves nested rules and at-rules out to the top level, the way Sass does:
8
+ * `.a { &:hover { … } }` becomes `.a:hover { … }`, and
9
+ * `.a { @media (…) { … } }` becomes `@media (…) { .a { … } }`.
10
+ *
11
+ * Tailwind 4 writes its variants nested (`hover:`, `md:`, the `@supports`
12
+ * fallback of an opacity modifier). Lynx's CSS parser reads a nested rule as
13
+ * a descendant selector and never sees the `&`, and Lynx for Web throws on
14
+ * it, so neither applies them. A production build already arrives flattened
15
+ * (Tailwind minifies with Lightning CSS); a development build doesn't.
16
+ */
17
+ export declare const flattenNesting: (root: Root) => void;
18
+ /**
19
+ * Replaces every `@layer` block with its contents and drops `@layer`
20
+ * statements.
21
+ *
22
+ * Lynx ignores a rule inside `@layer`, on native and on the web, so none of
23
+ * Tailwind 4's CSS would apply. Tailwind writes its layers in cascade order
24
+ * (theme, base, components, utilities), so keeping the source order keeps
25
+ * the cascade between them.
26
+ */
27
+ export declare const unwrapLayers: (container: Container) => void;
28
+ /**
29
+ * Removes the `@property` registrations and returns the custom properties
30
+ * that have an initial value, with that value.
31
+ *
32
+ * Lynx has no `@property`, so a variable Tailwind registers with an initial
33
+ * value (`--tw-border-style: solid`, `--tw-translate-x: 0`) is unset until a
34
+ * utility sets it, and every value that reads it breaks: `border` draws no
35
+ * border. A registration without an initial value is left out on purpose: the
36
+ * variable stays unset, so the `var()` fallbacks Tailwind writes apply.
37
+ */
38
+ export declare const takePropertyRegistrations: (root: Root) => Map<string, string>;
39
+ /**
40
+ * Removes the rules and at-rules the steps above left empty, such as a
41
+ * nested rule's parent that held only nested rules.
42
+ */
43
+ export declare const removeEmptyContainers: (container: Container) => void;
44
+ /**
45
+ * Writes out the `from` and `to` keyframes an animation leaves implied.
46
+ *
47
+ * Lynx doesn't play an animation that lacks either, and Tailwind's `spin`
48
+ * has only `to`, `ping` no `from`, and `pulse` neither, so `animate-spin`
49
+ * did nothing on device.
50
+ */
51
+ export declare const completeKeyframes: (root: Root) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { Root } from 'postcss';
2
+ /**
3
+ * Resolves the `var()` references that Lynx can't, inside the custom
4
+ * properties Tailwind CSS 4 sets.
5
+ *
6
+ * Lynx substitutes a `var()` that a custom property's value holds directly
7
+ * (`--tw-gradient-from: var(--color-red-500)`), but not one inside another
8
+ * function: `--tw-translate-x: calc(var(--spacing) * 2)` and
9
+ * `--tw-blur: blur(var(--blur-sm))` leave the property invalid, so the
10
+ * utility does nothing on device. That holds even when the variable is set
11
+ * in the same rule or the `var()` has a fallback.
12
+ *
13
+ * Each such reference becomes a value this stylesheet already knows: the
14
+ * variable's declaration in the same rule, else its theme value (the
15
+ * `:root` rule Tailwind writes), else the reference's fallback, else the
16
+ * initial value Tailwind registered with `@property`. Only a variable set by
17
+ * another utility on the same element, such as `ring-offset-2`'s width under
18
+ * `ring-2`, loses its effect, since the value is now fixed.
19
+ */
20
+ export declare const resolveNestedVariables: (root: Root, registrations: ReadonlyMap<string, string>) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,16 @@
1
1
  import type { RsbuildPluginAPI } from '@lynx-js/rspeedy';
2
+ /**
3
+ * Sets Tailwind CSS up for the app, either version:
4
+ *
5
+ * - **Tailwind 3** runs when the app has a `tailwind.config.*`, the way
6
+ * Angular CLI sets it up. Its config uses `@lynx-js/tailwind-preset`.
7
+ * - **Tailwind 4** runs when the app's PostCSS config lists
8
+ * `@tailwindcss/postcss` (`.postcssrc.json`, which `ng add` writes as
9
+ * Angular CLI's own Tailwind setup does). Rsbuild loads that config itself.
10
+ *
11
+ * Either way, a PostCSS plugin added after Tailwind rewrites the CSS
12
+ * Tailwind 4 writes into CSS Lynx reads (see tailwind-v4/index.ts). It only
13
+ * touches the stylesheets Tailwind 4 compiled, so it adds nothing to a
14
+ * Tailwind 3 build or a build without Tailwind.
15
+ */
2
16
  export declare const applyTailwind: (api: RsbuildPluginAPI) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotch/rsbuild-plugin-angular-lynx",
3
- "version": "22.2.3",
3
+ "version": "22.2.5",
4
4
  "description": "Rsbuild plugin for building AngularLynx applications",
5
5
  "homepage": "https://github.com/Blotch-Smart-Frames/AngularLynx#readme",
6
6
  "bugs": {
@@ -45,6 +45,7 @@
45
45
  "@lynx-js/runtime-wrapper-webpack-plugin": "^0.2.4",
46
46
  "@lynx-js/template-webpack-plugin": "^0.16.2",
47
47
  "@lynx-js/webpack-runtime-globals": "^0.0.8",
48
+ "postcss-value-parser": "^4.2.0",
48
49
  "tiny-invariant": "^1.3.3"
49
50
  },
50
51
  "devDependencies": {
@@ -53,7 +54,10 @@
53
54
  "@rsbuild/core": "^2.2.9",
54
55
  "@rslib/core": "^0.21.4",
55
56
  "@rspack/core": "^2.2.8",
57
+ "@tailwindcss/postcss": "^4.3.3",
56
58
  "@types/node": "^25.6.2",
59
+ "postcss": "^8.5.6",
60
+ "tailwindcss": "^4.3.3",
57
61
  "type-fest": "^5.6.0",
58
62
  "typescript": "^6.0.3"
59
63
  },