@stylexjs/stylex 0.18.2 → 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/es/stylex.mjs CHANGED
@@ -144,6 +144,18 @@ const defineConsts = function stylexDefineConsts(_styles) {
144
144
  const defineVars = function stylexDefineVars(_styles) {
145
145
  throw errorForFn('defineVars');
146
146
  };
147
+ const unstable_conditional = function stylexConditional(_value) {
148
+ throw errorForFn('unstable_conditional');
149
+ };
150
+ const unstable_defineVarsNested = function stylexDefineVarsNested(_styles) {
151
+ throw errorForFn('unstable_defineVarsNested');
152
+ };
153
+ const unstable_defineConstsNested = function stylexDefineConstsNested(_styles) {
154
+ throw errorForFn('unstable_defineConstsNested');
155
+ };
156
+ const unstable_createThemeNested = (_baseTokens, _overrides) => {
157
+ throw errorForFn('unstable_createThemeNested');
158
+ };
147
159
  const defineMarker = () => {
148
160
  throw errorForFn('defineMarker');
149
161
  };
@@ -254,25 +266,31 @@ const types = {
254
266
  throw errorForType('transformList');
255
267
  }
256
268
  };
257
- function _legacyMerge(...styles) {
258
- const [className] = styleqExports.styleq(styles);
259
- return className;
260
- }
261
- _legacyMerge.create = create;
262
- _legacyMerge.createTheme = createTheme;
263
- _legacyMerge.defineConsts = defineConsts;
264
- _legacyMerge.defineMarker = defineMarker;
265
- _legacyMerge.defineVars = defineVars;
266
- _legacyMerge.defaultMarker = defaultMarker;
267
- _legacyMerge.firstThatWorks = firstThatWorks;
268
- _legacyMerge.keyframes = keyframes;
269
- _legacyMerge.positionTry = positionTry;
270
- _legacyMerge.props = props;
271
- _legacyMerge.attrs = attrs;
272
- _legacyMerge.types = types;
273
- _legacyMerge.when = when;
274
- _legacyMerge.viewTransitionClass = viewTransitionClass;
275
- _legacyMerge.env = env;
276
- const legacyMerge = _legacyMerge;
269
+ const legacyMerge = /*@__PURE__*/ function () {
270
+ function _legacyMerge(...styles) {
271
+ const [className] = styleqExports.styleq(styles);
272
+ return className;
273
+ }
274
+ _legacyMerge.create = create;
275
+ _legacyMerge.createTheme = createTheme;
276
+ _legacyMerge.defineConsts = defineConsts;
277
+ _legacyMerge.defineMarker = defineMarker;
278
+ _legacyMerge.defineVars = defineVars;
279
+ _legacyMerge.defaultMarker = defaultMarker;
280
+ _legacyMerge.firstThatWorks = firstThatWorks;
281
+ _legacyMerge.keyframes = keyframes;
282
+ _legacyMerge.positionTry = positionTry;
283
+ _legacyMerge.props = props;
284
+ _legacyMerge.attrs = attrs;
285
+ _legacyMerge.types = types;
286
+ _legacyMerge.when = when;
287
+ _legacyMerge.viewTransitionClass = viewTransitionClass;
288
+ _legacyMerge.env = env;
289
+ _legacyMerge.unstable_conditional = unstable_conditional;
290
+ _legacyMerge.unstable_defineVarsNested = unstable_defineVarsNested;
291
+ _legacyMerge.unstable_defineConstsNested = unstable_defineConstsNested;
292
+ _legacyMerge.unstable_createThemeNested = unstable_createThemeNested;
293
+ return _legacyMerge;
294
+ }();
277
295
 
278
- export { attrs, create, createTheme, defaultMarker, defineConsts, defineMarker, defineVars, env, firstThatWorks, keyframes, legacyMerge, positionTry, props, types, viewTransitionClass, when };
296
+ export { attrs, create, createTheme, defaultMarker, defineConsts, defineMarker, defineVars, env, firstThatWorks, keyframes, legacyMerge, positionTry, props, types, unstable_conditional, unstable_createThemeNested, unstable_defineConstsNested, unstable_defineVarsNested, viewTransitionClass, when };
@@ -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<+_Val: unknown>: string;
14
+ declare export opaque type StyleXVar<out _Val extends unknown>: string;
15
15
 
