react 15.3.2 → 15.4.0-rc.4

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 (210) hide show
  1. package/dist/react-with-addons.js +3864 -21390
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2639 -19486
  4. package/dist/react.min.js +2 -6
  5. package/lib/KeyEscapeUtils.js +0 -1
  6. package/lib/LinkedStateMixin.js +1 -3
  7. package/lib/PooledClass.js +3 -1
  8. package/lib/React.js +0 -1
  9. package/lib/ReactAddonsDOMDependencies.js +35 -0
  10. package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
  11. package/lib/ReactCSSTransitionGroup.js +60 -43
  12. package/lib/ReactCSSTransitionGroupChild.js +2 -3
  13. package/lib/ReactChildren.js +0 -1
  14. package/lib/ReactClass.js +38 -54
  15. package/lib/ReactComponent.js +0 -1
  16. package/lib/ReactComponentTreeDevtool.js +0 -1
  17. package/lib/ReactComponentTreeHook.js +84 -101
  18. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
  19. package/lib/ReactComponentWithPureRenderMixin.js +0 -1
  20. package/lib/ReactCurrentOwner.js +1 -2
  21. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
  22. package/lib/ReactDOMFactories.js +0 -1
  23. package/lib/ReactElement.js +6 -14
  24. package/lib/ReactElementSymbol.js +19 -0
  25. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
  26. package/lib/ReactElementValidator.js +1 -3
  27. package/lib/ReactFragment.js +0 -1
  28. package/lib/ReactLink.js +0 -1
  29. package/lib/ReactNoopUpdateQueue.js +0 -1
  30. package/lib/ReactPropTypeLocationNames.js +1 -1
  31. package/lib/ReactPropTypeLocations.js +2 -12
  32. package/lib/ReactPropTypes.js +5 -3
  33. package/lib/ReactPropTypesSecret.js +1 -1
  34. package/lib/ReactPureComponent.js +0 -1
  35. package/lib/ReactStateSetters.js +0 -1
  36. package/lib/ReactTransitionChildMapping.js +0 -1
  37. package/lib/ReactTransitionEvents.js +1 -2
  38. package/lib/ReactTransitionGroup.js +145 -142
  39. package/lib/ReactUMDEntry.js +11 -6
  40. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
  41. package/lib/ReactVersion.js +1 -2
  42. package/lib/ReactWithAddons.js +15 -3
  43. package/lib/ReactWithAddonsUMDEntry.js +11 -6
  44. package/lib/canDefineProperty.js +2 -1
  45. package/lib/checkReactTypeSpec.js +0 -1
  46. package/lib/deprecated.js +0 -1
  47. package/lib/flattenChildren.js +0 -1
  48. package/lib/getIteratorFn.js +0 -1
  49. package/lib/onlyChild.js +0 -1
  50. package/lib/reactProdInvariant.js +0 -1
  51. package/lib/shallowCompare.js +1 -2
  52. package/lib/sliceChildren.js +0 -1
  53. package/lib/traverseAllChildren.js +11 -3
  54. package/lib/update.js +6 -8
  55. package/package.json +1 -1
  56. package/lib/AutoFocusUtils.js +0 -24
  57. package/lib/BeforeInputEventPlugin.js +0 -390
  58. package/lib/CSSProperty.js +0 -148
  59. package/lib/CSSPropertyOperations.js +0 -205
  60. package/lib/CallbackQueue.js +0 -106
  61. package/lib/ChangeEventPlugin.js +0 -325
  62. package/lib/DOMChildrenOperations.js +0 -194
  63. package/lib/DOMLazyTree.js +0 -118
  64. package/lib/DOMProperty.js +0 -206
  65. package/lib/DOMPropertyOperations.js +0 -221
  66. package/lib/Danger.js +0 -48
  67. package/lib/DefaultEventPluginOrder.js +0 -27
  68. package/lib/DisabledInputUtils.js +0 -50
  69. package/lib/EnterLeaveEventPlugin.js +0 -105
  70. package/lib/EventConstants.js +0 -97
  71. package/lib/EventPluginHub.js +0 -251
  72. package/lib/EventPluginRegistry.js +0 -247
  73. package/lib/EventPluginUtils.js +0 -229
  74. package/lib/EventPropagators.js +0 -137
  75. package/lib/FallbackCompositionState.js +0 -95
  76. package/lib/HTMLDOMPropertyConfig.js +0 -212
  77. package/lib/LinkedValueUtils.js +0 -136
  78. package/lib/NativeMethodsMixin.js +0 -167
  79. package/lib/ReactBrowserEventEmitter.js +0 -330
  80. package/lib/ReactChildReconciler.js +0 -154
  81. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  82. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  83. package/lib/ReactComponentEnvironment.js +0 -45
  84. package/lib/ReactComponentTreeTestUtils.js +0 -87
  85. package/lib/ReactCompositeComponent.js +0 -904
  86. package/lib/ReactDOM.js +0 -110
  87. package/lib/ReactDOMButton.js +0 -24
  88. package/lib/ReactDOMComponent.js +0 -1006
  89. package/lib/ReactDOMComponentTree.js +0 -188
  90. package/lib/ReactDOMContainerInfo.js +0 -33
  91. package/lib/ReactDOMEmptyComponent.js +0 -60
  92. package/lib/ReactDOMFiber.js +0 -76
  93. package/lib/ReactDOMIDOperations.js +0 -34
  94. package/lib/ReactDOMInput.js +0 -269
  95. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  96. package/lib/ReactDOMOption.js +0 -123
  97. package/lib/ReactDOMSelect.js +0 -201
  98. package/lib/ReactDOMSelection.js +0 -212
  99. package/lib/ReactDOMServer.js +0 -26
  100. package/lib/ReactDOMTextComponent.js +0 -164
  101. package/lib/ReactDOMTextarea.js +0 -155
  102. package/lib/ReactDOMTreeTraversal.js +0 -136
  103. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  104. package/lib/ReactDebugTool.js +0 -301
  105. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  106. package/lib/ReactDefaultInjection.js +0 -84
  107. package/lib/ReactEmptyComponent.js +0 -30
  108. package/lib/ReactErrorUtils.js +0 -76
  109. package/lib/ReactEventEmitterMixin.js +0 -33
  110. package/lib/ReactEventListener.js +0 -157
  111. package/lib/ReactFeatureFlags.js +0 -22
  112. package/lib/ReactHostComponent.js +0 -76
  113. package/lib/ReactHostOperationHistoryHook.js +0 -37
  114. package/lib/ReactInjection.js +0 -36
  115. package/lib/ReactInputSelection.js +0 -124
  116. package/lib/ReactInstanceHandles.js +0 -302
  117. package/lib/ReactInstanceMap.js +0 -48
  118. package/lib/ReactInstrumentation.js +0 -21
  119. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  120. package/lib/ReactMarkupChecksum.js +0 -50
  121. package/lib/ReactMount.js +0 -534
  122. package/lib/ReactMultiChild.js +0 -451
  123. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  124. package/lib/ReactNative.js +0 -71
  125. package/lib/ReactNativeAttributePayload.js +0 -371
  126. package/lib/ReactNativeBaseComponent.js +0 -198
  127. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  128. package/lib/ReactNativeComponentEnvironment.js +0 -31
  129. package/lib/ReactNativeComponentTree.js +0 -68
  130. package/lib/ReactNativeContainerInfo.js +0 -21
  131. package/lib/ReactNativeDOMIDOperations.js +0 -79
  132. package/lib/ReactNativeDefaultInjection.js +0 -101
  133. package/lib/ReactNativeEventEmitter.js +0 -191
  134. package/lib/ReactNativeEventPluginOrder.js +0 -16
  135. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  136. package/lib/ReactNativeMount.js +0 -193
  137. package/lib/ReactNativePropRegistry.js +0 -52
  138. package/lib/ReactNativeReconcileTransaction.js +0 -129
  139. package/lib/ReactNativeTagHandles.js +0 -56
  140. package/lib/ReactNativeTextComponent.js +0 -71
  141. package/lib/ReactNativeTreeTraversal.js +0 -127
  142. package/lib/ReactNodeTypes.js +0 -40
  143. package/lib/ReactNoop.js +0 -173
  144. package/lib/ReactOwner.js +0 -94
  145. package/lib/ReactPerf.js +0 -494
  146. package/lib/ReactReconcileTransaction.js +0 -178
  147. package/lib/ReactReconciler.js +0 -168
  148. package/lib/ReactRef.js +0 -80
  149. package/lib/ReactServerBatchingStrategy.js +0 -22
  150. package/lib/ReactServerRendering.js +0 -90
  151. package/lib/ReactServerRenderingTransaction.js +0 -90
  152. package/lib/ReactServerUpdateQueue.js +0 -141
  153. package/lib/ReactSimpleEmptyComponent.js +0 -37
  154. package/lib/ReactTestMount.js +0 -126
  155. package/lib/ReactTestReconcileTransaction.js +0 -121
  156. package/lib/ReactTestRenderer.js +0 -144
  157. package/lib/ReactTestUtils.js +0 -518
  158. package/lib/ReactUpdateQueue.js +0 -226
  159. package/lib/ReactUpdates.js +0 -251
  160. package/lib/ResponderEventPlugin.js +0 -510
  161. package/lib/ResponderSyntheticEvent.js +0 -39
  162. package/lib/ResponderTouchHistoryStore.js +0 -184
  163. package/lib/SVGDOMPropertyConfig.js +0 -302
  164. package/lib/SelectEventPlugin.js +0 -196
  165. package/lib/SimpleEventPlugin.js +0 -635
  166. package/lib/SyntheticAnimationEvent.js +0 -39
  167. package/lib/SyntheticClipboardEvent.js +0 -38
  168. package/lib/SyntheticCompositionEvent.js +0 -36
  169. package/lib/SyntheticDragEvent.js +0 -36
  170. package/lib/SyntheticEvent.js +0 -268
  171. package/lib/SyntheticFocusEvent.js +0 -36
  172. package/lib/SyntheticInputEvent.js +0 -37
  173. package/lib/SyntheticKeyboardEvent.js +0 -84
  174. package/lib/SyntheticMouseEvent.js +0 -72
  175. package/lib/SyntheticTouchEvent.js +0 -45
  176. package/lib/SyntheticTransitionEvent.js +0 -39
  177. package/lib/SyntheticUIEvent.js +0 -59
  178. package/lib/SyntheticWheelEvent.js +0 -54
  179. package/lib/TapEventPlugin.js +0 -110
  180. package/lib/TouchHistoryMath.js +0 -99
  181. package/lib/Transaction.js +0 -233
  182. package/lib/ViewportMetrics.js +0 -27
  183. package/lib/accumulate.js +0 -46
  184. package/lib/accumulateInto.js +0 -58
  185. package/lib/adler32.js +0 -44
  186. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  187. package/lib/createReactNativeComponentClass.js +0 -42
  188. package/lib/dangerousStyleValue.js +0 -79
  189. package/lib/escapeTextContentForBrowser.js +0 -123
  190. package/lib/findDOMNode.js +0 -60
  191. package/lib/findNodeHandle.js +0 -91
  192. package/lib/forEachAccumulated.js +0 -31
  193. package/lib/getEventCharCode.js +0 -50
  194. package/lib/getEventKey.js +0 -102
  195. package/lib/getEventModifierState.js +0 -43
  196. package/lib/getEventTarget.js +0 -35
  197. package/lib/getHostComponentFromComposite.js +0 -30
  198. package/lib/getNodeForCharacterOffset.js +0 -74
  199. package/lib/getTestDocument.js +0 -21
  200. package/lib/getTextContentAccessor.js +0 -33
  201. package/lib/getVendorPrefixedEventName.js +0 -101
  202. package/lib/instantiateReactComponent.js +0 -119
  203. package/lib/isEventSupported.js +0 -60
  204. package/lib/isTextInputElement.js +0 -51
  205. package/lib/quoteAttributeValueForBrowser.js +0 -26
  206. package/lib/reactComponentExpect.js +0 -217
  207. package/lib/setInnerHTML.js +0 -98
  208. package/lib/setTextContent.js +0 -48
  209. package/lib/shouldUpdateReactComponent.js +0 -42
  210. package/lib/validateDOMNesting.js +0 -382
