react 15.3.1-rc.2 → 15.4.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/react-with-addons.js +3961 -21387
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2701 -19464
  4. package/dist/react.min.js +2 -6
  5. package/lib/LinkedStateMixin.js +1 -2
  6. package/lib/PooledClass.js +3 -0
  7. package/lib/ReactAddonsDOMDependencies.js +36 -0
  8. package/lib/ReactAddonsDOMDependenciesUMDShim.js +32 -0
  9. package/lib/ReactCSSTransitionGroup.js +60 -42
  10. package/lib/ReactCSSTransitionGroupChild.js +2 -2
  11. package/lib/ReactClass.js +38 -53
  12. package/lib/ReactComponentTreeHook.js +84 -100
  13. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +5 -7
  14. package/lib/ReactCurrentOwner.js +1 -1
  15. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +6 -4
  16. package/lib/ReactElement.js +6 -29
  17. package/lib/ReactElementSymbol.js +20 -0
  18. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +4 -9
  19. package/lib/ReactElementValidator.js +1 -2
  20. package/lib/ReactPropTypeLocationNames.js +1 -0
  21. package/lib/ReactPropTypeLocations.js +2 -11
  22. package/lib/ReactPropTypes.js +30 -13
  23. package/lib/ReactPropTypesSecret.js +1 -0
  24. package/lib/ReactTransitionEvents.js +1 -1
  25. package/lib/ReactTransitionGroup.js +145 -141
  26. package/lib/ReactUMDEntry.js +11 -5
  27. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +4 -6
  28. package/lib/ReactVersion.js +1 -1
  29. package/lib/ReactWithAddons.js +15 -2
  30. package/lib/ReactWithAddonsUMDEntry.js +11 -5
  31. package/lib/canDefineProperty.js +2 -0
  32. package/lib/onlyChild.js +1 -1
  33. package/lib/traverseAllChildren.js +11 -2
  34. package/lib/update.js +6 -7
  35. package/package.json +2 -2
  36. package/lib/AutoFocusUtils.js +0 -24
  37. package/lib/BeforeInputEventPlugin.js +0 -388
  38. package/lib/CSSProperty.js +0 -148
  39. package/lib/CSSPropertyOperations.js +0 -205
  40. package/lib/CallbackQueue.js +0 -106
  41. package/lib/ChangeEventPlugin.js +0 -325
  42. package/lib/DOMChildrenOperations.js +0 -194
  43. package/lib/DOMLazyTree.js +0 -118
  44. package/lib/DOMProperty.js +0 -206
  45. package/lib/DOMPropertyOperations.js +0 -221
  46. package/lib/Danger.js +0 -48
  47. package/lib/DefaultEventPluginOrder.js +0 -27
  48. package/lib/DisabledInputUtils.js +0 -50
  49. package/lib/EnterLeaveEventPlugin.js +0 -105
  50. package/lib/EventConstants.js +0 -97
  51. package/lib/EventPluginHub.js +0 -251
  52. package/lib/EventPluginRegistry.js +0 -247
  53. package/lib/EventPluginUtils.js +0 -229
  54. package/lib/EventPropagators.js +0 -137
  55. package/lib/FallbackCompositionState.js +0 -95
  56. package/lib/HTMLDOMPropertyConfig.js +0 -209
  57. package/lib/LinkedValueUtils.js +0 -136
  58. package/lib/NativeMethodsMixin.js +0 -167
  59. package/lib/ReactBrowserEventEmitter.js +0 -317
  60. package/lib/ReactChildReconciler.js +0 -154
  61. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  62. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  63. package/lib/ReactComponentEnvironment.js +0 -45
  64. package/lib/ReactComponentTreeTestUtils.js +0 -87
  65. package/lib/ReactCompositeComponent.js +0 -920
  66. package/lib/ReactDOM.js +0 -110
  67. package/lib/ReactDOMButton.js +0 -24
  68. package/lib/ReactDOMComponent.js +0 -1005
  69. package/lib/ReactDOMComponentTree.js +0 -188
  70. package/lib/ReactDOMContainerInfo.js +0 -33
  71. package/lib/ReactDOMEmptyComponent.js +0 -60
  72. package/lib/ReactDOMFiber.js +0 -78
  73. package/lib/ReactDOMIDOperations.js +0 -34
  74. package/lib/ReactDOMInput.js +0 -269
  75. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  76. package/lib/ReactDOMOption.js +0 -123
  77. package/lib/ReactDOMSelect.js +0 -201
  78. package/lib/ReactDOMSelection.js +0 -212
  79. package/lib/ReactDOMServer.js +0 -26
  80. package/lib/ReactDOMTextComponent.js +0 -164
  81. package/lib/ReactDOMTextarea.js +0 -155
  82. package/lib/ReactDOMTreeTraversal.js +0 -136
  83. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  84. package/lib/ReactDebugTool.js +0 -307
  85. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  86. package/lib/ReactDefaultInjection.js +0 -84
  87. package/lib/ReactEmptyComponent.js +0 -30
  88. package/lib/ReactErrorUtils.js +0 -76
  89. package/lib/ReactEventEmitterMixin.js +0 -33
  90. package/lib/ReactEventListener.js +0 -157
  91. package/lib/ReactFeatureFlags.js +0 -22
  92. package/lib/ReactHostComponent.js +0 -76
  93. package/lib/ReactHostOperationHistoryHook.js +0 -37
  94. package/lib/ReactInjection.js +0 -36
  95. package/lib/ReactInputSelection.js +0 -124
  96. package/lib/ReactInstanceHandles.js +0 -302
  97. package/lib/ReactInstanceMap.js +0 -48
  98. package/lib/ReactInstrumentation.js +0 -21
  99. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  100. package/lib/ReactMarkupChecksum.js +0 -50
  101. package/lib/ReactMount.js +0 -495
  102. package/lib/ReactMultiChild.js +0 -451
  103. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  104. package/lib/ReactNative.js +0 -71
  105. package/lib/ReactNativeAttributePayload.js +0 -371
  106. package/lib/ReactNativeBaseComponent.js +0 -198
  107. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  108. package/lib/ReactNativeComponentEnvironment.js +0 -31
  109. package/lib/ReactNativeComponentTree.js +0 -68
  110. package/lib/ReactNativeContainerInfo.js +0 -21
  111. package/lib/ReactNativeDOMIDOperations.js +0 -79
  112. package/lib/ReactNativeDefaultInjection.js +0 -101
  113. package/lib/ReactNativeEventEmitter.js +0 -191
  114. package/lib/ReactNativeEventPluginOrder.js +0 -16
  115. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  116. package/lib/ReactNativeMount.js +0 -193
  117. package/lib/ReactNativePropRegistry.js +0 -52
  118. package/lib/ReactNativeReconcileTransaction.js +0 -116
  119. package/lib/ReactNativeTagHandles.js +0 -56
  120. package/lib/ReactNativeTextComponent.js +0 -71
  121. package/lib/ReactNativeTreeTraversal.js +0 -127
  122. package/lib/ReactNodeTypes.js +0 -40
  123. package/lib/ReactNoop.js +0 -173
  124. package/lib/ReactOwner.js +0 -94
  125. package/lib/ReactPerf.js +0 -494
  126. package/lib/ReactReconcileTransaction.js +0 -178
  127. package/lib/ReactReconciler.js +0 -168
  128. package/lib/ReactRef.js +0 -80
  129. package/lib/ReactServerBatchingStrategy.js +0 -22
  130. package/lib/ReactServerRendering.js +0 -90
  131. package/lib/ReactServerRenderingTransaction.js +0 -90
  132. package/lib/ReactServerUpdateQueue.js +0 -141
  133. package/lib/ReactSimpleEmptyComponent.js +0 -37
  134. package/lib/ReactTestMount.js +0 -123
  135. package/lib/ReactTestReconcileTransaction.js +0 -108
  136. package/lib/ReactTestRenderer.js +0 -144
  137. package/lib/ReactTestUtils.js +0 -518
  138. package/lib/ReactUpdateQueue.js +0 -226
  139. package/lib/ReactUpdates.js +0 -251
  140. package/lib/ResponderEventPlugin.js +0 -510
  141. package/lib/ResponderSyntheticEvent.js +0 -39
  142. package/lib/ResponderTouchHistoryStore.js +0 -184
  143. package/lib/SVGDOMPropertyConfig.js +0 -302
  144. package/lib/SelectEventPlugin.js +0 -196
  145. package/lib/SimpleEventPlugin.js +0 -635
  146. package/lib/SyntheticAnimationEvent.js +0 -39
  147. package/lib/SyntheticClipboardEvent.js +0 -38
  148. package/lib/SyntheticCompositionEvent.js +0 -36
  149. package/lib/SyntheticDragEvent.js +0 -36
  150. package/lib/SyntheticEvent.js +0 -267
  151. package/lib/SyntheticFocusEvent.js +0 -36
  152. package/lib/SyntheticInputEvent.js +0 -37
  153. package/lib/SyntheticKeyboardEvent.js +0 -84
  154. package/lib/SyntheticMouseEvent.js +0 -72
  155. package/lib/SyntheticTouchEvent.js +0 -45
  156. package/lib/SyntheticTransitionEvent.js +0 -39
  157. package/lib/SyntheticUIEvent.js +0 -59
  158. package/lib/SyntheticWheelEvent.js +0 -54
  159. package/lib/TapEventPlugin.js +0 -110
  160. package/lib/TouchHistoryMath.js +0 -99
  161. package/lib/Transaction.js +0 -233
  162. package/lib/ViewportMetrics.js +0 -27
  163. package/lib/accumulate.js +0 -46
  164. package/lib/accumulateInto.js +0 -58
  165. package/lib/adler32.js +0 -44
  166. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  167. package/lib/createReactNativeComponentClass.js +0 -42
  168. package/lib/dangerousStyleValue.js +0 -79
  169. package/lib/escapeTextContentForBrowser.js +0 -122
  170. package/lib/findDOMNode.js +0 -60
  171. package/lib/findNodeHandle.js +0 -91
  172. package/lib/forEachAccumulated.js +0 -31
  173. package/lib/getEventCharCode.js +0 -50
  174. package/lib/getEventKey.js +0 -102
  175. package/lib/getEventModifierState.js +0 -43
  176. package/lib/getEventTarget.js +0 -35
  177. package/lib/getHostComponentFromComposite.js +0 -30
  178. package/lib/getNodeForCharacterOffset.js +0 -74
  179. package/lib/getTestDocument.js +0 -21
  180. package/lib/getTextContentAccessor.js +0 -33
  181. package/lib/getVendorPrefixedEventName.js +0 -101
  182. package/lib/instantiateReactComponent.js +0 -119
  183. package/lib/isEventSupported.js +0 -60
  184. package/lib/isTextInputElement.js +0 -51
  185. package/lib/quoteAttributeValueForBrowser.js +0 -26
  186. package/lib/reactComponentExpect.js +0 -217
  187. package/lib/setInnerHTML.js +0 -98
  188. package/lib/setTextContent.js +0 -48
  189. package/lib/shouldUpdateReactComponent.js +0 -42
  190. package/lib/validateDOMNesting.js +0 -369
