react-dom 16.4.2 → 16.5.0
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/README.md +1 -1
- package/cjs/react-dom-server.browser.development.js +474 -181
- package/cjs/react-dom-server.browser.production.min.js +33 -31
- package/cjs/react-dom-server.node.development.js +474 -181
- package/cjs/react-dom-server.node.production.min.js +36 -34
- package/cjs/react-dom-test-utils.development.js +260 -102
- package/cjs/react-dom-test-utils.production.min.js +23 -23
- package/cjs/react-dom-unstable-native-dependencies.development.js +180 -82
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +28 -27
- package/cjs/react-dom.development.js +3431 -2774
- package/cjs/react-dom.production.min.js +224 -228
- package/cjs/react-dom.profiling.min.js +233 -230
- package/package.json +4 -3
- package/profiling.js +38 -0
- package/umd/react-dom-server.browser.development.js +449 -447
- package/umd/react-dom-server.browser.production.min.js +29 -30
- package/umd/react-dom-test-utils.development.js +201 -225
- package/umd/react-dom-test-utils.production.min.js +21 -21
- package/umd/react-dom-unstable-native-dependencies.development.js +112 -163
- package/umd/react-dom-unstable-native-dependencies.production.min.js +23 -23
- package/umd/react-dom.development.js +3419 -3217
- package/umd/react-dom.production.min.js +184 -188
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.5.0
|
|
2
2
|
* react-dom-test-utils.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -7,27 +7,27 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
'use strict';var
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
b)
|
|
24
|
-
|
|
25
|
-
a
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
function
|
|
30
|
-
[["abort","abort"],[
|
|
10
|
+
'use strict';var g=require("object-assign"),l=require("react"),m=require("react-dom");function n(a,b,c,e,d,k,f,h){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var L=[c,e,d,k,f,h],M=0;a=Error(b.replace(/%s/g,function(){return L[M++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
|
|
11
|
+
function p(a){for(var b=arguments.length-1,c="https://reactjs.org/docs/error-decoder.html?invariant="+a,e=0;e<b;e++)c+="&args[]="+encodeURIComponent(arguments[e+1]);n(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",c)}
|
|
12
|
+
function q(a){var b=a;if(a.alternate)for(;b.return;)b=b.return;else{if(0!==(b.effectTag&2))return 1;for(;b.return;)if(b=b.return,0!==(b.effectTag&2))return 1}return 5===b.tag?2:3}function r(a){2!==q(a)?p("188"):void 0}
|
|
13
|
+
function t(a){var b=a.alternate;if(!b)return b=q(a),3===b?p("188"):void 0,1===b?null:a;for(var c=a,e=b;;){var d=c.return,k=d?d.alternate:null;if(!d||!k)break;if(d.child===k.child){for(var f=d.child;f;){if(f===c)return r(d),a;if(f===e)return r(d),b;f=f.sibling}p("188")}if(c.return!==e.return)c=d,e=k;else{f=!1;for(var h=d.child;h;){if(h===c){f=!0;c=d;e=k;break}if(h===e){f=!0;e=d;c=k;break}h=h.sibling}if(!f){for(h=k.child;h;){if(h===c){f=!0;c=k;e=d;break}if(h===e){f=!0;e=k;c=d;break}h=h.sibling}f?void 0:
|
|
14
|
+
p("189")}}c.alternate!==e?p("190"):void 0}5!==c.tag?p("188"):void 0;return c.stateNode.current===c?a:b}function u(){return!0}function v(){return!1}function w(a,b,c,e){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var d in a)a.hasOwnProperty(d)&&((b=a[d])?this[d]=b(c):"target"===d?this.target=e:this[d]=c[d]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?u:v;this.isPropagationStopped=v;return this}
|
|
15
|
+
g(w.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=u)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=u)},persist:function(){this.isPersistent=u},isPersistent:v,destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=
|
|
16
|
+
null;this.nativeEvent=this._targetInst=this.dispatchConfig=null;this.isPropagationStopped=this.isDefaultPrevented=v;this._dispatchInstances=this._dispatchListeners=null}});w.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};
|
|
17
|
+
w.extend=function(a){function b(){}function c(){return e.apply(this,arguments)}var e=this;b.prototype=e.prototype;var d=new b;g(d,c.prototype);c.prototype=d;c.prototype.constructor=c;c.Interface=g({},e.Interface,a);c.extend=e.extend;x(c);return c};x(w);function y(a,b,c,e){if(this.eventPool.length){var d=this.eventPool.pop();this.call(d,a,b,c,e);return d}return new this(a,b,c,e)}function z(a){a instanceof this?void 0:p("279");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}
|
|
18
|
+
function x(a){a.eventPool=[];a.getPooled=y;a.release=z}var A=!("undefined"===typeof window||!window.document||!window.document.createElement);function B(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}var C={animationend:B("Animation","AnimationEnd"),animationiteration:B("Animation","AnimationIteration"),animationstart:B("Animation","AnimationStart"),transitionend:B("Transition","TransitionEnd")},D={},E={};
|
|
19
|
+
A&&(E=document.createElement("div").style,"AnimationEvent"in window||(delete C.animationend.animation,delete C.animationiteration.animation,delete C.animationstart.animation),"TransitionEvent"in window||delete C.transitionend.transition);function F(a){if(D[a])return D[a];if(!C[a])return a;var b=C[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in E)return D[a]=b[c];return a}
|
|
20
|
+
var G=F("animationend"),H=F("animationiteration"),I=F("animationstart"),J=F("transitionend"),K=m.findDOMNode,N=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,O=N[0],P=N[3],Q=N[4],R=N[5],S=N[6],aa=N[7],T=N[8],ba=N[9];function U(){}
|
|
21
|
+
function ca(a,b){if(!a)return[];a=t(a);if(!a)return[];for(var c=a,e=[];;){if(7===c.tag||8===c.tag||2===c.tag||3===c.tag||0===c.tag||1===c.tag){var d=c.stateNode;b(d)&&e.push(d)}if(c.child)c.child.return=c,c=c.child;else{if(c===a)return e;for(;!c.sibling;){if(!c.return||c.return===a)return e;c=c.return}c.sibling.return=c.return;c=c.sibling}}}
|
|
22
|
+
function V(a,b){if(a&&!a._reactInternalFiber){var c=""+a;a=Array.isArray(a)?"an array":a&&1===a.nodeType&&a.tagName?"a DOM node":"[object Object]"===c?"object with keys {"+Object.keys(a).join(", ")+"}":c;p("286",b,a)}}
|
|
23
|
+
var W={renderIntoDocument:function(a){var b=document.createElement("div");return m.render(a,b)},isElement:function(a){return l.isValidElement(a)},isElementOfType:function(a,b){return l.isValidElement(a)&&a.type===b},isDOMComponent:function(a){return!(!a||1!==a.nodeType||!a.tagName)},isDOMComponentElement:function(a){return!!(a&&l.isValidElement(a)&&a.tagName)},isCompositeComponent:function(a){return W.isDOMComponent(a)?!1:null!=a&&"function"===typeof a.render&&"function"===typeof a.setState},isCompositeComponentWithType:function(a,
|
|
24
|
+
b){return W.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){V(a,"findAllInRenderedTree");return a?ca(a._reactInternalFiber,b):[]},scryRenderedDOMComponentsWithClass:function(a,b){V(a,"scryRenderedDOMComponentsWithClass");return W.findAllInRenderedTree(a,function(a){if(W.isDOMComponent(a)){var c=a.className;"string"!==typeof c&&(c=a.getAttribute("class")||"");var d=c.split(/\s+/);Array.isArray(b)||(void 0===b?p("11"):void 0,b=b.split(/\s+/));return b.every(function(a){return-1!==
|
|
25
|
+
d.indexOf(a)})}return!1})},findRenderedDOMComponentWithClass:function(a,b){V(a,"findRenderedDOMComponentWithClass");a=W.scryRenderedDOMComponentsWithClass(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for class:"+b);return a[0]},scryRenderedDOMComponentsWithTag:function(a,b){V(a,"scryRenderedDOMComponentsWithTag");return W.findAllInRenderedTree(a,function(a){return W.isDOMComponent(a)&&a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,
|
|
26
|
+
b){V(a,"findRenderedDOMComponentWithTag");a=W.scryRenderedDOMComponentsWithTag(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for tag:"+b);return a[0]},scryRenderedComponentsWithType:function(a,b){V(a,"scryRenderedComponentsWithType");return W.findAllInRenderedTree(a,function(a){return W.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,b){V(a,"findRenderedComponentWithType");a=W.scryRenderedComponentsWithType(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+
|
|
27
|
+
a.length+") for componentType:"+b);return a[0]},mockComponent:function(a,b){b=b||a.mockTagName||"div";a.prototype.render.mockImplementation(function(){return l.createElement(b,null,this.props.children)});return this},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{}};
|
|
28
|
+
function da(a){return function(b,c){l.isValidElement(b)?p("228"):void 0;W.isCompositeComponent(b)?p("229"):void 0;var e=P[a],d=new U;d.target=b;d.type=a.toLowerCase();var k=O(b),f=new w(e,k,d,b);f.persist();g(f,c);e.phasedRegistrationNames?Q(f):R(f);m.unstable_batchedUpdates(function(){S(b);ba(f,!0)});aa()}}W.Simulate={};var X=void 0;for(X in P)W.Simulate[X]=da(X);
|
|
29
|
+
function ea(a,b){return function(c,e){var d=new U(a);g(d,e);W.isDOMComponent(c)?(c=K(c),d.target=c,T(b,d)):c.tagName&&(d.target=c,T(b,d))}}
|
|
30
|
+
[["abort","abort"],[G,"animationEnd"],[H,"animationIteration"],[I,"animationStart"],["blur","blur"],["canplaythrough","canPlayThrough"],["canplay","canPlay"],["cancel","cancel"],["change","change"],["click","click"],["close","close"],["compositionend","compositionEnd"],["compositionstart","compositionStart"],["compositionupdate","compositionUpdate"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragenter","dragEnter"],["dragexit","dragExit"],
|
|
31
31
|
["dragleave","dragLeave"],["dragover","dragOver"],["dragstart","dragStart"],["drag","drag"],["drop","drop"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],["ended","ended"],["error","error"],["focus","focus"],["input","input"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["loadstart","loadStart"],["loadstart","loadStart"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["mousedown","mouseDown"],["mousemove","mouseMove"],
|
|
32
32
|
["mouseout","mouseOut"],["mouseover","mouseOver"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["playing","playing"],["progress","progress"],["ratechange","rateChange"],["scroll","scroll"],["seeked","seeked"],["seeking","seeking"],["selectionchange","selectionChange"],["stalled","stalled"],["suspend","suspend"],["textInput","textInput"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchmove","touchMove"],["touchstart",
|
|
33
|
-
"touchStart"],[
|
|
33
|
+
"touchStart"],[J,"transitionEnd"],["volumechange","volumeChange"],["waiting","waiting"],["wheel","wheel"]].forEach(function(a){var b=a[1];W.SimulateNative[b]=ea(b,a[0])});var Y={default:W},Z=Y&&W||Y;module.exports=Z.default||Z;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.5.0
|
|
2
2
|
* react-dom-unstable-native-dependencies.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -16,13 +16,52 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
var ReactDOM = require('react-dom');
|
|
19
|
-
var invariant = require('fbjs/lib/invariant');
|
|
20
|
-
var warning = require('fbjs/lib/warning');
|
|
21
19
|
var _assign = require('object-assign');
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
23
|
+
*
|
|
24
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
25
|
+
* to provide information about what broke and what you were
|
|
26
|
+
* expecting.
|
|
27
|
+
*
|
|
28
|
+
* The invariant message will be stripped in production, but the invariant
|
|
29
|
+
* will remain to ensure logic does not differ in production.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
var validateFormat = function () {};
|
|
33
|
+
|
|
34
|
+
{
|
|
35
|
+
validateFormat = function (format) {
|
|
36
|
+
if (format === undefined) {
|
|
37
|
+
throw new Error('invariant requires an error message argument');
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function invariant(condition, format, a, b, c, d, e, f) {
|
|
43
|
+
validateFormat(format);
|
|
44
|
+
|
|
45
|
+
if (!condition) {
|
|
46
|
+
var error = void 0;
|
|
47
|
+
if (format === undefined) {
|
|
48
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
49
|
+
} else {
|
|
50
|
+
var args = [a, b, c, d, e, f];
|
|
51
|
+
var argIndex = 0;
|
|
52
|
+
error = new Error(format.replace(/%s/g, function () {
|
|
53
|
+
return args[argIndex++];
|
|
54
|
+
}));
|
|
55
|
+
error.name = 'Invariant Violation';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
23
62
|
|
|
24
63
|
// Relying on the `invariant()` implementation lets us
|
|
25
|
-
//
|
|
64
|
+
// preserve the format and params in the www builds.
|
|
26
65
|
|
|
27
66
|
{
|
|
28
67
|
// In DEV mode, we swap out invokeGuardedCallback for a special version
|
|
@@ -53,21 +92,94 @@ var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
|
53
92
|
}
|
|
54
93
|
}
|
|
55
94
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Call a function while guarding against errors that happens within it.
|
|
97
|
+
* Returns an error if it throws, otherwise null.
|
|
98
|
+
*
|
|
99
|
+
* In production, this is implemented using a try-catch. The reason we don't
|
|
100
|
+
* use a try-catch directly is so that we can swap out a different
|
|
101
|
+
* implementation in DEV mode.
|
|
102
|
+
*
|
|
103
|
+
* @param {String} name of the guard to use for logging or debugging
|
|
104
|
+
* @param {Function} func The function to invoke
|
|
105
|
+
* @param {*} context The context to use when calling the function
|
|
106
|
+
* @param {...*} args Arguments for function
|
|
107
|
+
*/
|
|
59
108
|
|
|
60
|
-
var injection = {
|
|
61
|
-
injectComponentTree: function (Injected) {
|
|
62
|
-
getFiberCurrentPropsFromNode = Injected.getFiberCurrentPropsFromNode;
|
|
63
|
-
getInstanceFromNode = Injected.getInstanceFromNode;
|
|
64
|
-
getNodeFromInstance = Injected.getNodeFromInstance;
|
|
65
109
|
|
|
66
|
-
|
|
67
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Same as invokeGuardedCallback, but instead of returning an error, it stores
|
|
112
|
+
* it in a global so it can be rethrown by `rethrowCaughtError` later.
|
|
113
|
+
* TODO: See if caughtError and rethrowError can be unified.
|
|
114
|
+
*
|
|
115
|
+
* @param {String} name of the guard to use for logging or debugging
|
|
116
|
+
* @param {Function} func The function to invoke
|
|
117
|
+
* @param {*} context The context to use when calling the function
|
|
118
|
+
* @param {...*} args Arguments for function
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* During execution of guarded functions we will capture the first error which
|
|
124
|
+
* we will rethrow to be handled by the top level error handler.
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
129
|
+
* This can be used to log issues in development environments in critical
|
|
130
|
+
* paths. Removing the logging code for production environments will keep the
|
|
131
|
+
* same logic and follow the same code paths.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
var warningWithoutStack = function () {};
|
|
135
|
+
|
|
136
|
+
{
|
|
137
|
+
warningWithoutStack = function (condition, format) {
|
|
138
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
139
|
+
args[_key - 2] = arguments[_key];
|
|
68
140
|
}
|
|
141
|
+
|
|
142
|
+
if (format === undefined) {
|
|
143
|
+
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
144
|
+
}
|
|
145
|
+
if (condition) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (typeof console !== 'undefined') {
|
|
149
|
+
var _console;
|
|
150
|
+
|
|
151
|
+
var stringArgs = args.map(function (item) {
|
|
152
|
+
return '' + item;
|
|
153
|
+
});
|
|
154
|
+
(_console = console).error.apply(_console, ['Warning: ' + format].concat(stringArgs));
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
// --- Welcome to debugging React ---
|
|
158
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
159
|
+
// to find the callsite that caused this warning to fire.
|
|
160
|
+
var argIndex = 0;
|
|
161
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
162
|
+
return args[argIndex++];
|
|
163
|
+
});
|
|
164
|
+
throw new Error(message);
|
|
165
|
+
} catch (x) {}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
var warningWithoutStack$1 = warningWithoutStack;
|
|
170
|
+
|
|
171
|
+
var getFiberCurrentPropsFromNode$1 = null;
|
|
172
|
+
var getInstanceFromNode$1 = null;
|
|
173
|
+
var getNodeFromInstance$1 = null;
|
|
174
|
+
|
|
175
|
+
function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
|
|
176
|
+
getFiberCurrentPropsFromNode$1 = getFiberCurrentPropsFromNodeImpl;
|
|
177
|
+
getInstanceFromNode$1 = getInstanceFromNodeImpl;
|
|
178
|
+
getNodeFromInstance$1 = getNodeFromInstanceImpl;
|
|
179
|
+
{
|
|
180
|
+
!(getNodeFromInstance$1 && getInstanceFromNode$1) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
|
|
69
181
|
}
|
|
70
|
-
}
|
|
182
|
+
}
|
|
71
183
|
|
|
72
184
|
var validateEventDispatches = void 0;
|
|
73
185
|
{
|
|
@@ -81,7 +193,7 @@ var validateEventDispatches = void 0;
|
|
|
81
193
|
var instancesIsArr = Array.isArray(dispatchInstances);
|
|
82
194
|
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
|
|
83
195
|
|
|
84
|
-
!(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ?
|
|
196
|
+
!(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
|
|
85
197
|
};
|
|
86
198
|
}
|
|
87
199
|
|
|
@@ -147,7 +259,7 @@ function executeDirectDispatch(event) {
|
|
|
147
259
|
var dispatchListener = event._dispatchListeners;
|
|
148
260
|
var dispatchInstance = event._dispatchInstances;
|
|
149
261
|
!!Array.isArray(dispatchListener) ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : void 0;
|
|
150
|
-
event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null;
|
|
262
|
+
event.currentTarget = dispatchListener ? getNodeFromInstance$1(dispatchInstance) : null;
|
|
151
263
|
var res = dispatchListener ? dispatchListener(event) : null;
|
|
152
264
|
event.currentTarget = null;
|
|
153
265
|
event._dispatchListeners = null;
|
|
@@ -164,11 +276,9 @@ function hasDispatches(event) {
|
|
|
164
276
|
}
|
|
165
277
|
|
|
166
278
|
// Before we know whether it is functional or class
|
|
167
|
-
|
|
168
|
-
|
|
169
279
|
// Root of a host tree. Could be nested inside another node.
|
|
170
280
|
// A subtree. Could be an entry point to a different renderer.
|
|
171
|
-
var HostComponent =
|
|
281
|
+
var HostComponent = 7;
|
|
172
282
|
|
|
173
283
|
function getParent(inst) {
|
|
174
284
|
do {
|
|
@@ -447,7 +557,7 @@ function getListener(inst, registrationName) {
|
|
|
447
557
|
// Work in progress (ex: onload events in incremental mode).
|
|
448
558
|
return null;
|
|
449
559
|
}
|
|
450
|
-
var props = getFiberCurrentPropsFromNode(stateNode);
|
|
560
|
+
var props = getFiberCurrentPropsFromNode$1(stateNode);
|
|
451
561
|
if (!props) {
|
|
452
562
|
// Work in progress.
|
|
453
563
|
return null;
|
|
@@ -487,7 +597,7 @@ function listenerAtPhase(inst, event, propagationPhase) {
|
|
|
487
597
|
*/
|
|
488
598
|
function accumulateDirectionalDispatches(inst, phase, event) {
|
|
489
599
|
{
|
|
490
|
-
!inst ?
|
|
600
|
+
!inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
|
|
491
601
|
}
|
|
492
602
|
var listener = listenerAtPhase(inst, event, phase);
|
|
493
603
|
if (listener) {
|
|
@@ -563,11 +673,8 @@ function accumulateDirectDispatches(events) {
|
|
|
563
673
|
|
|
564
674
|
/* eslint valid-typeof: 0 */
|
|
565
675
|
|
|
566
|
-
var didWarnForAddedNewProperty = false;
|
|
567
676
|
var EVENT_POOL_SIZE = 10;
|
|
568
677
|
|
|
569
|
-
var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
|
|
570
|
-
|
|
571
678
|
/**
|
|
572
679
|
* @interface Event
|
|
573
680
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
@@ -576,7 +683,9 @@ var EventInterface = {
|
|
|
576
683
|
type: null,
|
|
577
684
|
target: null,
|
|
578
685
|
// currentTarget is set when dispatching; no use in copying it here
|
|
579
|
-
currentTarget:
|
|
686
|
+
currentTarget: function () {
|
|
687
|
+
return null;
|
|
688
|
+
},
|
|
580
689
|
eventPhase: null,
|
|
581
690
|
bubbles: null,
|
|
582
691
|
cancelable: null,
|
|
@@ -587,6 +696,14 @@ var EventInterface = {
|
|
|
587
696
|
isTrusted: null
|
|
588
697
|
};
|
|
589
698
|
|
|
699
|
+
function functionThatReturnsTrue() {
|
|
700
|
+
return true;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
function functionThatReturnsFalse() {
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
|
|
590
707
|
/**
|
|
591
708
|
* Synthetic events are dispatched by event plugins, typically in response to a
|
|
592
709
|
* top-level event delegation handler.
|
|
@@ -611,6 +728,8 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
|
|
|
611
728
|
delete this.nativeEvent;
|
|
612
729
|
delete this.preventDefault;
|
|
613
730
|
delete this.stopPropagation;
|
|
731
|
+
delete this.isDefaultPrevented;
|
|
732
|
+
delete this.isPropagationStopped;
|
|
614
733
|
}
|
|
615
734
|
|
|
616
735
|
this.dispatchConfig = dispatchConfig;
|
|
@@ -639,11 +758,11 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
|
|
|
639
758
|
|
|
640
759
|
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
|
641
760
|
if (defaultPrevented) {
|
|
642
|
-
this.isDefaultPrevented =
|
|
761
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
643
762
|
} else {
|
|
644
|
-
this.isDefaultPrevented =
|
|
763
|
+
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
645
764
|
}
|
|
646
|
-
this.isPropagationStopped =
|
|
765
|
+
this.isPropagationStopped = functionThatReturnsFalse;
|
|
647
766
|
return this;
|
|
648
767
|
}
|
|
649
768
|
|
|
@@ -660,7 +779,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
660
779
|
} else if (typeof event.returnValue !== 'unknown') {
|
|
661
780
|
event.returnValue = false;
|
|
662
781
|
}
|
|
663
|
-
this.isDefaultPrevented =
|
|
782
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
664
783
|
},
|
|
665
784
|
|
|
666
785
|
stopPropagation: function () {
|
|
@@ -680,7 +799,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
680
799
|
event.cancelBubble = true;
|
|
681
800
|
}
|
|
682
801
|
|
|
683
|
-
this.isPropagationStopped =
|
|
802
|
+
this.isPropagationStopped = functionThatReturnsTrue;
|
|
684
803
|
},
|
|
685
804
|
|
|
686
805
|
/**
|
|
@@ -689,7 +808,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
689
808
|
* won't be added back into the pool.
|
|
690
809
|
*/
|
|
691
810
|
persist: function () {
|
|
692
|
-
this.isPersistent =
|
|
811
|
+
this.isPersistent = functionThatReturnsTrue;
|
|
693
812
|
},
|
|
694
813
|
|
|
695
814
|
/**
|
|
@@ -697,7 +816,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
697
816
|
*
|
|
698
817
|
* @return {boolean} True if this should not be released, false otherwise.
|
|
699
818
|
*/
|
|
700
|
-
isPersistent:
|
|
819
|
+
isPersistent: functionThatReturnsFalse,
|
|
701
820
|
|
|
702
821
|
/**
|
|
703
822
|
* `PooledClass` looks for `destructor` on each instance it releases.
|
|
@@ -709,13 +828,19 @@ _assign(SyntheticEvent.prototype, {
|
|
|
709
828
|
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
|
|
710
829
|
}
|
|
711
830
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
831
|
+
this.dispatchConfig = null;
|
|
832
|
+
this._targetInst = null;
|
|
833
|
+
this.nativeEvent = null;
|
|
834
|
+
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
835
|
+
this.isPropagationStopped = functionThatReturnsFalse;
|
|
836
|
+
this._dispatchListeners = null;
|
|
837
|
+
this._dispatchInstances = null;
|
|
715
838
|
{
|
|
716
839
|
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
|
|
717
|
-
Object.defineProperty(this, '
|
|
718
|
-
Object.defineProperty(this, '
|
|
840
|
+
Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
|
|
841
|
+
Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
|
|
842
|
+
Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
|
|
843
|
+
Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
|
|
719
844
|
}
|
|
720
845
|
}
|
|
721
846
|
});
|
|
@@ -746,38 +871,6 @@ SyntheticEvent.extend = function (Interface) {
|
|
|
746
871
|
return Class;
|
|
747
872
|
};
|
|
748
873
|
|
|
749
|
-
/** Proxying after everything set on SyntheticEvent
|
|
750
|
-
* to resolve Proxy issue on some WebKit browsers
|
|
751
|
-
* in which some Event properties are set to undefined (GH#10010)
|
|
752
|
-
*/
|
|
753
|
-
{
|
|
754
|
-
var isProxySupported = typeof Proxy === 'function' &&
|
|
755
|
-
// https://github.com/facebook/react/issues/12011
|
|
756
|
-
!Object.isSealed(new Proxy({}, {}));
|
|
757
|
-
|
|
758
|
-
if (isProxySupported) {
|
|
759
|
-
/*eslint-disable no-func-assign */
|
|
760
|
-
SyntheticEvent = new Proxy(SyntheticEvent, {
|
|
761
|
-
construct: function (target, args) {
|
|
762
|
-
return this.apply(target, Object.create(target.prototype), args);
|
|
763
|
-
},
|
|
764
|
-
apply: function (constructor, that, args) {
|
|
765
|
-
return new Proxy(constructor.apply(that, args), {
|
|
766
|
-
set: function (target, prop, value) {
|
|
767
|
-
if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
|
|
768
|
-
!(didWarnForAddedNewProperty || target.isPersistent()) ? warning(false, "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
|
|
769
|
-
didWarnForAddedNewProperty = true;
|
|
770
|
-
}
|
|
771
|
-
target[prop] = value;
|
|
772
|
-
return true;
|
|
773
|
-
}
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
});
|
|
777
|
-
/*eslint-enable no-func-assign */
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
781
874
|
addEventPoolingTo(SyntheticEvent);
|
|
782
875
|
|
|
783
876
|
/**
|
|
@@ -810,7 +903,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
|
|
|
810
903
|
|
|
811
904
|
function warn(action, result) {
|
|
812
905
|
var warningCondition = false;
|
|
813
|
-
!warningCondition ?
|
|
906
|
+
!warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
|
|
814
907
|
}
|
|
815
908
|
}
|
|
816
909
|
|
|
@@ -826,7 +919,7 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
|
|
|
826
919
|
|
|
827
920
|
function releasePooledEvent(event) {
|
|
828
921
|
var EventConstructor = this;
|
|
829
|
-
!(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance
|
|
922
|
+
!(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
|
|
830
923
|
event.destructor();
|
|
831
924
|
if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
|
|
832
925
|
EventConstructor.eventPool.push(event);
|
|
@@ -839,14 +932,12 @@ function addEventPoolingTo(EventConstructor) {
|
|
|
839
932
|
EventConstructor.release = releasePooledEvent;
|
|
840
933
|
}
|
|
841
934
|
|
|
842
|
-
var SyntheticEvent$1 = SyntheticEvent;
|
|
843
|
-
|
|
844
935
|
/**
|
|
845
936
|
* `touchHistory` isn't actually on the native event, but putting it in the
|
|
846
937
|
* interface will ensure that it is cleaned up when pooled/destroyed. The
|
|
847
938
|
* `ResponderEventPlugin` will populate it appropriately.
|
|
848
939
|
*/
|
|
849
|
-
var ResponderSyntheticEvent = SyntheticEvent
|
|
940
|
+
var ResponderSyntheticEvent = SyntheticEvent.extend({
|
|
850
941
|
touchHistory: function (nativeEvent) {
|
|
851
942
|
return null; // Actually doesn't even look at the native event.
|
|
852
943
|
}
|
|
@@ -944,7 +1035,7 @@ function getTouchIdentifier(_ref) {
|
|
|
944
1035
|
|
|
945
1036
|
!(identifier != null) ? invariant(false, 'Touch object is missing identifier.') : void 0;
|
|
946
1037
|
{
|
|
947
|
-
!(identifier <= MAX_TOUCH_BANK) ?
|
|
1038
|
+
!(identifier <= MAX_TOUCH_BANK) ? warningWithoutStack$1(false, 'Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK) : void 0;
|
|
948
1039
|
}
|
|
949
1040
|
return identifier;
|
|
950
1041
|
}
|
|
@@ -1032,7 +1123,7 @@ var ResponderTouchHistoryStore = {
|
|
|
1032
1123
|
}
|
|
1033
1124
|
{
|
|
1034
1125
|
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
1035
|
-
!(activeRecord != null && activeRecord.touchActive) ?
|
|
1126
|
+
!(activeRecord != null && activeRecord.touchActive) ? warningWithoutStack$1(false, 'Cannot find single active touch.') : void 0;
|
|
1036
1127
|
}
|
|
1037
1128
|
}
|
|
1038
1129
|
}
|
|
@@ -1466,7 +1557,7 @@ function noResponderTouches(nativeEvent) {
|
|
|
1466
1557
|
var target = activeTouch.target;
|
|
1467
1558
|
if (target !== null && target !== undefined && target !== 0) {
|
|
1468
1559
|
// Is the original touch location inside of the current responder?
|
|
1469
|
-
var targetInst = getInstanceFromNode(target);
|
|
1560
|
+
var targetInst = getInstanceFromNode$1(target);
|
|
1470
1561
|
if (isAncestor(responderInst, targetInst)) {
|
|
1471
1562
|
return false;
|
|
1472
1563
|
}
|
|
@@ -1554,11 +1645,18 @@ var ResponderEventPlugin = {
|
|
|
1554
1645
|
};
|
|
1555
1646
|
|
|
1556
1647
|
// This is used by react-native-web.
|
|
1557
|
-
|
|
1648
|
+
function injectComponentTree(ComponentTree) {
|
|
1649
|
+
setComponentTree(ComponentTree.getFiberCurrentPropsFromNode, ComponentTree.getInstanceFromNode, ComponentTree.getNodeFromInstance);
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1558
1652
|
// Inject react-dom's ComponentTree into this module.
|
|
1559
|
-
|
|
1653
|
+
// Keep in sync with ReactDOM.js and ReactTestUtils.js:
|
|
1654
|
+
var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
|
|
1655
|
+
var getInstanceFromNode = _ReactDOM$__SECRET_IN[0];
|
|
1656
|
+
var getNodeFromInstance = _ReactDOM$__SECRET_IN[1];
|
|
1657
|
+
var getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2];
|
|
1560
1658
|
|
|
1561
|
-
|
|
1659
|
+
setComponentTree(getFiberCurrentPropsFromNode, getInstanceFromNode, getNodeFromInstance);
|
|
1562
1660
|
|
|
1563
1661
|
var ReactDOMUnstableNativeDependencies = Object.freeze({
|
|
1564
1662
|
injectComponentTree: injectComponentTree,
|