@stylexjs/stylex 0.5.0-alpha.1 → 0.5.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/lib/es/StyleXTypes.d.ts +0 -218
- /package/lib/es/{StyleXCSSTypes.js → StyleXCSSTypes.mjs} +0 -0
- /package/lib/es/{StyleXSheet.js → StyleXSheet.mjs} +0 -0
- /package/lib/es/{StyleXTypes.js → StyleXTypes.mjs} +0 -0
- /package/lib/es/{stylex-inject.js → stylex-inject.mjs} +0 -0
- /package/lib/es/{stylex.js → stylex.mjs} +0 -0
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/stylex",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.2",
|
|
4
4
|
"description": "A library for defining styles for optimized user interfaces.",
|
|
5
5
|
"main": "./lib/stylex.js",
|
|
6
|
-
"module": "./lib/es/stylex.
|
|
6
|
+
"module": "./lib/es/stylex.mjs",
|
|
7
7
|
"types": "./lib/stylex.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"import": "./lib/es/stylex.
|
|
10
|
+
"import": "./lib/es/stylex.mjs",
|
|
11
11
|
"require": "./lib/stylex.js",
|
|
12
12
|
"types": "./lib/stylex.d.ts"
|
|
13
13
|
},
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"types": "./lib/StyleXTypes.d.ts"
|
|
18
18
|
},
|
|
19
19
|
"./lib/StyleXSheet": {
|
|
20
|
-
"import": "./lib/es/StyleXSheet.
|
|
20
|
+
"import": "./lib/es/StyleXSheet.mjs",
|
|
21
21
|
"require": "./lib/StyleXSheet.js",
|
|
22
22
|
"types": "./lib/StyleXSheet.d.ts"
|
|
23
23
|
},
|
|
24
24
|
"./lib/stylex-inject": {
|
|
25
|
-
"import": "./lib/es/stylex-inject.
|
|
25
|
+
"import": "./lib/es/stylex-inject.mjs",
|
|
26
26
|
"require": "./lib/stylex-inject.js",
|
|
27
27
|
"types": "./lib/stylex-inject.d.ts"
|
|
28
28
|
},
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"scripts": {
|
|
34
34
|
"prebuild": "gen-types -i src/ -o lib/",
|
|
35
35
|
"build:cjs": "BABEL_ENV=cjs babel src/ --out-dir lib/ --copy-files",
|
|
36
|
-
"build:esm": "BABEL_ENV=esm babel src/ --out-dir lib/es --
|
|
36
|
+
"build:esm": "BABEL_ENV=esm babel src/ --out-dir lib/es --out-file-extension .mjs",
|
|
37
37
|
"postbuild:esm": "rollup -c ./rollup.config.mjs",
|
|
38
38
|
"build": "npm run build:cjs && npm run build:esm",
|
|
39
39
|
"build-haste": "rewrite-imports -i src/ -o lib/",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"utility-types": "^3.10.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@stylexjs/scripts": "0.5.0-alpha.
|
|
49
|
+
"@stylexjs/scripts": "0.5.0-alpha.2"
|
|
50
50
|
},
|
|
51
51
|
"jest": {},
|
|
52
52
|
"files": [
|
package/lib/es/StyleXTypes.d.ts
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { CSSProperties } from './StyleXCSSTypes';
|
|
9
|
-
|
|
10
|
-
// Using an opaque type to declare ClassNames generated by stylex.
|
|
11
|
-
declare const StyleXClassNameTag: unique symbol;
|
|
12
|
-
export type StyleXClassNameFor<K, V> = string & {
|
|
13
|
-
_opaque: typeof StyleXClassNameTag;
|
|
14
|
-
_key: K;
|
|
15
|
-
_value: V;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type StyleXClassNameForValue<V> = StyleXClassNameFor<any, V>;
|
|
19
|
-
export type StyleXClassNameForKey<K> = StyleXClassNameFor<K, any>;
|
|
20
|
-
export type StyleXClassName = StyleXClassNameFor<any, any>;
|
|
21
|
-
// Type for arbitrarily nested Array.
|
|
22
|
-
export type StyleXArray<T> = T | ReadonlyArray<StyleXArray<T>>;
|
|
23
|
-
|
|
24
|
-
declare const StyleXVarTag: unique symbol;
|
|
25
|
-
declare class _StyleXVar<out Val> {
|
|
26
|
-
private _opaque: typeof StyleXVarTag;
|
|
27
|
-
private _value: Val;
|
|
28
|
-
}
|
|
29
|
-
export type StyleXVar<Val> = _StyleXVar<Val> & string;
|
|
30
|
-
|
|
31
|
-
type PseudoClassStr = `:${string}`;
|
|
32
|
-
type AtRuleStr = `@${string}`;
|
|
33
|
-
|
|
34
|
-
type CondStr = PseudoClassStr | AtRuleStr;
|
|
35
|
-
|
|
36
|
-
type CSSPropertiesWithExtras = Partial<
|
|
37
|
-
Readonly<
|
|
38
|
-
CSSProperties & {
|
|
39
|
-
'::after': CSSProperties;
|
|
40
|
-
'::backdrop': CSSProperties;
|
|
41
|
-
'::before': CSSProperties;
|
|
42
|
-
'::cue': CSSProperties;
|
|
43
|
-
'::cue-region': CSSProperties;
|
|
44
|
-
'::first-letter': CSSProperties;
|
|
45
|
-
'::first-line': CSSProperties;
|
|
46
|
-
'::file-selector-button': CSSProperties;
|
|
47
|
-
'::grammar-error': CSSProperties;
|
|
48
|
-
'::marker': CSSProperties;
|
|
49
|
-
// This is a pattern and not a static key so it cannot be typed correctly.
|
|
50
|
-
// [key: `::part(${string})` | `::slotted(${string})`]: CSSProperties;
|
|
51
|
-
'::placeholder': CSSProperties;
|
|
52
|
-
'::selection': CSSProperties;
|
|
53
|
-
// This is a pattern and not a static key so it cannot be typed correctly.
|
|
54
|
-
// '::slotted()': CSSProperties;
|
|
55
|
-
'::spelling-error': CSSProperties;
|
|
56
|
-
'::target-text': CSSProperties;
|
|
57
|
-
'::-webkit-scrollbar'?: CSSProperties;
|
|
58
|
-
// webkit styles used for Search in Safari
|
|
59
|
-
'::-webkit-search-decoration'?: CSSProperties;
|
|
60
|
-
'::-webkit-search-cancel-button'?: CSSProperties;
|
|
61
|
-
'::-webkit-search-results-button'?: CSSProperties;
|
|
62
|
-
'::-webkit-search-results-decoration'?: CSSProperties;
|
|
63
|
-
}
|
|
64
|
-
>
|
|
65
|
-
>;
|
|
66
|
-
|
|
67
|
-
export type NestedCSSPropTypes = Partial<
|
|
68
|
-
Readonly<{
|
|
69
|
-
[Key in keyof CSSPropertiesWithExtras]: StyleXClassNameFor<
|
|
70
|
-
Key,
|
|
71
|
-
CSSPropertiesWithExtras[Key]
|
|
72
|
-
>;
|
|
73
|
-
}>
|
|
74
|
-
>;
|
|
75
|
-
|
|
76
|
-
type UserAuthoredStyles = CSSPropertiesWithExtras | { [key: string]: unknown };
|
|
77
|
-
export type StyleXSingleStyle = false | (null | undefined | NestedCSSPropTypes);
|
|
78
|
-
// NOTE: `XStyle` has been deprecated in favor of `StaticStyles` and `StyleXStyles`.
|
|
79
|
-
|
|
80
|
-
export type Keyframes = Readonly<{ [name: string]: CSSProperties }>;
|
|
81
|
-
export type LegacyThemeStyles = Readonly<{ [constantName: string]: string }>;
|
|
82
|
-
|
|
83
|
-
type ComplexStyleValueType<T> = T extends StyleXVar<infer U>
|
|
84
|
-
? U
|
|
85
|
-
: T extends string | number | null
|
|
86
|
-
? T
|
|
87
|
-
: T extends ReadonlyArray<infer U>
|
|
88
|
-
? U
|
|
89
|
-
: T extends Readonly<{ default: infer A; [cond: CondStr]: infer B }>
|
|
90
|
-
? ComplexStyleValueType<A> | ComplexStyleValueType<B>
|
|
91
|
-
: T;
|
|
92
|
-
|
|
93
|
-
export type MapNamespace<CSS> = Readonly<{
|
|
94
|
-
[Key in keyof CSS]: StyleXClassNameFor<Key, ComplexStyleValueType<CSS[Key]>>;
|
|
95
|
-
}>;
|
|
96
|
-
|
|
97
|
-
export type MapNamespaces<
|
|
98
|
-
S extends {
|
|
99
|
-
[key: string]: UserAuthoredStyles | ((...args: any) => UserAuthoredStyles);
|
|
100
|
-
},
|
|
101
|
-
> = Readonly<{
|
|
102
|
-
[Key in keyof S]: S[Key] extends (...args: infer Args) => infer Obj
|
|
103
|
-
? (...args: Args) => Readonly<[MapNamespace<Obj>, InlineStyles]>
|
|
104
|
-
: MapNamespace<S[Key]>;
|
|
105
|
-
}>;
|
|
106
|
-
|
|
107
|
-
export type Stylex$Create = <
|
|
108
|
-
const S extends {
|
|
109
|
-
[key: string]: UserAuthoredStyles | ((...args: any) => UserAuthoredStyles);
|
|
110
|
-
},
|
|
111
|
-
>(
|
|
112
|
-
styles: S,
|
|
113
|
-
) => MapNamespaces<S>;
|
|
114
|
-
|
|
115
|
-
export type CompiledStyles =
|
|
116
|
-
| Readonly<{
|
|
117
|
-
[key: string]: StyleXClassName | null | void | never;
|
|
118
|
-
}>
|
|
119
|
-
| Readonly<{
|
|
120
|
-
theme: StyleXClassName;
|
|
121
|
-
}>;
|
|
122
|
-
|
|
123
|
-
declare const StyleXInlineStylesTag: unique symbol;
|
|
124
|
-
|
|
125
|
-
export type InlineStyles = typeof StyleXInlineStylesTag;
|
|
126
|
-
|
|
127
|
-
type _GenStylePropType<CSS extends UserAuthoredStyles> = Readonly<{
|
|
128
|
-
[Key in keyof CSS]: StyleXClassNameFor<Key, Readonly<CSS[Key]>>;
|
|
129
|
-
}>;
|
|
130
|
-
type GenStylePropType<CSS extends UserAuthoredStyles> = Readonly<
|
|
131
|
-
_GenStylePropType<CSS> &
|
|
132
|
-
Partial<{
|
|
133
|
-
[Key in Exclude<keyof CSSPropertiesWithExtras, keyof CSS>]: never;
|
|
134
|
-
}>
|
|
135
|
-
>;
|
|
136
|
-
|
|
137
|
-
// Replace `XStyle` with this.
|
|
138
|
-
export type StaticStyles<
|
|
139
|
-
CSS extends UserAuthoredStyles = CSSPropertiesWithExtras,
|
|
140
|
-
> = StyleXArray<false | null | GenStylePropType<CSS>>;
|
|
141
|
-
|
|
142
|
-
export type StaticStylesWithout<CSS extends UserAuthoredStyles> = StaticStyles<
|
|
143
|
-
Omit<CSSPropertiesWithExtras, keyof CSS>
|
|
144
|
-
>;
|
|
145
|
-
|
|
146
|
-
export type StyleXStyles<
|
|
147
|
-
CSS extends UserAuthoredStyles = CSSPropertiesWithExtras,
|
|
148
|
-
> = StyleXArray<
|
|
149
|
-
| null
|
|
150
|
-
| false
|
|
151
|
-
| GenStylePropType<CSS>
|
|
152
|
-
| Readonly<[GenStylePropType<CSS>, InlineStyles]>
|
|
153
|
-
>;
|
|
154
|
-
export type StyleXStylesWithout<CSS extends UserAuthoredStyles> = StyleXStyles<
|
|
155
|
-
Omit<CSSPropertiesWithExtras, keyof CSS>
|
|
156
|
-
>;
|
|
157
|
-
|
|
158
|
-
declare const StyleXVarGroupTag: unique symbol;
|
|
159
|
-
export type VarGroup<
|
|
160
|
-
Tokens extends { [key: string]: any },
|
|
161
|
-
ID extends symbol = symbol,
|
|
162
|
-
> = Readonly<{
|
|
163
|
-
[Key in keyof Tokens]: StyleXVar<Tokens[Key]>;
|
|
164
|
-
}> &
|
|
165
|
-
Readonly<{
|
|
166
|
-
__opaqueId: ID;
|
|
167
|
-
__tokens: Tokens;
|
|
168
|
-
}> &
|
|
169
|
-
typeof StyleXVarGroupTag;
|
|
170
|
-
|
|
171
|
-
export type TokensFromVarGroup<T extends VarGroup<unknown, unknown>> =
|
|
172
|
-
T['__tokens'];
|
|
173
|
-
|
|
174
|
-
export type IDFromVarGroup<T extends VarGroup<unknown, unknown>> =
|
|
175
|
-
T['__opaqueId'];
|
|
176
|
-
|
|
177
|
-
type TTokens = Readonly<{
|
|
178
|
-
[key: string]: string | { [key: string]: string };
|
|
179
|
-
}>;
|
|
180
|
-
|
|
181
|
-
type UnwrapVars<T> = T extends StyleXVar<infer U> ? U : T;
|
|
182
|
-
export type FlattenTokens<T extends TTokens> = Readonly<{
|
|
183
|
-
[Key in keyof T]: T[Key] extends { [key: string]: infer X }
|
|
184
|
-
? UnwrapVars<X>
|
|
185
|
-
: UnwrapVars<T[Key]>;
|
|
186
|
-
}>;
|
|
187
|
-
|
|
188
|
-
export type StyleX$DefineVars = <
|
|
189
|
-
DefaultTokens extends TTokens,
|
|
190
|
-
ID extends symbol = symbol,
|
|
191
|
-
>(
|
|
192
|
-
tokens: DefaultTokens,
|
|
193
|
-
) => VarGroup<FlattenTokens<DefaultTokens>, ID>;
|
|
194
|
-
|
|
195
|
-
declare class ThemeKey<out VG extends VarGroup> extends String {
|
|
196
|
-
private varGroup: VG;
|
|
197
|
-
}
|
|
198
|
-
export type Theme<
|
|
199
|
-
T extends VarGroup<unknown, symbol>,
|
|
200
|
-
Tag extends symbol = symbol,
|
|
201
|
-
> = Tag &
|
|
202
|
-
Readonly<{
|
|
203
|
-
theme: StyleXClassNameFor<ThemeKey<T>, IDFromVarGroup<T>>;
|
|
204
|
-
}>;
|
|
205
|
-
|
|
206
|
-
type OverridesForTokenType<Config extends { [key: string]: unknown }> = {
|
|
207
|
-
[Key in keyof Config]?:
|
|
208
|
-
| Config[Key]
|
|
209
|
-
| { default: Config[Key]; [atRule: AtRuleStr]: Config[Key] };
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
export type StyleX$CreateTheme = <
|
|
213
|
-
TVars extends VarGroup<unknown, unknown>,
|
|
214
|
-
ThemeID extends symbol = symbol,
|
|
215
|
-
>(
|
|
216
|
-
baseTokens: TVars,
|
|
217
|
-
overrides: OverridesForTokenType<TokensFromVarGroup<TVars>>,
|
|
218
|
-
) => Theme<TVars, ThemeID>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|