react 0.14.10 → 15.0.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/LICENSE +1 -1
- package/dist/react-with-addons.js +4900 -4627
- package/dist/react-with-addons.min.js +7 -7
- package/dist/react.js +4556 -4059
- package/dist/react.min.js +7 -7
- package/lib/AutoFocusUtils.js +3 -15
- package/lib/BeforeInputEventPlugin.js +8 -25
- package/lib/CSSProperty.js +10 -1
- package/lib/CSSPropertyOperations.js +49 -19
- package/lib/CallbackQueue.js +16 -4
- package/lib/ChangeEventPlugin.js +58 -54
- package/lib/DOMChildrenOperations.js +91 -61
- package/lib/DOMLazyTree.js +105 -0
- package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
- package/lib/DOMProperty.js +18 -39
- package/lib/DOMPropertyOperations.js +42 -53
- package/lib/Danger.js +13 -14
- package/lib/DefaultEventPluginOrder.js +1 -1
- package/lib/EnterLeaveEventPlugin.js +24 -43
- package/lib/EventConstants.js +6 -1
- package/lib/EventPluginHub.js +22 -66
- package/lib/EventPluginRegistry.js +30 -9
- package/lib/EventPluginUtils.js +61 -36
- package/lib/EventPropagators.js +19 -17
- package/lib/FallbackCompositionState.js +4 -4
- package/lib/HTMLDOMPropertyConfig.js +131 -152
- package/lib/LinkedStateMixin.js +1 -2
- package/lib/LinkedValueUtils.js +6 -7
- package/lib/MetaMatchers.js +2 -2
- package/lib/OrderedMap.js +17 -16
- package/lib/PooledClass.js +2 -2
- package/lib/React.js +50 -20
- package/lib/ReactBrowserEventEmitter.js +19 -26
- package/lib/ReactCSSTransitionGroup.js +4 -5
- package/lib/ReactCSSTransitionGroupChild.js +1 -6
- package/lib/ReactChildReconciler.js +15 -13
- package/lib/ReactChildren.js +5 -4
- package/lib/ReactClass.js +44 -92
- package/lib/ReactComponent.js +9 -10
- package/lib/ReactComponentBrowserEnvironment.js +9 -6
- package/lib/ReactComponentEnvironment.js +4 -4
- package/lib/ReactComponentWithPureRenderMixin.js +2 -2
- package/lib/ReactCompositeComponent.js +166 -74
- package/lib/ReactCurrentOwner.js +2 -1
- package/lib/ReactDOM.js +27 -15
- package/lib/ReactDOMButton.js +2 -2
- package/lib/ReactDOMComponent.js +186 -250
- package/lib/ReactDOMComponentFlags.js +18 -0
- package/lib/ReactDOMComponentTree.js +186 -0
- package/lib/ReactDOMContainerInfo.js +32 -0
- package/lib/ReactDOMDebugTool.js +61 -0
- package/lib/ReactDOMEmptyComponent.js +60 -0
- package/lib/ReactDOMFactories.js +1 -2
- package/lib/ReactDOMFeatureFlags.js +2 -2
- package/lib/ReactDOMIDOperations.js +5 -60
- package/lib/ReactDOMInput.js +73 -23
- package/lib/ReactDOMInstrumentation.js +16 -0
- package/lib/ReactDOMOption.js +14 -12
- package/lib/ReactDOMSelect.js +43 -19
- package/lib/ReactDOMSelection.js +4 -4
- package/lib/ReactDOMServer.js +1 -1
- package/lib/ReactDOMTextComponent.js +87 -45
- package/lib/ReactDOMTextarea.js +39 -11
- package/lib/ReactDOMTreeTraversal.js +134 -0
- package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
- package/lib/ReactDebugInstanceMap.js +102 -0
- package/lib/ReactDebugTool.js +72 -0
- package/lib/ReactDefaultBatchingStrategy.js +4 -3
- package/lib/ReactDefaultInjection.js +11 -15
- package/lib/ReactDefaultPerf.js +105 -26
- package/lib/ReactDefaultPerfAnalysis.js +23 -15
- package/lib/ReactElement.js +63 -23
- package/lib/ReactElementValidator.js +9 -9
- package/lib/ReactEmptyComponent.js +8 -33
- package/lib/ReactErrorUtils.js +1 -2
- package/lib/ReactEventEmitterMixin.js +3 -8
- package/lib/ReactEventListener.js +23 -77
- package/lib/ReactFeatureFlags.js +21 -0
- package/lib/ReactFragment.js +6 -6
- package/lib/ReactInjection.js +3 -3
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -12
- package/lib/ReactInstanceMap.js +2 -1
- package/lib/ReactInstrumentation.js +16 -0
- package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
- package/lib/ReactLink.js +2 -3
- package/lib/ReactMarkupChecksum.js +8 -3
- package/lib/ReactMount.js +88 -460
- package/lib/ReactMultiChild.js +106 -200
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +6 -5
- package/lib/ReactNodeTypes.js +37 -0
- package/lib/ReactNoopUpdateQueue.js +2 -25
- package/lib/ReactOwner.js +7 -6
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +5 -4
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +31 -7
- package/lib/ReactReconcileTransaction.js +20 -9
- package/lib/ReactReconciler.js +29 -6
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +1 -2
- package/lib/ReactServerRendering.js +17 -35
- package/lib/ReactServerRenderingTransaction.js +11 -29
- package/lib/ReactSimpleEmptyComponent.js +36 -0
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +47 -28
- package/lib/ReactTransitionChildMapping.js +1 -2
- package/lib/ReactTransitionEvents.js +8 -44
- package/lib/ReactTransitionGroup.js +4 -3
- package/lib/ReactUMDEntry.js +26 -0
- package/lib/ReactUpdateQueue.js +24 -66
- package/lib/ReactUpdates.js +29 -11
- package/lib/ReactVersion.js +2 -2
- package/lib/ReactWithAddons.js +1 -21
- package/lib/ReactWithAddonsUMDEntry.js +26 -0
- package/lib/ResponderEventPlugin.js +54 -66
- package/lib/ResponderSyntheticEvent.js +2 -3
- package/lib/ResponderTouchHistoryStore.js +5 -5
- package/lib/SVGDOMPropertyConfig.js +267 -94
- package/lib/SelectEventPlugin.js +13 -18
- package/lib/SimpleEventPlugin.js +57 -17
- package/lib/SyntheticAnimationEvent.js +39 -0
- package/lib/SyntheticClipboardEvent.js +2 -3
- package/lib/SyntheticCompositionEvent.js +2 -3
- package/lib/SyntheticDragEvent.js +2 -3
- package/lib/SyntheticEvent.js +102 -21
- package/lib/SyntheticFocusEvent.js +2 -3
- package/lib/SyntheticInputEvent.js +2 -3
- package/lib/SyntheticKeyboardEvent.js +2 -3
- package/lib/SyntheticMouseEvent.js +2 -3
- package/lib/SyntheticTouchEvent.js +2 -3
- package/lib/SyntheticTransitionEvent.js +39 -0
- package/lib/SyntheticUIEvent.js +2 -3
- package/lib/SyntheticWheelEvent.js +2 -3
- package/lib/TapEventPlugin.js +3 -12
- package/lib/Transaction.js +3 -3
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +2 -2
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +3 -2
- package/lib/canDefineProperty.js +1 -1
- package/lib/createHierarchyRenderer.js +1 -1
- package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
- package/lib/dangerousStyleValue.js +25 -3
- package/lib/deprecated.js +7 -4
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +15 -8
- package/lib/flattenChildren.js +2 -2
- package/lib/forEachAccumulated.js +2 -1
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +1 -2
- package/lib/getEventModifierState.js +1 -2
- package/lib/getEventTarget.js +8 -2
- package/lib/getIteratorFn.js +2 -2
- package/lib/getNativeComponentFromComposite.js +30 -0
- package/lib/getNodeForCharacterOffset.js +2 -1
- package/lib/getTestDocument.js +1 -1
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/getVendorPrefixedEventName.js +101 -0
- package/lib/instantiateReactComponent.js +12 -13
- package/lib/isEventSupported.js +2 -2
- package/lib/isTextInputElement.js +2 -1
- package/lib/onlyChild.js +2 -2
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +5 -4
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +6 -14
- package/lib/setTextContent.js +1 -1
- package/lib/shallowCompare.js +1 -1
- package/lib/shouldUpdateReactComponent.js +2 -3
- package/lib/sliceChildren.js +1 -1
- package/lib/traverseAllChildren.js +8 -8
- package/lib/update.js +16 -15
- package/lib/validateDOMNesting.js +18 -13
- package/package.json +23 -32
- package/addons.js +0 -13
- package/cjs/react-jsx-dev-runtime.development.js +0 -861
- package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
- package/cjs/react-jsx-runtime.development.js +0 -883
- package/cjs/react-jsx-runtime.production.min.js +0 -10
- package/jsx-dev-runtime.js +0 -7
- package/jsx-runtime.js +0 -7
- package/lib/Object.assign.js +0 -47
- package/lib/React.native.js +0 -5
- package/lib/ReactBrowserComponentMixin.js +0 -36
- package/lib/ReactEmptyComponentRegistry.js +0 -48
- package/lib/ReactIsomorphic.js +0 -74
- package/lib/ReactRootIndex.js +0 -29
- package/lib/ServerReactRootIndex.js +0 -29
- package/lib/cloneWithProps.js +0 -54
- package/lib/webcomponents.js +0 -6379
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -13,56 +13,20 @@
|
|
|
13
13
|
|
|
14
14
|
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
* EVENT_NAME_MAP is used to determine which event fired when a
|
|
18
|
-
* transition/animation ends, based on the style property used to
|
|
19
|
-
* define that event.
|
|
20
|
-
*/
|
|
21
|
-
var EVENT_NAME_MAP = {
|
|
22
|
-
transitionend: {
|
|
23
|
-
'transition': 'transitionend',
|
|
24
|
-
'WebkitTransition': 'webkitTransitionEnd',
|
|
25
|
-
'MozTransition': 'mozTransitionEnd',
|
|
26
|
-
'OTransition': 'oTransitionEnd',
|
|
27
|
-
'msTransition': 'MSTransitionEnd'
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
animationend: {
|
|
31
|
-
'animation': 'animationend',
|
|
32
|
-
'WebkitAnimation': 'webkitAnimationEnd',
|
|
33
|
-
'MozAnimation': 'mozAnimationEnd',
|
|
34
|
-
'OAnimation': 'oAnimationEnd',
|
|
35
|
-
'msAnimation': 'MSAnimationEnd'
|
|
36
|
-
}
|
|
37
|
-
};
|
|
16
|
+
var getVendorPrefixedEventName = require('./getVendorPrefixedEventName');
|
|
38
17
|
|
|
39
18
|
var endEvents = [];
|
|
40
19
|
|
|
41
20
|
function detectEvents() {
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
// On some platforms, in particular some releases of Android 4.x,
|
|
46
|
-
// the un-prefixed "animation" and "transition" properties are defined on the
|
|
47
|
-
// style object but the events that fire will still be prefixed, so we need
|
|
48
|
-
// to check if the un-prefixed events are useable, and if not remove them
|
|
49
|
-
// from the map
|
|
50
|
-
if (!('AnimationEvent' in window)) {
|
|
51
|
-
delete EVENT_NAME_MAP.animationend.animation;
|
|
52
|
-
}
|
|
21
|
+
var animEnd = getVendorPrefixedEventName('animationend');
|
|
22
|
+
var transEnd = getVendorPrefixedEventName('transitionend');
|
|
53
23
|
|
|
54
|
-
if (
|
|
55
|
-
|
|
24
|
+
if (animEnd) {
|
|
25
|
+
endEvents.push(animEnd);
|
|
56
26
|
}
|
|
57
27
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
for (var styleName in baseEvents) {
|
|
61
|
-
if (styleName in style) {
|
|
62
|
-
endEvents.push(baseEvents[styleName]);
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
28
|
+
if (transEnd) {
|
|
29
|
+
endEvents.push(transEnd);
|
|
66
30
|
}
|
|
67
31
|
}
|
|
68
32
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
14
16
|
var React = require('./React');
|
|
15
17
|
var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
|
|
16
18
|
|
|
17
|
-
var assign = require('./Object.assign');
|
|
18
19
|
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
19
20
|
|
|
20
21
|
var ReactTransitionGroup = React.createClass({
|
|
@@ -176,7 +177,7 @@ var ReactTransitionGroup = React.createClass({
|
|
|
176
177
|
this.performEnter(key);
|
|
177
178
|
} else {
|
|
178
179
|
this.setState(function (state) {
|
|
179
|
-
var newChildren =
|
|
180
|
+
var newChildren = _assign({}, state.children);
|
|
180
181
|
delete newChildren[key];
|
|
181
182
|
return { children: newChildren };
|
|
182
183
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule ReactUMDEntry
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
16
|
+
var ReactDOM = require('./ReactDOM');
|
|
17
|
+
var ReactDOMServer = require('./ReactDOMServer');
|
|
18
|
+
var React = require('./React');
|
|
19
|
+
|
|
20
|
+
// `version` will be added here by ReactIsomorphic.
|
|
21
|
+
var ReactUMDEntry = _assign({
|
|
22
|
+
__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOM,
|
|
23
|
+
__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactDOMServer
|
|
24
|
+
}, React);
|
|
25
|
+
|
|
26
|
+
module.exports = ReactUMDEntry;
|
package/lib/ReactUpdateQueue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2015, Facebook, Inc.
|
|
2
|
+
* Copyright 2015-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -12,11 +12,9 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
15
|
-
var ReactElement = require('./ReactElement');
|
|
16
15
|
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
17
16
|
var ReactUpdates = require('./ReactUpdates');
|
|
18
17
|
|
|
19
|
-
var assign = require('./Object.assign');
|
|
20
18
|
var invariant = require('fbjs/lib/invariant');
|
|
21
19
|
var warning = require('fbjs/lib/warning');
|
|
22
20
|
|
|
@@ -24,6 +22,19 @@ function enqueueUpdate(internalInstance) {
|
|
|
24
22
|
ReactUpdates.enqueueUpdate(internalInstance);
|
|
25
23
|
}
|
|
26
24
|
|
|
25
|
+
function formatUnexpectedArgument(arg) {
|
|
26
|
+
var type = typeof arg;
|
|
27
|
+
if (type !== 'object') {
|
|
28
|
+
return type;
|
|
29
|
+
}
|
|
30
|
+
var displayName = arg.constructor && arg.constructor.name || type;
|
|
31
|
+
var keys = Object.keys(arg);
|
|
32
|
+
if (keys.length > 0 && keys.length < 20) {
|
|
33
|
+
return displayName + ' (keys: ' + keys.join(', ') + ')';
|
|
34
|
+
}
|
|
35
|
+
return displayName;
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
|
28
39
|
var internalInstance = ReactInstanceMap.get(publicInstance);
|
|
29
40
|
if (!internalInstance) {
|
|
@@ -31,13 +42,13 @@ function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
|
|
31
42
|
// Only warn when we have a callerName. Otherwise we should be silent.
|
|
32
43
|
// We're probably calling from enqueueCallback. We don't want to warn
|
|
33
44
|
// there because we already warned for the corresponding lifecycle method.
|
|
34
|
-
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) :
|
|
45
|
+
process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : void 0;
|
|
35
46
|
}
|
|
36
47
|
return null;
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
if (process.env.NODE_ENV !== 'production') {
|
|
40
|
-
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '
|
|
51
|
+
process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition (such as ' + 'within `render` or another component\'s constructor). Render methods ' + 'should be a pure function of props and state; constructor ' + 'side-effects are an anti-pattern, but can be moved to ' + '`componentWillMount`.', callerName) : void 0;
|
|
41
52
|
}
|
|
42
53
|
|
|
43
54
|
return internalInstance;
|
|
@@ -60,7 +71,7 @@ var ReactUpdateQueue = {
|
|
|
60
71
|
if (process.env.NODE_ENV !== 'production') {
|
|
61
72
|
var owner = ReactCurrentOwner.current;
|
|
62
73
|
if (owner !== null) {
|
|
63
|
-
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') :
|
|
74
|
+
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
|
|
64
75
|
owner._warnedAboutRefsInRender = true;
|
|
65
76
|
}
|
|
66
77
|
}
|
|
@@ -81,10 +92,11 @@ var ReactUpdateQueue = {
|
|
|
81
92
|
*
|
|
82
93
|
* @param {ReactClass} publicInstance The instance to use as `this` context.
|
|
83
94
|
* @param {?function} callback Called after state is updated.
|
|
95
|
+
* @param {string} callerName Name of the calling function in the public API.
|
|
84
96
|
* @internal
|
|
85
97
|
*/
|
|
86
|
-
enqueueCallback: function (publicInstance, callback) {
|
|
87
|
-
|
|
98
|
+
enqueueCallback: function (publicInstance, callback, callerName) {
|
|
99
|
+
ReactUpdateQueue.validateCallback(callback, callerName);
|
|
88
100
|
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
|
|
89
101
|
|
|
90
102
|
// Previously we would throw an error if we didn't have an internal
|
|
@@ -109,7 +121,6 @@ var ReactUpdateQueue = {
|
|
|
109
121
|
},
|
|
110
122
|
|
|
111
123
|
enqueueCallbackInternal: function (internalInstance, callback) {
|
|
112
|
-
!(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
|
|
113
124
|
if (internalInstance._pendingCallbacks) {
|
|
114
125
|
internalInstance._pendingCallbacks.push(callback);
|
|
115
126
|
} else {
|
|
@@ -190,66 +201,13 @@ var ReactUpdateQueue = {
|
|
|
190
201
|
enqueueUpdate(internalInstance);
|
|
191
202
|
},
|
|
192
203
|
|
|
193
|
-
/**
|
|
194
|
-
* Sets a subset of the props.
|
|
195
|
-
*
|
|
196
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
197
|
-
* @param {object} partialProps Subset of the next props.
|
|
198
|
-
* @internal
|
|
199
|
-
*/
|
|
200
|
-
enqueueSetProps: function (publicInstance, partialProps) {
|
|
201
|
-
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
|
|
202
|
-
if (!internalInstance) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
enqueueSetPropsInternal: function (internalInstance, partialProps) {
|
|
209
|
-
var topLevelWrapper = internalInstance._topLevelWrapper;
|
|
210
|
-
!topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
|
211
|
-
|
|
212
|
-
// Merge with the pending element if it exists, otherwise with existing
|
|
213
|
-
// element props.
|
|
214
|
-
var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
|
|
215
|
-
var element = wrapElement.props;
|
|
216
|
-
var props = assign({}, element.props, partialProps);
|
|
217
|
-
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
|
|
218
|
-
|
|
219
|
-
enqueueUpdate(topLevelWrapper);
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Replaces all of the props.
|
|
224
|
-
*
|
|
225
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
226
|
-
* @param {object} props New props.
|
|
227
|
-
* @internal
|
|
228
|
-
*/
|
|
229
|
-
enqueueReplaceProps: function (publicInstance, props) {
|
|
230
|
-
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
|
|
231
|
-
if (!internalInstance) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
enqueueReplacePropsInternal: function (internalInstance, props) {
|
|
238
|
-
var topLevelWrapper = internalInstance._topLevelWrapper;
|
|
239
|
-
!topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
|
240
|
-
|
|
241
|
-
// Merge with the pending element if it exists, otherwise with existing
|
|
242
|
-
// element props.
|
|
243
|
-
var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
|
|
244
|
-
var element = wrapElement.props;
|
|
245
|
-
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
|
|
246
|
-
|
|
247
|
-
enqueueUpdate(topLevelWrapper);
|
|
248
|
-
},
|
|
249
|
-
|
|
250
204
|
enqueueElementInternal: function (internalInstance, newElement) {
|
|
251
205
|
internalInstance._pendingElement = newElement;
|
|
252
206
|
enqueueUpdate(internalInstance);
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
validateCallback: function (callback, callerName) {
|
|
210
|
+
!(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : invariant(false) : void 0;
|
|
253
211
|
}
|
|
254
212
|
|
|
255
213
|
};
|
package/lib/ReactUpdates.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
14
16
|
var CallbackQueue = require('./CallbackQueue');
|
|
15
17
|
var PooledClass = require('./PooledClass');
|
|
18
|
+
var ReactFeatureFlags = require('./ReactFeatureFlags');
|
|
16
19
|
var ReactPerf = require('./ReactPerf');
|
|
17
20
|
var ReactReconciler = require('./ReactReconciler');
|
|
18
21
|
var Transaction = require('./Transaction');
|
|
19
22
|
|
|
20
|
-
var assign = require('./Object.assign');
|
|
21
23
|
var invariant = require('fbjs/lib/invariant');
|
|
22
24
|
|
|
23
25
|
var dirtyComponents = [];
|
|
@@ -27,7 +29,7 @@ var asapEnqueued = false;
|
|
|
27
29
|
var batchingStrategy = null;
|
|
28
30
|
|
|
29
31
|
function ensureInjected() {
|
|
30
|
-
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) :
|
|
32
|
+
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : void 0;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
var NESTED_UPDATES = {
|
|
@@ -64,10 +66,11 @@ function ReactUpdatesFlushTransaction() {
|
|
|
64
66
|
this.reinitializeTransaction();
|
|
65
67
|
this.dirtyComponentsLength = null;
|
|
66
68
|
this.callbackQueue = CallbackQueue.getPooled();
|
|
67
|
-
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
|
|
69
|
+
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled(
|
|
70
|
+
/* useCreateElement */true);
|
|
68
71
|
}
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
_assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
|
|
71
74
|
getTransactionWrappers: function () {
|
|
72
75
|
return TRANSACTION_WRAPPERS;
|
|
73
76
|
},
|
|
@@ -107,7 +110,7 @@ function mountOrderComparator(c1, c2) {
|
|
|
107
110
|
|
|
108
111
|
function runBatchedUpdates(transaction) {
|
|
109
112
|
var len = transaction.dirtyComponentsLength;
|
|
110
|
-
!(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) :
|
|
113
|
+
!(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : void 0;
|
|
111
114
|
|
|
112
115
|
// Since reconciling a component higher in the owner hierarchy usually (not
|
|
113
116
|
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
|
|
@@ -126,8 +129,23 @@ function runBatchedUpdates(transaction) {
|
|
|
126
129
|
var callbacks = component._pendingCallbacks;
|
|
127
130
|
component._pendingCallbacks = null;
|
|
128
131
|
|
|
132
|
+
var markerName;
|
|
133
|
+
if (ReactFeatureFlags.logTopLevelRenders) {
|
|
134
|
+
var namedComponent = component;
|
|
135
|
+
// Duck type TopLevelWrapper. This is probably always true.
|
|
136
|
+
if (component._currentElement.props === component._renderedComponent._currentElement) {
|
|
137
|
+
namedComponent = component._renderedComponent;
|
|
138
|
+
}
|
|
139
|
+
markerName = 'React update: ' + namedComponent.getName();
|
|
140
|
+
console.time(markerName);
|
|
141
|
+
}
|
|
142
|
+
|
|
129
143
|
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
|
|
130
144
|
|
|
145
|
+
if (markerName) {
|
|
146
|
+
console.timeEnd(markerName);
|
|
147
|
+
}
|
|
148
|
+
|
|
131
149
|
if (callbacks) {
|
|
132
150
|
for (var j = 0; j < callbacks.length; j++) {
|
|
133
151
|
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
|
|
@@ -185,21 +203,21 @@ function enqueueUpdate(component) {
|
|
|
185
203
|
* if no updates are currently being performed.
|
|
186
204
|
*/
|
|
187
205
|
function asap(callback, context) {
|
|
188
|
-
!batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) :
|
|
206
|
+
!batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : void 0;
|
|
189
207
|
asapCallbackQueue.enqueue(callback, context);
|
|
190
208
|
asapEnqueued = true;
|
|
191
209
|
}
|
|
192
210
|
|
|
193
211
|
var ReactUpdatesInjection = {
|
|
194
212
|
injectReconcileTransaction: function (ReconcileTransaction) {
|
|
195
|
-
!ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) :
|
|
213
|
+
!ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : void 0;
|
|
196
214
|
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
|
|
197
215
|
},
|
|
198
216
|
|
|
199
217
|
injectBatchingStrategy: function (_batchingStrategy) {
|
|
200
|
-
!_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) :
|
|
201
|
-
!(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) :
|
|
202
|
-
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) :
|
|
218
|
+
!_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : void 0;
|
|
219
|
+
!(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : void 0;
|
|
220
|
+
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : void 0;
|
|
203
221
|
batchingStrategy = _batchingStrategy;
|
|
204
222
|
}
|
|
205
223
|
};
|
package/lib/ReactVersion.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
module.exports = '0.
|
|
14
|
+
module.exports = '15.0.0';
|
package/lib/ReactWithAddons.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,13 +9,6 @@
|
|
|
9
9
|
* @providesModule ReactWithAddons
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* This module exists purely in the open source project, and is meant as a way
|
|
14
|
-
* to create a separate standalone build of React. This build has "addons", or
|
|
15
|
-
* functionality we've built and think might be useful but doesn't have a good
|
|
16
|
-
* place to live inside React core.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
12
|
'use strict';
|
|
20
13
|
|
|
21
14
|
var LinkedStateMixin = require('./LinkedStateMixin');
|
|
@@ -24,14 +17,9 @@ var ReactComponentWithPureRenderMixin = require('./ReactComponentWithPureRenderM
|
|
|
24
17
|
var ReactCSSTransitionGroup = require('./ReactCSSTransitionGroup');
|
|
25
18
|
var ReactFragment = require('./ReactFragment');
|
|
26
19
|
var ReactTransitionGroup = require('./ReactTransitionGroup');
|
|
27
|
-
var ReactUpdates = require('./ReactUpdates');
|
|
28
20
|
|
|
29
|
-
var cloneWithProps = require('./cloneWithProps');
|
|
30
21
|
var shallowCompare = require('./shallowCompare');
|
|
31
22
|
var update = require('./update');
|
|
32
|
-
var warning = require('fbjs/lib/warning');
|
|
33
|
-
|
|
34
|
-
var warnedAboutBatchedUpdates = false;
|
|
35
23
|
|
|
36
24
|
React.addons = {
|
|
37
25
|
CSSTransitionGroup: ReactCSSTransitionGroup,
|
|
@@ -39,14 +27,6 @@ React.addons = {
|
|
|
39
27
|
PureRenderMixin: ReactComponentWithPureRenderMixin,
|
|
40
28
|
TransitionGroup: ReactTransitionGroup,
|
|
41
29
|
|
|
42
|
-
batchedUpdates: function () {
|
|
43
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
-
process.env.NODE_ENV !== 'production' ? warning(warnedAboutBatchedUpdates, 'React.addons.batchedUpdates is deprecated. Use ' + 'ReactDOM.unstable_batchedUpdates instead.') : undefined;
|
|
45
|
-
warnedAboutBatchedUpdates = true;
|
|
46
|
-
}
|
|
47
|
-
return ReactUpdates.batchedUpdates.apply(this, arguments);
|
|
48
|
-
},
|
|
49
|
-
cloneWithProps: cloneWithProps,
|
|
50
30
|
createFragment: ReactFragment.create,
|
|
51
31
|
shallowCompare: shallowCompare,
|
|
52
32
|
update: update
|