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,451 +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 ReactMultiChild
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var ReactComponentEnvironment = require('./ReactComponentEnvironment');
17
- var ReactInstanceMap = require('./ReactInstanceMap');
18
- var ReactInstrumentation = require('./ReactInstrumentation');
19
- var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
20
-
21
- var ReactCurrentOwner = require('./ReactCurrentOwner');
22
- var ReactReconciler = require('./ReactReconciler');
23
- var ReactChildReconciler = require('./ReactChildReconciler');
24
-
25
- var emptyFunction = require('fbjs/lib/emptyFunction');
26
- var flattenChildren = require('./flattenChildren');
27
- var invariant = require('fbjs/lib/invariant');
28
-
29
- /**
30
- * Make an update for markup to be rendered and inserted at a supplied index.
31
- *
32
- * @param {string} markup Markup that renders into an element.
33
- * @param {number} toIndex Destination index.
34
- * @private
35
- */
36
- function makeInsertMarkup(markup, afterNode, toIndex) {
37
- // NOTE: Null values reduce hidden classes.
38
- return {
39
- type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
40
- content: markup,
41
- fromIndex: null,
42
- fromNode: null,
43
- toIndex: toIndex,
44
- afterNode: afterNode
45
- };
46
- }
47
-
48
- /**
49
- * Make an update for moving an existing element to another index.
50
- *
51
- * @param {number} fromIndex Source index of the existing element.
52
- * @param {number} toIndex Destination index of the element.
53
- * @private
54
- */
55
- function makeMove(child, afterNode, toIndex) {
56
- // NOTE: Null values reduce hidden classes.
57
- return {
58
- type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
59
- content: null,
60
- fromIndex: child._mountIndex,
61
- fromNode: ReactReconciler.getHostNode(child),
62
- toIndex: toIndex,
63
- afterNode: afterNode
64
- };
65
- }
66
-
67
- /**
68
- * Make an update for removing an element at an index.
69
- *
70
- * @param {number} fromIndex Index of the element to remove.
71
- * @private
72
- */
73
- function makeRemove(child, node) {
74
- // NOTE: Null values reduce hidden classes.
75
- return {
76
- type: ReactMultiChildUpdateTypes.REMOVE_NODE,
77
- content: null,
78
- fromIndex: child._mountIndex,
79
- fromNode: node,
80
- toIndex: null,
81
- afterNode: null
82
- };
83
- }
84
-
85
- /**
86
- * Make an update for setting the markup of a node.
87
- *
88
- * @param {string} markup Markup that renders into an element.
89
- * @private
90
- */
91
- function makeSetMarkup(markup) {
92
- // NOTE: Null values reduce hidden classes.
93
- return {
94
- type: ReactMultiChildUpdateTypes.SET_MARKUP,
95
- content: markup,
96
- fromIndex: null,
97
- fromNode: null,
98
- toIndex: null,
99
- afterNode: null
100
- };
101
- }
102
-
103
- /**
104
- * Make an update for setting the text content.
105
- *
106
- * @param {string} textContent Text content to set.
107
- * @private
108
- */
109
- function makeTextContent(textContent) {
110
- // NOTE: Null values reduce hidden classes.
111
- return {
112
- type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
113
- content: textContent,
114
- fromIndex: null,
115
- fromNode: null,
116
- toIndex: null,
117
- afterNode: null
118
- };
119
- }
120
-
121
- /**
122
- * Push an update, if any, onto the queue. Creates a new queue if none is
123
- * passed and always returns the queue. Mutative.
124
- */
125
- function enqueue(queue, update) {
126
- if (update) {
127
- queue = queue || [];
128
- queue.push(update);
129
- }
130
- return queue;
131
- }
132
-
133
- /**
134
- * Processes any enqueued updates.
135
- *
136
- * @private
137
- */
138
- function processQueue(inst, updateQueue) {
139
- ReactComponentEnvironment.processChildrenUpdates(inst, updateQueue);
140
- }
141
-
142
- var setChildrenForInstrumentation = emptyFunction;
143
- if (process.env.NODE_ENV !== 'production') {
144
- var getDebugID = function (inst) {
145
- if (!inst._debugID) {
146
- // Check for ART-like instances. TODO: This is silly/gross.
147
- var internal;
148
- if (internal = ReactInstanceMap.get(inst)) {
149
- inst = internal;
150
- }
151
- }
152
- return inst._debugID;
153
- };
154
- setChildrenForInstrumentation = function (children) {
155
- var debugID = getDebugID(this);
156
- // TODO: React Native empty components are also multichild.
157
- // This means they still get into this method but don't have _debugID.
158
- if (debugID !== 0) {
159
- ReactInstrumentation.debugTool.onSetChildren(debugID, children ? Object.keys(children).map(function (key) {
160
- return children[key]._debugID;
161
- }) : []);
162
- }
163
- };
164
- }
165
-
166
- /**
167
- * ReactMultiChild are capable of reconciling multiple children.
168
- *
169
- * @class ReactMultiChild
170
- * @internal
171
- */
172
- var ReactMultiChild = {
173
-
174
- /**
175
- * Provides common functionality for components that must reconcile multiple
176
- * children. This is used by `ReactDOMComponent` to mount, update, and
177
- * unmount child components.
178
- *
179
- * @lends {ReactMultiChild.prototype}
180
- */
181
- Mixin: {
182
-
183
- _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
184
- if (process.env.NODE_ENV !== 'production') {
185
- var selfDebugID = getDebugID(this);
186
- if (this._currentElement) {
187
- try {
188
- ReactCurrentOwner.current = this._currentElement._owner;
189
- return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context, selfDebugID);
190
- } finally {
191
- ReactCurrentOwner.current = null;
192
- }
193
- }
194
- }
195
- return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
196
- },
197
-
198
- _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context) {
199
- var nextChildren;
200
- var selfDebugID = 0;
201
- if (process.env.NODE_ENV !== 'production') {
202
- selfDebugID = getDebugID(this);
203
- if (this._currentElement) {
204
- try {
205
- ReactCurrentOwner.current = this._currentElement._owner;
206
- nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
207
- } finally {
208
- ReactCurrentOwner.current = null;
209
- }
210
- ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
211
- return nextChildren;
212
- }
213
- }
214
- nextChildren = flattenChildren(nextNestedChildrenElements, selfDebugID);
215
- ReactChildReconciler.updateChildren(prevChildren, nextChildren, mountImages, removedNodes, transaction, this, this._hostContainerInfo, context, selfDebugID);
216
- return nextChildren;
217
- },
218
-
219
- /**
220
- * Generates a "mount image" for each of the supplied children. In the case
221
- * of `ReactDOMComponent`, a mount image is a string of markup.
222
- *
223
- * @param {?object} nestedChildren Nested child maps.
224
- * @return {array} An array of mounted representations.
225
- * @internal
226
- */
227
- mountChildren: function (nestedChildren, transaction, context) {
228
- var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
229
- this._renderedChildren = children;
230
-
231
- var mountImages = [];
232
- var index = 0;
233
- for (var name in children) {
234
- if (children.hasOwnProperty(name)) {
235
- var child = children[name];
236
- var selfDebugID = 0;
237
- if (process.env.NODE_ENV !== 'production') {
238
- selfDebugID = getDebugID(this);
239
- }
240
- var mountImage = ReactReconciler.mountComponent(child, transaction, this, this._hostContainerInfo, context, selfDebugID);
241
- child._mountIndex = index++;
242
- mountImages.push(mountImage);
243
- }
244
- }
245
-
246
- if (process.env.NODE_ENV !== 'production') {
247
- setChildrenForInstrumentation.call(this, children);
248
- }
249
-
250
- return mountImages;
251
- },
252
-
253
- /**
254
- * Replaces any rendered children with a text content string.
255
- *
256
- * @param {string} nextContent String of content.
257
- * @internal
258
- */
259
- updateTextContent: function (nextContent) {
260
- var prevChildren = this._renderedChildren;
261
- // Remove any rendered children.
262
- ReactChildReconciler.unmountChildren(prevChildren, false);
263
- for (var name in prevChildren) {
264
- if (prevChildren.hasOwnProperty(name)) {
265
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
266
- }
267
- }
268
- // Set new text content.
269
- var updates = [makeTextContent(nextContent)];
270
- processQueue(this, updates);
271
- },
272
-
273
- /**
274
- * Replaces any rendered children with a markup string.
275
- *
276
- * @param {string} nextMarkup String of markup.
277
- * @internal
278
- */
279
- updateMarkup: function (nextMarkup) {
280
- var prevChildren = this._renderedChildren;
281
- // Remove any rendered children.
282
- ReactChildReconciler.unmountChildren(prevChildren, false);
283
- for (var name in prevChildren) {
284
- if (prevChildren.hasOwnProperty(name)) {
285
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updateTextContent called on non-empty component.') : _prodInvariant('118') : void 0;
286
- }
287
- }
288
- var updates = [makeSetMarkup(nextMarkup)];
289
- processQueue(this, updates);
290
- },
291
-
292
- /**
293
- * Updates the rendered children with new children.
294
- *
295
- * @param {?object} nextNestedChildrenElements Nested child element maps.
296
- * @param {ReactReconcileTransaction} transaction
297
- * @internal
298
- */
299
- updateChildren: function (nextNestedChildrenElements, transaction, context) {
300
- // Hook used by React ART
301
- this._updateChildren(nextNestedChildrenElements, transaction, context);
302
- },
303
-
304
- /**
305
- * @param {?object} nextNestedChildrenElements Nested child element maps.
306
- * @param {ReactReconcileTransaction} transaction
307
- * @final
308
- * @protected
309
- */
310
- _updateChildren: function (nextNestedChildrenElements, transaction, context) {
311
- var prevChildren = this._renderedChildren;
312
- var removedNodes = {};
313
- var mountImages = [];
314
- var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, mountImages, removedNodes, transaction, context);
315
- if (!nextChildren && !prevChildren) {
316
- return;
317
- }
318
- var updates = null;
319
- var name;
320
- // `nextIndex` will increment for each child in `nextChildren`, but
321
- // `lastIndex` will be the last index visited in `prevChildren`.
322
- var nextIndex = 0;
323
- var lastIndex = 0;
324
- // `nextMountIndex` will increment for each newly mounted child.
325
- var nextMountIndex = 0;
326
- var lastPlacedNode = null;
327
- for (name in nextChildren) {
328
- if (!nextChildren.hasOwnProperty(name)) {
329
- continue;
330
- }
331
- var prevChild = prevChildren && prevChildren[name];
332
- var nextChild = nextChildren[name];
333
- if (prevChild === nextChild) {
334
- updates = enqueue(updates, this.moveChild(prevChild, lastPlacedNode, nextIndex, lastIndex));
335
- lastIndex = Math.max(prevChild._mountIndex, lastIndex);
336
- prevChild._mountIndex = nextIndex;
337
- } else {
338
- if (prevChild) {
339
- // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
340
- lastIndex = Math.max(prevChild._mountIndex, lastIndex);
341
- // The `removedNodes` loop below will actually remove the child.
342
- }
343
- // The child must be instantiated before it's mounted.
344
- updates = enqueue(updates, this._mountChildAtIndex(nextChild, mountImages[nextMountIndex], lastPlacedNode, nextIndex, transaction, context));
345
- nextMountIndex++;
346
- }
347
- nextIndex++;
348
- lastPlacedNode = ReactReconciler.getHostNode(nextChild);
349
- }
350
- // Remove children that are no longer present.
351
- for (name in removedNodes) {
352
- if (removedNodes.hasOwnProperty(name)) {
353
- updates = enqueue(updates, this._unmountChild(prevChildren[name], removedNodes[name]));
354
- }
355
- }
356
- if (updates) {
357
- processQueue(this, updates);
358
- }
359
- this._renderedChildren = nextChildren;
360
-
361
- if (process.env.NODE_ENV !== 'production') {
362
- setChildrenForInstrumentation.call(this, nextChildren);
363
- }
364
- },
365
-
366
- /**
367
- * Unmounts all rendered children. This should be used to clean up children
368
- * when this component is unmounted. It does not actually perform any
369
- * backend operations.
370
- *
371
- * @internal
372
- */
373
- unmountChildren: function (safely) {
374
- var renderedChildren = this._renderedChildren;
375
- ReactChildReconciler.unmountChildren(renderedChildren, safely);
376
- this._renderedChildren = null;
377
- },
378
-
379
- /**
380
- * Moves a child component to the supplied index.
381
- *
382
- * @param {ReactComponent} child Component to move.
383
- * @param {number} toIndex Destination index of the element.
384
- * @param {number} lastIndex Last index visited of the siblings of `child`.
385
- * @protected
386
- */
387
- moveChild: function (child, afterNode, toIndex, lastIndex) {
388
- // If the index of `child` is less than `lastIndex`, then it needs to
389
- // be moved. Otherwise, we do not need to move it because a child will be
390
- // inserted or moved before `child`.
391
- if (child._mountIndex < lastIndex) {
392
- return makeMove(child, afterNode, toIndex);
393
- }
394
- },
395
-
396
- /**
397
- * Creates a child component.
398
- *
399
- * @param {ReactComponent} child Component to create.
400
- * @param {string} mountImage Markup to insert.
401
- * @protected
402
- */
403
- createChild: function (child, afterNode, mountImage) {
404
- return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
405
- },
406
-
407
- /**
408
- * Removes a child component.
409
- *
410
- * @param {ReactComponent} child Child to remove.
411
- * @protected
412
- */
413
- removeChild: function (child, node) {
414
- return makeRemove(child, node);
415
- },
416
-
417
- /**
418
- * Mounts a child with the supplied name.
419
- *
420
- * NOTE: This is part of `updateChildren` and is here for readability.
421
- *
422
- * @param {ReactComponent} child Component to mount.
423
- * @param {string} name Name of the child.
424
- * @param {number} index Index at which to insert the child.
425
- * @param {ReactReconcileTransaction} transaction
426
- * @private
427
- */
428
- _mountChildAtIndex: function (child, mountImage, afterNode, index, transaction, context) {
429
- child._mountIndex = index;
430
- return this.createChild(child, afterNode, mountImage);
431
- },
432
-
433
- /**
434
- * Unmounts a rendered child.
435
- *
436
- * NOTE: This is part of `updateChildren` and is here for readability.
437
- *
438
- * @param {ReactComponent} child Component to unmount.
439
- * @private
440
- */
441
- _unmountChild: function (child, node) {
442
- var update = this.removeChild(child, node);
443
- child._mountIndex = null;
444
- return update;
445
- }
446
-
447
- }
448
-
449
- };
450
-
451
- module.exports = ReactMultiChild;
@@ -1,32 +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 ReactMultiChildUpdateTypes
10
- */
11
-
12
- 'use strict';
13
-
14
- var keyMirror = require('fbjs/lib/keyMirror');
15
-
16
- /**
17
- * When a component's children are updated, a series of update configuration
18
- * objects are created in order to batch and serialize the required changes.
19
- *
20
- * Enumerates all the possible types of update configurations.
21
- *
22
- * @internal
23
- */
24
- var ReactMultiChildUpdateTypes = keyMirror({
25
- INSERT_MARKUP: null,
26
- MOVE_EXISTING: null,
27
- REMOVE_NODE: null,
28
- SET_MARKUP: null,
29
- TEXT_CONTENT: null
30
- });
31
-
32
- module.exports = ReactMultiChildUpdateTypes;