Commit Graph

12357 Commits

Author SHA1 Message Date
Heaven 61836fba2a Fix typo: wnless -> unless (#16680) 2019-09-06 07:47:35 -07:00
Sebastian Markbåge e11bf42cea Check for Suspense boundary in a root Container (#16673)
If we find a Container that might mean that we're on a node that is inside
a Suspense boundary that is directly inside the Container root.

Imagine the div is a Container and the span is a dehydrated instance:

```
<div>
  <!--$-->
  <span />
  <!--/$-->
</div>
```

There's no way to tests this yet since I'm not actually utilizing
the return value yet.

The solution is to just use the same path to check for a Suspense boundary
as if we find a parent instance.
2019-09-05 16:06:05 -07:00
Dan Abramov 962dfc2c33 Remove experimental scheduler flags (#16672) 2019-09-05 20:08:06 +01:00
Nicolas Gallagher ff006451ad [react-events] Fix isTargetWithinNode type (#16671)
isTargetWithinNode passes the childTarget to getClosestInstanceFromNode which
does not account for a null value of 'node'.
2019-09-05 11:36:31 -07:00
Dan Abramov 040ca0fad7 Enable MessageLoop implementation by default (#16408) 2019-09-05 19:25:51 +01:00
Brian Vaughn d96f478f8a use-subscription tearing fix (#16623)
* Add (failing) subscription tearing test and bugfix
* Added more inline comments to test
* Simplified tearing test case slightly
2019-09-05 11:12:46 -07:00
Luna Ruan 79e46b6778 updated flags from false to dicated on www (#16647) 2019-09-05 09:51:44 -07:00
Sebastian Markbåge 8d7c733f1f [Partial Hydration] Don't invoke listeners on parent of dehydrated event target (#16591)
* Don't invoke listeners on parent of dehydrated event target

* Move Suspense boundary check to getClosestInstanceFromNode

Now getClosestInstanceFromNode can return either a host component,
host text component or suspense component when the suspense
component is dehydrated.

We then use that to ignore events on a suspense component.

* Attach the HostRoot fiber to the DOM container

This lets us detect if an event happens on this root's subtree before it
has rendered something.

* Add todo

The approach of checking isFiberMounted answers if we might be in an
in-progress hydration but it doesn't answer which root or boundary
might be in-progress so we don't know what to wait for.

This needs some refactoring.

* Refactor isFiberMountedImpl to getNearestMountedFiber

We'll need the nearest boundary for event replaying so this prepares for
that.

This surfaced an issue that we attach Hydrating tag on the root but normally
this (and Placement) is attached on the child. This surfaced an issue
that this can lead to both Placement and Hydrating effects which is not
supported so we need to ensure that we only ever use one or the other.

* Add todo for bug I spotted

* Cache tags

* Check the ContainerInstanceKey before the InstanceKey

The container is inside the instance, so we must find it before the
instance, since otherwise we'll miss it.
2019-09-05 08:51:31 -07:00
Nicolas Gallagher 9ce8711d5a [react-events] Tap responder (#16628)
This is a partial replacement for the 'Press' responder:

1. `useTap` is scoped to pointers (no keyboard support). Our current thinking is
that "responders" should be limited to working with pointers, and that they can
be combined with 'useKeyboard' in user-space. For example, we might create a
'usePress' hook in user-space that combines 'useTap' with 'useKeyboard' to react
to both pointers and keyboard interactions.

2. `useTap` cancels the gesture once the pointer moves over an element that is
not within the responder target's subtree. This differs from `usePress` (and
React Native), where the gesture remains active after the pointer exits the
target's subtree and is restarted once the pointer reenters. One of the
drawbacks with the `usePress` behavior is that it requires repeatedly measuring
DOM elements (which can cause jank) to perform hit region tests. `useTap` avoids
doing this and relies on `document.elementFromPoint` only to support the
TouchEvent fallbacks.

3. `useTap` calls `onTapUpdate` when the active gesture's state changes,
`onTapEnd` when the gesture successfully completes. and `onTapCancel` when it
fails. There is no `onTap` callback. `usePress` did not explicitly report back
when the gesture failed, and product developers were confused about the
difference between `onPress` and `onPressEnd`.

4. `useTap` explicitly separates the PointerEvent implementation from the
MouseEvent/TouchEvent fallback.

5. `useTap` has better unit test coverage . All pointer types and the fallback
environment are tested. The shape of the gesture state object is also defined
and tested.
2019-09-04 17:09:33 -07:00
Dominic Gannaway e86146e714 [react-events] Refine executeUserEventHandler (#16662) 2019-09-05 00:36:29 +01:00
Dominic Gannaway c66edb9f8b [react-events] Refactor getCurrentTarget to getResponderNode (#16660) 2019-09-04 20:04:35 +01:00
Dominic Gannaway 9ff60ff16b [react-events] Fix Scope listener issue (#16658) 2019-09-04 18:57:39 +01:00
Dominic Gannaway 7126a37bf4 [react-events] Keyboard responder propagation handling (#16657) 2019-09-04 18:25:05 +01:00
Dominic Gannaway 539640d89f [react-events] Various core tweaks for event responder system (#16654) 2019-09-04 18:05:56 +01:00
Dominic Gannaway af032764a9 [react-events] Adds preventKeys support to Keyboard responder (#16642) 2019-09-04 01:38:36 +01:00
Brian Vaughn f705e2bac7 Updated pending CHANGELOG for DevTools 2019-09-03 08:37:12 -07:00
Hristo Kanchev 77bb102398 [DevTools] [Profiler]: Save profile now working in Firefox (#16612)
* Added anchor dom element in order to successfully download profiling data.
* Reworked downloadFile to accept a DOMElement in order for FF to successfully download profiling data.
* Prettify downloadFile changes.
2019-09-03 08:35:12 -07:00
Heaven 92f094d86d fix typo: oncurrent - concurrent (#16633) 2019-09-02 11:21:48 +01:00
Dominic Gannaway 46f912fd57 [react-core] Add more support for experimental React Scope API (#16621) 2019-08-30 18:27:14 +01:00
Paul O’Shannessy 2c1e6bf619 Adopt Contributor Covenant (#16613)
In order to foster healthy open source communities, we're adopting the
[Contributor Covenant](https://www.contributor-covenant.org/). It has been
built by open source community members and represents a shared understanding of
what is expected from a healthy community.
2019-08-29 16:04:47 -07:00
Brian Vaughn f962feb882 Updated extensions build-from-source instructions in README 2019-08-29 08:49:08 -07:00
Simen Bekkhus ac6193687f add integrity field in yarn.lock (#16601) 2019-08-29 16:36:02 +01:00
Sebastian Silbermann 16329bd954 chore: Update nvmrc with latest lts (#16610) 2019-08-29 16:30:35 +01:00
Dominic Gannaway 4e544cffee [react-events] Split out mixed event responder tests (#16608) 2019-08-29 16:13:37 +01:00
Gerald Monaco f61138e068 Use renderToStaticMarkup for tests (#16516) 2019-08-29 16:08:38 +01:00
James George 980112b146 rephrase comment (#16559) 2019-08-29 14:51:07 +01:00
Bas Peeters 8a7c2e50f1 Remove duplicate character in regex group (#16572) 2019-08-29 14:49:27 +01:00
Tom Quirk 557d472fe3 add <thead>, <tfoot> to table > tr warning (#16535) 2019-08-29 14:46:27 +01:00
Simen Bekkhus 37fcd04681 chore: upgrade to danger 9 (#16602) 2019-08-29 13:46:53 +01:00
Dominic Gannaway bd79be9b68 [react-core] Add experimental React Scope component API (#16587) 2019-08-29 12:06:51 +01:00
Brian Vaughn 996acf9036 Updated DevTools extension build script to work when run remotely (#16603) 2019-08-28 17:01:26 -07:00
Dominic Gannaway 34aaec6f90 [react-events] Ensure screen reader virtual clicks support preventDefault (#16600) 2019-08-28 17:39:07 +01:00
Dan Abramov 01fb68b9bf Don't ignore dependencies for render phase update (#16574) 2019-08-28 16:55:56 +01:00
LEE SUK JAE 1b585f630b Fix link on error-codes/README.md (#16595) 2019-08-28 15:49:45 +01:00
Brian Vaughn 0f3e82f3c4 Merge branch 'devtools-v4-merge' 2019-08-28 07:39:49 -07:00
Brian Vaughn b8390310b1 Revert "Import React DevTools v4"
This reverts commit b438699d36.
2019-08-28 07:39:32 -07:00
Brian Vaughn b438699d36 Import React DevTools v4
Imports the entire React DevTools v4 git repository (with history).
2019-08-28 07:35:53 -07:00
Brian Vaughn ada5991422 Removed an unnecessary/unused DT Flow type 2019-08-28 07:28:06 -07:00
Brian Vaughn 08ce280cbc Updated DT regression fixture path 2019-08-28 07:25:52 -07:00
Brian Vaughn b034ac6d38 Merge branch 'master' into devtools-v4-merge 2019-08-28 07:13:49 -07:00
Luna Ruan f512537754 Babel Transform JSX to React.jsx/React.jsxDEV Plugin (#16432)
This babel transform is a fork of the @babel/plugin-transform-react-jsx transform and is for experimentation purposes only. We don't plan to own this code in the future, and we will upstream this to Babel at some point once we've proven out the concept.

As per the RFC to simplify element creation, we want to change the JSX transform from targeting React.createElement(type, props, children) to React.jsx(type, props, key). This modifies the existing @babel/plugin-transform-react-jsx (and helper) babel plugin to support React.jsx and React.jsxDEV.

The main differences between React.jsx/React.jsxDEV and React.createElement are:
1.) key is now passed as an explicit argument rather than through props
3.) children are now passed through props rather than as an explicit argument
4.) props must always be an object
5.) __source and and __self are now passed as separate arguments into React.jsxDEV rather than through props

Part of the rationale for this change is that we want to deprecate key spread through props because this is an expensive dynamic comparison operation. We want users instead always explicitly pass key as a prop. However, in the interim, we need a way to distinguish between <div {...props} key={foo} /> and <div key={foo} {...props} />. Therefore, until we completely deprecate key spreading, we will use React.createElement to transform <div {...props} key="Hi" /> and React.jsx to transform everything else.
2019-08-27 16:00:20 -07:00
Nicolas Gallagher cb15f18dc1 [react-events] Improve mock event object accuracy (#16590)
* Better simulation for pointercancel
* Fix pressure values for different pointers
* Add describe/test helpers for pointer events
2019-08-27 15:45:54 -07:00
Brian Vaughn bc8b15332b Updated README docs, example screenshots, etc 2019-08-27 15:20:34 -07:00
Brian Vaughn 7153dd516f Fixed a StyleEditor variable resolution regression 2019-08-27 12:53:38 -07:00
Brian Vaughn 33d439f8fd Merge branch 'master' into devtools-v4-merge 2019-08-27 11:00:41 -07:00
Brian Vaughn fb316787cb Removed unused Chrome Flow types 2019-08-27 10:54:21 -07:00
Brian Vaughn 8e1434e80e Added FB copyright header 2019-08-27 10:54:01 -07:00
Brian Vaughn 49b0f87d10 Suppress act/renderer warning for DevTools tests 2019-08-27 10:46:27 -07:00
Brian Vaughn 8c684bf7e1 Removed forked DevTools Flow types 2019-08-27 10:42:02 -07:00
Brian Vaughn 9a016c0c2b Removed outdated snapshot 2019-08-27 10:31:36 -07:00