react 15.3.2-rc.1 → 15.4.0-rc.3

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 (209) hide show
  1. package/dist/react-with-addons.js +3863 -21388
  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/sliceChildren.js +0 -1
  52. package/lib/traverseAllChildren.js +11 -3
  53. package/lib/update.js +6 -8
  54. package/package.json +1 -1
  55. package/lib/AutoFocusUtils.js +0 -24
  56. package/lib/BeforeInputEventPlugin.js +0 -390
  57. package/lib/CSSProperty.js +0 -148
  58. package/lib/CSSPropertyOperations.js +0 -205
  59. package/lib/CallbackQueue.js +0 -106
  60. package/lib/ChangeEventPlugin.js +0 -325
  61. package/lib/DOMChildrenOperations.js +0 -194
  62. package/lib/DOMLazyTree.js +0 -118
  63. package/lib/DOMProperty.js +0 -206
  64. package/lib/DOMPropertyOperations.js +0 -221
  65. package/lib/Danger.js +0 -48
  66. package/lib/DefaultEventPluginOrder.js +0 -27
  67. package/lib/DisabledInputUtils.js +0 -50
  68. package/lib/EnterLeaveEventPlugin.js +0 -105
  69. package/lib/EventConstants.js +0 -97
  70. package/lib/EventPluginHub.js +0 -251
  71. package/lib/EventPluginRegistry.js +0 -247
  72. package/lib/EventPluginUtils.js +0 -229
  73. package/lib/EventPropagators.js +0 -137
  74. package/lib/FallbackCompositionState.js +0 -95
  75. package/lib/HTMLDOMPropertyConfig.js +0 -212
  76. package/lib/LinkedValueUtils.js +0 -136
  77. package/lib/NativeMethodsMixin.js +0 -167
  78. package/lib/ReactBrowserEventEmitter.js +0 -330
  79. package/lib/ReactChildReconciler.js +0 -154
  80. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  81. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  82. package/lib/ReactComponentEnvironment.js +0 -45
  83. package/lib/ReactComponentTreeTestUtils.js +0 -87
  84. package/lib/ReactCompositeComponent.js +0 -904
  85. package/lib/ReactDOM.js +0 -110
  86. package/lib/ReactDOMButton.js +0 -24
  87. package/lib/ReactDOMComponent.js +0 -1006
  88. package/lib/ReactDOMComponentTree.js +0 -188
  89. package/lib/ReactDOMContainerInfo.js +0 -33
  90. package/lib/ReactDOMEmptyComponent.js +0 -60
  91. package/lib/ReactDOMFiber.js +0 -76
  92. package/lib/ReactDOMIDOperations.js +0 -34
  93. package/lib/ReactDOMInput.js +0 -269
  94. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  95. package/lib/ReactDOMOption.js +0 -123
  96. package/lib/ReactDOMSelect.js +0 -201
  97. package/lib/ReactDOMSelection.js +0 -212
  98. package/lib/ReactDOMServer.js +0 -26
  99. package/lib/ReactDOMTextComponent.js +0 -164
  100. package/lib/ReactDOMTextarea.js +0 -155
  101. package/lib/ReactDOMTreeTraversal.js +0 -136
  102. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  103. package/lib/ReactDebugTool.js +0 -301
  104. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  105. package/lib/ReactDefaultInjection.js +0 -84
  106. package/lib/ReactEmptyComponent.js +0 -30
  107. package/lib/ReactErrorUtils.js +0 -76
  108. package/lib/ReactEventEmitterMixin.js +0 -33
  109. package/lib/ReactEventListener.js +0 -157
  110. package/lib/ReactFeatureFlags.js +0 -22
  111. package/lib/ReactHostComponent.js +0 -76
  112. package/lib/ReactHostOperationHistoryHook.js +0 -37
  113. package/lib/ReactInjection.js +0 -36
  114. package/lib/ReactInputSelection.js +0 -124
  115. package/lib/ReactInstanceHandles.js +0 -302
  116. package/lib/ReactInstanceMap.js +0 -48
  117. package/lib/ReactInstrumentation.js +0 -21
  118. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  119. package/lib/ReactMarkupChecksum.js +0 -50
  120. package/lib/ReactMount.js +0 -534
  121. package/lib/ReactMultiChild.js +0 -451
  122. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  123. package/lib/ReactNative.js +0 -71
  124. package/lib/ReactNativeAttributePayload.js +0 -371
  125. package/lib/ReactNativeBaseComponent.js +0 -198
  126. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  127. package/lib/ReactNativeComponentEnvironment.js +0 -31
  128. package/lib/ReactNativeComponentTree.js +0 -68
  129. package/lib/ReactNativeContainerInfo.js +0 -21
  130. package/lib/ReactNativeDOMIDOperations.js +0 -79
  131. package/lib/ReactNativeDefaultInjection.js +0 -101
  132. package/lib/ReactNativeEventEmitter.js +0 -191
  133. package/lib/ReactNativeEventPluginOrder.js +0 -16
  134. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  135. package/lib/ReactNativeMount.js +0 -193
  136. package/lib/ReactNativePropRegistry.js +0 -52
  137. package/lib/ReactNativeReconcileTransaction.js +0 -129
  138. package/lib/ReactNativeTagHandles.js +0 -56
  139. package/lib/ReactNativeTextComponent.js +0 -71
  140. package/lib/ReactNativeTreeTraversal.js +0 -127
  141. package/lib/ReactNodeTypes.js +0 -40
  142. package/lib/ReactNoop.js +0 -173
  143. package/lib/ReactOwner.js +0 -94
  144. package/lib/ReactPerf.js +0 -494
  145. package/lib/ReactReconcileTransaction.js +0 -178
  146. package/lib/ReactReconciler.js +0 -168
  147. package/lib/ReactRef.js +0 -80
  148. package/lib/ReactServerBatchingStrategy.js +0 -22
  149. package/lib/ReactServerRendering.js +0 -90
  150. package/lib/ReactServerRenderingTransaction.js +0 -90
  151. package/lib/ReactServerUpdateQueue.js +0 -141
  152. package/lib/ReactSimpleEmptyComponent.js +0 -37
  153. package/lib/ReactTestMount.js +0 -126
  154. package/lib/ReactTestReconcileTransaction.js +0 -121
  155. package/lib/ReactTestRenderer.js +0 -144
  156. package/lib/ReactTestUtils.js +0 -518
  157. package/lib/ReactUpdateQueue.js +0 -226
  158. package/lib/ReactUpdates.js +0 -251
  159. package/lib/ResponderEventPlugin.js +0 -510
  160. package/lib/ResponderSyntheticEvent.js +0 -39
  161. package/lib/ResponderTouchHistoryStore.js +0 -184
  162. package/lib/SVGDOMPropertyConfig.js +0 -302
  163. package/lib/SelectEventPlugin.js +0 -196
  164. package/lib/SimpleEventPlugin.js +0 -635
  165. package/lib/SyntheticAnimationEvent.js +0 -39
  166. package/lib/SyntheticClipboardEvent.js +0 -38
  167. package/lib/SyntheticCompositionEvent.js +0 -36
  168. package/lib/SyntheticDragEvent.js +0 -36
  169. package/lib/SyntheticEvent.js +0 -268
  170. package/lib/SyntheticFocusEvent.js +0 -36
  171. package/lib/SyntheticInputEvent.js +0 -37
  172. package/lib/SyntheticKeyboardEvent.js +0 -84
  173. package/lib/SyntheticMouseEvent.js +0 -72
  174. package/lib/SyntheticTouchEvent.js +0 -45
  175. package/lib/SyntheticTransitionEvent.js +0 -39
  176. package/lib/SyntheticUIEvent.js +0 -59
  177. package/lib/SyntheticWheelEvent.js +0 -54
  178. package/lib/TapEventPlugin.js +0 -110
  179. package/lib/TouchHistoryMath.js +0 -99
  180. package/lib/Transaction.js +0 -233
  181. package/lib/ViewportMetrics.js +0 -27
  182. package/lib/accumulate.js +0 -46
  183. package/lib/accumulateInto.js +0 -58
  184. package/lib/adler32.js +0 -44
  185. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  186. package/lib/createReactNativeComponentClass.js +0 -42
  187. package/lib/dangerousStyleValue.js +0 -79
  188. package/lib/escapeTextContentForBrowser.js +0 -123
  189. package/lib/findDOMNode.js +0 -60
  190. package/lib/findNodeHandle.js +0 -91
  191. package/lib/forEachAccumulated.js +0 -31
  192. package/lib/getEventCharCode.js +0 -50
  193. package/lib/getEventKey.js +0 -102
  194. package/lib/getEventModifierState.js +0 -43
  195. package/lib/getEventTarget.js +0 -35
  196. package/lib/getHostComponentFromComposite.js +0 -30
  197. package/lib/getNodeForCharacterOffset.js +0 -74
  198. package/lib/getTestDocument.js +0 -21
  199. package/lib/getTextContentAccessor.js +0 -33
  200. package/lib/getVendorPrefixedEventName.js +0 -101
  201. package/lib/instantiateReactComponent.js +0 -119
  202. package/lib/isEventSupported.js +0 -60
  203. package/lib/isTextInputElement.js +0 -51
  204. package/lib/quoteAttributeValueForBrowser.js +0 -26
  205. package/lib/reactComponentExpect.js +0 -217
  206. package/lib/setInnerHTML.js +0 -98
  207. package/lib/setTextContent.js +0 -48
  208. package/lib/shouldUpdateReactComponent.js +0 -42
  209. package/lib/validateDOMNesting.js +0 -382
