@stylexjs/stylex 0.18.3 → 0.19.0
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/lib/cjs/stylex.d.ts +2 -0
- package/lib/cjs/stylex.js.flow +14 -10
- package/lib/cjs/types/StyleXCSSTypes.d.ts +1 -1
- package/lib/cjs/types/StyleXCSSTypes.js.flow +1 -1
- package/lib/cjs/types/StyleXOpaqueTypes.js.flow +2 -2
- package/lib/cjs/types/StyleXTypes.d.ts +3 -3
- package/lib/cjs/types/StyleXTypes.js.flow +74 -62
- package/lib/cjs/types/StyleXUtils.js.flow +1 -1
- package/lib/cjs/types/VarTypes.js.flow +47 -43
- package/lib/es/stylex.d.ts +2 -0
- package/lib/es/stylex.js.flow +14 -10
- package/lib/es/types/StyleXCSSTypes.d.ts +1 -1
- package/lib/es/types/StyleXCSSTypes.js.flow +1 -1
- package/lib/es/types/StyleXOpaqueTypes.js.flow +2 -2
- package/lib/es/types/StyleXTypes.d.ts +3 -3
- package/lib/es/types/StyleXTypes.js.flow +74 -62
- package/lib/es/types/StyleXUtils.js.flow +1 -1
- package/lib/es/types/VarTypes.js.flow +47 -43
- package/package.json +3 -3
package/lib/cjs/stylex.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
|
+
CSSProperties,
|
|
11
12
|
CompiledStyles,
|
|
12
13
|
InlineStyles,
|
|
13
14
|
Keyframes,
|
|
@@ -38,6 +39,7 @@ import type {
|
|
|
38
39
|
import type { ValueWithDefault } from './types/StyleXUtils';
|
|
39
40
|
import * as Types from './types/VarTypes';
|
|
40
41
|
export type {
|
|
42
|
+
CSSProperties,
|
|
41
43
|
CompiledStyles,
|
|
42
44
|
InlineStyles,
|
|
43
45
|
Keyframes,
|
package/lib/cjs/stylex.js.flow
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
|
+
CSSProperties,
|
|
11
12
|
CompiledStyles,
|
|
12
13
|
InlineStyles,
|
|
13
14
|
Keyframes,
|
|
@@ -39,6 +40,7 @@ import type { ValueWithDefault } from './types/StyleXUtils';
|
|
|
39
40
|
import * as Types from './types/VarTypes';
|
|
40
41
|
|
|
41
42
|
export type {
|
|
43
|
+
CSSProperties,
|
|
42
44
|
CompiledStyles,
|
|
43
45
|
InlineStyles,
|
|
44
46
|
Keyframes,
|
|
@@ -65,26 +67,26 @@ declare export const defineConsts: StyleX$DefineConsts;
|
|
|
65
67
|
declare export const defineVars: StyleX$DefineVars;
|
|
66
68
|
|
|
67
69
|
declare export const unstable_conditional: <
|
|
68
|
-
const T extends {
|
|
70
|
+
const T extends { readonly default: unknown, readonly [string]: unknown },
|
|
69
71
|
>(
|
|
70
72
|
_value: T,
|
|
71
73
|
) => T;
|
|
72
74
|
|
|
73
75
|
declare export const unstable_defineVarsNested: <
|
|
74
|
-
const T extends {
|
|
76
|
+
const T extends { readonly [string]: NestedVarsValue },
|
|
75
77
|
>(
|
|
76
78
|
_styles: T,
|
|
77
79
|
) => T;
|
|
78
80
|
|
|
79
81
|
declare export const unstable_defineConstsNested: <
|
|
80
|
-
const T extends {
|
|
82
|
+
const T extends { readonly [string]: NestedConstsValue },
|
|
81
83
|
>(
|
|
82
84
|
_styles: T,
|
|
83
85
|
) => T;
|
|
84
86
|
|
|
85
87
|
declare export const unstable_createThemeNested: (
|
|
86
|
-
_baseTokens: {
|
|
87
|
-
_overrides: {
|
|
88
|
+
_baseTokens: { readonly [string]: NestedStringValue },
|
|
89
|
+
_overrides: { readonly [string]: NestedVarsValue },
|
|
88
90
|
) => CompiledStyles;
|
|
89
91
|
|
|
90
92
|
declare export const defineMarker: StyleX$DefineMarker;
|
|
@@ -221,21 +223,23 @@ type IStyleX = {
|
|
|
221
223
|
types: typeof types,
|
|
222
224
|
when: typeof when,
|
|
223
225
|
unstable_conditional: <
|
|
224
|
-
const T extends {
|
|
226
|
+
const T extends { readonly default: unknown, readonly [string]: unknown },
|
|
225
227
|
>(
|
|
226
228
|
value: T,
|
|
227
229
|
) => T,
|
|
228
|
-
unstable_defineVarsNested: <
|
|
230
|
+
unstable_defineVarsNested: <
|
|
231
|
+
const T extends { readonly [string]: NestedVarsValue },
|
|
232
|
+
>(
|
|
229
233
|
tokens: T,
|
|
230
234
|
) => T,
|
|
231
235
|
unstable_defineConstsNested: <
|
|
232
|
-
const T extends {
|
|
236
|
+
const T extends { readonly [string]: NestedConstsValue },
|
|
233
237
|
>(
|
|
234
238
|
tokens: T,
|
|
235
239
|
) => T,
|
|
236
240
|
unstable_createThemeNested: (
|
|
237
|
-
baseTokens: {
|
|
238
|
-
overrides: {
|
|
241
|
+
baseTokens: { readonly [string]: NestedStringValue },
|
|
242
|
+
overrides: { readonly [string]: NestedVarsValue },
|
|
239
243
|
) => CompiledStyles,
|
|
240
244
|
__customProperties?: { [string]: unknown },
|
|
241
245
|
...
|
|
@@ -1461,7 +1461,7 @@ export type CSSProperties = Readonly<{
|
|
|
1461
1461
|
textTransform?: all | textTransform;
|
|
1462
1462
|
textUnderlineOffset?: all | number | string;
|
|
1463
1463
|
textUnderlinePosition?: all | textUnderlinePosition;
|
|
1464
|
-
textWrap?: all | 'wrap' | 'nowrap' | 'balance';
|
|
1464
|
+
textWrap?: all | 'wrap' | 'nowrap' | 'balance' | 'pretty' | 'stable';
|
|
1465
1465
|
timelineScope?: all | string;
|
|
1466
1466
|
top?: all | top;
|
|
1467
1467
|
touchAction?: all | touchAction;
|
|
@@ -1548,7 +1548,7 @@ export type CSSProperties = Readonly<{
|
|
|
1548
1548
|
textTransform?: all | textTransform,
|
|
1549
1549
|
textUnderlineOffset?: all | number | string,
|
|
1550
1550
|
textUnderlinePosition?: all | textUnderlinePosition,
|
|
1551
|
-
textWrap?: all | 'wrap' | 'nowrap' | 'balance',
|
|
1551
|
+
textWrap?: all | 'wrap' | 'nowrap' | 'balance' | 'pretty' | 'stable',
|
|
1552
1552
|
|
|
1553
1553
|
timelineScope?: all | string,
|
|
1554
1554
|
top?: all | top,
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
// value: T;
|
|
12
12
|
// }
|
|
13
13
|
// This is the type for the variables object
|
|
14
|
-
declare export opaque type StyleXVar
|
|
14
|
+
declare export opaque type StyleXVar<out _Val extends unknown>: string;
|
|
15
15
|
|
|
16
|
-
declare export opaque type StyleXClassNameFor
|
|
16
|
+
declare export opaque type StyleXClassNameFor<out _K, out _V>: string;
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import type { CSSType } from './VarTypes';
|
|
9
9
|
import type { CSSProperties } from './StyleXCSSTypes';
|
|
10
10
|
|
|
11
|
+
export type { CSSProperties } from './StyleXCSSTypes';
|
|
12
|
+
|
|
11
13
|
// Using an opaque type to declare ClassNames generated by stylex.
|
|
12
14
|
declare const StyleXClassNameTag: unique symbol;
|
|
13
15
|
export type StyleXClassNameFor<K, V> = string & {
|
|
@@ -312,10 +314,8 @@ export type StyleX$CreateTheme = <
|
|
|
312
314
|
overrides: OverridesForTokenType<TokensFromVarGroup<TVars>>,
|
|
313
315
|
) => Theme<TVars, ThemeID>;
|
|
314
316
|
|
|
315
|
-
declare const StyleXMarkerTag: unique symbol;
|
|
316
|
-
|
|
317
317
|
export type StyleX$DefineMarker = () => MapNamespace<{
|
|
318
|
-
readonly marker:
|
|
318
|
+
readonly marker: symbol;
|
|
319
319
|
}>;
|
|
320
320
|
|
|
321
321
|
export type StyleX$When = {
|
|
@@ -11,15 +11,16 @@ import type { CSSProperties } from './StyleXCSSTypes';
|
|
|
11
11
|
import type { StyleXClassNameFor, StyleXVar } from './StyleXOpaqueTypes';
|
|
12
12
|
import type { CSSType } from './VarTypes';
|
|
13
13
|
|
|
14
|
+
export type { CSSProperties } from './StyleXCSSTypes';
|
|
14
15
|
export type { StyleXClassNameFor, StyleXVar } from './StyleXOpaqueTypes';
|
|
15
16
|
|
|
16
17
|
// Using an opaque type to declare ClassNames generated by stylex.
|
|
17
|
-
export type StyleXClassNameForValue
|
|
18
|
-
export type StyleXClassNameForKey
|
|
18
|
+
export type StyleXClassNameForValue<out V> = StyleXClassNameFor<unknown, V>;
|
|
19
|
+
export type StyleXClassNameForKey<out K> = StyleXClassNameFor<K, unknown>;
|
|
19
20
|
export type StyleXClassName = StyleXClassNameFor<unknown, unknown>;
|
|
20
21
|
|
|
21
22
|
// Type for arbitrarily nested Array.
|
|
22
|
-
export type StyleXArray
|
|
23
|
+
export type StyleXArray<out T> = T | ReadonlyArray<StyleXArray<T>>;
|
|
23
24
|
|
|
24
25
|
type CSSPropertiesWithExtras = Readonly<{
|
|
25
26
|
...CSSProperties,
|
|
@@ -50,12 +51,12 @@ export type NestedCSSPropTypes = Readonly<{
|
|
|
50
51
|
}>;
|
|
51
52
|
|
|
52
53
|
export type StyleXSingleStyle = false | ?NestedCSSPropTypes;
|
|
53
|
-
export type XStyle
|
|
54
|
+
export type XStyle<out T = NestedCSSPropTypes> = StyleXArray<
|
|
54
55
|
false | ?Readonly<{ ...T, $$css: true }>,
|
|
55
56
|
>;
|
|
56
57
|
|
|
57
58
|
export type XStyleWithout<
|
|
58
|
-
|
|
59
|
+
out T extends { readonly [_K in keyof NestedCSSPropTypes]?: unknown },
|
|
59
60
|
> = XStyle<Readonly<Omit<NestedCSSPropTypes, keyof T>>>;
|
|
60
61
|
|
|
61
62
|
export type Keyframes = Readonly<{ [name: string]: CSSProperties, ... }>;
|
|
@@ -119,7 +120,7 @@ export type LegacyThemeStyles = Readonly<{
|
|
|
119
120
|
...
|
|
120
121
|
}>;
|
|
121
122
|
|
|
122
|
-
type ComplexStyleValueType
|
|
123
|
+
type ComplexStyleValueType<out T> =
|
|
123
124
|
T extends StyleXVar<infer U>
|
|
124
125
|
? U extends CSSType<infer V>
|
|
125
126
|
? V
|
|
@@ -128,23 +129,25 @@ type ComplexStyleValueType<+T> =
|
|
|
128
129
|
? T
|
|
129
130
|
: T extends ReadonlyArray<infer U>
|
|
130
131
|
? ComplexStyleValueType<U>
|
|
131
|
-
: T extends {
|
|
132
|
+
: T extends { readonly default: infer A, readonly [string]: infer B }
|
|
132
133
|
? ComplexStyleValueType<A> | ComplexStyleValueType<B>
|
|
133
134
|
: Readonly<T>;
|
|
134
135
|
|
|
135
|
-
type _MapNamespace
|
|
136
|
+
type _MapNamespace<out CSS extends { readonly [string]: unknown }> = Readonly<{
|
|
136
137
|
[Key in keyof CSS]: StyleXClassNameFor<Key, ComplexStyleValueType<CSS[Key]>>,
|
|
137
138
|
}>;
|
|
138
|
-
export type MapNamespace
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
:
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
export type MapNamespace<out CSS extends { readonly [string]: unknown }> =
|
|
140
|
+
Readonly<{
|
|
141
|
+
..._MapNamespace<CSS>,
|
|
142
|
+
$$css: true,
|
|
143
|
+
}>;
|
|
144
|
+
export type MapNamespaces<out S extends { readonly [string]: unknown }> =
|
|
145
|
+
Readonly<{
|
|
146
|
+
[Key in keyof S]: S[Key] extends (...args: infer Args) => infer Obj
|
|
147
|
+
? (...args: Args) => Readonly<[MapNamespace<Obj>, InlineStyles]>
|
|
148
|
+
: MapNamespace<S[Key]>,
|
|
149
|
+
}>;
|
|
150
|
+
export type StyleX$Create = <const S extends { readonly [string]: { ... } }>(
|
|
148
151
|
styles: S,
|
|
149
152
|
) => MapNamespaces<S>;
|
|
150
153
|
|
|
@@ -157,51 +160,56 @@ export type InlineStyles = Readonly<{
|
|
|
157
160
|
[key: string]: string,
|
|
158
161
|
}>;
|
|
159
162
|
|
|
160
|
-
type _GenStylePropType
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
type _GenStylePropType<out CSS extends { readonly [string]: unknown }> =
|
|
164
|
+
Readonly<{
|
|
165
|
+
[Key in keyof CSS]: CSS[Key] extends { readonly [string]: unknown }
|
|
166
|
+
? StyleXClassNameFor<Key, Readonly<CSS[Key]>>
|
|
167
|
+
: StyleXClassNameFor<Key, CSS[Key]>,
|
|
168
|
+
}>;
|
|
169
|
+
type GenStylePropType<out CSS extends { readonly [string]: unknown }> =
|
|
170
|
+
Readonly<{
|
|
171
|
+
..._GenStylePropType<CSS>,
|
|
172
|
+
$$css: true,
|
|
173
|
+
}>;
|
|
169
174
|
|
|
170
175
|
// Replace `XStyle` with this.
|
|
171
176
|
export type StaticStyles<
|
|
172
|
-
|
|
177
|
+
out CSS extends { readonly [string]: unknown } = CSSPropertiesWithExtras,
|
|
173
178
|
> = StyleXArray<false | ?GenStylePropType<Readonly<CSS>>>;
|
|
174
179
|
|
|
175
|
-
export type StaticStylesWithout
|
|
176
|
-
|
|
180
|
+
export type StaticStylesWithout<
|
|
181
|
+
out CSS extends { readonly [string]: unknown },
|
|
182
|
+
> = StaticStyles<Omit<CSSPropertiesWithExtras, keyof CSS>>;
|
|
177
183
|
|
|
178
184
|
export type StyleXStyles<
|
|
179
|
-
|
|
185
|
+
out CSS extends { readonly [string]: unknown } = CSSPropertiesWithExtras,
|
|
180
186
|
> = StyleXArray<
|
|
181
187
|
| ?false
|
|
182
188
|
| GenStylePropType<Readonly<CSS>>
|
|
183
189
|
| Readonly<[GenStylePropType<Readonly<CSS>>, InlineStyles]>,
|
|
184
190
|
>;
|
|
185
191
|
|
|
186
|
-
export type StyleXStylesWithout
|
|
187
|
-
|
|
192
|
+
export type StyleXStylesWithout<
|
|
193
|
+
out CSS extends { readonly [string]: unknown },
|
|
194
|
+
> = StyleXStyles<Omit<CSSPropertiesWithExtras, keyof CSS>>;
|
|
188
195
|
|
|
189
196
|
export type VarGroup<
|
|
190
|
-
|
|
191
|
-
|
|
197
|
+
out Tokens extends { readonly [string]: unknown },
|
|
198
|
+
out _ID extends string = string,
|
|
192
199
|
> = {
|
|
193
|
-
|
|
200
|
+
readonly [Key in keyof Tokens]: StyleXVar<Tokens[Key]>,
|
|
194
201
|
};
|
|
195
202
|
|
|
196
|
-
export type TokensFromVarGroup
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
203
|
+
export type TokensFromVarGroup<
|
|
204
|
+
out T extends VarGroup<{ readonly [string]: unknown }>,
|
|
205
|
+
> = Readonly<{
|
|
206
|
+
[Key in keyof T]: UnwrapVar<T[Key]>,
|
|
207
|
+
}>;
|
|
200
208
|
|
|
201
|
-
type IDFromVarGroup
|
|
202
|
-
T extends VarGroup<{
|
|
209
|
+
type IDFromVarGroup<out T extends VarGroup<{ readonly [string]: unknown }>> =
|
|
210
|
+
T extends VarGroup<{ readonly [string]: unknown }, infer ID> ? ID : empty;
|
|
203
211
|
|
|
204
|
-
type NestedVarObject
|
|
212
|
+
type NestedVarObject<out T> =
|
|
205
213
|
| T
|
|
206
214
|
| (() => T)
|
|
207
215
|
| Readonly<{
|
|
@@ -220,25 +228,27 @@ type TTokens = Readonly<{
|
|
|
220
228
|
export type NestedVarsValue =
|
|
221
229
|
| string
|
|
222
230
|
| CSSType<string | number>
|
|
223
|
-
| {
|
|
231
|
+
| { readonly [string]: NestedVarsValue };
|
|
224
232
|
|
|
225
233
|
export type NestedConstsValue =
|
|
226
234
|
| string
|
|
227
235
|
| number
|
|
228
|
-
| {
|
|
236
|
+
| { readonly [string]: NestedConstsValue };
|
|
229
237
|
|
|
230
|
-
export type NestedStringValue =
|
|
238
|
+
export type NestedStringValue =
|
|
239
|
+
| string
|
|
240
|
+
| { readonly [string]: NestedStringValue };
|
|
231
241
|
|
|
232
|
-
type UnwrapVar
|
|
242
|
+
type UnwrapVar<out T> = T extends () => infer U
|
|
233
243
|
? UnwrapVar<U>
|
|
234
244
|
: T extends StyleXVar<infer U>
|
|
235
245
|
? U
|
|
236
246
|
: T;
|
|
237
247
|
|
|
238
|
-
export type FlattenTokens
|
|
239
|
-
|
|
248
|
+
export type FlattenTokens<out T extends TTokens> = {
|
|
249
|
+
readonly [Key in keyof T]: T[Key] extends CSSType<string | number>
|
|
240
250
|
? UnwrapVar<T[Key]>
|
|
241
|
-
: T[Key] extends {
|
|
251
|
+
: T[Key] extends { readonly default: infer X, readonly [string]: infer Y }
|
|
242
252
|
? UnwrapVar<X | Y>
|
|
243
253
|
: UnwrapVar<T[Key]>,
|
|
244
254
|
};
|
|
@@ -251,26 +261,28 @@ export type StyleX$DefineVars = <
|
|
|
251
261
|
) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
|
|
252
262
|
|
|
253
263
|
export type StyleX$DefineConsts = <
|
|
254
|
-
const DefaultTokens extends {
|
|
264
|
+
const DefaultTokens extends { readonly [string]: number | string },
|
|
255
265
|
>(
|
|
256
266
|
tokens: DefaultTokens,
|
|
257
267
|
) => DefaultTokens;
|
|
258
268
|
|
|
259
|
-
// opaque type ThemeKey<+_VG: VarGroup<{
|
|
269
|
+
// opaque type ThemeKey<+_VG: VarGroup<{ readonly [string]: unknown }>>: string = string;
|
|
260
270
|
declare export opaque type Theme<
|
|
261
|
-
|
|
262
|
-
|
|
271
|
+
out T extends VarGroup<{ readonly [string]: unknown }, string>,
|
|
272
|
+
out _Tag extends string = string,
|
|
263
273
|
>: Readonly<{
|
|
264
274
|
$$css: true,
|
|
265
275
|
theme: StyleXClassNameFor<'theme', IDFromVarGroup<T>>,
|
|
266
276
|
}>;
|
|
267
277
|
|
|
268
|
-
export type OverridesForTokenType
|
|
278
|
+
export type OverridesForTokenType<
|
|
279
|
+
out Config extends { readonly [string]: unknown },
|
|
280
|
+
> = {
|
|
269
281
|
[Key in keyof Config]?: NestedVarObject<Config[Key]>,
|
|
270
282
|
};
|
|
271
283
|
|
|
272
284
|
export type StyleX$CreateTheme = <
|
|
273
|
-
BaseTokens extends VarGroup<{
|
|
285
|
+
BaseTokens extends VarGroup<{ readonly [string]: unknown }>,
|
|
274
286
|
ID extends string = string,
|
|
275
287
|
>(
|
|
276
288
|
baseTokens: BaseTokens,
|
|
@@ -278,29 +290,29 @@ export type StyleX$CreateTheme = <
|
|
|
278
290
|
) => Theme<BaseTokens, ID>;
|
|
279
291
|
|
|
280
292
|
export type StyleX$DefineMarker = () => MapNamespace<{
|
|
281
|
-
|
|
293
|
+
readonly marker: 'custom-marker',
|
|
282
294
|
}>;
|
|
283
295
|
|
|
284
296
|
export type StyleX$When = {
|
|
285
297
|
ancestor: (
|
|
286
298
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
287
|
-
_customMarker?: MapNamespace<{
|
|
299
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
288
300
|
) => ':where-ancestor',
|
|
289
301
|
descendant: (
|
|
290
302
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
291
|
-
_customMarker?: MapNamespace<{
|
|
303
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
292
304
|
) => ':where-descendant',
|
|
293
305
|
siblingBefore: (
|
|
294
306
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
295
|
-
_customMarker?: MapNamespace<{
|
|
307
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
296
308
|
) => ':where-sibling-before',
|
|
297
309
|
siblingAfter: (
|
|
298
310
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
299
|
-
_customMarker?: MapNamespace<{
|
|
311
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
300
312
|
) => ':where-sibling-after',
|
|
301
313
|
anySibling: (
|
|
302
314
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
303
|
-
_customMarker?: MapNamespace<{
|
|
315
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
304
316
|
) => ':where-any-sibling',
|
|
305
317
|
};
|
|
306
318
|
|
|
@@ -29,70 +29,74 @@ export type CSSSyntax =
|
|
|
29
29
|
type CSSSyntaxType = CSSSyntax;
|
|
30
30
|
type InnerValue = null | string | number;
|
|
31
31
|
|
|
32
|
-
interface ICSSType
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
interface ICSSType<out _T extends InnerValue> {
|
|
33
|
+
readonly value: ValueWithDefault<string>;
|
|
34
|
+
readonly syntax: CSSSyntaxType;
|
|
35
35
|
}
|
|
36
|
-
declare export class Angle
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
declare export class Angle<out T extends InnerValue> implements ICSSType<T> {
|
|
37
|
+
readonly value: ValueWithDefault<string>;
|
|
38
|
+
readonly syntax: CSSSyntaxType;
|
|
39
39
|
}
|
|
40
|
-
declare export class Color
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
declare export class Color<out T extends InnerValue> implements ICSSType<T> {
|
|
41
|
+
readonly value: ValueWithDefault<string>;
|
|
42
|
+
readonly syntax: CSSSyntaxType;
|
|
43
43
|
}
|
|
44
|
-
declare export class Url
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
declare export class Url<out T extends InnerValue> implements ICSSType<T> {
|
|
45
|
+
readonly value: ValueWithDefault<string>;
|
|
46
|
+
readonly syntax: CSSSyntaxType;
|
|
47
47
|
}
|
|
48
|
-
declare export class Image
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
declare export class Image<out T extends InnerValue> implements ICSSType<T> {
|
|
49
|
+
readonly value: ValueWithDefault<string>;
|
|
50
|
+
readonly syntax: CSSSyntaxType;
|
|
51
51
|
}
|
|
52
|
-
declare export class Integer
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
declare export class Integer<out T extends InnerValue> implements ICSSType<T> {
|
|
53
|
+
readonly value: ValueWithDefault<string>;
|
|
54
|
+
readonly syntax: CSSSyntaxType;
|
|
55
55
|
}
|
|
56
|
-
declare export class LengthPercentage
|
|
56
|
+
declare export class LengthPercentage<out T extends InnerValue>
|
|
57
57
|
implements ICSSType<T>
|
|
58
58
|
{
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
readonly value: ValueWithDefault<string>;
|
|
60
|
+
readonly syntax: CSSSyntaxType;
|
|
61
61
|
}
|
|
62
|
-
declare export class Length
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
declare export class Length<out T extends InnerValue> implements ICSSType<T> {
|
|
63
|
+
readonly value: ValueWithDefault<string>;
|
|
64
|
+
readonly syntax: CSSSyntaxType;
|
|
65
65
|
}
|
|
66
|
-
declare export class Percentage
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
declare export class Percentage<out T extends InnerValue>
|
|
67
|
+
implements ICSSType<T>
|
|
68
|
+
{
|
|
69
|
+
readonly value: ValueWithDefault<string>;
|
|
70
|
+
readonly syntax: CSSSyntaxType;
|
|
69
71
|
}
|
|
70
|
-
declare export class Num
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
declare export class Num<out T extends InnerValue> implements ICSSType<T> {
|
|
73
|
+
readonly value: ValueWithDefault<string>;
|
|
74
|
+
readonly syntax: CSSSyntaxType;
|
|
73
75
|
}
|
|
74
|
-
declare export class Resolution
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
declare export class Resolution<out T extends InnerValue>
|
|
77
|
+
implements ICSSType<T>
|
|
78
|
+
{
|
|
79
|
+
readonly value: ValueWithDefault<string>;
|
|
80
|
+
readonly syntax: CSSSyntaxType;
|
|
77
81
|
}
|
|
78
|
-
declare export class Time
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
declare export class Time<out T extends InnerValue> implements ICSSType<T> {
|
|
83
|
+
readonly value: ValueWithDefault<string>;
|
|
84
|
+
readonly syntax: CSSSyntaxType;
|
|
81
85
|
}
|
|
82
|
-
declare export class TransformFunction
|
|
86
|
+
declare export class TransformFunction<out T extends InnerValue>
|
|
83
87
|
implements ICSSType<T>
|
|
84
88
|
{
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
readonly value: ValueWithDefault<string>;
|
|
90
|
+
readonly syntax: CSSSyntaxType;
|
|
87
91
|
}
|
|
88
|
-
declare export class TransformList
|
|
92
|
+
declare export class TransformList<out T extends InnerValue>
|
|
89
93
|
implements ICSSType<T>
|
|
90
94
|
{
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
readonly value: ValueWithDefault<string>;
|
|
96
|
+
readonly syntax: CSSSyntaxType;
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
export type CSSType
|
|
99
|
+
export type CSSType<out T extends InnerValue> =
|
|
96
100
|
| Angle<T>
|
|
97
101
|
| Color<T>
|
|
98
102
|
| Url<T>
|
package/lib/es/stylex.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
|
+
CSSProperties,
|
|
11
12
|
CompiledStyles,
|
|
12
13
|
InlineStyles,
|
|
13
14
|
Keyframes,
|
|
@@ -38,6 +39,7 @@ import type {
|
|
|
38
39
|
import type { ValueWithDefault } from './types/StyleXUtils';
|
|
39
40
|
import * as Types from './types/VarTypes';
|
|
40
41
|
export type {
|
|
42
|
+
CSSProperties,
|
|
41
43
|
CompiledStyles,
|
|
42
44
|
InlineStyles,
|
|
43
45
|
Keyframes,
|
package/lib/es/stylex.js.flow
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
|
+
CSSProperties,
|
|
11
12
|
CompiledStyles,
|
|
12
13
|
InlineStyles,
|
|
13
14
|
Keyframes,
|
|
@@ -39,6 +40,7 @@ import type { ValueWithDefault } from './types/StyleXUtils';
|
|
|
39
40
|
import * as Types from './types/VarTypes';
|
|
40
41
|
|
|
41
42
|
export type {
|
|
43
|
+
CSSProperties,
|
|
42
44
|
CompiledStyles,
|
|
43
45
|
InlineStyles,
|
|
44
46
|
Keyframes,
|
|
@@ -65,26 +67,26 @@ declare export const defineConsts: StyleX$DefineConsts;
|
|
|
65
67
|
declare export const defineVars: StyleX$DefineVars;
|
|
66
68
|
|
|
67
69
|
declare export const unstable_conditional: <
|
|
68
|
-
const T extends {
|
|
70
|
+
const T extends { readonly default: unknown, readonly [string]: unknown },
|
|
69
71
|
>(
|
|
70
72
|
_value: T,
|
|
71
73
|
) => T;
|
|
72
74
|
|
|
73
75
|
declare export const unstable_defineVarsNested: <
|
|
74
|
-
const T extends {
|
|
76
|
+
const T extends { readonly [string]: NestedVarsValue },
|
|
75
77
|
>(
|
|
76
78
|
_styles: T,
|
|
77
79
|
) => T;
|
|
78
80
|
|
|
79
81
|
declare export const unstable_defineConstsNested: <
|
|
80
|
-
const T extends {
|
|
82
|
+
const T extends { readonly [string]: NestedConstsValue },
|
|
81
83
|
>(
|
|
82
84
|
_styles: T,
|
|
83
85
|
) => T;
|
|
84
86
|
|
|
85
87
|
declare export const unstable_createThemeNested: (
|
|
86
|
-
_baseTokens: {
|
|
87
|
-
_overrides: {
|
|
88
|
+
_baseTokens: { readonly [string]: NestedStringValue },
|
|
89
|
+
_overrides: { readonly [string]: NestedVarsValue },
|
|
88
90
|
) => CompiledStyles;
|
|
89
91
|
|
|
90
92
|
declare export const defineMarker: StyleX$DefineMarker;
|
|
@@ -221,21 +223,23 @@ type IStyleX = {
|
|
|
221
223
|
types: typeof types,
|
|
222
224
|
when: typeof when,
|
|
223
225
|
unstable_conditional: <
|
|
224
|
-
const T extends {
|
|
226
|
+
const T extends { readonly default: unknown, readonly [string]: unknown },
|
|
225
227
|
>(
|
|
226
228
|
value: T,
|
|
227
229
|
) => T,
|
|
228
|
-
unstable_defineVarsNested: <
|
|
230
|
+
unstable_defineVarsNested: <
|
|
231
|
+
const T extends { readonly [string]: NestedVarsValue },
|
|
232
|
+
>(
|
|
229
233
|
tokens: T,
|
|
230
234
|
) => T,
|
|
231
235
|
unstable_defineConstsNested: <
|
|
232
|
-
const T extends {
|
|
236
|
+
const T extends { readonly [string]: NestedConstsValue },
|
|
233
237
|
>(
|
|
234
238
|
tokens: T,
|
|
235
239
|
) => T,
|
|
236
240
|
unstable_createThemeNested: (
|
|
237
|
-
baseTokens: {
|
|
238
|
-
overrides: {
|
|
241
|
+
baseTokens: { readonly [string]: NestedStringValue },
|
|
242
|
+
overrides: { readonly [string]: NestedVarsValue },
|
|
239
243
|
) => CompiledStyles,
|
|
240
244
|
__customProperties?: { [string]: unknown },
|
|
241
245
|
...
|
|
@@ -1461,7 +1461,7 @@ export type CSSProperties = Readonly<{
|
|
|
1461
1461
|
textTransform?: all | textTransform;
|
|
1462
1462
|
textUnderlineOffset?: all | number | string;
|
|
1463
1463
|
textUnderlinePosition?: all | textUnderlinePosition;
|
|
1464
|
-
textWrap?: all | 'wrap' | 'nowrap' | 'balance';
|
|
1464
|
+
textWrap?: all | 'wrap' | 'nowrap' | 'balance' | 'pretty' | 'stable';
|
|
1465
1465
|
timelineScope?: all | string;
|
|
1466
1466
|
top?: all | top;
|
|
1467
1467
|
touchAction?: all | touchAction;
|
|
@@ -1548,7 +1548,7 @@ export type CSSProperties = Readonly<{
|
|
|
1548
1548
|
textTransform?: all | textTransform,
|
|
1549
1549
|
textUnderlineOffset?: all | number | string,
|
|
1550
1550
|
textUnderlinePosition?: all | textUnderlinePosition,
|
|
1551
|
-
textWrap?: all | 'wrap' | 'nowrap' | 'balance',
|
|
1551
|
+
textWrap?: all | 'wrap' | 'nowrap' | 'balance' | 'pretty' | 'stable',
|
|
1552
1552
|
|
|
1553
1553
|
timelineScope?: all | string,
|
|
1554
1554
|
top?: all | top,
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
// value: T;
|
|
12
12
|
// }
|
|
13
13
|
// This is the type for the variables object
|
|
14
|
-
declare export opaque type StyleXVar
|
|
14
|
+
declare export opaque type StyleXVar<out _Val extends unknown>: string;
|
|
15
15
|
|
|
16
|
-
declare export opaque type StyleXClassNameFor
|
|
16
|
+
declare export opaque type StyleXClassNameFor<out _K, out _V>: string;
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import type { CSSType } from './VarTypes';
|
|
9
9
|
import type { CSSProperties } from './StyleXCSSTypes';
|
|
10
10
|
|
|
11
|
+
export type { CSSProperties } from './StyleXCSSTypes';
|
|
12
|
+
|
|
11
13
|
// Using an opaque type to declare ClassNames generated by stylex.
|
|
12
14
|
declare const StyleXClassNameTag: unique symbol;
|
|
13
15
|
export type StyleXClassNameFor<K, V> = string & {
|
|
@@ -312,10 +314,8 @@ export type StyleX$CreateTheme = <
|
|
|
312
314
|
overrides: OverridesForTokenType<TokensFromVarGroup<TVars>>,
|
|
313
315
|
) => Theme<TVars, ThemeID>;
|
|
314
316
|
|
|
315
|
-
declare const StyleXMarkerTag: unique symbol;
|
|
316
|
-
|
|
317
317
|
export type StyleX$DefineMarker = () => MapNamespace<{
|
|
318
|
-
readonly marker:
|
|
318
|
+
readonly marker: symbol;
|
|
319
319
|
}>;
|
|
320
320
|
|
|
321
321
|
export type StyleX$When = {
|
|
@@ -11,15 +11,16 @@ import type { CSSProperties } from './StyleXCSSTypes';
|
|
|
11
11
|
import type { StyleXClassNameFor, StyleXVar } from './StyleXOpaqueTypes';
|
|
12
12
|
import type { CSSType } from './VarTypes';
|
|
13
13
|
|
|
14
|
+
export type { CSSProperties } from './StyleXCSSTypes';
|
|
14
15
|
export type { StyleXClassNameFor, StyleXVar } from './StyleXOpaqueTypes';
|
|
15
16
|
|
|
16
17
|
// Using an opaque type to declare ClassNames generated by stylex.
|
|
17
|
-
export type StyleXClassNameForValue
|
|
18
|
-
export type StyleXClassNameForKey
|
|
18
|
+
export type StyleXClassNameForValue<out V> = StyleXClassNameFor<unknown, V>;
|
|
19
|
+
export type StyleXClassNameForKey<out K> = StyleXClassNameFor<K, unknown>;
|
|
19
20
|
export type StyleXClassName = StyleXClassNameFor<unknown, unknown>;
|
|
20
21
|
|
|
21
22
|
// Type for arbitrarily nested Array.
|
|
22
|
-
export type StyleXArray
|
|
23
|
+
export type StyleXArray<out T> = T | ReadonlyArray<StyleXArray<T>>;
|
|
23
24
|
|
|
24
25
|
type CSSPropertiesWithExtras = Readonly<{
|
|
25
26
|
...CSSProperties,
|
|
@@ -50,12 +51,12 @@ export type NestedCSSPropTypes = Readonly<{
|
|
|
50
51
|
}>;
|
|
51
52
|
|
|
52
53
|
export type StyleXSingleStyle = false | ?NestedCSSPropTypes;
|
|
53
|
-
export type XStyle
|
|
54
|
+
export type XStyle<out T = NestedCSSPropTypes> = StyleXArray<
|
|
54
55
|
false | ?Readonly<{ ...T, $$css: true }>,
|
|
55
56
|
>;
|
|
56
57
|
|
|
57
58
|
export type XStyleWithout<
|
|
58
|
-
|
|
59
|
+
out T extends { readonly [_K in keyof NestedCSSPropTypes]?: unknown },
|
|
59
60
|
> = XStyle<Readonly<Omit<NestedCSSPropTypes, keyof T>>>;
|
|
60
61
|
|
|
61
62
|
export type Keyframes = Readonly<{ [name: string]: CSSProperties, ... }>;
|
|
@@ -119,7 +120,7 @@ export type LegacyThemeStyles = Readonly<{
|
|
|
119
120
|
...
|
|
120
121
|
}>;
|
|
121
122
|
|
|
122
|
-
type ComplexStyleValueType
|
|
123
|
+
type ComplexStyleValueType<out T> =
|
|
123
124
|
T extends StyleXVar<infer U>
|
|
124
125
|
? U extends CSSType<infer V>
|
|
125
126
|
? V
|
|
@@ -128,23 +129,25 @@ type ComplexStyleValueType<+T> =
|
|
|
128
129
|
? T
|
|
129
130
|
: T extends ReadonlyArray<infer U>
|
|
130
131
|
? ComplexStyleValueType<U>
|
|
131
|
-
: T extends {
|
|
132
|
+
: T extends { readonly default: infer A, readonly [string]: infer B }
|
|
132
133
|
? ComplexStyleValueType<A> | ComplexStyleValueType<B>
|
|
133
134
|
: Readonly<T>;
|
|
134
135
|
|
|
135
|
-
type _MapNamespace
|
|
136
|
+
type _MapNamespace<out CSS extends { readonly [string]: unknown }> = Readonly<{
|
|
136
137
|
[Key in keyof CSS]: StyleXClassNameFor<Key, ComplexStyleValueType<CSS[Key]>>,
|
|
137
138
|
}>;
|
|
138
|
-
export type MapNamespace
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
:
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
export type MapNamespace<out CSS extends { readonly [string]: unknown }> =
|
|
140
|
+
Readonly<{
|
|
141
|
+
..._MapNamespace<CSS>,
|
|
142
|
+
$$css: true,
|
|
143
|
+
}>;
|
|
144
|
+
export type MapNamespaces<out S extends { readonly [string]: unknown }> =
|
|
145
|
+
Readonly<{
|
|
146
|
+
[Key in keyof S]: S[Key] extends (...args: infer Args) => infer Obj
|
|
147
|
+
? (...args: Args) => Readonly<[MapNamespace<Obj>, InlineStyles]>
|
|
148
|
+
: MapNamespace<S[Key]>,
|
|
149
|
+
}>;
|
|
150
|
+
export type StyleX$Create = <const S extends { readonly [string]: { ... } }>(
|
|
148
151
|
styles: S,
|
|
149
152
|
) => MapNamespaces<S>;
|
|
150
153
|
|
|
@@ -157,51 +160,56 @@ export type InlineStyles = Readonly<{
|
|
|
157
160
|
[key: string]: string,
|
|
158
161
|
}>;
|
|
159
162
|
|
|
160
|
-
type _GenStylePropType
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
type _GenStylePropType<out CSS extends { readonly [string]: unknown }> =
|
|
164
|
+
Readonly<{
|
|
165
|
+
[Key in keyof CSS]: CSS[Key] extends { readonly [string]: unknown }
|
|
166
|
+
? StyleXClassNameFor<Key, Readonly<CSS[Key]>>
|
|
167
|
+
: StyleXClassNameFor<Key, CSS[Key]>,
|
|
168
|
+
}>;
|
|
169
|
+
type GenStylePropType<out CSS extends { readonly [string]: unknown }> =
|
|
170
|
+
Readonly<{
|
|
171
|
+
..._GenStylePropType<CSS>,
|
|
172
|
+
$$css: true,
|
|
173
|
+
}>;
|
|
169
174
|
|
|
170
175
|
// Replace `XStyle` with this.
|
|
171
176
|
export type StaticStyles<
|
|
172
|
-
|
|
177
|
+
out CSS extends { readonly [string]: unknown } = CSSPropertiesWithExtras,
|
|
173
178
|
> = StyleXArray<false | ?GenStylePropType<Readonly<CSS>>>;
|
|
174
179
|
|
|
175
|
-
export type StaticStylesWithout
|
|
176
|
-
|
|
180
|
+
export type StaticStylesWithout<
|
|
181
|
+
out CSS extends { readonly [string]: unknown },
|
|
182
|
+
> = StaticStyles<Omit<CSSPropertiesWithExtras, keyof CSS>>;
|
|
177
183
|
|
|
178
184
|
export type StyleXStyles<
|
|
179
|
-
|
|
185
|
+
out CSS extends { readonly [string]: unknown } = CSSPropertiesWithExtras,
|
|
180
186
|
> = StyleXArray<
|
|
181
187
|
| ?false
|
|
182
188
|
| GenStylePropType<Readonly<CSS>>
|
|
183
189
|
| Readonly<[GenStylePropType<Readonly<CSS>>, InlineStyles]>,
|
|
184
190
|
>;
|
|
185
191
|
|
|
186
|
-
export type StyleXStylesWithout
|
|
187
|
-
|
|
192
|
+
export type StyleXStylesWithout<
|
|
193
|
+
out CSS extends { readonly [string]: unknown },
|
|
194
|
+
> = StyleXStyles<Omit<CSSPropertiesWithExtras, keyof CSS>>;
|
|
188
195
|
|
|
189
196
|
export type VarGroup<
|
|
190
|
-
|
|
191
|
-
|
|
197
|
+
out Tokens extends { readonly [string]: unknown },
|
|
198
|
+
out _ID extends string = string,
|
|
192
199
|
> = {
|
|
193
|
-
|
|
200
|
+
readonly [Key in keyof Tokens]: StyleXVar<Tokens[Key]>,
|
|
194
201
|
};
|
|
195
202
|
|
|
196
|
-
export type TokensFromVarGroup
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
203
|
+
export type TokensFromVarGroup<
|
|
204
|
+
out T extends VarGroup<{ readonly [string]: unknown }>,
|
|
205
|
+
> = Readonly<{
|
|
206
|
+
[Key in keyof T]: UnwrapVar<T[Key]>,
|
|
207
|
+
}>;
|
|
200
208
|
|
|
201
|
-
type IDFromVarGroup
|
|
202
|
-
T extends VarGroup<{
|
|
209
|
+
type IDFromVarGroup<out T extends VarGroup<{ readonly [string]: unknown }>> =
|
|
210
|
+
T extends VarGroup<{ readonly [string]: unknown }, infer ID> ? ID : empty;
|
|
203
211
|
|
|
204
|
-
type NestedVarObject
|
|
212
|
+
type NestedVarObject<out T> =
|
|
205
213
|
| T
|
|
206
214
|
| (() => T)
|
|
207
215
|
| Readonly<{
|
|
@@ -220,25 +228,27 @@ type TTokens = Readonly<{
|
|
|
220
228
|
export type NestedVarsValue =
|
|
221
229
|
| string
|
|
222
230
|
| CSSType<string | number>
|
|
223
|
-
| {
|
|
231
|
+
| { readonly [string]: NestedVarsValue };
|
|
224
232
|
|
|
225
233
|
export type NestedConstsValue =
|
|
226
234
|
| string
|
|
227
235
|
| number
|
|
228
|
-
| {
|
|
236
|
+
| { readonly [string]: NestedConstsValue };
|
|
229
237
|
|
|
230
|
-
export type NestedStringValue =
|
|
238
|
+
export type NestedStringValue =
|
|
239
|
+
| string
|
|
240
|
+
| { readonly [string]: NestedStringValue };
|
|
231
241
|
|
|
232
|
-
type UnwrapVar
|
|
242
|
+
type UnwrapVar<out T> = T extends () => infer U
|
|
233
243
|
? UnwrapVar<U>
|
|
234
244
|
: T extends StyleXVar<infer U>
|
|
235
245
|
? U
|
|
236
246
|
: T;
|
|
237
247
|
|
|
238
|
-
export type FlattenTokens
|
|
239
|
-
|
|
248
|
+
export type FlattenTokens<out T extends TTokens> = {
|
|
249
|
+
readonly [Key in keyof T]: T[Key] extends CSSType<string | number>
|
|
240
250
|
? UnwrapVar<T[Key]>
|
|
241
|
-
: T[Key] extends {
|
|
251
|
+
: T[Key] extends { readonly default: infer X, readonly [string]: infer Y }
|
|
242
252
|
? UnwrapVar<X | Y>
|
|
243
253
|
: UnwrapVar<T[Key]>,
|
|
244
254
|
};
|
|
@@ -251,26 +261,28 @@ export type StyleX$DefineVars = <
|
|
|
251
261
|
) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
|
|
252
262
|
|
|
253
263
|
export type StyleX$DefineConsts = <
|
|
254
|
-
const DefaultTokens extends {
|
|
264
|
+
const DefaultTokens extends { readonly [string]: number | string },
|
|
255
265
|
>(
|
|
256
266
|
tokens: DefaultTokens,
|
|
257
267
|
) => DefaultTokens;
|
|
258
268
|
|
|
259
|
-
// opaque type ThemeKey<+_VG: VarGroup<{
|
|
269
|
+
// opaque type ThemeKey<+_VG: VarGroup<{ readonly [string]: unknown }>>: string = string;
|
|
260
270
|
declare export opaque type Theme<
|
|
261
|
-
|
|
262
|
-
|
|
271
|
+
out T extends VarGroup<{ readonly [string]: unknown }, string>,
|
|
272
|
+
out _Tag extends string = string,
|
|
263
273
|
>: Readonly<{
|
|
264
274
|
$$css: true,
|
|
265
275
|
theme: StyleXClassNameFor<'theme', IDFromVarGroup<T>>,
|
|
266
276
|
}>;
|
|
267
277
|
|
|
268
|
-
export type OverridesForTokenType
|
|
278
|
+
export type OverridesForTokenType<
|
|
279
|
+
out Config extends { readonly [string]: unknown },
|
|
280
|
+
> = {
|
|
269
281
|
[Key in keyof Config]?: NestedVarObject<Config[Key]>,
|
|
270
282
|
};
|
|
271
283
|
|
|
272
284
|
export type StyleX$CreateTheme = <
|
|
273
|
-
BaseTokens extends VarGroup<{
|
|
285
|
+
BaseTokens extends VarGroup<{ readonly [string]: unknown }>,
|
|
274
286
|
ID extends string = string,
|
|
275
287
|
>(
|
|
276
288
|
baseTokens: BaseTokens,
|
|
@@ -278,29 +290,29 @@ export type StyleX$CreateTheme = <
|
|
|
278
290
|
) => Theme<BaseTokens, ID>;
|
|
279
291
|
|
|
280
292
|
export type StyleX$DefineMarker = () => MapNamespace<{
|
|
281
|
-
|
|
293
|
+
readonly marker: 'custom-marker',
|
|
282
294
|
}>;
|
|
283
295
|
|
|
284
296
|
export type StyleX$When = {
|
|
285
297
|
ancestor: (
|
|
286
298
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
287
|
-
_customMarker?: MapNamespace<{
|
|
299
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
288
300
|
) => ':where-ancestor',
|
|
289
301
|
descendant: (
|
|
290
302
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
291
|
-
_customMarker?: MapNamespace<{
|
|
303
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
292
304
|
) => ':where-descendant',
|
|
293
305
|
siblingBefore: (
|
|
294
306
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
295
|
-
_customMarker?: MapNamespace<{
|
|
307
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
296
308
|
) => ':where-sibling-before',
|
|
297
309
|
siblingAfter: (
|
|
298
310
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
299
|
-
_customMarker?: MapNamespace<{
|
|
311
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
300
312
|
) => ':where-sibling-after',
|
|
301
313
|
anySibling: (
|
|
302
314
|
_pseudo?: StringPrefix<':'> | StringPrefix<'['>,
|
|
303
|
-
_customMarker?: MapNamespace<{
|
|
315
|
+
_customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
|
|
304
316
|
) => ':where-any-sibling',
|
|
305
317
|
};
|
|
306
318
|
|
|
@@ -29,70 +29,74 @@ export type CSSSyntax =
|
|
|
29
29
|
type CSSSyntaxType = CSSSyntax;
|
|
30
30
|
type InnerValue = null | string | number;
|
|
31
31
|
|
|
32
|
-
interface ICSSType
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
interface ICSSType<out _T extends InnerValue> {
|
|
33
|
+
readonly value: ValueWithDefault<string>;
|
|
34
|
+
readonly syntax: CSSSyntaxType;
|
|
35
35
|
}
|
|
36
|
-
declare export class Angle
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
declare export class Angle<out T extends InnerValue> implements ICSSType<T> {
|
|
37
|
+
readonly value: ValueWithDefault<string>;
|
|
38
|
+
readonly syntax: CSSSyntaxType;
|
|
39
39
|
}
|
|
40
|
-
declare export class Color
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
declare export class Color<out T extends InnerValue> implements ICSSType<T> {
|
|
41
|
+
readonly value: ValueWithDefault<string>;
|
|
42
|
+
readonly syntax: CSSSyntaxType;
|
|
43
43
|
}
|
|
44
|
-
declare export class Url
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
declare export class Url<out T extends InnerValue> implements ICSSType<T> {
|
|
45
|
+
readonly value: ValueWithDefault<string>;
|
|
46
|
+
readonly syntax: CSSSyntaxType;
|
|
47
47
|
}
|
|
48
|
-
declare export class Image
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
declare export class Image<out T extends InnerValue> implements ICSSType<T> {
|
|
49
|
+
readonly value: ValueWithDefault<string>;
|
|
50
|
+
readonly syntax: CSSSyntaxType;
|
|
51
51
|
}
|
|
52
|
-
declare export class Integer
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
declare export class Integer<out T extends InnerValue> implements ICSSType<T> {
|
|
53
|
+
readonly value: ValueWithDefault<string>;
|
|
54
|
+
readonly syntax: CSSSyntaxType;
|
|
55
55
|
}
|
|
56
|
-
declare export class LengthPercentage
|
|
56
|
+
declare export class LengthPercentage<out T extends InnerValue>
|
|
57
57
|
implements ICSSType<T>
|
|
58
58
|
{
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
readonly value: ValueWithDefault<string>;
|
|
60
|
+
readonly syntax: CSSSyntaxType;
|
|
61
61
|
}
|
|
62
|
-
declare export class Length
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
declare export class Length<out T extends InnerValue> implements ICSSType<T> {
|
|
63
|
+
readonly value: ValueWithDefault<string>;
|
|
64
|
+
readonly syntax: CSSSyntaxType;
|
|
65
65
|
}
|
|
66
|
-
declare export class Percentage
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
declare export class Percentage<out T extends InnerValue>
|
|
67
|
+
implements ICSSType<T>
|
|
68
|
+
{
|
|
69
|
+
readonly value: ValueWithDefault<string>;
|
|
70
|
+
readonly syntax: CSSSyntaxType;
|
|
69
71
|
}
|
|
70
|
-
declare export class Num
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
declare export class Num<out T extends InnerValue> implements ICSSType<T> {
|
|
73
|
+
readonly value: ValueWithDefault<string>;
|
|
74
|
+
readonly syntax: CSSSyntaxType;
|
|
73
75
|
}
|
|
74
|
-
declare export class Resolution
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
declare export class Resolution<out T extends InnerValue>
|
|
77
|
+
implements ICSSType<T>
|
|
78
|
+
{
|
|
79
|
+
readonly value: ValueWithDefault<string>;
|
|
80
|
+
readonly syntax: CSSSyntaxType;
|
|
77
81
|
}
|
|
78
|
-
declare export class Time
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
declare export class Time<out T extends InnerValue> implements ICSSType<T> {
|
|
83
|
+
readonly value: ValueWithDefault<string>;
|
|
84
|
+
readonly syntax: CSSSyntaxType;
|
|
81
85
|
}
|
|
82
|
-
declare export class TransformFunction
|
|
86
|
+
declare export class TransformFunction<out T extends InnerValue>
|
|
83
87
|
implements ICSSType<T>
|
|
84
88
|
{
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
readonly value: ValueWithDefault<string>;
|
|
90
|
+
readonly syntax: CSSSyntaxType;
|
|
87
91
|
}
|
|
88
|
-
declare export class TransformList
|
|
92
|
+
declare export class TransformList<out T extends InnerValue>
|
|
89
93
|
implements ICSSType<T>
|
|
90
94
|
{
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
readonly value: ValueWithDefault<string>;
|
|
96
|
+
readonly syntax: CSSSyntaxType;
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
export type CSSType
|
|
99
|
+
export type CSSType<out T extends InnerValue> =
|
|
96
100
|
| Angle<T>
|
|
97
101
|
| Color<T>
|
|
98
102
|
| Url<T>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/stylex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "A library for defining styles for optimized user interfaces.",
|
|
5
5
|
"main": "./lib/cjs/stylex.js",
|
|
6
6
|
"module": "./lib/es/stylex.mjs",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"@rollup/plugin-json": "^6.1.0",
|
|
58
58
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
59
59
|
"@rollup/plugin-replace": "^6.0.1",
|
|
60
|
-
"babel-plugin-syntax-hermes-parser": "^0.
|
|
60
|
+
"babel-plugin-syntax-hermes-parser": "^0.36.1",
|
|
61
61
|
"cross-env": "^10.1.0",
|
|
62
62
|
"rollup": "^4.59.0",
|
|
63
|
-
"scripts": "0.
|
|
63
|
+
"scripts": "0.19.0"
|
|
64
64
|
},
|
|
65
65
|
"files": [
|
|
66
66
|
"lib/*"
|