@stylexjs/stylex 0.17.4 → 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
 
@@ -161,6 +161,18 @@ type borderRightColor = color;
161
161
  type borderRightStyle = brStyle;
162
162
  type borderRightWidth = borderWidth;
163
163
  type borderRadius = lengthPercentage;
164
+ type cornerShape =
165
+ | 'round'
166
+ | 'scoop'
167
+ | 'bevel'
168
+ | 'notch'
169
+ | 'square'
170
+ | 'squircle'
171
+ | string;
172
+ type cornerTopLeftShape = cornerShape;
173
+ type cornerTopRightShape = cornerShape;
174
+ type cornerBottomLeftShape = cornerShape;
175
+ type cornerBottomRightShape = cornerShape;
164
176
  type borderSpacing = number | string;
165
177
  type borderStyle = brStyle;
166
178
  type borderTopLeftRadius = lengthPercentage;
@@ -1061,6 +1073,15 @@ export type CSSProperties = Readonly<{
1061
1073
  borderTopRightRadius?: all | borderTopRightRadius;
1062
1074
  borderBottomLeftRadius?: all | borderBottomLeftRadius;
1063
1075
  borderBottomRightRadius?: all | borderBottomRightRadius;
1076
+ cornerShape?: all | cornerShape;
1077
+ cornerStartStartShape?: all | cornerTopLeftShape;
1078
+ cornerStartEndShape?: all | cornerTopRightShape;
1079
+ cornerEndStartShape?: all | cornerBottomLeftShape;
1080
+ cornerEndEndShape?: all | cornerBottomRightShape;
1081
+ cornerTopLeftShape?: all | cornerTopLeftShape;
1082
+ cornerTopRightShape?: all | cornerTopRightShape;
1083
+ cornerBottomLeftShape?: all | cornerBottomLeftShape;
1084
+ cornerBottomRightShape?: all | cornerBottomRightShape;
1064
1085
  borderTopStyle?: all | borderTopStyle;
1065
1086
  borderTopWidth?: all | borderTopWidth;
1066
1087
  borderWidth?: all | borderWidth;
@@ -163,6 +163,20 @@ type borderRightColor = color;
163
163
  type borderRightStyle = brStyle;
164
164
  type borderRightWidth = borderWidth;
165
165
  type borderRadius = lengthPercentage;
166
+
167
+ type cornerShape =
168
+ | 'round'
169
+ | 'scoop'
170
+ | 'bevel'
171
+ | 'notch'
172
+ | 'square'
173
+ | 'squircle'
174
+ // | StringPrefix<'superellipse('>
175
+ | string;
176
+ type cornerTopLeftShape = cornerShape;
177
+ type cornerTopRightShape = cornerShape;
178
+ type cornerBottomLeftShape = cornerShape;
179
+ type cornerBottomRightShape = cornerShape;
166
180
  type borderSpacing = number | string;
167
181
  type borderStyle = brStyle;
168
182
  type borderTopLeftRadius = lengthPercentage;
@@ -939,14 +953,14 @@ type top = number | string;
939
953
 
940
954
  type OptionalArray<T> = Array<T> | T;
941
955
 
942
- export type SupportedVendorSpecificCSSProperties = $ReadOnly<{
956
+ export type SupportedVendorSpecificCSSProperties = Readonly<{
943
957
  MozOsxFontSmoothing?: null | 'grayscale',
944
958
  WebkitAppearance?: null | appearance,
945
959
  WebkitFontSmoothing?: null | 'antialiased',
946
960
  WebkitTapHighlightColor?: null | color,
947
961
  }>;
948
962
 
949
- export type CSSProperties = $ReadOnly<{
963
+ export type CSSProperties = Readonly<{
950
964
  // NOTE: adding a non-CSS property here for support themes in Stylex.
951
965
  theme?: all | string,
952
966
 
@@ -1095,6 +1109,16 @@ export type CSSProperties = $ReadOnly<{
1095
1109
  borderBottomLeftRadius?: all | borderBottomLeftRadius,
1096
1110
  borderBottomRightRadius?: all | borderBottomRightRadius,
1097
1111
 
1112
+ cornerShape?: all | cornerShape,
1113
+ cornerStartStartShape?: all | cornerTopLeftShape,
1114
+ cornerStartEndShape?: all | cornerTopRightShape,
1115
+ cornerEndStartShape?: all | cornerBottomLeftShape,
1116
+ cornerEndEndShape?: all | cornerBottomRightShape,
1117
+ cornerTopLeftShape?: all | cornerTopLeftShape,
1118
+ cornerTopRightShape?: all | cornerTopRightShape,
1119
+ cornerBottomLeftShape?: all | cornerBottomLeftShape,
1120
+ cornerBottomRightShape?: all | cornerBottomRightShape,
1121
+
1098
1122
  borderTopStyle?: all | borderTopStyle,
1099
1123
  borderTopWidth?: all | borderTopWidth,
1100
1124
  borderWidth?: all | borderWidth,
@@ -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;
@@ -87,7 +87,9 @@ export type NestedCSSPropTypes = Partial<
87
87
  >;
88
88
 
89
89
  type NotUndefined = {} | null;
90
- type UserAuthoredStyles = CSSPropertiesWithExtras | { [key: string]: NotUndefined };
90
+ type UserAuthoredStyles =
91
+ | CSSPropertiesWithExtras
92
+ | { [key: string]: NotUndefined };
91
93
  export type StyleXSingleStyle = false | (null | undefined | NestedCSSPropTypes);
92
94
  // NOTE: `XStyle` has been deprecated in favor of `StaticStyles` and `StyleXStyles`.
93
95
 
@@ -304,18 +306,23 @@ export type StyleX$CreateTheme = <
304
306
  overrides: OverridesForTokenType<TokensFromVarGroup<TVars>>,
305
307
  ) => Theme<TVars, ThemeID>;
306
308
 
309
+ declare const StyleXMarkerTag: unique symbol;
310
+
307
311
  export type StyleX$DefineMarker = () => MapNamespace<{
308
- readonly marker: unique symbol;
312
+ readonly marker: typeof StyleXMarkerTag;
309
313
  }>;
310
314
 
311
315
  export type StyleX$When = {
312
- ancestor: <const Pseudo extends string, MarkerSymbol extends symbol = symbol>(
316
+ ancestor: <
317
+ const Pseudo extends `:${string}` | `[${string}]`,
318
+ MarkerSymbol extends symbol = symbol,
319
+ >(
313
320
  _pseudo?: Pseudo,
314
321
  _customMarker?: MapNamespace<{ readonly marker: MarkerSymbol }>,
315
322
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
316
323
  ) => `:where-ancestor(${Pseudo}, ${MarkerSymbol})`;
317
324
  descendant: <
318
- const Pseudo extends string,
325
+ const Pseudo extends `:${string}` | `[${string}]`,
319
326
  MarkerSymbol extends symbol = symbol,
320
327
  >(
321
328
  _pseudo?: Pseudo,
@@ -323,7 +330,7 @@ export type StyleX$When = {
323
330
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
324
331
  ) => `:where-descendant(${Pseudo}, ${MarkerSymbol})`;
325
332
  siblingBefore: <
326
- const Pseudo extends string,
333
+ const Pseudo extends `:${string}` | `[${string}]`,
327
334
  MarkerSymbol extends symbol = symbol,
328
335
  >(
329
336
  _pseudo?: Pseudo,
@@ -331,7 +338,7 @@ export type StyleX$When = {
331
338
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
332
339
  ) => `:where-sibling-before(${Pseudo}, ${MarkerSymbol})`;
333
340
  siblingAfter: <
334
- const Pseudo extends string,
341
+ const Pseudo extends `:${string}` | `[${string}]`,
335
342
  MarkerSymbol extends symbol = symbol,
336
343
  >(
337
344
  _pseudo?: Pseudo,
@@ -339,7 +346,7 @@ export type StyleX$When = {
339
346
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
340
347
  ) => `:where-sibling-after(${Pseudo}, ${MarkerSymbol})`;
341
348
  anySibling: <
342
- const Pseudo extends string,
349
+ const Pseudo extends `:${string}` | `[${string}]`,
343
350
  MarkerSymbol extends symbol = symbol,
344
351
  >(
345
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 };
@@ -161,6 +161,18 @@ type borderRightColor = color;
161
161
  type borderRightStyle = brStyle;
162
162
  type borderRightWidth = borderWidth;
163
163
  type borderRadius = lengthPercentage;
164
+ type cornerShape =
165
+ | 'round'
166
+ | 'scoop'
167
+ | 'bevel'
168
+ | 'notch'
169
+ | 'square'
170
+ | 'squircle'
171
+ | string;
172
+ type cornerTopLeftShape = cornerShape;
173
+ type cornerTopRightShape = cornerShape;
174
+ type cornerBottomLeftShape = cornerShape;
175
+ type cornerBottomRightShape = cornerShape;
164
176
  type borderSpacing = number | string;
165
177
  type borderStyle = brStyle;
166
178
  type borderTopLeftRadius = lengthPercentage;
@@ -1061,6 +1073,15 @@ export type CSSProperties = Readonly<{
1061
1073
  borderTopRightRadius?: all | borderTopRightRadius;
1062
1074
  borderBottomLeftRadius?: all | borderBottomLeftRadius;
1063
1075
  borderBottomRightRadius?: all | borderBottomRightRadius;
1076
+ cornerShape?: all | cornerShape;
1077
+ cornerStartStartShape?: all | cornerTopLeftShape;
1078
+ cornerStartEndShape?: all | cornerTopRightShape;
1079
+ cornerEndStartShape?: all | cornerBottomLeftShape;
1080
+ cornerEndEndShape?: all | cornerBottomRightShape;
1081
+ cornerTopLeftShape?: all | cornerTopLeftShape;
1082
+ cornerTopRightShape?: all | cornerTopRightShape;
1083
+ cornerBottomLeftShape?: all | cornerBottomLeftShape;
1084
+ cornerBottomRightShape?: all | cornerBottomRightShape;
1064
1085
  borderTopStyle?: all | borderTopStyle;
1065
1086
  borderTopWidth?: all | borderTopWidth;
1066
1087
  borderWidth?: all | borderWidth;
@@ -163,6 +163,20 @@ type borderRightColor = color;
163
163
  type borderRightStyle = brStyle;
164
164
  type borderRightWidth = borderWidth;
165
165
  type borderRadius = lengthPercentage;
166
+
167
+ type cornerShape =
168
+ | 'round'
169
+ | 'scoop'
170
+ | 'bevel'
171
+ | 'notch'
172
+ | 'square'
173
+ | 'squircle'
174
+ // | StringPrefix<'superellipse('>
175
+ | string;
176
+ type cornerTopLeftShape = cornerShape;
177
+ type cornerTopRightShape = cornerShape;
178
+ type cornerBottomLeftShape = cornerShape;
179
+ type cornerBottomRightShape = cornerShape;
166
180
  type borderSpacing = number | string;
167
181
  type borderStyle = brStyle;
168
182
  type borderTopLeftRadius = lengthPercentage;
@@ -939,14 +953,14 @@ type top = number | string;
939
953
 
940
954
  type OptionalArray<T> = Array<T> | T;
941
955
 
942
- export type SupportedVendorSpecificCSSProperties = $ReadOnly<{
956
+ export type SupportedVendorSpecificCSSProperties = Readonly<{
943
957
  MozOsxFontSmoothing?: null | 'grayscale',
944
958
  WebkitAppearance?: null | appearance,
945
959
  WebkitFontSmoothing?: null | 'antialiased',
946
960
  WebkitTapHighlightColor?: null | color,
947
961
  }>;
948
962
 
949
- export type CSSProperties = $ReadOnly<{
963
+ export type CSSProperties = Readonly<{
950
964
  // NOTE: adding a non-CSS property here for support themes in Stylex.
951
965
  theme?: all | string,
952
966
 
@@ -1095,6 +1109,16 @@ export type CSSProperties = $ReadOnly<{
1095
1109
  borderBottomLeftRadius?: all | borderBottomLeftRadius,
1096
1110
  borderBottomRightRadius?: all | borderBottomRightRadius,
1097
1111
 
1112
+ cornerShape?: all | cornerShape,
1113
+ cornerStartStartShape?: all | cornerTopLeftShape,
1114
+ cornerStartEndShape?: all | cornerTopRightShape,
1115
+ cornerEndStartShape?: all | cornerBottomLeftShape,
1116
+ cornerEndEndShape?: all | cornerBottomRightShape,
1117
+ cornerTopLeftShape?: all | cornerTopLeftShape,
1118
+ cornerTopRightShape?: all | cornerTopRightShape,
1119
+ cornerBottomLeftShape?: all | cornerBottomLeftShape,
1120
+ cornerBottomRightShape?: all | cornerBottomRightShape,
1121
+
1098
1122
  borderTopStyle?: all | borderTopStyle,
1099
1123
  borderTopWidth?: all | borderTopWidth,
1100
1124
  borderWidth?: all | borderWidth,
@@ -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;
@@ -87,7 +87,9 @@ export type NestedCSSPropTypes = Partial<
87
87
  >;
88
88
 
89
89
  type NotUndefined = {} | null;
90
- type UserAuthoredStyles = CSSPropertiesWithExtras | { [key: string]: NotUndefined };
90
+ type UserAuthoredStyles =
91
+ | CSSPropertiesWithExtras
92
+ | { [key: string]: NotUndefined };
91
93
  export type StyleXSingleStyle = false | (null | undefined | NestedCSSPropTypes);
92
94
  // NOTE: `XStyle` has been deprecated in favor of `StaticStyles` and `StyleXStyles`.
93
95
 
@@ -304,18 +306,23 @@ export type StyleX$CreateTheme = <
304
306
  overrides: OverridesForTokenType<TokensFromVarGroup<TVars>>,
305
307
  ) => Theme<TVars, ThemeID>;
306
308
 
309
+ declare const StyleXMarkerTag: unique symbol;
310
+
307
311
  export type StyleX$DefineMarker = () => MapNamespace<{
308
- readonly marker: unique symbol;
312
+ readonly marker: typeof StyleXMarkerTag;
309
313
  }>;
310
314
 
311
315
  export type StyleX$When = {
312
- ancestor: <const Pseudo extends string, MarkerSymbol extends symbol = symbol>(
316
+ ancestor: <
317
+ const Pseudo extends `:${string}` | `[${string}]`,
318
+ MarkerSymbol extends symbol = symbol,
319
+ >(
313
320
  _pseudo?: Pseudo,
314
321
  _customMarker?: MapNamespace<{ readonly marker: MarkerSymbol }>,
315
322
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
316
323
  ) => `:where-ancestor(${Pseudo}, ${MarkerSymbol})`;
317
324
  descendant: <
318
- const Pseudo extends string,
325
+ const Pseudo extends `:${string}` | `[${string}]`,
319
326
  MarkerSymbol extends symbol = symbol,
320
327
  >(
321
328
  _pseudo?: Pseudo,
@@ -323,7 +330,7 @@ export type StyleX$When = {
323
330
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
324
331
  ) => `:where-descendant(${Pseudo}, ${MarkerSymbol})`;
325
332
  siblingBefore: <
326
- const Pseudo extends string,
333
+ const Pseudo extends `:${string}` | `[${string}]`,
327
334
  MarkerSymbol extends symbol = symbol,
328
335
  >(
329
336
  _pseudo?: Pseudo,
@@ -331,7 +338,7 @@ export type StyleX$When = {
331
338
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
332
339
  ) => `:where-sibling-before(${Pseudo}, ${MarkerSymbol})`;
333
340
  siblingAfter: <
334
- const Pseudo extends string,
341
+ const Pseudo extends `:${string}` | `[${string}]`,
335
342
  MarkerSymbol extends symbol = symbol,
336
343
  >(
337
344
  _pseudo?: Pseudo,
@@ -339,7 +346,7 @@ export type StyleX$When = {
339
346
  // @ts-expect-error - Trying to use a symbol in a string is not normally allowed
340
347
  ) => `:where-sibling-after(${Pseudo}, ${MarkerSymbol})`;
341
348
  anySibling: <
342
- const Pseudo extends string,
349
+ const Pseudo extends `:${string}` | `[${string}]`,
343
350
  MarkerSymbol extends symbol = symbol,
344
351
  >(
345
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.4",
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",
@@ -29,11 +29,11 @@
29
29
  },
30
30
  "license": "MIT",
31
31
  "scripts": {
32
- "prebuild": "rimraf lib && gen-types -i src/ -o lib/cjs && cp -r lib/cjs lib/es",
32
+ "prebuild": "shx rm -rf lib && gen-types -i src/ -o lib/cjs && shx cp -r lib/cjs lib/es",
33
33
  "build:cjs": "cross-env BABEL_ENV=cjs rollup -c ./rollup.config.mjs",
34
34
  "build:esm": "cross-env BABEL_ENV=esm rollup -c ./rollup.config.mjs",
35
35
  "build": "npm run build:cjs && npm run build:esm",
36
- "build-haste": "rimraf lib && rewrite-imports -i src/ -o lib/",
36
+ "build-haste": "shx rm -rf lib && rewrite-imports -i src/ -o lib/",
37
37
  "test": "cross-env BABEL_ENV=test jest --coverage"
38
38
  },
39
39
  "dependencies": {
@@ -59,9 +59,8 @@
59
59
  "@rollup/plugin-replace": "^6.0.1",
60
60
  "babel-plugin-syntax-hermes-parser": "^0.32.1",
61
61
  "cross-env": "^10.1.0",
62
- "rimraf": "^6.1.2",
63
62
  "rollup": "^4.24.0",
64
- "scripts": "0.17.4"
63
+ "scripts": "0.18.0"
65
64
  },
66
65
  "files": [
67
66
  "lib/*"