Skip to content

Commit b27c982

Browse files
committed
[change] StyleSheet rewrite
* Improves React Native compatibility by making StyleSheet.create the identify function. * Improves React 18 support by inserting styles on eval. * Supports use with multiple windows (i.e., iframes) and shadow roots. * Supports nested LTR/RTL layouts. * Supports 3rd party compilers and extraction to static CSS. * Fixes static and dynamic short/longform deduplication. * Reduces browser support: Safari 10.1+, Chromium Edge, no IE, no legacy Android browsers. * Removes automatic vendor-prefixing of inline styles (for better perf). * Removes focus-visible polyfill as modern browsers no longer show focus rings for mouse interactions. Close #2208 Fix #2138 Fix #2196 Fix #2007 Fix #1517
1 parent 174ebb3 commit b27c982

File tree

77 files changed

+2560
-2884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2560
-2884
lines changed

flow-typed/npm/styleq.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
type CompiledStyle = {
2+
$$css: boolean,
3+
[key: string]: string,
4+
};
5+
6+
type InlineStyle = {
7+
[key: string]: mixed,
8+
};
9+
10+
type EitherStyle = CompiledStyle | InlineStyle;
11+
12+
type StylesArray<+T> = T | $ReadOnlyArray<StylesArray<T>>;
13+
type Styles = StylesArray<CompiledStyle | InlineStyle | false>;
14+
type Style<+T = EitherStyle> = StylesArray<false | ?T>;
15+
16+
type StyleqOptions = {
17+
disableCache?: boolean,
18+
disableMix?: boolean,
19+
transform?: (CompiledStyle) => CompiledStyle,
20+
};
21+
22+
type StyleqResult = [string, InlineStyle | null];
23+
type Styleq = (styles: Styles) => StyleqResult;
24+
25+
type IStyleq = {
26+
(...styles: $ReadOnlyArray<Styles>): StyleqResult,
27+
factory: (options?: StyleqOptions) => Styleq,
28+
};
29+
30+
declare module "styleq" {
31+
declare module.exports: {
32+
styleq: IStyleq
33+
};
34+
}

packages/dom-event-testing-library/src/__tests__/index-test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-env jasmine, jest */
2-
31
/**
42
* Copyright (c) Facebook, Inc. and its affiliates.
53
*
@@ -49,7 +47,7 @@ describe('createEventTarget', () => {
4947
const target = createEventTarget(node);
5048
expect(target.node).toEqual(node);
5149
expect(Object.keys(target)).toMatchInlineSnapshot(`
52-
Array [
50+
[
5351
"node",
5452
"blur",
5553
"click",
@@ -331,9 +329,7 @@ describe('createEventTarget', () => {
331329
});
332330

333331
/**
334-
* Complex event sequences
335-
*
336-
* ...coming soon
332+
* TODO: Complex event sequences
337333
*/
338334

