@stylexjs/shared 0.2.0-beta.15 → 0.2.0-beta.17
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/convert-to-className.d.ts +1 -1
- package/lib/convert-to-className.js +6 -22
- package/lib/convert-to-className.js.flow +1 -1
- package/lib/generate-css-rule.d.ts +1 -1
- package/lib/generate-css-rule.js +3 -14
- package/lib/generate-css-rule.js.flow +1 -1
- package/lib/hash.d.ts +2 -2
- package/lib/hash.js +9 -33
- package/lib/hash.js.flow +1 -3
- package/lib/index.d.ts +9 -9
- package/lib/index.js +0 -14
- package/lib/index.js.flow +9 -9
- package/lib/messages.d.ts +26 -26
- package/lib/messages.js +26 -36
- package/lib/messages.js.flow +26 -26
- package/lib/physical-rtl/generate-ltr.js +39 -67
- package/lib/physical-rtl/generate-ltr.js.flow +1 -1
- package/lib/physical-rtl/generate-rtl.d.ts +1 -2
- package/lib/physical-rtl/generate-rtl.js +57 -89
- package/lib/physical-rtl/generate-rtl.js.flow +1 -2
- package/lib/preprocess-rules/PreRule.d.ts +3 -3
- package/lib/preprocess-rules/PreRule.js +3 -17
- package/lib/preprocess-rules/PreRule.js.flow +3 -3
- package/lib/preprocess-rules/application-order.d.ts +8 -5
- package/lib/preprocess-rules/application-order.js +121 -160
- package/lib/preprocess-rules/application-order.js.flow +6 -5
- package/lib/preprocess-rules/basic-validation.d.ts +1 -1
- package/lib/preprocess-rules/basic-validation.js +6 -15
- package/lib/preprocess-rules/basic-validation.js.flow +1 -1
- package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +2 -2
- package/lib/preprocess-rules/flatten-raw-style-obj.js +14 -43
- package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +2 -2
- package/lib/preprocess-rules/index.d.ts +2 -2
- package/lib/preprocess-rules/index.js +6 -15
- package/lib/preprocess-rules/index.js.flow +2 -2
- package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +3 -2
- package/lib/preprocess-rules/legacy-expand-shorthands.js +14 -33
- package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +2 -2
- package/lib/preprocess-rules/property-specificity.d.ts +8 -5
- package/lib/preprocess-rules/property-specificity.js +54 -76
- package/lib/preprocess-rules/property-specificity.js.flow +6 -5
- package/lib/stylex-create-vars.d.ts +17 -8
- package/lib/stylex-create-vars.js +30 -17
- package/lib/stylex-create-vars.js.flow +10 -4
- package/lib/stylex-create.d.ts +2 -2
- package/lib/stylex-create.js +1 -20
- package/lib/stylex-create.js.flow +1 -1
- package/lib/stylex-first-that-works.js +0 -10
- package/lib/stylex-include.js +0 -10
- package/lib/stylex-keyframes.d.ts +1 -1
- package/lib/stylex-keyframes.js +7 -27
- package/lib/stylex-keyframes.js.flow +1 -1
- package/lib/stylex-override-vars.d.ts +11 -4
- package/lib/stylex-override-vars.js +32 -18
- package/lib/stylex-override-vars.js.flow +3 -3
- package/lib/transform-value.js +11 -29
- package/lib/transform-value.js.flow +1 -1
- package/lib/utils/Rule.d.ts +2 -2
- package/lib/utils/Rule.js +0 -21
- package/lib/utils/Rule.js.flow +2 -2
- package/lib/utils/dashify.js +1 -9
- package/lib/utils/default-options.d.ts +1 -1
- package/lib/utils/default-options.js +2 -23
- package/lib/utils/default-options.js.flow +1 -1
- package/lib/utils/file-based-identifier.js +1 -9
- package/lib/utils/genCSSRule.d.ts +1 -1
- package/lib/utils/genCSSRule.js +6 -16
- package/lib/utils/genCSSRule.js.flow +1 -1
- package/lib/utils/normalize-value.js +1 -13
- package/lib/utils/normalize-value.js.flow +1 -1
- package/lib/utils/normalizers/detect-unclosed-fns.d.ts +1 -1
- package/lib/utils/normalizers/detect-unclosed-fns.js +2 -14
- package/lib/utils/normalizers/detect-unclosed-fns.js.flow +1 -1
- package/lib/utils/normalizers/font-size-px-to-rem.d.ts +1 -1
- package/lib/utils/normalizers/font-size-px-to-rem.js +4 -19
- package/lib/utils/normalizers/font-size-px-to-rem.js.flow +1 -1
- package/lib/utils/normalizers/leading-zero.d.ts +1 -1
- package/lib/utils/normalizers/leading-zero.js +3 -15
- package/lib/utils/normalizers/leading-zero.js.flow +1 -1
- package/lib/utils/normalizers/quotes.d.ts +1 -1
- package/lib/utils/normalizers/quotes.js +4 -17
- package/lib/utils/normalizers/quotes.js.flow +1 -1
- package/lib/utils/normalizers/timings.d.ts +1 -1
- package/lib/utils/normalizers/timings.js +4 -18
- package/lib/utils/normalizers/timings.js.flow +1 -1
- package/lib/utils/normalizers/whitespace.d.ts +1 -1
- package/lib/utils/normalizers/whitespace.js +12 -27
- package/lib/utils/normalizers/whitespace.js.flow +1 -1
- package/lib/utils/normalizers/zero-dimensions.d.ts +1 -1
- package/lib/utils/normalizers/zero-dimensions.js +8 -23
- package/lib/utils/normalizers/zero-dimensions.js.flow +1 -1
- package/lib/utils/object-utils.d.ts +28 -20
- package/lib/utils/object-utils.js +2 -15
- package/lib/utils/object-utils.js.flow +23 -27
- package/lib/utils/property-priorities.js +68 -83
- package/lib/utils/split-css-value.d.ts +1 -1
- package/lib/utils/split-css-value.js +8 -22
- package/lib/utils/split-css-value.js.flow +1 -1
- package/lib/validate.js +2 -11
- package/package.json +2 -3
@@ -4,102 +4,76 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = generateLTR;
|
7
|
-
/**
|
8
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
9
|
-
*
|
10
|
-
* This source code is licensed under the MIT license found in the
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*/
|
16
|
-
|
17
7
|
const logicalToPhysical = {
|
18
|
-
start:
|
19
|
-
end:
|
8
|
+
start: "left",
|
9
|
+
end: "right"
|
20
10
|
};
|
21
11
|
const propertyToLTR = {
|
22
|
-
|
12
|
+
"margin-start": _ref => {
|
23
13
|
let [_key, val] = _ref;
|
24
|
-
return [
|
14
|
+
return ["margin-left", val];
|
25
15
|
},
|
26
|
-
|
27
|
-
'margin-end': _ref2 => {
|
16
|
+
"margin-end": _ref2 => {
|
28
17
|
let [_key, val] = _ref2;
|
29
|
-
return [
|
18
|
+
return ["margin-right", val];
|
30
19
|
},
|
31
|
-
|
32
|
-
'padding-start': _ref3 => {
|
20
|
+
"padding-start": _ref3 => {
|
33
21
|
let [_key, val] = _ref3;
|
34
|
-
return [
|
22
|
+
return ["padding-left", val];
|
35
23
|
},
|
36
|
-
|
37
|
-
'padding-end': _ref4 => {
|
24
|
+
"padding-end": _ref4 => {
|
38
25
|
let [_key, val] = _ref4;
|
39
|
-
return [
|
26
|
+
return ["padding-right", val];
|
40
27
|
},
|
41
|
-
|
42
|
-
'border-start': _ref5 => {
|
28
|
+
"border-start": _ref5 => {
|
43
29
|
let [_key, val] = _ref5;
|
44
|
-
return [
|
30
|
+
return ["border-left", val];
|
45
31
|
},
|
46
|
-
|
47
|
-
'border-end': _ref6 => {
|
32
|
+
"border-end": _ref6 => {
|
48
33
|
let [_key, val] = _ref6;
|
49
|
-
return [
|
34
|
+
return ["border-right", val];
|
50
35
|
},
|
51
|
-
|
52
|
-
'border-start-width': _ref7 => {
|
36
|
+
"border-start-width": _ref7 => {
|
53
37
|
let [_key, val] = _ref7;
|
54
|
-
return [
|
38
|
+
return ["border-left-width", val];
|
55
39
|
},
|
56
|
-
|
57
|
-
'border-end-width': _ref8 => {
|
40
|
+
"border-end-width": _ref8 => {
|
58
41
|
let [_key, val] = _ref8;
|
59
|
-
return [
|
42
|
+
return ["border-right-width", val];
|
60
43
|
},
|
61
|
-
|
62
|
-
'border-start-color': _ref9 => {
|
44
|
+
"border-start-color": _ref9 => {
|
63
45
|
let [_key, val] = _ref9;
|
64
|
-
return [
|
46
|
+
return ["border-left-color", val];
|
65
47
|
},
|
66
|
-
|
67
|
-
'border-end-color': _ref10 => {
|
48
|
+
"border-end-color": _ref10 => {
|
68
49
|
let [_key, val] = _ref10;
|
69
|
-
return [
|
50
|
+
return ["border-right-color", val];
|
70
51
|
},
|
71
|
-
|
72
|
-
'border-start-style': _ref11 => {
|
52
|
+
"border-start-style": _ref11 => {
|
73
53
|
let [_key, val] = _ref11;
|
74
|
-
return [
|
54
|
+
return ["border-left-style", val];
|
75
55
|
},
|
76
|
-
|
77
|
-
'border-end-style': _ref12 => {
|
56
|
+
"border-end-style": _ref12 => {
|
78
57
|
let [_key, val] = _ref12;
|
79
|
-
return [
|
58
|
+
return ["border-right-style", val];
|
80
59
|
},
|
81
|
-
|
82
|
-
'border-top-start-radius': _ref13 => {
|
60
|
+
"border-top-start-radius": _ref13 => {
|
83
61
|
let [_key, val] = _ref13;
|
84
|
-
return [
|
62
|
+
return ["border-top-left-radius", val];
|
85
63
|
},
|
86
|
-
|
87
|
-
'border-bottom-start-radius': _ref14 => {
|
64
|
+
"border-bottom-start-radius": _ref14 => {
|
88
65
|
let [_key, val] = _ref14;
|
89
|
-
return [
|
66
|
+
return ["border-bottom-left-radius", val];
|
90
67
|
},
|
91
|
-
|
92
|
-
'border-top-end-radius': _ref15 => {
|
68
|
+
"border-top-end-radius": _ref15 => {
|
93
69
|
let [_key, val] = _ref15;
|
94
|
-
return [
|
70
|
+
return ["border-top-right-radius", val];
|
95
71
|
},
|
96
|
-
|
97
|
-
'border-bottom-end-radius': _ref16 => {
|
72
|
+
"border-bottom-end-radius": _ref16 => {
|
98
73
|
let [_key, val] = _ref16;
|
99
|
-
return [
|
74
|
+
return ["border-bottom-right-radius", val];
|
100
75
|
},
|
101
|
-
|
102
|
-
'text-align': _ref17 => {
|
76
|
+
"text-align": _ref17 => {
|
103
77
|
let [key, val] = _ref17;
|
104
78
|
return [key, logicalToPhysical[val] ?? val];
|
105
79
|
},
|
@@ -113,17 +87,15 @@ const propertyToLTR = {
|
|
113
87
|
},
|
114
88
|
start: _ref20 => {
|
115
89
|
let [_key, val] = _ref20;
|
116
|
-
return [
|
90
|
+
return ["left", val];
|
117
91
|
},
|
118
|
-
// 'inset-inline-start': ([key, val]: [string, string]) => ['left', val],
|
119
92
|
end: _ref21 => {
|
120
93
|
let [_key, val] = _ref21;
|
121
|
-
return [
|
94
|
+
return ["right", val];
|
122
95
|
},
|
123
|
-
|
124
|
-
'background-position': _ref22 => {
|
96
|
+
"background-position": _ref22 => {
|
125
97
|
let [key, val] = _ref22;
|
126
|
-
return [key, val.split(
|
98
|
+
return [key, val.split(" ").map(word => word === "start" ? "left" : word === "end" ? "right" : word).join(" ")];
|
127
99
|
}
|
128
100
|
};
|
129
101
|
function generateLTR(pair) {
|
@@ -6,25 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.default = generateRTL;
|
7
7
|
var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9
|
-
/**
|
10
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
11
|
-
*
|
12
|
-
* This source code is licensed under the MIT license found in the
|
13
|
-
* LICENSE file in the root directory of this source tree.
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
9
|
const cursorFlip = {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
10
|
+
"e-resize": "w-resize",
|
11
|
+
"w-resize": "e-resize",
|
12
|
+
"ne-resize": "nw-resize",
|
13
|
+
"nesw-resize": "nwse-resize",
|
14
|
+
"nw-resize": "ne-resize",
|
15
|
+
"nwse-resize": "nesw-resize",
|
16
|
+
"se-resize": "sw-resize",
|
17
|
+
"sw-resize": "se-resize"
|
28
18
|
};
|
29
19
|
function splitByDivisor(value) {
|
30
20
|
const ast = (0, _postcssValueParser.default)(value);
|
@@ -38,7 +28,7 @@ function splitByDivisor(value) {
|
|
38
28
|
currGroup = [];
|
39
29
|
}
|
40
30
|
for (const node of ast.nodes) {
|
41
|
-
if (node.type ===
|
31
|
+
if (node.type === "div") {
|
42
32
|
push();
|
43
33
|
} else {
|
44
34
|
currGroup.push(node);
|
@@ -48,130 +38,110 @@ function splitByDivisor(value) {
|
|
48
38
|
return groups;
|
49
39
|
}
|
50
40
|
function flipSign(value) {
|
51
|
-
if (value ===
|
41
|
+
if (value === "0") {
|
52
42
|
return value;
|
53
43
|
} else {
|
54
|
-
return value[0] ===
|
44
|
+
return value[0] === "-" ? value.slice(1) : "-" + value;
|
55
45
|
}
|
56
46
|
}
|
57
47
|
function flipShadow(value) {
|
58
48
|
const defs = splitByDivisor(value);
|
59
49
|
const builtDefs = [];
|
60
50
|
for (const def of defs) {
|
61
|
-
const parts = def.split(
|
51
|
+
const parts = def.split(" ");
|
62
52
|
const index = _postcssValueParser.default.unit(parts[0]) === false ? 1 : 0;
|
63
53
|
if (index < parts.length) {
|
64
54
|
parts[index] = flipSign(parts[index]);
|
65
55
|
}
|
66
|
-
builtDefs.push(parts.join(
|
56
|
+
builtDefs.push(parts.join(" "));
|
67
57
|
}
|
68
|
-
const rtl = builtDefs.join(
|
58
|
+
const rtl = builtDefs.join(", ");
|
69
59
|
if (rtl !== value) {
|
70
60
|
return rtl;
|
71
61
|
}
|
72
62
|
}
|
73
|
-
|
74
|
-
// Should we be flipping shadows at all?
|
75
|
-
// I think the better approach would be to let engineers use
|
76
|
-
// CSS-vars directly.
|
77
63
|
const shadowsFlip = {
|
78
|
-
|
64
|
+
"box-shadow": _ref => {
|
79
65
|
let [key, val] = _ref;
|
80
66
|
const rtlVal = flipShadow(val);
|
81
67
|
return rtlVal ? [key, rtlVal] : null;
|
82
68
|
},
|
83
|
-
|
69
|
+
"text-shadow": _ref2 => {
|
84
70
|
let [key, val] = _ref2;
|
85
71
|
const rtlVal = flipShadow(val);
|
86
72
|
return rtlVal ? [key, rtlVal] : null;
|
87
73
|
}
|
88
74
|
};
|
89
75
|
const logicalToPhysical = {
|
90
|
-
start:
|
91
|
-
end:
|
76
|
+
start: "right",
|
77
|
+
end: "left"
|
92
78
|
};
|
93
79
|
const propertyToRTL = {
|
94
|
-
|
80
|
+
"margin-start": _ref3 => {
|
95
81
|
let [_key, val] = _ref3;
|
96
|
-
return [
|
82
|
+
return ["margin-right", val];
|
97
83
|
},
|
98
|
-
|
99
|
-
'margin-end': _ref4 => {
|
84
|
+
"margin-end": _ref4 => {
|
100
85
|
let [_key, val] = _ref4;
|
101
|
-
return [
|
86
|
+
return ["margin-left", val];
|
102
87
|
},
|
103
|
-
|
104
|
-
'padding-start': _ref5 => {
|
88
|
+
"padding-start": _ref5 => {
|
105
89
|
let [_key, val] = _ref5;
|
106
|
-
return [
|
90
|
+
return ["padding-right", val];
|
107
91
|
},
|
108
|
-
|
109
|
-
'padding-end': _ref6 => {
|
92
|
+
"padding-end": _ref6 => {
|
110
93
|
let [_key, val] = _ref6;
|
111
|
-
return [
|
94
|
+
return ["padding-left", val];
|
112
95
|
},
|
113
|
-
|
114
|
-
'border-start': _ref7 => {
|
96
|
+
"border-start": _ref7 => {
|
115
97
|
let [_key, val] = _ref7;
|
116
|
-
return [
|
98
|
+
return ["border-right", val];
|
117
99
|
},
|
118
|
-
|
119
|
-
'border-end': _ref8 => {
|
100
|
+
"border-end": _ref8 => {
|
120
101
|
let [_key, val] = _ref8;
|
121
|
-
return [
|
102
|
+
return ["border-left", val];
|
122
103
|
},
|
123
|
-
|
124
|
-
'border-start-width': _ref9 => {
|
104
|
+
"border-start-width": _ref9 => {
|
125
105
|
let [_key, val] = _ref9;
|
126
|
-
return [
|
106
|
+
return ["border-right-width", val];
|
127
107
|
},
|
128
|
-
|
129
|
-
'border-end-width': _ref10 => {
|
108
|
+
"border-end-width": _ref10 => {
|
130
109
|
let [_key, val] = _ref10;
|
131
|
-
return [
|
110
|
+
return ["border-left-width", val];
|
132
111
|
},
|
133
|
-
|
134
|
-
'border-start-color': _ref11 => {
|
112
|
+
"border-start-color": _ref11 => {
|
135
113
|
let [_key, val] = _ref11;
|
136
|
-
return [
|
114
|
+
return ["border-right-color", val];
|
137
115
|
},
|
138
|
-
|
139
|
-
'border-end-color': _ref12 => {
|
116
|
+
"border-end-color": _ref12 => {
|
140
117
|
let [_key, val] = _ref12;
|
141
|
-
return [
|
118
|
+
return ["border-left-color", val];
|
142
119
|
},
|
143
|
-
|
144
|
-
'border-start-style': _ref13 => {
|
120
|
+
"border-start-style": _ref13 => {
|
145
121
|
let [_key, val] = _ref13;
|
146
|
-
return [
|
122
|
+
return ["border-right-style", val];
|
147
123
|
},
|
148
|
-
|
149
|
-
'border-end-style': _ref14 => {
|
124
|
+
"border-end-style": _ref14 => {
|
150
125
|
let [_key, val] = _ref14;
|
151
|
-
return [
|
126
|
+
return ["border-left-style", val];
|
152
127
|
},
|
153
|
-
|
154
|
-
'border-top-start-radius': _ref15 => {
|
128
|
+
"border-top-start-radius": _ref15 => {
|
155
129
|
let [_key, val] = _ref15;
|
156
|
-
return [
|
130
|
+
return ["border-top-right-radius", val];
|
157
131
|
},
|
158
|
-
|
159
|
-
'border-bottom-start-radius': _ref16 => {
|
132
|
+
"border-bottom-start-radius": _ref16 => {
|
160
133
|
let [_key, val] = _ref16;
|
161
|
-
return [
|
134
|
+
return ["border-bottom-right-radius", val];
|
162
135
|
},
|
163
|
-
|
164
|
-
'border-top-end-radius': _ref17 => {
|
136
|
+
"border-top-end-radius": _ref17 => {
|
165
137
|
let [_key, val] = _ref17;
|
166
|
-
return [
|
138
|
+
return ["border-top-left-radius", val];
|
167
139
|
},
|
168
|
-
|
169
|
-
'border-bottom-end-radius': _ref18 => {
|
140
|
+
"border-bottom-end-radius": _ref18 => {
|
170
141
|
let [_key, val] = _ref18;
|
171
|
-
return [
|
142
|
+
return ["border-bottom-left-radius", val];
|
172
143
|
},
|
173
|
-
|
174
|
-
'text-align': _ref19 => {
|
144
|
+
"text-align": _ref19 => {
|
175
145
|
let [key, val] = _ref19;
|
176
146
|
return logicalToPhysical[val] != null ? [key, logicalToPhysical[val]] : null;
|
177
147
|
},
|
@@ -185,21 +155,19 @@ const propertyToRTL = {
|
|
185
155
|
},
|
186
156
|
start: _ref22 => {
|
187
157
|
let [_key, val] = _ref22;
|
188
|
-
return [
|
158
|
+
return ["right", val];
|
189
159
|
},
|
190
|
-
// 'inset-inline-start': ([key, val]: [string, string]) => ['right', val],
|
191
160
|
end: _ref23 => {
|
192
161
|
let [_key, val] = _ref23;
|
193
|
-
return [
|
162
|
+
return ["left", val];
|
194
163
|
},
|
195
|
-
|
196
|
-
'background-position': _ref24 => {
|
164
|
+
"background-position": _ref24 => {
|
197
165
|
let [key, val] = _ref24;
|
198
|
-
const words = val.split(
|
199
|
-
if (!words.includes(
|
166
|
+
const words = val.split(" ");
|
167
|
+
if (!words.includes("start") && !words.includes("end")) {
|
200
168
|
return null;
|
201
169
|
}
|
202
|
-
return [key, words.map(word => word ===
|
170
|
+
return [key, words.map(word => word === "start" ? "right" : word === "end" ? "left" : word).join(" ")];
|
203
171
|
},
|
204
172
|
cursor: _ref25 => {
|
205
173
|
let [key, val] = _ref25;
|
@@ -12,7 +12,7 @@ import type { IncludedStyles } from '../stylex-include';
|
|
12
12
|
export type ComputedStyle = null | Readonly<[string, InjectableStyle]>;
|
13
13
|
export interface IPreRule {
|
14
14
|
compiled(
|
15
|
-
options: StyleXOptions
|
15
|
+
options: StyleXOptions,
|
16
16
|
): IncludedStyles | ReadonlyArray<ComputedStyle>;
|
17
17
|
equals(other: IPreRule): boolean;
|
18
18
|
}
|
@@ -36,7 +36,7 @@ export declare class PreRule implements IPreRule {
|
|
36
36
|
property: string,
|
37
37
|
value: string | number | ReadonlyArray<string | number>,
|
38
38
|
pseudos?: null | undefined | ReadonlyArray<string>,
|
39
|
-
atRules?: null | undefined | ReadonlyArray<string
|
39
|
+
atRules?: null | undefined | ReadonlyArray<string>,
|
40
40
|
);
|
41
41
|
compiled(options: StyleXOptions): ReadonlyArray<[string, InjectableStyle]>;
|
42
42
|
equals(other: IPreRule): boolean;
|
@@ -45,7 +45,7 @@ export declare class PreRuleSet implements IPreRule {
|
|
45
45
|
readonly rules: ReadonlyArray<PreRule | NullPreRule>;
|
46
46
|
constructor(rules: ReadonlyArray<PreRule | NullPreRule>);
|
47
47
|
static create(
|
48
|
-
rules: ReadonlyArray<PreRule | NullPreRule | PreRuleSet
|
48
|
+
rules: ReadonlyArray<PreRule | NullPreRule | PreRuleSet>,
|
49
49
|
): AnyPreRule;
|
50
50
|
compiled(options: StyleXOptions): ReadonlyArray<ComputedStyle>;
|
51
51
|
equals(other: IPreRule): boolean;
|
@@ -6,15 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.PreRuleSet = exports.PreRule = exports.PreIncludedStylesRule = exports.NullPreRule = void 0;
|
7
7
|
var _convertToClassName = require("../convert-to-className");
|
8
8
|
var _objectUtils = require("../utils/object-utils");
|
9
|
-
/**
|
10
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
11
|
-
*
|
12
|
-
* This source code is licensed under the MIT license found in the
|
13
|
-
* LICENSE file in the root directory of this source tree.
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*/
|
17
|
-
|
18
9
|
class NullPreRule {
|
19
10
|
compiled(_options) {
|
20
11
|
return [null];
|
@@ -29,23 +20,18 @@ class PreIncludedStylesRule {
|
|
29
20
|
this.includedStyles = IncludedStyles;
|
30
21
|
}
|
31
22
|
equals(other) {
|
32
|
-
return other instanceof PreIncludedStylesRule &&
|
33
|
-
// We can use reference equality here.
|
34
|
-
this.includedStyles === other.includedStyles;
|
23
|
+
return other instanceof PreIncludedStylesRule && this.includedStyles === other.includedStyles;
|
35
24
|
}
|
36
25
|
compiled(_options) {
|
37
26
|
return this.includedStyles;
|
38
27
|
}
|
39
28
|
}
|
40
|
-
|
41
|
-
// a comparator function that sorts strings alphabetically
|
42
|
-
// but where `default` always comes first
|
43
29
|
exports.PreIncludedStylesRule = PreIncludedStylesRule;
|
44
30
|
const stringComparator = (a, b) => {
|
45
|
-
if (a ===
|
31
|
+
if (a === "default") {
|
46
32
|
return -1;
|
47
33
|
}
|
48
|
-
if (b ===
|
34
|
+
if (b === "default") {
|
49
35
|
return 1;
|
50
36
|
}
|
51
37
|
return a.localeCompare(b);
|
@@ -19,7 +19,7 @@ export type ComputedStyle = null | $ReadOnly<[string, InjectableStyle]>;
|
|
19
19
|
// with all the metadata needed to compile them into CSS.
|
20
20
|
export interface IPreRule {
|
21
21
|
compiled(
|
22
|
-
options: StyleXOptions
|
22
|
+
options: StyleXOptions,
|
23
23
|
): IncludedStyles | $ReadOnlyArray<ComputedStyle>;
|
24
24
|
equals(other: IPreRule): boolean;
|
25
25
|
}
|
@@ -47,7 +47,7 @@ declare export class PreRule implements IPreRule {
|
|
47
47
|
property: string,
|
48
48
|
value: string | number | $ReadOnlyArray<string | number>,
|
49
49
|
pseudos?: ?$ReadOnlyArray<string>,
|
50
|
-
atRules?: ?$ReadOnlyArray<string
|
50
|
+
atRules?: ?$ReadOnlyArray<string>,
|
51
51
|
): void;
|
52
52
|
compiled(options: StyleXOptions): $ReadOnlyArray<[string, InjectableStyle]>;
|
53
53
|
equals(other: IPreRule): boolean;
|
@@ -57,7 +57,7 @@ declare export class PreRuleSet implements IPreRule {
|
|
57
57
|
+rules: $ReadOnlyArray<PreRule | NullPreRule>;
|
58
58
|
constructor(rules: $ReadOnlyArray<PreRule | NullPreRule>): void;
|
59
59
|
static create(
|
60
|
-
rules: $ReadOnlyArray<PreRule | NullPreRule | PreRuleSet
|
60
|
+
rules: $ReadOnlyArray<PreRule | NullPreRule | PreRuleSet>,
|
61
61
|
): AnyPreRule;
|
62
62
|
compiled(options: StyleXOptions): $ReadOnlyArray<ComputedStyle>;
|
63
63
|
equals(other: IPreRule): boolean;
|
@@ -111,7 +111,7 @@ import type { TStyleValue } from '../common-types';
|
|
111
111
|
*/
|
112
112
|
|
113
113
|
type TReturn = ReadonlyArray<[string, TStyleValue]>;
|
114
|
-
declare
|
114
|
+
declare const shorthands: {
|
115
115
|
all: (_: TStyleValue) => TReturn;
|
116
116
|
animation: (value: TStyleValue) => Array<[string, TStyleValue]>;
|
117
117
|
background: (value: TStyleValue) => TReturn;
|
@@ -202,7 +202,7 @@ declare var shorthands: {
|
|
202
202
|
textEmphasis: (value: TStyleValue) => TReturn;
|
203
203
|
transition: (value: TStyleValue) => TReturn;
|
204
204
|
};
|
205
|
-
declare
|
205
|
+
declare const aliases: {
|
206
206
|
borderHorizontal: any;
|
207
207
|
borderVertical: any;
|
208
208
|
borderBlockStart: any;
|
@@ -248,6 +248,9 @@ declare var aliases: {
|
|
248
248
|
start: any;
|
249
249
|
end: any;
|
250
250
|
};
|
251
|
-
declare
|
252
|
-
|
253
|
-
|
251
|
+
declare const $$EXPORT_DEFAULT_DECLARATION$$: Readonly</**
|
252
|
+
* > 205 | ...typeof shorthands,
|
253
|
+
* | ^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with complex spreads" is currently not supported.
|
254
|
+
**/
|
255
|
+
any>;
|
256
|
+
export default $$EXPORT_DEFAULT_DECLARATION$$;
|