react-native-css 3.0.0-nightly.61014be → 3.0.0-nightly.d8cb1bc
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/atRules.js +1 -1
- package/dist/commonjs/compiler/attributes.test.js +1 -1
- package/dist/commonjs/compiler/attributes.test.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +26 -17
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +173 -74
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +7 -7
- package/dist/commonjs/compiler/inheritance.test.js.map +1 -1
- package/dist/commonjs/compiler/selector-builder.js +457 -0
- package/dist/commonjs/compiler/selector-builder.js.map +1 -0
- package/dist/commonjs/compiler/selectors.js +10 -6
- package/dist/commonjs/compiler/selectors.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +113 -39
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/jest/index.js +23 -7
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +1 -1
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/poison.pill.js +4 -1
- package/dist/commonjs/poison.pill.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/attributes.js +42 -0
- package/dist/commonjs/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js +28 -21
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/index.js +10 -46
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +17 -17
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/injection.js +3 -2
- package/dist/commonjs/runtime/native/injection.js.map +1 -1
- package/dist/commonjs/runtime/native/react/interaction.js +10 -10
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +9 -9
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/react/useNativeCss.js +1 -0
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +1 -12
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/root.js +28 -0
- package/dist/commonjs/runtime/native/root.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calculate-props.js +53 -48
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/index.js +12 -12
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/units.js +6 -3
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/variables.js +3 -2
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
- package/dist/commonjs/runtime/utils/specificity.js +2 -1
- package/dist/commonjs/runtime/utils/specificity.js.map +1 -1
- package/dist/module/compiler/atRules.js +1 -1
- package/dist/module/compiler/attributes.test.js +1 -1
- package/dist/module/compiler/attributes.test.js.map +1 -1
- package/dist/module/compiler/compiler.js +26 -17
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/declarations.js +168 -70
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +7 -7
- package/dist/module/compiler/inheritance.test.js.map +1 -1
- package/dist/module/compiler/selector-builder.js +452 -0
- package/dist/module/compiler/selector-builder.js.map +1 -0
- package/dist/module/compiler/selectors.js +10 -6
- package/dist/module/compiler/selectors.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +112 -38
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/jest/index.js +23 -7
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +1 -1
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/poison.pill.js +4 -1
- package/dist/module/poison.pill.js.map +1 -1
- package/dist/module/runtime/native/conditions/attributes.js +38 -0
- package/dist/module/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/module/runtime/native/conditions/container-query.js +28 -21
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/index.js +10 -46
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +17 -17
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/injection.js +2 -1
- package/dist/module/runtime/native/injection.js.map +1 -1
- package/dist/module/runtime/native/react/interaction.js +10 -10
- package/dist/module/runtime/native/react/interaction.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +9 -9
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js +1 -0
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +0 -11
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/root.js +24 -0
- package/dist/module/runtime/native/root.js.map +1 -0
- package/dist/module/runtime/native/styles/calculate-props.js +53 -48
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/module/runtime/native/styles/index.js +12 -12
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- package/dist/module/runtime/native/styles/units.js +6 -3
- package/dist/module/runtime/native/styles/units.js.map +1 -1
- package/dist/module/runtime/native/styles/variables.js +2 -1
- package/dist/module/runtime/native/styles/variables.js.map +1 -1
- package/dist/module/runtime/utils/specificity.js +2 -1
- package/dist/module/runtime/utils/specificity.js.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +5 -4
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +16 -19
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +23 -0
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +21 -7
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +10 -3
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +2 -10
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/root.d.ts +11 -0
- package/dist/typescript/commonjs/src/runtime/native/root.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +5 -4
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +16 -19
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selector-builder.d.ts +23 -0
- package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +21 -7
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +10 -3
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/poison.pill.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/injection.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +2 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +2 -10
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/root.d.ts +11 -0
- package/dist/typescript/module/src/runtime/native/root.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts +1 -0
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/compiler/atRules.ts +1 -1
- package/src/compiler/attributes.test.ts +1 -1
- package/src/compiler/compiler.ts +30 -31
- package/src/compiler/compiler.types.ts +7 -5
- package/src/compiler/declarations.ts +293 -69
- package/src/compiler/inheritance.test.ts +6 -6
- package/src/compiler/selector-builder.ts +531 -0
- package/src/compiler/selectors.ts +20 -6
- package/src/compiler/stylesheet.ts +154 -45
- package/src/jest/index.ts +30 -6
- package/src/metro/index.ts +6 -3
- package/src/poison.pill.ts +5 -1
- package/src/runtime/native/conditions/attributes.ts +52 -0
- package/src/runtime/native/conditions/container-query.ts +27 -22
- package/src/runtime/native/conditions/guards.ts +1 -2
- package/src/runtime/native/conditions/index.ts +12 -66
- package/src/runtime/native/conditions/media-query.ts +18 -20
- package/src/runtime/native/injection.ts +1 -1
- package/src/runtime/native/react/interaction.ts +12 -12
- package/src/runtime/native/react/rules.ts +9 -9
- package/src/runtime/native/react/useNativeCss.ts +3 -0
- package/src/runtime/native/reactivity.ts +2 -21
- package/src/runtime/native/root.ts +31 -0
- package/src/runtime/native/styles/calculate-props.ts +59 -49
- package/src/runtime/native/styles/index.ts +12 -12
- package/src/runtime/native/styles/units.ts +7 -3
- package/src/runtime/native/styles/variables.ts +2 -6
- package/src/runtime/utils/specificity.ts +1 -0
|
@@ -13,8 +13,9 @@ exports.parseAlignItems = parseAlignItems;
|
|
|
13
13
|
exports.parseAlignSelf = parseAlignSelf;
|
|
14
14
|
exports.parseAngle = parseAngle;
|
|
15
15
|
exports.parseAspectRatio = parseAspectRatio;
|
|
16
|
-
exports.parseBorderBlockColor = parseBorderBlockColor;
|
|
17
16
|
exports.parseBorderBlockWidth = parseBorderBlockWidth;
|
|
17
|
+
exports.parseBorderInlineStyle = parseBorderInlineStyle;
|
|
18
|
+
exports.parseBorderInlineWidth = parseBorderInlineWidth;
|
|
18
19
|
exports.parseBorderSideWidth = parseBorderSideWidth;
|
|
19
20
|
exports.parseBorderSideWidthDeclaration = parseBorderSideWidthDeclaration;
|
|
20
21
|
exports.parseBorderStyle = parseBorderStyle;
|
|
@@ -24,10 +25,9 @@ exports.parseCalcArguments = parseCalcArguments;
|
|
|
24
25
|
exports.parseCalcFn = parseCalcFn;
|
|
25
26
|
exports.parseColor = parseColor;
|
|
26
27
|
exports.parseColorDeclaration = parseColorDeclaration;
|
|
27
|
-
exports.
|
|
28
|
+
exports.parseColorOrAutoDeclaration = parseColorOrAutoDeclaration;
|
|
29
|
+
exports.parseCustomDeclaration = parseCustomDeclaration;
|
|
28
30
|
exports.parseDeclaration = parseDeclaration;
|
|
29
|
-
exports.parseDeclarationCustom = parseDeclarationCustom;
|
|
30
|
-
exports.parseDeclarationUnparsed = parseDeclarationUnparsed;
|
|
31
31
|
exports.parseDimension = parseDimension;
|
|
32
32
|
exports.parseDimensionPercentageFor_LengthValue = parseDimensionPercentageFor_LengthValue;
|
|
33
33
|
exports.parseDisplay = parseDisplay;
|
|
@@ -67,6 +67,7 @@ exports.parseTextShadow = parseTextShadow;
|
|
|
67
67
|
exports.parseTime = parseTime;
|
|
68
68
|
exports.parseTranslateProp = parseTranslateProp;
|
|
69
69
|
exports.parseUnparsed = parseUnparsed;
|
|
70
|
+
exports.parseUnparsedDeclaration = parseUnparsedDeclaration;
|
|
70
71
|
exports.parseUnresolvedColor = parseUnresolvedColor;
|
|
71
72
|
exports.parseUserSelect = parseUserSelect;
|
|
72
73
|
exports.parseVerticalAlign = parseVerticalAlign;
|
|
@@ -103,37 +104,44 @@ const parsers = {
|
|
|
103
104
|
"block-size": parseSizeDeclaration,
|
|
104
105
|
"border": parseBorder,
|
|
105
106
|
"border-block": parseBorderBlock,
|
|
106
|
-
"border-block-color":
|
|
107
|
+
"border-block-color": parseBorderColor,
|
|
107
108
|
"border-block-end": parseBorderBlockEnd,
|
|
108
109
|
"border-block-end-color": parseColorDeclaration,
|
|
109
110
|
"border-block-end-width": parseBorderSideWidthDeclaration,
|
|
110
111
|
"border-block-start": parseBorderBlockStart,
|
|
111
112
|
"border-block-start-color": parseColorDeclaration,
|
|
112
113
|
"border-block-start-width": parseBorderSideWidthDeclaration,
|
|
114
|
+
"border-block-style": parseBorderBlockStyle,
|
|
113
115
|
"border-block-width": parseBorderBlockWidth,
|
|
114
116
|
"border-bottom": parseBorderSide,
|
|
115
117
|
"border-bottom-color": parseColorDeclaration,
|
|
116
118
|
"border-bottom-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
117
119
|
"border-bottom-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
120
|
+
"border-bottom-style": parseBorderStyleDeclaration,
|
|
118
121
|
"border-bottom-width": parseBorderSideWidthDeclaration,
|
|
119
122
|
"border-color": parseBorderColor,
|
|
120
123
|
"border-end-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
121
124
|
"border-end-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
122
125
|
"border-inline": parseBorderInline,
|
|
123
|
-
"border-inline-color":
|
|
126
|
+
"border-inline-color": parseBorderColor,
|
|
124
127
|
"border-inline-end": parseBorderInlineEnd,
|
|
125
128
|
"border-inline-end-color": parseColorDeclaration,
|
|
129
|
+
"border-inline-end-style": parseBorderInlineStyle,
|
|
126
130
|
"border-inline-end-width": parseBorderSideWidthDeclaration,
|
|
127
131
|
"border-inline-start": parseBorderInlineStart,
|
|
128
132
|
"border-inline-start-color": parseColorDeclaration,
|
|
133
|
+
"border-inline-start-style": parseBorderInlineStyle,
|
|
129
134
|
"border-inline-start-width": parseBorderSideWidthDeclaration,
|
|
130
|
-
"border-inline-
|
|
135
|
+
"border-inline-style": parseBorderInlineStyle,
|
|
136
|
+
"border-inline-width": parseBorderInlineWidth,
|
|
131
137
|
"border-left": parseBorderSide,
|
|
132
138
|
"border-left-color": parseColorDeclaration,
|
|
139
|
+
"border-left-style": parseBorderStyleDeclaration,
|
|
133
140
|
"border-left-width": parseBorderSideWidthDeclaration,
|
|
134
141
|
"border-radius": parseBorderRadius,
|
|
135
142
|
"border-right": parseBorderSide,
|
|
136
143
|
"border-right-color": parseColorDeclaration,
|
|
144
|
+
"border-right-style": parseBorderStyleDeclaration,
|
|
137
145
|
"border-right-width": parseBorderSideWidthDeclaration,
|
|
138
146
|
"border-start-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
139
147
|
"border-start-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
@@ -142,11 +150,12 @@ const parsers = {
|
|
|
142
150
|
"border-top-color": parseColorDeclaration,
|
|
143
151
|
"border-top-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
144
152
|
"border-top-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
153
|
+
"border-top-style": parseBorderStyleDeclaration,
|
|
145
154
|
"border-top-width": parseBorderSideWidthDeclaration,
|
|
146
155
|
"border-width": parseBorderWidth,
|
|
147
156
|
"bottom": parseSizeDeclaration,
|
|
148
157
|
"box-shadow": parseBoxShadow,
|
|
149
|
-
"caret-color":
|
|
158
|
+
"caret-color": parseCaretColor,
|
|
150
159
|
"color": parseFontColorDeclaration,
|
|
151
160
|
"column-gap": parseGap,
|
|
152
161
|
"container": parseContainer,
|
|
@@ -257,6 +266,12 @@ const parsers = {
|
|
|
257
266
|
// This is missing LightningCSS types
|
|
258
267
|
parsers["pointer-events"] = parsePointerEvents;
|
|
259
268
|
const validProperties = new Set(Object.keys(parsers));
|
|
269
|
+
function parseCaretColor(declaration, builder) {
|
|
270
|
+
builder.addMapping({
|
|
271
|
+
[declaration.property]: ["cursorColor"]
|
|
272
|
+
});
|
|
273
|
+
builder.addDescriptor("caret-color", parseColorOrAutoDeclaration(declaration, builder));
|
|
274
|
+
}
|
|
260
275
|
function parseDeclaration(declaration, builder) {
|
|
261
276
|
if ("vendorPrefix" in declaration && declaration.vendorPrefix.length) {
|
|
262
277
|
return;
|
|
@@ -265,9 +280,9 @@ function parseDeclaration(declaration, builder) {
|
|
|
265
280
|
return;
|
|
266
281
|
}
|
|
267
282
|
if (declaration.property === "unparsed") {
|
|
268
|
-
|
|
283
|
+
parseUnparsedDeclaration(declaration, builder);
|
|
269
284
|
} else if (declaration.property === "custom") {
|
|
270
|
-
|
|
285
|
+
parseCustomDeclaration(declaration, builder);
|
|
271
286
|
} else {
|
|
272
287
|
parseWithParser(declaration, builder);
|
|
273
288
|
}
|
|
@@ -276,6 +291,7 @@ function parseWithParser(declaration, builder) {
|
|
|
276
291
|
if (declaration.property in parsers) {
|
|
277
292
|
const parser = parsers[declaration.property];
|
|
278
293
|
builder.descriptorProperty = declaration.property;
|
|
294
|
+
builder.setWarningProperty(declaration.property);
|
|
279
295
|
const value = parser(declaration, builder, declaration.property);
|
|
280
296
|
if (value !== undefined) {
|
|
281
297
|
builder.addDescriptor(propertyRename[declaration.property] ?? declaration.property, value);
|
|
@@ -320,15 +336,25 @@ function parseBorderRadius({
|
|
|
320
336
|
"border-top-right-radius": parseSize2DDimensionPercentage(value.topRight, builder)
|
|
321
337
|
});
|
|
322
338
|
}
|
|
323
|
-
function parseBorderColor({
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
339
|
+
function parseBorderColor(declaration, builder) {
|
|
340
|
+
switch (declaration.property) {
|
|
341
|
+
case "border-color":
|
|
342
|
+
builder.addShorthand("border-color", {
|
|
343
|
+
"border-top-color": parseColor(declaration.value.top, builder),
|
|
344
|
+
"border-bottom-color": parseColor(declaration.value.bottom, builder),
|
|
345
|
+
"border-left-color": parseColor(declaration.value.left, builder),
|
|
346
|
+
"border-right-color": parseColor(declaration.value.right, builder)
|
|
347
|
+
});
|
|
348
|
+
break;
|
|
349
|
+
case "border-block-color":
|
|
350
|
+
builder.addDescriptor("border-top-color", parseColor(declaration.value.start, builder));
|
|
351
|
+
builder.addDescriptor("border-bottom-color", parseColor(declaration.value.end, builder));
|
|
352
|
+
break;
|
|
353
|
+
case "border-inline-color":
|
|
354
|
+
builder.addDescriptor("border-left-color", parseColor(declaration.value.start, builder));
|
|
355
|
+
builder.addDescriptor("border-right-color", parseColor(declaration.value.end, builder));
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
332
358
|
}
|
|
333
359
|
function parseBorderWidth({
|
|
334
360
|
value
|
|
@@ -396,6 +422,19 @@ function parseBorderInlineEnd({
|
|
|
396
422
|
builder.addDescriptor("border-right-color", parseColor(value.color, builder));
|
|
397
423
|
builder.addDescriptor("border-right-width", parseBorderSideWidth(value.width, builder));
|
|
398
424
|
}
|
|
425
|
+
function parseBorderInlineWidth(declaration, builder) {
|
|
426
|
+
builder.addDescriptor("border-left-width", parseBorderSideWidth(declaration.value.start, builder));
|
|
427
|
+
builder.addDescriptor("border-right-width", parseBorderSideWidth(declaration.value.end, builder));
|
|
428
|
+
}
|
|
429
|
+
function parseBorderInlineStyle(declaration, builder) {
|
|
430
|
+
if (typeof declaration.value === "string") {
|
|
431
|
+
builder.addDescriptor("border-style", parseBorderStyle(declaration.value, builder));
|
|
432
|
+
} else if (declaration.value.start === declaration.value.end) {
|
|
433
|
+
builder.addDescriptor("border-style", parseBorderStyle(declaration.value.start, builder));
|
|
434
|
+
} else {
|
|
435
|
+
builder.addWarning("property", "border-inline-style");
|
|
436
|
+
}
|
|
437
|
+
}
|
|
399
438
|
function parseFlexFlow({
|
|
400
439
|
value
|
|
401
440
|
}, builder) {
|
|
@@ -555,7 +594,11 @@ function parseLetterSpacing({
|
|
|
555
594
|
if (value.type === "normal") {
|
|
556
595
|
return;
|
|
557
596
|
}
|
|
558
|
-
|
|
597
|
+
const descriptor = parseLength(value.value, builder);
|
|
598
|
+
if (Array.isArray(descriptor) && descriptor[1] === "em" && typeof descriptor[2] === "number") {
|
|
599
|
+
return descriptor[2];
|
|
600
|
+
}
|
|
601
|
+
return descriptor;
|
|
559
602
|
}
|
|
560
603
|
function parseTextDecoration({
|
|
561
604
|
value
|
|
@@ -573,7 +616,8 @@ function parseZIndex({
|
|
|
573
616
|
return;
|
|
574
617
|
}
|
|
575
618
|
}
|
|
576
|
-
function parseContainerType(
|
|
619
|
+
function parseContainerType(_declaration, builder) {
|
|
620
|
+
builder.addContainer(["___default___"]);
|
|
577
621
|
return;
|
|
578
622
|
}
|
|
579
623
|
function parseContainerName({
|
|
@@ -588,12 +632,13 @@ function parseContainer({
|
|
|
588
632
|
builder.addContainer(value.name.type === "none" ? false : value.name.value);
|
|
589
633
|
return;
|
|
590
634
|
}
|
|
591
|
-
function
|
|
635
|
+
function parseUnparsedDeclaration(declaration, builder) {
|
|
592
636
|
let property = declaration.value.propertyId.property;
|
|
593
637
|
if (!(property in parsers)) {
|
|
594
638
|
builder.addWarning("property", property);
|
|
595
639
|
return;
|
|
596
640
|
}
|
|
641
|
+
builder.setWarningProperty(property);
|
|
597
642
|
|
|
598
643
|
/**
|
|
599
644
|
* React Native doesn't support all the logical properties
|
|
@@ -608,14 +653,14 @@ function parseDeclarationUnparsed(declaration, builder) {
|
|
|
608
653
|
*/
|
|
609
654
|
builder.descriptorProperty = property;
|
|
610
655
|
if (unparsedRuntimeParsing.has(property)) {
|
|
611
|
-
const args = parseUnparsed(declaration.value.value, builder);
|
|
656
|
+
const args = parseUnparsed(declaration.value.value, builder, property);
|
|
612
657
|
if (property === "animation") {
|
|
613
658
|
builder.addDescriptor("animation", [{}, `@${(0, _selectors.toRNProperty)(property)}`, args]);
|
|
614
659
|
} else {
|
|
615
660
|
builder.addDescriptor(property, [{}, `@${(0, _selectors.toRNProperty)(property)}`, args, 1]);
|
|
616
661
|
}
|
|
617
662
|
} else {
|
|
618
|
-
const value = parseUnparsed(declaration.value.value, builder);
|
|
663
|
+
const value = parseUnparsed(declaration.value.value, builder, property);
|
|
619
664
|
builder.addDescriptor(property, value);
|
|
620
665
|
if (property === "font-size") {
|
|
621
666
|
builder.addDescriptor("--__rn-css-em", value);
|
|
@@ -625,16 +670,21 @@ function parseDeclarationUnparsed(declaration, builder) {
|
|
|
625
670
|
}
|
|
626
671
|
}
|
|
627
672
|
}
|
|
628
|
-
function
|
|
673
|
+
function parseCustomDeclaration(declaration, builder) {
|
|
629
674
|
const property = declaration.value.name;
|
|
630
675
|
if (validProperties.has(property) || property.startsWith("--") || property.startsWith("-rn-")) {
|
|
631
|
-
builder.addDescriptor(property, parseUnparsed(declaration.value.value, builder,
|
|
676
|
+
builder.addDescriptor(property, parseUnparsed(declaration.value.value, builder, property));
|
|
677
|
+
} else if (property === "-webkit-line-clamp") {
|
|
678
|
+
builder.addMapping({
|
|
679
|
+
[property]: ["numberOfLines"]
|
|
680
|
+
});
|
|
681
|
+
builder.addDescriptor(property, parseUnparsed(declaration.value.value, builder, property));
|
|
632
682
|
} else {
|
|
633
683
|
builder.addWarning("property", declaration.value.name);
|
|
634
684
|
}
|
|
635
685
|
}
|
|
636
|
-
function reduceParseUnparsed(tokenOrValues, builder) {
|
|
637
|
-
const result = tokenOrValues.map(tokenOrValue => parseUnparsed(tokenOrValue, builder)).filter(v => v !== undefined);
|
|
686
|
+
function reduceParseUnparsed(tokenOrValues, builder, property, allowAuto) {
|
|
687
|
+
const result = tokenOrValues.map(tokenOrValue => parseUnparsed(tokenOrValue, builder, property, allowAuto)).filter(v => v !== undefined);
|
|
638
688
|
if (result.length === 0) {
|
|
639
689
|
return undefined;
|
|
640
690
|
}
|
|
@@ -648,6 +698,9 @@ function reduceParseUnparsed(tokenOrValues, builder) {
|
|
|
648
698
|
currentGroup.push(value);
|
|
649
699
|
}
|
|
650
700
|
}
|
|
701
|
+
|
|
702
|
+
// Groups are the tokens grouped together by comma location
|
|
703
|
+
// If a group only has 1 item, it shouldn't be an array
|
|
651
704
|
groups = groups.flatMap(group => {
|
|
652
705
|
if (!Array.isArray(group)) {
|
|
653
706
|
return [];
|
|
@@ -661,21 +714,26 @@ function reduceParseUnparsed(tokenOrValues, builder) {
|
|
|
661
714
|
} else {
|
|
662
715
|
return [first];
|
|
663
716
|
}
|
|
717
|
+
} else if (
|
|
718
|
+
// This is a special case for <ratio> values
|
|
719
|
+
group.includes("/") && group.every(item => typeof item === "string" && item === "/" ? item : typeof item === "number")) {
|
|
720
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
721
|
+
return [group.join(" ")];
|
|
664
722
|
} else {
|
|
665
723
|
return [group];
|
|
666
724
|
}
|
|
667
725
|
});
|
|
668
726
|
return groups.length === 1 ? groups[0] : groups;
|
|
669
727
|
}
|
|
670
|
-
function unparsedFunction(token, builder) {
|
|
671
|
-
return [{}, token.value.name, reduceParseUnparsed(token.value.arguments, builder)];
|
|
728
|
+
function unparsedFunction(token, builder, property, allowAuto) {
|
|
729
|
+
return [{}, token.value.name, reduceParseUnparsed(token.value.arguments, builder, property, allowAuto)];
|
|
672
730
|
}
|
|
673
731
|
|
|
674
732
|
/**
|
|
675
733
|
* When the CSS cannot be parsed (often due to a runtime condition like a CSS variable)
|
|
676
734
|
* This export function best efforts parsing it into a export function that we can evaluate at runtime
|
|
677
735
|
*/
|
|
678
|
-
function parseUnparsed(tokenOrValue, builder, allowAuto =
|
|
736
|
+
function parseUnparsed(tokenOrValue, builder, property, allowAuto = allowAutoProperties.has(property)) {
|
|
679
737
|
if (tokenOrValue === undefined || tokenOrValue === null) {
|
|
680
738
|
return;
|
|
681
739
|
}
|
|
@@ -694,7 +752,7 @@ function parseUnparsed(tokenOrValue, builder, allowAuto = false) {
|
|
|
694
752
|
return round(tokenOrValue);
|
|
695
753
|
}
|
|
696
754
|
if (Array.isArray(tokenOrValue)) {
|
|
697
|
-
const args = reduceParseUnparsed(tokenOrValue, builder);
|
|
755
|
+
const args = reduceParseUnparsed(tokenOrValue, builder, property, allowAuto);
|
|
698
756
|
if (!args) return;
|
|
699
757
|
if (Array.isArray(args) && args.length === 1) return args[0];
|
|
700
758
|
return args;
|
|
@@ -702,12 +760,12 @@ function parseUnparsed(tokenOrValue, builder, allowAuto = false) {
|
|
|
702
760
|
switch (tokenOrValue.type) {
|
|
703
761
|
case "unresolved-color":
|
|
704
762
|
{
|
|
705
|
-
return parseUnresolvedColor(tokenOrValue.value, builder);
|
|
763
|
+
return parseUnresolvedColor(tokenOrValue.value, builder, property, allowAuto);
|
|
706
764
|
}
|
|
707
765
|
case "var":
|
|
708
766
|
{
|
|
709
767
|
let args = tokenOrValue.value.name.ident.slice(2);
|
|
710
|
-
const fallback = parseUnparsed(tokenOrValue.value.fallback, builder);
|
|
768
|
+
const fallback = parseUnparsed(tokenOrValue.value.fallback, builder, property, allowAuto);
|
|
711
769
|
if (fallback !== undefined) {
|
|
712
770
|
args = [args, fallback];
|
|
713
771
|
}
|
|
@@ -728,7 +786,8 @@ function parseUnparsed(tokenOrValue, builder, allowAuto = false) {
|
|
|
728
786
|
case "translateX":
|
|
729
787
|
case "translateY":
|
|
730
788
|
tokenOrValue.value.name = `@${tokenOrValue.value.name}`;
|
|
731
|
-
return unparsedFunction(tokenOrValue, builder);
|
|
789
|
+
return unparsedFunction(tokenOrValue, builder, property, allowAuto);
|
|
790
|
+
case "blur":
|
|
732
791
|
case "brightness":
|
|
733
792
|
case "contrast":
|
|
734
793
|
case "cubic-bezier":
|
|
@@ -752,17 +811,17 @@ function parseUnparsed(tokenOrValue, builder, allowAuto = false) {
|
|
|
752
811
|
case "sepia":
|
|
753
812
|
case "shadow":
|
|
754
813
|
case "steps":
|
|
755
|
-
return unparsedFunction(tokenOrValue, builder);
|
|
814
|
+
return unparsedFunction(tokenOrValue, builder, property, allowAuto);
|
|
756
815
|
case "hairlineWidth":
|
|
757
816
|
return [{}, tokenOrValue.value.name, []];
|
|
758
817
|
case "calc":
|
|
759
818
|
case "max":
|
|
760
819
|
case "min":
|
|
761
820
|
case "clamp":
|
|
762
|
-
return parseCalcFn(tokenOrValue.value.name, tokenOrValue.value.arguments, builder);
|
|
821
|
+
return parseCalcFn(tokenOrValue.value.name, tokenOrValue.value.arguments, builder, property);
|
|
763
822
|
default:
|
|
764
823
|
{
|
|
765
|
-
builder.addWarning("
|
|
824
|
+
builder.addWarning("value", `${tokenOrValue.value.name}()`);
|
|
766
825
|
return;
|
|
767
826
|
}
|
|
768
827
|
}
|
|
@@ -808,11 +867,17 @@ function parseUnparsed(tokenOrValue, builder, allowAuto = false) {
|
|
|
808
867
|
return parseDimension(tokenOrValue.value, builder);
|
|
809
868
|
case "comma":
|
|
810
869
|
return CommaSeparator;
|
|
870
|
+
case "delim":
|
|
871
|
+
{
|
|
872
|
+
if (property === "aspect-ratio" && tokenOrValue.value.value === "/") {
|
|
873
|
+
return tokenOrValue.value.value;
|
|
874
|
+
}
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
811
877
|
case "at-keyword":
|
|
812
878
|
case "hash":
|
|
813
879
|
case "id-hash":
|
|
814
880
|
case "unquoted-url":
|
|
815
|
-
case "delim":
|
|
816
881
|
case "white-space":
|
|
817
882
|
case "comment":
|
|
818
883
|
case "colon":
|
|
@@ -865,22 +930,30 @@ function parseLength(length, builder) {
|
|
|
865
930
|
inlineRem = 14
|
|
866
931
|
} = builder.getOptions();
|
|
867
932
|
if (typeof length === "number") {
|
|
868
|
-
return length;
|
|
933
|
+
return round(length);
|
|
869
934
|
}
|
|
870
935
|
if ("unit" in length) {
|
|
871
936
|
switch (length.unit) {
|
|
872
937
|
case "px":
|
|
873
|
-
|
|
938
|
+
{
|
|
939
|
+
if (length.value === Infinity) {
|
|
940
|
+
return 9999;
|
|
941
|
+
} else if (length.value === -Infinity) {
|
|
942
|
+
return -9999;
|
|
943
|
+
} else {
|
|
944
|
+
return round(length.value);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
874
947
|
case "rem":
|
|
875
948
|
if (typeof inlineRem === "number") {
|
|
876
949
|
return length.value * inlineRem;
|
|
877
950
|
} else {
|
|
878
|
-
return [{}, "rem", length.value];
|
|
951
|
+
return [{}, "rem", round(length.value)];
|
|
879
952
|
}
|
|
880
953
|
case "vw":
|
|
881
954
|
case "vh":
|
|
882
955
|
case "em":
|
|
883
|
-
return [{}, length.unit, length.value, 1];
|
|
956
|
+
return [{}, length.unit, round(length.value), 1];
|
|
884
957
|
case "in":
|
|
885
958
|
case "cm":
|
|
886
959
|
case "mm":
|
|
@@ -965,7 +1038,7 @@ function parseAngle(angle, builder) {
|
|
|
965
1038
|
case "rad":
|
|
966
1039
|
return `${angle.value}${angle.type}`;
|
|
967
1040
|
default:
|
|
968
|
-
builder.addWarning("value", angle.value);
|
|
1041
|
+
builder.addWarning("value", `${angle.value} ${angle.type}`);
|
|
969
1042
|
return undefined;
|
|
970
1043
|
}
|
|
971
1044
|
}
|
|
@@ -1023,7 +1096,7 @@ function parseSize(size, builder, options, {
|
|
|
1023
1096
|
}
|
|
1024
1097
|
return;
|
|
1025
1098
|
}
|
|
1026
|
-
function
|
|
1099
|
+
function parseColorOrAutoDeclaration({
|
|
1027
1100
|
value
|
|
1028
1101
|
}, builder) {
|
|
1029
1102
|
if (value.type === "auto") {
|
|
@@ -1413,19 +1486,27 @@ function parseBorderStyle(value, builder) {
|
|
|
1413
1486
|
builder.addWarning("value", value.top);
|
|
1414
1487
|
return undefined;
|
|
1415
1488
|
}
|
|
1416
|
-
function parseBorderBlockColor({
|
|
1417
|
-
value
|
|
1418
|
-
}, builder) {
|
|
1419
|
-
builder.addDescriptor("border-top-color", parseColor(value.start, builder));
|
|
1420
|
-
builder.addDescriptor("border-bottom-color", parseColor(value.end, builder));
|
|
1421
|
-
return;
|
|
1422
|
-
}
|
|
1423
1489
|
function parseBorderBlockWidth(declaration, builder) {
|
|
1424
1490
|
builder.addDescriptor("border-top-width", parseBorderSideWidth(declaration.value.start, builder));
|
|
1425
1491
|
builder.addDescriptor("border-bottom-width", parseBorderSideWidth(declaration.value.end, builder));
|
|
1426
1492
|
}
|
|
1493
|
+
function parseBorderBlockStyle(declaration, builder) {
|
|
1494
|
+
if (declaration.value.start === declaration.value.end) {
|
|
1495
|
+
builder.addDescriptor("border-style", parseBorderStyle(declaration.value.start, builder));
|
|
1496
|
+
} else {
|
|
1497
|
+
builder.addWarning("property", "border-block-style");
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1427
1500
|
function parseBorderSideWidthDeclaration(declaration, builder) {
|
|
1428
|
-
|
|
1501
|
+
if (declaration.property.includes("block")) {
|
|
1502
|
+
builder.addDescriptor(`border-${declaration.property.includes("start") ? "top" : "bottom"}-width`, parseBorderSideWidth(declaration.value, builder));
|
|
1503
|
+
return;
|
|
1504
|
+
} else if (declaration.property.includes("inline")) {
|
|
1505
|
+
builder.addDescriptor(`border-${declaration.property.includes("start") ? "left" : "right"}-width`, parseBorderSideWidth(declaration.value, builder));
|
|
1506
|
+
return;
|
|
1507
|
+
} else {
|
|
1508
|
+
return parseBorderSideWidth(declaration.value, builder);
|
|
1509
|
+
}
|
|
1429
1510
|
}
|
|
1430
1511
|
function parseBorderSideWidth(value, builder) {
|
|
1431
1512
|
if (value.type === "length") {
|
|
@@ -1470,7 +1551,7 @@ function parseLineHeight(value, builder) {
|
|
|
1470
1551
|
return parseLength(length, builder);
|
|
1471
1552
|
case "percentage":
|
|
1472
1553
|
case "calc":
|
|
1473
|
-
builder.addWarning("
|
|
1554
|
+
builder.addWarning("style", "line-height", typeof length.value === "number" ? length.value : JSON.stringify(length.value));
|
|
1474
1555
|
return;
|
|
1475
1556
|
default:
|
|
1476
1557
|
{
|
|
@@ -1540,8 +1621,8 @@ function parseLengthOrCoercePercentageToRuntime(value, builder) {
|
|
|
1540
1621
|
}
|
|
1541
1622
|
function parseGap(declaration, builder) {
|
|
1542
1623
|
if ("column" in declaration.value) {
|
|
1543
|
-
builder.addDescriptor("row-gap",
|
|
1544
|
-
builder.addDescriptor("column-gap",
|
|
1624
|
+
builder.addDescriptor("row-gap", parseGapValue(declaration.value.row, builder));
|
|
1625
|
+
builder.addDescriptor("column-gap", parseGapValue(declaration.value.column, builder));
|
|
1545
1626
|
return;
|
|
1546
1627
|
} else {
|
|
1547
1628
|
if (declaration.value.type === "normal") {
|
|
@@ -1551,6 +1632,13 @@ function parseGap(declaration, builder) {
|
|
|
1551
1632
|
return parseLength(declaration.value.value, builder);
|
|
1552
1633
|
}
|
|
1553
1634
|
}
|
|
1635
|
+
function parseGapValue(value, builder) {
|
|
1636
|
+
if (value.type === "normal") {
|
|
1637
|
+
return;
|
|
1638
|
+
} else {
|
|
1639
|
+
return parseLength(value.value, builder);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1554
1642
|
function parseTextAlign({
|
|
1555
1643
|
value
|
|
1556
1644
|
}, builder) {
|
|
@@ -1650,7 +1738,11 @@ function parseDimension({
|
|
|
1650
1738
|
}, builder) {
|
|
1651
1739
|
switch (unit) {
|
|
1652
1740
|
case "px":
|
|
1653
|
-
|
|
1741
|
+
if (value === Infinity) {
|
|
1742
|
+
return 9999;
|
|
1743
|
+
} else {
|
|
1744
|
+
return value;
|
|
1745
|
+
}
|
|
1654
1746
|
case "%":
|
|
1655
1747
|
return `${value}%`;
|
|
1656
1748
|
case "rnh":
|
|
@@ -1675,17 +1767,24 @@ function parseUserSelect({
|
|
|
1675
1767
|
}
|
|
1676
1768
|
}
|
|
1677
1769
|
function parseSVGPaint({
|
|
1678
|
-
value
|
|
1770
|
+
value,
|
|
1771
|
+
property
|
|
1679
1772
|
}, builder) {
|
|
1773
|
+
let parsedValue;
|
|
1680
1774
|
if (value.type === "none") {
|
|
1681
|
-
|
|
1775
|
+
parsedValue = "transparent";
|
|
1682
1776
|
} else if (value.type === "color") {
|
|
1683
|
-
|
|
1777
|
+
parsedValue = parseColor(value.value, builder);
|
|
1778
|
+
} else {
|
|
1779
|
+
return;
|
|
1684
1780
|
}
|
|
1685
|
-
|
|
1781
|
+
builder.addMapping({
|
|
1782
|
+
[property]: [property]
|
|
1783
|
+
});
|
|
1784
|
+
builder.addDescriptor(property, parsedValue);
|
|
1686
1785
|
}
|
|
1687
1786
|
function round(number) {
|
|
1688
|
-
return Math.round((number + Number.EPSILON) *
|
|
1787
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
1689
1788
|
}
|
|
1690
1789
|
function parseDimensionPercentageFor_LengthValue(value, builder) {
|
|
1691
1790
|
if (value.type === "calc") {
|
|
@@ -1696,7 +1795,7 @@ function parseDimensionPercentageFor_LengthValue(value, builder) {
|
|
|
1696
1795
|
return parseLength(value.value, builder);
|
|
1697
1796
|
}
|
|
1698
1797
|
}
|
|
1699
|
-
const
|
|
1798
|
+
const allowAutoProperties = new Set(["pointer-events"]);
|
|
1700
1799
|
function parseEnv(value, builder) {
|
|
1701
1800
|
switch (value.name.type) {
|
|
1702
1801
|
case "ua":
|
|
@@ -1705,7 +1804,7 @@ function parseEnv(value, builder) {
|
|
|
1705
1804
|
case "safe-area-inset-right":
|
|
1706
1805
|
case "safe-area-inset-bottom":
|
|
1707
1806
|
case "safe-area-inset-left":
|
|
1708
|
-
return [{}, "var", [`--react-native-css-${value.name.value}`, parseUnparsed(value.fallback, builder)], 1];
|
|
1807
|
+
return [{}, "var", [`--react-native-css-${value.name.value}`, parseUnparsed(value.fallback, builder, value.name.value)], 1];
|
|
1709
1808
|
case "viewport-segment-width":
|
|
1710
1809
|
case "viewport-segment-height":
|
|
1711
1810
|
case "viewport-segment-top":
|
|
@@ -1719,14 +1818,14 @@ function parseEnv(value, builder) {
|
|
|
1719
1818
|
}
|
|
1720
1819
|
return;
|
|
1721
1820
|
}
|
|
1722
|
-
function parseCalcFn(name, tokens, builder) {
|
|
1723
|
-
const args = parseCalcArguments(tokens, builder);
|
|
1821
|
+
function parseCalcFn(name, tokens, builder, property) {
|
|
1822
|
+
const args = parseCalcArguments(tokens, builder, property);
|
|
1724
1823
|
if (args) {
|
|
1725
1824
|
return [{}, name, args];
|
|
1726
1825
|
}
|
|
1727
1826
|
return;
|
|
1728
1827
|
}
|
|
1729
|
-
function parseCalcArguments([...args], builder) {
|
|
1828
|
+
function parseCalcArguments([...args], builder, property) {
|
|
1730
1829
|
const parsed = [];
|
|
1731
1830
|
let mode;
|
|
1732
1831
|
for (const [currentIndex, arg] of args.entries()) {
|
|
@@ -1740,7 +1839,7 @@ function parseCalcArguments([...args], builder) {
|
|
|
1740
1839
|
case "function":
|
|
1741
1840
|
case "unresolved-color":
|
|
1742
1841
|
{
|
|
1743
|
-
const value = parseUnparsed(arg, builder);
|
|
1842
|
+
const value = parseUnparsed(arg, builder, property);
|
|
1744
1843
|
if (value === undefined) {
|
|
1745
1844
|
return undefined;
|
|
1746
1845
|
}
|
|
@@ -1809,7 +1908,7 @@ function parseCalcArguments([...args], builder) {
|
|
|
1809
1908
|
.splice(currentIndex, closeParenthesisIndex - currentIndex + 1)
|
|
1810
1909
|
// Then drop the surrounding parenthesis
|
|
1811
1910
|
.slice(1, -1);
|
|
1812
|
-
parsed.push(parseCalcFn("calc", innerCalcArgs, builder));
|
|
1911
|
+
parsed.push(parseCalcFn("calc", innerCalcArgs, builder, property));
|
|
1813
1912
|
break;
|
|
1814
1913
|
}
|
|
1815
1914
|
case "close-parenthesis":
|
|
@@ -1850,20 +1949,20 @@ function parseTranslateProp(value, prop, builder) {
|
|
|
1850
1949
|
}
|
|
1851
1950
|
return parseLength(value[prop], builder);
|
|
1852
1951
|
}
|
|
1853
|
-
function parseUnresolvedColor(color, builder) {
|
|
1952
|
+
function parseUnresolvedColor(color, builder, property, allowAuto) {
|
|
1854
1953
|
switch (color.type) {
|
|
1855
1954
|
case "rgb":
|
|
1856
|
-
return [{}, "rgba", [round(color.r * 255), round(color.g * 255), round(color.b * 255), parseUnparsed(color.alpha, builder)]];
|
|
1955
|
+
return [{}, "rgba", [round(color.r * 255), round(color.g * 255), round(color.b * 255), parseUnparsed(color.alpha, builder, property)]];
|
|
1857
1956
|
case "hsl":
|
|
1858
|
-
return [{}, color.type, [color.h, color.s, color.l, parseUnparsed(color.alpha, builder)]];
|
|
1957
|
+
return [{}, color.type, [color.h, color.s, color.l, parseUnparsed(color.alpha, builder, property)]];
|
|
1859
1958
|
case "light-dark":
|
|
1860
1959
|
{
|
|
1861
1960
|
const extraRule = builder.extendRule({
|
|
1862
1961
|
m: [["=", "prefers-color-scheme", "dark"]]
|
|
1863
1962
|
});
|
|
1864
|
-
builder.addUnnamedDescriptor(reduceParseUnparsed(color.dark, builder), false, extraRule);
|
|
1963
|
+
builder.addUnnamedDescriptor(reduceParseUnparsed(color.dark, builder, property, allowAuto), false, extraRule);
|
|
1865
1964
|
builder.addExtraRule(extraRule);
|
|
1866
|
-
return reduceParseUnparsed(color.light, builder);
|
|
1965
|
+
return reduceParseUnparsed(color.light, builder, property, allowAuto);
|
|
1867
1966
|
}
|
|
1868
1967
|
default:
|
|
1869
1968
|
color;
|