@stylexjs/stylex 0.1.0-beta.7 → 0.2.0-beta.8
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/stylex.d.ts +9 -14
- package/lib/stylex.js +4 -2
- package/package.json +1 -1
package/lib/stylex.d.ts
CHANGED
|
@@ -38,17 +38,14 @@ export type CompiledNamespaceSet = {
|
|
|
38
38
|
readonly [K in string]: CompiledNamespace;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
type Stylex$Create = <S extends
|
|
41
|
+
type Stylex$Create = <S extends NamespaceSet>(
|
|
42
42
|
styles: S
|
|
43
43
|
) => $ReadOnly<{
|
|
44
44
|
readonly [K in keyof S]: {
|
|
45
45
|
readonly [P in keyof S[K]]: S[K][P] extends string | number
|
|
46
|
-
?
|
|
46
|
+
? ClassNameFor<P, S[K][P]>
|
|
47
47
|
: {
|
|
48
|
-
readonly [F in keyof S[K][P]]:
|
|
49
|
-
`${P}+${F}`,
|
|
50
|
-
S[K][P][F]
|
|
51
|
-
>;
|
|
48
|
+
readonly [F in keyof S[K][P]]: ClassNameFor<`${P}+${F}`, S[K][P][F]>;
|
|
52
49
|
};
|
|
53
50
|
};
|
|
54
51
|
}>;
|
|
@@ -56,19 +53,17 @@ type Stylex$Create = <S extends StyleXNamespaceSet>(
|
|
|
56
53
|
type StylexInclude = <S extends CompiledNamespace>(
|
|
57
54
|
compiledNamespace: S
|
|
58
55
|
) => {
|
|
59
|
-
readonly [K in keyof S]: S[K] extends ClassNameFor<K, infer V>
|
|
60
|
-
? V
|
|
61
|
-
: Uncompiled<S[K]>;
|
|
56
|
+
readonly [K in keyof S]: S[K] extends ClassNameFor<K, infer V> ? V : S[K];
|
|
62
57
|
};
|
|
63
58
|
|
|
64
|
-
type Stylex$Keyframes = <S extends
|
|
65
|
-
animationConfig: S
|
|
66
|
-
) => string;
|
|
59
|
+
type Stylex$Keyframes = <S extends NamespaceSet>(animationConfig: S) => string;
|
|
67
60
|
|
|
68
|
-
type
|
|
61
|
+
type NestedArray<T> = T | Array<T | NestedArray<T>>;
|
|
62
|
+
|
|
63
|
+
declare let stylex: {
|
|
69
64
|
(
|
|
70
65
|
...styles: ReadonlyArray<
|
|
71
|
-
|
|
66
|
+
NestedArray<(CompiledNamespace | null | undefined) | boolean>
|
|
72
67
|
>
|
|
73
68
|
): string;
|
|
74
69
|
create: Stylex$Create;
|
package/lib/stylex.js
CHANGED
|
@@ -55,12 +55,14 @@ function stylex() {
|
|
|
55
55
|
for (const prop in styleObj) {
|
|
56
56
|
const value = styleObj[prop];
|
|
57
57
|
// Style declarations, e.g., opacity: 's3fkgpd'
|
|
58
|
-
if (typeof value === 'string') {
|
|
58
|
+
if (typeof value === 'string' || value === null) {
|
|
59
59
|
// Skip adding to the chunks if property has already been seen
|
|
60
60
|
if (!definedProperties.includes(prop)) {
|
|
61
61
|
definedProperties.push(prop);
|
|
62
62
|
definedPropertiesChunk.push(prop);
|
|
63
|
-
|
|
63
|
+
if (typeof value === 'string') {
|
|
64
|
+
classNameChunk += classNameChunk ? ' ' + value : value;
|
|
65
|
+
}
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
}
|