@stylexjs/stylex 0.2.0-beta.13 → 0.2.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/StyleXTypes.d.ts +28 -0
- package/lib/StyleXTypes.js.flow +14 -0
- package/lib/stylex.d.ts +21 -6
- package/lib/stylex.js +13 -1
- package/lib/stylex.js.flow +27 -7
- package/package.json +2 -2
package/lib/StyleXTypes.d.ts
CHANGED
|
@@ -172,3 +172,31 @@ export type Stylex$Create = <S extends {}>(
|
|
|
172
172
|
* | ^^^^^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "$ObjMap" is currently not supported.
|
|
173
173
|
**/
|
|
174
174
|
any>;
|
|
175
|
+
export declare type StyleXVarsTheme<
|
|
176
|
+
Vars extends { readonly [$$Key$$: string]: string }
|
|
177
|
+
> = Vars;
|
|
178
|
+
export type Stylex$CreateVars = <
|
|
179
|
+
Vars extends { readonly [$$Key$$: string]: string }
|
|
180
|
+
>(
|
|
181
|
+
styles: Vars,
|
|
182
|
+
config?: { themeName: string }
|
|
183
|
+
) => StyleXVarsTheme<
|
|
184
|
+
Readonly</**
|
|
185
|
+
* > 129 | ) => StyleXVarsTheme<$ReadOnly<$ObjMapConst<Vars, string>>>;
|
|
186
|
+
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "$ObjMapConst" is currently not supported.
|
|
187
|
+
**/
|
|
188
|
+
any>
|
|
189
|
+
>;
|
|
190
|
+
export type Stylex$OverrideVars = <
|
|
191
|
+
Vars extends { readonly [$$Key$$: string]: string }
|
|
192
|
+
>(
|
|
193
|
+
styles: Vars & { __themeName__: string },
|
|
194
|
+
stylesOverride: Vars,
|
|
195
|
+
config?: { themeName: string }
|
|
196
|
+
) => StyleXVarsTheme<
|
|
197
|
+
Readonly</**
|
|
198
|
+
* > 135 | ) => StyleXVarsTheme<$ReadOnly<$ObjMapConst<Vars, string>>>;
|
|
199
|
+
* | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "$ObjMapConst" is currently not supported.
|
|
200
|
+
**/
|
|
201
|
+
any>
|
|
202
|
+
>;
|
package/lib/StyleXTypes.js.flow
CHANGED
|
@@ -119,3 +119,17 @@ export type MapNamespaces = <CSS: { ... }>(CSS) => MapNamespace<CSS>;
|
|
|
119
119
|
export type Stylex$Create = <S: { ... }>(
|
|
120
120
|
styles: S
|
|
121
121
|
) => $ReadOnly<$ObjMap<S, MapNamespaces>>;
|
|
122
|
+
|
|
123
|
+
// This is the type for the variables object
|
|
124
|
+
declare export opaque type StyleXVarsTheme<+Vars: { +[string]: string }>: Vars;
|
|
125
|
+
|
|
126
|
+
export type Stylex$CreateVars = <+Vars: { +[string]: string }>(
|
|
127
|
+
styles: Vars,
|
|
128
|
+
config?: { themeName: string }
|
|
129
|
+
) => StyleXVarsTheme<$ReadOnly<$ObjMapConst<Vars, string>>>;
|
|
130
|
+
|
|
131
|
+
export type Stylex$OverrideVars = <+Vars: { +[string]: string }>(
|
|
132
|
+
styles: Vars & { __themeName__: string },
|
|
133
|
+
stylesOverride: Vars,
|
|
134
|
+
config?: { themeName: string }
|
|
135
|
+
) => StyleXVarsTheme<$ReadOnly<$ObjMapConst<Vars, string>>>;
|
package/lib/stylex.d.ts
CHANGED
|
@@ -10,27 +10,35 @@
|
|
|
10
10
|
import type {
|
|
11
11
|
Keyframes,
|
|
12
12
|
Stylex$Create,
|
|
13
|
+
Stylex$CreateVars,
|
|
14
|
+
Stylex$OverrideVars,
|
|
13
15
|
StyleXArray,
|
|
14
16
|
MapNamespace,
|
|
15
17
|
} from './StyleXTypes';
|
|
16
18
|
import injectStyle from './stylex-inject';
|
|
17
19
|
type DedupeStyles = Readonly<{
|
|
20
|
+
$$css: true;
|
|
18
21
|
[key: string]: string | Readonly<{ [key: string]: string }>;
|
|
19
22
|
}>;
|
|
20
23
|
export declare function spread(
|
|
21
24
|
styles: StyleXArray<
|
|
22
25
|
| (null | undefined | DedupeStyles)
|
|
23
26
|
| boolean
|
|
24
|
-
| { [$$Key$$: string]: string | number }
|
|
27
|
+
| Readonly<{ $$css?: void; [$$Key$$: string]: string | number }>
|
|
25
28
|
>,
|
|
26
29
|
_options?: {}
|
|
27
|
-
): {
|
|
30
|
+
): Readonly<{
|
|
31
|
+
className: string;
|
|
32
|
+
style: Readonly<{ $$css?: void; [$$Key$$: string]: string | number }>;
|
|
33
|
+
}>;
|
|
28
34
|
type Stylex$Include = <
|
|
29
35
|
TStyles extends { readonly [$$Key$$: string]: string | number }
|
|
30
36
|
>(
|
|
31
37
|
_styles: MapNamespace<TStyles>
|
|
32
38
|
) => TStyles;
|
|
33
39
|
export declare var create: Stylex$Create;
|
|
40
|
+
export declare var unstable_createVars: Stylex$CreateVars;
|
|
41
|
+
export declare var unstable_overrideVars: Stylex$OverrideVars;
|
|
34
42
|
export declare var include: Stylex$Include;
|
|
35
43
|
export declare var keyframes: (_keyframes: Keyframes) => string;
|
|
36
44
|
export declare var firstThatWorks: <T extends string | number>(
|
|
@@ -45,12 +53,19 @@ type IStyleX = {
|
|
|
45
53
|
>
|
|
46
54
|
): string;
|
|
47
55
|
spread: (
|
|
48
|
-
styles:
|
|
49
|
-
|
|
56
|
+
styles: StyleXArray<
|
|
57
|
+
| (null | undefined | DedupeStyles)
|
|
58
|
+
| boolean
|
|
59
|
+
| Readonly<{ $$css?: void; [$$Key$$: string]: string | number }>
|
|
50
60
|
>,
|
|
51
|
-
|
|
52
|
-
) => {
|
|
61
|
+
_options?: {}
|
|
62
|
+
) => Readonly<{
|
|
63
|
+
className: string;
|
|
64
|
+
style: Readonly<{ $$css?: void; [$$Key$$: string]: string | number }>;
|
|
65
|
+
}>;
|
|
53
66
|
create: Stylex$Create;
|
|
67
|
+
unstable_createVars: Stylex$CreateVars;
|
|
68
|
+
unstable_overrideVars: Stylex$OverrideVars;
|
|
54
69
|
include: Stylex$Include;
|
|
55
70
|
firstThatWorks: <T extends string | number>(
|
|
56
71
|
...v: ReadonlyArray<T>
|
package/lib/stylex.js
CHANGED
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
14
14
|
});
|
|
15
15
|
exports.keyframes = exports.inject = exports.include = exports.firstThatWorks = exports.default = exports.create = exports.UNSUPPORTED_PROPERTY = void 0;
|
|
16
16
|
exports.spread = spread;
|
|
17
|
-
exports.stylex = void 0;
|
|
17
|
+
exports.unstable_overrideVars = exports.unstable_createVars = exports.stylex = void 0;
|
|
18
18
|
var _stylexInject = _interopRequireDefault(require("./stylex-inject"));
|
|
19
19
|
var _styleq = require("styleq");
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -28,11 +28,21 @@ function spread(styles, _options) {
|
|
|
28
28
|
function stylexCreate(_styles) {
|
|
29
29
|
throw new Error('stylex.create should never be called. It should be compiled away.');
|
|
30
30
|
}
|
|
31
|
+
function stylexCreateVars(_styles) {
|
|
32
|
+
throw new Error('stylex.createVars should never be called. It should be compiled away.');
|
|
33
|
+
}
|
|
34
|
+
function stylexOverrideVars(_styles) {
|
|
35
|
+
throw new Error('stylex.overrideVars should never be called. It should be compiled away.');
|
|
36
|
+
}
|
|
31
37
|
function stylexIncludes(_styles) {
|
|
32
38
|
throw new Error('stylex.extends should never be called. It should be compiled away.');
|
|
33
39
|
}
|
|
34
40
|
const create = stylexCreate;
|
|
35
41
|
exports.create = create;
|
|
42
|
+
const unstable_createVars = stylexCreateVars;
|
|
43
|
+
exports.unstable_createVars = unstable_createVars;
|
|
44
|
+
const unstable_overrideVars = stylexOverrideVars;
|
|
45
|
+
exports.unstable_overrideVars = unstable_overrideVars;
|
|
36
46
|
const include = stylexIncludes;
|
|
37
47
|
exports.include = include;
|
|
38
48
|
const keyframes = _keyframes => {
|
|
@@ -58,6 +68,8 @@ function _stylex() {
|
|
|
58
68
|
}
|
|
59
69
|
_stylex.spread = spread;
|
|
60
70
|
_stylex.create = create;
|
|
71
|
+
_stylex.unstable_createVars = unstable_createVars;
|
|
72
|
+
_stylex.unstable_overrideVars = unstable_overrideVars;
|
|
61
73
|
_stylex.include = include;
|
|
62
74
|
_stylex.keyframes = keyframes;
|
|
63
75
|
_stylex.firstThatWorks = firstThatWorks;
|
package/lib/stylex.js.flow
CHANGED
|
@@ -10,20 +10,30 @@
|
|
|
10
10
|
import type {
|
|
11
11
|
Keyframes,
|
|
12
12
|
Stylex$Create,
|
|
13
|
+
Stylex$CreateVars,
|
|
14
|
+
Stylex$OverrideVars,
|
|
13
15
|
StyleXArray,
|
|
14
16
|
MapNamespace,
|
|
15
17
|
} from './StyleXTypes';
|
|
16
18
|
|
|
17
19
|
import injectStyle from './stylex-inject';
|
|
18
20
|
type DedupeStyles = $ReadOnly<{
|
|
21
|
+
$$css: true,
|
|
19
22
|
[key: string]: string | $ReadOnly<{ [key: string]: string, ... }>,
|
|
20
23
|
...
|
|
21
24
|
}>;
|
|
22
25
|
|
|
23
26
|
declare export function spread(
|
|
24
|
-
styles: StyleXArray
|
|
27
|
+
styles: StyleXArray<
|
|
28
|
+
| ?DedupeStyles
|
|
29
|
+
| boolean
|
|
30
|
+
| $ReadOnly<{ $$css?: void, [string]: string | number }>
|
|
31
|
+
>,
|
|
25
32
|
_options?: { ... }
|
|
26
|
-
): {
|
|
33
|
+
): $ReadOnly<{
|
|
34
|
+
className: string,
|
|
35
|
+
style: $ReadOnly<{ $$css?: void, [string]: string | number }>,
|
|
36
|
+
}>;
|
|
27
37
|
|
|
28
38
|
type Stylex$Include = <TStyles: { +[string]: string | number }>(
|
|
29
39
|
_styles: MapNamespace<TStyles>
|
|
@@ -31,6 +41,10 @@ type Stylex$Include = <TStyles: { +[string]: string | number }>(
|
|
|
31
41
|
|
|
32
42
|
declare export var create: Stylex$Create;
|
|
33
43
|
|
|
44
|
+
declare export var unstable_createVars: Stylex$CreateVars;
|
|
45
|
+
|
|
46
|
+
declare export var unstable_overrideVars: Stylex$OverrideVars;
|
|
47
|
+
|
|
34
48
|
declare export var include: Stylex$Include;
|
|
35
49
|
|
|
36
50
|
declare export var keyframes: (_keyframes: Keyframes) => string;
|
|
@@ -46,13 +60,19 @@ declare export var UNSUPPORTED_PROPERTY: <T>(_props: T) => T;
|
|
|
46
60
|
type IStyleX = {
|
|
47
61
|
(...styles: $ReadOnlyArray<StyleXArray<?DedupeStyles | boolean>>): string,
|
|
48
62
|
spread: (
|
|
49
|
-
styles:
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
styles: StyleXArray<
|
|
64
|
+
| ?DedupeStyles
|
|
65
|
+
| boolean
|
|
66
|
+
| $ReadOnly<{ $$css?: void, [string]: string | number }>
|
|
67
|
+
>,
|
|
68
|
+
_options?: { ... }
|
|
69
|
+
) => $ReadOnly<{
|
|
52
70
|
className: string,
|
|
53
|
-
style: { [string]: string | number }
|
|
54
|
-
}
|
|
71
|
+
style: $ReadOnly<{ $$css?: void, [string]: string | number }>,
|
|
72
|
+
}>,
|
|
55
73
|
create: Stylex$Create,
|
|
74
|
+
unstable_createVars: Stylex$CreateVars,
|
|
75
|
+
unstable_overrideVars: Stylex$OverrideVars,
|
|
56
76
|
include: Stylex$Include,
|
|
57
77
|
firstThatWorks: <T: string | number>(
|
|
58
78
|
...v: $ReadOnlyArray<T>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/stylex",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.15",
|
|
4
4
|
"description": "A library for defining styles for optimized user interfaces.",
|
|
5
5
|
"main": "lib/stylex.js",
|
|
6
6
|
"react-native": "lib/native/stylex.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"utility-types": "^3.10.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@stylexjs/scripts": "0.2.0-beta.
|
|
23
|
+
"@stylexjs/scripts": "0.2.0-beta.15"
|
|
24
24
|
},
|
|
25
25
|
"jest": {},
|
|
26
26
|
"files": [
|