react-native-css 0.0.0-nightly.b0b35b1 → 0.0.0-nightly.b5f2a4d
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/dist/commonjs/compiler/compiler.js +63 -4
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +5 -0
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/compiler/supports.js +1 -3
- package/dist/commonjs/compiler/supports.js.map +1 -1
- package/dist/commonjs/components/FlatList.js +1 -0
- package/dist/commonjs/components/FlatList.js.map +1 -1
- package/dist/commonjs/native/styles/functions/filters.js +4 -4
- package/dist/commonjs/native/styles/functions/filters.js.map +1 -1
- package/dist/commonjs/native/styles/index.js +45 -2
- package/dist/commonjs/native/styles/index.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/_handler.js +10 -0
- package/dist/commonjs/native/styles/shorthands/_handler.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/box-shadow.js +22 -9
- package/dist/commonjs/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/module/compiler/compiler.js +64 -5
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +5 -0
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/compiler/supports.js +1 -3
- package/dist/module/compiler/supports.js.map +1 -1
- package/dist/module/components/FlatList.js +1 -0
- package/dist/module/components/FlatList.js.map +1 -1
- package/dist/module/native/styles/functions/filters.js +4 -4
- package/dist/module/native/styles/functions/filters.js.map +1 -1
- package/dist/module/native/styles/index.js +45 -2
- package/dist/module/native/styles/index.js.map +1 -1
- package/dist/module/native/styles/shorthands/_handler.js +11 -1
- package/dist/module/native/styles/shorthands/_handler.js.map +1 -1
- package/dist/module/native/styles/shorthands/box-shadow.js +23 -9
- package/dist/module/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +1 -0
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/_handler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +1 -0
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/_handler.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/compiler/compiler.ts +90 -5
- package/src/compiler/stylesheet.ts +6 -0
- package/src/compiler/supports.ts +1 -3
- package/src/components/FlatList.tsx +1 -0
- package/src/native/styles/functions/filters.ts +6 -6
- package/src/native/styles/index.ts +46 -2
- package/src/native/styles/shorthands/_handler.ts +14 -1
- package/src/native/styles/shorthands/box-shadow.ts +28 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../../src/compiler/stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAOjD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EAEf,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAO1B,KAAK,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,WAAW,CAAC;AAWjE,qBAAa,iBAAiB;IAa1B,OAAO,CAAC,OAAO;IACR,I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,SAAS,EAAE,cAAc;IAKvC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK;IAUpC,oBAAoB,CAClB,KAAK,EAAE,eAAe,EACtB,UAAU,CAAC,EAAE,OAAO,EACpB,IAAI,YAAY;IASlB,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,eAAe,EACtB,UAAU,CAAC,EAAE,OAAO,EACpB,IAAI,YAAY;IAqDlB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAUvE,OAAO,CAAC,cAAc;IAqDtB,oBAAoB,CAAC,YAAY,eAAiB,GAAG,IAAI;IA4IzD,iBAAiB,CAAC,KAAK,EAAE,cAAc;IAKvC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe;IAMpD,kBAAkB,CAAC,IAAI,EAAE,MAAM;IAU/B,iBAAiB,CAAC,QAAQ,EAAE,MAAM;CAUnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/FlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"FlatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/FlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAY1B,eAAO,MAAM,QAAQ,EAIJ,OAAO,UAAU,GAChC,CAAC,CAAC,KAAK,EACL,KAAK,EAAE,WAAW,CAChB,aAAa,CAAC,KAAK,CAAC,EACpB,mBAAmB,CAAC,OAAO,UAAU,CAAC,CACvC,KACE,SAAS,CAAC,CAAC;AAElB,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_handler.d.ts","sourceRoot":"","sources":["../../../../../../../src/native/styles/shorthands/_handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_handler.d.ts","sourceRoot":"","sources":["../../../../../../../src/native/styles/shorthands/_handler.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,KAAK,aAAa,GACd,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEpC,KAAK,sBAAsB,GACvB,SAAS,CAAC,MAAM,GAAG,SAAS,MAAM,EAAE,EAAE,aAAa,CAAC,GACpD,qBAAqB,CAAC;AAE1B,KAAK,qBAAqB,GAAG,SAAS;IACpC,MAAM,GAAG,SAAS,MAAM,EAAE;IAC1B,aAAa;IACb,GAAG;CACJ,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EACpC,QAAQ,EAAE,qBAAqB,EAAE,EACjC,UAAU,GAAE,iBAAiB,GAAG,QAAQ,GAAG,QAA4B,GACtE,aAAa,CAsGf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box-shadow.d.ts","sourceRoot":"","sources":["../../../../../../../src/native/styles/shorthands/box-shadow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"box-shadow.d.ts","sourceRoot":"","sources":["../../../../../../../src/native/styles/shorthands/box-shadow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAgCxD,eAAO,MAAM,SAAS,EAAE,qBAoCvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../../../../src/compiler/compiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../../../../src/compiler/compiler.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,eAAe,EAKhB,MAAM,kBAAkB,CAAC;AAmB1B;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,GAAE,eAAoB;;;;;;;EA0J3E"}
|
|
@@ -62,6 +62,7 @@ export declare class StylesheetBuilder {
|
|
|
62
62
|
private pushDescriptor;
|
|
63
63
|
applyRuleToSelectors(selectorList?: SelectorList): void;
|
|
64
64
|
addContainerQuery(query: ContainerQuery): void;
|
|
65
|
+
addRootVariable(name: string, value: StyleDescriptor): void;
|
|
65
66
|
newAnimationFrames(name: string): void;
|
|
66
67
|
newAnimationFrame(progress: string): void;
|
|
67
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../../src/compiler/stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAOjD,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EAEf,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAO1B,KAAK,WAAW,GAAG,OAAO,GAAG,OAAO,GAA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IAAI,EAAE,OAAO,CAAC,SAAS,CAAC;IASrC,OAAO,CAAC,gBAAgB;IAQxB,aAAa,CAAC,SAAS,EAAE,cAAc;IAKvC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK;IAUpC,oBAAoB,CAClB,KAAK,EAAE,eAAe,EACtB,UAAU,CAAC,EAAE,OAAO,EACpB,IAAI,YAAY;IASlB,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,eAAe,EACtB,UAAU,CAAC,EAAE,OAAO,EACpB,IAAI,YAAY;IAqDlB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAUvE,OAAO,CAAC,cAAc;IAqDtB,oBAAoB,CAAC,YAAY,eAAiB,GAAG,IAAI;IA4IzD,iBAAiB,CAAC,KAAK,EAAE,cAAc;IAKvC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe;IAMpD,kBAAkB,CAAC,IAAI,EAAE,MAAM;IAU/B,iBAAiB,CAAC,QAAQ,EAAE,MAAM;CAUnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/FlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"FlatList.d.ts","sourceRoot":"","sources":["../../../../../src/components/FlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,kBAAkB,CAAC;AAY1B,eAAO,MAAM,QAAQ,EAIJ,OAAO,UAAU,GAChC,CAAC,CAAC,KAAK,EACL,KAAK,EAAE,WAAW,CAChB,aAAa,CAAC,KAAK,CAAC,EACpB,mBAAmB,CAAC,OAAO,UAAU,CAAC,CACvC,KACE,SAAS,CAAC,CAAC;AAElB,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_handler.d.ts","sourceRoot":"","sources":["../../../../../../../src/native/styles/shorthands/_handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_handler.d.ts","sourceRoot":"","sources":["../../../../../../../src/native/styles/shorthands/_handler.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,KAAK,aAAa,GACd,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEpC,KAAK,sBAAsB,GACvB,SAAS,CAAC,MAAM,GAAG,SAAS,MAAM,EAAE,EAAE,aAAa,CAAC,GACpD,qBAAqB,CAAC;AAE1B,KAAK,qBAAqB,GAAG,SAAS;IACpC,MAAM,GAAG,SAAS,MAAM,EAAE;IAC1B,aAAa;IACb,GAAG;CACJ,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EACpC,QAAQ,EAAE,qBAAqB,EAAE,EACjC,UAAU,GAAE,iBAAiB,GAAG,QAAQ,GAAG,QAA4B,GACtE,aAAa,CAsGf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box-shadow.d.ts","sourceRoot":"","sources":["../../../../../../../src/native/styles/shorthands/box-shadow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"box-shadow.d.ts","sourceRoot":"","sources":["../../../../../../../src/native/styles/shorthands/box-shadow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAgCxD,eAAO,MAAM,SAAS,EAAE,qBAoCvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-css",
|
|
3
|
-
"version": "0.0.0-nightly.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.0-nightly.b5f2a4d",
|
|
4
|
+
"description": "Use CSS stylesheets in React Native",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"source": "./src/index.ts",
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
},
|
|
212
212
|
"devDependencies": {
|
|
213
213
|
"@babel/core": "^7.28.0",
|
|
214
|
-
"@commitlint/config-conventional": "^
|
|
214
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
215
215
|
"@eslint/js": "^9.30.1",
|
|
216
216
|
"@expo/metro-config": "~54.0.5",
|
|
217
217
|
"@ianvs/prettier-plugin-sort-imports": "^4.4.2",
|
|
@@ -233,9 +233,9 @@
|
|
|
233
233
|
"expo": "54.0.10",
|
|
234
234
|
"jest": "^29.7.0",
|
|
235
235
|
"jest-expo": "~54.0.12",
|
|
236
|
-
"lefthook": "^1.
|
|
236
|
+
"lefthook": "^2.1.5",
|
|
237
237
|
"lightningcss": "^1.30.1",
|
|
238
|
-
"metro-runtime": "^0.
|
|
238
|
+
"metro-runtime": "^0.84.2",
|
|
239
239
|
"postcss": "^8.5.6",
|
|
240
240
|
"prettier": "^3.6.2",
|
|
241
241
|
"react": "19.1.0",
|
package/src/compiler/compiler.ts
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
type MediaQuery as CSSMediaQuery,
|
|
8
8
|
type CustomAtRules,
|
|
9
9
|
type MediaRule,
|
|
10
|
+
type ParsedComponent,
|
|
11
|
+
type PropertyRule,
|
|
10
12
|
type Rule,
|
|
11
13
|
type Visitor,
|
|
12
14
|
} from "lightningcss";
|
|
@@ -15,11 +17,19 @@ import { maybeMutateReactNativeOptions, parsePropAtRule } from "./atRules";
|
|
|
15
17
|
import type {
|
|
16
18
|
CompilerOptions,
|
|
17
19
|
ContainerQuery,
|
|
20
|
+
StyleDescriptor,
|
|
18
21
|
StyleRuleMapping,
|
|
19
22
|
UniqueVarInfo,
|
|
20
23
|
} from "./compiler.types";
|
|
21
24
|
import { parseContainerCondition } from "./container-query";
|
|
22
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
parseAngle,
|
|
27
|
+
parseColor,
|
|
28
|
+
parseDeclaration,
|
|
29
|
+
parseLength,
|
|
30
|
+
reduceParseUnparsed,
|
|
31
|
+
round,
|
|
32
|
+
} from "./declarations";
|
|
23
33
|
import { inlineVariables } from "./inline-variables";
|
|
24
34
|
import { extractKeyFrames } from "./keyframes";
|
|
25
35
|
import { lightningcssLoader } from "./lightningcss-loader";
|
|
@@ -74,17 +84,28 @@ export function compile(code: Buffer | string, options: CompilerOptions = {}) {
|
|
|
74
84
|
|
|
75
85
|
const vars = new Map<string, UniqueVarInfo>();
|
|
76
86
|
|
|
87
|
+
// Determine the effective rem multiplier for compile-time inlining.
|
|
88
|
+
// If inlineRem is explicitly set, use that. Otherwise, scan for
|
|
89
|
+
// :root { font-size: Npx } in the CSS to allow CSS-based configuration.
|
|
90
|
+
let effectiveRem: number | false = options.inlineRem ?? undefined!;
|
|
91
|
+
if (effectiveRem === undefined) {
|
|
92
|
+
const css = typeof code === "string" ? code : code.toString();
|
|
93
|
+
const match = css.match(/:root\s*\{[^}]*font-size:\s*([\d.]+)px/);
|
|
94
|
+
effectiveRem = match?.[1] ? parseFloat(match[1]) : 14;
|
|
95
|
+
}
|
|
96
|
+
|
|
77
97
|
const firstPassVisitor: Visitor<CustomAtRules> = {};
|
|
78
98
|
|
|
79
|
-
if (
|
|
99
|
+
if (effectiveRem !== false) {
|
|
100
|
+
const remMultiplier = effectiveRem;
|
|
80
101
|
firstPassVisitor.Length = (length) => {
|
|
81
|
-
if (length.unit !== "rem"
|
|
102
|
+
if (length.unit !== "rem") {
|
|
82
103
|
return length;
|
|
83
104
|
}
|
|
84
105
|
|
|
85
106
|
return {
|
|
86
107
|
unit: "px",
|
|
87
|
-
value: round(length.value *
|
|
108
|
+
value: round(length.value * remMultiplier),
|
|
88
109
|
};
|
|
89
110
|
};
|
|
90
111
|
}
|
|
@@ -276,13 +297,15 @@ function extractRule(
|
|
|
276
297
|
}
|
|
277
298
|
}
|
|
278
299
|
break;
|
|
300
|
+
case "property":
|
|
301
|
+
extractPropertyRule(rule.value, builder);
|
|
302
|
+
break;
|
|
279
303
|
case "custom":
|
|
280
304
|
case "font-face":
|
|
281
305
|
case "font-palette-values":
|
|
282
306
|
case "font-feature-values":
|
|
283
307
|
case "namespace":
|
|
284
308
|
case "layer-statement":
|
|
285
|
-
case "property":
|
|
286
309
|
case "view-transition":
|
|
287
310
|
case "ignored":
|
|
288
311
|
case "unknown":
|
|
@@ -377,3 +400,65 @@ function extractContainer(
|
|
|
377
400
|
extractRule(rule, builder, mapping);
|
|
378
401
|
}
|
|
379
402
|
}
|
|
403
|
+
|
|
404
|
+
function extractPropertyRule(
|
|
405
|
+
propertyRule: PropertyRule,
|
|
406
|
+
builder: StylesheetBuilder,
|
|
407
|
+
) {
|
|
408
|
+
const { initialValue, name } = propertyRule;
|
|
409
|
+
|
|
410
|
+
if (initialValue == null) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
const varName = name.startsWith("--") ? name.slice(2) : name;
|
|
415
|
+
const value = parsePropertyInitialValue(initialValue, builder);
|
|
416
|
+
|
|
417
|
+
if (value !== undefined) {
|
|
418
|
+
builder.addRootVariable(varName, value);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function parsePropertyInitialValue(
|
|
423
|
+
component: ParsedComponent,
|
|
424
|
+
builder: StylesheetBuilder,
|
|
425
|
+
): StyleDescriptor {
|
|
426
|
+
switch (component.type) {
|
|
427
|
+
case "length":
|
|
428
|
+
return parseLength(component.value, builder);
|
|
429
|
+
case "number":
|
|
430
|
+
case "integer":
|
|
431
|
+
return round(component.value);
|
|
432
|
+
case "percentage":
|
|
433
|
+
return `${round(component.value * 100)}%`;
|
|
434
|
+
case "color":
|
|
435
|
+
return parseColor(component.value, builder);
|
|
436
|
+
case "angle":
|
|
437
|
+
return parseAngle(component.value, builder);
|
|
438
|
+
case "length-percentage":
|
|
439
|
+
return parseLength(component.value, builder);
|
|
440
|
+
case "token-list":
|
|
441
|
+
return reduceParseUnparsed(
|
|
442
|
+
component.value,
|
|
443
|
+
builder,
|
|
444
|
+
"@property",
|
|
445
|
+
false,
|
|
446
|
+
);
|
|
447
|
+
case "custom-ident":
|
|
448
|
+
case "literal":
|
|
449
|
+
return component.value;
|
|
450
|
+
case "repeated": {
|
|
451
|
+
const results = component.value.components
|
|
452
|
+
.map((c) => parsePropertyInitialValue(c, builder))
|
|
453
|
+
.filter(
|
|
454
|
+
(v): v is NonNullable<StyleDescriptor> => v !== undefined,
|
|
455
|
+
);
|
|
456
|
+
// Unwrap single-child repeated values so downstream consumers get a
|
|
457
|
+
// scalar instead of a 1-element array. For example, `<length>+` with
|
|
458
|
+
// initial-value `10px` should produce the same shape as `<length>`.
|
|
459
|
+
return results.length === 1 ? results[0] : results;
|
|
460
|
+
}
|
|
461
|
+
default:
|
|
462
|
+
return undefined;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
@@ -577,6 +577,12 @@ export class StylesheetBuilder {
|
|
|
577
577
|
this.ruleTemplate.cq.push(query);
|
|
578
578
|
}
|
|
579
579
|
|
|
580
|
+
addRootVariable(name: string, value: StyleDescriptor) {
|
|
581
|
+
this.shared.rootVariables ??= {};
|
|
582
|
+
this.shared.rootVariables[name] ??= [];
|
|
583
|
+
this.shared.rootVariables[name].push([value]);
|
|
584
|
+
}
|
|
585
|
+
|
|
580
586
|
newAnimationFrames(name: string) {
|
|
581
587
|
this.shared.animations ??= {};
|
|
582
588
|
|
package/src/compiler/supports.ts
CHANGED
|
@@ -21,8 +21,6 @@ export function supportsConditionValid(condition: SupportsCondition): boolean {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const declarations: Record<string, string[]> = {
|
|
24
|
-
// We don't actually support this, but its needed for Tailwind CSS
|
|
25
|
-
"-moz-orient": ["inline"],
|
|
26
24
|
// Special text used by TailwindCSS. We should probably change this to all color-mix
|
|
27
|
-
|
|
25
|
+
color: ["color-mix(in lab, red, red)"],
|
|
28
26
|
};
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { copyComponentProperties } from "./copyComponentProperties";
|
|
11
11
|
|
|
12
12
|
const mapping: StyledConfiguration<typeof RNFlatList> = {
|
|
13
|
+
className: "style",
|
|
13
14
|
ListFooterComponentClassName: "ListFooterComponentStyle",
|
|
14
15
|
ListHeaderComponentClassName: "ListHeaderComponentStyle",
|
|
15
16
|
columnWrapperClassName: "columnWrapperStyle",
|
|
@@ -62,22 +62,22 @@ export const saturate: StyleFunctionResolver = (resolveValue, value) => {
|
|
|
62
62
|
export const opacity: StyleFunctionResolver = (resolveValue, value) => {
|
|
63
63
|
const args = resolveValue(value[2]);
|
|
64
64
|
return {
|
|
65
|
-
|
|
65
|
+
opacity: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
const color = ["color", "
|
|
69
|
+
const color = ["color", "color"] as const;
|
|
70
70
|
const offsetX = ["offsetX", "number"] as const;
|
|
71
71
|
const offsetY = ["offsetY", "number"] as const;
|
|
72
|
-
const
|
|
72
|
+
const standardDeviation = ["standardDeviation", "number"] as const;
|
|
73
73
|
|
|
74
74
|
const handler = shorthandHandler(
|
|
75
75
|
[
|
|
76
|
-
[offsetX, offsetY,
|
|
76
|
+
[offsetX, offsetY, standardDeviation, color],
|
|
77
77
|
[color, offsetX, offsetY],
|
|
78
|
-
[color, offsetX, offsetY,
|
|
78
|
+
[color, offsetX, offsetY, standardDeviation],
|
|
79
79
|
[offsetX, offsetY, color],
|
|
80
|
-
[offsetX, offsetY,
|
|
80
|
+
[offsetX, offsetY, standardDeviation, color],
|
|
81
81
|
],
|
|
82
82
|
[],
|
|
83
83
|
"object",
|
|
@@ -268,6 +268,50 @@ export function getStyledProps(
|
|
|
268
268
|
return result;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
/**
|
|
272
|
+
* Merges two prop objects, skipping keys from `right` whose value is `undefined`
|
|
273
|
+
* or an empty plain object.
|
|
274
|
+
*
|
|
275
|
+
* `Object.assign({}, left, right)` copies all enumerable own properties from `right`,
|
|
276
|
+
* including those with value `undefined` or `{}`. When a component passes
|
|
277
|
+
* `style={undefined}` or `contentContainerStyle={{}}`, the computed NativeWind
|
|
278
|
+
* style from `left` gets overwritten. This function prevents that by only copying
|
|
279
|
+
* values that carry meaningful style information.
|
|
280
|
+
*
|
|
281
|
+
* Empty object detection uses inline `for...in` instead of a separate function or
|
|
282
|
+
* `Object.keys().length` — avoids both function call overhead and intermediate array
|
|
283
|
+
* allocation on a hot path (called per-prop per-render). Consistent with how the
|
|
284
|
+
* `["style"]` target path handles this via `filterCssVariables({})` returning `undefined`.
|
|
285
|
+
*
|
|
286
|
+
* @param left - The computed NativeWind props (className-derived styles)
|
|
287
|
+
* @param right - The inline props from the component (guaranteed non-null by caller; may contain undefined values)
|
|
288
|
+
* @returns A new object with all properties from `left`, overridden only by meaningful values from `right`
|
|
289
|
+
*/
|
|
290
|
+
function mergeDefinedProps(
|
|
291
|
+
left: Record<string, any> | undefined,
|
|
292
|
+
right: Record<string, any>,
|
|
293
|
+
) {
|
|
294
|
+
const result = left ? { ...left } : {};
|
|
295
|
+
for (const key in right) {
|
|
296
|
+
const value = right[key];
|
|
297
|
+
if (value === undefined) continue;
|
|
298
|
+
// Non-object values (strings, numbers, booleans, null, arrays): always assign
|
|
299
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
300
|
+
result[key] = value;
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
// Plain object: assign only if non-empty. An empty style object (e.g.,
|
|
304
|
+
// contentContainerStyle={{}}) has no properties to apply and should not
|
|
305
|
+
// overwrite computed className styles. The for...in loop only executes
|
|
306
|
+
// if the object has enumerable keys — empty objects are skipped.
|
|
307
|
+
for (const _ in value) {
|
|
308
|
+
result[key] = value;
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
|
|
271
315
|
function deepMergeConfig(
|
|
272
316
|
config: Config,
|
|
273
317
|
left: Record<string, any> | undefined,
|
|
@@ -359,10 +403,10 @@ function deepMergeConfig(
|
|
|
359
403
|
}
|
|
360
404
|
}
|
|
361
405
|
} else {
|
|
362
|
-
result =
|
|
406
|
+
result = mergeDefinedProps(left, right);
|
|
363
407
|
}
|
|
364
408
|
} else {
|
|
365
|
-
result =
|
|
409
|
+
result = mergeDefinedProps(left, right);
|
|
366
410
|
}
|
|
367
411
|
|
|
368
412
|
if (
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isStyleDescriptorArray,
|
|
4
|
+
isStyleFunction,
|
|
5
|
+
} from "react-native-css/utilities";
|
|
3
6
|
|
|
4
7
|
import { setDeepPath } from "../../objects";
|
|
5
8
|
import { ShortHandSymbol } from "../constants";
|
|
@@ -56,6 +59,16 @@ export function shorthandHandler(
|
|
|
56
59
|
return type.includes(value) || type.includes(typeof value);
|
|
57
60
|
}
|
|
58
61
|
|
|
62
|
+
// Style functions (var, calc, env, etc.) are unresolved at pattern-match
|
|
63
|
+
// time — their actual values won't be known until runtime variable
|
|
64
|
+
// resolution. Accepting them in any type slot makes pattern matching
|
|
65
|
+
// less strict when variables are involved, but rejecting them would
|
|
66
|
+
// break variable-based shadows entirely (e.g. box-shadow: var(--shadow)
|
|
67
|
+
// where --shadow resolves to "0 4px 6px -1px #000").
|
|
68
|
+
if (isStyleFunction(value)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
59
72
|
switch (type) {
|
|
60
73
|
case "string":
|
|
61
74
|
case "number":
|
|
@@ -4,7 +4,9 @@ import { isStyleDescriptorArray } from "react-native-css/utilities";
|
|
|
4
4
|
import type { StyleFunctionResolver } from "../resolve";
|
|
5
5
|
import { shorthandHandler } from "./_handler";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// "color" type accepts both strings ("#fff") and objects (PlatformColor from currentcolor).
|
|
8
|
+
// Using "string" here would reject platform color objects and silently drop the shadow.
|
|
9
|
+
const color = ["color", "color"] as const;
|
|
8
10
|
const offsetX = ["offsetX", "number"] as const;
|
|
9
11
|
const offsetY = ["offsetY", "number"] as const;
|
|
10
12
|
const blurRadius = ["blurRadius", "number"] as const;
|
|
@@ -41,22 +43,32 @@ export const boxShadow: StyleFunctionResolver = (
|
|
|
41
43
|
|
|
42
44
|
if (!isStyleDescriptorArray(args)) {
|
|
43
45
|
return args;
|
|
44
|
-
} else {
|
|
45
|
-
return args
|
|
46
|
-
.flatMap(flattenShadowDescriptor)
|
|
47
|
-
.map((shadows) => {
|
|
48
|
-
if (shadows === undefined) {
|
|
49
|
-
return;
|
|
50
|
-
} else {
|
|
51
|
-
return normalizeInsetValue(
|
|
52
|
-
omitTransparentShadows(
|
|
53
|
-
handler(resolveValue, shadows, get, options),
|
|
54
|
-
),
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
.filter((v) => v !== undefined);
|
|
59
46
|
}
|
|
47
|
+
|
|
48
|
+
// A flat array of primitives (e.g. [0, 4, 6, -1, "#000"]) is a single shadow
|
|
49
|
+
// resolved from a runtime variable. Pass it directly to the pattern handler.
|
|
50
|
+
// A nested array (e.g. [[0, 4, 6, -1, "#000"], [...]]) is multiple shadows.
|
|
51
|
+
if (args.length > 0 && !Array.isArray(args[0])) {
|
|
52
|
+
const result = handler(resolveValue, args, get, options);
|
|
53
|
+
if (result === undefined) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const filtered = omitTransparentShadows(result);
|
|
57
|
+
return filtered !== undefined ? [normalizeInsetValue(filtered)] : [];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return args
|
|
61
|
+
.flatMap(flattenShadowDescriptor)
|
|
62
|
+
.map((shadows) => {
|
|
63
|
+
if (shadows === undefined) {
|
|
64
|
+
return;
|
|
65
|
+
} else {
|
|
66
|
+
return normalizeInsetValue(
|
|
67
|
+
omitTransparentShadows(handler(resolveValue, shadows, get, options)),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
.filter((v) => v !== undefined);
|
|
60
72
|
};
|
|
61
73
|
|
|
62
74
|
function flattenShadowDescriptor(arg: StyleDescriptor): StyleDescriptor[] {
|