@stylexjs/stylex 0.2.0-beta.22 → 0.2.0-beta.24

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.
@@ -858,6 +858,7 @@ export type CSSProperties = Readonly<{
858
858
  WebkitAppearance?: null | appearance;
859
859
  WebkitFontSmoothing?: null | 'antialiased';
860
860
  WebkitTapHighlightColor?: null | color;
861
+ aspectRatio?: null | number | string;
861
862
  alignContent?: null | alignContent;
862
863
  alignItems?: null | alignItems;
863
864
  alignSelf?: null | alignSelf;
@@ -878,6 +878,7 @@ export type CSSProperties = $ReadOnly<{
878
878
  WebkitTapHighlightColor?: null | color,
879
879
  // ENDOF ...$Exact<SupportedVendorSpecificCSSProperties>,
880
880
 
881
+ aspectRatio?: null | number | string,
881
882
  alignContent?: null | alignContent,
882
883
  alignItems?: null | alignItems,
883
884
  alignSelf?: null | alignSelf,
@@ -7,7 +7,7 @@
7
7
  *
8
8
  */
9
9
 
10
- export type SpreadOptions = {
10
+ export type SpreadOptions = Readonly<{
11
11
  customProperties: {};
12
12
  inheritedFontSize: null | undefined | number;
13
13
  fontScale: number | void;
@@ -16,4 +16,4 @@ export type SpreadOptions = {
16
16
  viewportHeight: number;
17
17
  viewportWidth: number;
18
18
  writingDirection: 'ltr' | 'rtl';
19
- };
19
+ }>;
@@ -7,7 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- export type SpreadOptions = {|
10
+ export type SpreadOptions = $ReadOnly<{
11
11
  customProperties: {},
12
12
  inheritedFontSize: ?number,
13
13
  fontScale: number | void,
@@ -16,4 +16,4 @@ export type SpreadOptions = {|
16
16
  viewportHeight: number,
17
17
  viewportWidth: number,
18
18
  writingDirection: 'ltr' | 'rtl',
19
- |};
19
+ }>;
@@ -22,7 +22,7 @@ function resolveColorValue(colorValue) {
22
22
  color: colorValue
23
23
  }
24
24
  });
25
- return _stylex.stylex.props(styles.root, mockOptions).style.color;
25
+ return _stylex.stylex.props.call(mockOptions, styles.root).style.color;
26
26
  }
27
27
  describe('stylex CSSCustomProperty value test', () => {
28
28
  beforeEach(() => {
@@ -52,7 +52,7 @@ describe('stylex CSSCustomProperty value test', () => {
52
52
  boxShadow: 'var(--boxShadowVar1, 0px 0px 0px black)'
53
53
  }
54
54
  });
55
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
55
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
56
56
  });
57
57
  test('falls back to a default value with spaces', () => {
58
58
  const styles = _stylex.stylex.create({
@@ -60,7 +60,7 @@ describe('stylex CSSCustomProperty value test', () => {
60
60
  boxShadow: 'var(--boxShadowVarNotFound, 0px 0px 0px black)'
61
61
  }
62
62
  });
63
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
63
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
64
64
  });
65
65
  test('parses and falls back to default value containing a variable', () => {
66
66
  const styles = _stylex.stylex.create({
@@ -68,7 +68,7 @@ describe('stylex CSSCustomProperty value test', () => {
68
68
  color: 'var(--colorNotFound, var(--testVar2))'
69
69
  }
70
70
  });
71
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
71
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
72
72
  });
73
73
  test('parses and falls back to a default value containing spaces and embedded variables', () => {
74
74
  const styles = _stylex.stylex.create({
@@ -76,7 +76,7 @@ describe('stylex CSSCustomProperty value test', () => {
76
76
  boxShadow: 'var(--boxShadowVarNotFound, 0px 0px 0px var(--testVar2))'
77
77
  }
78
78
  });
79
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
79
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
80
80
  });
81
81
  test('does not parse malformed vars', () => {
82
82
  expect(resolveColorValue('var(--testUnfinished')).toEqual('var(--testUnfinished');
@@ -93,9 +93,9 @@ describe('stylex CSSCustomProperty value test', () => {
93
93
  borderWidth: 'var(--rawNumber)'
94
94
  }
95
95
  });
96
- const rootStyle = _stylex.stylex.props(styles.root, mockOptions).style;
96
+ const rootStyle = _stylex.stylex.props.call(mockOptions, styles.root).style;
97
97
  expect(rootStyle.borderWidth).toEqual(10);
98
- expect(_stylex.stylex.props(styles.withVars, mockOptions).style.borderWidth).toEqual(rootStyle.borderWidth);
98
+ expect(_stylex.stylex.props.call(mockOptions, styles.withVars).style.borderWidth).toEqual(rootStyle.borderWidth);
99
99
  });
100
100
  test('value lookup with pixel prop conversion', () => {
101
101
  const styles = _stylex.stylex.create({
@@ -106,9 +106,9 @@ describe('stylex CSSCustomProperty value test', () => {
106
106
  borderWidth: 'var(--pixelNumber)'
107
107
  }
108
108
  });
109
- const rootStyle = _stylex.stylex.props(styles.root, mockOptions).style;
109
+ const rootStyle = _stylex.stylex.props.call(mockOptions, styles.root).style;
110
110
  expect(rootStyle.borderWidth).toEqual(10);
111
- expect(_stylex.stylex.props(styles.withVars, mockOptions).style.borderWidth).toEqual(rootStyle.borderWidth);
111
+ expect(_stylex.stylex.props.call(mockOptions, styles.withVars).style.borderWidth).toEqual(rootStyle.borderWidth);
112
112
  });
113
113
  test('value lookup with em prop conversion', () => {
114
114
  const styles = _stylex.stylex.create({
@@ -119,9 +119,9 @@ describe('stylex CSSCustomProperty value test', () => {
119
119
  fontSize: 'var(--emNumber)'
120
120
  }
121
121
  });
122
- const rootStyle = _stylex.stylex.props(styles.root, mockOptions).style;
122
+ const rootStyle = _stylex.stylex.props.call(mockOptions, styles.root).style;
123
123
  expect(rootStyle.fontSize).toEqual(160);
124
- expect(_stylex.stylex.props(styles.withVars, mockOptions).style.fontSize).toEqual(rootStyle.fontSize);
124
+ expect(_stylex.stylex.props.call(mockOptions, styles.withVars).style.fontSize).toEqual(rootStyle.fontSize);
125
125
  });
126
126
  test('prop lookup with ref', () => {
127
127
  const styles = _stylex.stylex.create({
@@ -132,9 +132,9 @@ describe('stylex CSSCustomProperty value test', () => {
132
132
  borderWidth: 'var(--refToPixelNumber)'
133
133
  }
134
134
  });
135
- const rootStyle = _stylex.stylex.props(styles.root, mockOptions).style;
135
+ const rootStyle = _stylex.stylex.props.call(mockOptions, styles.root).style;
136
136
  expect(rootStyle.borderWidth).toEqual(10);
137
- expect(_stylex.stylex.props(styles.withVars, mockOptions).style.borderWidth).toEqual(rootStyle.borderWidth);
137
+ expect(_stylex.stylex.props.call(mockOptions, styles.withVars).style.borderWidth).toEqual(rootStyle.borderWidth);
138
138
  });
139
139
  test('prop lookup with ref to ref', () => {
140
140
  const styles = _stylex.stylex.create({
@@ -142,7 +142,7 @@ describe('stylex CSSCustomProperty value test', () => {
142
142
  borderWidth: 'var(--refToRefToRawNumber)'
143
143
  }
144
144
  });
145
- const rootStyle = _stylex.stylex.props(styles.root, mockOptions).style;
145
+ const rootStyle = _stylex.stylex.props.call(mockOptions, styles.root).style;
146
146
  expect(rootStyle.borderWidth).toEqual(10);
147
147
  });
148
148
  });
@@ -21,7 +21,7 @@ describe('styles', () => {
21
21
  animationDelay: '0.3s'
22
22
  }
23
23
  });
24
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
24
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
25
25
  });
26
26
  test('animation-duration', () => {
27
27
  const styles = _stylex.stylex.create({
@@ -29,7 +29,7 @@ describe('styles', () => {
29
29
  animationDuration: '0.5s'
30
30
  }
31
31
  });
32
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
32
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
33
33
  });
34
34
  test('background-image', () => {
35
35
  const styles = _stylex.stylex.create({
@@ -37,7 +37,7 @@ describe('styles', () => {
37
37
  backgroundImage: 'url(https://placehold.it/300/300'
38
38
  }
39
39
  });
40
- _stylex.stylex.props(styles.root, mockOptions);
40
+ _stylex.stylex.props.call(mockOptions, styles.root);
41
41
  expect(console.warn).toHaveBeenCalled();
42
42
  });
43
43
  test('border-style', () => {
@@ -50,8 +50,8 @@ describe('styles', () => {
50
50
  borderStyle: 'solid'
51
51
  }
52
52
  });
53
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
54
- expect(_stylex.stylex.props([styles.root, styles.override], mockOptions)).toMatchSnapshot();
53
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
54
+ expect(_stylex.stylex.props.call(mockOptions, styles.root, styles.override)).toMatchSnapshot();
55
55
  });
56
56
  test('box-shadow', () => {
57
57
  const styles = _stylex.stylex.create({
@@ -59,20 +59,20 @@ describe('styles', () => {
59
59
  boxShadow: '1px 2px 3px 4px red'
60
60
  }
61
61
  });
62
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
62
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
63
63
  const styles2 = _stylex.stylex.create({
64
64
  root: {
65
65
  boxShadow: '1px 2px 3px 4px red, 2px 3px 4px 5px blue'
66
66
  }
67
67
  });
68
- _stylex.stylex.props(styles2.root, mockOptions);
68
+ _stylex.stylex.props.call(mockOptions, styles2.root);
69
69
  expect(console.warn).toHaveBeenCalledTimes(1);
70
70
  const styles3 = _stylex.stylex.create({
71
71
  root: {
72
72
  boxShadow: 'inset 1px 2px 3px 4px red'
73
73
  }
74
74
  });
75
- _stylex.stylex.props(styles3.root, mockOptions);
75
+ _stylex.stylex.props.call(mockOptions, styles3.root);
76
76
  expect(console.warn).toHaveBeenCalledTimes(2);
77
77
  });
78
78
  test('box-sizing: content-box', () => {
@@ -142,15 +142,15 @@ describe('styles', () => {
142
142
  width: 'auto'
143
143
  }
144
144
  });
145
- expect(_stylex.stylex.props(styles.width, mockOptions)).toMatchSnapshot('width');
146
- expect(_stylex.stylex.props(styles.height, mockOptions)).toMatchSnapshot('height');
147
- expect(_stylex.stylex.props(styles.maxWidth, mockOptions)).toMatchSnapshot('maxWidth');
148
- expect(_stylex.stylex.props(styles.maxHeight, mockOptions)).toMatchSnapshot('maxHeight');
149
- expect(_stylex.stylex.props(styles.minWidth, mockOptions)).toMatchSnapshot('minWidth');
150
- expect(_stylex.stylex.props(styles.minHeight, mockOptions)).toMatchSnapshot('minHeight');
151
- expect(_stylex.stylex.props(styles.units, mockOptions)).toMatchSnapshot('units');
152
- expect(_stylex.stylex.props(styles.allDifferent, mockOptions)).toMatchSnapshot('allDifferent');
153
- expect(_stylex.stylex.props(styles.auto, mockOptions)).toMatchSnapshot('auto');
145
+ expect(_stylex.stylex.props.call(mockOptions, styles.width)).toMatchSnapshot('width');
146
+ expect(_stylex.stylex.props.call(mockOptions, styles.height)).toMatchSnapshot('height');
147
+ expect(_stylex.stylex.props.call(mockOptions, styles.maxWidth)).toMatchSnapshot('maxWidth');
148
+ expect(_stylex.stylex.props.call(mockOptions, styles.maxHeight)).toMatchSnapshot('maxHeight');
149
+ expect(_stylex.stylex.props.call(mockOptions, styles.minWidth)).toMatchSnapshot('minWidth');
150
+ expect(_stylex.stylex.props.call(mockOptions, styles.minHeight)).toMatchSnapshot('minHeight');
151
+ expect(_stylex.stylex.props.call(mockOptions, styles.units)).toMatchSnapshot('units');
152
+ expect(_stylex.stylex.props.call(mockOptions, styles.allDifferent)).toMatchSnapshot('allDifferent');
153
+ expect(_stylex.stylex.props.call(mockOptions, styles.auto)).toMatchSnapshot('auto');
154
154
  });
155
155
  test('direction', () => {
156
156
  const styles = _stylex.stylex.create({
@@ -158,13 +158,13 @@ describe('styles', () => {
158
158
  direction: 'ltr'
159
159
  }
160
160
  });
161
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
161
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
162
162
  const styles2 = _stylex.stylex.create({
163
163
  root: {
164
164
  direction: 'rtl'
165
165
  }
166
166
  });
167
- expect(_stylex.stylex.props(styles2.root, mockOptions)).toMatchSnapshot();
167
+ expect(_stylex.stylex.props.call(mockOptions, styles2.root)).toMatchSnapshot();
168
168
  });
169
169
  test('font-size', () => {
170
170
  const styles = _stylex.stylex.create({
@@ -172,11 +172,11 @@ describe('styles', () => {
172
172
  fontSize: '2.5rem'
173
173
  }
174
174
  });
175
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot('default');
176
- expect(_stylex.stylex.props(styles.root, {
175
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot('default');
176
+ expect(_stylex.stylex.props.call({
177
177
  ...mockOptions,
178
178
  fontScale: 2
179
- })).toMatchSnapshot('fontScale:2');
179
+ }, styles.root)).toMatchSnapshot('fontScale:2');
180
180
  });
181
181
  test('font-variant', () => {
182
182
  const styles = _stylex.stylex.create({
@@ -184,7 +184,7 @@ describe('styles', () => {
184
184
  fontVariant: 'common-ligatures small-caps'
185
185
  }
186
186
  });
187
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
187
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
188
188
  });
189
189
  test('font-weight', () => {
190
190
  const styles = _stylex.stylex.create({
@@ -192,13 +192,13 @@ describe('styles', () => {
192
192
  fontWeight: 900
193
193
  }
194
194
  });
195
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
195
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
196
196
  const styles2 = _stylex.stylex.create({
197
197
  root: {
198
198
  fontWeight: 'bold'
199
199
  }
200
200
  });
201
- expect(_stylex.stylex.props(styles2.root, mockOptions)).toMatchSnapshot();
201
+ expect(_stylex.stylex.props.call(mockOptions, styles2.root)).toMatchSnapshot();
202
202
  });
203
203
  test('line-clamp', () => {
204
204
  const styles = _stylex.stylex.create({
@@ -206,7 +206,7 @@ describe('styles', () => {
206
206
  lineClamp: 3
207
207
  }
208
208
  });
209
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
209
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
210
210
  });
211
211
  test('line-height', () => {
212
212
  const styles = _stylex.stylex.create({
@@ -223,10 +223,10 @@ describe('styles', () => {
223
223
  lineHeight: '24px'
224
224
  }
225
225
  });
226
- expect(_stylex.stylex.props(styles.numeric, mockOptions)).toMatchSnapshot('unitless number');
227
- expect(_stylex.stylex.props(styles.string, mockOptions)).toMatchSnapshot('unitless string');
228
- expect(_stylex.stylex.props(styles.rem, mockOptions)).toMatchSnapshot('rem');
229
- expect(_stylex.stylex.props(styles.px, mockOptions)).toMatchSnapshot('px');
226
+ expect(_stylex.stylex.props.call(mockOptions, styles.numeric)).toMatchSnapshot('unitless number');
227
+ expect(_stylex.stylex.props.call(mockOptions, styles.string)).toMatchSnapshot('unitless string');
228
+ expect(_stylex.stylex.props.call(mockOptions, styles.rem)).toMatchSnapshot('rem');
229
+ expect(_stylex.stylex.props.call(mockOptions, styles.px)).toMatchSnapshot('px');
230
230
  });
231
231
  test('object-fit', () => {
232
232
  const styles = _stylex.stylex.create({
@@ -246,11 +246,11 @@ describe('styles', () => {
246
246
  objectFit: 'none'
247
247
  }
248
248
  });
249
- expect(_stylex.stylex.props(styles.contain, mockOptions)).toMatchSnapshot('contain');
250
- expect(_stylex.stylex.props(styles.cover, mockOptions)).toMatchSnapshot('contain');
251
- expect(_stylex.stylex.props(styles.fill, mockOptions)).toMatchSnapshot('fill');
252
- expect(_stylex.stylex.props(styles.scaleDown, mockOptions)).toMatchSnapshot('scaleDown');
253
- expect(_stylex.stylex.props(styles.none, mockOptions)).toMatchSnapshot('none');
249
+ expect(_stylex.stylex.props.call(mockOptions, styles.contain)).toMatchSnapshot('contain');
250
+ expect(_stylex.stylex.props.call(mockOptions, styles.cover)).toMatchSnapshot('contain');
251
+ expect(_stylex.stylex.props.call(mockOptions, styles.fill)).toMatchSnapshot('fill');
252
+ expect(_stylex.stylex.props.call(mockOptions, styles.scaleDown)).toMatchSnapshot('scaleDown');
253
+ expect(_stylex.stylex.props.call(mockOptions, styles.none)).toMatchSnapshot('none');
254
254
  });
255
255
  test('pointer-events', () => {
256
256
  const styles = _stylex.stylex.create({
@@ -258,7 +258,7 @@ describe('styles', () => {
258
258
  pointerEvents: 'none'
259
259
  }
260
260
  });
261
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
261
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
262
262
  });
263
263
  test('position', () => {
264
264
  const styles = _stylex.stylex.create({
@@ -278,11 +278,11 @@ describe('styles', () => {
278
278
  position: 'sticky'
279
279
  }
280
280
  });
281
- expect(_stylex.stylex.props(styles.static, mockOptions)).toMatchSnapshot('static');
282
- expect(_stylex.stylex.props(styles.relative, mockOptions)).toMatchSnapshot('relative');
283
- expect(_stylex.stylex.props(styles.absolute, mockOptions)).toMatchSnapshot('absolute');
284
- expect(_stylex.stylex.props(styles.fixed, mockOptions)).toMatchSnapshot('fixed');
285
- expect(_stylex.stylex.props(styles.sticky, mockOptions)).toMatchSnapshot('sticky');
281
+ expect(_stylex.stylex.props.call(mockOptions, styles.static)).toMatchSnapshot('static');
282
+ expect(_stylex.stylex.props.call(mockOptions, styles.relative)).toMatchSnapshot('relative');
283
+ expect(_stylex.stylex.props.call(mockOptions, styles.absolute)).toMatchSnapshot('absolute');
284
+ expect(_stylex.stylex.props.call(mockOptions, styles.fixed)).toMatchSnapshot('fixed');
285
+ expect(_stylex.stylex.props.call(mockOptions, styles.sticky)).toMatchSnapshot('sticky');
286
286
  expect(console.warn).toHaveBeenCalledTimes(3);
287
287
  });
288
288
  test('text-shadow', () => {
@@ -291,13 +291,13 @@ describe('styles', () => {
291
291
  textShadow: '1px 2px 3px red'
292
292
  }
293
293
  });
294
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
294
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
295
295
  const styles2 = _stylex.stylex.create({
296
296
  root: {
297
297
  textShadow: '1px 2px 3px red, 2px 3px 4px blue'
298
298
  }
299
299
  });
300
- expect(_stylex.stylex.props(styles2.root, mockOptions)).toMatchSnapshot();
300
+ expect(_stylex.stylex.props.call(mockOptions, styles2.root)).toMatchSnapshot();
301
301
  expect(console.warn).toHaveBeenCalledTimes(1);
302
302
  });
303
303
  test('transform', () => {
@@ -331,15 +331,15 @@ describe('styles', () => {
331
331
  `
332
332
  }
333
333
  });
334
- expect(_stylex.stylex.props(styles.none, mockOptions)).toMatchSnapshot('none');
335
- expect(_stylex.stylex.props(styles.matrix, mockOptions)).toMatchSnapshot('matrix');
336
- expect(_stylex.stylex.props(styles.perspective, mockOptions)).toMatchSnapshot('perspective');
337
- expect(_stylex.stylex.props(styles.rotate, mockOptions)).toMatchSnapshot('rotate');
338
- expect(_stylex.stylex.props(styles.scale, mockOptions)).toMatchSnapshot('scale');
339
- expect(_stylex.stylex.props(styles.skew, mockOptions)).toMatchSnapshot('skew');
340
- expect(_stylex.stylex.props(styles.translate, mockOptions)).toMatchSnapshot('translate');
341
- expect(_stylex.stylex.props(styles.rotate, mockOptions)).toMatchSnapshot('rotate');
342
- expect(_stylex.stylex.props(styles.mixed, mockOptions)).toMatchSnapshot('mixed');
334
+ expect(_stylex.stylex.props.call(mockOptions, styles.none)).toMatchSnapshot('none');
335
+ expect(_stylex.stylex.props.call(mockOptions, styles.matrix)).toMatchSnapshot('matrix');
336
+ expect(_stylex.stylex.props.call(mockOptions, styles.perspective)).toMatchSnapshot('perspective');
337
+ expect(_stylex.stylex.props.call(mockOptions, styles.rotate)).toMatchSnapshot('rotate');
338
+ expect(_stylex.stylex.props.call(mockOptions, styles.scale)).toMatchSnapshot('scale');
339
+ expect(_stylex.stylex.props.call(mockOptions, styles.skew)).toMatchSnapshot('skew');
340
+ expect(_stylex.stylex.props.call(mockOptions, styles.translate)).toMatchSnapshot('translate');
341
+ expect(_stylex.stylex.props.call(mockOptions, styles.rotate)).toMatchSnapshot('rotate');
342
+ expect(_stylex.stylex.props.call(mockOptions, styles.mixed)).toMatchSnapshot('mixed');
343
343
  });
344
344
  test('transition-delay', () => {
345
345
  const styles = _stylex.stylex.create({
@@ -347,7 +347,7 @@ describe('styles', () => {
347
347
  transitionDelay: '0.3s'
348
348
  }
349
349
  });
350
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
350
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
351
351
  });
352
352
  test('transition-duration', () => {
353
353
  const styles = _stylex.stylex.create({
@@ -355,7 +355,7 @@ describe('styles', () => {
355
355
  transitionDuration: '0.5s'
356
356
  }
357
357
  });
358
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
358
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
359
359
  });
360
360
  test('user-select', () => {
361
361
  const styles = _stylex.stylex.create({
@@ -363,7 +363,7 @@ describe('styles', () => {
363
363
  userSelect: 'none'
364
364
  }
365
365
  });
366
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
366
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
367
367
  });
368
368
  test('vertical-align', () => {
369
369
  const styles = _stylex.stylex.create({
@@ -374,8 +374,8 @@ describe('styles', () => {
374
374
  verticalAlign: 'top'
375
375
  }
376
376
  });
377
- expect(_stylex.stylex.props(styles.middle, mockOptions)).toMatchSnapshot('middle');
378
- expect(_stylex.stylex.props(styles.top, mockOptions)).toMatchSnapshot('top');
377
+ expect(_stylex.stylex.props.call(mockOptions, styles.middle)).toMatchSnapshot('middle');
378
+ expect(_stylex.stylex.props.call(mockOptions, styles.top)).toMatchSnapshot('top');
379
379
  });
380
380
  test(':hover syntax', () => {
381
381
  const styles = _stylex.stylex.create({
@@ -386,12 +386,12 @@ describe('styles', () => {
386
386
  }
387
387
  }
388
388
  });
389
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot('not hovered');
389
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot('not hovered');
390
390
  const hoverOptions = {
391
391
  ...mockOptions,
392
392
  hover: true
393
393
  };
394
- expect(_stylex.stylex.props(styles.root, hoverOptions)).toMatchSnapshot('hovered');
394
+ expect(_stylex.stylex.props.call(hoverOptions, styles.root)).toMatchSnapshot('hovered');
395
395
  });
396
396
  });
397
397
  describe('logical styles', () => {
@@ -407,18 +407,18 @@ describe('logical styles', () => {
407
407
  minBlockSize: '100px'
408
408
  }
409
409
  });
410
- expect(_stylex.stylex.props(styles.blockSize, mockOptions)).toMatchSnapshot('blockSize');
411
- expect(_stylex.stylex.props([{
410
+ expect(_stylex.stylex.props.call(mockOptions, styles.blockSize)).toMatchSnapshot('blockSize');
411
+ expect(_stylex.stylex.props.call(mockOptions, {
412
412
  height: 200
413
- }, styles.blockSize], mockOptions)).toMatchSnapshot('blockSize after height');
414
- expect(_stylex.stylex.props(styles.maxBlockSize, mockOptions)).toMatchSnapshot('maxBlockSize');
415
- expect(_stylex.stylex.props([{
413
+ }, styles.blockSize)).toMatchSnapshot('blockSize after height');
414
+ expect(_stylex.stylex.props.call(mockOptions, styles.maxBlockSize)).toMatchSnapshot('maxBlockSize');
415
+ expect(_stylex.stylex.props.call(mockOptions, {
416
416
  maxHeight: 200
417
- }, styles.maxBlockSize], mockOptions)).toMatchSnapshot('maxBlockSize after maxHeight');
418
- expect(_stylex.stylex.props(styles.minBlockSize, mockOptions)).toMatchSnapshot('minBlockSize');
419
- expect(_stylex.stylex.props([{
417
+ }, styles.maxBlockSize)).toMatchSnapshot('maxBlockSize after maxHeight');
418
+ expect(_stylex.stylex.props.call(mockOptions, styles.minBlockSize)).toMatchSnapshot('minBlockSize');
419
+ expect(_stylex.stylex.props.call(mockOptions, {
420
420
  minHeight: 200
421
- }, styles.minBlockSize], mockOptions)).toMatchSnapshot('minBlockSize after minHeight');
421
+ }, styles.minBlockSize)).toMatchSnapshot('minBlockSize after minHeight');
422
422
  });
423
423
  test('inlineSize', () => {
424
424
  const styles = _stylex.stylex.create({
@@ -432,18 +432,18 @@ describe('logical styles', () => {
432
432
  minInlineSize: '100px'
433
433
  }
434
434
  });
435
- expect(_stylex.stylex.props(styles.inlineSize, mockOptions)).toMatchSnapshot('inlineSize');
436
- expect(_stylex.stylex.props([{
435
+ expect(_stylex.stylex.props.call(mockOptions, styles.inlineSize)).toMatchSnapshot('inlineSize');
436
+ expect(_stylex.stylex.props.call(mockOptions, {
437
437
  width: 200
438
- }, styles.inlineSize], mockOptions)).toMatchSnapshot('inlineSize after width');
439
- expect(_stylex.stylex.props(styles.maxInlineSize, mockOptions)).toMatchSnapshot('maxInlineSize');
440
- expect(_stylex.stylex.props([{
438
+ }, styles.inlineSize)).toMatchSnapshot('inlineSize after width');
439
+ expect(_stylex.stylex.props.call(mockOptions, styles.maxInlineSize)).toMatchSnapshot('maxInlineSize');
440
+ expect(_stylex.stylex.props.call(mockOptions, {
441
441
  maxWidth: 200
442
- }, styles.maxInlineSize], mockOptions)).toMatchSnapshot('maxInlineSize after maxWidth');
443
- expect(_stylex.stylex.props(styles.minInlineSize, mockOptions)).toMatchSnapshot('minInlineSize');
444
- expect(_stylex.stylex.props([{
442
+ }, styles.maxInlineSize)).toMatchSnapshot('maxInlineSize after maxWidth');
443
+ expect(_stylex.stylex.props.call(mockOptions, styles.minInlineSize)).toMatchSnapshot('minInlineSize');
444
+ expect(_stylex.stylex.props.call(mockOptions, {
445
445
  minWidth: 200
446
- }, styles.minInlineSize], mockOptions)).toMatchSnapshot('minInlineSize after minWidth');
446
+ }, styles.minInlineSize)).toMatchSnapshot('minInlineSize after minWidth');
447
447
  });
448
448
  test('borderBlock', () => {
449
449
  const styles = _stylex.stylex.create({
@@ -463,11 +463,11 @@ describe('logical styles', () => {
463
463
  borderBlockStartWidth: 3
464
464
  }
465
465
  });
466
- expect(_stylex.stylex.props(styles.borderBlock, mockOptions)).toMatchSnapshot('borderBlock');
467
- expect(_stylex.stylex.props(styles.borderBlockEnd, mockOptions)).toMatchSnapshot('borderBlockEnd');
468
- expect(_stylex.stylex.props(styles.borderBlockStart, mockOptions)).toMatchSnapshot('borderBlockStart');
469
- expect(_stylex.stylex.props([styles.borderBlockEnd, styles.borderBlock], mockOptions)).toMatchSnapshot('borderBlock after borderBlockEnd');
470
- expect(_stylex.stylex.props([styles.borderBlockStart, styles.borderBlock], mockOptions)).toMatchSnapshot('borderBlock after borderBlockStart');
466
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderBlock)).toMatchSnapshot('borderBlock');
467
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderBlockEnd)).toMatchSnapshot('borderBlockEnd');
468
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderBlockStart)).toMatchSnapshot('borderBlockStart');
469
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderBlockEnd, styles.borderBlock)).toMatchSnapshot('borderBlock after borderBlockEnd');
470
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderBlockStart, styles.borderBlock)).toMatchSnapshot('borderBlock after borderBlockStart');
471
471
  });
472
472
  test('borderInline', () => {
473
473
  const styles = _stylex.stylex.create({
@@ -487,11 +487,11 @@ describe('logical styles', () => {
487
487
  borderInlineStartWidth: 3
488
488
  }
489
489
  });
490
- expect(_stylex.stylex.props(styles.borderInline, mockOptions)).toMatchSnapshot('borderInline');
491
- expect(_stylex.stylex.props(styles.borderInlineEnd, mockOptions)).toMatchSnapshot('borderInlineEnd');
492
- expect(_stylex.stylex.props(styles.borderInlineStart, mockOptions)).toMatchSnapshot('borderInlineStart');
493
- expect(_stylex.stylex.props([styles.borderInlineEnd, styles.borderInline], mockOptions)).toMatchSnapshot('borderInline after borderInlineEnd');
494
- expect(_stylex.stylex.props([styles.borderInlineStart, styles.borderInline], mockOptions)).toMatchSnapshot('borderInline after borderInlineStart');
490
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderInline)).toMatchSnapshot('borderInline');
491
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderInlineEnd)).toMatchSnapshot('borderInlineEnd');
492
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderInlineStart)).toMatchSnapshot('borderInlineStart');
493
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderInlineEnd, styles.borderInline)).toMatchSnapshot('borderInline after borderInlineEnd');
494
+ expect(_stylex.stylex.props.call(mockOptions, styles.borderInlineStart, styles.borderInline)).toMatchSnapshot('borderInline after borderInlineStart');
495
495
  });
496
496
  test('borderRadius', () => {
497
497
  const styles = _stylex.stylex.create({
@@ -508,22 +508,22 @@ describe('logical styles', () => {
508
508
  borderEndEndRadius: 10
509
509
  }
510
510
  });
511
- expect(_stylex.stylex.props(styles.startstart, mockOptions)).toMatchSnapshot('startstart');
512
- expect(_stylex.stylex.props(styles.startend, mockOptions)).toMatchSnapshot('startend');
513
- expect(_stylex.stylex.props(styles.endstart, mockOptions)).toMatchSnapshot('endstart');
514
- expect(_stylex.stylex.props(styles.endend, mockOptions)).toMatchSnapshot('endend');
511
+ expect(_stylex.stylex.props.call(mockOptions, styles.startstart)).toMatchSnapshot('startstart');
512
+ expect(_stylex.stylex.props.call(mockOptions, styles.startend)).toMatchSnapshot('startend');
513
+ expect(_stylex.stylex.props.call(mockOptions, styles.endstart)).toMatchSnapshot('endstart');
514
+ expect(_stylex.stylex.props.call(mockOptions, styles.endend)).toMatchSnapshot('endend');
515
515
  });
516
516
  test.skip('borderStyle', () => {
517
517
  const styles = _stylex.stylex.create({
518
518
  root: {}
519
519
  });
520
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
520
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
521
521
  });
522
522
  test.skip('borderWidth', () => {
523
523
  const styles = _stylex.stylex.create({
524
524
  root: {}
525
525
  });
526
- expect(_stylex.stylex.props(styles.root, mockOptions)).toMatchSnapshot();
526
+ expect(_stylex.stylex.props.call(mockOptions, styles.root)).toMatchSnapshot();
527
527
  });
528
528
  test('inset', () => {
529
529
  const styles = _stylex.stylex.create({
@@ -549,29 +549,29 @@ describe('logical styles', () => {
549
549
  insetInlineEnd: 7
550
550
  }
551
551
  });
552
- expect(_stylex.stylex.props(styles.inset, mockOptions)).toMatchSnapshot('inset');
553
- expect(_stylex.stylex.props(styles.insetBlock, mockOptions)).toMatchSnapshot('insetBlock');
554
- expect(_stylex.stylex.props(styles.insetBlockStart, mockOptions)).toMatchSnapshot('insetBlockStart');
555
- expect(_stylex.stylex.props(styles.insetBlockEnd, mockOptions)).toMatchSnapshot('insetBlockEnd');
556
- expect(_stylex.stylex.props(styles.insetInline, mockOptions)).toMatchSnapshot('insetInline');
557
- expect(_stylex.stylex.props(styles.insetInlineStart, mockOptions)).toMatchSnapshot('insetInlineStart');
558
- expect(_stylex.stylex.props(styles.insetInlineEnd, mockOptions)).toMatchSnapshot('insetInlineEnd');
559
- expect(_stylex.stylex.props([{
552
+ expect(_stylex.stylex.props.call(mockOptions, styles.inset)).toMatchSnapshot('inset');
553
+ expect(_stylex.stylex.props.call(mockOptions, styles.insetBlock)).toMatchSnapshot('insetBlock');
554
+ expect(_stylex.stylex.props.call(mockOptions, styles.insetBlockStart)).toMatchSnapshot('insetBlockStart');
555
+ expect(_stylex.stylex.props.call(mockOptions, styles.insetBlockEnd)).toMatchSnapshot('insetBlockEnd');
556
+ expect(_stylex.stylex.props.call(mockOptions, styles.insetInline)).toMatchSnapshot('insetInline');
557
+ expect(_stylex.stylex.props.call(mockOptions, styles.insetInlineStart)).toMatchSnapshot('insetInlineStart');
558
+ expect(_stylex.stylex.props.call(mockOptions, styles.insetInlineEnd)).toMatchSnapshot('insetInlineEnd');
559
+ expect(_stylex.stylex.props.call(mockOptions, {
560
560
  left: 10,
561
561
  right: 10,
562
562
  bottom: 100,
563
563
  top: 100
564
- }, styles.insetBlockStart], mockOptions)).toMatchSnapshot('inset vs top');
565
- expect(_stylex.stylex.props([{
564
+ }, styles.insetBlockStart)).toMatchSnapshot('inset vs top');
565
+ expect(_stylex.stylex.props.call(mockOptions, {
566
566
  bottom: 100,
567
567
  top: 100
568
- }, styles.insetBlockStart], mockOptions)).toMatchSnapshot('insetBlock vs top');
569
- expect(_stylex.stylex.props([{
568
+ }, styles.insetBlockStart)).toMatchSnapshot('insetBlock vs top');
569
+ expect(_stylex.stylex.props.call(mockOptions, {
570
570
  top: 100
571
- }, styles.insetBlockStart], mockOptions)).toMatchSnapshot('insetBlockStart vs top');
572
- expect(_stylex.stylex.props([{
571
+ }, styles.insetBlockStart)).toMatchSnapshot('insetBlockStart vs top');
572
+ expect(_stylex.stylex.props.call(mockOptions, {
573
573
  bottom: 100
574
- }, styles.insetBlockEnd], mockOptions)).toMatchSnapshot('insetBlockEnd vs bottom');
574
+ }, styles.insetBlockEnd)).toMatchSnapshot('insetBlockEnd vs bottom');
575
575
  });
576
576
  test('margin', () => {
577
577
  const styles = _stylex.stylex.create({
@@ -594,12 +594,12 @@ describe('logical styles', () => {
594
594
  marginInlineEnd: 3
595
595
  }
596
596
  });
597
- expect(_stylex.stylex.props(styles.marginBlock, mockOptions)).toMatchSnapshot('marginBlock');
598
- expect(_stylex.stylex.props(styles.marginBlockStart, mockOptions)).toMatchSnapshot('marginBlockStart');
599
- expect(_stylex.stylex.props(styles.marginBlockEnd, mockOptions)).toMatchSnapshot('marginBlockEnd');
600
- expect(_stylex.stylex.props(styles.marginInline, mockOptions)).toMatchSnapshot('marginInline');
601
- expect(_stylex.stylex.props(styles.marginInlineStart, mockOptions)).toMatchSnapshot('marginInlineStart');
602
- expect(_stylex.stylex.props(styles.marginInlineEnd, mockOptions)).toMatchSnapshot('marginInlineEnd');
597
+ expect(_stylex.stylex.props.call(mockOptions, styles.marginBlock)).toMatchSnapshot('marginBlock');
598
+ expect(_stylex.stylex.props.call(mockOptions, styles.marginBlockStart)).toMatchSnapshot('marginBlockStart');
599
+ expect(_stylex.stylex.props.call(mockOptions, styles.marginBlockEnd)).toMatchSnapshot('marginBlockEnd');
600
+ expect(_stylex.stylex.props.call(mockOptions, styles.marginInline)).toMatchSnapshot('marginInline');
601
+ expect(_stylex.stylex.props.call(mockOptions, styles.marginInlineStart)).toMatchSnapshot('marginInlineStart');
602
+ expect(_stylex.stylex.props.call(mockOptions, styles.marginInlineEnd)).toMatchSnapshot('marginInlineEnd');
603
603
  });
604
604
  test('padding', () => {
605
605
  const styles = _stylex.stylex.create({
@@ -622,12 +622,12 @@ describe('logical styles', () => {
622
622
  paddingInlineEnd: 3
623
623
  }
624
624
  });
625
- expect(_stylex.stylex.props(styles.paddingBlock, mockOptions)).toMatchSnapshot('paddingBlock');
626
- expect(_stylex.stylex.props(styles.paddingBlockStart, mockOptions)).toMatchSnapshot('paddingBlockStart');
627
- expect(_stylex.stylex.props(styles.paddingBlockEnd, mockOptions)).toMatchSnapshot('paddingBlockEnd');
628
- expect(_stylex.stylex.props(styles.paddingInline, mockOptions)).toMatchSnapshot('paddingInline');
629
- expect(_stylex.stylex.props(styles.paddingInlineStart, mockOptions)).toMatchSnapshot('paddingInlineStart');
630
- expect(_stylex.stylex.props(styles.paddingInlineEnd, mockOptions)).toMatchSnapshot('paddingInlineEnd');
625
+ expect(_stylex.stylex.props.call(mockOptions, styles.paddingBlock)).toMatchSnapshot('paddingBlock');
626
+ expect(_stylex.stylex.props.call(mockOptions, styles.paddingBlockStart)).toMatchSnapshot('paddingBlockStart');
627
+ expect(_stylex.stylex.props.call(mockOptions, styles.paddingBlockEnd)).toMatchSnapshot('paddingBlockEnd');
628
+ expect(_stylex.stylex.props.call(mockOptions, styles.paddingInline)).toMatchSnapshot('paddingInline');
629
+ expect(_stylex.stylex.props.call(mockOptions, styles.paddingInlineStart)).toMatchSnapshot('paddingInlineStart');
630
+ expect(_stylex.stylex.props.call(mockOptions, styles.paddingInlineEnd)).toMatchSnapshot('paddingInlineEnd');
631
631
  });
632
632
  test('textAlign', () => {
633
633
  const styles = _stylex.stylex.create({
@@ -638,8 +638,8 @@ describe('logical styles', () => {
638
638
  textAlign: 'end'
639
639
  }
640
640
  });
641
- expect(_stylex.stylex.props(styles.start, mockOptions)).toMatchSnapshot('start');
642
- expect(_stylex.stylex.props(styles.end, mockOptions)).toMatchSnapshot('end');
641
+ expect(_stylex.stylex.props.call(mockOptions, styles.start)).toMatchSnapshot('start');
642
+ expect(_stylex.stylex.props.call(mockOptions, styles.end)).toMatchSnapshot('end');
643
643
  });
644
644
  });
645
645
  describe('length units', () => {
@@ -652,7 +652,7 @@ describe('length units', () => {
652
652
  width: `${value}${unitToTest}`
653
653
  }
654
654
  });
655
- expect(_stylex.stylex.props(styles.underTest, mockOptions)).toMatchSnapshot();
655
+ expect(_stylex.stylex.props.call(mockOptions, styles.underTest)).toMatchSnapshot();
656
656
  });
657
657
  }
658
658
  test(`${value} "em" units based on inherited font-size`, () => {
@@ -661,10 +661,10 @@ describe('length units', () => {
661
661
  width: `${value}em`
662
662
  }
663
663
  });
664
- expect(_stylex.stylex.props(styles.underTest, {
664
+ expect(_stylex.stylex.props.call({
665
665
  ...mockOptions,
666
666
  inheritedFontSize: 12
667
- })).toMatchSnapshot();
667
+ }, styles.underTest)).toMatchSnapshot();
668
668
  });
669
669
  });
670
670
  describe('custom properties', () => {
@@ -683,7 +683,7 @@ describe('custom properties', () => {
683
683
  width: 'var(--unprovided)'
684
684
  }
685
685
  });
686
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
686
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
687
687
  expect(console.error).toHaveBeenCalledWith('stylex: Unrecognized custom property "--unprovided"');
688
688
  });
689
689
  test("resolves custom properties' values", () => {
@@ -695,13 +695,13 @@ describe('custom properties', () => {
695
695
  width: 'var(--the-best-width)'
696
696
  }
697
697
  });
698
- expect(_stylex.stylex.props(underTest, {
698
+ expect(_stylex.stylex.props.call({
699
699
  ...mockOptions,
700
700
  customProperties: {
701
701
  slightlyDarkerBlack: '#333',
702
702
  theBestWidth: 42
703
703
  }
704
- })).toMatchSnapshot();
704
+ }, underTest)).toMatchSnapshot();
705
705
  });
706
706
  });
707
707
  expect.extend({
@@ -720,10 +720,10 @@ expect.extend({
720
720
  }
721
721
  }
722
722
  });
723
- const props = _stylex.stylex.props(underTest, {
723
+ const props = _stylex.stylex.props.call({
724
724
  viewportHeight: height,
725
725
  viewportWidth: width
726
- });
726
+ }, underTest);
727
727
  const actualValue = props.style.width;
728
728
  if (actualValue === EXPECTED_MATCHED_VALUE) {
729
729
  return {
@@ -796,7 +796,7 @@ describe('unsupported style properties', () => {
796
796
  filter: 'blur(1px)'
797
797
  }
798
798
  });
799
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
799
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
800
800
  expect(console.warn).toHaveBeenCalled();
801
801
  });
802
802
  test('"marginStart"', () => {
@@ -807,7 +807,7 @@ describe('unsupported style properties', () => {
807
807
  marginStart: 10
808
808
  }
809
809
  });
810
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
810
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
811
811
  expect(console.warn).toHaveBeenCalled();
812
812
  });
813
813
  test('"marginEnd"', () => {
@@ -818,7 +818,7 @@ describe('unsupported style properties', () => {
818
818
  marginEnd: 10
819
819
  }
820
820
  });
821
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
821
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
822
822
  expect(console.warn).toHaveBeenCalled();
823
823
  });
824
824
  test('"marginHorizontal"', () => {
@@ -829,7 +829,7 @@ describe('unsupported style properties', () => {
829
829
  marginHorizontal: 10
830
830
  }
831
831
  });
832
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
832
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
833
833
  expect(console.warn).toHaveBeenCalled();
834
834
  });
835
835
  test('"marginVertical"', () => {
@@ -840,7 +840,7 @@ describe('unsupported style properties', () => {
840
840
  marginVertical: 10
841
841
  }
842
842
  });
843
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
843
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
844
844
  expect(console.warn).toHaveBeenCalled();
845
845
  });
846
846
  test('"paddingHorizontal"', () => {
@@ -851,7 +851,7 @@ describe('unsupported style properties', () => {
851
851
  paddingHorizontal: 10
852
852
  }
853
853
  });
854
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
854
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
855
855
  expect(console.warn).toHaveBeenCalled();
856
856
  });
857
857
  test('"paddingVertical"', () => {
@@ -862,7 +862,7 @@ describe('unsupported style properties', () => {
862
862
  paddingVertical: 10
863
863
  }
864
864
  });
865
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
865
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
866
866
  expect(console.warn).toHaveBeenCalled();
867
867
  });
868
868
  test('"transitionProperty" passthrough', () => {
@@ -873,10 +873,10 @@ describe('unsupported style properties', () => {
873
873
  transitionProperty: 'opacity'
874
874
  }
875
875
  });
876
- expect(_stylex.stylex.props(underTest, {
876
+ expect(_stylex.stylex.props.call({
877
877
  ...mockOptions,
878
878
  passthroughProperties: ['transitionProperty']
879
- })).toMatchSnapshot();
879
+ }, underTest)).toMatchSnapshot();
880
880
  expect(console.warn).not.toHaveBeenCalled();
881
881
  });
882
882
  });
@@ -896,7 +896,7 @@ describe('unsupported style values', () => {
896
896
  width: 'calc(2 * 1rem)'
897
897
  }
898
898
  });
899
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
899
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
900
900
  expect(console.warn).toHaveBeenCalled();
901
901
  });
902
902
  test('inherit', () => {
@@ -907,7 +907,7 @@ describe('unsupported style values', () => {
907
907
  fontSize: 'inherit'
908
908
  }
909
909
  });
910
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
910
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
911
911
  expect(console.warn).toHaveBeenCalled();
912
912
  });
913
913
  test('initial', () => {
@@ -918,7 +918,7 @@ describe('unsupported style values', () => {
918
918
  fontSize: 'initial'
919
919
  }
920
920
  });
921
- expect(_stylex.stylex.props(underTest, mockOptions)).toMatchSnapshot();
921
+ expect(_stylex.stylex.props.call(mockOptions, underTest)).toMatchSnapshot();
922
922
  expect(console.warn).toHaveBeenCalled();
923
923
  });
924
924
  });
@@ -30,8 +30,8 @@ export declare function keyframes(k: Keyframes): Keyframes;
30
30
  */
31
31
 
32
32
  export declare function props(
33
- style: null | undefined | { [key: string]: unknown },
34
- options: SpreadOptions,
33
+ this: SpreadOptions,
34
+ ...style: ReadonlyArray<null | undefined | { [key: string]: unknown }>
35
35
  ): { [$$Key$$: string]: {} };
36
36
  export declare const __customProperties: { [$$Key$$: string]: unknown };
37
37
  export declare const defineVars: StyleX$DefineVars;
@@ -143,7 +143,15 @@ function finalizeValue(unfinalizedValue, options) {
143
143
  function create(styles) {
144
144
  const result = {};
145
145
  for (const styleName in styles) {
146
- result[styleName] = preprocessCreate(styles[styleName]);
146
+ const val = styles[styleName];
147
+ if (typeof val === 'function') {
148
+ result[styleName] = function () {
149
+ const style = val(...arguments);
150
+ return preprocessCreate(style);
151
+ };
152
+ } else {
153
+ result[styleName] = preprocessCreate(styles[styleName]);
154
+ }
147
155
  }
148
156
  return result;
149
157
  }
@@ -156,7 +164,11 @@ function keyframes(k) {
156
164
  return k;
157
165
  }
158
166
  const timeValuedProperties = ['animationDelay', 'animationDuration', 'transitionDelay', 'transitionDuration'];
159
- function props(style, options) {
167
+ function props() {
168
+ const options = this;
169
+ for (var _len = arguments.length, style = new Array(_len), _key = 0; _key < _len; _key++) {
170
+ style[_key] = arguments[_key];
171
+ }
160
172
  let {
161
173
  lineClamp,
162
174
  ...flatStyle
@@ -35,8 +35,8 @@ declare export function keyframes(k: Keyframes): Keyframes;
35
35
  */
36
36
 
37
37
  declare export function props(
38
- style: ?{ [key: string]: mixed },
39
- options: SpreadOptions,
38
+ this: SpreadOptions,
39
+ ...style: $ReadOnlyArray<?{ [key: string]: mixed }>
40
40
  ): { [string]: { ... } };
41
41
 
42
42
  declare export const __customProperties: { [string]: mixed };
package/lib/stylex.d.ts CHANGED
@@ -20,12 +20,14 @@ import type {
20
20
  export type { Theme, Variant } from './StyleXTypes';
21
21
  import injectStyle from './stylex-inject';
22
22
  export declare function props(
23
- styles: StyleXArray<
24
- | (null | undefined | CompiledStyles)
25
- | boolean
26
- | Readonly<[CompiledStyles, InlineStyles]>
27
- >,
28
- _options?: {},
23
+ this: null | undefined | unknown,
24
+ ...styles: ReadonlyArray<
25
+ StyleXArray<
26
+ | (null | undefined | CompiledStyles)
27
+ | boolean
28
+ | Readonly<[CompiledStyles, InlineStyles]>
29
+ >
30
+ >
29
31
  ): Readonly<{
30
32
  className?: string;
31
33
  style?: Readonly<{ [$$Key$$: string]: string | number }>;
@@ -112,12 +114,14 @@ type IStyleX = {
112
114
  >
113
115
  ): string;
114
116
  props: (
115
- styles: StyleXArray<
116
- | (null | undefined | CompiledStyles)
117
- | boolean
118
- | Readonly<[CompiledStyles, InlineStyles]>
119
- >,
120
- _options?: {},
117
+ this: null | undefined | unknown,
118
+ ...styles: ReadonlyArray<
119
+ StyleXArray<
120
+ | (null | undefined | CompiledStyles)
121
+ | boolean
122
+ | Readonly<[CompiledStyles, InlineStyles]>
123
+ >
124
+ >
121
125
  ) => Readonly<{
122
126
  className?: string;
123
127
  style?: Readonly<{ [$$Key$$: string]: string | number }>;
package/lib/stylex.js CHANGED
@@ -10,9 +10,13 @@ exports.types = exports.stylex = void 0;
10
10
  var _stylexInject = _interopRequireDefault(require("./stylex-inject"));
11
11
  var _styleq = require("styleq");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- function props(styles, _options) {
13
+ function props() {
14
+ const options = this;
15
+ for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
16
+ styles[_key] = arguments[_key];
17
+ }
14
18
  if (__implementations.props) {
15
- return __implementations.props(styles, _options);
19
+ return __implementations.props.call(options, styles);
16
20
  }
17
21
  const [className, style] = (0, _styleq.styleq)(styles);
18
22
  const result = {};
@@ -111,8 +115,8 @@ const firstThatWorks = function () {
111
115
  exports.firstThatWorks = firstThatWorks;
112
116
  const inject = exports.inject = _stylexInject.default;
113
117
  function _stylex() {
114
- for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
115
- styles[_key] = arguments[_key];
118
+ for (var _len2 = arguments.length, styles = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
119
+ styles[_key2] = arguments[_key2];
116
120
  }
117
121
  const [className] = (0, _styleq.styleq)(styles);
118
122
  return className;
@@ -22,10 +22,12 @@ export type { Theme, Variant } from './StyleXTypes';
22
22
 
23
23
  import injectStyle from './stylex-inject';
24
24
  declare export function props(
25
- styles: StyleXArray<
26
- ?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
27
- >,
28
- _options?: { ... },
25
+ this: ?mixed,
26
+ ...styles: $ReadOnlyArray<
27
+ StyleXArray<
28
+ ?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
29
+ >,
30
+ >
29
31
  ): $ReadOnly<{
30
32
  className?: string,
31
33
  style?: $ReadOnly<{ [string]: string | number }>,
@@ -113,10 +115,12 @@ declare export const inject: typeof injectStyle;
113
115
  type IStyleX = {
114
116
  (...styles: $ReadOnlyArray<StyleXArray<?CompiledStyles | boolean>>): string,
115
117
  props: (
116
- styles: StyleXArray<
117
- ?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
118
- >,
119
- _options?: { ... },
118
+ this: ?mixed,
119
+ ...styles: $ReadOnlyArray<
120
+ StyleXArray<
121
+ ?CompiledStyles | boolean | $ReadOnly<[CompiledStyles, InlineStyles]>,
122
+ >,
123
+ >
120
124
  ) => $ReadOnly<{
121
125
  className?: string,
122
126
  style?: $ReadOnly<{ [string]: string | number }>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/stylex",
3
- "version": "0.2.0-beta.22",
3
+ "version": "0.2.0-beta.24",
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.22"
23
+ "@stylexjs/scripts": "0.2.0-beta.24"
24
24
  },
25
25
  "jest": {},
26
26
  "files": [