react 15.3.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 (189) hide show
  1. package/dist/react-with-addons.js +3898 -21383
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2672 -19494
  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 -13
  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 +5 -2
  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/traverseAllChildren.js +11 -2
  33. package/lib/update.js +6 -7
  34. package/package.json +1 -1
  35. package/lib/AutoFocusUtils.js +0 -24
  36. package/lib/BeforeInputEventPlugin.js +0 -390
  37. package/lib/CSSProperty.js +0 -148
  38. package/lib/CSSPropertyOperations.js +0 -205
  39. package/lib/CallbackQueue.js +0 -106
  40. package/lib/ChangeEventPlugin.js +0 -325
  41. package/lib/DOMChildrenOperations.js +0 -194
  42. package/lib/DOMLazyTree.js +0 -118
  43. package/lib/DOMProperty.js +0 -206
  44. package/lib/DOMPropertyOperations.js +0 -221
  45. package/lib/Danger.js +0 -48
  46. package/lib/DefaultEventPluginOrder.js +0 -27
  47. package/lib/DisabledInputUtils.js +0 -50
  48. package/lib/EnterLeaveEventPlugin.js +0 -105
  49. package/lib/EventConstants.js +0 -97
  50. package/lib/EventPluginHub.js +0 -251
  51. package/lib/EventPluginRegistry.js +0 -247
  52. package/lib/EventPluginUtils.js +0 -229
  53. package/lib/EventPropagators.js +0 -137
  54. package/lib/FallbackCompositionState.js +0 -95
  55. package/lib/HTMLDOMPropertyConfig.js +0 -212
  56. package/lib/LinkedValueUtils.js +0 -136
  57. package/lib/NativeMethodsMixin.js +0 -167
  58. package/lib/ReactBrowserEventEmitter.js +0 -330
  59. package/lib/ReactChildReconciler.js +0 -154
  60. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  61. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  62. package/lib/ReactComponentEnvironment.js +0 -45
  63. package/lib/ReactComponentTreeTestUtils.js +0 -87
  64. package/lib/ReactCompositeComponent.js +0 -904
  65. package/lib/ReactDOM.js +0 -110
  66. package/lib/ReactDOMButton.js +0 -24
  67. package/lib/ReactDOMComponent.js +0 -1006
  68. package/lib/ReactDOMComponentTree.js +0 -188
  69. package/lib/ReactDOMContainerInfo.js +0 -33
  70. package/lib/ReactDOMEmptyComponent.js +0 -60
  71. package/lib/ReactDOMFiber.js +0 -76
  72. package/lib/ReactDOMIDOperations.js +0 -34
  73. package/lib/ReactDOMInput.js +0 -269
  74. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  75. package/lib/ReactDOMOption.js +0 -123
  76. package/lib/ReactDOMSelect.js +0 -201
  77. package/lib/ReactDOMSelection.js +0 -212
  78. package/lib/ReactDOMServer.js +0 -26
  79. package/lib/ReactDOMTextComponent.js +0 -164
  80. package/lib/ReactDOMTextarea.js +0 -155
  81. package/lib/ReactDOMTreeTraversal.js +0 -136
  82. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  83. package/lib/ReactDebugTool.js +0 -301
  84. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  85. package/lib/ReactDefaultInjection.js +0 -84
  86. package/lib/ReactEmptyComponent.js +0 -30
  87. package/lib/ReactErrorUtils.js +0 -76
  88. package/lib/ReactEventEmitterMixin.js +0 -33
  89. package/lib/ReactEventListener.js +0 -157
  90. package/lib/ReactFeatureFlags.js +0 -22
  91. package/lib/ReactHostComponent.js +0 -76
  92. package/lib/ReactHostOperationHistoryHook.js +0 -37
  93. package/lib/ReactInjection.js +0 -36
  94. package/lib/ReactInputSelection.js +0 -124
  95. package/lib/ReactInstanceHandles.js +0 -302
  96. package/lib/ReactInstanceMap.js +0 -48
  97. package/lib/ReactInstrumentation.js +0 -21
  98. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  99. package/lib/ReactMarkupChecksum.js +0 -50
  100. package/lib/ReactMount.js +0 -534
  101. package/lib/ReactMultiChild.js +0 -451
  102. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  103. package/lib/ReactNative.js +0 -71
  104. package/lib/ReactNativeAttributePayload.js +0 -371
  105. package/lib/ReactNativeBaseComponent.js +0 -198
  106. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  107. package/lib/ReactNativeComponentEnvironment.js +0 -31
  108. package/lib/ReactNativeComponentTree.js +0 -68
  109. package/lib/ReactNativeContainerInfo.js +0 -21
  110. package/lib/ReactNativeDOMIDOperations.js +0 -79
  111. package/lib/ReactNativeDefaultInjection.js +0 -101
  112. package/lib/ReactNativeEventEmitter.js +0 -191
  113. package/lib/ReactNativeEventPluginOrder.js +0 -16
  114. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  115. package/lib/ReactNativeMount.js +0 -193
  116. package/lib/ReactNativePropRegistry.js +0 -52
  117. package/lib/ReactNativeReconcileTransaction.js +0 -129
  118. package/lib/ReactNativeTagHandles.js +0 -56
  119. package/lib/ReactNativeTextComponent.js +0 -71
  120. package/lib/ReactNativeTreeTraversal.js +0 -127
  121. package/lib/ReactNodeTypes.js +0 -40
  122. package/lib/ReactNoop.js +0 -173
  123. package/lib/ReactOwner.js +0 -94
  124. package/lib/ReactPerf.js +0 -494
  125. package/lib/ReactReconcileTransaction.js +0 -178
  126. package/lib/ReactReconciler.js +0 -168
  127. package/lib/ReactRef.js +0 -80
  128. package/lib/ReactServerBatchingStrategy.js +0 -22
  129. package/lib/ReactServerRendering.js +0 -90
  130. package/lib/ReactServerRenderingTransaction.js +0 -90
  131. package/lib/ReactServerUpdateQueue.js +0 -141
  132. package/lib/ReactSimpleEmptyComponent.js +0 -37
  133. package/lib/ReactTestMount.js +0 -126
  134. package/lib/ReactTestReconcileTransaction.js +0 -121
  135. package/lib/ReactTestRenderer.js +0 -144
  136. package/lib/ReactTestUtils.js +0 -518
  137. package/lib/ReactUpdateQueue.js +0 -226
  138. package/lib/ReactUpdates.js +0 -251
  139. package/lib/ResponderEventPlugin.js +0 -510
  140. package/lib/ResponderSyntheticEvent.js +0 -39
  141. package/lib/ResponderTouchHistoryStore.js +0 -184
  142. package/lib/SVGDOMPropertyConfig.js +0 -302
  143. package/lib/SelectEventPlugin.js +0 -196
  144. package/lib/SimpleEventPlugin.js +0 -635
  145. package/lib/SyntheticAnimationEvent.js +0 -39
  146. package/lib/SyntheticClipboardEvent.js +0 -38
  147. package/lib/SyntheticCompositionEvent.js +0 -36
  148. package/lib/SyntheticDragEvent.js +0 -36
  149. package/lib/SyntheticEvent.js +0 -268
  150. package/lib/SyntheticFocusEvent.js +0 -36
  151. package/lib/SyntheticInputEvent.js +0 -37
  152. package/lib/SyntheticKeyboardEvent.js +0 -84
  153. package/lib/SyntheticMouseEvent.js +0 -72
  154. package/lib/SyntheticTouchEvent.js +0 -45
  155. package/lib/SyntheticTransitionEvent.js +0 -39
  156. package/lib/SyntheticUIEvent.js +0 -59
  157. package/lib/SyntheticWheelEvent.js +0 -54
  158. package/lib/TapEventPlugin.js +0 -110
  159. package/lib/TouchHistoryMath.js +0 -99
  160. package/lib/Transaction.js +0 -233
  161. package/lib/ViewportMetrics.js +0 -27
  162. package/lib/accumulate.js +0 -46
  163. package/lib/accumulateInto.js +0 -58
  164. package/lib/adler32.js +0 -44
  165. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  166. package/lib/createReactNativeComponentClass.js +0 -42
  167. package/lib/dangerousStyleValue.js +0 -79
  168. package/lib/escapeTextContentForBrowser.js +0 -123
  169. package/lib/findDOMNode.js +0 -60
  170. package/lib/findNodeHandle.js +0 -91
  171. package/lib/forEachAccumulated.js +0 -31
  172. package/lib/getEventCharCode.js +0 -50
  173. package/lib/getEventKey.js +0 -102
  174. package/lib/getEventModifierState.js +0 -43
  175. package/lib/getEventTarget.js +0 -35
  176. package/lib/getHostComponentFromComposite.js +0 -30
  177. package/lib/getNodeForCharacterOffset.js +0 -74
  178. package/lib/getTestDocument.js +0 -21
  179. package/lib/getTextContentAccessor.js +0 -33
  180. package/lib/getVendorPrefixedEventName.js +0 -101
  181. package/lib/instantiateReactComponent.js +0 -119
  182. package/lib/isEventSupported.js +0 -60
  183. package/lib/isTextInputElement.js +0 -51
  184. package/lib/quoteAttributeValueForBrowser.js +0 -26
  185. package/lib/reactComponentExpect.js +0 -217
  186. package/lib/setInnerHTML.js +0 -98
  187. package/lib/setTextContent.js +0 -48
  188. package/lib/shouldUpdateReactComponent.js +0 -42
  189. package/lib/validateDOMNesting.js +0 -382
@@ -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;