react 15.2.1 → 15.3.0-rc.1
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/dist/react-with-addons.js +1058 -791
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +987 -722
- package/dist/react.min.js +6 -6
- package/lib/EventPluginHub.js +14 -6
- package/lib/LinkedValueUtils.js +2 -1
- package/lib/NativeMethodsMixin.js +1 -1
- package/lib/React.js +2 -0
- package/lib/ReactChildReconciler.js +5 -1
- package/lib/ReactChildrenMutationWarningDevtool.js +62 -0
- package/lib/ReactClass.js +7 -0
- package/lib/ReactCompositeComponent.js +76 -25
- package/lib/ReactDOMComponent.js +22 -0
- package/lib/ReactDebugTool.js +10 -0
- package/lib/ReactElement.js +8 -0
- package/lib/ReactMultiChild.js +11 -8
- package/lib/ReactPropTypes.js +24 -12
- package/lib/ReactPropTypesSecret.js +16 -0
- package/lib/ReactPureComponent.js +42 -0
- package/lib/ReactReconciler.js +2 -4
- package/lib/ReactRef.js +3 -1
- package/lib/ReactTestMount.js +28 -15
- package/lib/ReactTestRenderer.js +11 -0
- package/lib/ReactTestUtils.js +2 -0
- package/lib/ReactVersion.js +1 -1
- package/lib/SVGDOMPropertyConfig.js +2 -0
- package/lib/SimpleEventPlugin.js +10 -6
- package/lib/checkReactTypeSpec.js +2 -1
- package/lib/traverseAllChildren.js +8 -1
- package/package.json +1 -1
package/lib/ReactTestRenderer.js
CHANGED
|
@@ -15,6 +15,7 @@ var _assign = require('object-assign');
|
|
|
15
15
|
|
|
16
16
|
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
17
17
|
|
|
18
|
+
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
18
19
|
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
|
|
19
20
|
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
20
21
|
var ReactMultiChild = require('./ReactMultiChild');
|
|
@@ -56,6 +57,11 @@ ReactTestComponent.prototype.receiveComponent = function (nextElement, transacti
|
|
|
56
57
|
this.updateChildren(nextElement.props.children, transaction, context);
|
|
57
58
|
};
|
|
58
59
|
ReactTestComponent.prototype.getHostNode = function () {};
|
|
60
|
+
ReactTestComponent.prototype.getPublicInstance = function () {
|
|
61
|
+
// I can't say this makes a ton of sense but it seems better than throwing.
|
|
62
|
+
// Maybe we'll revise later if someone has a good use case.
|
|
63
|
+
return null;
|
|
64
|
+
};
|
|
59
65
|
ReactTestComponent.prototype.unmountComponent = function () {};
|
|
60
66
|
ReactTestComponent.prototype.toJSON = function () {
|
|
61
67
|
var _currentElement$props = this._currentElement.props;
|
|
@@ -121,6 +127,11 @@ ReactEmptyComponent.injection.injectEmptyComponentFactory(function () {
|
|
|
121
127
|
return new ReactTestEmptyComponent();
|
|
122
128
|
});
|
|
123
129
|
|
|
130
|
+
ReactComponentEnvironment.injection.injectEnvironment({
|
|
131
|
+
processChildrenUpdates: function () {},
|
|
132
|
+
replaceNodeWithMarkup: function () {}
|
|
133
|
+
});
|
|
134
|
+
|
|
124
135
|
var ReactTestRenderer = {
|
|
125
136
|
create: ReactTestMount.render,
|
|
126
137
|
|
package/lib/ReactTestUtils.js
CHANGED
|
@@ -424,6 +424,8 @@ function makeSimulator(eventType) {
|
|
|
424
424
|
|
|
425
425
|
var fakeNativeEvent = new Event();
|
|
426
426
|
fakeNativeEvent.target = node;
|
|
427
|
+
fakeNativeEvent.type = eventType.toLowerCase();
|
|
428
|
+
|
|
427
429
|
// We don't use SyntheticEvent.getPooled in order to not have to worry about
|
|
428
430
|
// properly destroying any properties assigned from `eventData` upon release
|
|
429
431
|
var event = new SyntheticEvent(dispatchConfig, ReactDOMComponentTree.getInstanceFromNode(node), fakeNativeEvent, node);
|
package/lib/ReactVersion.js
CHANGED
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -485,6 +485,10 @@ for (var type in topLevelEventsToDispatchConfig) {
|
|
|
485
485
|
var ON_CLICK_KEY = keyOf({ onClick: null });
|
|
486
486
|
var onClickListeners = {};
|
|
487
487
|
|
|
488
|
+
function getDictionaryKey(inst) {
|
|
489
|
+
return '.' + inst._rootNodeID;
|
|
490
|
+
}
|
|
491
|
+
|
|
488
492
|
var SimpleEventPlugin = {
|
|
489
493
|
|
|
490
494
|
eventTypes: eventTypes,
|
|
@@ -608,19 +612,19 @@ var SimpleEventPlugin = {
|
|
|
608
612
|
// fire. The workaround for this bug involves attaching an empty click
|
|
609
613
|
// listener on the target node.
|
|
610
614
|
if (registrationName === ON_CLICK_KEY) {
|
|
611
|
-
var
|
|
615
|
+
var key = getDictionaryKey(inst);
|
|
612
616
|
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
|
|
613
|
-
if (!onClickListeners[
|
|
614
|
-
onClickListeners[
|
|
617
|
+
if (!onClickListeners[key]) {
|
|
618
|
+
onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
|
|
615
619
|
}
|
|
616
620
|
}
|
|
617
621
|
},
|
|
618
622
|
|
|
619
623
|
willDeleteListener: function (inst, registrationName) {
|
|
620
624
|
if (registrationName === ON_CLICK_KEY) {
|
|
621
|
-
var
|
|
622
|
-
onClickListeners[
|
|
623
|
-
delete onClickListeners[
|
|
625
|
+
var key = getDictionaryKey(inst);
|
|
626
|
+
onClickListeners[key].remove();
|
|
627
|
+
delete onClickListeners[key];
|
|
624
628
|
}
|
|
625
629
|
}
|
|
626
630
|
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
var _prodInvariant = require('./reactProdInvariant');
|
|
15
15
|
|
|
16
16
|
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
|
|
17
|
+
var ReactPropTypesSecret = require('./ReactPropTypesSecret');
|
|
17
18
|
|
|
18
19
|
var invariant = require('fbjs/lib/invariant');
|
|
19
20
|
var warning = require('fbjs/lib/warning');
|
|
@@ -43,7 +44,7 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
|
|
|
43
44
|
// This is intentionally an invariant that gets caught. It's the same
|
|
44
45
|
// behavior as without this statement except with a better message.
|
|
45
46
|
!(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
|
|
46
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location);
|
|
47
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
47
48
|
} catch (ex) {
|
|
48
49
|
error = ex;
|
|
49
50
|
}
|
|
@@ -98,7 +98,14 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
98
98
|
}
|
|
99
99
|
} else {
|
|
100
100
|
if (process.env.NODE_ENV !== 'production') {
|
|
101
|
-
|
|
101
|
+
var mapsAsChildrenAddendum = '';
|
|
102
|
+
if (ReactCurrentOwner.current) {
|
|
103
|
+
var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
|
|
104
|
+
if (mapsAsChildrenOwnerName) {
|
|
105
|
+
mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
|
|
102
109
|
didWarnAboutMaps = true;
|
|
103
110
|
}
|
|
104
111
|
// Iterator will provide entry [k,v] tuples rather than values.
|