@stylexjs/shared 0.2.0-beta.10 → 0.2.0-beta.12
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/common-types.d.ts +49 -0
- package/lib/common-types.js.flow +64 -0
- package/lib/convert-to-className.d.ts +16 -0
- package/lib/convert-to-className.js.flow +23 -0
- package/lib/generate-css-rule.d.ts +17 -0
- package/lib/generate-css-rule.js.flow +17 -0
- package/lib/hash.d.ts +11 -0
- package/lib/hash.js.flow +12 -0
- package/lib/index.d.ts +32 -95
- package/lib/index.js.flow +46 -3
- package/lib/messages.d.ts +32 -0
- package/lib/messages.js.flow +35 -0
- package/lib/physical-rtl/generate-ltr.d.ts +12 -0
- package/lib/physical-rtl/generate-ltr.js.flow +13 -0
- package/lib/physical-rtl/generate-rtl.d.ts +14 -0
- package/lib/physical-rtl/generate-rtl.js.flow +13 -0
- package/lib/preprocess-rules/PreRule.d.ts +52 -0
- package/lib/preprocess-rules/PreRule.js.flow +64 -0
- package/lib/preprocess-rules/application-order.d.ts +253 -0
- package/lib/preprocess-rules/application-order.js.flow +206 -0
- package/lib/preprocess-rules/basic-validation.d.ts +13 -0
- package/lib/preprocess-rules/basic-validation.js +3 -3
- package/lib/preprocess-rules/basic-validation.js.flow +13 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +25 -0
- package/lib/preprocess-rules/flatten-raw-style-obj.js +5 -5
- package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +27 -0
- package/lib/preprocess-rules/index.d.ts +18 -0
- package/lib/preprocess-rules/index.js.flow +19 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +122 -0
- package/lib/preprocess-rules/legacy-expand-shorthands.js +0 -139
- package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +101 -0
- package/lib/preprocess-rules/property-specificity.d.ts +76 -0
- package/lib/preprocess-rules/property-specificity.js.flow +87 -0
- package/lib/stylex-create-vars.d.ts +27 -0
- package/lib/stylex-create-vars.js +59 -0
- package/lib/stylex-create-vars.js.flow +22 -0
- package/lib/stylex-create.d.ts +23 -0
- package/lib/stylex-create.js.flow +30 -0
- package/lib/stylex-first-that-works.d.ts +14 -0
- package/lib/stylex-first-that-works.js.flow +13 -0
- package/lib/stylex-include.d.ts +19 -0
- package/lib/stylex-include.js.flow +21 -0
- package/lib/stylex-keyframes.d.ts +17 -0
- package/lib/stylex-keyframes.js.flow +20 -0
- package/lib/transform-value.d.ts +13 -0
- package/lib/transform-value.js.flow +15 -0
- package/lib/utils/Rule.d.ts +58 -0
- package/lib/utils/Rule.js.flow +64 -0
- package/lib/utils/dashify.d.ts +10 -0
- package/lib/utils/dashify.js.flow +9 -0
- package/lib/utils/default-options.d.ts +10 -0
- package/lib/utils/default-options.js.flow +24 -0
- package/lib/utils/file-based-identifier.d.ts +14 -0
- package/lib/utils/file-based-identifier.js +22 -0
- package/lib/utils/file-based-identifier.js.flow +13 -0
- package/lib/utils/genCSSRule.d.ts +16 -0
- package/lib/utils/genCSSRule.js.flow +16 -0
- package/lib/utils/normalize-value.d.ts +12 -0
- package/lib/utils/normalize-value.js.flow +14 -0
- package/lib/utils/normalizers/detect-unclosed-fns.d.ts +17 -0
- package/lib/utils/normalizers/detect-unclosed-fns.js.flow +16 -0
- package/lib/utils/normalizers/font-size-px-to-rem.d.ts +19 -0
- package/lib/utils/normalizers/font-size-px-to-rem.js +9 -4
- package/lib/utils/normalizers/font-size-px-to-rem.js.flow +18 -0
- package/lib/utils/normalizers/leading-zero.d.ts +17 -0
- package/lib/utils/normalizers/leading-zero.js.flow +16 -0
- package/lib/utils/normalizers/quotes.d.ts +19 -0
- package/lib/utils/normalizers/quotes.js.flow +18 -0
- package/lib/utils/normalizers/timings.d.ts +19 -0
- package/lib/utils/normalizers/timings.js.flow +18 -0
- package/lib/utils/normalizers/whitespace.d.ts +20 -0
- package/lib/utils/normalizers/whitespace.js.flow +19 -0
- package/lib/utils/normalizers/zero-dimensions.d.ts +19 -0
- package/lib/utils/normalizers/zero-dimensions.js.flow +18 -0
- package/lib/utils/object-utils.d.ts +61 -0
- package/lib/utils/object-utils.js.flow +81 -0
- package/lib/utils/property-priorities.d.ts +11 -0
- package/lib/utils/property-priorities.js.flow +10 -0
- package/lib/utils/split-css-value.d.ts +15 -0
- package/lib/utils/split-css-value.js.flow +16 -0
- package/lib/validate.d.ts +12 -0
- package/lib/validate.js.flow +12 -0
- package/package.json +4 -4
- package/lib/expand-shorthands.d.ts +0 -5
- package/lib/expand-shorthands.js +0 -330
- package/lib/namespace-transforms/__tests__/preflatten.test.js +0 -120
- package/lib/namespace-transforms/preflatten.js +0 -89
- package/lib/preprocess-rules/expand-shorthands.js +0 -156
- package/lib/preprocess-rules/null-out-longhand.js +0 -310
- package/lib/preprocess-rules/react-native-web.js +0 -142
- package/lib/stylex-defaultValue.js +0 -397
@@ -0,0 +1,253 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
import type { TStyleValue } from '../common-types';
|
11
|
+
/**
|
12
|
+
* Shorthand properties:
|
13
|
+
* - [x] all - Should be banned
|
14
|
+
* - [x] animation
|
15
|
+
* - [x] background
|
16
|
+
* - [x] border
|
17
|
+
* - [x] border-block-end
|
18
|
+
* - [x] border-block-start
|
19
|
+
* - [x] border-bottom
|
20
|
+
* - [x] border-color
|
21
|
+
* - [x] border-image
|
22
|
+
* - [x] border-inline-end
|
23
|
+
* - [x] border-inline-start
|
24
|
+
* - [x] border-left
|
25
|
+
* - [x] border-radius
|
26
|
+
* - [x] border-right
|
27
|
+
* - [x] border-style
|
28
|
+
* - [x] border-top
|
29
|
+
* - [x] border-width
|
30
|
+
* - [x] column-rule
|
31
|
+
* - [x] columns
|
32
|
+
* - [x] container
|
33
|
+
* - [x] flex
|
34
|
+
* - [x] flex-flow
|
35
|
+
* - [x] font
|
36
|
+
* - [x] gap
|
37
|
+
* - [x] grid
|
38
|
+
* - [x] grid-area
|
39
|
+
* - [x] grid-column
|
40
|
+
* - [x] grid-row
|
41
|
+
* - [x] grid-template
|
42
|
+
* - [x] inset
|
43
|
+
* - [x] inset-block
|
44
|
+
* - [x] inset-inline
|
45
|
+
* - [x] list-style
|
46
|
+
* - [x] margin
|
47
|
+
* - [x] mask
|
48
|
+
* - [x] offset
|
49
|
+
* - [x] outline
|
50
|
+
* - [x] overflow
|
51
|
+
* - [x] padding
|
52
|
+
* - [x] place-content
|
53
|
+
* - [x] place-items
|
54
|
+
* - [x] place-self
|
55
|
+
* - [x] scroll-margin
|
56
|
+
* - [x] scroll-padding
|
57
|
+
* - [x] text-decoration
|
58
|
+
* - [x] text-emphasis
|
59
|
+
* - [x] transition
|
60
|
+
*/
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Shorthand properties:
|
64
|
+
* - [x] all - Should be banned
|
65
|
+
* - [x] animation
|
66
|
+
* - [x] background
|
67
|
+
* - [x] border
|
68
|
+
* - [x] border-block-end
|
69
|
+
* - [x] border-block-start
|
70
|
+
* - [x] border-bottom
|
71
|
+
* - [x] border-color
|
72
|
+
* - [x] border-image
|
73
|
+
* - [x] border-inline-end
|
74
|
+
* - [x] border-inline-start
|
75
|
+
* - [x] border-left
|
76
|
+
* - [x] border-radius
|
77
|
+
* - [x] border-right
|
78
|
+
* - [x] border-style
|
79
|
+
* - [x] border-top
|
80
|
+
* - [x] border-width
|
81
|
+
* - [x] column-rule
|
82
|
+
* - [x] columns
|
83
|
+
* - [x] container
|
84
|
+
* - [x] flex
|
85
|
+
* - [x] flex-flow
|
86
|
+
* - [x] font
|
87
|
+
* - [x] gap
|
88
|
+
* - [x] grid
|
89
|
+
* - [x] grid-area
|
90
|
+
* - [x] grid-column
|
91
|
+
* - [x] grid-row
|
92
|
+
* - [x] grid-template
|
93
|
+
* - [x] inset
|
94
|
+
* - [x] inset-block
|
95
|
+
* - [x] inset-inline
|
96
|
+
* - [x] list-style
|
97
|
+
* - [x] margin
|
98
|
+
* - [x] mask
|
99
|
+
* - [x] offset
|
100
|
+
* - [x] outline
|
101
|
+
* - [x] overflow
|
102
|
+
* - [x] padding
|
103
|
+
* - [x] place-content
|
104
|
+
* - [x] place-items
|
105
|
+
* - [x] place-self
|
106
|
+
* - [x] scroll-margin
|
107
|
+
* - [x] scroll-padding
|
108
|
+
* - [x] text-decoration
|
109
|
+
* - [x] text-emphasis
|
110
|
+
* - [x] transition
|
111
|
+
*/
|
112
|
+
|
113
|
+
type TReturn = ReadonlyArray<[string, TStyleValue]>;
|
114
|
+
declare var shorthands: {
|
115
|
+
all: (_: TStyleValue) => TReturn;
|
116
|
+
animation: (value: TStyleValue) => Array<[string, TStyleValue]>;
|
117
|
+
background: (value: TStyleValue) => TReturn;
|
118
|
+
border: (rawValue: TStyleValue) => TReturn;
|
119
|
+
borderInline: (rawValue: TStyleValue) => TReturn;
|
120
|
+
borderBlock: (rawValue: TStyleValue) => TReturn;
|
121
|
+
borderTop: (rawValue: TStyleValue) => TReturn;
|
122
|
+
borderInlineEnd: (rawValue: TStyleValue) => TReturn;
|
123
|
+
borderRight: (_rawValue: TStyleValue) => TReturn;
|
124
|
+
borderBottom: (rawValue: TStyleValue) => TReturn;
|
125
|
+
borderInlineStart: (rawValue: TStyleValue) => TReturn;
|
126
|
+
borderLeft: (_rawValue: TStyleValue) => TReturn;
|
127
|
+
borderInlineWidth: (rawValue: TStyleValue) => TReturn;
|
128
|
+
borderInlineStyle: (rawValue: TStyleValue) => TReturn;
|
129
|
+
borderInlineColor: (rawValue: TStyleValue) => TReturn;
|
130
|
+
borderBlockWidth: (rawValue: TStyleValue) => TReturn;
|
131
|
+
borderBlockStyle: (rawValue: TStyleValue) => TReturn;
|
132
|
+
borderBlockColor: (rawValue: TStyleValue) => TReturn;
|
133
|
+
borderColor: (value: TStyleValue) => TReturn;
|
134
|
+
borderStyle: (value: TStyleValue) => TReturn;
|
135
|
+
borderWidth: (value: TStyleValue) => TReturn;
|
136
|
+
borderInlineStartColor: (value: TStyleValue) => TReturn;
|
137
|
+
borderInlineEndColor: (value: TStyleValue) => TReturn;
|
138
|
+
borderInlineStartStyle: (value: TStyleValue) => TReturn;
|
139
|
+
borderInlineEndStyle: (value: TStyleValue) => TReturn;
|
140
|
+
borderInlineStartWidth: (value: TStyleValue) => TReturn;
|
141
|
+
borderInlineEndWidth: (value: TStyleValue) => TReturn;
|
142
|
+
borderLeftColor: (value: TStyleValue) => TReturn;
|
143
|
+
borderRightColor: (value: TStyleValue) => TReturn;
|
144
|
+
borderLeftStyle: (value: TStyleValue) => TReturn;
|
145
|
+
borderRightStyle: (value: TStyleValue) => TReturn;
|
146
|
+
borderLeftWidth: (value: TStyleValue) => TReturn;
|
147
|
+
borderRightWidth: (value: TStyleValue) => TReturn;
|
148
|
+
borderRadius: (value: TStyleValue) => TReturn;
|
149
|
+
borderStartStartRadius: (value: TStyleValue) => TReturn;
|
150
|
+
borderStartEndRadius: (value: TStyleValue) => TReturn;
|
151
|
+
borderEndStartRadius: (value: TStyleValue) => TReturn;
|
152
|
+
borderEndEndRadius: (value: TStyleValue) => TReturn;
|
153
|
+
borderTopLeftRadius: (value: TStyleValue) => TReturn;
|
154
|
+
borderTopRightRadius: (value: TStyleValue) => TReturn;
|
155
|
+
borderBottomLeftRadius: (value: TStyleValue) => TReturn;
|
156
|
+
borderBottomRightRadius: (value: TStyleValue) => TReturn;
|
157
|
+
columnRule: (value: TStyleValue) => TReturn;
|
158
|
+
columns: (value: TStyleValue) => TReturn;
|
159
|
+
container: (value: TStyleValue) => TReturn;
|
160
|
+
flex: (value: TStyleValue) => TReturn;
|
161
|
+
flexFlow: (value: TStyleValue) => TReturn;
|
162
|
+
font: (value: TStyleValue) => TReturn;
|
163
|
+
gap: (value: TStyleValue) => TReturn;
|
164
|
+
grid: (value: TStyleValue) => TReturn;
|
165
|
+
gridArea: (value: TStyleValue) => TReturn;
|
166
|
+
gridRow: (value: TStyleValue) => TReturn;
|
167
|
+
gridColumn: (value: TStyleValue) => TReturn;
|
168
|
+
gridTemplate: (value: TStyleValue) => TReturn;
|
169
|
+
inset: (value: TStyleValue) => TReturn;
|
170
|
+
insetInline: (value: TStyleValue) => TReturn;
|
171
|
+
insetBlock: (value: TStyleValue) => TReturn;
|
172
|
+
insetInlineStart: (value: TStyleValue) => TReturn;
|
173
|
+
insetInlineEnd: (value: TStyleValue) => TReturn;
|
174
|
+
left: (value: TStyleValue) => TReturn;
|
175
|
+
right: (value: TStyleValue) => TReturn;
|
176
|
+
listStyle: (value: TStyleValue) => TReturn;
|
177
|
+
margin: (value: TStyleValue) => TReturn;
|
178
|
+
marginInline: (value: TStyleValue) => TReturn;
|
179
|
+
marginBlock: (value: TStyleValue) => TReturn;
|
180
|
+
marginInlineStart: (value: TStyleValue) => TReturn;
|
181
|
+
marginInlineEnd: (value: TStyleValue) => TReturn;
|
182
|
+
marginLeft: (value: TStyleValue) => TReturn;
|
183
|
+
marginRight: (value: TStyleValue) => TReturn;
|
184
|
+
mask: (value: TStyleValue) => TReturn;
|
185
|
+
offset: (value: TStyleValue) => TReturn;
|
186
|
+
outline: (value: TStyleValue) => TReturn;
|
187
|
+
overflow: (value: TStyleValue) => TReturn;
|
188
|
+
padding: (rawValue: TStyleValue) => TReturn;
|
189
|
+
paddingInline: (rawValue: TStyleValue) => TReturn;
|
190
|
+
paddingBlock: (rawValue: TStyleValue) => TReturn;
|
191
|
+
paddingInlineStart: (value: TStyleValue) => TReturn;
|
192
|
+
paddingInlineEnd: (value: TStyleValue) => TReturn;
|
193
|
+
paddingLeft: (value: TStyleValue) => TReturn;
|
194
|
+
paddingRight: (value: TStyleValue) => TReturn;
|
195
|
+
placeContent: (value: TStyleValue) => TReturn;
|
196
|
+
placeItems: (value: TStyleValue) => TReturn;
|
197
|
+
placeSelf: (value: TStyleValue) => TReturn;
|
198
|
+
scrollMargin: (value: TStyleValue) => TReturn;
|
199
|
+
scrollPadding: (value: TStyleValue) => TReturn;
|
200
|
+
scrollTimeline: (value: TStyleValue) => TReturn;
|
201
|
+
textDecoration: (value: TStyleValue) => TReturn;
|
202
|
+
textEmphasis: (value: TStyleValue) => TReturn;
|
203
|
+
transition: (value: TStyleValue) => TReturn;
|
204
|
+
};
|
205
|
+
declare var aliases: {
|
206
|
+
borderHorizontal: any;
|
207
|
+
borderVertical: any;
|
208
|
+
borderBlockStart: any;
|
209
|
+
borderEnd: any;
|
210
|
+
borderBlockEnd: any;
|
211
|
+
borderStart: any;
|
212
|
+
borderHorizontalWidth: any;
|
213
|
+
borderHorizontalStyle: any;
|
214
|
+
borderHorizontalColor: any;
|
215
|
+
borderVerticalWidth: any;
|
216
|
+
borderVerticalStyle: any;
|
217
|
+
borderVerticalColor: any;
|
218
|
+
borderBlockStartColor: (value: TStyleValue) => TReturn;
|
219
|
+
borderBlockEndColor: (value: TStyleValue) => TReturn;
|
220
|
+
borderBlockStartStyle: (value: TStyleValue) => TReturn;
|
221
|
+
borderBlockEndStyle: (value: TStyleValue) => TReturn;
|
222
|
+
borderBlockStartWidth: (value: TStyleValue) => TReturn;
|
223
|
+
borderBlockEndWidth: (value: TStyleValue) => TReturn;
|
224
|
+
borderStartColor: any;
|
225
|
+
borderEndColor: any;
|
226
|
+
borderStartStyle: any;
|
227
|
+
borderEndStyle: any;
|
228
|
+
borderStartWidth: any;
|
229
|
+
borderEndWidth: any;
|
230
|
+
borderTopStartRadius: (value: TStyleValue) => TReturn;
|
231
|
+
borderTopEndRadius: (value: TStyleValue) => TReturn;
|
232
|
+
borderBottomStartRadius: (value: TStyleValue) => TReturn;
|
233
|
+
borderBottomEndRadius: (value: TStyleValue) => TReturn;
|
234
|
+
marginBlockStart: (value: TStyleValue) => TReturn;
|
235
|
+
marginBlockEnd: (value: TStyleValue) => TReturn;
|
236
|
+
marginStart: any;
|
237
|
+
marginEnd: any;
|
238
|
+
marginHorizontal: any;
|
239
|
+
marginVertical: any;
|
240
|
+
paddingBlockStart: (rawValue: TStyleValue) => TReturn;
|
241
|
+
paddingBlockEnd: (rawValue: TStyleValue) => TReturn;
|
242
|
+
paddingStart: any;
|
243
|
+
paddingEnd: any;
|
244
|
+
paddingHorizontal: any;
|
245
|
+
paddingVertical: any;
|
246
|
+
insetBlockStart: (value: TStyleValue) => TReturn;
|
247
|
+
insetBlockEnd: (value: TStyleValue) => TReturn;
|
248
|
+
start: any;
|
249
|
+
end: any;
|
250
|
+
};
|
251
|
+
declare var expansions: Omit<shorthands, keyof (aliases | {})> &
|
252
|
+
Omit<aliases, keyof ({})> & {};
|
253
|
+
export default expansions;
|
@@ -0,0 +1,206 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
* @flow strict
|
8
|
+
*/
|
9
|
+
|
10
|
+
import type { TStyleValue } from '../common-types';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Shorthand properties:
|
14
|
+
* - [x] all - Should be banned
|
15
|
+
* - [x] animation
|
16
|
+
* - [x] background
|
17
|
+
* - [x] border
|
18
|
+
* - [x] border-block-end
|
19
|
+
* - [x] border-block-start
|
20
|
+
* - [x] border-bottom
|
21
|
+
* - [x] border-color
|
22
|
+
* - [x] border-image
|
23
|
+
* - [x] border-inline-end
|
24
|
+
* - [x] border-inline-start
|
25
|
+
* - [x] border-left
|
26
|
+
* - [x] border-radius
|
27
|
+
* - [x] border-right
|
28
|
+
* - [x] border-style
|
29
|
+
* - [x] border-top
|
30
|
+
* - [x] border-width
|
31
|
+
* - [x] column-rule
|
32
|
+
* - [x] columns
|
33
|
+
* - [x] container
|
34
|
+
* - [x] flex
|
35
|
+
* - [x] flex-flow
|
36
|
+
* - [x] font
|
37
|
+
* - [x] gap
|
38
|
+
* - [x] grid
|
39
|
+
* - [x] grid-area
|
40
|
+
* - [x] grid-column
|
41
|
+
* - [x] grid-row
|
42
|
+
* - [x] grid-template
|
43
|
+
* - [x] inset
|
44
|
+
* - [x] inset-block
|
45
|
+
* - [x] inset-inline
|
46
|
+
* - [x] list-style
|
47
|
+
* - [x] margin
|
48
|
+
* - [x] mask
|
49
|
+
* - [x] offset
|
50
|
+
* - [x] outline
|
51
|
+
* - [x] overflow
|
52
|
+
* - [x] padding
|
53
|
+
* - [x] place-content
|
54
|
+
* - [x] place-items
|
55
|
+
* - [x] place-self
|
56
|
+
* - [x] scroll-margin
|
57
|
+
* - [x] scroll-padding
|
58
|
+
* - [x] text-decoration
|
59
|
+
* - [x] text-emphasis
|
60
|
+
* - [x] transition
|
61
|
+
*/
|
62
|
+
|
63
|
+
type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
|
64
|
+
|
65
|
+
declare var shorthands: {
|
66
|
+
all: (_: TStyleValue) => TReturn,
|
67
|
+
animation: (value: TStyleValue) => Array<[string, TStyleValue]>,
|
68
|
+
background: (value: TStyleValue) => TReturn,
|
69
|
+
border: (rawValue: TStyleValue) => TReturn,
|
70
|
+
borderInline: (rawValue: TStyleValue) => TReturn,
|
71
|
+
borderBlock: (rawValue: TStyleValue) => TReturn,
|
72
|
+
borderTop: (rawValue: TStyleValue) => TReturn,
|
73
|
+
borderInlineEnd: (rawValue: TStyleValue) => TReturn,
|
74
|
+
borderRight: (_rawValue: TStyleValue) => TReturn,
|
75
|
+
borderBottom: (rawValue: TStyleValue) => TReturn,
|
76
|
+
borderInlineStart: (rawValue: TStyleValue) => TReturn,
|
77
|
+
borderLeft: (_rawValue: TStyleValue) => TReturn,
|
78
|
+
borderInlineWidth: (rawValue: TStyleValue) => TReturn,
|
79
|
+
borderInlineStyle: (rawValue: TStyleValue) => TReturn,
|
80
|
+
borderInlineColor: (rawValue: TStyleValue) => TReturn,
|
81
|
+
borderBlockWidth: (rawValue: TStyleValue) => TReturn,
|
82
|
+
borderBlockStyle: (rawValue: TStyleValue) => TReturn,
|
83
|
+
borderBlockColor: (rawValue: TStyleValue) => TReturn,
|
84
|
+
borderColor: (value: TStyleValue) => TReturn,
|
85
|
+
borderStyle: (value: TStyleValue) => TReturn,
|
86
|
+
borderWidth: (value: TStyleValue) => TReturn,
|
87
|
+
borderInlineStartColor: (value: TStyleValue) => TReturn,
|
88
|
+
borderInlineEndColor: (value: TStyleValue) => TReturn,
|
89
|
+
borderInlineStartStyle: (value: TStyleValue) => TReturn,
|
90
|
+
borderInlineEndStyle: (value: TStyleValue) => TReturn,
|
91
|
+
borderInlineStartWidth: (value: TStyleValue) => TReturn,
|
92
|
+
borderInlineEndWidth: (value: TStyleValue) => TReturn,
|
93
|
+
borderLeftColor: (value: TStyleValue) => TReturn,
|
94
|
+
borderRightColor: (value: TStyleValue) => TReturn,
|
95
|
+
borderLeftStyle: (value: TStyleValue) => TReturn,
|
96
|
+
borderRightStyle: (value: TStyleValue) => TReturn,
|
97
|
+
borderLeftWidth: (value: TStyleValue) => TReturn,
|
98
|
+
borderRightWidth: (value: TStyleValue) => TReturn,
|
99
|
+
borderRadius: (value: TStyleValue) => TReturn,
|
100
|
+
borderStartStartRadius: (value: TStyleValue) => TReturn,
|
101
|
+
borderStartEndRadius: (value: TStyleValue) => TReturn,
|
102
|
+
borderEndStartRadius: (value: TStyleValue) => TReturn,
|
103
|
+
borderEndEndRadius: (value: TStyleValue) => TReturn,
|
104
|
+
borderTopLeftRadius: (value: TStyleValue) => TReturn,
|
105
|
+
borderTopRightRadius: (value: TStyleValue) => TReturn,
|
106
|
+
borderBottomLeftRadius: (value: TStyleValue) => TReturn,
|
107
|
+
borderBottomRightRadius: (value: TStyleValue) => TReturn,
|
108
|
+
columnRule: (value: TStyleValue) => TReturn,
|
109
|
+
columns: (value: TStyleValue) => TReturn,
|
110
|
+
container: (value: TStyleValue) => TReturn,
|
111
|
+
flex: (value: TStyleValue) => TReturn,
|
112
|
+
flexFlow: (value: TStyleValue) => TReturn,
|
113
|
+
font: (value: TStyleValue) => TReturn,
|
114
|
+
gap: (value: TStyleValue) => TReturn,
|
115
|
+
grid: (value: TStyleValue) => TReturn,
|
116
|
+
gridArea: (value: TStyleValue) => TReturn,
|
117
|
+
gridRow: (value: TStyleValue) => TReturn,
|
118
|
+
gridColumn: (value: TStyleValue) => TReturn,
|
119
|
+
gridTemplate: (value: TStyleValue) => TReturn,
|
120
|
+
inset: (value: TStyleValue) => TReturn,
|
121
|
+
insetInline: (value: TStyleValue) => TReturn,
|
122
|
+
insetBlock: (value: TStyleValue) => TReturn,
|
123
|
+
insetInlineStart: (value: TStyleValue) => TReturn,
|
124
|
+
insetInlineEnd: (value: TStyleValue) => TReturn,
|
125
|
+
left: (value: TStyleValue) => TReturn,
|
126
|
+
right: (value: TStyleValue) => TReturn,
|
127
|
+
listStyle: (value: TStyleValue) => TReturn,
|
128
|
+
margin: (value: TStyleValue) => TReturn,
|
129
|
+
marginInline: (value: TStyleValue) => TReturn,
|
130
|
+
marginBlock: (value: TStyleValue) => TReturn,
|
131
|
+
marginInlineStart: (value: TStyleValue) => TReturn,
|
132
|
+
marginInlineEnd: (value: TStyleValue) => TReturn,
|
133
|
+
marginLeft: (value: TStyleValue) => TReturn,
|
134
|
+
marginRight: (value: TStyleValue) => TReturn,
|
135
|
+
mask: (value: TStyleValue) => TReturn,
|
136
|
+
offset: (value: TStyleValue) => TReturn,
|
137
|
+
outline: (value: TStyleValue) => TReturn,
|
138
|
+
overflow: (value: TStyleValue) => TReturn,
|
139
|
+
padding: (rawValue: TStyleValue) => TReturn,
|
140
|
+
paddingInline: (rawValue: TStyleValue) => TReturn,
|
141
|
+
paddingBlock: (rawValue: TStyleValue) => TReturn,
|
142
|
+
paddingInlineStart: (value: TStyleValue) => TReturn,
|
143
|
+
paddingInlineEnd: (value: TStyleValue) => TReturn,
|
144
|
+
paddingLeft: (value: TStyleValue) => TReturn,
|
145
|
+
paddingRight: (value: TStyleValue) => TReturn,
|
146
|
+
placeContent: (value: TStyleValue) => TReturn,
|
147
|
+
placeItems: (value: TStyleValue) => TReturn,
|
148
|
+
placeSelf: (value: TStyleValue) => TReturn,
|
149
|
+
scrollMargin: (value: TStyleValue) => TReturn,
|
150
|
+
scrollPadding: (value: TStyleValue) => TReturn,
|
151
|
+
scrollTimeline: (value: TStyleValue) => TReturn,
|
152
|
+
textDecoration: (value: TStyleValue) => TReturn,
|
153
|
+
textEmphasis: (value: TStyleValue) => TReturn,
|
154
|
+
transition: (value: TStyleValue) => TReturn,
|
155
|
+
};
|
156
|
+
|
157
|
+
declare var aliases: {
|
158
|
+
borderHorizontal: $FlowFixMe,
|
159
|
+
borderVertical: $FlowFixMe,
|
160
|
+
borderBlockStart: $FlowFixMe,
|
161
|
+
borderEnd: $FlowFixMe,
|
162
|
+
borderBlockEnd: $FlowFixMe,
|
163
|
+
borderStart: $FlowFixMe,
|
164
|
+
borderHorizontalWidth: $FlowFixMe,
|
165
|
+
borderHorizontalStyle: $FlowFixMe,
|
166
|
+
borderHorizontalColor: $FlowFixMe,
|
167
|
+
borderVerticalWidth: $FlowFixMe,
|
168
|
+
borderVerticalStyle: $FlowFixMe,
|
169
|
+
borderVerticalColor: $FlowFixMe,
|
170
|
+
borderBlockStartColor: (value: TStyleValue) => TReturn,
|
171
|
+
borderBlockEndColor: (value: TStyleValue) => TReturn,
|
172
|
+
borderBlockStartStyle: (value: TStyleValue) => TReturn,
|
173
|
+
borderBlockEndStyle: (value: TStyleValue) => TReturn,
|
174
|
+
borderBlockStartWidth: (value: TStyleValue) => TReturn,
|
175
|
+
borderBlockEndWidth: (value: TStyleValue) => TReturn,
|
176
|
+
borderStartColor: $FlowFixMe,
|
177
|
+
borderEndColor: $FlowFixMe,
|
178
|
+
borderStartStyle: $FlowFixMe,
|
179
|
+
borderEndStyle: $FlowFixMe,
|
180
|
+
borderStartWidth: $FlowFixMe,
|
181
|
+
borderEndWidth: $FlowFixMe,
|
182
|
+
borderTopStartRadius: (value: TStyleValue) => TReturn,
|
183
|
+
borderTopEndRadius: (value: TStyleValue) => TReturn,
|
184
|
+
borderBottomStartRadius: (value: TStyleValue) => TReturn,
|
185
|
+
borderBottomEndRadius: (value: TStyleValue) => TReturn,
|
186
|
+
marginBlockStart: (value: TStyleValue) => TReturn,
|
187
|
+
marginBlockEnd: (value: TStyleValue) => TReturn,
|
188
|
+
marginStart: $FlowFixMe,
|
189
|
+
marginEnd: $FlowFixMe,
|
190
|
+
marginHorizontal: $FlowFixMe,
|
191
|
+
marginVertical: $FlowFixMe,
|
192
|
+
paddingBlockStart: (rawValue: TStyleValue) => TReturn,
|
193
|
+
paddingBlockEnd: (rawValue: TStyleValue) => TReturn,
|
194
|
+
paddingStart: $FlowFixMe,
|
195
|
+
paddingEnd: $FlowFixMe,
|
196
|
+
paddingHorizontal: $FlowFixMe,
|
197
|
+
paddingVertical: $FlowFixMe,
|
198
|
+
insetBlockStart: (value: TStyleValue) => TReturn,
|
199
|
+
insetBlockEnd: (value: TStyleValue) => TReturn,
|
200
|
+
start: $FlowFixMe,
|
201
|
+
end: $FlowFixMe,
|
202
|
+
};
|
203
|
+
|
204
|
+
declare var expansions: { ...shorthands, ...aliases };
|
205
|
+
|
206
|
+
declare export default expansions;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
export declare function validateNamespace(
|
11
|
+
namespace: unknown,
|
12
|
+
conditions: ReadonlyArray<string>
|
13
|
+
): void;
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.validateNamespace = validateNamespace;
|
7
|
-
var
|
7
|
+
var _stylexInclude = require("../stylex-include");
|
8
8
|
var messages = _interopRequireWildcard(require("../messages"));
|
9
9
|
var _objectUtils = require("../utils/object-utils");
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
@@ -38,7 +38,7 @@ function validateNamespace(namespace) {
|
|
38
38
|
}
|
39
39
|
continue;
|
40
40
|
}
|
41
|
-
if (val instanceof
|
41
|
+
if (val instanceof _stylexInclude.IncludedStyles) {
|
42
42
|
if (conditions.length === 0) {
|
43
43
|
continue;
|
44
44
|
}
|
@@ -80,7 +80,7 @@ function validateConditionalStyles(val) {
|
|
80
80
|
}
|
81
81
|
continue;
|
82
82
|
}
|
83
|
-
if (v instanceof
|
83
|
+
if (v instanceof _stylexInclude.IncludedStyles) {
|
84
84
|
throw new Error(messages.ONLY_TOP_LEVEL_INLCUDES);
|
85
85
|
}
|
86
86
|
if ((0, _objectUtils.isPlainObject)(v)) {
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
* @flow strict
|
8
|
+
*/
|
9
|
+
|
10
|
+
declare export function validateNamespace(
|
11
|
+
namespace: mixed,
|
12
|
+
conditions: $ReadOnlyArray<string>
|
13
|
+
): void;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
import type { RawStyles, StyleXOptions } from '../common-types';
|
11
|
+
import {
|
12
|
+
type AnyPreRule,
|
13
|
+
type IPreRule,
|
14
|
+
PreIncludedStylesRule,
|
15
|
+
} from './PreRule';
|
16
|
+
export declare function flattenRawStyleObject(
|
17
|
+
style: RawStyles,
|
18
|
+
options: StyleXOptions
|
19
|
+
): ReadonlyArray<Readonly<[string, IPreRule]>>;
|
20
|
+
export declare function _flattenRawStyleObject(
|
21
|
+
style: RawStyles,
|
22
|
+
pseudos: ReadonlyArray<string>,
|
23
|
+
atRules: ReadonlyArray<string>,
|
24
|
+
options: StyleXOptions
|
25
|
+
): Array<Readonly<[string, AnyPreRule | PreIncludedStylesRule]>>;
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports._flattenRawStyleObject = _flattenRawStyleObject;
|
7
7
|
exports.flattenRawStyleObject = flattenRawStyleObject;
|
8
|
-
var
|
8
|
+
var _index = _interopRequireDefault(require("./index"));
|
9
9
|
var _PreRule = require("./PreRule");
|
10
|
-
var
|
10
|
+
var _stylexInclude = require("../stylex-include");
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
12
|
/**
|
13
13
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
@@ -27,14 +27,14 @@ function _flattenRawStyleObject(style, pseudos, atRules, options) {
|
|
27
27
|
const value = style[key];
|
28
28
|
|
29
29
|
// Included Styles
|
30
|
-
if (typeof value === 'object' && value instanceof
|
30
|
+
if (typeof value === 'object' && value instanceof _stylexInclude.IncludedStyles) {
|
31
31
|
flattened.push([key, new _PreRule.PreIncludedStylesRule(value)]);
|
32
32
|
continue;
|
33
33
|
}
|
34
34
|
|
35
35
|
// Default styles
|
36
36
|
if (value === null || typeof value === 'string' || typeof value === 'number') {
|
37
|
-
const pairs = (0,
|
37
|
+
const pairs = (0, _index.default)([key, value], options);
|
38
38
|
for (const [property, value] of pairs) {
|
39
39
|
if (value === null) {
|
40
40
|
flattened.push([property, new _PreRule.NullPreRule()]);
|
@@ -49,7 +49,7 @@ function _flattenRawStyleObject(style, pseudos, atRules, options) {
|
|
49
49
|
if (Array.isArray(value)) {
|
50
50
|
const equivalentPairs = {};
|
51
51
|
for (const eachVal of value) {
|
52
|
-
const pairs = (0,
|
52
|
+
const pairs = (0, _index.default)([key, eachVal], options);
|
53
53
|
for (const [property, val] of pairs) {
|
54
54
|
if (Array.isArray(val)) {
|
55
55
|
if (equivalentPairs[property] == null) {
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
* @flow strict
|
8
|
+
*/
|
9
|
+
|
10
|
+
import type { RawStyles, StyleXOptions } from '../common-types';
|
11
|
+
|
12
|
+
import {
|
13
|
+
type AnyPreRule,
|
14
|
+
type IPreRule,
|
15
|
+
PreIncludedStylesRule,
|
16
|
+
} from './PreRule';
|
17
|
+
declare export function flattenRawStyleObject(
|
18
|
+
style: RawStyles,
|
19
|
+
options: StyleXOptions
|
20
|
+
): $ReadOnlyArray<$ReadOnly<[string, IPreRule]>>;
|
21
|
+
|
22
|
+
declare export function _flattenRawStyleObject(
|
23
|
+
style: RawStyles,
|
24
|
+
pseudos: $ReadOnlyArray<string>,
|
25
|
+
atRules: $ReadOnlyArray<string>,
|
26
|
+
options: StyleXOptions
|
27
|
+
): Array<$ReadOnly<[string, AnyPreRule | PreIncludedStylesRule]>>;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
import type { StyleXOptions, TStyleValue } from '../common-types';
|
11
|
+
export declare function getExpandedKeys(
|
12
|
+
options: StyleXOptions
|
13
|
+
): ReadonlyArray<string>;
|
14
|
+
declare function flatMapExpandedShorthands(
|
15
|
+
objEntry: Readonly<[string, TStyleValue]>,
|
16
|
+
options: StyleXOptions
|
17
|
+
): ReadonlyArray<[string, TStyleValue]>;
|
18
|
+
export default flatMapExpandedShorthands;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
* @flow strict
|
8
|
+
*/
|
9
|
+
|
10
|
+
import type { StyleXOptions, TStyleValue } from '../common-types';
|
11
|
+
|
12
|
+
declare export function getExpandedKeys(
|
13
|
+
options: StyleXOptions
|
14
|
+
): $ReadOnlyArray<string>;
|
15
|
+
|
16
|
+
declare export default function flatMapExpandedShorthands(
|
17
|
+
objEntry: $ReadOnly<[string, TStyleValue]>,
|
18
|
+
options: StyleXOptions
|
19
|
+
): $ReadOnlyArray<[string, TStyleValue]>;
|