react-native-css 3.0.0-preview.0 → 3.0.0-preview.1
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/declarations.js +99 -24
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +5 -0
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/jest/index.js +0 -1
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/runtime/native/api.js +21 -2
- package/dist/commonjs/runtime/native/api.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +1 -5
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/units.js +10 -8
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
- package/dist/commonjs/runtime/web/api.js +18 -0
- package/dist/commonjs/runtime/web/api.js.map +1 -1
- package/dist/commonjs/style-collection/root.js +1 -0
- package/dist/commonjs/style-collection/root.js.map +1 -1
- package/dist/module/compiler/declarations.js +94 -24
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +5 -0
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/jest/index.js +1 -2
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/runtime/native/api.js +21 -3
- package/dist/module/runtime/native/api.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +0 -4
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/styles/units.js +11 -8
- package/dist/module/runtime/native/styles/units.js.map +1 -1
- package/dist/module/runtime/web/api.js +18 -1
- package/dist/module/runtime/web/api.js.map +1 -1
- package/dist/module/style-collection/root.js +1 -0
- package/dist/module/style-collection/root.js.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +12 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +13 -1
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +0 -2
- package/dist/typescript/commonjs/src/runtime/native/reactivity.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/web/api.d.ts +8 -2
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +12 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/api.d.ts +13 -1
- package/dist/typescript/module/src/runtime/native/api.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +0 -2
- package/dist/typescript/module/src/runtime/native/reactivity.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/web/api.d.ts +8 -2
- package/dist/typescript/module/src/runtime/web/api.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/compiler/declarations.ts +126 -32
- package/src/compiler/stylesheet.ts +6 -0
- package/src/jest/index.ts +1 -2
- package/src/runtime/native/{api.ts → api.tsx} +31 -4
- package/src/runtime/native/reactivity.ts +0 -4
- package/src/runtime/native/styles/units.ts +13 -8
- package/src/runtime/web/{api.ts → api.tsx} +28 -2
- package/src/style-collection/root.ts +2 -0
|
@@ -13,6 +13,7 @@ exports.parseAlignItems = parseAlignItems;
|
|
|
13
13
|
exports.parseAlignSelf = parseAlignSelf;
|
|
14
14
|
exports.parseAngle = parseAngle;
|
|
15
15
|
exports.parseAspectRatio = parseAspectRatio;
|
|
16
|
+
exports.parseBackfaceVisibility = parseBackfaceVisibility;
|
|
16
17
|
exports.parseBorderBlockWidth = parseBorderBlockWidth;
|
|
17
18
|
exports.parseBorderInlineStyle = parseBorderInlineStyle;
|
|
18
19
|
exports.parseBorderInlineWidth = parseBorderInlineWidth;
|
|
@@ -21,6 +22,7 @@ exports.parseBorderSideWidthDeclaration = parseBorderSideWidthDeclaration;
|
|
|
21
22
|
exports.parseBorderStyle = parseBorderStyle;
|
|
22
23
|
exports.parseBorderStyleDeclaration = parseBorderStyleDeclaration;
|
|
23
24
|
exports.parseBoxShadow = parseBoxShadow;
|
|
25
|
+
exports.parseBoxSizing = parseBoxSizing;
|
|
24
26
|
exports.parseCalcArguments = parseCalcArguments;
|
|
25
27
|
exports.parseCalcFn = parseCalcFn;
|
|
26
28
|
exports.parseColor = parseColor;
|
|
@@ -30,6 +32,7 @@ exports.parseCustomDeclaration = parseCustomDeclaration;
|
|
|
30
32
|
exports.parseDeclaration = parseDeclaration;
|
|
31
33
|
exports.parseDimension = parseDimension;
|
|
32
34
|
exports.parseDimensionPercentageFor_LengthValue = parseDimensionPercentageFor_LengthValue;
|
|
35
|
+
exports.parseDirection = parseDirection;
|
|
33
36
|
exports.parseDisplay = parseDisplay;
|
|
34
37
|
exports.parseEnv = parseEnv;
|
|
35
38
|
exports.parseFontColorDeclaration = parseFontColorDeclaration;
|
|
@@ -46,6 +49,7 @@ exports.parseJustifyContent = parseJustifyContent;
|
|
|
46
49
|
exports.parseLength = parseLength;
|
|
47
50
|
exports.parseLengthDeclaration = parseLengthDeclaration;
|
|
48
51
|
exports.parseLengthOrCoercePercentageToRuntime = parseLengthOrCoercePercentageToRuntime;
|
|
52
|
+
exports.parseLengthPercentageDeclaration = parseLengthPercentageDeclaration;
|
|
49
53
|
exports.parseLengthPercentageOrAuto = parseLengthPercentageOrAuto;
|
|
50
54
|
exports.parseLengthPercentageOrAutoDeclaration = parseLengthPercentageOrAutoDeclaration;
|
|
51
55
|
exports.parseLineHeight = parseLineHeight;
|
|
@@ -59,6 +63,7 @@ exports.parseSize = parseSize;
|
|
|
59
63
|
exports.parseSize2DDimensionPercentage = parseSize2DDimensionPercentage;
|
|
60
64
|
exports.parseSize2DDimensionPercentageDeclaration = parseSize2DDimensionPercentageDeclaration;
|
|
61
65
|
exports.parseSizeDeclaration = parseSizeDeclaration;
|
|
66
|
+
exports.parseSizeWithAutoDeclaration = parseSizeWithAutoDeclaration;
|
|
62
67
|
exports.parseTextAlign = parseTextAlign;
|
|
63
68
|
exports.parseTextDecorationLine = parseTextDecorationLine;
|
|
64
69
|
exports.parseTextDecorationLineDeclaration = parseTextDecorationLineDeclaration;
|
|
@@ -78,7 +83,7 @@ var _colorjs = _interopRequireDefault(require("colorjs.io"));
|
|
|
78
83
|
var _keyframes = require("./keyframes.js");
|
|
79
84
|
var _selectors = require("./selectors.js");
|
|
80
85
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
81
|
-
// cSpell:ignore rcap,vmin,svmin,lvmin,dvmin,cqmin,vmax,svmax,lvmax,dvmax,cqmax,currentcolor,oklab,oklch,prophoto
|
|
86
|
+
// cSpell:ignore rcap,vmin,svmin,lvmin,dvmin,cqmin,vmax,svmax,lvmax,dvmax,cqmax,currentcolor,oklab,oklch,prophoto,squircle,oldstyle,nums
|
|
82
87
|
|
|
83
88
|
const CommaSeparator = Symbol("CommaSeparator");
|
|
84
89
|
const propertyRename = {
|
|
@@ -101,6 +106,7 @@ const parsers = {
|
|
|
101
106
|
"animation-play-state": addAnimationValue,
|
|
102
107
|
"animation-timing-function": addAnimationValue,
|
|
103
108
|
"aspect-ratio": parseAspectRatio,
|
|
109
|
+
"backface-visibility": parseBackfaceVisibility,
|
|
104
110
|
"background-color": parseColorDeclaration,
|
|
105
111
|
"background-image": parseBackgroundImage,
|
|
106
112
|
"block-size": parseSizeDeclaration,
|
|
@@ -156,8 +162,9 @@ const parsers = {
|
|
|
156
162
|
"border-top-style": parseBorderStyleDeclaration,
|
|
157
163
|
"border-top-width": parseBorderSideWidthDeclaration,
|
|
158
164
|
"border-width": parseBorderWidth,
|
|
159
|
-
"bottom":
|
|
165
|
+
"bottom": parseSizeWithAutoDeclaration,
|
|
160
166
|
"box-shadow": parseBoxShadow,
|
|
167
|
+
"box-sizing": parseBoxSizing,
|
|
161
168
|
"caret-color": parseColorOrAutoDeclaration,
|
|
162
169
|
"color": parseFontColorDeclaration,
|
|
163
170
|
"column-gap": parseGap,
|
|
@@ -165,10 +172,11 @@ const parsers = {
|
|
|
165
172
|
"container-name": parseContainerName,
|
|
166
173
|
"container-type": parseContainerType,
|
|
167
174
|
"display": parseDisplay,
|
|
175
|
+
"direction": parseDirection,
|
|
168
176
|
"fill": parseSVGPaint,
|
|
169
177
|
"filter": parseFilter,
|
|
170
178
|
"flex": parseFlex,
|
|
171
|
-
"flex-basis":
|
|
179
|
+
"flex-basis": parseLengthPercentageDeclaration,
|
|
172
180
|
"flex-direction": ({
|
|
173
181
|
value
|
|
174
182
|
}) => value,
|
|
@@ -193,26 +201,26 @@ const parsers = {
|
|
|
193
201
|
"inline-size": parseSizeDeclaration,
|
|
194
202
|
"inset": parseInset,
|
|
195
203
|
"inset-block": parseInsetBlock,
|
|
196
|
-
"inset-block-end":
|
|
197
|
-
"inset-block-start":
|
|
204
|
+
"inset-block-end": parseLengthPercentageDeclaration,
|
|
205
|
+
"inset-block-start": parseLengthPercentageDeclaration,
|
|
198
206
|
"inset-inline": parseInsetInline,
|
|
199
|
-
"inset-inline-end":
|
|
200
|
-
"inset-inline-start":
|
|
207
|
+
"inset-inline-end": parseLengthPercentageDeclaration,
|
|
208
|
+
"inset-inline-start": parseLengthPercentageDeclaration,
|
|
201
209
|
"justify-content": parseJustifyContent,
|
|
202
|
-
"left":
|
|
210
|
+
"left": parseSizeWithAutoDeclaration,
|
|
203
211
|
"letter-spacing": parseLetterSpacing,
|
|
204
212
|
"line-height": parseLineHeightDeclaration,
|
|
205
213
|
"margin": parseMargin,
|
|
206
214
|
"margin-block": parseMarginBlock,
|
|
207
215
|
"margin-block-end": parseLengthPercentageOrAutoDeclaration,
|
|
208
216
|
"margin-block-start": parseLengthPercentageOrAutoDeclaration,
|
|
209
|
-
"margin-bottom":
|
|
217
|
+
"margin-bottom": parseSizeWithAutoDeclaration,
|
|
210
218
|
"margin-inline": parseMarginInline,
|
|
211
219
|
"margin-inline-end": parseLengthPercentageOrAutoDeclaration,
|
|
212
220
|
"margin-inline-start": parseLengthPercentageOrAutoDeclaration,
|
|
213
|
-
"margin-left":
|
|
214
|
-
"margin-right":
|
|
215
|
-
"margin-top":
|
|
221
|
+
"margin-left": parseSizeWithAutoDeclaration,
|
|
222
|
+
"margin-right": parseSizeWithAutoDeclaration,
|
|
223
|
+
"margin-top": parseSizeWithAutoDeclaration,
|
|
216
224
|
"max-block-size": parseSizeDeclaration,
|
|
217
225
|
"max-height": parseSizeDeclaration,
|
|
218
226
|
"max-inline-size": parseSizeDeclaration,
|
|
@@ -223,21 +231,24 @@ const parsers = {
|
|
|
223
231
|
"min-width": parseSizeDeclaration,
|
|
224
232
|
"opacity": ({
|
|
225
233
|
value
|
|
226
|
-
}) => value,
|
|
234
|
+
}) => round(value),
|
|
235
|
+
"outline-color": parseColorDeclaration,
|
|
236
|
+
"outline-style": parseOutlineStyle,
|
|
237
|
+
"outline-width": parseBorderSideWidthDeclaration,
|
|
227
238
|
"overflow": parseOverflow,
|
|
228
239
|
"padding": parsePadding,
|
|
229
240
|
"padding-block": parsePaddingBlock,
|
|
230
|
-
"padding-block-end":
|
|
231
|
-
"padding-block-start":
|
|
241
|
+
"padding-block-end": parseLengthPercentageDeclaration,
|
|
242
|
+
"padding-block-start": parseLengthPercentageDeclaration,
|
|
232
243
|
"padding-bottom": parseSizeDeclaration,
|
|
233
244
|
"padding-inline": parsePaddingInline,
|
|
234
|
-
"padding-inline-end":
|
|
235
|
-
"padding-inline-start":
|
|
245
|
+
"padding-inline-end": parseLengthPercentageDeclaration,
|
|
246
|
+
"padding-inline-start": parseLengthPercentageDeclaration,
|
|
236
247
|
"padding-left": parseSizeDeclaration,
|
|
237
248
|
"padding-right": parseSizeDeclaration,
|
|
238
249
|
"padding-top": parseSizeDeclaration,
|
|
239
250
|
"position": parsePosition,
|
|
240
|
-
"right":
|
|
251
|
+
"right": parseSizeWithAutoDeclaration,
|
|
241
252
|
"rotate": parseRotate,
|
|
242
253
|
"row-gap": parseGap,
|
|
243
254
|
"scale": parseScale,
|
|
@@ -252,7 +263,7 @@ const parsers = {
|
|
|
252
263
|
"text-transform": ({
|
|
253
264
|
value
|
|
254
265
|
}) => value.case,
|
|
255
|
-
"top":
|
|
266
|
+
"top": parseSizeWithAutoDeclaration,
|
|
256
267
|
"transform": parseTransform,
|
|
257
268
|
"transition": addTransitionValue,
|
|
258
269
|
"transition-delay": addTransitionValue,
|
|
@@ -468,16 +479,24 @@ function parseMarginBlock({
|
|
|
468
479
|
value
|
|
469
480
|
}, builder) {
|
|
470
481
|
builder.addShorthand("margin-block", {
|
|
471
|
-
"margin-block-start": parseLengthPercentageOrAuto(value.blockStart, builder
|
|
472
|
-
|
|
482
|
+
"margin-block-start": parseLengthPercentageOrAuto(value.blockStart, builder, {
|
|
483
|
+
allowAuto: true
|
|
484
|
+
}),
|
|
485
|
+
"margin-block-end": parseLengthPercentageOrAuto(value.blockEnd, builder, {
|
|
486
|
+
allowAuto: true
|
|
487
|
+
})
|
|
473
488
|
});
|
|
474
489
|
}
|
|
475
490
|
function parseMarginInline({
|
|
476
491
|
value
|
|
477
492
|
}, builder) {
|
|
478
493
|
builder.addShorthand("margin-inline", {
|
|
479
|
-
"margin-inline-start": parseLengthPercentageOrAuto(value.inlineStart, builder
|
|
480
|
-
|
|
494
|
+
"margin-inline-start": parseLengthPercentageOrAuto(value.inlineStart, builder, {
|
|
495
|
+
allowAuto: true
|
|
496
|
+
}),
|
|
497
|
+
"margin-inline-end": parseLengthPercentageOrAuto(value.inlineEnd, builder, {
|
|
498
|
+
allowAuto: true
|
|
499
|
+
})
|
|
481
500
|
});
|
|
482
501
|
}
|
|
483
502
|
function parsePadding({
|
|
@@ -686,6 +705,11 @@ function parseCustomDeclaration(declaration, builder) {
|
|
|
686
705
|
} else if (property === "object-position") {
|
|
687
706
|
// https://github.com/parcel-bundler/lightningcss/issues/1047
|
|
688
707
|
parseObjectPosition(declaration.value, builder);
|
|
708
|
+
} else if (property === "outline-offset") {
|
|
709
|
+
// https://github.com/parcel-bundler/lightningcss/issues/1048
|
|
710
|
+
builder.addDescriptor(property, parseUnparsed(declaration.value.value, builder, property));
|
|
711
|
+
} else if (property === "corner-shape") {
|
|
712
|
+
parseCornerShape(declaration.value, builder);
|
|
689
713
|
} else if (validProperties.has(property) || property.startsWith("--") || property.startsWith("-rn-")) {
|
|
690
714
|
builder.addDescriptor(property, parseUnparsed(declaration.value.value, builder, property));
|
|
691
715
|
} else {
|
|
@@ -1058,6 +1082,11 @@ function parseAngle(angle, builder) {
|
|
|
1058
1082
|
function parseSizeDeclaration(declaration, builder) {
|
|
1059
1083
|
return parseSize(declaration.value, builder);
|
|
1060
1084
|
}
|
|
1085
|
+
function parseSizeWithAutoDeclaration(declaration, builder) {
|
|
1086
|
+
return parseSize(declaration.value, builder, {
|
|
1087
|
+
allowAuto: true
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1061
1090
|
function parsePointerEvents({
|
|
1062
1091
|
value
|
|
1063
1092
|
}, builder) {
|
|
@@ -1273,9 +1302,14 @@ function parseColor(cssColor, builder) {
|
|
|
1273
1302
|
});
|
|
1274
1303
|
}
|
|
1275
1304
|
}
|
|
1276
|
-
function
|
|
1305
|
+
function parseLengthPercentageDeclaration(value, builder) {
|
|
1277
1306
|
return parseLengthPercentageOrAuto(value.value, builder);
|
|
1278
1307
|
}
|
|
1308
|
+
function parseLengthPercentageOrAutoDeclaration(value, builder) {
|
|
1309
|
+
return parseLengthPercentageOrAuto(value.value, builder, {
|
|
1310
|
+
allowAuto: true
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1279
1313
|
function parseLengthPercentageOrAuto(lengthPercentageOrAuto, builder, {
|
|
1280
1314
|
allowAuto = false
|
|
1281
1315
|
} = {}) {
|
|
@@ -1675,6 +1709,13 @@ function parseBoxShadow({
|
|
|
1675
1709
|
builder.addDescriptor(`boxShadow.[${index}].inset`, shadow.inset ? true : undefined);
|
|
1676
1710
|
}
|
|
1677
1711
|
}
|
|
1712
|
+
function parseBoxSizing(declaration, builder) {
|
|
1713
|
+
if (["border-box", "content-box"].includes(declaration.value)) {
|
|
1714
|
+
return declaration.value;
|
|
1715
|
+
}
|
|
1716
|
+
builder.addWarning("value", declaration.value);
|
|
1717
|
+
return undefined;
|
|
1718
|
+
}
|
|
1678
1719
|
function parseDisplay({
|
|
1679
1720
|
value
|
|
1680
1721
|
}, builder) {
|
|
@@ -1730,6 +1771,14 @@ function parseDisplay({
|
|
|
1730
1771
|
}
|
|
1731
1772
|
}
|
|
1732
1773
|
}
|
|
1774
|
+
function parseDirection(declaration, builder) {
|
|
1775
|
+
if (["ltr", "rtl"].includes(declaration.value)) {
|
|
1776
|
+
builder.addDescriptor("direction", declaration.value);
|
|
1777
|
+
builder.addDescriptor("--__rn-css-direction", declaration.value);
|
|
1778
|
+
}
|
|
1779
|
+
builder.addWarning("value", declaration.value);
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1733
1782
|
function parseAspectRatio({
|
|
1734
1783
|
value
|
|
1735
1784
|
}) {
|
|
@@ -1746,6 +1795,16 @@ function parseAspectRatio({
|
|
|
1746
1795
|
}
|
|
1747
1796
|
}
|
|
1748
1797
|
}
|
|
1798
|
+
function parseBackfaceVisibility({
|
|
1799
|
+
value
|
|
1800
|
+
}, builder) {
|
|
1801
|
+
if (["visible", "hidden"].includes(value)) {
|
|
1802
|
+
return value;
|
|
1803
|
+
} else {
|
|
1804
|
+
builder.addWarning("value", value);
|
|
1805
|
+
return;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1749
1808
|
function parseDimension({
|
|
1750
1809
|
unit,
|
|
1751
1810
|
value
|
|
@@ -2155,6 +2214,14 @@ function parseObjectPosition(declaration, builder) {
|
|
|
2155
2214
|
});
|
|
2156
2215
|
builder.addDescriptor("object-position", [{}, "join", [parseUnparsed(declaration.value, builder, "object-position"), " "]]);
|
|
2157
2216
|
}
|
|
2217
|
+
function parseCornerShape(declaration, builder) {
|
|
2218
|
+
const shape = parseUnparsed(declaration.value, builder, "corner-shape");
|
|
2219
|
+
if (shape === "round") {
|
|
2220
|
+
builder.addDescriptor("borderCurve", "circular");
|
|
2221
|
+
} else if (shape === "squircle") {
|
|
2222
|
+
builder.addDescriptor("borderCurve", "continuous");
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2158
2225
|
function parseVisibility(declaration, builder) {
|
|
2159
2226
|
if (declaration.value === "visible") {
|
|
2160
2227
|
builder.addDescriptor("opacity", 1);
|
|
@@ -2164,6 +2231,14 @@ function parseVisibility(declaration, builder) {
|
|
|
2164
2231
|
builder.addWarning("value", declaration.value);
|
|
2165
2232
|
}
|
|
2166
2233
|
}
|
|
2234
|
+
function parseOutlineStyle(declaration, builder) {
|
|
2235
|
+
const allowed = ["solid", "dotted", "dashed"];
|
|
2236
|
+
if (declaration.value.type !== "auto" && allowed.includes(declaration.value.value)) {
|
|
2237
|
+
builder.addDescriptor("outlineStyle", declaration.value.value);
|
|
2238
|
+
} else {
|
|
2239
|
+
builder.addWarning("value", declaration.value.type === "auto" ? "auto" : declaration.value.value);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2167
2242
|
function parseFilter(declaration, builder) {
|
|
2168
2243
|
if (declaration.value.type === "none") {
|
|
2169
2244
|
return "unset";
|