react 0.14.0-beta1 → 0.14.0-beta2
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/addons.js +5 -2
- package/dist/JSXTransformer.js +588 -227
- package/dist/react-with-addons.js +3118 -2707
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +3713 -3317
- package/dist/react.min.js +6 -5
- package/lib/AutoFocusUtils.js +3 -3
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +3 -0
- package/lib/CSSPropertyOperations.js +13 -13
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +12 -12
- package/lib/DOMChildrenOperations.js +10 -6
- package/lib/DOMProperty.js +8 -8
- package/lib/DOMPropertyOperations.js +9 -9
- package/lib/Danger.js +14 -14
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +5 -5
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +11 -11
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +11 -11
- package/lib/EventPropagators.js +7 -7
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +4 -2
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +8 -8
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +2 -2
- package/lib/React.js +6 -6
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +16 -5
- package/lib/ReactCSSTransitionGroupChild.js +12 -11
- package/lib/ReactChildReconciler.js +25 -18
- package/lib/ReactChildren.js +6 -6
- package/lib/ReactClass.js +42 -42
- package/lib/ReactComponent.js +13 -13
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +38 -38
- package/lib/ReactDOM.js +72 -159
- package/lib/ReactDOMComponent.js +104 -60
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/ReactDOMIDOperations.js +10 -24
- package/lib/ReactDOMInput.js +8 -8
- package/lib/ReactDOMOption.js +7 -7
- package/lib/ReactDOMSelect.js +8 -8
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +2 -2
- package/lib/ReactDOMTextComponent.js +11 -11
- package/lib/ReactDOMTextarea.js +11 -11
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +24 -24
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -9
- package/lib/ReactElement.js +4 -4
- package/lib/ReactElementValidator.js +21 -21
- package/lib/ReactEmptyComponent.js +4 -4
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +19 -14
- package/lib/ReactFragment.js +11 -11
- package/lib/ReactInjection.js +11 -11
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -11
- package/lib/ReactIsomorphic.js +11 -11
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +68 -48
- package/lib/ReactMultiChild.js +83 -22
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -3
- package/lib/ReactNoopUpdateQueue.js +3 -3
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +34 -8
- package/lib/ReactReconcileTransaction.js +6 -6
- package/lib/ReactReconciler.js +12 -12
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +5 -5
- package/lib/ReactServerRendering.js +12 -12
- package/lib/ReactServerRenderingTransaction.js +5 -5
- package/lib/ReactTestUtils.js +26 -27
- package/lib/ReactTransitionChildMapping.js +2 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +17 -17
- package/lib/ReactUpdates.js +14 -14
- package/lib/ReactWithAddons.js +14 -14
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +9 -9
- package/lib/SimpleEventPlugin.js +201 -25
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +3 -3
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +3 -3
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +6 -6
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +11 -6
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +4 -4
- package/lib/findDOMNode.js +9 -9
- package/lib/flattenChildren.js +4 -4
- package/lib/getEventKey.js +1 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +12 -12
- package/lib/isEventSupported.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +210 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +1 -1
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/sliceChildren.js +51 -0
- package/lib/traverseAllChildren.js +14 -13
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +6 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +1 -1
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/ReactDOMClient.js +0 -90
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/emptyObject.js +0 -20
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -93
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/isTextNode.js +0 -25
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -57
package/lib/ReactComponent.js
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactNoopUpdateQueue = require(
|
|
14
|
+
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
|
|
15
15
|
|
|
16
|
-
var emptyObject = require(
|
|
17
|
-
var invariant = require(
|
|
18
|
-
var warning = require(
|
|
16
|
+
var emptyObject = require('fbjs/lib/emptyObject');
|
|
17
|
+
var invariant = require('fbjs/lib/invariant');
|
|
18
|
+
var warning = require('fbjs/lib/warning');
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Base class helpers for the updating state of a component.
|
|
@@ -55,9 +55,9 @@ function ReactComponent(props, context, updater) {
|
|
|
55
55
|
* @protected
|
|
56
56
|
*/
|
|
57
57
|
ReactComponent.prototype.setState = function (partialState, callback) {
|
|
58
|
-
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ?
|
|
59
|
-
if (
|
|
60
|
-
|
|
58
|
+
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
|
|
59
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
60
|
+
process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
|
|
61
61
|
}
|
|
62
62
|
this.updater.enqueueSetState(this, partialState);
|
|
63
63
|
if (callback) {
|
|
@@ -91,7 +91,7 @@ ReactComponent.prototype.forceUpdate = function (callback) {
|
|
|
91
91
|
* we would like to deprecate them, we're not going to move them over to this
|
|
92
92
|
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
93
93
|
*/
|
|
94
|
-
if (
|
|
94
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
95
95
|
var deprecatedAPIs = {
|
|
96
96
|
getDOMNode: ['getDOMNode', 'Use React.findDOMNode(component) instead.'],
|
|
97
97
|
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
@@ -103,11 +103,13 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
103
103
|
try {
|
|
104
104
|
Object.defineProperty(ReactComponent.prototype, methodName, {
|
|
105
105
|
get: function () {
|
|
106
|
-
|
|
106
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
|
|
107
107
|
return undefined;
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
|
-
} catch (x) {
|
|
110
|
+
} catch (x) {
|
|
111
|
+
// IE will fail on defineProperty (es5-shim/sham too)
|
|
112
|
+
}
|
|
111
113
|
};
|
|
112
114
|
for (var fnName in deprecatedAPIs) {
|
|
113
115
|
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
@@ -116,6 +118,4 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
module.exports = ReactComponent;
|
|
120
|
-
|
|
121
|
-
// IE will fail on defineProperty (es5-shim/sham too)
|
|
121
|
+
module.exports = ReactComponent;
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactDOMIDOperations = require(
|
|
15
|
-
var ReactMount = require(
|
|
14
|
+
var ReactDOMIDOperations = require('./ReactDOMIDOperations');
|
|
15
|
+
var ReactMount = require('./ReactMount');
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Abstracts away all functionality of the reconciler that requires knowledge of
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var invariant = require(
|
|
14
|
+
var invariant = require('fbjs/lib/invariant');
|
|
15
15
|
|
|
16
16
|
var injected = false;
|
|
17
17
|
|
|
@@ -38,7 +38,7 @@ var ReactComponentEnvironment = {
|
|
|
38
38
|
|
|
39
39
|
injection: {
|
|
40
40
|
injectEnvironment: function (environment) {
|
|
41
|
-
!!injected ?
|
|
41
|
+
!!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
|
|
42
42
|
ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
|
|
43
43
|
ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
|
|
44
44
|
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactComponentEnvironment = require(
|
|
15
|
-
var ReactCurrentOwner = require(
|
|
16
|
-
var ReactElement = require(
|
|
17
|
-
var ReactInstanceMap = require(
|
|
18
|
-
var ReactPerf = require(
|
|
19
|
-
var ReactPropTypeLocations = require(
|
|
20
|
-
var ReactPropTypeLocationNames = require(
|
|
21
|
-
var ReactReconciler = require(
|
|
22
|
-
var ReactUpdateQueue = require(
|
|
23
|
-
|
|
24
|
-
var assign = require(
|
|
25
|
-
var emptyObject = require(
|
|
26
|
-
var invariant = require(
|
|
27
|
-
var shouldUpdateReactComponent = require(
|
|
28
|
-
var warning = require(
|
|
14
|
+
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
15
|
+
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
16
|
+
var ReactElement = require('./ReactElement');
|
|
17
|
+
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
18
|
+
var ReactPerf = require('./ReactPerf');
|
|
19
|
+
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
|
|
20
|
+
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
|
|
21
|
+
var ReactReconciler = require('./ReactReconciler');
|
|
22
|
+
var ReactUpdateQueue = require('./ReactUpdateQueue');
|
|
23
|
+
|
|
24
|
+
var assign = require('./Object.assign');
|
|
25
|
+
var emptyObject = require('fbjs/lib/emptyObject');
|
|
26
|
+
var invariant = require('fbjs/lib/invariant');
|
|
27
|
+
var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
|
|
28
|
+
var warning = require('fbjs/lib/warning');
|
|
29
29
|
|
|
30
30
|
function getDeclarationErrorAddendum(component) {
|
|
31
31
|
var owner = component._currentElement._owner || null;
|
|
@@ -128,10 +128,10 @@ var ReactCompositeComponentMixin = {
|
|
|
128
128
|
// Initialize the public class
|
|
129
129
|
var inst = new Component(publicProps, publicContext, ReactUpdateQueue);
|
|
130
130
|
|
|
131
|
-
if (
|
|
131
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
132
132
|
// This will throw later in _renderValidatedComponent, but add an early
|
|
133
133
|
// warning now to help debugging
|
|
134
|
-
|
|
134
|
+
process.env.NODE_ENV !== 'production' ? warning(inst.render != null, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render` in your ' + 'component or you may have accidentally tried to render an element ' + 'whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
// These should be set up in the constructor, but as a convenience for
|
|
@@ -146,24 +146,24 @@ var ReactCompositeComponentMixin = {
|
|
|
146
146
|
// Store a reference from the instance back to the internal representation
|
|
147
147
|
ReactInstanceMap.set(inst, this);
|
|
148
148
|
|
|
149
|
-
if (
|
|
149
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
150
150
|
// Since plain JS classes are defined without any special initialization
|
|
151
151
|
// logic, we can not catch common errors early. Therefore, we have to
|
|
152
152
|
// catch them here, at initialization time, instead.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
|
|
154
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
|
|
155
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
|
|
156
|
+
process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
|
|
157
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
|
|
158
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
|
|
159
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
var initialState = inst.state;
|
|
163
163
|
if (initialState === undefined) {
|
|
164
164
|
inst.state = initialState = null;
|
|
165
165
|
}
|
|
166
|
-
!(typeof initialState === 'object' && !Array.isArray(initialState)) ?
|
|
166
|
+
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
|
167
167
|
|
|
168
168
|
this._pendingStateQueue = null;
|
|
169
169
|
this._pendingReplaceState = false;
|
|
@@ -265,7 +265,7 @@ var ReactCompositeComponentMixin = {
|
|
|
265
265
|
*/
|
|
266
266
|
_processContext: function (context) {
|
|
267
267
|
var maskedContext = this._maskContext(context);
|
|
268
|
-
if (
|
|
268
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
269
269
|
var Component = this._currentElement.type;
|
|
270
270
|
if (Component.contextTypes) {
|
|
271
271
|
this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
|
|
@@ -284,12 +284,12 @@ var ReactCompositeComponentMixin = {
|
|
|
284
284
|
var inst = this._instance;
|
|
285
285
|
var childContext = inst.getChildContext && inst.getChildContext();
|
|
286
286
|
if (childContext) {
|
|
287
|
-
!(typeof Component.childContextTypes === 'object') ?
|
|
288
|
-
if (
|
|
287
|
+
!(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
|
288
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
289
289
|
this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
|
|
290
290
|
}
|
|
291
291
|
for (var name in childContext) {
|
|
292
|
-
!(name in Component.childContextTypes) ?
|
|
292
|
+
!(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
|
|
293
293
|
}
|
|
294
294
|
return assign({}, currentContext, childContext);
|
|
295
295
|
}
|
|
@@ -306,7 +306,7 @@ var ReactCompositeComponentMixin = {
|
|
|
306
306
|
* @private
|
|
307
307
|
*/
|
|
308
308
|
_processProps: function (newProps) {
|
|
309
|
-
if (
|
|
309
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
310
310
|
var Component = this._currentElement.type;
|
|
311
311
|
if (Component.propTypes) {
|
|
312
312
|
this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
|
|
@@ -333,7 +333,7 @@ var ReactCompositeComponentMixin = {
|
|
|
333
333
|
try {
|
|
334
334
|
// This is intentionally an invariant that gets caught. It's the same
|
|
335
335
|
// behavior as without this statement except with a better message.
|
|
336
|
-
!(typeof propTypes[propName] === 'function') ?
|
|
336
|
+
!(typeof propTypes[propName] === '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], propName) : invariant(false) : undefined;
|
|
337
337
|
error = propTypes[propName](props, propName, componentName, location);
|
|
338
338
|
} catch (ex) {
|
|
339
339
|
error = ex;
|
|
@@ -346,9 +346,9 @@ var ReactCompositeComponentMixin = {
|
|
|
346
346
|
|
|
347
347
|
if (location === ReactPropTypeLocations.prop) {
|
|
348
348
|
// Preface gives us something to blacklist in warning module
|
|
349
|
-
|
|
349
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
|
|
350
350
|
} else {
|
|
351
|
-
|
|
351
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
}
|
|
@@ -422,8 +422,8 @@ var ReactCompositeComponentMixin = {
|
|
|
422
422
|
|
|
423
423
|
var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
|
|
424
424
|
|
|
425
|
-
if (
|
|
426
|
-
|
|
425
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
426
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
if (shouldUpdate) {
|
|
@@ -544,7 +544,7 @@ var ReactCompositeComponentMixin = {
|
|
|
544
544
|
_renderValidatedComponentWithoutOwnerOrContext: function () {
|
|
545
545
|
var inst = this._instance;
|
|
546
546
|
var renderedComponent = inst.render();
|
|
547
|
-
if (
|
|
547
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
548
548
|
// We allow auto-mocks to proceed as if they're returning null.
|
|
549
549
|
if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
|
|
550
550
|
// This is probably bad practice. Consider warning here and
|
|
@@ -569,7 +569,7 @@ var ReactCompositeComponentMixin = {
|
|
|
569
569
|
}
|
|
570
570
|
!(
|
|
571
571
|
// TODO: An `isValidNode` function would probably be more appropriate
|
|
572
|
-
|
|
572
|
+
renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
|
573
573
|
return renderedComponent;
|
|
574
574
|
},
|
|
575
575
|
|
package/lib/ReactDOM.js
CHANGED
|
@@ -7,171 +7,84 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
9
|
* @providesModule ReactDOM
|
|
10
|
-
* @typechecks static-only
|
|
11
10
|
*/
|
|
12
11
|
|
|
12
|
+
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
|
|
13
|
+
|
|
13
14
|
'use strict';
|
|
14
15
|
|
|
15
|
-
var
|
|
16
|
-
var
|
|
16
|
+
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
17
|
+
var ReactDOMTextComponent = require('./ReactDOMTextComponent');
|
|
18
|
+
var ReactDefaultInjection = require('./ReactDefaultInjection');
|
|
19
|
+
var ReactInstanceHandles = require('./ReactInstanceHandles');
|
|
20
|
+
var ReactMount = require('./ReactMount');
|
|
21
|
+
var ReactPerf = require('./ReactPerf');
|
|
22
|
+
var ReactReconciler = require('./ReactReconciler');
|
|
23
|
+
var ReactUpdates = require('./ReactUpdates');
|
|
17
24
|
|
|
18
|
-
var
|
|
25
|
+
var findDOMNode = require('./findDOMNode');
|
|
26
|
+
var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer');
|
|
27
|
+
var warning = require('fbjs/lib/warning');
|
|
19
28
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
ReactDefaultInjection.inject();
|
|
30
|
+
|
|
31
|
+
var render = ReactPerf.measure('React', 'render', ReactMount.render);
|
|
32
|
+
|
|
33
|
+
var React = {
|
|
34
|
+
findDOMNode: findDOMNode,
|
|
35
|
+
render: render,
|
|
36
|
+
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
|
|
37
|
+
|
|
38
|
+
/* eslint-disable camelcase */
|
|
39
|
+
unstable_batchedUpdates: ReactUpdates.batchedUpdates,
|
|
40
|
+
unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Inject the runtime into a devtools global hook regardless of browser.
|
|
44
|
+
// Allows for debugging when the hook is injected on the page.
|
|
45
|
+
/* eslint-enable camelcase */
|
|
46
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
|
|
47
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
|
|
48
|
+
CurrentOwner: ReactCurrentOwner,
|
|
49
|
+
InstanceHandles: ReactInstanceHandles,
|
|
50
|
+
Mount: ReactMount,
|
|
51
|
+
Reconciler: ReactReconciler,
|
|
52
|
+
TextComponent: ReactDOMTextComponent
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
57
|
+
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
58
|
+
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
|
|
59
|
+
|
|
60
|
+
// If we're in Chrome, look for the devtools marker and provide a download
|
|
61
|
+
// link if not installed.
|
|
62
|
+
if (navigator.userAgent.indexOf('Chrome') > -1) {
|
|
63
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
|
|
64
|
+
console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// If we're in IE8, check to see if we are in combatibility mode and provide
|
|
69
|
+
// information on preventing compatibility mode
|
|
70
|
+
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
|
|
71
|
+
|
|
72
|
+
process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
|
|
73
|
+
|
|
74
|
+
var expectedFeatures = [
|
|
75
|
+
// shims
|
|
76
|
+
Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
|
|
77
|
+
|
|
78
|
+
// shams
|
|
79
|
+
Object.create, Object.freeze];
|
|
80
|
+
|
|
81
|
+
for (var i = 0; i < expectedFeatures.length; i++) {
|
|
82
|
+
if (!expectedFeatures[i]) {
|
|
83
|
+
console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
29
87
|
}
|
|
30
|
-
return ReactElement.createFactory(tag);
|
|
31
88
|
}
|
|
32
89
|
|
|
33
|
-
|
|
34
|
-
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
|
35
|
-
* This is also accessible via `React.DOM`.
|
|
36
|
-
*
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
var ReactDOM = mapObject({
|
|
40
|
-
a: 'a',
|
|
41
|
-
abbr: 'abbr',
|
|
42
|
-
address: 'address',
|
|
43
|
-
area: 'area',
|
|
44
|
-
article: 'article',
|
|
45
|
-
aside: 'aside',
|
|
46
|
-
audio: 'audio',
|
|
47
|
-
b: 'b',
|
|
48
|
-
base: 'base',
|
|
49
|
-
bdi: 'bdi',
|
|
50
|
-
bdo: 'bdo',
|
|
51
|
-
big: 'big',
|
|
52
|
-
blockquote: 'blockquote',
|
|
53
|
-
body: 'body',
|
|
54
|
-
br: 'br',
|
|
55
|
-
button: 'button',
|
|
56
|
-
canvas: 'canvas',
|
|
57
|
-
caption: 'caption',
|
|
58
|
-
cite: 'cite',
|
|
59
|
-
code: 'code',
|
|
60
|
-
col: 'col',
|
|
61
|
-
colgroup: 'colgroup',
|
|
62
|
-
data: 'data',
|
|
63
|
-
datalist: 'datalist',
|
|
64
|
-
dd: 'dd',
|
|
65
|
-
del: 'del',
|
|
66
|
-
details: 'details',
|
|
67
|
-
dfn: 'dfn',
|
|
68
|
-
dialog: 'dialog',
|
|
69
|
-
div: 'div',
|
|
70
|
-
dl: 'dl',
|
|
71
|
-
dt: 'dt',
|
|
72
|
-
em: 'em',
|
|
73
|
-
embed: 'embed',
|
|
74
|
-
fieldset: 'fieldset',
|
|
75
|
-
figcaption: 'figcaption',
|
|
76
|
-
figure: 'figure',
|
|
77
|
-
footer: 'footer',
|
|
78
|
-
form: 'form',
|
|
79
|
-
h1: 'h1',
|
|
80
|
-
h2: 'h2',
|
|
81
|
-
h3: 'h3',
|
|
82
|
-
h4: 'h4',
|
|
83
|
-
h5: 'h5',
|
|
84
|
-
h6: 'h6',
|
|
85
|
-
head: 'head',
|
|
86
|
-
header: 'header',
|
|
87
|
-
hgroup: 'hgroup',
|
|
88
|
-
hr: 'hr',
|
|
89
|
-
html: 'html',
|
|
90
|
-
i: 'i',
|
|
91
|
-
iframe: 'iframe',
|
|
92
|
-
img: 'img',
|
|
93
|
-
input: 'input',
|
|
94
|
-
ins: 'ins',
|
|
95
|
-
kbd: 'kbd',
|
|
96
|
-
keygen: 'keygen',
|
|
97
|
-
label: 'label',
|
|
98
|
-
legend: 'legend',
|
|
99
|
-
li: 'li',
|
|
100
|
-
link: 'link',
|
|
101
|
-
main: 'main',
|
|
102
|
-
map: 'map',
|
|
103
|
-
mark: 'mark',
|
|
104
|
-
menu: 'menu',
|
|
105
|
-
menuitem: 'menuitem',
|
|
106
|
-
meta: 'meta',
|
|
107
|
-
meter: 'meter',
|
|
108
|
-
nav: 'nav',
|
|
109
|
-
noscript: 'noscript',
|
|
110
|
-
object: 'object',
|
|
111
|
-
ol: 'ol',
|
|
112
|
-
optgroup: 'optgroup',
|
|
113
|
-
option: 'option',
|
|
114
|
-
output: 'output',
|
|
115
|
-
p: 'p',
|
|
116
|
-
param: 'param',
|
|
117
|
-
picture: 'picture',
|
|
118
|
-
pre: 'pre',
|
|
119
|
-
progress: 'progress',
|
|
120
|
-
q: 'q',
|
|
121
|
-
rp: 'rp',
|
|
122
|
-
rt: 'rt',
|
|
123
|
-
ruby: 'ruby',
|
|
124
|
-
s: 's',
|
|
125
|
-
samp: 'samp',
|
|
126
|
-
script: 'script',
|
|
127
|
-
section: 'section',
|
|
128
|
-
select: 'select',
|
|
129
|
-
small: 'small',
|
|
130
|
-
source: 'source',
|
|
131
|
-
span: 'span',
|
|
132
|
-
strong: 'strong',
|
|
133
|
-
style: 'style',
|
|
134
|
-
sub: 'sub',
|
|
135
|
-
summary: 'summary',
|
|
136
|
-
sup: 'sup',
|
|
137
|
-
table: 'table',
|
|
138
|
-
tbody: 'tbody',
|
|
139
|
-
td: 'td',
|
|
140
|
-
textarea: 'textarea',
|
|
141
|
-
tfoot: 'tfoot',
|
|
142
|
-
th: 'th',
|
|
143
|
-
thead: 'thead',
|
|
144
|
-
time: 'time',
|
|
145
|
-
title: 'title',
|
|
146
|
-
tr: 'tr',
|
|
147
|
-
track: 'track',
|
|
148
|
-
u: 'u',
|
|
149
|
-
ul: 'ul',
|
|
150
|
-
'var': 'var',
|
|
151
|
-
video: 'video',
|
|
152
|
-
wbr: 'wbr',
|
|
153
|
-
|
|
154
|
-
// SVG
|
|
155
|
-
circle: 'circle',
|
|
156
|
-
clipPath: 'clipPath',
|
|
157
|
-
defs: 'defs',
|
|
158
|
-
ellipse: 'ellipse',
|
|
159
|
-
g: 'g',
|
|
160
|
-
image: 'image',
|
|
161
|
-
line: 'line',
|
|
162
|
-
linearGradient: 'linearGradient',
|
|
163
|
-
mask: 'mask',
|
|
164
|
-
path: 'path',
|
|
165
|
-
pattern: 'pattern',
|
|
166
|
-
polygon: 'polygon',
|
|
167
|
-
polyline: 'polyline',
|
|
168
|
-
radialGradient: 'radialGradient',
|
|
169
|
-
rect: 'rect',
|
|
170
|
-
stop: 'stop',
|
|
171
|
-
svg: 'svg',
|
|
172
|
-
text: 'text',
|
|
173
|
-
tspan: 'tspan'
|
|
174
|
-
|
|
175
|
-
}, createDOMFactory);
|
|
176
|
-
|
|
177
|
-
module.exports = ReactDOM;
|
|
90
|
+
module.exports = React;
|