@stylexjs/stylex 0.2.0-beta.26 → 0.2.0-beta.27

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.
@@ -114,9 +114,13 @@ export type Stylex$Create = <
114
114
  styles: S,
115
115
  ) => MapNamespaces<S>;
116
116
 
117
- export type CompiledStyles = Readonly<{
118
- [key: string]: StyleXClassName | null | void | never;
119
- }>;
117
+ export type CompiledStyles =
118
+ | Readonly<{
119
+ [key: string]: StyleXClassName | null | void | never;
120
+ }>
121
+ | Readonly<{
122
+ theme: StyleXClassName;
123
+ }>;
120
124
 
121
125
  declare const StyleXInlineStylesTag: unique symbol;
122
126
 
@@ -155,27 +159,29 @@ export type StyleXStylesWithout<CSS extends UserAuthoredStyles> = StyleXStyles<
155
159
 
156
160
  declare const StyleXVarGroupTag: unique symbol;
157
161
  export type VarGroup<
158
- Tokens extends { [key: string]: unknown },
162
+ Tokens extends { [key: string]: any },
159
163
  ID extends symbol = symbol,
160
164
  > = Readonly<{
161
- [Key in keyof Tokens]: Tokens[Key];
162
- }> & {
163
- $opaqueId: ID;
164
- $tokens: Tokens;
165
- } & typeof StyleXVarGroupTag;
165
+ [Key in keyof Tokens]: StyleXVar<Tokens[Key]>;
166
+ }> &
167
+ Readonly<{
168
+ $opaqueId: ID;
169
+ $tokens: Tokens;
170
+ }> &
171
+ typeof StyleXVarGroupTag;
166
172
 
167
- export type TokensFromVarGroup<T extends VarGroup<TTokens>> = T['$tokens'];
173
+ export type TokensFromVarGroup<T extends VarGroup<unknown, unknown>> =
174
+ T['$tokens'];
168
175
 
169
- export type IDFromVarGroup<T extends VarGroup<TTokens>> = T['$opaqueId'];
176
+ export type IDFromVarGroup<T extends VarGroup<unknown, unknown>> =
177
+ T['$opaqueId'];
170
178
 
171
- type TTokens = {
172
- [key: string]: string | { default: string; [key: AtRuleStr]: string };
173
- };
179
+ type TTokens = Readonly<{
180
+ [key: string]: string | { [key: string]: string };
181
+ }>;
174
182
 
175
183
  export type FlattenTokens<T extends TTokens> = Readonly<{
176
- [Key in keyof T]: T[Key] extends { [key: string]: infer X }
177
- ? StyleXVar<X>
178
- : StyleXVar<T[Key]>;
184
+ [Key in keyof T]: T[Key] extends { [key: string]: infer X } ? X : T[Key];
179
185
  }>;
180
186
 
181
187
  export type StyleX$DefineVars = <
@@ -186,24 +192,23 @@ export type StyleX$DefineVars = <
186
192
  ) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
187
193
 
188
194
  export type Theme<
189
- T extends VarGroup<TTokens, symbol>,
190
- // eslint-disable-next-line no-unused-vars
195
+ T extends VarGroup<unknown, symbol>,
191
196
  Tag extends symbol = symbol,
192
197
  > = Tag &
193
198
  Readonly<{
194
199
  theme: StyleXClassNameFor<string, IDFromVarGroup<T>>;
195
200
  }>;
196
201
 
197
- type OverridesForTokenType<Config extends { [key: string]: any }> = {
202
+ type OverridesForTokenType<Config extends { [key: string]: unknown }> = {
198
203
  [Key in keyof Config]:
199
204
  | Config[Key]
200
205
  | { default: Config[Key]; [atRule: AtRuleStr]: Config[Key] };
201
206
  };
202
207
 
203
208
  export type StyleX$CreateTheme = <
204
- BaseTokens extends VarGroup<any>,
205
- ID extends symbol = symbol,
209
+ TVars extends VarGroup<unknown, unknown>,
210
+ ThemeID extends symbol = symbol,
206
211
  >(
207
- baseTokens: BaseTokens,
208
- overrides: OverridesForTokenType<TokensFromVarGroup<BaseTokens>>,
209
- ) => Theme<BaseTokens, ID>;
212
+ baseTokens: TVars,
213
+ overrides: OverridesForTokenType<TokensFromVarGroup<TVars>>,
214
+ ) => Theme<TVars, ThemeID>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/stylex",
3
- "version": "0.2.0-beta.26",
3
+ "version": "0.2.0-beta.27",
4
4
  "description": "A library for defining styles for optimized user interfaces.",
5
5
  "main": "lib/stylex.js",
6
6
  "types": "lib/stylex.d.ts",
@@ -19,7 +19,7 @@
19
19
  "utility-types": "^3.10.0"
20
20
  },
21
21
  "devDependencies": {
22
- "@stylexjs/scripts": "0.2.0-beta.26"
22
+ "@stylexjs/scripts": "0.2.0-beta.27"
23
23
  },
24
24
  "jest": {},
25
25
  "files": [