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.
Files changed (169) hide show
  1. package/addons.js +5 -2
  2. package/dist/JSXTransformer.js +588 -227
  3. package/dist/react-with-addons.js +3118 -2707
  4. package/dist/react-with-addons.min.js +6 -6
  5. package/dist/react.js +3713 -3317
  6. package/dist/react.min.js +6 -5
  7. package/lib/AutoFocusUtils.js +3 -3
  8. package/lib/BeforeInputEventPlugin.js +13 -13
  9. package/lib/CSSProperty.js +3 -0
  10. package/lib/CSSPropertyOperations.js +13 -13
  11. package/lib/CallbackQueue.js +4 -4
  12. package/lib/ChangeEventPlugin.js +12 -12
  13. package/lib/DOMChildrenOperations.js +10 -6
  14. package/lib/DOMProperty.js +8 -8
  15. package/lib/DOMPropertyOperations.js +9 -9
  16. package/lib/Danger.js +14 -14
  17. package/lib/DefaultEventPluginOrder.js +2 -2
  18. package/lib/EnterLeaveEventPlugin.js +5 -5
  19. package/lib/EventConstants.js +23 -1
  20. package/lib/EventPluginHub.js +11 -11
  21. package/lib/EventPluginRegistry.js +8 -8
  22. package/lib/EventPluginUtils.js +11 -11
  23. package/lib/EventPropagators.js +7 -7
  24. package/lib/FallbackCompositionState.js +3 -3
  25. package/lib/HTMLDOMPropertyConfig.js +4 -2
  26. package/lib/LinkedStateMixin.js +2 -2
  27. package/lib/LinkedValueUtils.js +8 -8
  28. package/lib/MetaMatchers.js +118 -0
  29. package/lib/OrderedMap.js +453 -0
  30. package/lib/PooledClass.js +2 -2
  31. package/lib/React.js +6 -6
  32. package/lib/ReactBrowserComponentMixin.js +4 -4
  33. package/lib/ReactBrowserEventEmitter.js +30 -7
  34. package/lib/ReactCSSTransitionGroup.js +16 -5
  35. package/lib/ReactCSSTransitionGroupChild.js +12 -11
  36. package/lib/ReactChildReconciler.js +25 -18
  37. package/lib/ReactChildren.js +6 -6
  38. package/lib/ReactClass.js +42 -42
  39. package/lib/ReactComponent.js +13 -13
  40. package/lib/ReactComponentBrowserEnvironment.js +2 -2
  41. package/lib/ReactComponentEnvironment.js +2 -2
  42. package/lib/ReactComponentWithPureRenderMixin.js +1 -1
  43. package/lib/ReactCompositeComponent.js +38 -38
  44. package/lib/ReactDOM.js +72 -159
  45. package/lib/ReactDOMComponent.js +104 -60
  46. package/lib/ReactDOMFactories.js +177 -0
  47. package/lib/ReactDOMIDOperations.js +10 -24
  48. package/lib/ReactDOMInput.js +8 -8
  49. package/lib/ReactDOMOption.js +7 -7
  50. package/lib/ReactDOMSelect.js +8 -8
  51. package/lib/ReactDOMSelection.js +3 -3
  52. package/lib/ReactDOMServer.js +2 -2
  53. package/lib/ReactDOMTextComponent.js +11 -11
  54. package/lib/ReactDOMTextarea.js +11 -11
  55. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  56. package/lib/ReactDefaultInjection.js +24 -24
  57. package/lib/ReactDefaultPerf.js +7 -7
  58. package/lib/ReactDefaultPerfAnalysis.js +6 -9
  59. package/lib/ReactElement.js +4 -4
  60. package/lib/ReactElementValidator.js +21 -21
  61. package/lib/ReactEmptyComponent.js +4 -4
  62. package/lib/ReactEventEmitterMixin.js +1 -1
  63. package/lib/ReactEventListener.js +19 -14
  64. package/lib/ReactFragment.js +11 -11
  65. package/lib/ReactInjection.js +11 -11
  66. package/lib/ReactInputSelection.js +4 -4
  67. package/lib/ReactInstanceHandles.js +10 -11
  68. package/lib/ReactIsomorphic.js +11 -11
  69. package/lib/ReactLink.js +1 -1
  70. package/lib/ReactMarkupChecksum.js +6 -2
  71. package/lib/ReactMount.js +68 -48
  72. package/lib/ReactMultiChild.js +83 -22
  73. package/lib/ReactMultiChildUpdateTypes.js +2 -1
  74. package/lib/ReactNativeComponent.js +3 -3
  75. package/lib/ReactNoopUpdateQueue.js +3 -3
  76. package/lib/ReactOwner.js +3 -3
  77. package/lib/ReactPerf.js +2 -2
  78. package/lib/ReactPropTransferer.js +3 -3
  79. package/lib/ReactPropTypeLocationNames.js +1 -1
  80. package/lib/ReactPropTypeLocations.js +1 -1
  81. package/lib/ReactPropTypes.js +34 -8
  82. package/lib/ReactReconcileTransaction.js +6 -6
  83. package/lib/ReactReconciler.js +12 -12
  84. package/lib/ReactRef.js +1 -1
  85. package/lib/ReactServerBatchingStrategy.js +5 -5
  86. package/lib/ReactServerRendering.js +12 -12
  87. package/lib/ReactServerRenderingTransaction.js +5 -5
  88. package/lib/ReactTestUtils.js +26 -27
  89. package/lib/ReactTransitionChildMapping.js +2 -2
  90. package/lib/ReactTransitionEvents.js +1 -1
  91. package/lib/ReactTransitionGroup.js +5 -6
  92. package/lib/ReactUpdateQueue.js +17 -17
  93. package/lib/ReactUpdates.js +14 -14
  94. package/lib/ReactWithAddons.js +14 -14
  95. package/lib/ResponderEventPlugin.js +514 -0
  96. package/lib/ResponderSyntheticEvent.js +40 -0
  97. package/lib/ResponderTouchHistoryStore.js +180 -0
  98. package/lib/SVGDOMPropertyConfig.js +1 -1
  99. package/lib/SelectEventPlugin.js +9 -9
  100. package/lib/SimpleEventPlugin.js +201 -25
  101. package/lib/SyntheticClipboardEvent.js +1 -1
  102. package/lib/SyntheticCompositionEvent.js +1 -1
  103. package/lib/SyntheticDragEvent.js +1 -1
  104. package/lib/SyntheticEvent.js +3 -3
  105. package/lib/SyntheticFocusEvent.js +1 -1
  106. package/lib/SyntheticInputEvent.js +1 -1
  107. package/lib/SyntheticKeyboardEvent.js +4 -4
  108. package/lib/SyntheticMouseEvent.js +3 -3
  109. package/lib/SyntheticTouchEvent.js +2 -2
  110. package/lib/SyntheticUIEvent.js +2 -2
  111. package/lib/SyntheticWheelEvent.js +1 -1
  112. package/lib/TapEventPlugin.js +119 -0
  113. package/lib/Transaction.js +6 -6
  114. package/lib/accumulate.js +44 -0
  115. package/lib/accumulateInto.js +2 -2
  116. package/lib/adler32.js +19 -7
  117. package/lib/cloneWithProps.js +11 -6
  118. package/lib/createHierarchyRenderer.js +85 -0
  119. package/lib/dangerousStyleValue.js +1 -1
  120. package/lib/deprecated.js +4 -4
  121. package/lib/findDOMNode.js +9 -9
  122. package/lib/flattenChildren.js +4 -4
  123. package/lib/getEventKey.js +1 -1
  124. package/lib/getTestDocument.js +28 -0
  125. package/lib/getTextContentAccessor.js +1 -1
  126. package/lib/instantiateReactComponent.js +12 -12
  127. package/lib/isEventSupported.js +1 -1
  128. package/lib/onlyChild.js +3 -3
  129. package/lib/quoteAttributeValueForBrowser.js +1 -1
  130. package/lib/reactComponentExpect.js +210 -0
  131. package/lib/renderSubtreeIntoContainer.js +1 -1
  132. package/lib/setInnerHTML.js +1 -1
  133. package/lib/setTextContent.js +3 -3
  134. package/lib/shallowCompare.js +1 -1
  135. package/lib/sliceChildren.js +51 -0
  136. package/lib/traverseAllChildren.js +14 -13
  137. package/lib/update.js +13 -13
  138. package/lib/validateDOMNesting.js +6 -6
  139. package/lib/webcomponents.js +6379 -0
  140. package/package.json +4 -6
  141. package/react.js +1 -1
  142. package/lib/CSSCore.js +0 -97
  143. package/lib/EventListener.js +0 -84
  144. package/lib/ExecutionEnvironment.js +0 -38
  145. package/lib/ReactDOMClient.js +0 -90
  146. package/lib/camelize.js +0 -32
  147. package/lib/camelizeStyleName.js +0 -40
  148. package/lib/containsNode.js +0 -55
  149. package/lib/createArrayFromMixed.js +0 -85
  150. package/lib/createNodesFromMarkup.js +0 -84
  151. package/lib/emptyFunction.js +0 -38
  152. package/lib/emptyObject.js +0 -20
  153. package/lib/focusNode.js +0 -26
  154. package/lib/getActiveElement.js +0 -29
  155. package/lib/getMarkupWrap.js +0 -93
  156. package/lib/getUnboundedScrollPosition.js +0 -38
  157. package/lib/hyphenate.js +0 -33
  158. package/lib/hyphenateStyleName.js +0 -39
  159. package/lib/invariant.js +0 -49
  160. package/lib/isNode.js +0 -23
  161. package/lib/isTextNode.js +0 -25
  162. package/lib/keyMirror.js +0 -48
  163. package/lib/keyOf.js +0 -35
  164. package/lib/mapObject.js +0 -51
  165. package/lib/performance.js +0 -23
  166. package/lib/performanceNow.js +0 -28
  167. package/lib/shallowEqual.js +0 -48
  168. package/lib/toArray.js +0 -57
  169. package/lib/warning.js +0 -57
