|
7 | 7 | * @flow
|
8 | 8 | */
|
9 | 9 |
|
| 10 | +import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags'; |
| 11 | + |
10 | 12 | export type Flags = number;
|
11 | 13 |
|
12 | 14 | // Don't change these two values. They're used by React Dev Tools.
|
13 |
| -export const NoFlags = /* */ 0b000000000000000000; |
14 |
| -export const PerformedWork = /* */ 0b000000000000000001; |
| 15 | +export const NoFlags = /* */ 0b0000000000000000000; |
| 16 | +export const PerformedWork = /* */ 0b0000000000000000001; |
15 | 17 |
|
16 | 18 | // You can change the rest (and add more).
|
17 |
| -export const Placement = /* */ 0b000000000000000010; |
18 |
| -export const Update = /* */ 0b000000000000000100; |
19 |
| -export const PlacementAndUpdate = /* */ 0b000000000000000110; |
20 |
| -export const Deletion = /* */ 0b000000000000001000; |
21 |
| -export const ContentReset = /* */ 0b000000000000010000; |
22 |
| -export const Callback = /* */ 0b000000000000100000; |
23 |
| -export const DidCapture = /* */ 0b000000000001000000; |
24 |
| -export const Ref = /* */ 0b000000000010000000; |
25 |
| -export const Snapshot = /* */ 0b000000000100000000; |
26 |
| -export const Passive = /* */ 0b000000001000000000; |
27 |
| -// TODO (effects) Remove this bit once the new reconciler is synced to the old. |
28 |
| -export const PassiveUnmountPendingDev = /* */ 0b000010000000000000; |
29 |
| -export const Hydrating = /* */ 0b000000010000000000; |
30 |
| -export const HydratingAndUpdate = /* */ 0b000000010000000100; |
| 19 | +export const Placement = /* */ 0b0000000000000000010; |
| 20 | +export const Update = /* */ 0b0000000000000000100; |
| 21 | +export const PlacementAndUpdate = /* */ 0b0000000000000000110; |
| 22 | +export const Deletion = /* */ 0b0000000000000001000; |
| 23 | +export const ContentReset = /* */ 0b0000000000000010000; |
| 24 | +export const Callback = /* */ 0b0000000000000100000; |
| 25 | +export const DidCapture = /* */ 0b0000000000001000000; |
| 26 | +export const Ref = /* */ 0b0000000000010000000; |
| 27 | +export const Snapshot = /* */ 0b0000000000100000000; |
| 28 | +export const Passive = /* */ 0b0000000001000000000; |
| 29 | +export const Hydrating = /* */ 0b0000000010000000000; |
| 30 | +export const HydratingAndUpdate = /* */ 0b0000000010000000100; |
| 31 | +export const Visibility = /* */ 0b0000000100000000000; |
31 | 32 |
|
32 | 33 | // Passive & Update & Callback & Ref & Snapshot
|
33 |
| -export const LifecycleEffectMask = /* */ 0b000000001110100100; |
| 34 | +export const LifecycleEffectMask = /* */ 0b0000000001110100100; |
34 | 35 |
|
35 | 36 | // Union of all host effects
|
36 |
| -export const HostEffectMask = /* */ 0b000000011111111111; |
| 37 | +export const HostEffectMask = /* */ 0b0000000111111111111; |
37 | 38 |
|
38 | 39 | // These are not really side effects, but we still reuse this field.
|
39 |
| -export const Incomplete = /* */ 0b000000100000000000; |
40 |
| -export const ShouldCapture = /* */ 0b000001000000000000; |
41 |
| -export const ForceUpdateForLegacySuspense = /* */ 0b000100000000000000; |
| 40 | +export const Incomplete = /* */ 0b0000001000000000000; |
| 41 | +export const ShouldCapture = /* */ 0b0000010000000000000; |
| 42 | +// TODO (effects) Remove this bit once the new reconciler is synced to the old. |
| 43 | +export const PassiveUnmountPendingDev = /* */ 0b0000100000000000000; |
| 44 | +export const ForceUpdateForLegacySuspense = /* */ 0b0001000000000000000; |
42 | 45 |
|
43 | 46 | // Static tags describe aspects of a fiber that are not specific to a render,
|
44 | 47 | // e.g. a fiber uses a passive effect (even if there are no updates on this particular render).
|
45 | 48 | // This enables us to defer more work in the unmount case,
|
46 | 49 | // since we can defer traversing the tree during layout to look for Passive effects,
|
47 | 50 | // and instead rely on the static flag as a signal that there may be cleanup work.
|
48 |
| -export const PassiveStatic = /* */ 0b001000000000000000; |
| 51 | +export const PassiveStatic = /* */ 0b0010000000000000000; |
49 | 52 |
|
50 | 53 | // Union of side effect groupings as pertains to subtreeFlags
|
51 |
| -// TODO: Don't need to visit Placement during BeforeMutation phase |
52 |
| -// TODO: Only need to visit Deletions during BeforeMutation phase if an element |
53 |
| -// is focused. |
54 |
| -export const BeforeMutationMask = /* */ 0b000000000100001010; |
55 |
| -export const MutationMask = /* */ 0b000000010010011110; |
56 |
| -export const LayoutMask = /* */ 0b000000000010100100; |
57 |
| -export const PassiveMask = /* */ 0b000000001000001000; |
| 54 | + |
| 55 | +export const BeforeMutationMask = |
| 56 | + Snapshot | |
| 57 | + (enableCreateEventHandleAPI |
| 58 | + ? // createEventHandle needs to visit deleted and hidden trees to |
| 59 | + // fire beforeblur |
| 60 | + // TODO: Only need to visit Deletions during BeforeMutation phase if an |
| 61 | + // element is focused. |
| 62 | + Deletion | Visibility |
| 63 | + : 0); |
| 64 | + |
| 65 | +export const MutationMask = /* */ 0b0000000110010011110; |
| 66 | +export const LayoutMask = /* */ 0b0000000000010100100; |
| 67 | +export const PassiveMask = /* */ 0b0000000001000001000; |
58 | 68 |
|
59 | 69 | // Union of tags that don't get reset on clones.
|
60 | 70 | // This allows certain concepts to persist without recalculting them,
|
61 | 71 | // e.g. whether a subtree contains passive effects or portals.
|
62 |
| -export const StaticMask = /* */ 0b001000000000000000; |
| 72 | +export const StaticMask = /* */ 0b0010000000000000000; |
63 | 73 |
|
64 | 74 | // These flags allow us to traverse to fibers that have effects on mount
|
65 | 75 | // without traversing the entire tree after every commit for
|
66 | 76 | // double invoking
|
67 |
| -export const MountLayoutDev = /* */ 0b010000000000000000; |
68 |
| -export const MountPassiveDev = /* */ 0b100000000000000000; |
| 77 | +export const MountLayoutDev = /* */ 0b0100000000000000000; |
| 78 | +export const MountPassiveDev = /* */ 0b1000000000000000000; |
0 commit comments