16
- declare export opaque type StyleXClassNameFor<+_K, +_V>: string;
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 & {
@@ -252,12 +254,17 @@ export type IDFromVarGroup<T extends VarGroup<{}>> = T['__opaqueId'];
252
254
 
253
255
  type TTokens = Readonly<{
254
256
  [key: string]:
255
- | NestedVarObject<null | string | number>
256
- | StyleXVar<null | string | number>
257
+ | NestedVarObject<
258
+ null | string | number | StyleXVar<null | string | number>
259
+ >
257
260
  | CSSType<null | string | number>;
258
261
  }>;
259
262
 
260
- type UnwrapVars<T> = T extends StyleXVar<infer U> ? U : T;
263
+ type UnwrapVars<T> = T extends () => infer U
264
+ ? UnwrapVars<U>
265
+ : T extends StyleXVar<infer U>
266
+ ? U
267
+ : T;
261
268
  export type FlattenTokens<T extends TTokens> = Readonly<{
262
269
  [Key in keyof T]: T[Key] extends { [key: string]: infer X }
263
270
  ? UnwrapVars<X>
@@ -266,6 +273,7 @@ export type FlattenTokens<T extends TTokens> = Readonly<{
266
273
 
267
274
  type NestedVarObject<T> =
268
275
  | T
276
+ | (() => T)
269
277
  | Readonly<{
270
278
  default: NestedVarObject<T>;
271
279
  [key: AtRuleStr]: NestedVarObject<T>;
@@ -306,10 +314,8 @@ export type StyleX$CreateTheme = <
306
314
  overrides: OverridesForTokenType<TokensFromVarGroup<TVars>>,
307
315
  ) => Theme<TVars, ThemeID>;
308
316
 
309
- declare const StyleXMarkerTag: unique symbol;
310
-
311
317
  export type StyleX$DefineMarker = () => MapNamespace<{
312
- readonly marker: typeof StyleXMarkerTag;
318
+ readonly marker: symbol;
313
319
  }>;
314
320
 
315
321
  export type StyleX$When = {
@@ -360,3 +366,50 @@ export interface Register {}
360
366
  export type StyleX$Env = Register extends { env: infer TEnv }
361
367
  ? TEnv
362
368
  : Readonly<{ [key: string]: unknown }>;
369
+
370
+ // === Nested API Types ===
371
+
372
+ export type NestedVarsValue =
373
+ | string
374
+ | CSSType<string | number>
375
+ | { readonly [key: string]: NestedVarsValue };
376
+
377
+ export type NestedConstsValue =
378
+ | string
379
+ | number
380
+ | { readonly [key: string]: NestedConstsValue };
381
+
382
+ export type NestedStringValue =
383
+ | string
384
+ | { readonly [key: string]: NestedStringValue };
385
+
386
+ // unstable_defineVarsNested: preserves nested key structure in output.
387
+ // Uses generic <T> to give consumers key-level autocomplete.
388
+ // Leaf values are replaced with var(--hash) strings at compile time.
389
+ export type StyleX$DefineVarsNested = <
390
+ const T extends { [key: string]: NestedVarsValue },
391
+ >(
392
+ tokens: T,
393
+ ) => T;
394
+
395
+ // unstable_defineConstsNested: same as input — values inlined at compile time.
396
+ export type StyleX$DefineConstsNested = <
397
+ const T extends { [key: string]: NestedConstsValue },
398
+ >(
399
+ tokens: T,
400
+ ) => T;
401
+
402
+ // unstable_createThemeNested: returns a flat theme object like createTheme.
403
+ export type StyleX$CreateThemeNested = (
404
+ baseTokens: { readonly [key: string]: NestedStringValue },
405
+ overrides: { readonly [key: string]: NestedVarsValue },
406
+ ) => CompiledStyles;
407
+
408
+ // unstable_conditional: identity function for type disambiguation.
409
+ // Marks a conditional @media/@supports value so the type system can
410
+ // distinguish it from namespace objects in nested token definitions.
411
+ export type StyleX$Conditional = <
412
+ const T extends { default: unknown; [key: `@${string}`]: unknown },
413
+ >(
414
+ value: T,
415
+ ) => T;
@@ -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<+V> = StyleXClassNameFor<unknown, V>;
18
- export type StyleXClassNameForKey<+K> = StyleXClassNameFor<K, unknown>;
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<+T> = T | ReadonlyArray<StyleXArray<T>>;
23
+ export type StyleXArray<out T> = T | ReadonlyArray<StyleXArray<T>>;
23
24
 
24
25
  type CSSPropertiesWithExtras = Readonly<{
25
26
  ...CSSProperties,
@@ -50,12 +51,13 @@ export type NestedCSSPropTypes = Readonly<{
50
51
  }>;
51
52
 
52
53
  export type StyleXSingleStyle = false | ?NestedCSSPropTypes;
53
- export type XStyle<+T = NestedCSSPropTypes> = StyleXArray<
54
+ export type XStyle<out T = NestedCSSPropTypes> = StyleXArray<
54
55
  false | ?Readonly<{ ...T, $$css: true }>,
55
56
  >;
56
57
 
57
- export type XStyleWithout<+T: { +[_K in keyof NestedCSSPropTypes]?: unknown }> =
58
- XStyle<Readonly<Omit<NestedCSSPropTypes, keyof T>>>;
58
+ export type XStyleWithout<
59
+ out T extends { readonly [_K in keyof NestedCSSPropTypes]?: unknown },
60
+ > = XStyle<Readonly<Omit<NestedCSSPropTypes, keyof T>>>;
59
61
 
60
62
  export type Keyframes = Readonly<{ [name: string]: CSSProperties, ... }>;
61
63
 
@@ -118,7 +120,7 @@ export type LegacyThemeStyles = Readonly<{
118
120
  ...
119
121
  }>;
120
122
 
121
- type ComplexStyleValueType<+T> =
123
+ type ComplexStyleValueType<out T> =
122
124
  T extends StyleXVar<infer U>
123
125
  ? U extends CSSType<infer V>
124
126
  ? V
@@ -127,23 +129,25 @@ type ComplexStyleValueType<+T> =
127
129
  ? T
128
130
  : T extends ReadonlyArray<infer U>
129
131
  ? ComplexStyleValueType<U>
130
- : T extends { +default: infer A, +[string]: infer B }
132
+ : T extends { readonly default: infer A, readonly [string]: infer B }
131
133
  ? ComplexStyleValueType<A> | ComplexStyleValueType<B>
132
134
  : Readonly<T>;
133
135
 
134
- type _MapNamespace<+CSS: { +[string]: unknown }> = Readonly<{
136
+ type _MapNamespace<out CSS extends { readonly [string]: unknown }> = Readonly<{
135
137
  [Key in keyof CSS]: StyleXClassNameFor<Key, ComplexStyleValueType<CSS[Key]>>,
136
138
  }>;
137
- export type MapNamespace<+CSS: { +[string]: unknown }> = Readonly<{
138
- ..._MapNamespace<CSS>,
139
- $$css: true,
140
- }>;
141
- export type MapNamespaces<+S: { +[string]: unknown }> = Readonly<{
142
- [Key in keyof S]: S[Key] extends (...args: infer Args) => infer Obj
143
- ? (...args: Args) => Readonly<[MapNamespace<Obj>, InlineStyles]>
144
- : MapNamespace<S[Key]>,
145
- }>;
146
- export type StyleX$Create = <const S: { +[string]: { ... } }>(
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]: { ... } }>(
147
151
  styles: S,
148
152
  ) => MapNamespaces<S>;
149
153
 
@@ -156,51 +160,58 @@ export type InlineStyles = Readonly<{
156
160
  [key: string]: string,
157
161
  }>;
158
162
 
159
- type _GenStylePropType<+CSS: { +[string]: unknown }> = Readonly<{
160
- [Key in keyof CSS]: CSS[Key] extends { +[string]: unknown }
161
- ? StyleXClassNameFor<Key, Readonly<CSS[Key]>>
162
- : StyleXClassNameFor<Key, CSS[Key]>,
163
- }>;
164
- type GenStylePropType<+CSS: { +[string]: unknown }> = Readonly<{
165
- ..._GenStylePropType<CSS>,
166
- $$css: true,
167
- }>;
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
+ }>;
168
174
 
169
175
  // Replace `XStyle` with this.
170
176
  export type StaticStyles<
171
- +CSS: { +[string]: unknown } = CSSPropertiesWithExtras,
177
+ out CSS extends { readonly [string]: unknown } = CSSPropertiesWithExtras,
172
178
  > = StyleXArray<false | ?GenStylePropType<Readonly<CSS>>>;
173
179
 
174
- export type StaticStylesWithout<+CSS: { +[string]: unknown }> = StaticStyles<
175
- Omit<CSSPropertiesWithExtras, keyof CSS>,
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
- +CSS: { +[string]: unknown } = CSSPropertiesWithExtras,
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<+CSS: { +[string]: unknown }> = StyleXStyles<
187
- Omit<CSSPropertiesWithExtras, keyof CSS>,
188
- >;
192
+ export type StyleXStylesWithout<
193
+ out CSS extends { readonly [string]: unknown },
194
+ > = StyleXStyles<Omit<CSSPropertiesWithExtras, keyof CSS>>;
189
195
 
190
- export type VarGroup<+Tokens: { +[string]: unknown }, +_ID: string = string> = {
191
- +[Key in keyof Tokens]: StyleXVar<Tokens[Key]>,
196
+ export type VarGroup<
197
+ out Tokens extends { readonly [string]: unknown },
198
+ out _ID extends string = string,
199
+ > = {
200
+ readonly [Key in keyof Tokens]: StyleXVar<Tokens[Key]>,
192
201
  };
193
202
 
194
- export type TokensFromVarGroup<+T: VarGroup<{ +[string]: unknown }>> =
195
- Readonly<{
196
- [Key in keyof T]: UnwrapVar<T[Key]>,
197
- }>;
203
+ export type TokensFromVarGroup<
204
+ out T extends VarGroup<{ readonly [string]: unknown }>,
205
+ > = Readonly<{
206
+ [Key in keyof T]: UnwrapVar<T[Key]>,
207
+ }>;
198
208
 
199
- type IDFromVarGroup<+T: VarGroup<{ +[string]: unknown }>> =
200
- T extends VarGroup<{ +[string]: unknown }, infer ID> ? ID : empty;
209
+ type IDFromVarGroup<out T extends VarGroup<{ readonly [string]: unknown }>> =
210
+ T extends VarGroup<{ readonly [string]: unknown }, infer ID> ? ID : empty;
201
211
 
202
- type NestedVarObject<+T> =
212
+ type NestedVarObject<out T> =
203
213
  | T
214
+ | (() => T)
204
215
  | Readonly<{
205
216
  default: NestedVarObject<T>,
206
217
  [string]: NestedVarObject<T>,
@@ -208,76 +219,101 @@ type NestedVarObject<+T> =
208
219
 
209
220
  type TTokens = Readonly<{
210
221
  [string]:
211
- | NestedVarObject<null | string | number>
212
- | StyleXVar<null | string | number>
222
+ | NestedVarObject<
223
+ null | string | number | StyleXVar<null | string | number>,
224
+ >
213
225
  | CSSType<null | string | number>,
214
226
  }>;
215
227
 
216
- type UnwrapVar<+T> = T extends StyleXVar<infer U> ? U : T;
217
- export type FlattenTokens<+T: TTokens> = {
218
- +[Key in keyof T]: T[Key] extends CSSType<string | number>
228
+ export type NestedVarsValue =
229
+ | string
230
+ | CSSType<string | number>
231
+ | { readonly [string]: NestedVarsValue };
232
+
233
+ export type NestedConstsValue =
234
+ | string
235
+ | number
236
+ | { readonly [string]: NestedConstsValue };
237
+
238
+ export type NestedStringValue =
239
+ | string
240
+ | { readonly [string]: NestedStringValue };
241
+
242
+ type UnwrapVar<out T> = T extends () => infer U
243
+ ? UnwrapVar<U>
244
+ : T extends StyleXVar<infer U>
245
+ ? U
246
+ : T;
247
+
248
+ export type FlattenTokens<out T extends TTokens> = {
249
+ readonly [Key in keyof T]: T[Key] extends CSSType<string | number>
219
250
  ? UnwrapVar<T[Key]>
220
- : T[Key] extends { +default: infer X, +[string]: infer Y }
251
+ : T[Key] extends { readonly default: infer X, readonly [string]: infer Y }
221
252
  ? UnwrapVar<X | Y>
222
253
  : UnwrapVar<T[Key]>,
223
254
  };
224
255
 
225
- export type StyleX$DefineVars = <DefaultTokens: TTokens, ID: string = string>(
256
+ export type StyleX$DefineVars = <
257
+ DefaultTokens extends TTokens,
258
+ ID extends string = string,
259
+ >(
226
260
  tokens: DefaultTokens,
227
261
  ) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
228
262
 
229
263
  export type StyleX$DefineConsts = <
230
- const DefaultTokens: { +[string]: number | string },
264
+ const DefaultTokens extends { readonly [string]: number | string },
231
265
  >(
232
266
  tokens: DefaultTokens,
233
267
  ) => DefaultTokens;
234
268
 
235
- // opaque type ThemeKey<+_VG: VarGroup<{ +[string]: unknown }>>: string = string;
269
+ // opaque type ThemeKey<+_VG: VarGroup<{ readonly [string]: unknown }>>: string = string;
236
270
  declare export opaque type Theme<
237
- +T: VarGroup<{ +[string]: unknown }, string>,
238
- +_Tag: string = string,
271
+ out T extends VarGroup<{ readonly [string]: unknown }, string>,
272
+ out _Tag extends string = string,
239
273
  >: Readonly<{
240
274
  $$css: true,
241
275
  theme: StyleXClassNameFor<'theme', IDFromVarGroup<T>>,
242
276
  }>;
243
277
 
244
- export type OverridesForTokenType<+Config: { +[string]: unknown }> = {
278
+ export type OverridesForTokenType<
279
+ out Config extends { readonly [string]: unknown },
280
+ > = {
245
281
  [Key in keyof Config]?: NestedVarObject<Config[Key]>,
246
282
  };
247
283
 
248
284
  export type StyleX$CreateTheme = <
249
- BaseTokens: VarGroup<{ +[string]: unknown }>,
250
- ID: string = string,
285
+ BaseTokens extends VarGroup<{ readonly [string]: unknown }>,
286
+ ID extends string = string,
251
287
  >(
252
288
  baseTokens: BaseTokens,
253
289
  overrides: OverridesForTokenType<TokensFromVarGroup<BaseTokens>>,
254
290
  ) => Theme<BaseTokens, ID>;
255
291
 
256
292
  export type StyleX$DefineMarker = () => MapNamespace<{
257
- +marker: 'custom-marker',
293
+ readonly marker: 'custom-marker',
258
294
  }>;
259
295
 
260
296
  export type StyleX$When = {
261
297
  ancestor: (
262
298
  _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
263
- _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
299
+ _customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
264
300
  ) => ':where-ancestor',
265
301
  descendant: (
266
302
  _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
267
- _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
303
+ _customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
268
304
  ) => ':where-descendant',
269
305
  siblingBefore: (
270
306
  _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
271
- _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
307
+ _customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
272
308
  ) => ':where-sibling-before',
273
309
  siblingAfter: (
274
310
  _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
275
- _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
311
+ _customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
276
312
  ) => ':where-sibling-after',
277
313
  anySibling: (
278
314
  _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
279
- _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
315
+ _customMarker?: MapNamespace<{ readonly marker: 'custom-marker' }>,
280
316
  ) => ':where-any-sibling',
281
317
  };
282
318
 
283
- export type StyleX$Env = $ReadOnly<{ [string]: mixed }>;
319
+ export type StyleX$Env = Readonly<{ [string]: unknown }>;
@@ -7,7 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- export type ValueWithDefault<+T> =
10
+ export type ValueWithDefault<out T> =
11
11
  | T
12
12
  | Readonly<{
13
13
  default: ValueWithDefault<T>,
@@ -29,64 +29,74 @@ export type CSSSyntax =
29
29
  type CSSSyntaxType = CSSSyntax;
30
30
  type InnerValue = null | string | number;
31
31
 
32
- interface ICSSType<+_T: InnerValue> {
33
- +value: ValueWithDefault<string>;
34
- +syntax: CSSSyntaxType;
32
+ interface ICSSType<out _T extends InnerValue> {
33
+ readonly value: ValueWithDefault<string>;
34
+ readonly syntax: CSSSyntaxType;
35
35
  }
36
- declare export class Angle<+T: InnerValue> implements ICSSType<T> {
37
- +value: ValueWithDefault<string>;
38
- +syntax: CSSSyntaxType;
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<+T: InnerValue> implements ICSSType<T> {
41
- +value: ValueWithDefault<string>;
42
- +syntax: CSSSyntaxType;
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<+T: InnerValue> implements ICSSType<T> {
45
- +value: ValueWithDefault<string>;
46
- +syntax: CSSSyntaxType;
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<+T: InnerValue> implements ICSSType<T> {
49
- +value: ValueWithDefault<string>;
50
- +syntax: CSSSyntaxType;
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<+T: InnerValue> implements ICSSType<T> {
53
- +value: ValueWithDefault<string>;
54
- +syntax: CSSSyntaxType;
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<+T: InnerValue> implements ICSSType<T> {
57
- +value: ValueWithDefault<string>;
58
- +syntax: CSSSyntaxType;
56
+ declare export class LengthPercentage<out T extends InnerValue>
57
+ implements ICSSType<T>
58
+ {
59
+ readonly value: ValueWithDefault<string>;
60
+ readonly syntax: CSSSyntaxType;
59
61
  }
60
- declare export class Length<+T: InnerValue> implements ICSSType<T> {
61
- +value: ValueWithDefault<string>;
62
- +syntax: CSSSyntaxType;
62
+ declare export class Length<out T extends InnerValue> implements ICSSType<T> {
63
+ readonly value: ValueWithDefault<string>;
64
+ readonly syntax: CSSSyntaxType;
63
65
  }
64
- declare export class Percentage<+T: InnerValue> implements ICSSType<T> {
65
- +value: ValueWithDefault<string>;
66
- +syntax: CSSSyntaxType;
66
+ declare export class Percentage<out T extends InnerValue>
67
+ implements ICSSType<T>
68
+ {
69
+ readonly value: ValueWithDefault<string>;
70
+ readonly syntax: CSSSyntaxType;
67
71
  }
68
- declare export class Num<+T: InnerValue> implements ICSSType<T> {
69
- +value: ValueWithDefault<string>;
70
- +syntax: CSSSyntaxType;
72
+ declare export class Num<out T extends InnerValue> implements ICSSType<T> {
73
+ readonly value: ValueWithDefault<string>;
74
+ readonly syntax: CSSSyntaxType;
71
75
  }
72
- declare export class Resolution<+T: InnerValue> implements ICSSType<T> {
73
- +value: ValueWithDefault<string>;
74
- +syntax: CSSSyntaxType;
76
+ declare export class Resolution<out T extends InnerValue>
77
+ implements ICSSType<T>
78
+ {
79
+ readonly value: ValueWithDefault<string>;
80
+ readonly syntax: CSSSyntaxType;
75
81
  }
76
- declare export class Time<+T: InnerValue> implements ICSSType<T> {
77
- +value: ValueWithDefault<string>;
78
- +syntax: CSSSyntaxType;
82
+ declare export class Time<out T extends InnerValue> implements ICSSType<T> {
83
+ readonly value: ValueWithDefault<string>;
84
+ readonly syntax: CSSSyntaxType;
79
85
  }
80
- declare export class TransformFunction<+T: InnerValue> implements ICSSType<T> {
81
- +value: ValueWithDefault<string>;
82
- +syntax: CSSSyntaxType;
86
+ declare export class TransformFunction<out T extends InnerValue>
87
+ implements ICSSType<T>
88
+ {
89
+ readonly value: ValueWithDefault<string>;
90
+ readonly syntax: CSSSyntaxType;
83
91
  }
84
- declare export class TransformList<+T: InnerValue> implements ICSSType<T> {
85
- +value: ValueWithDefault<string>;
86
- +syntax: CSSSyntaxType;
92
+ declare export class TransformList<out T extends InnerValue>
93
+ implements ICSSType<T>
94
+ {
95
+ readonly value: ValueWithDefault<string>;
96
+ readonly syntax: CSSSyntaxType;
87
97
  }
88
98
 
89
- export type CSSType<+T: InnerValue> =
99
+ export type CSSType<out T extends InnerValue> =
90
100
  | Angle<T>
91
101
  | Color<T>
92
102
  | Url<T>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/stylex",
3
- "version": "0.18.2",
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,12 +57,13 @@
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.32.1",
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.18.2"
63
+ "scripts": "0.19.0"
64
64
  },
65
65
  "files": [
66
66
  "lib/*"
67
- ]
67
+ ],
68
+ "sideEffects": false
68
69
  }