react-native-css 0.0.0-nightly.04af4c6 → 0.0.0-nightly.08286a2
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 +10 -14
- package/dist/commonjs/compiler/atRules.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +10 -10
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +5 -2
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/native/styles/calculate-props.js +1 -1
- package/dist/module/compiler/atRules.js +10 -14
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/declarations.js +10 -10
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +5 -2
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/native/styles/calculate-props.js +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/compiler/atRules.ts +10 -16
- package/src/compiler/declarations.ts +10 -10
- package/src/compiler/stylesheet.ts +5 -3
- package/src/native/styles/calculate-props.ts +1 -1
package/src/compiler/atRules.ts
CHANGED
|
@@ -47,11 +47,11 @@ export function maybeMutateReactNativeOptions(
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/***********************************************
|
|
50
|
-
* @
|
|
50
|
+
* @prop *
|
|
51
51
|
***********************************************/
|
|
52
52
|
|
|
53
|
-
function
|
|
54
|
-
return rule.type === "unknown" && rule.value.name === "
|
|
53
|
+
function isPropAtRule(rule: Rule | PropAtRule): rule is PropAtRule {
|
|
54
|
+
return rule.type === "unknown" && rule.value.name === "prop";
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export function parsePropAtRule(rules?: (Rule | PropAtRule)[]) {
|
|
@@ -71,14 +71,14 @@ export function parsePropAtRule(rules?: (Rule | PropAtRule)[]) {
|
|
|
71
71
|
if (!rules) return mapping;
|
|
72
72
|
|
|
73
73
|
for (const rule of rules) {
|
|
74
|
-
if (!
|
|
74
|
+
if (!isPropAtRule(rule)) continue;
|
|
75
75
|
|
|
76
76
|
if (rule.value.prelude.length > 0) {
|
|
77
77
|
const prelude = rule.value.prelude.filter((item) => {
|
|
78
78
|
return item.value.type !== "white-space";
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
propAtRuleBlock(prelude, mapping);
|
|
82
82
|
} else if (rule.value.block) {
|
|
83
83
|
// Remove all whitespace tokens
|
|
84
84
|
const blocks = rule.value.block.filter((item) => {
|
|
@@ -91,7 +91,7 @@ export function parsePropAtRule(rules?: (Rule | PropAtRule)[]) {
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
for (const block of blockRules) {
|
|
94
|
-
|
|
94
|
+
propAtRuleBlock(block, mapping);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -99,7 +99,7 @@ export function parsePropAtRule(rules?: (Rule | PropAtRule)[]) {
|
|
|
99
99
|
return mapping;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
function
|
|
102
|
+
function propAtRuleBlock(
|
|
103
103
|
token: Extract<TokenOrValue, { type: "token" }>[],
|
|
104
104
|
mapping: StyleRuleMapping = {},
|
|
105
105
|
): StyleRuleMapping {
|
|
@@ -107,7 +107,7 @@ function nativeMappingAtRuleBlock(
|
|
|
107
107
|
return item.value.type === "colon";
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
// @
|
|
110
|
+
// @props <to>; (has no from value)
|
|
111
111
|
if (!to) {
|
|
112
112
|
to = from;
|
|
113
113
|
from = [
|
|
@@ -128,10 +128,10 @@ function nativeMappingAtRuleBlock(
|
|
|
128
128
|
return mapping;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
mapping[toRNProperty(fromToken.value.value)] = to.flatMap((item, index) => {
|
|
132
132
|
switch (item.value.type) {
|
|
133
133
|
case "delim":
|
|
134
|
-
return index === 0 && item.value.value === "
|
|
134
|
+
return index === 0 && item.value.value === "*" ? ["*"] : [];
|
|
135
135
|
case "ident":
|
|
136
136
|
return item.value.value.split(".").map((part) => toRNProperty(part));
|
|
137
137
|
default:
|
|
@@ -139,11 +139,5 @@ function nativeMappingAtRuleBlock(
|
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
-
if (value.length === 2 && value[0] === "&" && value[1]) {
|
|
143
|
-
value = value[1];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
mapping[toRNProperty(fromToken.value.value)] = value;
|
|
147
|
-
|
|
148
142
|
return mapping;
|
|
149
143
|
}
|
|
@@ -1984,11 +1984,11 @@ export function parseTextShadow(
|
|
|
1984
1984
|
parseColor(textShadow.color, builder),
|
|
1985
1985
|
);
|
|
1986
1986
|
builder.addDescriptor(
|
|
1987
|
-
"
|
|
1987
|
+
"*.textShadowOffset.width",
|
|
1988
1988
|
parseLength(textShadow.xOffset, builder),
|
|
1989
1989
|
);
|
|
1990
1990
|
builder.addDescriptor(
|
|
1991
|
-
"
|
|
1991
|
+
"*.textShadowOffset.height",
|
|
1992
1992
|
parseLength(textShadow.yOffset, builder),
|
|
1993
1993
|
);
|
|
1994
1994
|
builder.addDescriptor(
|
|
@@ -2374,27 +2374,27 @@ export function parseBoxShadow(
|
|
|
2374
2374
|
) {
|
|
2375
2375
|
for (const [index, shadow] of value.entries()) {
|
|
2376
2376
|
builder.addDescriptor(
|
|
2377
|
-
|
|
2377
|
+
`*.boxShadow.[${index}].color`,
|
|
2378
2378
|
parseColor(shadow.color, builder),
|
|
2379
2379
|
);
|
|
2380
2380
|
builder.addDescriptor(
|
|
2381
|
-
|
|
2381
|
+
`*.boxShadow.[${index}].offsetX`,
|
|
2382
2382
|
parseLength(shadow.xOffset, builder),
|
|
2383
2383
|
);
|
|
2384
2384
|
builder.addDescriptor(
|
|
2385
|
-
|
|
2385
|
+
`*.boxShadow.[${index}].offsetY`,
|
|
2386
2386
|
parseLength(shadow.yOffset, builder),
|
|
2387
2387
|
);
|
|
2388
2388
|
builder.addDescriptor(
|
|
2389
|
-
|
|
2389
|
+
`*.boxShadow.[${index}].blurRadius`,
|
|
2390
2390
|
parseLength(shadow.blur, builder),
|
|
2391
2391
|
);
|
|
2392
2392
|
builder.addDescriptor(
|
|
2393
|
-
|
|
2393
|
+
`*.boxShadow.[${index}].spreadDistance`,
|
|
2394
2394
|
parseLength(shadow.spread, builder),
|
|
2395
2395
|
);
|
|
2396
2396
|
builder.addDescriptor(
|
|
2397
|
-
|
|
2397
|
+
`*.boxShadow.[${index}].inset`,
|
|
2398
2398
|
shadow.inset ? true : undefined,
|
|
2399
2399
|
);
|
|
2400
2400
|
}
|
|
@@ -3088,7 +3088,7 @@ function parseObjectFit(
|
|
|
3088
3088
|
builder: StylesheetBuilder,
|
|
3089
3089
|
) {
|
|
3090
3090
|
builder.addMapping({
|
|
3091
|
-
"object-fit":
|
|
3091
|
+
"object-fit": "contentFit",
|
|
3092
3092
|
});
|
|
3093
3093
|
builder.addDescriptor(
|
|
3094
3094
|
"object-fit",
|
|
@@ -3101,7 +3101,7 @@ function parseObjectPosition(
|
|
|
3101
3101
|
builder: StylesheetBuilder,
|
|
3102
3102
|
) {
|
|
3103
3103
|
builder.addMapping({
|
|
3104
|
-
"object-position":
|
|
3104
|
+
"object-position": "contentPosition",
|
|
3105
3105
|
});
|
|
3106
3106
|
builder.addDescriptor("object-position", [
|
|
3107
3107
|
{},
|
|
@@ -56,7 +56,7 @@ export class StylesheetBuilder {
|
|
|
56
56
|
private ruleTemplate: StyleRule = {
|
|
57
57
|
s: [],
|
|
58
58
|
},
|
|
59
|
-
// Any default mapping should be included in the @
|
|
59
|
+
// Any default mapping should be included in the @prop parsing
|
|
60
60
|
private mapping: StyleRuleMapping = {},
|
|
61
61
|
public descriptorProperty?: string,
|
|
62
62
|
private shared: {
|
|
@@ -403,10 +403,12 @@ export class StylesheetBuilder {
|
|
|
403
403
|
} else {
|
|
404
404
|
forceTuple = true;
|
|
405
405
|
}
|
|
406
|
+
} else if (propPath) {
|
|
407
|
+
forceTuple = true;
|
|
408
|
+
} else {
|
|
409
|
+
propPath = property;
|
|
406
410
|
}
|
|
407
411
|
|
|
408
|
-
propPath ??= property;
|
|
409
|
-
|
|
410
412
|
if (forceTuple && !Array.isArray(propPath)) {
|
|
411
413
|
propPath = [propPath];
|
|
412
414
|
}
|