@@ -1,112 +0,0 @@
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 ReactDOMUnknownPropertyHook
10
- */
11
-
12
- 'use strict';
13
-
14
- var DOMProperty = require('./DOMProperty');
15
- var EventPluginRegistry = require('./EventPluginRegistry');
16
- var ReactComponentTreeHook = require('./ReactComponentTreeHook');
17
-
18
- var warning = require('fbjs/lib/warning');
19
-
20
- if (process.env.NODE_ENV !== 'production') {
21
- var reactProps = {
22
- children: true,
23
- dangerouslySetInnerHTML: true,
24
- key: true,
25
- ref: true,
26
-
27
- autoFocus: true,
28
- defaultValue: true,
29
- valueLink: true,
30
- defaultChecked: true,
31
- checkedLink: true,
32
- innerHTML: true,
33
- suppressContentEditableWarning: true,
34
- onFocusIn: true,
35
- onFocusOut: true
36
- };
37
- var warnedProperties = {};
38
-
39
- var validateProperty = function (tagName, name, debugID) {
40
- if (DOMProperty.properties.hasOwnProperty(name) || DOMProperty.isCustomAttribute(name)) {
41
- return true;
42
- }
43
- if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
44
- return true;
45
- }
46
- if (EventPluginRegistry.registrationNameModules.hasOwnProperty(name)) {
47
- return true;
48
- }
49
- warnedProperties[name] = true;
50
- var lowerCasedName = name.toLowerCase();
51
-
52
- // data-* attributes should be lowercase; suggest the lowercase version
53
- var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
54
-
55
- var registrationName = EventPluginRegistry.possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? EventPluginRegistry.possibleRegistrationNames[lowerCasedName] : null;
56
-
57
- if (standardName != null) {
58
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown DOM property %s. Did you mean %s?%s', name, standardName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
59
- return true;
60
- } else if (registrationName != null) {
61
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown event handler property %s. Did you mean `%s`?%s', name, registrationName, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
62
- return true;
63
- } else {
64
- // We were unable to guess which prop the user intended.
65
- // It is likely that the user was just blindly spreading/forwarding props
66
- // Components should be careful to only render valid props/attributes.
67
- // Warning will be invoked in warnUnknownProperties to allow grouping.
68
- return false;
69
- }
70
- };
71
- }
72
-
73
- var warnUnknownProperties = function (debugID, element) {
74
- var unknownProps = [];
75
- for (var key in element.props) {
76
- var isValid = validateProperty(element.type, key, debugID);
77
- if (!isValid) {
78
- unknownProps.push(key);
79
- }
80
- }
81
-
82
- var unknownPropString = unknownProps.map(function (prop) {
83
- return '`' + prop + '`';
84
- }).join(', ');
85
-
86
- if (unknownProps.length === 1) {
87
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown prop %s on <%s> tag. Remove this prop from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
88
- } else if (unknownProps.length > 1) {
89
- process.env.NODE_ENV !== 'production' ? warning(false, 'Unknown props %s on <%s> tag. Remove these props from the element. ' + 'For details, see https://fb.me/react-unknown-prop%s', unknownPropString, element.type, ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0;
90
- }
91
- };
92
-
93
- function handleElement(debugID, element) {
94
- if (element == null || typeof element.type !== 'string') {
95
- return;
96
- }
97
- if (element.type.indexOf('-') >= 0 || element.props.is) {
98
- return;
99
- }
100
- warnUnknownProperties(debugID, element);
101
- }
102
-
103
- var ReactDOMUnknownPropertyHook = {
104
- onBeforeMountComponent: function (debugID, element) {
105
- handleElement(debugID, element);
106
- },
107
- onBeforeUpdateComponent: function (debugID, element) {
108
- handleElement(debugID, element);
109
- }
110
- };
111
-
112
- module.exports = ReactDOMUnknownPropertyHook;
@@ -1,307 +0,0 @@
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 ReactInvalidSetStateWarningHook = require('./ReactInvalidSetStateWarningHook');
15
- var ReactHostOperationHistoryHook = require('./ReactHostOperationHistoryHook');
16
- var ReactComponentTreeHook = require('./ReactComponentTreeHook');
17
- var ReactChildrenMutationWarningHook = require('./ReactChildrenMutationWarningHook');
18
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
19
-
20
- var performanceNow = require('fbjs/lib/performanceNow');
21
- var warning = require('fbjs/lib/warning');
22
-
23
- var hooks = [];
24
- var didHookThrowForEvent = {};
25
-
26
- function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) {
27
- try {
28
- fn.call(context, arg1, arg2, arg3, arg4, arg5);
29
- } catch (e) {
30
- process.env.NODE_ENV !== 'production' ? warning(didHookThrowForEvent[event], 'Exception thrown by hook while handling %s: %s', event, e + '\n' + e.stack) : void 0;
31
- didHookThrowForEvent[event] = true;
32
- }
33
- }
34
-
35
- function emitEvent(event, arg1, arg2, arg3, arg4, arg5) {
36
- for (var i = 0; i < hooks.length; i++) {
37
- var hook = hooks[i];
38
- var fn = hook[event];
39
- if (fn) {
40
- callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5);
41
- }
42
- }
43
- }
44
-
45
- var isProfiling = false;
46
- var flushHistory = [];
47
- var lifeCycleTimerStack = [];
48
- var currentFlushNesting = 0;
49
- var currentFlushMeasurements = null;
50
- var currentFlushStartTime = null;
51
- var currentTimerDebugID = null;
52
- var currentTimerStartTime = null;
53
- var currentTimerNestedFlushDuration = null;
54
- var currentTimerType = null;
55
-
56
- var lifeCycleTimerHasWarned = false;
57
-
58
- function clearHistory() {
59
- ReactComponentTreeHook.purgeUnmountedComponents();
60
- ReactHostOperationHistoryHook.clearHistory();
61
- }
62
-
63
- function getTreeSnapshot(registeredIDs) {
64
- return registeredIDs.reduce(function (tree, id) {
65
- var ownerID = ReactComponentTreeHook.getOwnerID(id);
66
- var parentID = ReactComponentTreeHook.getParentID(id);
67
- tree[id] = {
68
- displayName: ReactComponentTreeHook.getDisplayName(id),
69
- text: ReactComponentTreeHook.getText(id),
70
- updateCount: ReactComponentTreeHook.getUpdateCount(id),
71
- childIDs: ReactComponentTreeHook.getChildIDs(id),
72
- // Text nodes don't have owners but this is close enough.
73
- ownerID: ownerID || ReactComponentTreeHook.getOwnerID(parentID),
74
- parentID: parentID
75
- };
76
- return tree;
77
- }, {});
78
- }
79
-
80
- function resetMeasurements() {
81
- var previousStartTime = currentFlushStartTime;
82
- var previousMeasurements = currentFlushMeasurements || [];
83
- var previousOperations = ReactHostOperationHistoryHook.getHistory();
84
-
85
- if (currentFlushNesting === 0) {
86
- currentFlushStartTime = null;
87
- currentFlushMeasurements = null;
88
- clearHistory();
89
- return;
90
- }
91
-
92
- if (previousMeasurements.length || previousOperations.length) {
93
- var registeredIDs = ReactComponentTreeHook.getRegisteredIDs();
94
- flushHistory.push({
95
- duration: performanceNow() - previousStartTime,
96
- measurements: previousMeasurements || [],
97
- operations: previousOperations || [],
98
- treeSnapshot: getTreeSnapshot(registeredIDs)
99
- });
100
- }
101
-
102
- clearHistory();
103
- currentFlushStartTime = performanceNow();
104
- currentFlushMeasurements = [];
105
- }
106
-
107
- function checkDebugID(debugID) {
108
- var allowRoot = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
109
-
110
- if (allowRoot && debugID === 0) {
111
- return;
112
- }
113
- if (!debugID) {
114
- process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0;
115
- }
116
- }
117
-
118
- function beginLifeCycleTimer(debugID, timerType) {
119
- if (currentFlushNesting === 0) {
120
- return;
121
- }
122
- if (currentTimerType && !lifeCycleTimerHasWarned) {
123
- process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
124
- lifeCycleTimerHasWarned = true;
125
- }
126
- currentTimerStartTime = performanceNow();
127
- currentTimerNestedFlushDuration = 0;
128
- currentTimerDebugID = debugID;
129
- currentTimerType = timerType;
130
- }
131
-
132
- function endLifeCycleTimer(debugID, timerType) {
133
- if (currentFlushNesting === 0) {
134
- return;
135
- }
136
- if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {
137
- process.env.NODE_ENV !== 'production' ? warning(false, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
138
- lifeCycleTimerHasWarned = true;
139
- }
140
- if (isProfiling) {
141
- currentFlushMeasurements.push({
142
- timerType: timerType,
143
- instanceID: debugID,
144
- duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration
145
- });
146
- }
147
- currentTimerStartTime = null;
148
- currentTimerNestedFlushDuration = null;
149
- currentTimerDebugID = null;
150
- currentTimerType = null;
151
- }
152
-
153
- function pauseCurrentLifeCycleTimer() {
154
- var currentTimer = {
155
- startTime: currentTimerStartTime,
156
- nestedFlushStartTime: performanceNow(),
157
- debugID: currentTimerDebugID,
158
- timerType: currentTimerType
159
- };
160
- lifeCycleTimerStack.push(currentTimer);
161
- currentTimerStartTime = null;
162
- currentTimerNestedFlushDuration = null;
163
- currentTimerDebugID = null;
164
- currentTimerType = null;
165
- }
166
-
167
- function resumeCurrentLifeCycleTimer() {
168
- var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop();
169
-
170
- var startTime = _lifeCycleTimerStack$.startTime;
171
- var nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime;
172
- var debugID = _lifeCycleTimerStack$.debugID;
173
- var timerType = _lifeCycleTimerStack$.timerType;
174
-
175
- var nestedFlushDuration = performanceNow() - nestedFlushStartTime;
176
- currentTimerStartTime = startTime;
177
- currentTimerNestedFlushDuration += nestedFlushDuration;
178
- currentTimerDebugID = debugID;
179
- currentTimerType = timerType;
180
- }
181
-
182
- var ReactDebugTool = {
183
- addHook: function (hook) {
184
- hooks.push(hook);
185
- },
186
- removeHook: function (hook) {
187
- for (var i = 0; i < hooks.length; i++) {
188
- if (hooks[i] === hook) {
189
- hooks.splice(i, 1);
190
- i--;
191
- }
192
- }
193
- },
194
- isProfiling: function () {
195
- return isProfiling;
196
- },
197
- beginProfiling: function () {
198
- if (isProfiling) {
199
- return;
200
- }
201
-
202
- isProfiling = true;
203
- flushHistory.length = 0;
204
- resetMeasurements();
205
- ReactDebugTool.addHook(ReactHostOperationHistoryHook);
206
- },
207
- endProfiling: function () {
208
- if (!isProfiling) {
209
- return;
210
- }
211
-
212
- isProfiling = false;
213
- resetMeasurements();
214
- ReactDebugTool.removeHook(ReactHostOperationHistoryHook);
215
- },
216
- getFlushHistory: function () {
217
- return flushHistory;
218
- },
219
- onBeginFlush: function () {
220
- currentFlushNesting++;
221
- resetMeasurements();
222
- pauseCurrentLifeCycleTimer();
223
- emitEvent('onBeginFlush');
224
- },
225
- onEndFlush: function () {
226
- resetMeasurements();
227
- currentFlushNesting--;
228
- resumeCurrentLifeCycleTimer();
229
- emitEvent('onEndFlush');
230
- },
231
- onBeginLifeCycleTimer: function (debugID, timerType) {
232
- checkDebugID(debugID);
233
- emitEvent('onBeginLifeCycleTimer', debugID, timerType);
234
- beginLifeCycleTimer(debugID, timerType);
235
- },
236
- onEndLifeCycleTimer: function (debugID, timerType) {
237
- checkDebugID(debugID);
238
- endLifeCycleTimer(debugID, timerType);
239
- emitEvent('onEndLifeCycleTimer', debugID, timerType);
240
- },
241
- onError: function (debugID) {
242
- if (currentTimerDebugID != null) {
243
- endLifeCycleTimer(currentTimerDebugID, currentTimerType);
244
- }
245
- emitEvent('onError', debugID);
246
- },
247
- onBeginProcessingChildContext: function () {
248
- emitEvent('onBeginProcessingChildContext');
249
- },
250
- onEndProcessingChildContext: function () {
251
- emitEvent('onEndProcessingChildContext');
252
- },
253
- onHostOperation: function (debugID, type, payload) {
254
- checkDebugID(debugID);
255
- emitEvent('onHostOperation', debugID, type, payload);
256
- },
257
- onSetState: function () {
258
- emitEvent('onSetState');
259
- },
260
- onSetChildren: function (debugID, childDebugIDs) {
261
- checkDebugID(debugID);
262
- childDebugIDs.forEach(checkDebugID);
263
- emitEvent('onSetChildren', debugID, childDebugIDs);
264
- },
265
- onBeforeMountComponent: function (debugID, element, parentDebugID) {
266
- checkDebugID(debugID);
267
- checkDebugID(parentDebugID, true);
268
- emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
269
- },
270
- onMountComponent: function (debugID) {
271
- checkDebugID(debugID);
272
- emitEvent('onMountComponent', debugID);
273
- },
274
- onBeforeUpdateComponent: function (debugID, element) {
275
- checkDebugID(debugID);
276
- emitEvent('onBeforeUpdateComponent', debugID, element);
277
- },
278
- onUpdateComponent: function (debugID) {
279
- checkDebugID(debugID);
280
- emitEvent('onUpdateComponent', debugID);
281
- },
282
- onBeforeUnmountComponent: function (debugID) {
283
- checkDebugID(debugID);
284
- emitEvent('onBeforeUnmountComponent', debugID);
285
- },
286
- onUnmountComponent: function (debugID) {
287
- checkDebugID(debugID);
288
- emitEvent('onUnmountComponent', debugID);
289
- },
290
- onTestEvent: function () {
291
- emitEvent('onTestEvent');
292
- }
293
- };
294
-
295
- // TODO remove these when RN/www gets updated
296
- ReactDebugTool.addDevtool = ReactDebugTool.addHook;
297
- ReactDebugTool.removeDevtool = ReactDebugTool.removeHook;
298
-
299
- ReactDebugTool.addHook(ReactInvalidSetStateWarningHook);
300
- ReactDebugTool.addHook(ReactComponentTreeHook);
301
- ReactDebugTool.addHook(ReactChildrenMutationWarningHook);
302
- var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
303
- if (/[?&]react_perf\b/.test(url)) {
304
- ReactDebugTool.beginProfiling();
305
- }
306
-
307
- module.exports = ReactDebugTool;
@@ -1,68 +0,0 @@
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 ReactDefaultBatchingStrategy
10
- */
11
-
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- var ReactUpdates = require('./ReactUpdates');
17
- var Transaction = require('./Transaction');
18
-
19
- var emptyFunction = require('fbjs/lib/emptyFunction');
20
-
21
- var RESET_BATCHED_UPDATES = {
22
- initialize: emptyFunction,
23
- close: function () {
24
- ReactDefaultBatchingStrategy.isBatchingUpdates = false;
25
- }
26
- };
27
-
28
- var FLUSH_BATCHED_UPDATES = {
29
- initialize: emptyFunction,
30
- close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
31
- };
32
-
33
- var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
34
-
35
- function ReactDefaultBatchingStrategyTransaction() {
36
- this.reinitializeTransaction();
37
- }
38
-
39
- _assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
40
- getTransactionWrappers: function () {
41
- return TRANSACTION_WRAPPERS;
42
- }
43
- });
44
-
45
- var transaction = new ReactDefaultBatchingStrategyTransaction();
46
-
47
- var ReactDefaultBatchingStrategy = {
48
- isBatchingUpdates: false,
49
-
50
- /**
51
- * Call the provided function in a context within which calls to `setState`
52
- * and friends are batched such that components aren't updated unnecessarily.
53
- */
54
- batchedUpdates: function (callback, a, b, c, d, e) {
55
- var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
56
-
57
- ReactDefaultBatchingStrategy.isBatchingUpdates = true;
58
-
59
- // The code is written this way to avoid extra allocations
60
- if (alreadyBatchingUpdates) {
61
- callback(a, b, c, d, e);
62
- } else {
63
- transaction.perform(callback, null, a, b, c, d, e);
64
- }
65
- }
66
- };
67
-
68
- module.exports = ReactDefaultBatchingStrategy;