@stylexjs/stylex 0.10.1 → 0.11.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/StyleXTypes.d.ts +1 -1
- package/lib/StyleXTypes.js.flow +1 -1
- package/lib/VarTypes.d.ts +1 -6
- package/lib/VarTypes.js.flow +1 -6
- package/lib/es/stylex.mjs +74 -126
- package/lib/es/util-types.mjs +0 -0
- package/lib/stylex.d.ts +73 -87
- package/lib/stylex.js +50 -48
- package/lib/stylex.js.flow +74 -86
- package/lib/util-types.d.ts +15 -0
- package/lib/util-types.js +1 -0
- package/lib/util-types.js.flow +15 -0
- package/package.json +21 -4
package/lib/StyleXTypes.d.ts
CHANGED
package/lib/StyleXTypes.js.flow
CHANGED
|
@@ -87,7 +87,7 @@ export type MapNamespaces<+S: { +[string]: mixed }> = $ReadOnly<{
|
|
|
87
87
|
? (...args: Args) => $ReadOnly<[MapNamespace<Obj>, InlineStyles]>
|
|
88
88
|
: MapNamespace<S[Key]>,
|
|
89
89
|
}>;
|
|
90
|
-
export type
|
|
90
|
+
export type StyleX$Create = <S: { +[string]: mixed }>(
|
|
91
91
|
styles: S,
|
|
92
92
|
) => MapNamespaces<S>;
|
|
93
93
|
|
package/lib/VarTypes.d.ts
CHANGED
|
@@ -7,12 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
| T
|
|
12
|
-
| Readonly<{
|
|
13
|
-
default: ValueWithDefault<T>;
|
|
14
|
-
[$$Key$$: string]: ValueWithDefault<T>;
|
|
15
|
-
}>;
|
|
10
|
+
import type { ValueWithDefault } from './util-types';
|
|
16
11
|
export type CSSSyntax =
|
|
17
12
|
| '*'
|
|
18
13
|
| '<length>'
|
package/lib/VarTypes.js.flow
CHANGED
|
@@ -7,12 +7,7 @@
|
|
|
7
7
|
* @flow strict
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
| T
|
|
12
|
-
| $ReadOnly<{
|
|
13
|
-
default: ValueWithDefault<T>,
|
|
14
|
-
[string]: ValueWithDefault<T>,
|
|
15
|
-
}>;
|
|
10
|
+
import type { ValueWithDefault } from './util-types';
|
|
16
11
|
|
|
17
12
|
export type CSSSyntax =
|
|
18
13
|
| '*'
|
package/lib/es/stylex.mjs
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
var styleq = {};
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Copyright (c) Nicolas Gallagher
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
3
|
var hasRequiredStyleq;
|
|
13
4
|
|
|
14
5
|
function requireStyleq () {
|
|
@@ -21,185 +12,130 @@ function requireStyleq () {
|
|
|
21
12
|
styleq.styleq = void 0;
|
|
22
13
|
var cache = new WeakMap();
|
|
23
14
|
var compiledKey = '$$css';
|
|
24
|
-
|
|
25
15
|
function createStyleq(options) {
|
|
26
16
|
var disableCache;
|
|
27
17
|
var disableMix;
|
|
28
18
|
var transform;
|
|
29
|
-
|
|
30
19
|
if (options != null) {
|
|
31
20
|
disableCache = options.disableCache === true;
|
|
32
21
|
disableMix = options.disableMix === true;
|
|
33
22
|
transform = options.transform;
|
|
34
23
|
}
|
|
35
|
-
|
|
36
24
|
return function styleq() {
|
|
37
|
-
|
|
38
|
-
var definedProperties = []; // The className and inline style to build up
|
|
39
|
-
|
|
25
|
+
var definedProperties = [];
|
|
40
26
|
var className = '';
|
|
41
|
-
var inlineStyle = null;
|
|
42
|
-
|
|
43
|
-
var nextCache = disableCache ? null : cache;
|
|
44
|
-
|
|
27
|
+
var inlineStyle = null;
|
|
28
|
+
var debugString = '';
|
|
29
|
+
var nextCache = disableCache ? null : cache;
|
|
45
30
|
var styles = new Array(arguments.length);
|
|
46
|
-
|
|
47
31
|
for (var i = 0; i < arguments.length; i++) {
|
|
48
32
|
styles[i] = arguments[i];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
}
|
|
52
34
|
while (styles.length > 0) {
|
|
53
|
-
var possibleStyle = styles.pop();
|
|
54
|
-
|
|
35
|
+
var possibleStyle = styles.pop();
|
|
55
36
|
if (possibleStyle == null || possibleStyle === false) {
|
|
56
37
|
continue;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
38
|
+
}
|
|
60
39
|
if (Array.isArray(possibleStyle)) {
|
|
61
40
|
for (var _i = 0; _i < possibleStyle.length; _i++) {
|
|
62
41
|
styles.push(possibleStyle[_i]);
|
|
63
42
|
}
|
|
64
|
-
|
|
65
43
|
continue;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
44
|
+
}
|
|
69
45
|
var style = transform != null ? transform(possibleStyle) : possibleStyle;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// Build up the class names defined by this object
|
|
73
|
-
var classNameChunk = ''; // Check the cache to see if we've already done this work
|
|
74
|
-
|
|
46
|
+
if (style.$$css != null) {
|
|
47
|
+
var classNameChunk = '';
|
|
75
48
|
if (nextCache != null && nextCache.has(style)) {
|
|
76
|
-
// Cache: read
|
|
77
49
|
var cacheEntry = nextCache.get(style);
|
|
78
|
-
|
|
79
50
|
if (cacheEntry != null) {
|
|
80
|
-
classNameChunk = cacheEntry[0];
|
|
81
|
-
|
|
51
|
+
classNameChunk = cacheEntry[0];
|
|
52
|
+
debugString = cacheEntry[2];
|
|
82
53
|
definedProperties.push.apply(definedProperties, cacheEntry[1]);
|
|
83
|
-
nextCache = cacheEntry[
|
|
54
|
+
nextCache = cacheEntry[3];
|
|
84
55
|
}
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
// The properties defined by this object
|
|
56
|
+
} else {
|
|
88
57
|
var definedPropertiesChunk = [];
|
|
89
|
-
|
|
90
58
|
for (var prop in style) {
|
|
91
59
|
var value = style[prop];
|
|
92
|
-
if (prop === compiledKey)
|
|
93
|
-
|
|
94
|
-
|
|
60
|
+
if (prop === compiledKey) {
|
|
61
|
+
var compiledKeyValue = style[prop];
|
|
62
|
+
if (compiledKeyValue !== true) {
|
|
63
|
+
debugString = debugString ? compiledKeyValue + '; ' + debugString : compiledKeyValue;
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
95
67
|
if (typeof value === 'string' || value === null) {
|
|
96
|
-
// Only add to chunks if this property hasn't already been seen
|
|
97
68
|
if (!definedProperties.includes(prop)) {
|
|
98
69
|
definedProperties.push(prop);
|
|
99
|
-
|
|
100
70
|
if (nextCache != null) {
|
|
101
71
|
definedPropertiesChunk.push(prop);
|
|
102
72
|
}
|
|
103
|
-
|
|
104
73
|
if (typeof value === 'string') {
|
|
105
74
|
classNameChunk += classNameChunk ? ' ' + value : value;
|
|
106
75
|
}
|
|
107
76
|
}
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
77
|
+
} else {
|
|
110
78
|
console.error("styleq: ".concat(prop, " typeof ").concat(String(value), " is not \"string\" or \"null\"."));
|
|
111
79
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
80
|
+
}
|
|
115
81
|
if (nextCache != null) {
|
|
116
|
-
// Create the next WeakMap for this sequence of styles
|
|
117
82
|
var weakMap = new WeakMap();
|
|
118
|
-
nextCache.set(style, [classNameChunk, definedPropertiesChunk, weakMap]);
|
|
83
|
+
nextCache.set(style, [classNameChunk, definedPropertiesChunk, debugString, weakMap]);
|
|
119
84
|
nextCache = weakMap;
|
|
120
85
|
}
|
|
121
|
-
}
|
|
122
|
-
// object. Order of chunks matches passed order of styles from first to
|
|
123
|
-
// last (which we iterate over in reverse).
|
|
124
|
-
|
|
125
|
-
|
|
86
|
+
}
|
|
126
87
|
if (classNameChunk) {
|
|
127
88
|
className = className ? classNameChunk + ' ' + className : classNameChunk;
|
|
128
89
|
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
90
|
+
} else {
|
|
131
91
|
if (disableMix) {
|
|
132
92
|
if (inlineStyle == null) {
|
|
133
93
|
inlineStyle = {};
|
|
134
94
|
}
|
|
135
|
-
|
|
136
95
|
inlineStyle = Object.assign({}, style, inlineStyle);
|
|
137
96
|
} else {
|
|
138
97
|
var subStyle = null;
|
|
139
|
-
|
|
140
98
|
for (var _prop in style) {
|
|
141
99
|
var _value = style[_prop];
|
|
142
|
-
|
|
143
100
|
if (_value !== undefined) {
|
|
144
101
|
if (!definedProperties.includes(_prop)) {
|
|
145
102
|
if (_value != null) {
|
|
146
103
|
if (inlineStyle == null) {
|
|
147
104
|
inlineStyle = {};
|
|
148
105
|
}
|
|
149
|
-
|
|
150
106
|
if (subStyle == null) {
|
|
151
107
|
subStyle = {};
|
|
152
108
|
}
|
|
153
|
-
|
|
154
109
|
subStyle[_prop] = _value;
|
|
155
110
|
}
|
|
156
|
-
|
|
157
|
-
definedProperties.push(_prop); // Cache is unnecessary overhead if results can't be reused.
|
|
158
|
-
|
|
111
|
+
definedProperties.push(_prop);
|
|
159
112
|
nextCache = null;
|
|
160
113
|
}
|
|
161
114
|
}
|
|
162
115
|
}
|
|
163
|
-
|
|
164
116
|
if (subStyle != null) {
|
|
165
117
|
inlineStyle = Object.assign(subStyle, inlineStyle);
|
|
166
118
|
}
|
|
167
119
|
}
|
|
168
120
|
}
|
|
169
121
|
}
|
|
170
|
-
|
|
171
|
-
var styleProps = [className, inlineStyle];
|
|
122
|
+
var styleProps = [className, inlineStyle, debugString];
|
|
172
123
|
return styleProps;
|
|
173
124
|
};
|
|
174
125
|
}
|
|
175
|
-
|
|
176
|
-
var styleq$1 = createStyleq();
|
|
177
|
-
styleq.styleq = styleq$1;
|
|
126
|
+
var styleq$1 = styleq.styleq = createStyleq();
|
|
178
127
|
styleq$1.factory = createStyleq;
|
|
179
128
|
return styleq;
|
|
180
129
|
}
|
|
181
130
|
|
|
182
131
|
var styleqExports = /*@__PURE__*/ requireStyleq();
|
|
183
132
|
|
|
184
|
-
const errorForFn = name => new Error(`'stylex.${name}'
|
|
133
|
+
const errorForFn = name => new Error(`Unexpected 'stylex.${name}' call at runtime. Styles must be compiled by '@stylexjs/babel-plugin'.`);
|
|
185
134
|
const errorForType = key => errorForFn(`types.${key}`);
|
|
186
|
-
function props() {
|
|
187
|
-
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
188
|
-
styles[_key] = arguments[_key];
|
|
189
|
-
}
|
|
190
|
-
const [className, style] = styleqExports.styleq(styles);
|
|
191
|
-
const result = {};
|
|
192
|
-
if (className != null && className !== '') {
|
|
193
|
-
result.className = className;
|
|
194
|
-
}
|
|
195
|
-
if (style != null && Object.keys(style).length > 0) {
|
|
196
|
-
result.style = style;
|
|
197
|
-
}
|
|
198
|
-
return result;
|
|
199
|
-
}
|
|
200
135
|
function attrs() {
|
|
201
136
|
const {
|
|
202
137
|
className,
|
|
138
|
+
'data-style-src': dataStyleSrc,
|
|
203
139
|
style
|
|
204
140
|
} = props(...arguments);
|
|
205
141
|
const result = {};
|
|
@@ -209,24 +145,43 @@ function attrs() {
|
|
|
209
145
|
if (style != null && Object.keys(style).length > 0) {
|
|
210
146
|
result.style = Object.keys(style).map(key => `${key}:${style[key]};`).join('');
|
|
211
147
|
}
|
|
148
|
+
if (dataStyleSrc != null && dataStyleSrc !== '') {
|
|
149
|
+
result['data-style-src'] = dataStyleSrc;
|
|
150
|
+
}
|
|
212
151
|
return result;
|
|
213
152
|
}
|
|
214
|
-
function stylexCreate(_styles) {
|
|
153
|
+
const create = function stylexCreate(_styles) {
|
|
215
154
|
throw errorForFn('create');
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
throw errorForFn('defineVars');
|
|
219
|
-
}
|
|
220
|
-
const stylexCreateTheme = (_baseTokens, _overrides) => {
|
|
155
|
+
};
|
|
156
|
+
const createTheme = (_baseTokens, _overrides) => {
|
|
221
157
|
throw errorForFn('createTheme');
|
|
222
158
|
};
|
|
223
|
-
const
|
|
224
|
-
throw errorForFn('
|
|
159
|
+
const defineVars = function stylexDefineVars(_styles) {
|
|
160
|
+
throw errorForFn('defineVars');
|
|
161
|
+
};
|
|
162
|
+
const firstThatWorks = function () {
|
|
163
|
+
throw errorForFn('firstThatWorks');
|
|
164
|
+
};
|
|
165
|
+
const keyframes = _keyframes => {
|
|
166
|
+
throw errorForFn('keyframes');
|
|
225
167
|
};
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
168
|
+
function props() {
|
|
169
|
+
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
170
|
+
styles[_key] = arguments[_key];
|
|
171
|
+
}
|
|
172
|
+
const [className, style, dataStyleSrc] = styleqExports.styleq(styles);
|
|
173
|
+
const result = {};
|
|
174
|
+
if (className != null && className !== '') {
|
|
175
|
+
result.className = className;
|
|
176
|
+
}
|
|
177
|
+
if (style != null && Object.keys(style).length > 0) {
|
|
178
|
+
result.style = style;
|
|
179
|
+
}
|
|
180
|
+
if (dataStyleSrc != null && dataStyleSrc !== '') {
|
|
181
|
+
result['data-style-src'] = dataStyleSrc;
|
|
182
|
+
}
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
230
185
|
const types = {
|
|
231
186
|
angle: _v => {
|
|
232
187
|
throw errorForType('angle');
|
|
@@ -268,28 +223,21 @@ const types = {
|
|
|
268
223
|
throw errorForType('transformList');
|
|
269
224
|
}
|
|
270
225
|
};
|
|
271
|
-
|
|
272
|
-
throw errorForFn('keyframes');
|
|
273
|
-
};
|
|
274
|
-
const firstThatWorks = function () {
|
|
275
|
-
throw errorForFn('firstThatWorks');
|
|
276
|
-
};
|
|
277
|
-
function _stylex() {
|
|
226
|
+
function _legacyMerge() {
|
|
278
227
|
for (var _len2 = arguments.length, styles = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
279
228
|
styles[_key2] = arguments[_key2];
|
|
280
229
|
}
|
|
281
230
|
const [className] = styleqExports.styleq(styles);
|
|
282
231
|
return className;
|
|
283
232
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
export { attrs, create, createTheme, _stylex as default, defineVars, firstThatWorks, include, keyframes, legacyMerge, props, types };
|
|
233
|
+
_legacyMerge.attrs = attrs;
|
|
234
|
+
_legacyMerge.create = create;
|
|
235
|
+
_legacyMerge.createTheme = createTheme;
|
|
236
|
+
_legacyMerge.defineVars = defineVars;
|
|
237
|
+
_legacyMerge.firstThatWorks = firstThatWorks;
|
|
238
|
+
_legacyMerge.keyframes = keyframes;
|
|
239
|
+
_legacyMerge.props = props;
|
|
240
|
+
_legacyMerge.types = types;
|
|
241
|
+
const legacyMerge = _legacyMerge;
|
|
242
|
+
|
|
243
|
+
export { attrs, create, createTheme, defineVars, firstThatWorks, keyframes, legacyMerge, props, types };
|
|
File without changes
|
package/lib/stylex.d.ts
CHANGED
|
@@ -8,41 +8,32 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
|
+
CompiledStyles,
|
|
12
|
+
InlineStyles,
|
|
11
13
|
Keyframes,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
StaticStyles,
|
|
15
|
+
StaticStylesWithout,
|
|
16
|
+
StyleX$Create,
|
|
14
17
|
StyleX$CreateTheme,
|
|
18
|
+
StyleX$DefineVars,
|
|
15
19
|
StyleXArray,
|
|
16
|
-
CompiledStyles,
|
|
17
|
-
InlineStyles,
|
|
18
|
-
StyleXClassNameFor,
|
|
19
|
-
} from './StyleXTypes';
|
|
20
|
-
import type {
|
|
21
|
-
ValueWithDefault,
|
|
22
|
-
Angle,
|
|
23
|
-
Color,
|
|
24
|
-
Url,
|
|
25
|
-
Image,
|
|
26
|
-
Integer,
|
|
27
|
-
LengthPercentage,
|
|
28
|
-
Length,
|
|
29
|
-
Percentage,
|
|
30
|
-
Num,
|
|
31
|
-
Resolution,
|
|
32
|
-
Time,
|
|
33
|
-
TransformFunction,
|
|
34
|
-
TransformList,
|
|
35
|
-
} from './VarTypes';
|
|
36
|
-
export type {
|
|
37
|
-
VarGroup,
|
|
38
|
-
Theme,
|
|
39
20
|
StyleXStyles,
|
|
40
21
|
StyleXStylesWithout,
|
|
22
|
+
Theme,
|
|
23
|
+
VarGroup,
|
|
24
|
+
} from './StyleXTypes';
|
|
25
|
+
import type { ValueWithDefault } from './util-types';
|
|
26
|
+
import * as Types from './VarTypes';
|
|
27
|
+
export type {
|
|
41
28
|
StaticStyles,
|
|
42
29
|
StaticStylesWithout,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
StyleXStyles,
|
|
31
|
+
StyleXStylesWithout,
|
|
32
|
+
Theme,
|
|
33
|
+
Types,
|
|
34
|
+
VarGroup,
|
|
35
|
+
};
|
|
36
|
+
export declare function attrs(
|
|
46
37
|
...styles: ReadonlyArray<
|
|
47
38
|
StyleXArray<
|
|
48
39
|
| (null | undefined | CompiledStyles)
|
|
@@ -50,11 +41,16 @@ export declare function props(
|
|
|
50
41
|
| Readonly<[CompiledStyles, InlineStyles]>
|
|
51
42
|
>
|
|
52
43
|
>
|
|
53
|
-
): Readonly<{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
export declare
|
|
44
|
+
): Readonly<{ class?: string; 'data-style-src'?: string; style?: string }>;
|
|
45
|
+
export declare const create: StyleX$Create;
|
|
46
|
+
export declare const createTheme: StyleX$CreateTheme;
|
|
47
|
+
export declare const defineVars: StyleX$DefineVars;
|
|
48
|
+
export declare const firstThatWorks: <T extends string | number>(
|
|
49
|
+
..._styles: ReadonlyArray<T>
|
|
50
|
+
) => ReadonlyArray<T>;
|
|
51
|
+
export declare const keyframes: (_keyframes: Keyframes) => string;
|
|
52
|
+
export declare function props(
|
|
53
|
+
this: null | undefined | unknown,
|
|
58
54
|
...styles: ReadonlyArray<
|
|
59
55
|
StyleXArray<
|
|
60
56
|
| (null | undefined | CompiledStyles)
|
|
@@ -62,70 +58,61 @@ export declare function attrs(
|
|
|
62
58
|
| Readonly<[CompiledStyles, InlineStyles]>
|
|
63
59
|
>
|
|
64
60
|
>
|
|
65
|
-
): Readonly<{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
>(
|
|
71
|
-
styles: TStyles,
|
|
72
|
-
) => {
|
|
73
|
-
readonly [Key in keyof TStyles]: TStyles[Key] extends StyleXClassNameFor<
|
|
74
|
-
unknown,
|
|
75
|
-
infer V
|
|
76
|
-
>
|
|
77
|
-
? V
|
|
78
|
-
: string;
|
|
79
|
-
};
|
|
80
|
-
export declare const create: Stylex$Create;
|
|
81
|
-
export declare const defineVars: StyleX$DefineVars;
|
|
82
|
-
export declare const createTheme: StyleX$CreateTheme;
|
|
83
|
-
export declare const include: Stylex$Include;
|
|
61
|
+
): Readonly<{
|
|
62
|
+
className?: string;
|
|
63
|
+
'data-style-src'?: string;
|
|
64
|
+
style?: Readonly<{ [$$Key$$: string]: string | number }>;
|
|
65
|
+
}>;
|
|
84
66
|
export declare const types: {
|
|
85
67
|
angle: <T extends string | 0 = string | 0>(
|
|
86
68
|
_v: ValueWithDefault<T>,
|
|
87
|
-
) => Angle<T>;
|
|
88
|
-
color: <T extends string = string>(_v: ValueWithDefault<T>) => Color<T>;
|
|
89
|
-
url: <T extends string = string>(_v: ValueWithDefault<T>) => Url<T>;
|
|
90
|
-
image: <T extends string = string>(_v: ValueWithDefault<T>) => Image<T>;
|
|
69
|
+
) => Types.Angle<T>;
|
|
70
|
+
color: <T extends string = string>(_v: ValueWithDefault<T>) => Types.Color<T>;
|
|
71
|
+
url: <T extends string = string>(_v: ValueWithDefault<T>) => Types.Url<T>;
|
|
72
|
+
image: <T extends string = string>(_v: ValueWithDefault<T>) => Types.Image<T>;
|
|
91
73
|
integer: <T extends number | string = number | string>(
|
|
92
74
|
_v: ValueWithDefault<T>,
|
|
93
|
-
) => Integer<T>;
|
|
75
|
+
) => Types.Integer<T>;
|
|
94
76
|
lengthPercentage: <T extends number | string = number | string>(
|
|
95
77
|
_v: ValueWithDefault<T>,
|
|
96
|
-
) => LengthPercentage<T>;
|
|
78
|
+
) => Types.LengthPercentage<T>;
|
|
97
79
|
length: <T extends number | string = number | string>(
|
|
98
80
|
_v: ValueWithDefault<T>,
|
|
99
|
-
) => Length<T>;
|
|
81
|
+
) => Types.Length<T>;
|
|
100
82
|
percentage: <T extends number | string = number | string>(
|
|
101
83
|
_v: ValueWithDefault<T>,
|
|
102
|
-
) => Percentage<T>;
|
|
84
|
+
) => Types.Percentage<T>;
|
|
103
85
|
number: <T extends number | string = number | string>(
|
|
104
86
|
_v: ValueWithDefault<T>,
|
|
105
|
-
) => Num<T>;
|
|
87
|
+
) => Types.Num<T>;
|
|
106
88
|
resolution: <T extends string = string>(
|
|
107
89
|
_v: ValueWithDefault<T>,
|
|
108
|
-
) => Resolution<T>;
|
|
109
|
-
time: <T extends string | 0 = string | 0>(
|
|
90
|
+
) => Types.Resolution<T>;
|
|
91
|
+
time: <T extends string | 0 = string | 0>(
|
|
92
|
+
_v: ValueWithDefault<T>,
|
|
93
|
+
) => Types.Time<T>;
|
|
110
94
|
transformFunction: <T extends string = string>(
|
|
111
95
|
_v: ValueWithDefault<T>,
|
|
112
|
-
) => TransformFunction<T>;
|
|
96
|
+
) => Types.TransformFunction<T>;
|
|
113
97
|
transformList: <T extends string = string>(
|
|
114
98
|
_v: ValueWithDefault<T>,
|
|
115
|
-
) => TransformList<T>;
|
|
99
|
+
) => Types.TransformList<T>;
|
|
116
100
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
101
|
+
/**
|
|
102
|
+
* DO NOT USE. Legacy export for Meta
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* DO NOT USE. Legacy export for Meta
|
|
107
|
+
*/
|
|
108
|
+
|
|
121
109
|
type IStyleX = {
|
|
122
110
|
(
|
|
123
111
|
...styles: ReadonlyArray<
|
|
124
112
|
StyleXArray<(null | undefined | CompiledStyles) | boolean>
|
|
125
113
|
>
|
|
126
114
|
): string;
|
|
127
|
-
|
|
128
|
-
this: null | undefined | unknown,
|
|
115
|
+
attrs: (
|
|
129
116
|
...styles: ReadonlyArray<
|
|
130
117
|
StyleXArray<
|
|
131
118
|
| (null | undefined | CompiledStyles)
|
|
@@ -133,11 +120,16 @@ type IStyleX = {
|
|
|
133
120
|
| Readonly<[CompiledStyles, InlineStyles]>
|
|
134
121
|
>
|
|
135
122
|
>
|
|
136
|
-
) => Readonly<{
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
123
|
+
) => Readonly<{ class?: string; 'data-style-src'?: string; style?: string }>;
|
|
124
|
+
create: StyleX$Create;
|
|
125
|
+
createTheme: StyleX$CreateTheme;
|
|
126
|
+
defineVars: StyleX$DefineVars;
|
|
127
|
+
firstThatWorks: <T extends string | number>(
|
|
128
|
+
...v: ReadonlyArray<T>
|
|
129
|
+
) => ReadonlyArray<T>;
|
|
130
|
+
keyframes: (keyframes: Keyframes) => string;
|
|
131
|
+
props: (
|
|
132
|
+
this: null | undefined | unknown,
|
|
141
133
|
...styles: ReadonlyArray<
|
|
142
134
|
StyleXArray<
|
|
143
135
|
| (null | undefined | CompiledStyles)
|
|
@@ -145,18 +137,12 @@ type IStyleX = {
|
|
|
145
137
|
| Readonly<[CompiledStyles, InlineStyles]>
|
|
146
138
|
>
|
|
147
139
|
>
|
|
148
|
-
) => Readonly<{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
140
|
+
) => Readonly<{
|
|
141
|
+
className?: string;
|
|
142
|
+
'data-style-src'?: string;
|
|
143
|
+
style?: Readonly<{ [$$Key$$: string]: string | number }>;
|
|
144
|
+
}>;
|
|
153
145
|
types: typeof types;
|
|
154
|
-
firstThatWorks: <T extends string | number>(
|
|
155
|
-
...v: ReadonlyArray<T>
|
|
156
|
-
) => ReadonlyArray<T>;
|
|
157
|
-
keyframes: (keyframes: Keyframes) => string;
|
|
158
146
|
__customProperties?: { [$$Key$$: string]: unknown };
|
|
159
147
|
};
|
|
160
148
|
export declare const legacyMerge: IStyleX;
|
|
161
|
-
declare const $$EXPORT_DEFAULT_DECLARATION$$: IStyleX;
|
|
162
|
-
export default $$EXPORT_DEFAULT_DECLARATION$$;
|
package/lib/stylex.js
CHANGED
|
@@ -4,29 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.attrs = attrs;
|
|
7
|
-
exports.legacyMerge = exports.keyframes = exports.
|
|
7
|
+
exports.legacyMerge = exports.keyframes = exports.firstThatWorks = exports.defineVars = exports.createTheme = exports.create = void 0;
|
|
8
8
|
exports.props = props;
|
|
9
9
|
exports.types = void 0;
|
|
10
|
+
var Types = _interopRequireWildcard(require("./VarTypes"));
|
|
10
11
|
var _styleq = require("styleq");
|
|
11
|
-
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
const errorForFn = name => new Error(`Unexpected 'stylex.${name}' call at runtime. Styles must be compiled by '@stylexjs/babel-plugin'.`);
|
|
12
15
|
const errorForType = key => errorForFn(`types.${key}`);
|
|
13
|
-
function props() {
|
|
14
|
-
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
-
styles[_key] = arguments[_key];
|
|
16
|
-
}
|
|
17
|
-
const [className, style] = (0, _styleq.styleq)(styles);
|
|
18
|
-
const result = {};
|
|
19
|
-
if (className != null && className !== '') {
|
|
20
|
-
result.className = className;
|
|
21
|
-
}
|
|
22
|
-
if (style != null && Object.keys(style).length > 0) {
|
|
23
|
-
result.style = style;
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
16
|
function attrs() {
|
|
28
17
|
const {
|
|
29
18
|
className,
|
|
19
|
+
'data-style-src': dataStyleSrc,
|
|
30
20
|
style
|
|
31
21
|
} = props(...arguments);
|
|
32
22
|
const result = {};
|
|
@@ -36,24 +26,46 @@ function attrs() {
|
|
|
36
26
|
if (style != null && Object.keys(style).length > 0) {
|
|
37
27
|
result.style = Object.keys(style).map(key => `${key}:${style[key]};`).join('');
|
|
38
28
|
}
|
|
29
|
+
if (dataStyleSrc != null && dataStyleSrc !== '') {
|
|
30
|
+
result['data-style-src'] = dataStyleSrc;
|
|
31
|
+
}
|
|
39
32
|
return result;
|
|
40
33
|
}
|
|
41
|
-
function stylexCreate(_styles) {
|
|
34
|
+
const create = exports.create = function stylexCreate(_styles) {
|
|
42
35
|
throw errorForFn('create');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
throw errorForFn('defineVars');
|
|
46
|
-
}
|
|
47
|
-
const stylexCreateTheme = (_baseTokens, _overrides) => {
|
|
36
|
+
};
|
|
37
|
+
const createTheme = (_baseTokens, _overrides) => {
|
|
48
38
|
throw errorForFn('createTheme');
|
|
49
39
|
};
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
exports.createTheme = createTheme;
|
|
41
|
+
const defineVars = exports.defineVars = function stylexDefineVars(_styles) {
|
|
42
|
+
throw errorForFn('defineVars');
|
|
43
|
+
};
|
|
44
|
+
const firstThatWorks = function () {
|
|
45
|
+
throw errorForFn('firstThatWorks');
|
|
52
46
|
};
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
exports.firstThatWorks = firstThatWorks;
|
|
48
|
+
const keyframes = _keyframes => {
|
|
49
|
+
throw errorForFn('keyframes');
|
|
50
|
+
};
|
|
51
|
+
exports.keyframes = keyframes;
|
|
52
|
+
function props() {
|
|
53
|
+
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
54
|
+
styles[_key] = arguments[_key];
|
|
55
|
+
}
|
|
56
|
+
const [className, style, dataStyleSrc] = (0, _styleq.styleq)(styles);
|
|
57
|
+
const result = {};
|
|
58
|
+
if (className != null && className !== '') {
|
|
59
|
+
result.className = className;
|
|
60
|
+
}
|
|
61
|
+
if (style != null && Object.keys(style).length > 0) {
|
|
62
|
+
result.style = style;
|
|
63
|
+
}
|
|
64
|
+
if (dataStyleSrc != null && dataStyleSrc !== '') {
|
|
65
|
+
result['data-style-src'] = dataStyleSrc;
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
57
69
|
const types = exports.types = {
|
|
58
70
|
angle: _v => {
|
|
59
71
|
throw errorForType('angle');
|
|
@@ -95,29 +107,19 @@ const types = exports.types = {
|
|
|
95
107
|
throw errorForType('transformList');
|
|
96
108
|
}
|
|
97
109
|
};
|
|
98
|
-
|
|
99
|
-
throw errorForFn('keyframes');
|
|
100
|
-
};
|
|
101
|
-
exports.keyframes = keyframes;
|
|
102
|
-
const firstThatWorks = function () {
|
|
103
|
-
throw errorForFn('firstThatWorks');
|
|
104
|
-
};
|
|
105
|
-
exports.firstThatWorks = firstThatWorks;
|
|
106
|
-
function _stylex() {
|
|
110
|
+
function _legacyMerge() {
|
|
107
111
|
for (var _len2 = arguments.length, styles = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
108
112
|
styles[_key2] = arguments[_key2];
|
|
109
113
|
}
|
|
110
114
|
const [className] = (0, _styleq.styleq)(styles);
|
|
111
115
|
return className;
|
|
112
116
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const legacyMerge = exports.legacyMerge = _stylex;
|
|
123
|
-
var _default = exports.default = _stylex;
|
|
117
|
+
_legacyMerge.attrs = attrs;
|
|
118
|
+
_legacyMerge.create = create;
|
|
119
|
+
_legacyMerge.createTheme = createTheme;
|
|
120
|
+
_legacyMerge.defineVars = defineVars;
|
|
121
|
+
_legacyMerge.firstThatWorks = firstThatWorks;
|
|
122
|
+
_legacyMerge.keyframes = keyframes;
|
|
123
|
+
_legacyMerge.props = props;
|
|
124
|
+
_legacyMerge.types = types;
|
|
125
|
+
const legacyMerge = exports.legacyMerge = _legacyMerge;
|
package/lib/stylex.js.flow
CHANGED
|
@@ -8,52 +8,33 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
|
+
CompiledStyles,
|
|
12
|
+
InlineStyles,
|
|
11
13
|
Keyframes,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
StaticStyles,
|
|
15
|
+
StaticStylesWithout,
|
|
16
|
+
StyleX$Create,
|
|
14
17
|
StyleX$CreateTheme,
|
|
18
|
+
StyleX$DefineVars,
|
|
15
19
|
StyleXArray,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
StyleXStyles,
|
|
21
|
+
StyleXStylesWithout,
|
|
22
|
+
Theme,
|
|
23
|
+
VarGroup,
|
|
19
24
|
} from './StyleXTypes';
|
|
20
|
-
import type {
|
|
21
|
-
|
|
22
|
-
Angle,
|
|
23
|
-
Color,
|
|
24
|
-
Url,
|
|
25
|
-
Image,
|
|
26
|
-
Integer,
|
|
27
|
-
LengthPercentage,
|
|
28
|
-
Length,
|
|
29
|
-
Percentage,
|
|
30
|
-
Num,
|
|
31
|
-
Resolution,
|
|
32
|
-
Time,
|
|
33
|
-
TransformFunction,
|
|
34
|
-
TransformList,
|
|
35
|
-
} from './VarTypes';
|
|
25
|
+
import type { ValueWithDefault } from './util-types';
|
|
26
|
+
import * as Types from './VarTypes';
|
|
36
27
|
|
|
37
28
|
export type {
|
|
38
|
-
VarGroup,
|
|
39
|
-
Theme,
|
|
40
|
-
StyleXStyles,
|
|
41
|
-
StyleXStylesWithout,
|
|
42
29
|
StaticStyles,
|
|
43
30
|
StaticStylesWithout,
|
|
44
|
-
|
|
31
|
+
StyleXStyles,
|
|
32
|
+
StyleXStylesWithout,
|
|
33
|
+
Theme,
|
|
34
|
+
Types,
|
|
35
|
+
VarGroup,
|
|
36
|
+
};
|
|
45
37
|
|
|
46
|
-
declare export function props(
|
|
47
|
-
this: ?mixed,
|
|
48
|
-
...styles: $ReadOnlyArray<
|
|
49
|
-
StyleXArray<
|
|
50
|
-
?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
|
|
51
|
-
>,
|
|
52
|
-
>
|
|
53
|
-
): $ReadOnly<{
|
|
54
|
-
className?: string,
|
|
55
|
-
style?: $ReadOnly<{ [string]: string | number }>,
|
|
56
|
-
}>;
|
|
57
38
|
declare export function attrs(
|
|
58
39
|
...styles: $ReadOnlyArray<
|
|
59
40
|
StyleXArray<
|
|
@@ -62,79 +43,75 @@ declare export function attrs(
|
|
|
62
43
|
>
|
|
63
44
|
): $ReadOnly<{
|
|
64
45
|
class?: string,
|
|
46
|
+
'data-style-src'?: string,
|
|
65
47
|
style?: string,
|
|
66
48
|
}>;
|
|
67
49
|
|
|
68
|
-
|
|
69
|
-
TStyles: { +[string]: StyleXClassNameFor<string, mixed> },
|
|
70
|
-
>(
|
|
71
|
-
styles: TStyles,
|
|
72
|
-
) => {
|
|
73
|
-
+[Key in keyof TStyles]: TStyles[Key] extends StyleXClassNameFor<
|
|
74
|
-
mixed,
|
|
75
|
-
infer V,
|
|
76
|
-
>
|
|
77
|
-
? V
|
|
78
|
-
: string,
|
|
79
|
-
};
|
|
50
|
+
declare export const create: StyleX$Create;
|
|
80
51
|
|
|
81
|
-
declare export const
|
|
52
|
+
declare export const createTheme: StyleX$CreateTheme;
|
|
82
53
|
|
|
83
54
|
declare export const defineVars: StyleX$DefineVars;
|
|
84
55
|
|
|
85
|
-
declare export const
|
|
56
|
+
declare export const firstThatWorks: <T: string | number>(
|
|
57
|
+
..._styles: $ReadOnlyArray<T>
|
|
58
|
+
) => $ReadOnlyArray<T>;
|
|
86
59
|
|
|
87
|
-
declare export const
|
|
60
|
+
declare export const keyframes: (_keyframes: Keyframes) => string;
|
|
61
|
+
|
|
62
|
+
declare export function props(
|
|
63
|
+
this: ?mixed,
|
|
64
|
+
...styles: $ReadOnlyArray<
|
|
65
|
+
StyleXArray<
|
|
66
|
+
?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
|
|
67
|
+
>,
|
|
68
|
+
>
|
|
69
|
+
): $ReadOnly<{
|
|
70
|
+
className?: string,
|
|
71
|
+
'data-style-src'?: string,
|
|
72
|
+
style?: $ReadOnly<{ [string]: string | number }>,
|
|
73
|
+
}>;
|
|
88
74
|
|
|
89
75
|
declare export const types: {
|
|
90
|
-
angle: <T: string | 0 = string | 0>(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
76
|
+
angle: <T: string | 0 = string | 0>(
|
|
77
|
+
_v: ValueWithDefault<T>,
|
|
78
|
+
) => Types.Angle<T>,
|
|
79
|
+
color: <T: string = string>(_v: ValueWithDefault<T>) => Types.Color<T>,
|
|
80
|
+
url: <T: string = string>(_v: ValueWithDefault<T>) => Types.Url<T>,
|
|
81
|
+
image: <T: string = string>(_v: ValueWithDefault<T>) => Types.Image<T>,
|
|
94
82
|
integer: <T: number | string = number | string>(
|
|
95
83
|
_v: ValueWithDefault<T>,
|
|
96
|
-
) => Integer<T>,
|
|
84
|
+
) => Types.Integer<T>,
|
|
97
85
|
lengthPercentage: <T: number | string = number | string>(
|
|
98
86
|
_v: ValueWithDefault<T>,
|
|
99
|
-
) => LengthPercentage<T>,
|
|
87
|
+
) => Types.LengthPercentage<T>,
|
|
100
88
|
length: <T: number | string = number | string>(
|
|
101
89
|
_v: ValueWithDefault<T>,
|
|
102
|
-
) => Length<T>,
|
|
90
|
+
) => Types.Length<T>,
|
|
103
91
|
percentage: <T: number | string = number | string>(
|
|
104
92
|
_v: ValueWithDefault<T>,
|
|
105
|
-
) => Percentage<T>,
|
|
93
|
+
) => Types.Percentage<T>,
|
|
106
94
|
number: <T: number | string = number | string>(
|
|
107
95
|
_v: ValueWithDefault<T>,
|
|
108
|
-
) => Num<T>,
|
|
109
|
-
resolution: <T: string = string>(
|
|
110
|
-
|
|
96
|
+
) => Types.Num<T>,
|
|
97
|
+
resolution: <T: string = string>(
|
|
98
|
+
_v: ValueWithDefault<T>,
|
|
99
|
+
) => Types.Resolution<T>,
|
|
100
|
+
time: <T: string | 0 = string | 0>(_v: ValueWithDefault<T>) => Types.Time<T>,
|
|
111
101
|
transformFunction: <T: string = string>(
|
|
112
102
|
_v: ValueWithDefault<T>,
|
|
113
|
-
) => TransformFunction<T>,
|
|
103
|
+
) => Types.TransformFunction<T>,
|
|
114
104
|
transformList: <T: string = string>(
|
|
115
105
|
_v: ValueWithDefault<T>,
|
|
116
|
-
) => TransformList<T>,
|
|
106
|
+
) => Types.TransformList<T>,
|
|
117
107
|
};
|
|
118
108
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
..._styles: $ReadOnlyArray<T>
|
|
123
|
-
) => $ReadOnlyArray<T>;
|
|
109
|
+
/**
|
|
110
|
+
* DO NOT USE. Legacy export for Meta
|
|
111
|
+
*/
|
|
124
112
|
|
|
125
113
|
type IStyleX = {
|
|
126
114
|
(...styles: $ReadOnlyArray<StyleXArray<?CompiledStyles | boolean>>): string,
|
|
127
|
-
props: (
|
|
128
|
-
this: ?mixed,
|
|
129
|
-
...styles: $ReadOnlyArray<
|
|
130
|
-
StyleXArray<
|
|
131
|
-
?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
|
|
132
|
-
>,
|
|
133
|
-
>
|
|
134
|
-
) => $ReadOnly<{
|
|
135
|
-
className?: string,
|
|
136
|
-
style?: $ReadOnly<{ [string]: string | number }>,
|
|
137
|
-
}>,
|
|
138
115
|
attrs: (
|
|
139
116
|
...styles: $ReadOnlyArray<
|
|
140
117
|
StyleXArray<
|
|
@@ -143,20 +120,31 @@ type IStyleX = {
|
|
|
143
120
|
>
|
|
144
121
|
) => $ReadOnly<{
|
|
145
122
|
class?: string,
|
|
123
|
+
'data-style-src'?: string,
|
|
146
124
|
style?: string,
|
|
147
125
|
}>,
|
|
148
|
-
create:
|
|
149
|
-
defineVars: StyleX$DefineVars,
|
|
126
|
+
create: StyleX$Create,
|
|
150
127
|
createTheme: StyleX$CreateTheme,
|
|
151
|
-
|
|
152
|
-
types: typeof types,
|
|
128
|
+
defineVars: StyleX$DefineVars,
|
|
153
129
|
firstThatWorks: <T: string | number>(
|
|
154
130
|
...v: $ReadOnlyArray<T>
|
|
155
131
|
) => $ReadOnlyArray<T>,
|
|
156
132
|
keyframes: (keyframes: Keyframes) => string,
|
|
133
|
+
props: (
|
|
134
|
+
this: ?mixed,
|
|
135
|
+
...styles: $ReadOnlyArray<
|
|
136
|
+
StyleXArray<
|
|
137
|
+
?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
|
|
138
|
+
>,
|
|
139
|
+
>
|
|
140
|
+
) => $ReadOnly<{
|
|
141
|
+
className?: string,
|
|
142
|
+
'data-style-src'?: string,
|
|
143
|
+
style?: $ReadOnly<{ [string]: string | number }>,
|
|
144
|
+
}>,
|
|
145
|
+
types: typeof types,
|
|
157
146
|
__customProperties?: { [string]: mixed },
|
|
158
147
|
...
|
|
159
148
|
};
|
|
160
149
|
|
|
161
150
|
declare export const legacyMerge: IStyleX;
|
|
162
|
-
declare export default IStyleX;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export type ValueWithDefault<T> =
|
|
11
|
+
| T
|
|
12
|
+
| Readonly<{
|
|
13
|
+
default: ValueWithDefault<T>;
|
|
14
|
+
[$$Key$$: string]: ValueWithDefault<T>;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type ValueWithDefault<+T> =
|
|
11
|
+
| T
|
|
12
|
+
| $ReadOnly<{
|
|
13
|
+
default: ValueWithDefault<T>,
|
|
14
|
+
[string]: ValueWithDefault<T>,
|
|
15
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/stylex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "A library for defining styles for optimized user interfaces.",
|
|
5
5
|
"main": "./lib/stylex.js",
|
|
6
6
|
"module": "./lib/es/stylex.mjs",
|
|
@@ -42,11 +42,28 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"css-mediaquery": "^0.1.2",
|
|
44
44
|
"invariant": "^2.2.4",
|
|
45
|
-
"styleq": "0.1
|
|
45
|
+
"styleq": "0.2.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
48
|
+
"@babel/cli": "^7.26.4",
|
|
49
|
+
"@babel/core": "^7.26.8",
|
|
50
|
+
"@babel/eslint-parser": "^7.26.8",
|
|
51
|
+
"@babel/plugin-syntax-flow": "^7.26.0",
|
|
52
|
+
"@babel/preset-env": "^7.26.8",
|
|
53
|
+
"@babel/preset-flow": "^7.25.9",
|
|
54
|
+
"@babel/preset-react": "^7.26.3",
|
|
55
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
56
|
+
"@babel/types": "^7.26.8",
|
|
57
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
58
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
59
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
60
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
61
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
62
|
+
"@rollup/plugin-replace": "^6.0.1",
|
|
63
|
+
"@stylexjs/scripts": "0.11.1",
|
|
64
|
+
"babel-plugin-syntax-hermes-parser": "^0.26.0",
|
|
65
|
+
"cross-env": "^7.0.3",
|
|
66
|
+
"rollup": "^4.24.0"
|
|
50
67
|
},
|
|
51
68
|
"jest": {},
|
|
52
69
|
"files": [
|