react 0.14.9 → 15.0.0-rc.2

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 (183) hide show
  1. package/LICENSE +1 -1
  2. package/addons.js +2 -0
  3. package/dist/react-with-addons.js +4299 -4138
  4. package/dist/react-with-addons.min.js +7 -7
  5. package/dist/react.js +4059 -3644
  6. package/dist/react.min.js +7 -7
  7. package/lib/AutoFocusUtils.js +3 -15
  8. package/lib/BeforeInputEventPlugin.js +8 -25
  9. package/lib/CSSProperty.js +10 -1
  10. package/lib/CSSPropertyOperations.js +21 -7
  11. package/lib/CallbackQueue.js +12 -1
  12. package/lib/ChangeEventPlugin.js +58 -54
  13. package/lib/DOMChildrenOperations.js +93 -60
  14. package/lib/DOMLazyTree.js +105 -0
  15. package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
  16. package/lib/DOMProperty.js +15 -36
  17. package/lib/DOMPropertyOperations.js +40 -52
  18. package/lib/Danger.js +6 -7
  19. package/lib/DefaultEventPluginOrder.js +1 -1
  20. package/lib/EnterLeaveEventPlugin.js +24 -43
  21. package/lib/EventConstants.js +6 -1
  22. package/lib/EventPluginHub.js +20 -64
  23. package/lib/EventPluginRegistry.js +23 -2
  24. package/lib/EventPluginUtils.js +60 -35
  25. package/lib/EventPropagators.js +19 -17
  26. package/lib/FallbackCompositionState.js +1 -2
  27. package/lib/HTMLDOMPropertyConfig.js +131 -152
  28. package/lib/LinkedStateMixin.js +1 -2
  29. package/lib/LinkedValueUtils.js +2 -3
  30. package/lib/MetaMatchers.js +2 -2
  31. package/lib/Object.assign.js +1 -1
  32. package/lib/OrderedMap.js +1 -1
  33. package/lib/PooledClass.js +1 -1
  34. package/lib/React.js +1 -13
  35. package/lib/ReactBrowserEventEmitter.js +16 -24
  36. package/lib/ReactCSSTransitionGroup.js +1 -2
  37. package/lib/ReactCSSTransitionGroupChild.js +1 -6
  38. package/lib/ReactChildReconciler.js +14 -12
  39. package/lib/ReactChildren.js +5 -4
  40. package/lib/ReactClass.js +21 -70
  41. package/lib/ReactComponent.js +4 -5
  42. package/lib/ReactComponentBrowserEnvironment.js +9 -6
  43. package/lib/ReactComponentEnvironment.js +3 -3
  44. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  45. package/lib/ReactCompositeComponent.js +146 -55
  46. package/lib/ReactCurrentOwner.js +2 -1
  47. package/lib/ReactDOM.js +26 -14
  48. package/lib/ReactDOMButton.js +2 -2
  49. package/lib/ReactDOMComponent.js +162 -231
  50. package/lib/ReactDOMComponentFlags.js +18 -0
  51. package/lib/ReactDOMComponentTree.js +186 -0
  52. package/lib/ReactDOMContainerInfo.js +32 -0
  53. package/lib/ReactDOMDebugTool.js +61 -0
  54. package/lib/ReactDOMEmptyComponent.js +60 -0
  55. package/lib/ReactDOMFactories.js +1 -2
  56. package/lib/ReactDOMFeatureFlags.js +2 -2
  57. package/lib/ReactDOMIDOperations.js +5 -60
  58. package/lib/ReactDOMInput.js +71 -22
  59. package/lib/ReactDOMInstrumentation.js +16 -0
  60. package/lib/ReactDOMOption.js +9 -8
  61. package/lib/ReactDOMSelect.js +38 -15
  62. package/lib/ReactDOMSelection.js +4 -4
  63. package/lib/ReactDOMServer.js +1 -1
  64. package/lib/ReactDOMTextComponent.js +84 -43
  65. package/lib/ReactDOMTextarea.js +32 -5
  66. package/lib/ReactDOMTreeTraversal.js +134 -0
  67. package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
  68. package/lib/ReactDebugTool.js +72 -0
  69. package/lib/ReactDefaultBatchingStrategy.js +1 -1
  70. package/lib/ReactDefaultInjection.js +11 -15
  71. package/lib/ReactDefaultPerf.js +59 -19
  72. package/lib/ReactDefaultPerfAnalysis.js +17 -9
  73. package/lib/ReactElement.js +60 -21
  74. package/lib/ReactElementValidator.js +2 -2
  75. package/lib/ReactEmptyComponent.js +8 -33
  76. package/lib/ReactErrorUtils.js +1 -2
  77. package/lib/ReactEventEmitterMixin.js +3 -8
  78. package/lib/ReactEventListener.js +20 -75
  79. package/lib/ReactFeatureFlags.js +21 -0
  80. package/lib/ReactFragment.js +2 -2
  81. package/lib/ReactInjection.js +3 -3
  82. package/lib/ReactInputSelection.js +4 -4
  83. package/lib/ReactInstanceHandles.js +4 -6
  84. package/lib/ReactInstanceMap.js +2 -1
  85. package/lib/ReactInstrumentation.js +16 -0
  86. package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
  87. package/lib/ReactIsomorphic.js +1 -1
  88. package/lib/ReactLink.js +2 -3
  89. package/lib/ReactMarkupChecksum.js +8 -3
  90. package/lib/ReactMount.js +74 -447
  91. package/lib/ReactMultiChild.js +106 -200
  92. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  93. package/lib/ReactNativeComponent.js +2 -2
  94. package/lib/ReactNodeTypes.js +37 -0
  95. package/lib/ReactNoopUpdateQueue.js +1 -24
  96. package/lib/ReactOwner.js +5 -4
  97. package/lib/ReactPerf.js +2 -2
  98. package/lib/ReactPropTransferer.js +1 -1
  99. package/lib/ReactPropTypeLocationNames.js +1 -1
  100. package/lib/ReactPropTypeLocations.js +1 -1
  101. package/lib/ReactPropTypes.js +31 -7
  102. package/lib/ReactReconcileTransaction.js +17 -6
  103. package/lib/ReactReconciler.js +29 -6
  104. package/lib/ReactRef.js +1 -1
  105. package/lib/ReactServerBatchingStrategy.js +1 -2
  106. package/lib/ReactServerRendering.js +16 -34
  107. package/lib/ReactServerRenderingTransaction.js +8 -26
  108. package/lib/ReactSimpleEmptyComponent.js +36 -0
  109. package/lib/ReactStateSetters.js +1 -1
  110. package/lib/ReactTestUtils.js +30 -21
  111. package/lib/ReactTransitionChildMapping.js +1 -2
  112. package/lib/ReactTransitionEvents.js +8 -44
  113. package/lib/ReactTransitionGroup.js +1 -1
  114. package/lib/ReactUpdateQueue.js +4 -63
  115. package/lib/ReactUpdates.js +19 -2
  116. package/lib/ReactVersion.js +2 -2
  117. package/lib/ReactWithAddons.js +1 -14
  118. package/lib/ResponderEventPlugin.js +53 -65
  119. package/lib/ResponderSyntheticEvent.js +2 -3
  120. package/lib/ResponderTouchHistoryStore.js +1 -1
  121. package/lib/SVGDOMPropertyConfig.js +267 -94
  122. package/lib/SelectEventPlugin.js +13 -18
  123. package/lib/SimpleEventPlugin.js +56 -16
  124. package/lib/SyntheticAnimationEvent.js +39 -0
  125. package/lib/SyntheticClipboardEvent.js +2 -3
  126. package/lib/SyntheticCompositionEvent.js +2 -3
  127. package/lib/SyntheticDragEvent.js +2 -3
  128. package/lib/SyntheticEvent.js +97 -17
  129. package/lib/SyntheticFocusEvent.js +2 -3
  130. package/lib/SyntheticInputEvent.js +2 -3
  131. package/lib/SyntheticKeyboardEvent.js +2 -3
  132. package/lib/SyntheticMouseEvent.js +2 -3
  133. package/lib/SyntheticTouchEvent.js +2 -3
  134. package/lib/SyntheticTransitionEvent.js +39 -0
  135. package/lib/SyntheticUIEvent.js +2 -3
  136. package/lib/SyntheticWheelEvent.js +2 -3
  137. package/lib/TapEventPlugin.js +3 -12
  138. package/lib/Transaction.js +1 -1
  139. package/lib/ViewportMetrics.js +1 -1
  140. package/lib/accumulate.js +1 -1
  141. package/lib/accumulateInto.js +1 -1
  142. package/lib/adler32.js +3 -2
  143. package/lib/canDefineProperty.js +1 -1
  144. package/lib/createHierarchyRenderer.js +1 -1
  145. package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
  146. package/lib/dangerousStyleValue.js +25 -3
  147. package/lib/deprecated.js +3 -1
  148. package/lib/escapeTextContentForBrowser.js +1 -1
  149. package/lib/findDOMNode.js +15 -8
  150. package/lib/flattenChildren.js +1 -1
  151. package/lib/forEachAccumulated.js +2 -1
  152. package/lib/getEventCharCode.js +2 -2
  153. package/lib/getEventKey.js +1 -2
  154. package/lib/getEventModifierState.js +1 -2
  155. package/lib/getEventTarget.js +8 -2
  156. package/lib/getIteratorFn.js +2 -2
  157. package/lib/getNativeComponentFromComposite.js +30 -0
  158. package/lib/getNodeForCharacterOffset.js +2 -1
  159. package/lib/getTestDocument.js +1 -1
  160. package/lib/getTextContentAccessor.js +1 -1
  161. package/lib/getVendorPrefixedEventName.js +101 -0
  162. package/lib/instantiateReactComponent.js +7 -9
  163. package/lib/isEventSupported.js +2 -2
  164. package/lib/isTextInputElement.js +2 -1
  165. package/lib/onlyChild.js +1 -1
  166. package/lib/quoteAttributeValueForBrowser.js +1 -1
  167. package/lib/reactComponentExpect.js +1 -1
  168. package/lib/renderSubtreeIntoContainer.js +1 -1
  169. package/lib/setInnerHTML.js +5 -14
  170. package/lib/setTextContent.js +1 -1
  171. package/lib/shallowCompare.js +1 -1
  172. package/lib/shouldUpdateReactComponent.js +2 -3
  173. package/lib/sliceChildren.js +1 -1
  174. package/lib/traverseAllChildren.js +6 -6
  175. package/lib/update.js +2 -2
  176. package/lib/validateDOMNesting.js +15 -11
  177. package/package.json +2 -2
  178. package/lib/ReactBrowserComponentMixin.js +0 -36
  179. package/lib/ReactEmptyComponentRegistry.js +0 -48
  180. package/lib/ReactRootIndex.js +0 -29
  181. package/lib/ServerReactRootIndex.js +0 -29
  182. package/lib/cloneWithProps.js +0 -54
  183. package/lib/webcomponents.js +0 -6379
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
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,14 +11,19 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var DOMPropertyOperations = require('./DOMPropertyOperations');
14
15
  var LinkedValueUtils = require('./LinkedValueUtils');
