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,90 +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 ReactServerRendering
10
- */
11
- 'use strict';
12
-
13
- var _prodInvariant = require('./reactProdInvariant');
14
-
15
- var ReactDOMContainerInfo = require('./ReactDOMContainerInfo');
16
- var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
17
- var ReactElement = require('./ReactElement');
18
- var ReactInstrumentation = require('./ReactInstrumentation');
19
- var ReactMarkupChecksum = require('./ReactMarkupChecksum');
20
- var ReactReconciler = require('./ReactReconciler');
21
- var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
22
- var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
23
- var ReactUpdates = require('./ReactUpdates');
24
-
25
- var emptyObject = require('fbjs/lib/emptyObject');
26
- var instantiateReactComponent = require('./instantiateReactComponent');
27
- var invariant = require('fbjs/lib/invariant');
28
-
29
- var pendingTransactions = 0;
30
-
31
- /**
32
- * @param {ReactElement} element
33
- * @return {string} the HTML markup
34
- */
35
- function renderToStringImpl(element, makeStaticMarkup) {
36
- var transaction;
37
- try {
38
- ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
39
-
40
- transaction = ReactServerRenderingTransaction.getPooled(makeStaticMarkup);
41
-
42
- pendingTransactions++;
43
-
44
- return transaction.perform(function () {
45
- var componentInstance = instantiateReactComponent(element, true);
46
- var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactDOMContainerInfo(), emptyObject, 0 /* parentDebugID */
47
- );
48
- if (process.env.NODE_ENV !== 'production') {
49
- ReactInstrumentation.debugTool.onUnmountComponent(componentInstance._debugID);
50
- }
51
- if (!makeStaticMarkup) {
52
- markup = ReactMarkupChecksum.addChecksumToMarkup(markup);
53
- }
54
- return markup;
55
- }, null);
56
- } finally {
57
- pendingTransactions--;
58
- ReactServerRenderingTransaction.release(transaction);
59
- // Revert to the DOM batching strategy since these two renderers
60
- // currently share these stateful modules.
61
- if (!pendingTransactions) {
62
- ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
63
- }
64
- }
65
- }
66
-
67
- /**
68
- * Render a ReactElement to its initial HTML. This should only be used on the
69
- * server.
70
- * See https://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostring
71
- */
72
- function renderToString(element) {
73
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : _prodInvariant('46') : void 0;
74
- return renderToStringImpl(element, false);
75
- }
76
-
77
- /**
78
- * Similar to renderToString, except this doesn't create extra DOM attributes
79
- * such as data-react-id that React uses internally.
80
- * See https://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostaticmarkup
81
- */
82
- function renderToStaticMarkup(element) {
83
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : _prodInvariant('47') : void 0;
84
- return renderToStringImpl(element, true);
85
- }
86
-
87
- module.exports = {
88
- renderToString: renderToString,
89
- renderToStaticMarkup: renderToStaticMarkup
90
- };
@@ -1,90 +0,0 @@
1
- /**
2
- * Copyright 2014-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 ReactServerRenderingTransaction
10
- */
11
-
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- var PooledClass = require('./PooledClass');
17
- var Transaction = require('./Transaction');
18
- var ReactInstrumentation = require('./ReactInstrumentation');
19
- var ReactServerUpdateQueue = require('./ReactServerUpdateQueue');
20
-
21
- /**
22
- * Executed within the scope of the `Transaction` instance. Consider these as
23
- * being member methods, but with an implied ordering while being isolated from
24
- * each other.
25
- */
26
- var TRANSACTION_WRAPPERS = [];
27
-
28
- if (process.env.NODE_ENV !== 'production') {
29
- TRANSACTION_WRAPPERS.push({
30
- initialize: ReactInstrumentation.debugTool.onBeginFlush,
31
- close: ReactInstrumentation.debugTool.onEndFlush
32
- });
33
- }
34
-
35
- var noopCallbackQueue = {
36
- enqueue: function () {}
37
- };
38
-
39
- /**
40
- * @class ReactServerRenderingTransaction
41
- * @param {boolean} renderToStaticMarkup
42
- */
43
- function ReactServerRenderingTransaction(renderToStaticMarkup) {
44
- this.reinitializeTransaction();
45
- this.renderToStaticMarkup = renderToStaticMarkup;
46
- this.useCreateElement = false;
47
- this.updateQueue = new ReactServerUpdateQueue(this);
48
- }
49
-
50
- var Mixin = {
51
- /**
52
- * @see Transaction
53
- * @abstract
54
- * @final
55
- * @return {array} Empty list of operation wrap procedures.
56
- */
57
- getTransactionWrappers: function () {
58
- return TRANSACTION_WRAPPERS;
59
- },
60
-
61
- /**
62
- * @return {object} The queue to collect `onDOMReady` callbacks with.
63
- */
64
- getReactMountReady: function () {
65
- return noopCallbackQueue;
66
- },
67
-
68
- /**
69
- * @return {object} The queue to collect React async events.
70
- */
71
- getUpdateQueue: function () {
72
- return this.updateQueue;
73
- },
74
-
75
- /**
76
- * `PooledClass` looks for this, and will invoke this before allowing this
77
- * instance to be reused.
78
- */
79
- destructor: function () {},
80
-
81
- checkpoint: function () {},
82
-
83
- rollback: function () {}
84
- };
85
-
86
- _assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
87
-
88
- PooledClass.addPoolingTo(ReactServerRenderingTransaction);
89
-
90
- module.exports = ReactServerRenderingTransaction;
@@ -1,141 +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 ReactServerUpdateQueue
10
- *
11
- */
12
-
13
- 'use strict';
14
-
15
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
-
17
- var ReactUpdateQueue = require('./ReactUpdateQueue');
18
- var Transaction = require('./Transaction');
19
- var warning = require('fbjs/lib/warning');
20
-
21
- function warnNoop(publicInstance, callerName) {
22
- if (process.env.NODE_ENV !== 'production') {
23
- var constructor = publicInstance.constructor;
24
- process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
25
- }
26
- }
27
-
28
- /**
29
- * This is the update queue used for server rendering.
30
- * It delegates to ReactUpdateQueue while server rendering is in progress and
31
- * switches to ReactNoopUpdateQueue after the transaction has completed.
32
- * @class ReactServerUpdateQueue
33
- * @param {Transaction} transaction
34
- */
35
-
36
- var ReactServerUpdateQueue = function () {
37
- /* :: transaction: Transaction; */
38
-
39
- function ReactServerUpdateQueue(transaction) {
40
- _classCallCheck(this, ReactServerUpdateQueue);
41
-
42
- this.transaction = transaction;
43
- }
44
-
45
- /**
46
- * Checks whether or not this composite component is mounted.
47
- * @param {ReactClass} publicInstance The instance we want to test.
48
- * @return {boolean} True if mounted, false otherwise.
49
- * @protected
50
- * @final
51
- */
52
-
53
-
54
- ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) {
55
- return false;
56
- };
57
-
58
- /**
59
- * Enqueue a callback that will be executed after all the pending updates
60
- * have processed.
61
- *
62
- * @param {ReactClass} publicInstance The instance to use as `this` context.
63
- * @param {?function} callback Called after state is updated.
64
- * @internal
65
- */
66
-
67
-
68
- ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) {
69
- if (this.transaction.isInTransaction()) {
70
- ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName);
71
- }
72
- };
73
-
74
- /**
75
- * Forces an update. This should only be invoked when it is known with
76
- * certainty that we are **not** in a DOM transaction.
77
- *
78
- * You may want to call this when you know that some deeper aspect of the
79
- * component's state has changed but `setState` was not called.
80
- *
81
- * This will not invoke `shouldComponentUpdate`, but it will invoke
82
- * `componentWillUpdate` and `componentDidUpdate`.
83
- *
84
- * @param {ReactClass} publicInstance The instance that should rerender.
85
- * @internal
86
- */
87
-
88
-
89
- ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) {
90
- if (this.transaction.isInTransaction()) {
91
- ReactUpdateQueue.enqueueForceUpdate(publicInstance);
92
- } else {
93
- warnNoop(publicInstance, 'forceUpdate');
94
- }
95
- };
96
-
97
- /**
98
- * Replaces all of the state. Always use this or `setState` to mutate state.
99
- * You should treat `this.state` as immutable.
100
- *
101
- * There is no guarantee that `this.state` will be immediately updated, so
102
- * accessing `this.state` after calling this method may return the old value.
103
- *
104
- * @param {ReactClass} publicInstance The instance that should rerender.
105
- * @param {object|function} completeState Next state.
106
- * @internal
107
- */
108
-
109
-
110
- ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) {
111
- if (this.transaction.isInTransaction()) {
112
- ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState);
113
- } else {
114
- warnNoop(publicInstance, 'replaceState');
115
- }
116
- };
117
-
118
- /**
119
- * Sets a subset of the state. This only exists because _pendingState is
120
- * internal. This provides a merging strategy that is not available to deep
121
- * properties which is confusing. TODO: Expose pendingState or don't use it
122
- * during the merge.
123
- *
124
- * @param {ReactClass} publicInstance The instance that should rerender.
125
- * @param {object|function} partialState Next partial state to be merged with state.
126
- * @internal
127
- */
128
-
129
-
130
- ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) {
131
- if (this.transaction.isInTransaction()) {
132
- ReactUpdateQueue.enqueueSetState(publicInstance, partialState);
133
- } else {
134
- warnNoop(publicInstance, 'setState');
135
- }
136
- };
137
-
138
- return ReactServerUpdateQueue;
139
- }();
140
-
141
- module.exports = ReactServerUpdateQueue;
@@ -1,37 +0,0 @@
1
- /**
2
- * Copyright 2014-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 ReactSimpleEmptyComponent
10
- */
11
-
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- var ReactReconciler = require('./ReactReconciler');
17
-
18
- var ReactSimpleEmptyComponent = function (placeholderElement, instantiate) {
19
- this._currentElement = null;
20
- this._renderedComponent = instantiate(placeholderElement);
21
- };
22
- _assign(ReactSimpleEmptyComponent.prototype, {
23
- mountComponent: function (transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
24
- ) {
25
- return ReactReconciler.mountComponent(this._renderedComponent, transaction, hostParent, hostContainerInfo, context, parentDebugID);
26
- },
27
- receiveComponent: function () {},
28
- getHostNode: function () {
29
- return ReactReconciler.getHostNode(this._renderedComponent);
30
- },
31
- unmountComponent: function () {
32
- ReactReconciler.unmountComponent(this._renderedComponent);
33
- this._renderedComponent = null;
34
- }
35
- });
36
-
37
- module.exports = ReactSimpleEmptyComponent;
@@ -1,123 +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 ReactTestMount
10
- *
11
- */
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var ReactElement = require('./ReactElement');
17
- var ReactReconciler = require('./ReactReconciler');
18
- var ReactUpdates = require('./ReactUpdates');
19
-
20
- var emptyObject = require('fbjs/lib/emptyObject');
21
- var getHostComponentFromComposite = require('./getHostComponentFromComposite');
22
- var instantiateReactComponent = require('./instantiateReactComponent');
23
- var invariant = require('fbjs/lib/invariant');
24
-
25
- /**
26
- * Temporary (?) hack so that we can store all top-level pending updates on
27
- * composites instead of having to worry about different types of components
28
- * here.
29
- */
30
- var TopLevelWrapper = function () {};
31
- TopLevelWrapper.prototype.isReactComponent = {};
32
- if (process.env.NODE_ENV !== 'production') {
33
- TopLevelWrapper.displayName = 'TopLevelWrapper';
34
- }
35
- TopLevelWrapper.prototype.render = function () {
36
- // this.props is actually a ReactElement
37
- return this.props;
38
- };
39
-
40
- /**
41
- * Mounts this component and inserts it into the DOM.
42
- *
43
- * @param {ReactComponent} componentInstance The instance to mount.
44
- * @param {number} rootID ID of the root node.
45
- * @param {number} containerTag container element to mount into.
46
- * @param {ReactReconcileTransaction} transaction
47
- */
48
- function mountComponentIntoNode(componentInstance, transaction) {
49
- var image = ReactReconciler.mountComponent(componentInstance, transaction, null, null, emptyObject);
50
- componentInstance._renderedComponent._topLevelWrapper = componentInstance;
51
- return image;
52
- }
53
-
54
- /**
55
- * Batched mount.
56
- *
57
- * @param {ReactComponent} componentInstance The instance to mount.
58
- * @param {number} rootID ID of the root node.
59
- * @param {number} containerTag container element to mount into.
60
- */
61
- function batchedMountComponentIntoNode(componentInstance) {
62
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
63
- var image = transaction.perform(mountComponentIntoNode, null, componentInstance, transaction);
64
- ReactUpdates.ReactReconcileTransaction.release(transaction);
65
- return image;
66
- }
67
-
68
- var ReactTestInstance = function (component) {
69
- this._component = component;
70
- };
71
- ReactTestInstance.prototype.getInstance = function () {
72
- return this._component._renderedComponent.getPublicInstance();
73
- };
74
- ReactTestInstance.prototype.update = function (nextElement) {
75
- !this._component ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactTestRenderer: .update() can\'t be called after unmount.') : _prodInvariant('139') : void 0;
76
- var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
77
- var component = this._component;
78
- ReactUpdates.batchedUpdates(function () {
79
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true);
80
- transaction.perform(function () {
81
- ReactReconciler.receiveComponent(component, nextWrappedElement, transaction, emptyObject);
82
- });
83
- ReactUpdates.ReactReconcileTransaction.release(transaction);
84
- });
85
- };
86
- ReactTestInstance.prototype.unmount = function (nextElement) {
87
- var component = this._component;
88
- ReactUpdates.batchedUpdates(function () {
89
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true);
90
- transaction.perform(function () {
91
- ReactReconciler.unmountComponent(component, false);
92
- });
93
- ReactUpdates.ReactReconcileTransaction.release(transaction);
94
- });
95
- this._component = null;
96
- };
97
- ReactTestInstance.prototype.toJSON = function () {
98
- var inst = getHostComponentFromComposite(this._component);
99
- return inst.toJSON();
100
- };
101
-
102
- /**
103
- * As soon as `ReactMount` is refactored to not rely on the DOM, we can share
104
- * code between the two. For now, we'll hard code the ID logic.
105
- */
106
- var ReactTestMount = {
107
-
108
- render: function (nextElement) {
109
- var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
110
-
111
- var instance = instantiateReactComponent(nextWrappedElement, false);
112
-
113
- // The initial render is synchronous but any updates that happen during
114
- // rendering, in componentWillMount or componentDidMount, will be batched
115
- // according to the current batching strategy.
116
-
117
- ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, instance);
118
- return new ReactTestInstance(instance);
119
- }
120
-
121
- };
122
-
123
- module.exports = ReactTestMount;