@stylexjs/stylex 0.15.4 → 0.16.1
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/cjs/stylex.d.ts +10 -0
- package/lib/cjs/stylex.js +24 -0
- package/lib/cjs/stylex.js.flow +12 -0
- package/lib/cjs/types/StyleXTypes.d.ts +3 -3
- package/lib/cjs/types/StyleXTypes.js.flow +1 -1
- package/lib/es/stylex.d.ts +10 -0
- package/lib/es/stylex.js.flow +12 -0
- package/lib/es/stylex.mjs +23 -1
- package/lib/es/types/StyleXTypes.d.ts +3 -3
- package/lib/es/types/StyleXTypes.js.flow +1 -1
- package/package.json +2 -2
package/lib/cjs/stylex.d.ts
CHANGED
|
@@ -73,6 +73,14 @@ export declare function props(
|
|
|
73
73
|
export declare const viewTransitionClass: (
|
|
74
74
|
_viewTransitionClass: ViewTransitionClass,
|
|
75
75
|
) => string;
|
|
76
|
+
export declare const defaultMarker: () => StaticStyles;
|
|
77
|
+
export declare const when: {
|
|
78
|
+
ancestor: (_pseudo?: string) => string;
|
|
79
|
+
descendant: (_pseudo?: string) => string;
|
|
80
|
+
siblingBefore: (_pseudo?: string) => string;
|
|
81
|
+
siblingAfter: (_pseudo?: string) => string;
|
|
82
|
+
anySibling: (_pseudo?: string) => string;
|
|
83
|
+
};
|
|
76
84
|
export declare const types: {
|
|
77
85
|
angle: <T extends string | 0 = string | 0>(
|
|
78
86
|
_v: ValueWithDefault<T>,
|
|
@@ -123,6 +131,7 @@ type IStyleX = {
|
|
|
123
131
|
create: StyleX$Create;
|
|
124
132
|
createTheme: StyleX$CreateTheme;
|
|
125
133
|
defineVars: StyleX$DefineVars;
|
|
134
|
+
defaultMarker: () => StaticStyles;
|
|
126
135
|
firstThatWorks: <T extends string | number>(
|
|
127
136
|
...v: ReadonlyArray<T>
|
|
128
137
|
) => ReadonlyArray<T>;
|
|
@@ -144,6 +153,7 @@ type IStyleX = {
|
|
|
144
153
|
}>;
|
|
145
154
|
viewTransitionClass: (viewTransitionClass: ViewTransitionClass) => string;
|
|
146
155
|
types: typeof types;
|
|
156
|
+
when: typeof when;
|
|
147
157
|
__customProperties?: { [$$Key$$: string]: unknown };
|
|
148
158
|
};
|
|
149
159
|
export declare const legacyMerge: IStyleX;
|
package/lib/cjs/stylex.js
CHANGED
|
@@ -172,6 +172,26 @@ function props(...styles) {
|
|
|
172
172
|
const viewTransitionClass = _viewTransitionClass => {
|
|
173
173
|
throw errorForFn('viewTransitionClass');
|
|
174
174
|
};
|
|
175
|
+
const defaultMarker = () => {
|
|
176
|
+
throw errorForFn('defaultMarker');
|
|
177
|
+
};
|
|
178
|
+
const when = {
|
|
179
|
+
ancestor: _pseudo => {
|
|
180
|
+
throw errorForFn('when.ancestor');
|
|
181
|
+
},
|
|
182
|
+
descendant: _pseudo => {
|
|
183
|
+
throw errorForFn('when.descendant');
|
|
184
|
+
},
|
|
185
|
+
siblingBefore: _pseudo => {
|
|
186
|
+
throw errorForFn('when.siblingBefore');
|
|
187
|
+
},
|
|
188
|
+
siblingAfter: _pseudo => {
|
|
189
|
+
throw errorForFn('when.siblingAfter');
|
|
190
|
+
},
|
|
191
|
+
anySibling: _pseudo => {
|
|
192
|
+
throw errorForFn('when.anySibling');
|
|
193
|
+
}
|
|
194
|
+
};
|
|
175
195
|
const types = {
|
|
176
196
|
angle: _v => {
|
|
177
197
|
throw errorForType('angle');
|
|
@@ -220,16 +240,19 @@ function _legacyMerge(...styles) {
|
|
|
220
240
|
_legacyMerge.create = create;
|
|
221
241
|
_legacyMerge.createTheme = createTheme;
|
|
222
242
|
_legacyMerge.defineVars = defineVars;
|
|
243
|
+
_legacyMerge.defaultMarker = defaultMarker;
|
|
223
244
|
_legacyMerge.firstThatWorks = firstThatWorks;
|
|
224
245
|
_legacyMerge.keyframes = keyframes;
|
|
225
246
|
_legacyMerge.positionTry = positionTry;
|
|
226
247
|
_legacyMerge.props = props;
|
|
227
248
|
_legacyMerge.types = types;
|
|
249
|
+
_legacyMerge.when = when;
|
|
228
250
|
_legacyMerge.viewTransitionClass = viewTransitionClass;
|
|
229
251
|
const legacyMerge = _legacyMerge;
|
|
230
252
|
|
|
231
253
|
exports.create = create;
|
|
232
254
|
exports.createTheme = createTheme;
|
|
255
|
+
exports.defaultMarker = defaultMarker;
|
|
233
256
|
exports.defineConsts = defineConsts;
|
|
234
257
|
exports.defineVars = defineVars;
|
|
235
258
|
exports.firstThatWorks = firstThatWorks;
|
|
@@ -239,3 +262,4 @@ exports.positionTry = positionTry;
|
|
|
239
262
|
exports.props = props;
|
|
240
263
|
exports.types = types;
|
|
241
264
|
exports.viewTransitionClass = viewTransitionClass;
|
|
265
|
+
exports.when = when;
|
package/lib/cjs/stylex.js.flow
CHANGED
|
@@ -82,6 +82,16 @@ declare export const viewTransitionClass: (
|
|
|
82
82
|
_viewTransitionClass: ViewTransitionClass,
|
|
83
83
|
) => string;
|
|
84
84
|
|
|
85
|
+
declare export const defaultMarker: () => StaticStyles<>;
|
|
86
|
+
|
|
87
|
+
declare export const when: {
|
|
88
|
+
ancestor: (_pseudo?: string) => string,
|
|
89
|
+
descendant: (_pseudo?: string) => string,
|
|
90
|
+
siblingBefore: (_pseudo?: string) => string,
|
|
91
|
+
siblingAfter: (_pseudo?: string) => string,
|
|
92
|
+
anySibling: (_pseudo?: string) => string,
|
|
93
|
+
};
|
|
94
|
+
|
|
85
95
|
declare export const types: {
|
|
86
96
|
angle: <T: string | 0 = string | 0>(
|
|
87
97
|
_v: ValueWithDefault<T>,
|
|
@@ -121,6 +131,7 @@ type IStyleX = {
|
|
|
121
131
|
create: StyleX$Create,
|
|
122
132
|
createTheme: StyleX$CreateTheme,
|
|
123
133
|
defineVars: StyleX$DefineVars,
|
|
134
|
+
defaultMarker: () => StaticStyles<>,
|
|
124
135
|
firstThatWorks: <T: string | number>(
|
|
125
136
|
...v: $ReadOnlyArray<T>
|
|
126
137
|
) => $ReadOnlyArray<T>,
|
|
@@ -140,6 +151,7 @@ type IStyleX = {
|
|
|
140
151
|
}>,
|
|
141
152
|
viewTransitionClass: (viewTransitionClass: ViewTransitionClass) => string,
|
|
142
153
|
types: typeof types,
|
|
154
|
+
when: typeof when,
|
|
143
155
|
__customProperties?: { [string]: mixed },
|
|
144
156
|
...
|
|
145
157
|
};
|
|
@@ -248,9 +248,9 @@ export type IDFromVarGroup<T extends VarGroup<{}>> = T['__opaqueId'];
|
|
|
248
248
|
|
|
249
249
|
type TTokens = Readonly<{
|
|
250
250
|
[key: string]:
|
|
251
|
+
| NestedVarObject<null | string | number>
|
|
252
|
+
| StyleXVar<null | string | number>
|
|
251
253
|
| CSSType<null | string | number>
|
|
252
|
-
| string
|
|
253
|
-
| { [key: string]: string };
|
|
254
254
|
}>;
|
|
255
255
|
|
|
256
256
|
type UnwrapVars<T> = T extends StyleXVar<infer U> ? U : T;
|
|
@@ -264,7 +264,7 @@ type NestedVarObject<T> =
|
|
|
264
264
|
| T
|
|
265
265
|
| Readonly<{
|
|
266
266
|
default: NestedVarObject<T>;
|
|
267
|
-
[key:
|
|
267
|
+
[key: AtRuleStr]: NestedVarObject<T>;
|
|
268
268
|
}>;
|
|
269
269
|
|
|
270
270
|
export type StyleX$DefineConsts = <
|
|
@@ -143,7 +143,7 @@ export type MapNamespaces<+S: { +[string]: mixed }> = $ReadOnly<{
|
|
|
143
143
|
? (...args: Args) => $ReadOnly<[MapNamespace<Obj>, InlineStyles]>
|
|
144
144
|
: MapNamespace<S[Key]>,
|
|
145
145
|
}>;
|
|
146
|
-
export type StyleX$Create = <S: { +[string]:
|
|
146
|
+
export type StyleX$Create = <S: { +[string]: { ... } }>(
|
|
147
147
|
styles: S,
|
|
148
148
|
) => MapNamespaces<S>;
|
|
149
149
|
|
package/lib/es/stylex.d.ts
CHANGED
|
@@ -73,6 +73,14 @@ export declare function props(
|
|
|
73
73
|
export declare const viewTransitionClass: (
|
|
74
74
|
_viewTransitionClass: ViewTransitionClass,
|
|
75
75
|
) => string;
|
|
76
|
+
export declare const defaultMarker: () => StaticStyles;
|
|
77
|
+
export declare const when: {
|
|
78
|
+
ancestor: (_pseudo?: string) => string;
|
|
79
|
+
descendant: (_pseudo?: string) => string;
|
|
80
|
+
siblingBefore: (_pseudo?: string) => string;
|
|
81
|
+
siblingAfter: (_pseudo?: string) => string;
|
|
82
|
+
anySibling: (_pseudo?: string) => string;
|
|
83
|
+
};
|
|
76
84
|
export declare const types: {
|
|
77
85
|
angle: <T extends string | 0 = string | 0>(
|
|
78
86
|
_v: ValueWithDefault<T>,
|
|
@@ -123,6 +131,7 @@ type IStyleX = {
|
|
|
123
131
|
create: StyleX$Create;
|
|
124
132
|
createTheme: StyleX$CreateTheme;
|
|
125
133
|
defineVars: StyleX$DefineVars;
|
|
134
|
+
defaultMarker: () => StaticStyles;
|
|
126
135
|
firstThatWorks: <T extends string | number>(
|
|
127
136
|
...v: ReadonlyArray<T>
|
|
128
137
|
) => ReadonlyArray<T>;
|
|
@@ -144,6 +153,7 @@ type IStyleX = {
|
|
|
144
153
|
}>;
|
|
145
154
|
viewTransitionClass: (viewTransitionClass: ViewTransitionClass) => string;
|
|
146
155
|
types: typeof types;
|
|
156
|
+
when: typeof when;
|
|
147
157
|
__customProperties?: { [$$Key$$: string]: unknown };
|
|
148
158
|
};
|
|
149
159
|
export declare const legacyMerge: IStyleX;
|
package/lib/es/stylex.js.flow
CHANGED
|
@@ -82,6 +82,16 @@ declare export const viewTransitionClass: (
|
|
|
82
82
|
_viewTransitionClass: ViewTransitionClass,
|
|
83
83
|
) => string;
|
|
84
84
|
|
|
85
|
+
declare export const defaultMarker: () => StaticStyles<>;
|
|
86
|
+
|
|
87
|
+
declare export const when: {
|
|
88
|
+
ancestor: (_pseudo?: string) => string,
|
|
89
|
+
descendant: (_pseudo?: string) => string,
|
|
90
|
+
siblingBefore: (_pseudo?: string) => string,
|
|
91
|
+
siblingAfter: (_pseudo?: string) => string,
|
|
92
|
+
anySibling: (_pseudo?: string) => string,
|
|
93
|
+
};
|
|
94
|
+
|
|
85
95
|
declare export const types: {
|
|
86
96
|
angle: <T: string | 0 = string | 0>(
|
|
87
97
|
_v: ValueWithDefault<T>,
|
|
@@ -121,6 +131,7 @@ type IStyleX = {
|
|
|
121
131
|
create: StyleX$Create,
|
|
122
132
|
createTheme: StyleX$CreateTheme,
|
|
123
133
|
defineVars: StyleX$DefineVars,
|
|
134
|
+
defaultMarker: () => StaticStyles<>,
|
|
124
135
|
firstThatWorks: <T: string | number>(
|
|
125
136
|
...v: $ReadOnlyArray<T>
|
|
126
137
|
) => $ReadOnlyArray<T>,
|
|
@@ -140,6 +151,7 @@ type IStyleX = {
|
|
|
140
151
|
}>,
|
|
141
152
|
viewTransitionClass: (viewTransitionClass: ViewTransitionClass) => string,
|
|
142
153
|
types: typeof types,
|
|
154
|
+
when: typeof when,
|
|
143
155
|
__customProperties?: { [string]: mixed },
|
|
144
156
|
...
|
|
145
157
|
};
|
package/lib/es/stylex.mjs
CHANGED
|
@@ -170,6 +170,26 @@ function props(...styles) {
|
|
|
170
170
|
const viewTransitionClass = _viewTransitionClass => {
|
|
171
171
|
throw errorForFn('viewTransitionClass');
|
|
172
172
|
};
|
|
173
|
+
const defaultMarker = () => {
|
|
174
|
+
throw errorForFn('defaultMarker');
|
|
175
|
+
};
|
|
176
|
+
const when = {
|
|
177
|
+
ancestor: _pseudo => {
|
|
178
|
+
throw errorForFn('when.ancestor');
|
|
179
|
+
},
|
|
180
|
+
descendant: _pseudo => {
|
|
181
|
+
throw errorForFn('when.descendant');
|
|
182
|
+
},
|
|
183
|
+
siblingBefore: _pseudo => {
|
|
184
|
+
throw errorForFn('when.siblingBefore');
|
|
185
|
+
},
|
|
186
|
+
siblingAfter: _pseudo => {
|
|
187
|
+
throw errorForFn('when.siblingAfter');
|
|
188
|
+
},
|
|
189
|
+
anySibling: _pseudo => {
|
|
190
|
+
throw errorForFn('when.anySibling');
|
|
191
|
+
}
|
|
192
|
+
};
|
|
173
193
|
const types = {
|
|
174
194
|
angle: _v => {
|
|
175
195
|
throw errorForType('angle');
|
|
@@ -218,12 +238,14 @@ function _legacyMerge(...styles) {
|
|
|
218
238
|
_legacyMerge.create = create;
|
|
219
239
|
_legacyMerge.createTheme = createTheme;
|
|
220
240
|
_legacyMerge.defineVars = defineVars;
|
|
241
|
+
_legacyMerge.defaultMarker = defaultMarker;
|
|
221
242
|
_legacyMerge.firstThatWorks = firstThatWorks;
|
|
222
243
|
_legacyMerge.keyframes = keyframes;
|
|
223
244
|
_legacyMerge.positionTry = positionTry;
|
|
224
245
|
_legacyMerge.props = props;
|
|
225
246
|
_legacyMerge.types = types;
|
|
247
|
+
_legacyMerge.when = when;
|
|
226
248
|
_legacyMerge.viewTransitionClass = viewTransitionClass;
|
|
227
249
|
const legacyMerge = _legacyMerge;
|
|
228
250
|
|
|
229
|
-
export { create, createTheme, defineConsts, defineVars, firstThatWorks, keyframes, legacyMerge, positionTry, props, types, viewTransitionClass };
|
|
251
|
+
export { create, createTheme, defaultMarker, defineConsts, defineVars, firstThatWorks, keyframes, legacyMerge, positionTry, props, types, viewTransitionClass, when };
|
|
@@ -248,9 +248,9 @@ export type IDFromVarGroup<T extends VarGroup<{}>> = T['__opaqueId'];
|
|
|
248
248
|
|
|
249
249
|
type TTokens = Readonly<{
|
|
250
250
|
[key: string]:
|
|
251
|
+
| NestedVarObject<null | string | number>
|
|
252
|
+
| StyleXVar<null | string | number>
|
|
251
253
|
| CSSType<null | string | number>
|
|
252
|
-
| string
|
|
253
|
-
| { [key: string]: string };
|
|
254
254
|
}>;
|
|
255
255
|
|
|
256
256
|
type UnwrapVars<T> = T extends StyleXVar<infer U> ? U : T;
|
|
@@ -264,7 +264,7 @@ type NestedVarObject<T> =
|
|
|
264
264
|
| T
|
|
265
265
|
| Readonly<{
|
|
266
266
|
default: NestedVarObject<T>;
|
|
267
|
-
[key:
|
|
267
|
+
[key: AtRuleStr]: NestedVarObject<T>;
|
|
268
268
|
}>;
|
|
269
269
|
|
|
270
270
|
export type StyleX$DefineConsts = <
|
|
@@ -143,7 +143,7 @@ export type MapNamespaces<+S: { +[string]: mixed }> = $ReadOnly<{
|
|
|
143
143
|
? (...args: Args) => $ReadOnly<[MapNamespace<Obj>, InlineStyles]>
|
|
144
144
|
: MapNamespace<S[Key]>,
|
|
145
145
|
}>;
|
|
146
|
-
export type StyleX$Create = <S: { +[string]:
|
|
146
|
+
export type StyleX$Create = <S: { +[string]: { ... } }>(
|
|
147
147
|
styles: S,
|
|
148
148
|
) => MapNamespaces<S>;
|
|
149
149
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/stylex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "A library for defining styles for optimized user interfaces.",
|
|
5
5
|
"main": "./lib/cjs/stylex.js",
|
|
6
6
|
"module": "./lib/es/stylex.mjs",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"cross-env": "^7.0.3",
|
|
62
62
|
"rimraf": "^5.0.10",
|
|
63
63
|
"rollup": "^4.24.0",
|
|
64
|
-
"scripts": "0.
|
|
64
|
+
"scripts": "0.16.1"
|
|
65
65
|
},
|
|
66
66
|
"files": [
|
|
67
67
|
"lib/*"
|