15
- var ReactDOMIDOperations = require('./ReactDOMIDOperations');
16
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
16
17
  var ReactUpdates = require('./ReactUpdates');
17
18
 
18
19
  var assign = require('./Object.assign');
19
20
  var invariant = require('fbjs/lib/invariant');
20
21
  var warning = require('fbjs/lib/warning');
21
22
 
23
+ var didWarnValueLink = false;
24
+ var didWarnValueNull = false;
25
+ var didWarnValDefaultVal = false;
26
+
22
27
  function forceUpdateIfMounted() {
23
28
  if (this._rootNodeID) {
24
29
  // DOM component is still mounted; update
@@ -26,6 +31,14 @@ function forceUpdateIfMounted() {
26
31
  }
27
32
  }
28
33
 
34
+ function warnIfValueIsNull(props) {
35
+ if (props != null && props.value === null && !didWarnValueNull) {
36
+ process.env.NODE_ENV !== 'production' ? warning(false, '`value` prop on `textarea` should not be null. ' + 'Consider using the empty string to clear the component or `undefined` ' + 'for uncontrolled components.') : undefined;
37
+
38
+ didWarnValueNull = true;
39
+ }
40
+ }
41
+
29
42
  /**
30
43
  * Implements a <textarea> native component that allows setting `value`, and
31
44
  * `defaultValue`. This differs from the traditional DOM API because value is
@@ -42,7 +55,7 @@ function forceUpdateIfMounted() {
42
55
  * `defaultValue` if specified, or the children content (deprecated).
43
56
  */
44
57
  var ReactDOMTextarea = {
45
- getNativeProps: function (inst, props, context) {
58
+ getNativeProps: function (inst, props) {
46
59
  !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
47
60
 
48
61
  // Always set children to the same thing. In IE9, the selection range will
@@ -60,6 +73,15 @@ var ReactDOMTextarea = {
60
73
  mountWrapper: function (inst, props) {
61
74
  if (process.env.NODE_ENV !== 'production') {
62
75
  LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
76
+ if (props.valueLink !== undefined && !didWarnValueLink) {
77
+ process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `textarea` is deprecated; set `value` and `onChange` instead.') : undefined;
78
+ didWarnValueLink = true;
79
+ }
80
+ if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
81
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components') : undefined;
82
+ didWarnValDefaultVal = true;
83
+ }
84
+ warnIfValueIsNull(props);
63
85
  }
64
86
 
65
87
  var defaultValue = props.defaultValue;
@@ -81,24 +103,29 @@ var ReactDOMTextarea = {
81
103
  defaultValue = '';
82
104
  }
83
105
  var value = LinkedValueUtils.getValue(props);
84
-
85
106
  inst._wrapperState = {
86
107
  // We save the initial value so that `ReactDOMComponent` doesn't update
87
108
  // `textContent` (unnecessary since we update value).
88
109
  // The initial value can be a boolean or object so that's why it's
89
110
  // forced to be a string.
90
111
  initialValue: '' + (value != null ? value : defaultValue),
112
+ listeners: null,
91
113
  onChange: _handleChange.bind(inst)
92
114
  };
93
115
  },
94
116
 
95
117
  updateWrapper: function (inst) {
96
118
  var props = inst._currentElement.props;
119
+
120
+ if (process.env.NODE_ENV !== 'production') {
121
+ warnIfValueIsNull(props);
122
+ }
123
+
97
124
  var value = LinkedValueUtils.getValue(props);
98
125
  if (value != null) {
99
126
  // Cast `value` to a string to ensure the value is set correctly. While
100
127
  // browsers typically do this as necessary, jsdom doesn't.
101
- ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
128
+ DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'value', '' + value);
102
129
  }
103
130
  }
104
131
  };
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Copyright 2015-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 ReactDOMTreeTraversal
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var invariant = require('fbjs/lib/invariant');
15
+
16
+ /**
17
+ * Return the lowest common ancestor of A and B, or null if they are in
18
+ * different trees.
19
+ */
20
+ function getLowestCommonAncestor(instA, instB) {
21
+ !('_nativeNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : undefined;
22
+ !('_nativeNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : invariant(false) : undefined;
23
+
24
+ var depthA = 0;
25
+ for (var tempA = instA; tempA; tempA = tempA._nativeParent) {
26
+ depthA++;
27
+ }
28
+ var depthB = 0;
29
+ for (var tempB = instB; tempB; tempB = tempB._nativeParent) {
30
+ depthB++;
31
+ }
32
+
33
+ // If A is deeper, crawl up.
34
+ while (depthA - depthB > 0) {
35
+ instA = instA._nativeParent;
36
+ depthA--;
37
+ }
38
+
39
+ // If B is deeper, crawl up.
40
+ while (depthB - depthA > 0) {
41
+ instB = instB._nativeParent;
42
+ depthB--;
43
+ }
44
+
45
+ // Walk in lockstep until we find a match.
46
+ var depth = depthA;
47
+ while (depth--) {
48
+ if (instA === instB) {
49
+ return instA;
50
+ }
51
+ instA = instA._nativeParent;
52
+ instB = instB._nativeParent;
53
+ }
54
+ return null;
55
+ }
56
+
57
+ /**
58
+ * Return if A is an ancestor of B.
59
+ */
60
+ function isAncestor(instA, instB) {
61
+ !('_nativeNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : invariant(false) : undefined;
62
+ !('_nativeNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : invariant(false) : undefined;
63
+
64
+ while (instB) {
65
+ if (instB === instA) {
66
+ return true;
67
+ }
68
+ instB = instB._nativeParent;
69
+ }
70
+ return false;
71
+ }
72
+
73
+ /**
74
+ * Return the parent instance of the passed-in instance.
75
+ */
76
+ function getParentInstance(inst) {
77
+ !('_nativeNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : invariant(false) : undefined;
78
+
79
+ return inst._nativeParent;
80
+ }
81
+
82
+ /**
83
+ * Simulates the traversal of a two-phase, capture/bubble event dispatch.
84
+ */
85
+ function traverseTwoPhase(inst, fn, arg) {
86
+ var path = [];
87
+ while (inst) {
88
+ path.push(inst);
89
+ inst = inst._nativeParent;
90
+ }
91
+ var i;
92
+ for (i = path.length; i-- > 0;) {
93
+ fn(path[i], false, arg);
94
+ }
95
+ for (i = 0; i < path.length; i++) {
96
+ fn(path[i], true, arg);
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
102
+ * should would receive a `mouseEnter` or `mouseLeave` event.
103
+ *
104
+ * Does not invoke the callback on the nearest common ancestor because nothing
105
+ * "entered" or "left" that element.
106
+ */
107
+ function traverseEnterLeave(from, to, fn, argFrom, argTo) {
108
+ var common = from && to ? getLowestCommonAncestor(from, to) : null;
109
+ var pathFrom = [];
110
+ while (from && from !== common) {
111
+ pathFrom.push(from);
112
+ from = from._nativeParent;
113
+ }
114
+ var pathTo = [];
115
+ while (to && to !== common) {
116
+ pathTo.push(to);
117
+ to = to._nativeParent;
118
+ }
119
+ var i;
120
+ for (i = 0; i < pathFrom.length; i++) {
121
+ fn(pathFrom[i], true, argFrom);
122
+ }
123
+ for (i = pathTo.length; i-- > 0;) {
124
+ fn(pathTo[i], false, argTo);
125
+ }
126
+ }
127
+
128
+ module.exports = {
129
+ isAncestor: isAncestor,
130
+ getLowestCommonAncestor: getLowestCommonAncestor,
131
+ getParentInstance: getParentInstance,
132
+ traverseTwoPhase: traverseTwoPhase,
133
+ traverseEnterLeave: traverseEnterLeave
134
+ };
@@ -0,0 +1,64 @@
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 ReactDOMUnknownPropertyDevtool
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var DOMProperty = require('./DOMProperty');
15
+ var EventPluginRegistry = require('./EventPluginRegistry');
16
+
17
+ var warning = require('fbjs/lib/warning');
18
+
19
+ if (process.env.NODE_ENV !== 'production') {
20
+ var reactProps = {
21
+ children: true,
22
+ dangerouslySetInnerHTML: true,
23
+ key: true,
24
+ ref: true
25
+ };
26
+ var warnedProperties = {};
27
+
28
+ var warnUnknownProperty = function (name) {
29
+ if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) {
30
+ return;
31
+ }
32
+ if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
33
+ return;
34
+ }
35
+
36
+ warnedProperties[name] = true;
37
+ var lowerCasedName = name.toLowerCase();
38
+
39
+ // data-* attributes should be lowercase; suggest the lowercase version
40
+ var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
41
+
42
+ // For now, only warn when we have a suggested correction. This prevents
43
+ // logging too much when using transferPropsTo.
44
+ process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
45
+
46
+ var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null;
47
+
48
+ process.env.NODE_ENV !== 'production' ? warning(registrationName == null, 'Unknown event handler property %s. Did you mean `%s`?', name, registrationName) : undefined;
49
+ };
50
+ }
51
+
52
+ var ReactDOMUnknownPropertyDevtool = {
53
+ onCreateMarkupForProperty: function (name, value) {
54
+ warnUnknownProperty(name);
55
+ },
56
+ onSetValueForProperty: function (node, name, value) {
57
+ warnUnknownProperty(name);
58
+ },
59
+ onDeleteValueForProperty: function (node, name) {
60
+ warnUnknownProperty(name);
61
+ }
62
+ };
63
+
64
+ module.exports = ReactDOMUnknownPropertyDevtool;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Copyright 2016-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 ReactDebugTool
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var ReactInvalidSetStateWarningDevTool = require('./ReactInvalidSetStateWarningDevTool');
15
+ var warning = require('fbjs/lib/warning');
16
+
17
+ var eventHandlers = [];
18
+ var handlerDoesThrowForEvent = {};
19
+
20
+ function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
21
+ if (process.env.NODE_ENV !== 'production') {
22
+ eventHandlers.forEach(function (handler) {
23
+ try {
24
+ if (handler[handlerFunctionName]) {
25
+ handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
26
+ }
27
+ } catch (e) {
28
+ process.env.NODE_ENV !== 'production' ? warning(!handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e.message) : undefined;
29
+ handlerDoesThrowForEvent[handlerFunctionName] = true;
30
+ }
31
+ });
32
+ }
33
+ }
34
+
35
+ var ReactDebugTool = {
36
+ addDevtool: function (devtool) {
37
+ eventHandlers.push(devtool);
38
+ },
39
+ removeDevtool: function (devtool) {
40
+ for (var i = 0; i < eventHandlers.length; i++) {
41
+ if (eventHandlers[i] === devtool) {
42
+ eventHandlers.splice(i, 1);
43
+ i--;
44
+ }
45
+ }
46
+ },
47
+ onBeginProcessingChildContext: function () {
48
+ emitEvent('onBeginProcessingChildContext');
49
+ },
50
+ onEndProcessingChildContext: function () {
51
+ emitEvent('onEndProcessingChildContext');
52
+ },
53
+ onSetState: function () {
54
+ emitEvent('onSetState');
55
+ },
56
+ onMountRootComponent: function (internalInstance) {
57
+ emitEvent('onMountRootComponent', internalInstance);
58
+ },
59
+ onMountComponent: function (internalInstance) {
60
+ emitEvent('onMountComponent', internalInstance);
61
+ },
62
+ onUpdateComponent: function (internalInstance) {
63
+ emitEvent('onUpdateComponent', internalInstance);
64
+ },
65
+ onUnmountComponent: function (internalInstance) {
66
+ emitEvent('onUnmountComponent', internalInstance);
67
+ }
68
+ };
69
+
70
+ ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool);
71
+
72
+ module.exports = ReactDebugTool;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
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,25 +13,23 @@
13
13
 
14
14
  var BeforeInputEventPlugin = require('./BeforeInputEventPlugin');
15
15
  var ChangeEventPlugin = require('./ChangeEventPlugin');
16
- var ClientReactRootIndex = require('./ClientReactRootIndex');
17
16
  var DefaultEventPluginOrder = require('./DefaultEventPluginOrder');
18
17
  var EnterLeaveEventPlugin = require('./EnterLeaveEventPlugin');
19
18
  var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
20
19
  var HTMLDOMPropertyConfig = require('./HTMLDOMPropertyConfig');
21
- var ReactBrowserComponentMixin = require('./ReactBrowserComponentMixin');
22
20
  var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
23
- var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
24
21
  var ReactDOMComponent = require('./ReactDOMComponent');
22
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
23
+ var ReactDOMEmptyComponent = require('./ReactDOMEmptyComponent');
24
+ var ReactDOMTreeTraversal = require('./ReactDOMTreeTraversal');
25
25
  var ReactDOMTextComponent = require('./ReactDOMTextComponent');
26
+ var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
26
27
  var ReactEventListener = require('./ReactEventListener');
27
28
  var ReactInjection = require('./ReactInjection');
28
- var ReactInstanceHandles = require('./ReactInstanceHandles');
29
- var ReactMount = require('./ReactMount');
30
29
  var ReactReconcileTransaction = require('./ReactReconcileTransaction');
30
+ var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
31
31
  var SelectEventPlugin = require('./SelectEventPlugin');
32
- var ServerReactRootIndex = require('./ServerReactRootIndex');
33
32
  var SimpleEventPlugin = require('./SimpleEventPlugin');
34
- var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
35
33
 
36
34
  var alreadyInjected = false;
37
35
 
@@ -50,8 +48,8 @@ function inject() {
50
48
  * Inject modules for resolving DOM hierarchy and plugin ordering.
51
49
  */
52
50
  ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
53
- ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
54
- ReactInjection.EventPluginHub.injectMount(ReactMount);
51
+ ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
52
+ ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
55
53
 
56
54
  /**
57
55
  * Some important event plugins included by default (without having to require
@@ -69,18 +67,16 @@ function inject() {
69
67
 
70
68
  ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
71
69
 
72
- ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
73
-
74
70
  ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
75
71
  ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
76
72
 
77
- ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
73
+ ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
74
+ return new ReactDOMEmptyComponent(instantiate);
75
+ });
78
76
 
79
77
  ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
80
78
  ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
81
79
 
82
- ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
83
-
84
80
  ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
85
81
 
86
82
  if (process.env.NODE_ENV !== 'production') {