@stylexjs/stylex 0.17.5 → 0.18.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.
@@ -7,7 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- type InjectArgs = $ReadOnly<{
10
+ type InjectArgs = Readonly<{
11
11
  ltr: string,
12
12
  rtl?: ?string,
13
13
  priority: number,
@@ -7,7 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- export type OrderedCSSStyleSheet = $ReadOnly<{
10
+ export type OrderedCSSStyleSheet = Readonly<{
11
11
  getTextContent: () => string,
12
12
  insert: (cssText: string, groupValue: number) => void,
13
13
  update: (oldCssText: string, newCssText: string, groupValue: number) => void,
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type { OrderedCSSStyleSheet } from './createOrderedCSSStyleSheet';
11
11
 
12
- type Sheet = $ReadOnly<{
12
+ type Sheet = Readonly<{
13
13
  ...OrderedCSSStyleSheet,
14
14
  }>;
15
15
 
@@ -92,6 +92,8 @@ export declare const defaultMarker: () => MapNamespace<
92
92
  export declare type defaultMarker = typeof defaultMarker;
93
93
  export declare const when: StyleX$When;
94
94
  export declare type when = typeof when;
95
+ export declare const env: Readonly<{ [$$Key$$: string]: unknown }>;
96
+ export declare type env = typeof env;
95
97
  export declare const types: {
96
98
  angle: <T extends string | 0 = string | 0>(
97
99
  _v: ValueWithDefault<T>,
@@ -144,6 +146,7 @@ type IStyleX = {
144
146
  createTheme: StyleX$CreateTheme;
145
147
  defineConsts: StyleX$DefineConsts;
146
148
  defineVars: StyleX$DefineVars;
149
+ env: Readonly<{ [$$Key$$: string]: unknown }>;
147
150
  defaultMarker: () => MapNamespace<Readonly<{ marker: 'default-marker' }>>;
148
151
  defineMarker: StyleX$DefineMarker;
149
152
  firstThatWorks: <T extends string | number>(
package/lib/cjs/stylex.js CHANGED
@@ -195,6 +195,7 @@ const when = {
195
195
  throw errorForFn('when.anySibling');
196
196
  }
197
197
  };
198
+ const env = Object.freeze({});
198
199
  const types = {
199
200
  angle: _v => {
200
201
  throw errorForType('angle');
@@ -253,6 +254,7 @@ _legacyMerge.props = props;
253
254
  _legacyMerge.types = types;
254
255
  _legacyMerge.when = when;
255
256
  _legacyMerge.viewTransitionClass = viewTransitionClass;
257
+ _legacyMerge.env = env;
256
258
  const legacyMerge = _legacyMerge;
257
259
 
258
260
  exports.create = create;
@@ -261,6 +263,7 @@ exports.defaultMarker = defaultMarker;
261
263
  exports.defineConsts = defineConsts;
262
264
  exports.defineMarker = defineMarker;
263
265
  exports.defineVars = defineVars;
266
+ exports.env = env;
264
267
  exports.firstThatWorks = firstThatWorks;
265
268
  exports.keyframes = keyframes;
266
269
  exports.legacyMerge = legacyMerge;
@@ -63,24 +63,24 @@ declare export const defineVars: StyleX$DefineVars;
63
63
  declare export const defineMarker: StyleX$DefineMarker;
64
64
 
65
65
  declare export const firstThatWorks: <T: string | number>(
66
- ..._styles: $ReadOnlyArray<T>
67
- ) => $ReadOnlyArray<T>;
66
+ ..._styles: ReadonlyArray<T>
67
+ ) => ReadonlyArray<T>;
68
68
 
69
69
  declare export const keyframes: (_keyframes: Keyframes) => string;
70
70
 
71
71
  declare export const positionTry: (_positionTry: PositionTry) => string;
72
72
 
73
73
  declare export function props(
74
- this: ?mixed,
75
- ...styles: $ReadOnlyArray<
74
+ this: ?unknown,
75
+ ...styles: ReadonlyArray<
76
76
  StyleXArray<
77
- ?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
77
+ ?CompiledStyles | boolean | Readonly<[CompiledStyles, InlineStyles]>,
78
78
  >,
79
79
  >
80
- ): $ReadOnly<{
80
+ ): Readonly<{
81
81
  className?: string,
82
82
  'data-style-src'?: string,
83
- style?: $ReadOnly<{ [string]: string | number }>,
83
+ style?: Readonly<{ [string]: string | number }>,
84
84
  }>;
85
85
 
86
86
  declare export const viewTransitionClass: (
@@ -88,13 +88,15 @@ declare export const viewTransitionClass: (
88
88
  ) => string;
89
89
 
90
90
  declare export const defaultMarker: () => MapNamespace<
91
- $ReadOnly<{
91
+ Readonly<{
92
92
  marker: 'default-marker',
93
93
  }>,
94
94
  >;
95
95
 
96
96
  declare export const when: StyleX$When;
97
97
 
98
+ declare export const env: $ReadOnly<{ [string]: mixed }>;
99
+
98
100
  declare export const types: {
99
101
  angle: <T: string | 0 = string | 0>(
100
102
  _v: ValueWithDefault<T>,
@@ -130,38 +132,39 @@ declare export const types: {
130
132
  */
131
133
 
132
134
  type IStyleX = {
133
- (...styles: $ReadOnlyArray<StyleXArray<?CompiledStyles | boolean>>): string,
135
+ (...styles: ReadonlyArray<StyleXArray<?CompiledStyles | boolean>>): string,
134
136
  create: StyleX$Create,
135
137
  createTheme: StyleX$CreateTheme,
136
138
  defineConsts: StyleX$DefineConsts,
137
139
  defineVars: StyleX$DefineVars,
140
+ env: $ReadOnly<{ [string]: mixed }>,
138
141
  defaultMarker: () => MapNamespace<
139
- $ReadOnly<{
142
+ Readonly<{
140
143
  marker: 'default-marker',
141
144
  }>,
142
145
  >,
143
146
  defineMarker: StyleX$DefineMarker,
144
147
  firstThatWorks: <T: string | number>(
145
- ...v: $ReadOnlyArray<T>
146
- ) => $ReadOnlyArray<T>,
148
+ ...v: ReadonlyArray<T>
149
+ ) => ReadonlyArray<T>,
147
150
  keyframes: (keyframes: Keyframes) => string,
148
151
  positionTry: (positionTry: PositionTry) => string,
149
152
  props: (
150
- this: ?mixed,
151
- ...styles: $ReadOnlyArray<
153
+ this: ?unknown,
154
+ ...styles: ReadonlyArray<
152
155
  StyleXArray<
153
- ?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
156
+ ?CompiledStyles | boolean | Readonly<[CompiledStyles, InlineStyles]>,
154
157
  >,
155
158
  >
156
- ) => $ReadOnly<{
159
+ ) => Readonly<{
157
160
  className?: string,
158
161
  'data-style-src'?: string,
159
- style?: $ReadOnly<{ [string]: string | number }>,
162
+ style?: Readonly<{ [string]: string | number }>,
160
163
  }>,
161
164
  viewTransitionClass: (viewTransitionClass: ViewTransitionClass) => string,
162
165
  types: typeof types,
163
166
  when: typeof when,
164
- __customProperties?: { [string]: mixed },
167
+ __customProperties?: { [string]: unknown },
165
168
  ...
166
169
  };
167
170
 
@@ -953,14 +953,14 @@ type top = number | string;
953
953
 
954
954
  type OptionalArray<T> = Array<T> | T;
955
955
 
956
- export type SupportedVendorSpecificCSSProperties = $ReadOnly<{
956
+ export type SupportedVendorSpecificCSSProperties = Readonly<{
957
957
  MozOsxFontSmoothing?: null | 'grayscale',
958
958
  WebkitAppearance?: null | appearance,
959
959
  WebkitFontSmoothing?: null | 'antialiased',
960
960
  WebkitTapHighlightColor?: null | color,
961
961
  }>;
962
962
 
963
- export type CSSProperties = $ReadOnly<{
963
+ export type CSSProperties = Readonly<{
964
964
  // NOTE: adding a non-CSS property here for support themes in Stylex.
965
965
  theme?: all | string,
966
966
 
@@ -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: mixed>: string;
14
+ declare export opaque type StyleXVar<+_Val: unknown>: string;
15
15
 
16
16
  declare export opaque type StyleXClassNameFor<+_K, +_V>: string;
@@ -306,18 +306,23 @@ export type StyleX$CreateTheme = <
306
306
  overrides: OverridesForTokenType<TokensFromVarGroup<TVars>>,
307
307
  ) => Theme<TVars, ThemeID>;
308
308
 
309
+ declare const StyleXMarkerTag: unique symbol;
310
+
309
311
  export type StyleX$DefineMarker = () => MapNamespace<{
310
- readonly marker: unique symbol;
312
+ readonly marker: typeof StyleXMarkerTag;
311
313
  }>;
312
314
 
313
315
  export type StyleX$When = {
314
- ancestor: <const Pseudo extends string, MarkerSymbol extends symbol = symbol>(
316
+ ancestor: <
317
+ const Pseudo extends `:${string}` | `[${string}]`,
318
+ MarkerSymbol extends symbol = symbol,
319
+ >(
315
320
  _pseudo?: Pseudo,
316
321
  _customMarker?: MapNamespace<{ readonly marker: MarkerSymbol }>,
317
322
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
318
323
  ) => `:where-ancestor(${Pseudo}, ${MarkerSymbol})`;
319
324
  descendant: <
320
- const Pseudo extends string,
325
+ const Pseudo extends `:${string}` | `[${string}]`,
321
326
  MarkerSymbol extends symbol = symbol,
322
327
  >(
323
328
  _pseudo?: Pseudo,
@@ -325,7 +330,7 @@ export type StyleX$When = {
325
330
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
326
331
  ) => `:where-descendant(${Pseudo}, ${MarkerSymbol})`;
327
332
  siblingBefore: <
328
- const Pseudo extends string,
333
+ const Pseudo extends `:${string}` | `[${string}]`,
329
334
  MarkerSymbol extends symbol = symbol,
330
335
  >(
331
336
  _pseudo?: Pseudo,
@@ -333,7 +338,7 @@ export type StyleX$When = {
333
338
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
334
339
  ) => `:where-sibling-before(${Pseudo}, ${MarkerSymbol})`;
335
340
  siblingAfter: <
336
- const Pseudo extends string,
341
+ const Pseudo extends `:${string}` | `[${string}]`,
337
342
  MarkerSymbol extends symbol = symbol,
338
343
  >(
339
344
  _pseudo?: Pseudo,
@@ -341,7 +346,7 @@ export type StyleX$When = {
341
346
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
342
347
  ) => `:where-sibling-after(${Pseudo}, ${MarkerSymbol})`;
343
348
  anySibling: <
344
- const Pseudo extends string,
349
+ const Pseudo extends `:${string}` | `[${string}]`,
345
350
  MarkerSymbol extends symbol = symbol,
346
351
  >(
347
352
  _pseudo?: Pseudo,
@@ -14,14 +14,14 @@ import type { CSSType } from './VarTypes';
14
14
  export type { StyleXClassNameFor, StyleXVar } from './StyleXOpaqueTypes';
15
15
 
16
16
  // Using an opaque type to declare ClassNames generated by stylex.
17
- export type StyleXClassNameForValue<+V> = StyleXClassNameFor<mixed, V>;
18
- export type StyleXClassNameForKey<+K> = StyleXClassNameFor<K, mixed>;
19
- export type StyleXClassName = StyleXClassNameFor<mixed, mixed>;
17
+ export type StyleXClassNameForValue<+V> = StyleXClassNameFor<unknown, V>;
18
+ export type StyleXClassNameForKey<+K> = StyleXClassNameFor<K, unknown>;
19
+ export type StyleXClassName = StyleXClassNameFor<unknown, unknown>;
20
20
 
21
21
  // Type for arbitrarily nested Array.
22
- export type StyleXArray<+T> = T | $ReadOnlyArray<StyleXArray<T>>;
22
+ export type StyleXArray<+T> = T | ReadonlyArray<StyleXArray<T>>;
23
23
 
24
- type CSSPropertiesWithExtras = $ReadOnly<{
24
+ type CSSPropertiesWithExtras = Readonly<{
25
25
  ...CSSProperties,
26
26
  '::before'?: CSSProperties,
27
27
  '::after'?: CSSProperties,
@@ -45,21 +45,21 @@ type CSSPropertiesWithExtras = $ReadOnly<{
45
45
  '::-webkit-search-results-decoration'?: CSSProperties,
46
46
  }>;
47
47
 
48
- export type NestedCSSPropTypes = $ReadOnly<{
48
+ export type NestedCSSPropTypes = Readonly<{
49
49
  [Key in keyof CSSPropertiesWithExtras]?: StyleXClassNameForKey<Key>,
50
50
  }>;
51
51
 
52
52
  export type StyleXSingleStyle = false | ?NestedCSSPropTypes;
53
53
  export type XStyle<+T = NestedCSSPropTypes> = StyleXArray<
54
- false | ?$ReadOnly<{ ...T, $$css: true }>,
54
+ false | ?Readonly<{ ...T, $$css: true }>,
55
55
  >;
56
56
 
57
- export type XStyleWithout<+T: { +[_K in keyof NestedCSSPropTypes]?: mixed }> =
58
- XStyle<$ReadOnly<Omit<NestedCSSPropTypes, $Keys<T>>>>;
57
+ export type XStyleWithout<+T: { +[_K in keyof NestedCSSPropTypes]?: unknown }> =
58
+ XStyle<Readonly<Omit<NestedCSSPropTypes, keyof T>>>;
59
59
 
60
- export type Keyframes = $ReadOnly<{ [name: string]: CSSProperties, ... }>;
60
+ export type Keyframes = Readonly<{ [name: string]: CSSProperties, ... }>;
61
61
 
62
- export type PositionTry = $ReadOnly<{
62
+ export type PositionTry = Readonly<{
63
63
  // Anchor Positioning Properties
64
64
  positionAnchor?: CSSProperties['positionAnchor'],
65
65
  positionArea?: CSSProperties['positionArea'],
@@ -106,14 +106,14 @@ export type PositionTry = $ReadOnly<{
106
106
  placeSelf?: CSSProperties['placeSelf'],
107
107
  }>;
108
108
 
109
- export type ViewTransitionClass = $ReadOnly<{
109
+ export type ViewTransitionClass = Readonly<{
110
110
  group?: CSSProperties,
111
111
  imagePair?: CSSProperties,
112
112
  old?: CSSProperties,
113
113
  new?: CSSProperties,
114
114
  }>;
115
115
 
116
- export type LegacyThemeStyles = $ReadOnly<{
116
+ export type LegacyThemeStyles = Readonly<{
117
117
  [constantName: string]: string,
118
118
  ...
119
119
  }>;
@@ -125,85 +125,88 @@ type ComplexStyleValueType<+T> =
125
125
  : U
126
126
  : T extends string | number | null
127
127
  ? T
128
- : T extends $ReadOnlyArray<infer U>
128
+ : T extends ReadonlyArray<infer U>
129
129
  ? ComplexStyleValueType<U>
130
130
  : T extends { +default: infer A, +[string]: infer B }
131
131
  ? ComplexStyleValueType<A> | ComplexStyleValueType<B>
132
- : $ReadOnly<T>;
132
+ : Readonly<T>;
133
133
 
134
- type _MapNamespace<+CSS: { +[string]: mixed }> = $ReadOnly<{
134
+ type _MapNamespace<+CSS: { +[string]: unknown }> = Readonly<{
135
135
  [Key in keyof CSS]: StyleXClassNameFor<Key, ComplexStyleValueType<CSS[Key]>>,
136
136
  }>;
137
- export type MapNamespace<+CSS: { +[string]: mixed }> = $ReadOnly<{
137
+ export type MapNamespace<+CSS: { +[string]: unknown }> = Readonly<{
138
138
  ..._MapNamespace<CSS>,
139
139
  $$css: true,
140
140
  }>;
141
- export type MapNamespaces<+S: { +[string]: mixed }> = $ReadOnly<{
141
+ export type MapNamespaces<+S: { +[string]: unknown }> = Readonly<{
142
142
  [Key in keyof S]: S[Key] extends (...args: infer Args) => infer Obj
143
- ? (...args: Args) => $ReadOnly<[MapNamespace<Obj>, InlineStyles]>
143
+ ? (...args: Args) => Readonly<[MapNamespace<Obj>, InlineStyles]>
144
144
  : MapNamespace<S[Key]>,
145
145
  }>;
146
146
  export type StyleX$Create = <const S: { +[string]: { ... } }>(
147
147
  styles: S,
148
148
  ) => MapNamespaces<S>;
149
149
 
150
- export type CompiledStyles = $ReadOnly<{
150
+ export type CompiledStyles = Readonly<{
151
151
  $$css: true,
152
152
  [key: string]: StyleXClassName,
153
153
  }>;
154
- export type InlineStyles = $ReadOnly<{
154
+ export type InlineStyles = Readonly<{
155
155
  $$css?: void,
156
156
  [key: string]: string,
157
157
  }>;
158
158
 
159
- type _GenStylePropType<+CSS: { +[string]: mixed }> = $ReadOnly<{
160
- [Key in keyof CSS]: CSS[Key] extends { +[string]: mixed }
161
- ? StyleXClassNameFor<Key, $ReadOnly<CSS[Key]>>
159
+ type _GenStylePropType<+CSS: { +[string]: unknown }> = Readonly<{
160
+ [Key in keyof CSS]: CSS[Key] extends { +[string]: unknown }
161
+ ? StyleXClassNameFor<Key, Readonly<CSS[Key]>>
162
162
  : StyleXClassNameFor<Key, CSS[Key]>,
163
163
  }>;
164
- type GenStylePropType<+CSS: { +[string]: mixed }> = $ReadOnly<{
164
+ type GenStylePropType<+CSS: { +[string]: unknown }> = Readonly<{
165
165
  ..._GenStylePropType<CSS>,
166
166
  $$css: true,
167
167
  }>;
168
168
 
169
169
  // Replace `XStyle` with this.
170
- export type StaticStyles<+CSS: { +[string]: mixed } = CSSPropertiesWithExtras> =
171
- StyleXArray<false | ?GenStylePropType<$ReadOnly<CSS>>>;
170
+ export type StaticStyles<
171
+ +CSS: { +[string]: unknown } = CSSPropertiesWithExtras,
172
+ > = StyleXArray<false | ?GenStylePropType<Readonly<CSS>>>;
172
173
 
173
- export type StaticStylesWithout<+CSS: { +[string]: mixed }> = StaticStyles<
174
- Omit<CSSPropertiesWithExtras, $Keys<CSS>>,
174
+ export type StaticStylesWithout<+CSS: { +[string]: unknown }> = StaticStyles<
175
+ Omit<CSSPropertiesWithExtras, keyof CSS>,
175
176
  >;
176
177
 
177
- export type StyleXStyles<+CSS: { +[string]: mixed } = CSSPropertiesWithExtras> =
178
- StyleXArray<
179
- | ?false
180
- | GenStylePropType<$ReadOnly<CSS>>
181
- | $ReadOnly<[GenStylePropType<$ReadOnly<CSS>>, InlineStyles]>,
182
- >;
178
+ export type StyleXStyles<
179
+ +CSS: { +[string]: unknown } = CSSPropertiesWithExtras,
180
+ > = StyleXArray<
181
+ | ?false
182
+ | GenStylePropType<Readonly<CSS>>
183
+ | Readonly<[GenStylePropType<Readonly<CSS>>, InlineStyles]>,
184
+ >;
183
185
 
184
- export type StyleXStylesWithout<+CSS: { +[string]: mixed }> = StyleXStyles<
185
- Omit<CSSPropertiesWithExtras, $Keys<CSS>>,
186
+ export type StyleXStylesWithout<+CSS: { +[string]: unknown }> = StyleXStyles<
187
+ Omit<CSSPropertiesWithExtras, keyof CSS>,
186
188
  >;
187
189
 
188
- export type VarGroup<+Tokens: { +[string]: mixed }, +_ID: string = string> = {
190
+ export type VarGroup<+Tokens: { +[string]: unknown }, +_ID: string = string> = {
189
191
  +[Key in keyof Tokens]: StyleXVar<Tokens[Key]>,
190
192
  };
191
193
 
192
- export type TokensFromVarGroup<+T: VarGroup<{ +[string]: mixed }>> = $ReadOnly<{
193
- [Key in keyof T]: UnwrapVar<T[Key]>,
194
- }>;
194
+ export type TokensFromVarGroup<+T: VarGroup<{ +[string]: unknown }>> =
195
+ Readonly<{
196
+ [Key in keyof T]: UnwrapVar<T[Key]>,
197
+ }>;
195
198
 
196
- type IDFromVarGroup<+T: VarGroup<{ +[string]: mixed }>> =
197
- T extends VarGroup<{ +[string]: mixed }, infer ID> ? ID : empty;
199
+ type IDFromVarGroup<+T: VarGroup<{ +[string]: unknown }>> =
200
+ T extends VarGroup<{ +[string]: unknown }, infer ID> ? ID : empty;
198
201
 
199
202
  type NestedVarObject<+T> =
200
203
  | T
201
- | $ReadOnly<{
204
+ | Readonly<{
202
205
  default: NestedVarObject<T>,
203
206
  [string]: NestedVarObject<T>,
204
207
  }>;
205
208
 
206
- type TTokens = $ReadOnly<{
209
+ type TTokens = Readonly<{
207
210
  [string]:
208
211
  | NestedVarObject<null | string | number>
209
212
  | StyleXVar<null | string | number>
@@ -229,21 +232,21 @@ export type StyleX$DefineConsts = <
229
232
  tokens: DefaultTokens,
230
233
  ) => DefaultTokens;
231
234
 
232
- // opaque type ThemeKey<+_VG: VarGroup<{ +[string]: mixed }>>: string = string;
235
+ // opaque type ThemeKey<+_VG: VarGroup<{ +[string]: unknown }>>: string = string;
233
236
  declare export opaque type Theme<
234
- +T: VarGroup<{ +[string]: mixed }, string>,
237
+ +T: VarGroup<{ +[string]: unknown }, string>,
235
238
  +_Tag: string = string,
236
- >: $ReadOnly<{
239
+ >: Readonly<{
237
240
  $$css: true,
238
241
  theme: StyleXClassNameFor<'theme', IDFromVarGroup<T>>,
239
242
  }>;
240
243
 
241
- export type OverridesForTokenType<+Config: { +[string]: mixed }> = {
244
+ export type OverridesForTokenType<+Config: { +[string]: unknown }> = {
242
245
  [Key in keyof Config]?: NestedVarObject<Config[Key]>,
243
246
  };
244
247
 
245
248
  export type StyleX$CreateTheme = <
246
- BaseTokens: VarGroup<{ +[string]: mixed }>,
249
+ BaseTokens: VarGroup<{ +[string]: unknown }>,
247
250
  ID: string = string,
248
251
  >(
249
252
  baseTokens: BaseTokens,
@@ -256,23 +259,23 @@ export type StyleX$DefineMarker = () => MapNamespace<{
256
259
 
257
260
  export type StyleX$When = {
258
261
  ancestor: (
259
- _pseudo?: StringPrefix<':'>,
262
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
260
263
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
261
264
  ) => ':where-ancestor',
262
265
  descendant: (
263
- _pseudo?: StringPrefix<':'>,
266
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
264
267
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
265
268
  ) => ':where-descendant',
266
269
  siblingBefore: (
267
- _pseudo?: StringPrefix<':'>,
270
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
268
271
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
269
272
  ) => ':where-sibling-before',
270
273
  siblingAfter: (
271
- _pseudo?: StringPrefix<':'>,
274
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
272
275
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
273
276
  ) => ':where-sibling-after',
274
277
  anySibling: (
275
- _pseudo?: StringPrefix<':'>,
278
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
276
279
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
277
280
  ) => ':where-any-sibling',
278
281
  };
@@ -9,7 +9,7 @@
9
9
 
10
10
  export type ValueWithDefault<+T> =
11
11
  | T
12
- | $ReadOnly<{
12
+ | Readonly<{
13
13
  default: ValueWithDefault<T>,
14
14
  [string]: ValueWithDefault<T>,
15
15
  }>;
@@ -7,7 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- type InjectArgs = $ReadOnly<{
10
+ type InjectArgs = Readonly<{
11
11
  ltr: string,
12
12
  rtl?: ?string,
13
13
  priority: number,
@@ -7,7 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- export type OrderedCSSStyleSheet = $ReadOnly<{
10
+ export type OrderedCSSStyleSheet = Readonly<{
11
11
  getTextContent: () => string,
12
12
  insert: (cssText: string, groupValue: number) => void,
13
13
  update: (oldCssText: string, newCssText: string, groupValue: number) => void,
@@ -9,7 +9,7 @@
9
9
 
10
10
  import type { OrderedCSSStyleSheet } from './createOrderedCSSStyleSheet';
11
11
 
12
- type Sheet = $ReadOnly<{
12
+ type Sheet = Readonly<{
13
13
  ...OrderedCSSStyleSheet,
14
14
  }>;
15
15
 
@@ -92,6 +92,8 @@ export declare const defaultMarker: () => MapNamespace<
92
92
  export declare type defaultMarker = typeof defaultMarker;
93
93
  export declare const when: StyleX$When;
94
94
  export declare type when = typeof when;
95
+ export declare const env: Readonly<{ [$$Key$$: string]: unknown }>;
96
+ export declare type env = typeof env;
95
97
  export declare const types: {
96
98
  angle: <T extends string | 0 = string | 0>(
97
99
  _v: ValueWithDefault<T>,
@@ -144,6 +146,7 @@ type IStyleX = {
144
146
  createTheme: StyleX$CreateTheme;
145
147
  defineConsts: StyleX$DefineConsts;
146
148
  defineVars: StyleX$DefineVars;
149
+ env: Readonly<{ [$$Key$$: string]: unknown }>;
147
150
  defaultMarker: () => MapNamespace<Readonly<{ marker: 'default-marker' }>>;
148
151
  defineMarker: StyleX$DefineMarker;
149
152
  firstThatWorks: <T extends string | number>(
@@ -63,24 +63,24 @@ declare export const defineVars: StyleX$DefineVars;
63
63
  declare export const defineMarker: StyleX$DefineMarker;
64
64
 
65
65
  declare export const firstThatWorks: <T: string | number>(
66
- ..._styles: $ReadOnlyArray<T>
67
- ) => $ReadOnlyArray<T>;
66
+ ..._styles: ReadonlyArray<T>
67
+ ) => ReadonlyArray<T>;
68
68
 
69
69
  declare export const keyframes: (_keyframes: Keyframes) => string;
70
70
 
71
71
  declare export const positionTry: (_positionTry: PositionTry) => string;
72
72
 
73
73
  declare export function props(
74
- this: ?mixed,
75
- ...styles: $ReadOnlyArray<
74
+ this: ?unknown,
75
+ ...styles: ReadonlyArray<
76
76
  StyleXArray<
77
- ?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
77
+ ?CompiledStyles | boolean | Readonly<[CompiledStyles, InlineStyles]>,
78
78
  >,
79
79
  >
80
- ): $ReadOnly<{
80
+ ): Readonly<{
81
81
  className?: string,
82
82
  'data-style-src'?: string,
83
- style?: $ReadOnly<{ [string]: string | number }>,
83
+ style?: Readonly<{ [string]: string | number }>,
84
84
  }>;
85
85
 
86
86
  declare export const viewTransitionClass: (
@@ -88,13 +88,15 @@ declare export const viewTransitionClass: (
88
88
  ) => string;
89
89
 
90
90
  declare export const defaultMarker: () => MapNamespace<
91
- $ReadOnly<{
91
+ Readonly<{
92
92
  marker: 'default-marker',
93
93
  }>,
94
94
  >;
95
95
 
96
96
  declare export const when: StyleX$When;
97
97
 
98
+ declare export const env: $ReadOnly<{ [string]: mixed }>;
99
+
98
100
  declare export const types: {
99
101
  angle: <T: string | 0 = string | 0>(
100
102
  _v: ValueWithDefault<T>,
@@ -130,38 +132,39 @@ declare export const types: {
130
132
  */
131
133
 
132
134
  type IStyleX = {
133
- (...styles: $ReadOnlyArray<StyleXArray<?CompiledStyles | boolean>>): string,
135
+ (...styles: ReadonlyArray<StyleXArray<?CompiledStyles | boolean>>): string,
134
136
  create: StyleX$Create,
135
137
  createTheme: StyleX$CreateTheme,
136
138
  defineConsts: StyleX$DefineConsts,
137
139
  defineVars: StyleX$DefineVars,
140
+ env: $ReadOnly<{ [string]: mixed }>,
138
141
  defaultMarker: () => MapNamespace<
139
- $ReadOnly<{
142
+ Readonly<{
140
143
  marker: 'default-marker',
141
144
  }>,
142
145
  >,
143
146
  defineMarker: StyleX$DefineMarker,
144
147
  firstThatWorks: <T: string | number>(
145
- ...v: $ReadOnlyArray<T>
146
- ) => $ReadOnlyArray<T>,
148
+ ...v: ReadonlyArray<T>
149
+ ) => ReadonlyArray<T>,
147
150
  keyframes: (keyframes: Keyframes) => string,
148
151
  positionTry: (positionTry: PositionTry) => string,
149
152
  props: (
150
- this: ?mixed,
151
- ...styles: $ReadOnlyArray<
153
+ this: ?unknown,
154
+ ...styles: ReadonlyArray<
152
155
  StyleXArray<
153
- ?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
156
+ ?CompiledStyles | boolean | Readonly<[CompiledStyles, InlineStyles]>,
154
157
  >,
155
158
  >
156
- ) => $ReadOnly<{
159
+ ) => Readonly<{
157
160
  className?: string,
158
161
  'data-style-src'?: string,
159
- style?: $ReadOnly<{ [string]: string | number }>,
162
+ style?: Readonly<{ [string]: string | number }>,
160
163
  }>,
161
164
  viewTransitionClass: (viewTransitionClass: ViewTransitionClass) => string,
162
165
  types: typeof types,
163
166
  when: typeof when,
164
- __customProperties?: { [string]: mixed },
167
+ __customProperties?: { [string]: unknown },
165
168
  ...
166
169
  };
167
170
 
package/lib/es/stylex.mjs CHANGED
@@ -193,6 +193,7 @@ const when = {
193
193
  throw errorForFn('when.anySibling');
194
194
  }
195
195
  };
196
+ const env = Object.freeze({});
196
197
  const types = {
197
198
  angle: _v => {
198
199
  throw errorForType('angle');
@@ -251,6 +252,7 @@ _legacyMerge.props = props;
251
252
  _legacyMerge.types = types;
252
253
  _legacyMerge.when = when;
253
254
  _legacyMerge.viewTransitionClass = viewTransitionClass;
255
+ _legacyMerge.env = env;
254
256
  const legacyMerge = _legacyMerge;
255
257
 
256
- export { create, createTheme, defaultMarker, defineConsts, defineMarker, defineVars, firstThatWorks, keyframes, legacyMerge, positionTry, props, types, viewTransitionClass, when };
258
+ export { create, createTheme, defaultMarker, defineConsts, defineMarker, defineVars, env, firstThatWorks, keyframes, legacyMerge, positionTry, props, types, viewTransitionClass, when };
@@ -953,14 +953,14 @@ type top = number | string;
953
953
 
954
954
  type OptionalArray<T> = Array<T> | T;
955
955
 
956
- export type SupportedVendorSpecificCSSProperties = $ReadOnly<{
956
+ export type SupportedVendorSpecificCSSProperties = Readonly<{
957
957
  MozOsxFontSmoothing?: null | 'grayscale',
958
958
  WebkitAppearance?: null | appearance,
959
959
  WebkitFontSmoothing?: null | 'antialiased',
960
960
  WebkitTapHighlightColor?: null | color,
961
961
  }>;
962
962
 
963
- export type CSSProperties = $ReadOnly<{
963
+ export type CSSProperties = Readonly<{
964
964
  // NOTE: adding a non-CSS property here for support themes in Stylex.
965
965
  theme?: all | string,
966
966
 
@@ -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: mixed>: string;
14
+ declare export opaque type StyleXVar<+_Val: unknown>: string;
15
15
 
16
16
  declare export opaque type StyleXClassNameFor<+_K, +_V>: string;
@@ -306,18 +306,23 @@ export type StyleX$CreateTheme = <
306
306
  overrides: OverridesForTokenType<TokensFromVarGroup<TVars>>,
307
307
  ) => Theme<TVars, ThemeID>;
308
308
 
309
+ declare const StyleXMarkerTag: unique symbol;
310
+
309
311
  export type StyleX$DefineMarker = () => MapNamespace<{
310
- readonly marker: unique symbol;
312
+ readonly marker: typeof StyleXMarkerTag;
311
313
  }>;
312
314
 
313
315
  export type StyleX$When = {
314
- ancestor: <const Pseudo extends string, MarkerSymbol extends symbol = symbol>(
316
+ ancestor: <
317
+ const Pseudo extends `:${string}` | `[${string}]`,
318
+ MarkerSymbol extends symbol = symbol,
319
+ >(
315
320
  _pseudo?: Pseudo,
316
321
  _customMarker?: MapNamespace<{ readonly marker: MarkerSymbol }>,
317
322
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
318
323
  ) => `:where-ancestor(${Pseudo}, ${MarkerSymbol})`;
319
324
  descendant: <
320
- const Pseudo extends string,
325
+ const Pseudo extends `:${string}` | `[${string}]`,
321
326
  MarkerSymbol extends symbol = symbol,
322
327
  >(
323
328
  _pseudo?: Pseudo,
@@ -325,7 +330,7 @@ export type StyleX$When = {
325
330
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
326
331
  ) => `:where-descendant(${Pseudo}, ${MarkerSymbol})`;
327
332
  siblingBefore: <
328
- const Pseudo extends string,
333
+ const Pseudo extends `:${string}` | `[${string}]`,
329
334
  MarkerSymbol extends symbol = symbol,
330
335
  >(
331
336
  _pseudo?: Pseudo,
@@ -333,7 +338,7 @@ export type StyleX$When = {
333
338
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
334
339
  ) => `:where-sibling-before(${Pseudo}, ${MarkerSymbol})`;
335
340
  siblingAfter: <
336
- const Pseudo extends string,
341
+ const Pseudo extends `:${string}` | `[${string}]`,
337
342
  MarkerSymbol extends symbol = symbol,
338
343
  >(
339
344
  _pseudo?: Pseudo,
@@ -341,7 +346,7 @@ export type StyleX$When = {
341
346
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
342
347
  ) => `:where-sibling-after(${Pseudo}, ${MarkerSymbol})`;
343
348
  anySibling: <
344
- const Pseudo extends string,
349
+ const Pseudo extends `:${string}` | `[${string}]`,
345
350
  MarkerSymbol extends symbol = symbol,
346
351
  >(
347
352
  _pseudo?: Pseudo,
@@ -14,14 +14,14 @@ import type { CSSType } from './VarTypes';
14
14
  export type { StyleXClassNameFor, StyleXVar } from './StyleXOpaqueTypes';
15
15
 
16
16
  // Using an opaque type to declare ClassNames generated by stylex.
17
- export type StyleXClassNameForValue<+V> = StyleXClassNameFor<mixed, V>;
18
- export type StyleXClassNameForKey<+K> = StyleXClassNameFor<K, mixed>;
19
- export type StyleXClassName = StyleXClassNameFor<mixed, mixed>;
17
+ export type StyleXClassNameForValue<+V> = StyleXClassNameFor<unknown, V>;
18
+ export type StyleXClassNameForKey<+K> = StyleXClassNameFor<K, unknown>;
19
+ export type StyleXClassName = StyleXClassNameFor<unknown, unknown>;
20
20
 
21
21
  // Type for arbitrarily nested Array.
22
- export type StyleXArray<+T> = T | $ReadOnlyArray<StyleXArray<T>>;
22
+ export type StyleXArray<+T> = T | ReadonlyArray<StyleXArray<T>>;
23
23
 
24
- type CSSPropertiesWithExtras = $ReadOnly<{
24
+ type CSSPropertiesWithExtras = Readonly<{
25
25
  ...CSSProperties,
26
26
  '::before'?: CSSProperties,
27
27
  '::after'?: CSSProperties,
@@ -45,21 +45,21 @@ type CSSPropertiesWithExtras = $ReadOnly<{
45
45
  '::-webkit-search-results-decoration'?: CSSProperties,
46
46
  }>;
47
47
 
48
- export type NestedCSSPropTypes = $ReadOnly<{
48
+ export type NestedCSSPropTypes = Readonly<{
49
49
  [Key in keyof CSSPropertiesWithExtras]?: StyleXClassNameForKey<Key>,
50
50
  }>;
51
51
 
52
52
  export type StyleXSingleStyle = false | ?NestedCSSPropTypes;
53
53
  export type XStyle<+T = NestedCSSPropTypes> = StyleXArray<
54
- false | ?$ReadOnly<{ ...T, $$css: true }>,
54
+ false | ?Readonly<{ ...T, $$css: true }>,
55
55
  >;
56
56
 
57
- export type XStyleWithout<+T: { +[_K in keyof NestedCSSPropTypes]?: mixed }> =
58
- XStyle<$ReadOnly<Omit<NestedCSSPropTypes, $Keys<T>>>>;
57
+ export type XStyleWithout<+T: { +[_K in keyof NestedCSSPropTypes]?: unknown }> =
58
+ XStyle<Readonly<Omit<NestedCSSPropTypes, keyof T>>>;
59
59
 
60
- export type Keyframes = $ReadOnly<{ [name: string]: CSSProperties, ... }>;
60
+ export type Keyframes = Readonly<{ [name: string]: CSSProperties, ... }>;
61
61
 
62
- export type PositionTry = $ReadOnly<{
62
+ export type PositionTry = Readonly<{
63
63
  // Anchor Positioning Properties
64
64
  positionAnchor?: CSSProperties['positionAnchor'],
65
65
  positionArea?: CSSProperties['positionArea'],
@@ -106,14 +106,14 @@ export type PositionTry = $ReadOnly<{
106
106
  placeSelf?: CSSProperties['placeSelf'],
107
107
  }>;
108
108
 
109
- export type ViewTransitionClass = $ReadOnly<{
109
+ export type ViewTransitionClass = Readonly<{
110
110
  group?: CSSProperties,
111
111
  imagePair?: CSSProperties,
112
112
  old?: CSSProperties,
113
113
  new?: CSSProperties,
114
114
  }>;
115
115
 
116
- export type LegacyThemeStyles = $ReadOnly<{
116
+ export type LegacyThemeStyles = Readonly<{
117
117
  [constantName: string]: string,
118
118
  ...
119
119
  }>;
@@ -125,85 +125,88 @@ type ComplexStyleValueType<+T> =
125
125
  : U
126
126
  : T extends string | number | null
127
127
  ? T
128
- : T extends $ReadOnlyArray<infer U>
128
+ : T extends ReadonlyArray<infer U>
129
129
  ? ComplexStyleValueType<U>
130
130
  : T extends { +default: infer A, +[string]: infer B }
131
131
  ? ComplexStyleValueType<A> | ComplexStyleValueType<B>
132
- : $ReadOnly<T>;
132
+ : Readonly<T>;
133
133
 
134
- type _MapNamespace<+CSS: { +[string]: mixed }> = $ReadOnly<{
134
+ type _MapNamespace<+CSS: { +[string]: unknown }> = Readonly<{
135
135
  [Key in keyof CSS]: StyleXClassNameFor<Key, ComplexStyleValueType<CSS[Key]>>,
136
136
  }>;
137
- export type MapNamespace<+CSS: { +[string]: mixed }> = $ReadOnly<{
137
+ export type MapNamespace<+CSS: { +[string]: unknown }> = Readonly<{
138
138
  ..._MapNamespace<CSS>,
139
139
  $$css: true,
140
140
  }>;
141
- export type MapNamespaces<+S: { +[string]: mixed }> = $ReadOnly<{
141
+ export type MapNamespaces<+S: { +[string]: unknown }> = Readonly<{
142
142
  [Key in keyof S]: S[Key] extends (...args: infer Args) => infer Obj
143
- ? (...args: Args) => $ReadOnly<[MapNamespace<Obj>, InlineStyles]>
143
+ ? (...args: Args) => Readonly<[MapNamespace<Obj>, InlineStyles]>
144
144
  : MapNamespace<S[Key]>,
145
145
  }>;
146
146
  export type StyleX$Create = <const S: { +[string]: { ... } }>(
147
147
  styles: S,
148
148
  ) => MapNamespaces<S>;
149
149
 
150
- export type CompiledStyles = $ReadOnly<{
150
+ export type CompiledStyles = Readonly<{
151
151
  $$css: true,
152
152
  [key: string]: StyleXClassName,
153
153
  }>;
154
- export type InlineStyles = $ReadOnly<{
154
+ export type InlineStyles = Readonly<{
155
155
  $$css?: void,
156
156
  [key: string]: string,
157
157
  }>;
158
158
 
159
- type _GenStylePropType<+CSS: { +[string]: mixed }> = $ReadOnly<{
160
- [Key in keyof CSS]: CSS[Key] extends { +[string]: mixed }
161
- ? StyleXClassNameFor<Key, $ReadOnly<CSS[Key]>>
159
+ type _GenStylePropType<+CSS: { +[string]: unknown }> = Readonly<{
160
+ [Key in keyof CSS]: CSS[Key] extends { +[string]: unknown }
161
+ ? StyleXClassNameFor<Key, Readonly<CSS[Key]>>
162
162
  : StyleXClassNameFor<Key, CSS[Key]>,
163
163
  }>;
164
- type GenStylePropType<+CSS: { +[string]: mixed }> = $ReadOnly<{
164
+ type GenStylePropType<+CSS: { +[string]: unknown }> = Readonly<{
165
165
  ..._GenStylePropType<CSS>,
166
166
  $$css: true,
167
167
  }>;
168
168
 
169
169
  // Replace `XStyle` with this.
170
- export type StaticStyles<+CSS: { +[string]: mixed } = CSSPropertiesWithExtras> =
171
- StyleXArray<false | ?GenStylePropType<$ReadOnly<CSS>>>;
170
+ export type StaticStyles<
171
+ +CSS: { +[string]: unknown } = CSSPropertiesWithExtras,
172
+ > = StyleXArray<false | ?GenStylePropType<Readonly<CSS>>>;
172
173
 
173
- export type StaticStylesWithout<+CSS: { +[string]: mixed }> = StaticStyles<
174
- Omit<CSSPropertiesWithExtras, $Keys<CSS>>,
174
+ export type StaticStylesWithout<+CSS: { +[string]: unknown }> = StaticStyles<
175
+ Omit<CSSPropertiesWithExtras, keyof CSS>,
175
176
  >;
176
177
 
177
- export type StyleXStyles<+CSS: { +[string]: mixed } = CSSPropertiesWithExtras> =
178
- StyleXArray<
179
- | ?false
180
- | GenStylePropType<$ReadOnly<CSS>>
181
- | $ReadOnly<[GenStylePropType<$ReadOnly<CSS>>, InlineStyles]>,
182
- >;
178
+ export type StyleXStyles<
179
+ +CSS: { +[string]: unknown } = CSSPropertiesWithExtras,
180
+ > = StyleXArray<
181
+ | ?false
182
+ | GenStylePropType<Readonly<CSS>>
183
+ | Readonly<[GenStylePropType<Readonly<CSS>>, InlineStyles]>,
184
+ >;
183
185
 
184
- export type StyleXStylesWithout<+CSS: { +[string]: mixed }> = StyleXStyles<
185
- Omit<CSSPropertiesWithExtras, $Keys<CSS>>,
186
+ export type StyleXStylesWithout<+CSS: { +[string]: unknown }> = StyleXStyles<
187
+ Omit<CSSPropertiesWithExtras, keyof CSS>,
186
188
  >;
187
189
 
188
- export type VarGroup<+Tokens: { +[string]: mixed }, +_ID: string = string> = {
190
+ export type VarGroup<+Tokens: { +[string]: unknown }, +_ID: string = string> = {
189
191
  +[Key in keyof Tokens]: StyleXVar<Tokens[Key]>,
190
192
  };
191
193
 
192
- export type TokensFromVarGroup<+T: VarGroup<{ +[string]: mixed }>> = $ReadOnly<{
193
- [Key in keyof T]: UnwrapVar<T[Key]>,
194
- }>;
194
+ export type TokensFromVarGroup<+T: VarGroup<{ +[string]: unknown }>> =
195
+ Readonly<{
196
+ [Key in keyof T]: UnwrapVar<T[Key]>,
197
+ }>;
195
198
 
196
- type IDFromVarGroup<+T: VarGroup<{ +[string]: mixed }>> =
197
- T extends VarGroup<{ +[string]: mixed }, infer ID> ? ID : empty;
199
+ type IDFromVarGroup<+T: VarGroup<{ +[string]: unknown }>> =
200
+ T extends VarGroup<{ +[string]: unknown }, infer ID> ? ID : empty;
198
201
 
199
202
  type NestedVarObject<+T> =
200
203
  | T
201
- | $ReadOnly<{
204
+ | Readonly<{
202
205
  default: NestedVarObject<T>,
203
206
  [string]: NestedVarObject<T>,
204
207
  }>;
205
208
 
206
- type TTokens = $ReadOnly<{
209
+ type TTokens = Readonly<{
207
210
  [string]:
208
211
  | NestedVarObject<null | string | number>
209
212
  | StyleXVar<null | string | number>
@@ -229,21 +232,21 @@ export type StyleX$DefineConsts = <
229
232
  tokens: DefaultTokens,
230
233
  ) => DefaultTokens;
231
234
 
232
- // opaque type ThemeKey<+_VG: VarGroup<{ +[string]: mixed }>>: string = string;
235
+ // opaque type ThemeKey<+_VG: VarGroup<{ +[string]: unknown }>>: string = string;
233
236
  declare export opaque type Theme<
234
- +T: VarGroup<{ +[string]: mixed }, string>,
237
+ +T: VarGroup<{ +[string]: unknown }, string>,
235
238
  +_Tag: string = string,
236
- >: $ReadOnly<{
239
+ >: Readonly<{
237
240
  $$css: true,
238
241
  theme: StyleXClassNameFor<'theme', IDFromVarGroup<T>>,
239
242
  }>;
240
243
 
241
- export type OverridesForTokenType<+Config: { +[string]: mixed }> = {
244
+ export type OverridesForTokenType<+Config: { +[string]: unknown }> = {
242
245
  [Key in keyof Config]?: NestedVarObject<Config[Key]>,
243
246
  };
244
247
 
245
248
  export type StyleX$CreateTheme = <
246
- BaseTokens: VarGroup<{ +[string]: mixed }>,
249
+ BaseTokens: VarGroup<{ +[string]: unknown }>,
247
250
  ID: string = string,
248
251
  >(
249
252
  baseTokens: BaseTokens,
@@ -256,23 +259,23 @@ export type StyleX$DefineMarker = () => MapNamespace<{
256
259
 
257
260
  export type StyleX$When = {
258
261
  ancestor: (
259
- _pseudo?: StringPrefix<':'>,
262
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
260
263
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
261
264
  ) => ':where-ancestor',
262
265
  descendant: (
263
- _pseudo?: StringPrefix<':'>,
266
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
264
267
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
265
268
  ) => ':where-descendant',
266
269
  siblingBefore: (
267
- _pseudo?: StringPrefix<':'>,
270
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
268
271
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
269
272
  ) => ':where-sibling-before',
270
273
  siblingAfter: (
271
- _pseudo?: StringPrefix<':'>,
274
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
272
275
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
273
276
  ) => ':where-sibling-after',
274
277
  anySibling: (
275
- _pseudo?: StringPrefix<':'>,
278
+ _pseudo?: StringPrefix<':'> | StringPrefix<'['>,
276
279
  _customMarker?: MapNamespace<{ +marker: 'custom-marker' }>,
277
280
  ) => ':where-any-sibling',
278
281
  };
@@ -9,7 +9,7 @@
9
9
 
10
10
  export type ValueWithDefault<+T> =
11
11
  | T
12
- | $ReadOnly<{
12
+ | Readonly<{
13
13
  default: ValueWithDefault<T>,
14
14
  [string]: ValueWithDefault<T>,
15
15
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/stylex",
3
- "version": "0.17.5",
3
+ "version": "0.18.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",
@@ -60,7 +60,7 @@
60
60
  "babel-plugin-syntax-hermes-parser": "^0.32.1",
61
61
  "cross-env": "^10.1.0",
62
62
  "rollup": "^4.24.0",
63
- "scripts": "0.17.5"
63
+ "scripts": "0.18.0"
64
64
  },
65
65
  "files": [
66
66
  "lib/*"