@stylexjs/stylex 0.2.0-beta.16 → 0.2.0-beta.18
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/StyleXCSSTypes.js +1 -10
- package/lib/StyleXSheet.d.ts +3 -3
- package/lib/StyleXSheet.js +19 -132
- package/lib/StyleXSheet.js.flow +2 -2
- package/lib/StyleXTypes.d.ts +143 -180
- package/lib/StyleXTypes.js +1 -10
- package/lib/StyleXTypes.js.flow +72 -23
- package/lib/native/CSSCustomPropertyValue.js +2 -11
- package/lib/native/CSSLengthUnitValue.d.ts +1 -1
- package/lib/native/CSSLengthUnitValue.js +7 -18
- package/lib/native/CSSLengthUnitValue.js.flow +1 -1
- package/lib/native/CSSMediaQuery.d.ts +1 -1
- package/lib/native/CSSMediaQuery.js +4 -18
- package/lib/native/CSSMediaQuery.js.flow +1 -1
- package/lib/native/__tests__/__snapshots__/stylex-test.js.snap +81 -0
- package/lib/native/__tests__/parseTimeValue-test.js +11 -0
- package/lib/native/__tests__/stylex-test.js +186 -128
- package/lib/native/errorMsg.js +0 -9
- package/lib/native/flattenStyle.js +1 -11
- package/lib/native/parseShadow.js +4 -13
- package/lib/native/parseTimeValue.d.ts +11 -0
- package/lib/native/parseTimeValue.js +18 -0
- package/lib/native/parseTimeValue.js.flow +12 -0
- package/lib/native/stylex.d.ts +6 -5
- package/lib/native/stylex.js +60 -106
- package/lib/native/stylex.js.flow +4 -4
- package/lib/stylex-inject.d.ts +1 -1
- package/lib/stylex-inject.js +0 -9
- package/lib/stylex-inject.js.flow +1 -1
- package/lib/stylex.d.ts +23 -25
- package/lib/stylex.js +8 -17
- package/lib/stylex.js.flow +24 -27
- package/package.json +2 -2
package/lib/stylex.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
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
|
-
*/
|
|
9
|
-
|
|
10
|
-
'use strict';
|
|
1
|
+
"use strict";
|
|
11
2
|
|
|
12
3
|
Object.defineProperty(exports, "__esModule", {
|
|
13
4
|
value: true
|
|
@@ -26,16 +17,16 @@ function spread(styles, _options) {
|
|
|
26
17
|
};
|
|
27
18
|
}
|
|
28
19
|
function stylexCreate(_styles) {
|
|
29
|
-
throw new Error(
|
|
20
|
+
throw new Error("stylex.create should never be called. It should be compiled away.");
|
|
30
21
|
}
|
|
31
22
|
function stylexCreateVars(_styles) {
|
|
32
|
-
throw new Error(
|
|
23
|
+
throw new Error("stylex.createVars should never be called. It should be compiled away.");
|
|
33
24
|
}
|
|
34
25
|
function stylexOverrideVars(_styles) {
|
|
35
|
-
throw new Error(
|
|
26
|
+
throw new Error("stylex.overrideVars should never be called. It should be compiled away.");
|
|
36
27
|
}
|
|
37
28
|
function stylexIncludes(_styles) {
|
|
38
|
-
throw new Error(
|
|
29
|
+
throw new Error("stylex.extends should never be called. It should be compiled away.");
|
|
39
30
|
}
|
|
40
31
|
const create = stylexCreate;
|
|
41
32
|
exports.create = create;
|
|
@@ -46,17 +37,17 @@ exports.unstable_overrideVars = unstable_overrideVars;
|
|
|
46
37
|
const include = stylexIncludes;
|
|
47
38
|
exports.include = include;
|
|
48
39
|
const keyframes = _keyframes => {
|
|
49
|
-
throw new Error(
|
|
40
|
+
throw new Error("stylex.keyframes should never be called");
|
|
50
41
|
};
|
|
51
42
|
exports.keyframes = keyframes;
|
|
52
43
|
const firstThatWorks = function () {
|
|
53
|
-
throw new Error(
|
|
44
|
+
throw new Error("stylex.firstThatWorks should never be called.");
|
|
54
45
|
};
|
|
55
46
|
exports.firstThatWorks = firstThatWorks;
|
|
56
47
|
const inject = _stylexInject.default;
|
|
57
48
|
exports.inject = inject;
|
|
58
49
|
const UNSUPPORTED_PROPERTY = _props => {
|
|
59
|
-
throw new Error(
|
|
50
|
+
throw new Error("stylex.UNSUPPORTED_PROPERTY should never be called. It should be compiled away.");
|
|
60
51
|
};
|
|
61
52
|
exports.UNSUPPORTED_PROPERTY = UNSUPPORTED_PROPERTY;
|
|
62
53
|
function _stylex() {
|
package/lib/stylex.js.flow
CHANGED
|
@@ -10,69 +10,66 @@
|
|
|
10
10
|
import type {
|
|
11
11
|
Keyframes,
|
|
12
12
|
Stylex$Create,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
StyleX$CreateVars,
|
|
14
|
+
StyleX$OverrideVars,
|
|
15
15
|
StyleXArray,
|
|
16
16
|
MapNamespace,
|
|
17
|
+
CompiledStyles,
|
|
17
18
|
} from './StyleXTypes';
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
type DedupeStyles = $ReadOnly<{
|
|
21
|
-
$$css: true,
|
|
22
|
-
[key: string]: string | $ReadOnly<{ [key: string]: string, ... }>,
|
|
23
|
-
...
|
|
24
|
-
}>;
|
|
20
|
+
export type { Theme, Variant } from './StyleXTypes';
|
|
25
21
|
|
|
22
|
+
import injectStyle from './stylex-inject';
|
|
26
23
|
declare export function spread(
|
|
27
24
|
styles: StyleXArray<
|
|
28
|
-
| ?
|
|
25
|
+
| ?CompiledStyles
|
|
29
26
|
| boolean
|
|
30
|
-
| $ReadOnly<{ $$css?: void, [string]: string | number }
|
|
27
|
+
| $ReadOnly<{ $$css?: void, [string]: string | number }>,
|
|
31
28
|
>,
|
|
32
|
-
_options?: { ... }
|
|
29
|
+
_options?: { ... },
|
|
33
30
|
): $ReadOnly<{
|
|
34
31
|
className: string,
|
|
35
32
|
style: $ReadOnly<{ $$css?: void, [string]: string | number }>,
|
|
36
33
|
}>;
|
|
37
34
|
|
|
38
35
|
type Stylex$Include = <TStyles: { +[string]: string | number }>(
|
|
39
|
-
_styles: MapNamespace<TStyles
|
|
36
|
+
_styles: MapNamespace<TStyles>,
|
|
40
37
|
) => TStyles;
|
|
41
38
|
|
|
42
|
-
declare export
|
|
39
|
+
declare export const create: Stylex$Create;
|
|
43
40
|
|
|
44
|
-
declare export
|
|
41
|
+
declare export const unstable_createVars: StyleX$CreateVars;
|
|
45
42
|
|
|
46
|
-
declare export
|
|
43
|
+
declare export const unstable_overrideVars: StyleX$OverrideVars;
|
|
47
44
|
|
|
48
|
-
declare export
|
|
45
|
+
declare export const include: Stylex$Include;
|
|
49
46
|
|
|
50
|
-
declare export
|
|
47
|
+
declare export const keyframes: (_keyframes: Keyframes) => string;
|
|
51
48
|
|
|
52
|
-
declare export
|
|
49
|
+
declare export const firstThatWorks: <T: string | number>(
|
|
53
50
|
..._styles: $ReadOnlyArray<T>
|
|
54
51
|
) => $ReadOnlyArray<T>;
|
|
55
52
|
|
|
56
|
-
declare export
|
|
53
|
+
declare export const inject: typeof injectStyle;
|
|
57
54
|
|
|
58
|
-
declare export
|
|
55
|
+
declare export const UNSUPPORTED_PROPERTY: <T>(_props: T) => T;
|
|
59
56
|
|
|
60
57
|
type IStyleX = {
|
|
61
|
-
(...styles: $ReadOnlyArray<StyleXArray<?
|
|
58
|
+
(...styles: $ReadOnlyArray<StyleXArray<?CompiledStyles | boolean>>): string,
|
|
62
59
|
spread: (
|
|
63
60
|
styles: StyleXArray<
|
|
64
|
-
| ?
|
|
61
|
+
| ?CompiledStyles
|
|
65
62
|
| boolean
|
|
66
|
-
| $ReadOnly<{ $$css?: void, [string]: string | number }
|
|
63
|
+
| $ReadOnly<{ $$css?: void, [string]: string | number }>,
|
|
67
64
|
>,
|
|
68
|
-
_options?: { ... }
|
|
65
|
+
_options?: { ... },
|
|
69
66
|
) => $ReadOnly<{
|
|
70
67
|
className: string,
|
|
71
68
|
style: $ReadOnly<{ $$css?: void, [string]: string | number }>,
|
|
72
69
|
}>,
|
|
73
70
|
create: Stylex$Create,
|
|
74
|
-
unstable_createVars:
|
|
75
|
-
unstable_overrideVars:
|
|
71
|
+
unstable_createVars: StyleX$CreateVars,
|
|
72
|
+
unstable_overrideVars: StyleX$OverrideVars,
|
|
76
73
|
include: Stylex$Include,
|
|
77
74
|
firstThatWorks: <T: string | number>(
|
|
78
75
|
...v: $ReadOnlyArray<T>
|
|
@@ -85,4 +82,4 @@ type IStyleX = {
|
|
|
85
82
|
|
|
86
83
|
declare export default IStyleX;
|
|
87
84
|
|
|
88
|
-
declare export
|
|
85
|
+
declare export const stylex: IStyleX;
|
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.18",
|
|
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.18"
|
|
24
24
|
},
|
|
25
25
|
"jest": {},
|
|
26
26
|
"files": [
|