react-native-css 3.0.0-nightly.27bd5e2 → 3.0.0-nightly.4af17f5
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 +6 -2
- package/dist/commonjs/compiler/atRules.js.map +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 +57 -18
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +177 -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 +125 -40
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/jest/index.js +24 -25
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +7 -5
- 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 +6 -2
- package/dist/module/compiler/atRules.js.map +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 +57 -18
- 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 +172 -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 +124 -39
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/jest/index.js +25 -10
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +7 -5
- 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/example/app.config.d.ts +4 -0
- package/dist/typescript/commonjs/example/app.config.d.ts.map +1 -0
- 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 +23 -5
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +11 -5
- 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/example/app.config.d.ts +4 -0
- package/dist/typescript/module/example/app.config.d.ts.map +1 -0
- 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 +23 -5
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +11 -5
- 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 +28 -4
- package/src/compiler/atRules.ts +7 -2
- package/src/compiler/attributes.test.ts +1 -1
- package/src/compiler/compiler.ts +63 -33
- package/src/compiler/compiler.types.ts +7 -5
- package/src/compiler/declarations.ts +300 -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 +168 -38
- package/src/jest/index.ts +34 -11
- package/src/metro/index.ts +12 -6
- 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
- package/types.d.ts +70 -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
|
}
|
|
@@ -791,6 +850,8 @@ function parseUnparsed(tokenOrValue, builder, allowAuto = false) {
|
|
|
791
850
|
return true;
|
|
792
851
|
} else if (value === "false") {
|
|
793
852
|
return false;
|
|
853
|
+
} else if (value === "infinity") {
|
|
854
|
+
return Number.MAX_SAFE_INTEGER;
|
|
794
855
|
} else {
|
|
795
856
|
return value;
|
|
796
857
|
}
|
|
@@ -808,11 +869,17 @@ function parseUnparsed(tokenOrValue, builder, allowAuto = false) {
|
|
|
808
869
|
return parseDimension(tokenOrValue.value, builder);
|
|
809
870
|
case "comma":
|
|
810
871
|
return CommaSeparator;
|
|
872
|
+
case "delim":
|
|
873
|
+
{
|
|
874
|
+
if (property === "aspect-ratio" && tokenOrValue.value.value === "/") {
|
|
875
|
+
return tokenOrValue.value.value;
|
|
876
|
+
}
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
811
879
|
case "at-keyword":
|
|
812
880
|
case "hash":
|
|
813
881
|
case "id-hash":
|
|
814
882
|
case "unquoted-url":
|
|
815
|
-
case "delim":
|
|
816
883
|
case "white-space":
|
|
817
884
|
case "comment":
|
|
818
885
|
case "colon":
|
|
@@ -865,22 +932,32 @@ function parseLength(length, builder) {
|
|
|
865
932
|
inlineRem = 14
|
|
866
933
|
} = builder.getOptions();
|
|
867
934
|
if (typeof length === "number") {
|
|
868
|
-
return length;
|
|
935
|
+
return round(length);
|
|
869
936
|
}
|
|
870
937
|
if ("unit" in length) {
|
|
871
938
|
switch (length.unit) {
|
|
872
939
|
case "px":
|
|
873
|
-
|
|
940
|
+
{
|
|
941
|
+
if (length.value === Infinity) {
|
|
942
|
+
return 9999;
|
|
943
|
+
} else if (length.value === -Infinity) {
|
|
944
|
+
return -9999;
|
|
945
|
+
} else {
|
|
946
|
+
// Normalize large values to safe integers, e.g. `calc(infinity * 1px)`
|
|
947
|
+
const value = Math.max(Math.min(length.value, Number.MAX_SAFE_INTEGER), Number.MIN_SAFE_INTEGER);
|
|
948
|
+
return round(value);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
874
951
|
case "rem":
|
|
875
952
|
if (typeof inlineRem === "number") {
|
|
876
953
|
return length.value * inlineRem;
|
|
877
954
|
} else {
|
|
878
|
-
return [{}, "rem", length.value];
|
|
955
|
+
return [{}, "rem", round(length.value)];
|
|
879
956
|
}
|
|
880
957
|
case "vw":
|
|
881
958
|
case "vh":
|
|
882
959
|
case "em":
|
|
883
|
-
return [{}, length.unit, length.value, 1];
|
|
960
|
+
return [{}, length.unit, round(length.value), 1];
|
|
884
961
|
case "in":
|
|
885
962
|
case "cm":
|
|
886
963
|
case "mm":
|
|
@@ -965,7 +1042,7 @@ function parseAngle(angle, builder) {
|
|
|
965
1042
|
case "rad":
|
|
966
1043
|
return `${angle.value}${angle.type}`;
|
|
967
1044
|
default:
|
|
968
|
-
builder.addWarning("value", angle.value);
|
|
1045
|
+
builder.addWarning("value", `${angle.value} ${angle.type}`);
|
|
969
1046
|
return undefined;
|
|
970
1047
|
}
|
|
971
1048
|
}
|
|
@@ -1023,7 +1100,7 @@ function parseSize(size, builder, options, {
|
|
|
1023
1100
|
}
|
|
1024
1101
|
return;
|
|
1025
1102
|
}
|
|
1026
|
-
function
|
|
1103
|
+
function parseColorOrAutoDeclaration({
|
|
1027
1104
|
value
|
|
1028
1105
|
}, builder) {
|
|
1029
1106
|
if (value.type === "auto") {
|
|
@@ -1413,19 +1490,27 @@ function parseBorderStyle(value, builder) {
|
|
|
1413
1490
|
builder.addWarning("value", value.top);
|
|
1414
1491
|
return undefined;
|
|
1415
1492
|
}
|
|
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
1493
|
function parseBorderBlockWidth(declaration, builder) {
|
|
1424
1494
|
builder.addDescriptor("border-top-width", parseBorderSideWidth(declaration.value.start, builder));
|
|
1425
1495
|
builder.addDescriptor("border-bottom-width", parseBorderSideWidth(declaration.value.end, builder));
|
|
1426
1496
|
}
|
|
1497
|
+
function parseBorderBlockStyle(declaration, builder) {
|
|
1498
|
+
if (declaration.value.start === declaration.value.end) {
|
|
1499
|
+
builder.addDescriptor("border-style", parseBorderStyle(declaration.value.start, builder));
|
|
1500
|
+
} else {
|
|
1501
|
+
builder.addWarning("property", "border-block-style");
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1427
1504
|
function parseBorderSideWidthDeclaration(declaration, builder) {
|
|
1428
|
-
|
|
1505
|
+
if (declaration.property.includes("block")) {
|
|
1506
|
+
builder.addDescriptor(`border-${declaration.property.includes("start") ? "top" : "bottom"}-width`, parseBorderSideWidth(declaration.value, builder));
|
|
1507
|
+
return;
|
|
1508
|
+
} else if (declaration.property.includes("inline")) {
|
|
1509
|
+
builder.addDescriptor(`border-${declaration.property.includes("start") ? "left" : "right"}-width`, parseBorderSideWidth(declaration.value, builder));
|
|
1510
|
+
return;
|
|
1511
|
+
} else {
|
|
1512
|
+
return parseBorderSideWidth(declaration.value, builder);
|
|
1513
|
+
}
|
|
1429
1514
|
}
|
|
1430
1515
|
function parseBorderSideWidth(value, builder) {
|
|
1431
1516
|
if (value.type === "length") {
|
|
@@ -1470,7 +1555,7 @@ function parseLineHeight(value, builder) {
|
|
|
1470
1555
|
return parseLength(length, builder);
|
|
1471
1556
|
case "percentage":
|
|
1472
1557
|
case "calc":
|
|
1473
|
-
builder.addWarning("
|
|
1558
|
+
builder.addWarning("style", "line-height", typeof length.value === "number" ? length.value : JSON.stringify(length.value));
|
|
1474
1559
|
return;
|
|
1475
1560
|
default:
|
|
1476
1561
|
{
|
|
@@ -1540,8 +1625,8 @@ function parseLengthOrCoercePercentageToRuntime(value, builder) {
|
|
|
1540
1625
|
}
|
|
1541
1626
|
function parseGap(declaration, builder) {
|
|
1542
1627
|
if ("column" in declaration.value) {
|
|
1543
|
-
builder.addDescriptor("row-gap",
|
|
1544
|
-
builder.addDescriptor("column-gap",
|
|
1628
|
+
builder.addDescriptor("row-gap", parseGapValue(declaration.value.row, builder));
|
|
1629
|
+
builder.addDescriptor("column-gap", parseGapValue(declaration.value.column, builder));
|
|
1545
1630
|
return;
|
|
1546
1631
|
} else {
|
|
1547
1632
|
if (declaration.value.type === "normal") {
|
|
@@ -1551,6 +1636,13 @@ function parseGap(declaration, builder) {
|
|
|
1551
1636
|
return parseLength(declaration.value.value, builder);
|
|
1552
1637
|
}
|
|
1553
1638
|
}
|
|
1639
|
+
function parseGapValue(value, builder) {
|
|
1640
|
+
if (value.type === "normal") {
|
|
1641
|
+
return;
|
|
1642
|
+
} else {
|
|
1643
|
+
return parseLength(value.value, builder);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1554
1646
|
function parseTextAlign({
|
|
1555
1647
|
value
|
|
1556
1648
|
}, builder) {
|
|
@@ -1650,7 +1742,11 @@ function parseDimension({
|
|
|
1650
1742
|
}, builder) {
|
|
1651
1743
|
switch (unit) {
|
|
1652
1744
|
case "px":
|
|
1653
|
-
|
|
1745
|
+
if (value === Infinity) {
|
|
1746
|
+
return 9999;
|
|
1747
|
+
} else {
|
|
1748
|
+
return value;
|
|
1749
|
+
}
|
|
1654
1750
|
case "%":
|
|
1655
1751
|
return `${value}%`;
|
|
1656
1752
|
case "rnh":
|
|
@@ -1675,17 +1771,24 @@ function parseUserSelect({
|
|
|
1675
1771
|
}
|
|
1676
1772
|
}
|
|
1677
1773
|
function parseSVGPaint({
|
|
1678
|
-
value
|
|
1774
|
+
value,
|
|
1775
|
+
property
|
|
1679
1776
|
}, builder) {
|
|
1777
|
+
let parsedValue;
|
|
1680
1778
|
if (value.type === "none") {
|
|
1681
|
-
|
|
1779
|
+
parsedValue = "transparent";
|
|
1682
1780
|
} else if (value.type === "color") {
|
|
1683
|
-
|
|
1781
|
+
parsedValue = parseColor(value.value, builder);
|
|
1782
|
+
} else {
|
|
1783
|
+
return;
|
|
1684
1784
|
}
|
|
1685
|
-
|
|
1785
|
+
builder.addMapping({
|
|
1786
|
+
[property]: [property]
|
|
1787
|
+
});
|
|
1788
|
+
builder.addDescriptor(property, parsedValue);
|
|
1686
1789
|
}
|
|
1687
1790
|
function round(number) {
|
|
1688
|
-
return Math.round((number + Number.EPSILON) *
|
|
1791
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
1689
1792
|
}
|
|
1690
1793
|
function parseDimensionPercentageFor_LengthValue(value, builder) {
|
|
1691
1794
|
if (value.type === "calc") {
|
|
@@ -1696,7 +1799,7 @@ function parseDimensionPercentageFor_LengthValue(value, builder) {
|
|
|
1696
1799
|
return parseLength(value.value, builder);
|
|
1697
1800
|
}
|
|
1698
1801
|
}
|
|
1699
|
-
const
|
|
1802
|
+
const allowAutoProperties = new Set(["pointer-events"]);
|
|
1700
1803
|
function parseEnv(value, builder) {
|
|
1701
1804
|
switch (value.name.type) {
|
|
1702
1805
|
case "ua":
|
|
@@ -1705,7 +1808,7 @@ function parseEnv(value, builder) {
|
|
|
1705
1808
|
case "safe-area-inset-right":
|
|
1706
1809
|
case "safe-area-inset-bottom":
|
|
1707
1810
|
case "safe-area-inset-left":
|
|
1708
|
-
return [{}, "var", [`--react-native-css-${value.name.value}`, parseUnparsed(value.fallback, builder)], 1];
|
|
1811
|
+
return [{}, "var", [`--react-native-css-${value.name.value}`, parseUnparsed(value.fallback, builder, value.name.value)], 1];
|
|
1709
1812
|
case "viewport-segment-width":
|
|
1710
1813
|
case "viewport-segment-height":
|
|
1711
1814
|
case "viewport-segment-top":
|
|
@@ -1719,14 +1822,14 @@ function parseEnv(value, builder) {
|
|
|
1719
1822
|
}
|
|
1720
1823
|
return;
|
|
1721
1824
|
}
|
|
1722
|
-
function parseCalcFn(name, tokens, builder) {
|
|
1723
|
-
const args = parseCalcArguments(tokens, builder);
|
|
1825
|
+
function parseCalcFn(name, tokens, builder, property) {
|
|
1826
|
+
const args = parseCalcArguments(tokens, builder, property);
|
|
1724
1827
|
if (args) {
|
|
1725
1828
|
return [{}, name, args];
|
|
1726
1829
|
}
|
|
1727
1830
|
return;
|
|
1728
1831
|
}
|
|
1729
|
-
function parseCalcArguments([...args], builder) {
|
|
1832
|
+
function parseCalcArguments([...args], builder, property) {
|
|
1730
1833
|
const parsed = [];
|
|
1731
1834
|
let mode;
|
|
1732
1835
|
for (const [currentIndex, arg] of args.entries()) {
|
|
@@ -1740,7 +1843,7 @@ function parseCalcArguments([...args], builder) {
|
|
|
1740
1843
|
case "function":
|
|
1741
1844
|
case "unresolved-color":
|
|
1742
1845
|
{
|
|
1743
|
-
const value = parseUnparsed(arg, builder);
|
|
1846
|
+
const value = parseUnparsed(arg, builder, property);
|
|
1744
1847
|
if (value === undefined) {
|
|
1745
1848
|
return undefined;
|
|
1746
1849
|
}
|
|
@@ -1809,7 +1912,7 @@ function parseCalcArguments([...args], builder) {
|
|
|
1809
1912
|
.splice(currentIndex, closeParenthesisIndex - currentIndex + 1)
|
|
1810
1913
|
// Then drop the surrounding parenthesis
|
|
1811
1914
|
.slice(1, -1);
|
|
1812
|
-
parsed.push(parseCalcFn("calc", innerCalcArgs, builder));
|
|
1915
|
+
parsed.push(parseCalcFn("calc", innerCalcArgs, builder, property));
|
|
1813
1916
|
break;
|
|
1814
1917
|
}
|
|
1815
1918
|
case "close-parenthesis":
|
|
@@ -1850,20 +1953,20 @@ function parseTranslateProp(value, prop, builder) {
|
|
|
1850
1953
|
}
|
|
1851
1954
|
return parseLength(value[prop], builder);
|
|
1852
1955
|
}
|
|
1853
|
-
function parseUnresolvedColor(color, builder) {
|
|
1956
|
+
function parseUnresolvedColor(color, builder, property, allowAuto) {
|
|
1854
1957
|
switch (color.type) {
|
|
1855
1958
|
case "rgb":
|
|
1856
|
-
return [{}, "rgba", [round(color.r * 255), round(color.g * 255), round(color.b * 255), parseUnparsed(color.alpha, builder)]];
|
|
1959
|
+
return [{}, "rgba", [round(color.r * 255), round(color.g * 255), round(color.b * 255), parseUnparsed(color.alpha, builder, property)]];
|
|
1857
1960
|
case "hsl":
|
|
1858
|
-
return [{}, color.type, [color.h, color.s, color.l, parseUnparsed(color.alpha, builder)]];
|
|
1961
|
+
return [{}, color.type, [color.h, color.s, color.l, parseUnparsed(color.alpha, builder, property)]];
|
|
1859
1962
|
case "light-dark":
|
|
1860
1963
|
{
|
|
1861
1964
|
const extraRule = builder.extendRule({
|
|
1862
1965
|
m: [["=", "prefers-color-scheme", "dark"]]
|
|
1863
1966
|
});
|
|
1864
|
-
builder.addUnnamedDescriptor(reduceParseUnparsed(color.dark, builder), false, extraRule);
|
|
1967
|
+
builder.addUnnamedDescriptor(reduceParseUnparsed(color.dark, builder, property, allowAuto), false, extraRule);
|
|
1865
1968
|
builder.addExtraRule(extraRule);
|
|
1866
|
-
return reduceParseUnparsed(color.light, builder);
|
|
1969
|
+
return reduceParseUnparsed(color.light, builder, property, allowAuto);
|
|
1867
1970
|
}
|
|
1868
1971
|
default:
|
|
1869
1972
|
color;
|