339335
/**
@@ -343,24 +339,28 @@ describe('createEventTarget', () => {
343339
test('.setBoundingClientRect()', () => {
344340
const target = createEventTarget(node);
345341
expect(node.getBoundingClientRect()).toMatchInlineSnapshot(`
346-
Object {
342+
{
347343
"bottom": 0,
348344
"height": 0,
349345
"left": 0,
350346
"right": 0,
351347
"top": 0,
352348
"width": 0,
349+
"x": 0,
350+
"y": 0,
353351
}
354352
`);
355353
target.setBoundingClientRect({ x: 10, y: 20, width: 100, height: 200 });
356354
expect(node.getBoundingClientRect()).toMatchInlineSnapshot(`
357-
Object {
355+
{
358356
"bottom": 220,
359357
"height": 200,
360358
"left": 10,
361359
"right": 110,
362360
"top": 20,
363361
"width": 100,
362+
"x": 10,
363+
"y": 20,
364364
}
365365
`);
366366
});

packages/react-native-web/src/exports/ActivityIndicator/__tests__/__snapshots__/index-test.js.snap

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ exports[`components/ActivityIndicator prop "accessibilityLabel" value is set 1`]
55
aria-label="accessibility label"
66
aria-valuemax="1"
77
aria-valuemin="0"
8-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
8+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
99
role="progressbar"
1010
>
1111
<div
12-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-width-19wmn03"
12+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
1313
>
1414
<svg
1515
height="100%"
@@ -42,11 +42,11 @@ exports[`components/ActivityIndicator prop "accessibilityLiveRegion" value is se
4242
aria-live="polite"
4343
aria-valuemax="1"
4444
aria-valuemin="0"
45-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
45+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
4646
role="progressbar"
4747
>
4848
<div
49-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-width-19wmn03"
49+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
5050
>
5151
<svg
5252
height="100%"
@@ -78,11 +78,11 @@ exports[`components/ActivityIndicator prop "animating" is "false" 1`] = `
7878
<div
7979
aria-valuemax="1"
8080
aria-valuemin="0"
81-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
81+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
8282
role="progressbar"
8383
>
8484
<div
85-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationPlayState-1abnn5w r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-visibility-11j9u27 r-width-19wmn03"
85+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-animationPlayState-1abnn5w r-visibility-11j9u27"
8686
>
8787
<svg
8888
height="100%"
@@ -114,11 +114,11 @@ exports[`components/ActivityIndicator prop "animating" is "true" 1`] = `
114114
<div
115115
aria-valuemax="1"
116116
aria-valuemin="0"
117-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
117+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
118118
role="progressbar"
119119
>
120120
<div
121-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-width-19wmn03"
121+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
122122
>
123123
<svg
124124
height="100%"
@@ -175,13 +175,13 @@ exports[`components/ActivityIndicator prop "dataSet" value is set 1`] = `
175175
<div
176176
aria-valuemax="1"
177177
aria-valuemin="0"
178-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
178+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
179179
data-one="one"
180180
data-two="two"
181181
role="progressbar"
182182
>
183183
<div
184-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-width-19wmn03"
184+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
185185
>
186186
<svg
187187
height="100%"
@@ -213,11 +213,11 @@ exports[`components/ActivityIndicator prop "hidesWhenStopped" is "false" 1`] = `
213213
<div
214214
aria-valuemax="1"
215215
aria-valuemin="0"
216-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
216+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
217217
role="progressbar"
218218
>
219219
<div
220-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationPlayState-1abnn5w r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-width-19wmn03"
220+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-animationPlayState-1abnn5w"
221221
>
222222
<svg
223223
height="100%"
@@ -249,11 +249,11 @@ exports[`components/ActivityIndicator prop "hidesWhenStopped" is "true" 1`] = `
249249
<div
250250
aria-valuemax="1"
251251
aria-valuemin="0"
252-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
252+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
253253
role="progressbar"
254254
>
255255
<div
256-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationPlayState-1abnn5w r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-visibility-11j9u27 r-width-19wmn03"
256+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-animationPlayState-1abnn5w r-visibility-11j9u27"
257257
>
258258
<svg
259259
height="100%"
@@ -285,12 +285,12 @@ exports[`components/ActivityIndicator prop "nativeID" value is set 1`] = `
285285
<div
286286
aria-valuemax="1"
287287
aria-valuemin="0"
288-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
288+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
289289
id="123"
290290
role="progressbar"
291291
>
292292
<div
293-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-width-19wmn03"
293+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
294294
>
295295
<svg
296296
height="100%"
@@ -322,11 +322,11 @@ exports[`components/ActivityIndicator prop "size" is "large" 1`] = `
322322
<div
323323
aria-valuemax="1"
324324
aria-valuemin="0"
325-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
325+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
326326
role="progressbar"
327327
>
328328
<div
329-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-height-1r8g8re r-width-1acpoxo"
329+
class="css-view-175oi2r r-height-1r8g8re r-width-1acpoxo r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
330330
>
331331
<svg
332332
height="100%"
@@ -358,11 +358,11 @@ exports[`components/ActivityIndicator prop "size" is a number 1`] = `
358358
<div
359359
aria-valuemax="1"
360360
aria-valuemin="0"
361-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
361+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
362362
role="progressbar"
363363
>
364364
<div
365-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
365+
class="css-view-175oi2r r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
366366
style="height: 30px; width: 30px;"
367367
>
368368
<svg
@@ -395,12 +395,12 @@ exports[`components/ActivityIndicator prop "style" value is set 1`] = `
395395
<div
396396
aria-valuemax="1"
397397
aria-valuemin="0"
398-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
398+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
399399
role="progressbar"
400400
style="border-top-width: 5px; border-right-width: 5px; border-bottom-width: 5px; border-left-width: 5px;"
401401
>
402402
<div
403-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-width-19wmn03"
403+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
404404
>
405405
<svg
406406
height="100%"
@@ -432,12 +432,12 @@ exports[`components/ActivityIndicator prop "testID" value is set 1`] = `
432432
<div
433433
aria-valuemax="1"
434434
aria-valuemin="0"
435-
class="css-view-1dbjc4n r-alignItems-1awozwy r-justifyContent-1777fci"
435+
class="css-view-175oi2r r-alignItems-1awozwy r-justifyContent-1777fci"
436436
data-testid="123"
437437
role="progressbar"
438438
>
439439
<div
440-
class="css-view-1dbjc4n r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0 r-height-z80fyv r-width-19wmn03"
440+
class="css-view-175oi2r r-height-z80fyv r-width-19wmn03 r-animationDuration-17bb2tj r-animationIterationCount-1muvv40 r-animationKeyframes-127358a r-animationTimingFunction-1ldzwu0"
441441
>
442442
<svg
443443
height="100%"

packages/react-native-web/src/exports/AppRegistry/__tests__/__snapshots__/index-test.js.snap

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)