@@ -11,11 +11,11 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactNoopUpdateQueue = require("./ReactNoopUpdateQueue");
14
+ var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
15
15
 
16
- var emptyObject = require("./emptyObject");
17
- var invariant = require("./invariant");
18
- var warning = require("./warning");
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) ? 'production' !== process.env.NODE_ENV ? 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 ('production' !== process.env.NODE_ENV) {
60
- 'production' !== process.env.NODE_ENV ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
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 ('production' !== process.env.NODE_ENV) {
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
- 'production' !== process.env.NODE_ENV ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
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("./ReactDOMIDOperations");
15
- var ReactMount = require("./ReactMount");
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("./invariant");
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 ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
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,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var shallowCompare = require("./shallowCompare");
14
+ var shallowCompare = require('./shallowCompare');
15
15
 
16
16
  /**
17
17
  * If your React component's render function is "pure", e.g. it will render the
@@ -11,21 +11,21 @@
11
11
 
12
12
  'use strict';
13
13
 
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("./emptyObject");
26
- var invariant = require("./invariant");
27
- var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
28
- var warning = require("./warning");
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 ('production' !== process.env.NODE_ENV) {
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
- 'production' !== process.env.NODE_ENV ? 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;
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 ('production' !== process.env.NODE_ENV) {
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
- 'production' !== process.env.NODE_ENV ? 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
- 'production' !== process.env.NODE_ENV ? 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
- 'production' !== process.env.NODE_ENV ? 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
- 'production' !== process.env.NODE_ENV ? 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
- 'production' !== process.env.NODE_ENV ? 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
- 'production' !== process.env.NODE_ENV ? 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
- 'production' !== process.env.NODE_ENV ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
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)) ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
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 ('production' !== process.env.NODE_ENV) {
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') ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
288
- if ('production' !== process.env.NODE_ENV) {
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) ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
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 ('production' !== process.env.NODE_ENV) {
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') ? 'production' !== process.env.NODE_ENV ? 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;
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
- 'production' !== process.env.NODE_ENV ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
349
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
350
350
  } else {
351
- 'production' !== process.env.NODE_ENV ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
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 ('production' !== process.env.NODE_ENV) {
426
- 'production' !== process.env.NODE_ENV ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
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 ('production' !== process.env.NODE_ENV) {
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
- (renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent))) ? 'production' !== process.env.NODE_ENV ? 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;
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 ReactElement = require("./ReactElement");
16
- var ReactElementValidator = require("./ReactElementValidator");
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 mapObject = require("./mapObject");
25
+ var findDOMNode = require('./findDOMNode');
26
+ var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer');
27
+ var warning = require('fbjs/lib/warning');
19
28
 
20
- /**
21
- * Create a factory that creates HTML tag elements.
22
- *
23
- * @param {string} tag Tag name (e.g. `div`).
24
- * @private
25
- */
26
- function createDOMFactory(tag) {
27
- if ('production' !== process.env.NODE_ENV) {
28
- return ReactElementValidator.createFactory(tag);
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;