@@ -1,71 +0,0 @@
1
- /**
2
- * Copyright (c) 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 ReactNativeTextComponent
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant'),
15
- _assign = require('object-assign');
16
-
17
- var ReactNativeComponentTree = require('./ReactNativeComponentTree');
18
- var ReactNativeTagHandles = require('./ReactNativeTagHandles');
19
- var UIManager = require('react-native/lib/UIManager');
20
-
21
- var invariant = require('fbjs/lib/invariant');
22
-
23
- var ReactNativeTextComponent = function (text) {
24
- // This is really a ReactText (ReactNode), not a ReactElement
25
- this._currentElement = text;
26
- this._stringText = '' + text;
27
- this._hostParent = null;
28
- this._rootNodeID = 0;
29
- };
30
-
31
- _assign(ReactNativeTextComponent.prototype, {
32
-
33
- mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
34
- // TODO: hostParent should have this context already. Stop abusing context.
35
- !context.isInAParentText ? process.env.NODE_ENV !== 'production' ? invariant(false, 'RawText "%s" must be wrapped in an explicit <Text> component.', this._stringText) : _prodInvariant('20', this._stringText) : void 0;
36
- this._hostParent = hostParent;
37
- var tag = ReactNativeTagHandles.allocateTag();
38
- this._rootNodeID = tag;
39
- var nativeTopRootTag = hostContainerInfo._tag;
40
- UIManager.createView(tag, 'RCTRawText', nativeTopRootTag, { text: this._stringText });
41
-
42
- ReactNativeComponentTree.precacheNode(this, tag);
43
-
44
- return tag;
45
- },
46
-
47
- getHostNode: function () {
48
- return this._rootNodeID;
49
- },
50
-
51
- receiveComponent: function (nextText, transaction, context) {
52
- if (nextText !== this._currentElement) {
53
- this._currentElement = nextText;
54
- var nextStringText = '' + nextText;
55
- if (nextStringText !== this._stringText) {
56
- this._stringText = nextStringText;
57
- UIManager.updateView(this._rootNodeID, 'RCTRawText', { text: this._stringText });
58
- }
59
- }
60
- },
61
-
62
- unmountComponent: function () {
63
- ReactNativeComponentTree.uncacheNode(this);
64
- this._currentElement = null;
65
- this._stringText = null;
66
- this._rootNodeID = 0;
67
- }
68
-
69
- });
70
-
71
- module.exports = ReactNativeTextComponent;
@@ -1,127 +0,0 @@
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 ReactNativeTreeTraversal
10
- */
11
-
12
- 'use strict';
13
-
14
- // Same as ReactDOMTreeTraversal without the invariants.
15
-
16
- /**
17
- * Return the lowest common ancestor of A and B, or null if they are in
18
- * different trees.
19
- */
20
-
21
- function getLowestCommonAncestor(instA, instB) {
22
- var depthA = 0;
23
- for (var tempA = instA; tempA; tempA = tempA._hostParent) {
24
- depthA++;
25
- }
26
- var depthB = 0;
27
- for (var tempB = instB; tempB; tempB = tempB._hostParent) {
28
- depthB++;
29
- }
30
-
31
- // If A is deeper, crawl up.
32
- while (depthA - depthB > 0) {
33
- instA = instA._hostParent;
34
- depthA--;
35
- }
36
-
37
- // If B is deeper, crawl up.
38
- while (depthB - depthA > 0) {
39
- instB = instB._hostParent;
40
- depthB--;
41
- }
42
-
43
- // Walk in lockstep until we find a match.
44
- var depth = depthA;
45
- while (depth--) {
46
- if (instA === instB) {
47
- return instA;
48
- }
49
- instA = instA._hostParent;
50
- instB = instB._hostParent;
51
- }
52
- return null;
53
- }
54
-
55
- /**
56
- * Return if A is an ancestor of B.
57
- */
58
- function isAncestor(instA, instB) {
59
- while (instB) {
60
- if (instB === instA) {
61
- return true;
62
- }
63
- instB = instB._hostParent;
64
- }
65
- return false;
66
- }
67
-
68
- /**
69
- * Return the parent instance of the passed-in instance.
70
- */
71
- function getParentInstance(inst) {
72
- return inst._hostParent;
73
- }
74
-
75
- /**
76
- * Simulates the traversal of a two-phase, capture/bubble event dispatch.
77
- */
78
- function traverseTwoPhase(inst, fn, arg) {
79
- var path = [];
80
- while (inst) {
81
- path.push(inst);
82
- inst = inst._hostParent;
83
- }
84
- var i;
85
- for (i = path.length; i-- > 0;) {
86
- fn(path[i], false, arg);
87
- }
88
- for (i = 0; i < path.length; i++) {
89
- fn(path[i], true, arg);
90
- }
91
- }
92
-
93
- /**
94
- * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
95
- * should would receive a `mouseEnter` or `mouseLeave` event.
96
- *
97
- * Does not invoke the callback on the nearest common ancestor because nothing
98
- * "entered" or "left" that element.
99
- */
100
- function traverseEnterLeave(from, to, fn, argFrom, argTo) {
101
- var common = from && to ? getLowestCommonAncestor(from, to) : null;
102
- var pathFrom = [];
103
- while (from && from !== common) {
104
- pathFrom.push(from);
105
- from = from._hostParent;
106
- }
107
- var pathTo = [];
108
- while (to && to !== common) {
109
- pathTo.push(to);
110
- to = to._hostParent;
111
- }
112
- var i;
113
- for (i = 0; i < pathFrom.length; i++) {
114
- fn(pathFrom[i], true, argFrom);
115
- }
116
- for (i = pathTo.length; i-- > 0;) {
117
- fn(pathTo[i], false, argTo);
118
- }
119
- }
120
-
121
- module.exports = {
122
- isAncestor: isAncestor,
123
- getLowestCommonAncestor: getLowestCommonAncestor,
124
- getParentInstance: getParentInstance,
125
- traverseTwoPhase: traverseTwoPhase,
126
- traverseEnterLeave: traverseEnterLeave
127
- };
@@ -1,40 +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 ReactNodeTypes
10
- *
11
- */
12
-
13
- 'use strict';
14
-
15
- var _prodInvariant = require('./reactProdInvariant');
16
-
17
- var ReactElement = require('./ReactElement');
18
-
19
- var invariant = require('fbjs/lib/invariant');
20
-
21
- var ReactNodeTypes = {
22
- HOST: 0,
23
- COMPOSITE: 1,
24
- EMPTY: 2,
25
-
26
- getType: function (node) {
27
- if (node === null || node === false) {
28
- return ReactNodeTypes.EMPTY;
29
- } else if (ReactElement.isValidElement(node)) {
30
- if (typeof node.type === 'function') {
31
- return ReactNodeTypes.COMPOSITE;
32
- } else {
33
- return ReactNodeTypes.HOST;
34
- }
35
- }
36
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
37
- }
38
- };
39
-
40
- module.exports = ReactNodeTypes;
package/lib/ReactNoop.js DELETED
@@ -1,173 +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 ReactNoop
10
- *
11
- */
12
-
13
- /**
14
- * This is a renderer of React that doesn't have a render target output.
15
- * It is useful to demonstrate the internals of the reconciler in isolation
16
- * and for testing semantics of reconciliation separate from the host
17
- * environment.
18
- */
19
-
20
- 'use strict';
21
-
22
- var ReactFiberReconciler = require('./ReactFiberReconciler');
23
-
24
- var scheduledHighPriCallback = null;
25
- var scheduledLowPriCallback = null;
26
-
27
- var TERMINAL_TAG = 99;
28
-
29
- var instanceCounter = 0;
30
-
31
- function recursivelyAppendChildren(flatArray, child) {
32
- if (!child) {
33
- return;
34
- }
35
- if (child.tag === TERMINAL_TAG) {
36
- flatArray.push(child);
37
- } else {
38
- var node = child;
39
- do {
40
- recursivelyAppendChildren(flatArray, node.output);
41
- } while (node = node.sibling);
42
- }
43
- }
44
-
45
- function flattenChildren(children) {
46
- var flatArray = [];
47
- recursivelyAppendChildren(flatArray, children);
48
- return flatArray;
49
- }
50
-
51
- var NoopRenderer = ReactFiberReconciler({
52
- updateContainer: function (containerInfo, children) {
53
- console.log('Update container #' + containerInfo.rootID);
54
- containerInfo.children = flattenChildren(children);
55
- },
56
- createInstance: function (type, props, children) {
57
- console.log('Create instance #' + instanceCounter);
58
- var inst = {
59
- tag: TERMINAL_TAG,
60
- id: instanceCounter++,
61
- type: type,
62
- children: flattenChildren(children)
63
- };
64
- // Hide from unit tests
65
- Object.defineProperty(inst, 'tag', { value: inst.tag, enumerable: false });
66
- Object.defineProperty(inst, 'id', { value: inst.id, enumerable: false });
67
- return inst;
68
- },
69
- prepareUpdate: function (instance, oldProps, newProps, children) {
70
- console.log('Prepare for update on #' + instance.id);
71
- return true;
72
- },
73
- commitUpdate: function (instance, oldProps, newProps, children) {
74
- console.log('Commit update on #' + instance.id);
75
- instance.children = flattenChildren(children);
76
- },
77
- deleteInstance: function (instance) {
78
- console.log('Delete #' + instance.id);
79
- },
80
- scheduleHighPriCallback: function (callback) {
81
- scheduledHighPriCallback = callback;
82
- },
83
- scheduleLowPriCallback: function (callback) {
84
- scheduledLowPriCallback = callback;
85
- }
86
- });
87
-
88
- var rootContainer = { rootID: 0, children: [] };
89
-
90
- var root = null;
91
-
92
- var ReactNoop = {
93
-
94
- root: rootContainer,
95
-
96
- render: function (element) {
97
- if (!root) {
98
- root = NoopRenderer.mountContainer(element, rootContainer);
99
- } else {
100
- NoopRenderer.updateContainer(element, root);
101
- }
102
- },
103
- flushHighPri: function () {
104
- var cb = scheduledHighPriCallback;
105
- if (cb === null) {
106
- return;
107
- }
108
- scheduledHighPriCallback = null;
109
- cb();
110
- },
111
- flushLowPri: function () {
112
- var timeout = arguments.length <= 0 || arguments[0] === undefined ? Infinity : arguments[0];
113
-
114
- var cb = scheduledLowPriCallback;
115
- if (cb === null) {
116
- return;
117
- }
118
- scheduledLowPriCallback = null;
119
- var timeRemaining = timeout;
120
- cb({
121
- timeRemaining: function () {
122
- // Simulate a fix amount of time progressing between each call.
123
- timeRemaining -= 5;
124
- if (timeRemaining < 0) {
125
- timeRemaining = 0;
126
- }
127
- return timeRemaining;
128
- }
129
- });
130
- },
131
- flush: function () {
132
- ReactNoop.flushHighPri();
133
- ReactNoop.flushLowPri();
134
- },
135
-
136
-
137
- // Logs the current state of the tree.
138
- dumpTree: function () {
139
- if (!root) {
140
- console.log('Nothing rendered yet.');
141
- return;
142
- }
143
-
144
- function logHostInstances(children, depth) {
145
- for (var i = 0; i < children.length; i++) {
146
- var child = children[i];
147
- console.log(' '.repeat(depth) + '- ' + child.type + '#' + child.id);
148
- logHostInstances(child.children, depth + 1);
149
- }
150
- }
151
- function logContainer(container, depth) {
152
- console.log(' '.repeat(depth) + '- [root#' + container.rootID + ']');
153
- logHostInstances(container.children, depth + 1);
154
- }
155
-
156
- function logFiber(fiber, depth) {
157
- console.log(' '.repeat(depth) + '- ' + (fiber.type ? fiber.type.name || fiber.type : '[root]'), '[' + fiber.pendingWorkPriority + (fiber.pendingProps ? '*' : '') + ']');
158
- if (fiber.child) {
159
- logFiber(fiber.child, depth + 1);
160
- }
161
- if (fiber.sibling) {
162
- logFiber(fiber.sibling, depth);
163
- }
164
- }
165
-
166
- console.log('HOST INSTANCES:');
167
- logContainer(rootContainer, 0);
168
- console.log('FIBERS:');
169
- logFiber(root.stateNode.current, 0);
170
- }
171
- };
172
-
173
- module.exports = ReactNoop;
package/lib/ReactOwner.js DELETED
@@ -1,94 +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 ReactOwner
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var invariant = require('fbjs/lib/invariant');
17
-
18
- /**
19
- * ReactOwners are capable of storing references to owned components.
20
- *
21
- * All components are capable of //being// referenced by owner components, but
22
- * only ReactOwner components are capable of //referencing// owned components.
23
- * The named reference is known as a "ref".
24
- *
25
- * Refs are available when mounted and updated during reconciliation.
26
- *
27
- * var MyComponent = React.createClass({
28
- * render: function() {
29
- * return (
30
- * <div onClick={this.handleClick}>
31
- * <CustomComponent ref="custom" />
32
- * </div>
33
- * );
34
- * },
35
- * handleClick: function() {
36
- * this.refs.custom.handleClick();
37
- * },
38
- * componentDidMount: function() {
39
- * this.refs.custom.initialize();
40
- * }
41
- * });
42
- *
43
- * Refs should rarely be used. When refs are used, they should only be done to
44
- * control data that is not handled by React's data flow.
45
- *
46
- * @class ReactOwner
47
- */
48
- var ReactOwner = {
49
-
50
- /**
51
- * @param {?object} object
52
- * @return {boolean} True if `object` is a valid owner.
53
- * @final
54
- */
55
- isValidOwner: function (object) {
56
- return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
57
- },
58
-
59
- /**
60
- * Adds a component by ref to an owner component.
61
- *
62
- * @param {ReactComponent} component Component to reference.
63
- * @param {string} ref Name by which to refer to the component.
64
- * @param {ReactOwner} owner Component on which to record the ref.
65
- * @final
66
- * @internal
67
- */
68
- addComponentAsRefTo: function (component, ref, owner) {
69
- !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0;
70
- owner.attachRef(ref, component);
71
- },
72
-
73
- /**
74
- * Removes a component by ref from an owner component.
75
- *
76
- * @param {ReactComponent} component Component to dereference.
77
- * @param {string} ref Name of the ref to remove.
78
- * @param {ReactOwner} owner Component on which the ref is recorded.
79
- * @final
80
- * @internal
81
- */
82
- removeComponentAsRefFrom: function (component, ref, owner) {
83
- !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('120') : void 0;
84
- var ownerPublicInstance = owner.getPublicInstance();
85
- // Check that `component`'s owner is still alive and that `component` is still the current ref
86
- // because we do not want to detach the ref if another component stole it.
87
- if (ownerPublicInstance && ownerPublicInstance.refs[ref] === component.getPublicInstance()) {
88
- owner.detachRef(ref);
89
- }
90
- }
91
-
92
- };
93
-
94
- module.exports = ReactOwner;