@@ -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,301 +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
- onBeginProcessingChildContext: function () {
242
- emitEvent('onBeginProcessingChildContext');
243
- },
244
- onEndProcessingChildContext: function () {
245
- emitEvent('onEndProcessingChildContext');
246
- },
247
- onHostOperation: function (debugID, type, payload) {
248
- checkDebugID(debugID);
249
- emitEvent('onHostOperation', debugID, type, payload);
250
- },
251
- onSetState: function () {
252
- emitEvent('onSetState');
253
- },
254
- onSetChildren: function (debugID, childDebugIDs) {
255
- checkDebugID(debugID);
256
- childDebugIDs.forEach(checkDebugID);
257
- emitEvent('onSetChildren', debugID, childDebugIDs);
258
- },
259
- onBeforeMountComponent: function (debugID, element, parentDebugID) {
260
- checkDebugID(debugID);
261
- checkDebugID(parentDebugID, true);
262
- emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
263
- },
264
- onMountComponent: function (debugID) {
265
- checkDebugID(debugID);
266
- emitEvent('onMountComponent', debugID);
267
- },
268
- onBeforeUpdateComponent: function (debugID, element) {
269
- checkDebugID(debugID);
270
- emitEvent('onBeforeUpdateComponent', debugID, element);
271
- },
272
- onUpdateComponent: function (debugID) {
273
- checkDebugID(debugID);
274
- emitEvent('onUpdateComponent', debugID);
275
- },
276
- onBeforeUnmountComponent: function (debugID) {
277
- checkDebugID(debugID);
278
- emitEvent('onBeforeUnmountComponent', debugID);
279
- },
280
- onUnmountComponent: function (debugID) {
281
- checkDebugID(debugID);
282
- emitEvent('onUnmountComponent', debugID);
283
- },
284
- onTestEvent: function () {
285
- emitEvent('onTestEvent');
286
- }
287
- };
288
-
289
- // TODO remove these when RN/www gets updated
290
- ReactDebugTool.addDevtool = ReactDebugTool.addHook;
291
- ReactDebugTool.removeDevtool = ReactDebugTool.removeHook;
292
-
293
- ReactDebugTool.addHook(ReactInvalidSetStateWarningHook);
294
- ReactDebugTool.addHook(ReactComponentTreeHook);
295
- ReactDebugTool.addHook(ReactChildrenMutationWarningHook);
296
- var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
297
- if (/[?&]react_perf\b/.test(url)) {
298
- ReactDebugTool.beginProfiling();
299
- }
300
-
301
- 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;