react 0.14.0-alpha3 → 0.14.0-rc1
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.
- package/README.md +5 -2
- package/addons.js +8 -3
- package/dist/react-dom.js +42 -0
- package/dist/react-dom.min.js +12 -0
- package/dist/react-with-addons.js +6076 -5337
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +5445 -4839
- package/dist/react.min.js +6 -5
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +15 -5
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +18 -3
- package/lib/CSSPropertyOperations.js +22 -14
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +18 -15
- package/lib/DOMChildrenOperations.js +17 -7
- package/lib/DOMProperty.js +82 -117
- package/lib/DOMPropertyOperations.js +84 -33
- package/lib/Danger.js +21 -16
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +21 -13
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +17 -20
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +33 -42
- package/lib/EventPropagators.js +8 -8
- package/lib/FallbackCompositionState.js +9 -3
- package/lib/HTMLDOMPropertyConfig.js +19 -3
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +50 -38
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +15 -5
- package/lib/React.js +18 -7
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +35 -9
- package/lib/ReactCSSTransitionGroupChild.js +56 -30
- package/lib/ReactChildReconciler.js +24 -19
- package/lib/ReactChildren.js +75 -35
- package/lib/ReactClass.js +70 -87
- package/lib/ReactComponent.js +27 -20
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +3 -3
- package/lib/ReactCompositeComponent.js +117 -106
- package/lib/ReactDOM.js +74 -158
- package/lib/ReactDOMButton.js +15 -26
- package/lib/ReactDOMComponent.js +441 -72
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
- package/lib/ReactDOMIDOperations.js +8 -66
- package/lib/ReactDOMInput.js +87 -99
- package/lib/ReactDOMOption.js +25 -44
- package/lib/ReactDOMSelect.js +88 -98
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +5 -3
- package/lib/ReactDOMTextComponent.js +33 -20
- package/lib/ReactDOMTextarea.js +48 -61
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +23 -72
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -11
- package/lib/ReactElement.js +92 -107
- package/lib/ReactElementValidator.js +53 -173
- package/lib/ReactEmptyComponent.js +26 -62
- package/lib/ReactEmptyComponentRegistry.js +48 -0
- package/lib/ReactErrorUtils.js +45 -9
- package/lib/ReactEventEmitterMixin.js +3 -4
- package/lib/ReactEventListener.js +64 -12
- package/lib/ReactFragment.js +29 -115
- package/lib/ReactInjection.js +10 -12
- package/lib/ReactInputSelection.js +8 -7
- package/lib/ReactInstanceHandles.js +12 -12
- package/lib/ReactIsomorphic.js +15 -11
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +196 -122
- package/lib/ReactMultiChild.js +119 -25
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -8
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +41 -12
- package/lib/ReactReconcileTransaction.js +12 -10
- package/lib/ReactReconciler.js +8 -11
- package/lib/ReactRef.js +15 -2
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +22 -9
- package/lib/ReactServerRenderingTransaction.js +8 -7
- package/lib/ReactTestUtils.js +89 -64
- package/lib/ReactTransitionChildMapping.js +3 -6
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +60 -35
- package/lib/ReactUpdates.js +15 -18
- package/lib/{isTextNode.js → ReactVersion.js} +2 -13
- package/lib/ReactWithAddons.js +24 -17
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +25 -16
- package/lib/SimpleEventPlugin.js +200 -45
- package/lib/SyntheticClipboardEvent.js +3 -3
- package/lib/SyntheticCompositionEvent.js +3 -3
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +24 -8
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +3 -3
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +5 -5
- package/lib/SyntheticTouchEvent.js +4 -4
- package/lib/SyntheticUIEvent.js +4 -4
- package/lib/SyntheticWheelEvent.js +3 -3
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +17 -11
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +12 -7
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +48 -0
- package/lib/findDOMNode.js +11 -12
- package/lib/flattenChildren.js +4 -4
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +0 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +27 -25
- package/lib/isEventSupported.js +1 -1
- package/lib/isTextInputElement.js +2 -1
- package/lib/joinClasses.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +216 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +2 -2
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/shouldUpdateReactComponent.js +12 -8
- package/lib/sliceChildren.js +34 -0
- package/lib/traverseAllChildren.js +21 -19
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +6 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +2 -0
- package/addons/CSSTransitionGroup.js +0 -1
- package/addons/LinkedStateMixin.js +0 -1
- package/addons/Perf.js +0 -1
- package/addons/PureRenderMixin.js +0 -1
- package/addons/TestUtils.js +0 -1
- package/addons/TransitionGroup.js +0 -1
- package/addons/batchedUpdates.js +0 -1
- package/addons/cloneWithProps.js +0 -1
- package/addons/createFragment.js +0 -1
- package/addons/renderSubtreeIntoContainer.js +0 -1
- package/addons/shallowCompare.js +0 -1
- package/addons/update.js +0 -1
- package/dist/JSXTransformer.js +0 -17589
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/LocalEventTrapMixin.js +0 -46
- package/lib/ReactContext.js +0 -32
- package/lib/ReactDOMClient.js +0 -85
- package/lib/ReactDOMForm.js +0 -47
- package/lib/ReactDOMIframe.js +0 -43
- package/lib/ReactDOMImg.js +0 -44
- package/lib/ReactLifeCycle.js +0 -35
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createFullPageComponent.js +0 -51
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -115
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -61
package/lib/ReactMultiChild.js
CHANGED
|
@@ -12,11 +12,14 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var ReactComponentEnvironment = require(
|
|
16
|
-
var ReactMultiChildUpdateTypes = require(
|
|
15
|
+
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
16
|
+
var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
|
|
17
17
|
|
|
18
|
-
var
|
|
19
|
-
var
|
|
18
|
+
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
19
|
+
var ReactReconciler = require('./ReactReconciler');
|
|
20
|
+
var ReactChildReconciler = require('./ReactChildReconciler');
|
|
21
|
+
|
|
22
|
+
var flattenChildren = require('./flattenChildren');
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
25
|
* Updating children of a component may trigger recursive updates. The depth is
|
|
@@ -53,14 +56,14 @@ var markupQueue = [];
|
|
|
53
56
|
* @param {number} toIndex Destination index.
|
|
54
57
|
* @private
|
|
55
58
|
*/
|
|
56
|
-
function
|
|
59
|
+
function enqueueInsertMarkup(parentID, markup, toIndex) {
|
|
57
60
|
// NOTE: Null values reduce hidden classes.
|
|
58
61
|
updateQueue.push({
|
|
59
62
|
parentID: parentID,
|
|
60
63
|
parentNode: null,
|
|
61
64
|
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
|
|
62
65
|
markupIndex: markupQueue.push(markup) - 1,
|
|
63
|
-
|
|
66
|
+
content: null,
|
|
64
67
|
fromIndex: null,
|
|
65
68
|
toIndex: toIndex
|
|
66
69
|
});
|
|
@@ -81,7 +84,7 @@ function enqueueMove(parentID, fromIndex, toIndex) {
|
|
|
81
84
|
parentNode: null,
|
|
82
85
|
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
|
|
83
86
|
markupIndex: null,
|
|
84
|
-
|
|
87
|
+
content: null,
|
|
85
88
|
fromIndex: fromIndex,
|
|
86
89
|
toIndex: toIndex
|
|
87
90
|
});
|
|
@@ -101,12 +104,32 @@ function enqueueRemove(parentID, fromIndex) {
|
|
|
101
104
|
parentNode: null,
|
|
102
105
|
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
|
|
103
106
|
markupIndex: null,
|
|
104
|
-
|
|
107
|
+
content: null,
|
|
105
108
|
fromIndex: fromIndex,
|
|
106
109
|
toIndex: null
|
|
107
110
|
});
|
|
108
111
|
}
|
|
109
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Enqueues setting the markup of a node.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} parentID ID of the parent component.
|
|
117
|
+
* @param {string} markup Markup that renders into an element.
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
function enqueueSetMarkup(parentID, markup) {
|
|
121
|
+
// NOTE: Null values reduce hidden classes.
|
|
122
|
+
updateQueue.push({
|
|
123
|
+
parentID: parentID,
|
|
124
|
+
parentNode: null,
|
|
125
|
+
type: ReactMultiChildUpdateTypes.SET_MARKUP,
|
|
126
|
+
markupIndex: null,
|
|
127
|
+
content: markup,
|
|
128
|
+
fromIndex: null,
|
|
129
|
+
toIndex: null
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
110
133
|
/**
|
|
111
134
|
* Enqueues setting the text content.
|
|
112
135
|
*
|
|
@@ -121,7 +144,7 @@ function enqueueTextContent(parentID, textContent) {
|
|
|
121
144
|
parentNode: null,
|
|
122
145
|
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
|
|
123
146
|
markupIndex: null,
|
|
124
|
-
|
|
147
|
+
content: textContent,
|
|
125
148
|
fromIndex: null,
|
|
126
149
|
toIndex: null
|
|
127
150
|
});
|
|
@@ -166,6 +189,37 @@ var ReactMultiChild = {
|
|
|
166
189
|
*/
|
|
167
190
|
Mixin: {
|
|
168
191
|
|
|
192
|
+
_reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
|
|
193
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
194
|
+
if (this._currentElement) {
|
|
195
|
+
try {
|
|
196
|
+
ReactCurrentOwner.current = this._currentElement._owner;
|
|
197
|
+
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
|
|
198
|
+
} finally {
|
|
199
|
+
ReactCurrentOwner.current = null;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
_reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
|
|
207
|
+
var nextChildren;
|
|
208
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
209
|
+
if (this._currentElement) {
|
|
210
|
+
try {
|
|
211
|
+
ReactCurrentOwner.current = this._currentElement._owner;
|
|
212
|
+
nextChildren = flattenChildren(nextNestedChildrenElements);
|
|
213
|
+
} finally {
|
|
214
|
+
ReactCurrentOwner.current = null;
|
|
215
|
+
}
|
|
216
|
+
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
nextChildren = flattenChildren(nextNestedChildrenElements);
|
|
220
|
+
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
|
|
221
|
+
},
|
|
222
|
+
|
|
169
223
|
/**
|
|
170
224
|
* Generates a "mount image" for each of the supplied children. In the case
|
|
171
225
|
* of `ReactDOMComponent`, a mount image is a string of markup.
|
|
@@ -175,7 +229,7 @@ var ReactMultiChild = {
|
|
|
175
229
|
* @internal
|
|
176
230
|
*/
|
|
177
231
|
mountChildren: function (nestedChildren, transaction, context) {
|
|
178
|
-
var children =
|
|
232
|
+
var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
|
|
179
233
|
this._renderedChildren = children;
|
|
180
234
|
var mountImages = [];
|
|
181
235
|
var index = 0;
|
|
@@ -185,9 +239,8 @@ var ReactMultiChild = {
|
|
|
185
239
|
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
|
|
186
240
|
var rootID = this._rootNodeID + name;
|
|
187
241
|
var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
|
|
188
|
-
child._mountIndex = index
|
|
242
|
+
child._mountIndex = index++;
|
|
189
243
|
mountImages.push(mountImage);
|
|
190
|
-
index++;
|
|
191
244
|
}
|
|
192
245
|
}
|
|
193
246
|
return mountImages;
|
|
@@ -209,7 +262,7 @@ var ReactMultiChild = {
|
|
|
209
262
|
// TODO: The setTextContent operation should be enough
|
|
210
263
|
for (var name in prevChildren) {
|
|
211
264
|
if (prevChildren.hasOwnProperty(name)) {
|
|
212
|
-
this.
|
|
265
|
+
this._unmountChild(prevChildren[name]);
|
|
213
266
|
}
|
|
214
267
|
}
|
|
215
268
|
// Set new text content.
|
|
@@ -227,18 +280,50 @@ var ReactMultiChild = {
|
|
|
227
280
|
}
|
|
228
281
|
},
|
|
229
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Replaces any rendered children with a markup string.
|
|
285
|
+
*
|
|
286
|
+
* @param {string} nextMarkup String of markup.
|
|
287
|
+
* @internal
|
|
288
|
+
*/
|
|
289
|
+
updateMarkup: function (nextMarkup) {
|
|
290
|
+
updateDepth++;
|
|
291
|
+
var errorThrown = true;
|
|
292
|
+
try {
|
|
293
|
+
var prevChildren = this._renderedChildren;
|
|
294
|
+
// Remove any rendered children.
|
|
295
|
+
ReactChildReconciler.unmountChildren(prevChildren);
|
|
296
|
+
for (var name in prevChildren) {
|
|
297
|
+
if (prevChildren.hasOwnProperty(name)) {
|
|
298
|
+
this._unmountChildByName(prevChildren[name], name);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
this.setMarkup(nextMarkup);
|
|
302
|
+
errorThrown = false;
|
|
303
|
+
} finally {
|
|
304
|
+
updateDepth--;
|
|
305
|
+
if (!updateDepth) {
|
|
306
|
+
if (errorThrown) {
|
|
307
|
+
clearQueue();
|
|
308
|
+
} else {
|
|
309
|
+
processQueue();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
|
|
230
315
|
/**
|
|
231
316
|
* Updates the rendered children with new children.
|
|
232
317
|
*
|
|
233
|
-
* @param {?object}
|
|
318
|
+
* @param {?object} nextNestedChildrenElements Nested child element maps.
|
|
234
319
|
* @param {ReactReconcileTransaction} transaction
|
|
235
320
|
* @internal
|
|
236
321
|
*/
|
|
237
|
-
updateChildren: function (
|
|
322
|
+
updateChildren: function (nextNestedChildrenElements, transaction, context) {
|
|
238
323
|
updateDepth++;
|
|
239
324
|
var errorThrown = true;
|
|
240
325
|
try {
|
|
241
|
-
this._updateChildren(
|
|
326
|
+
this._updateChildren(nextNestedChildrenElements, transaction, context);
|
|
242
327
|
errorThrown = false;
|
|
243
328
|
} finally {
|
|
244
329
|
updateDepth--;
|
|
@@ -256,14 +341,14 @@ var ReactMultiChild = {
|
|
|
256
341
|
* Improve performance by isolating this hot code path from the try/catch
|
|
257
342
|
* block in `updateChildren`.
|
|
258
343
|
*
|
|
259
|
-
* @param {?object}
|
|
344
|
+
* @param {?object} nextNestedChildrenElements Nested child element maps.
|
|
260
345
|
* @param {ReactReconcileTransaction} transaction
|
|
261
346
|
* @final
|
|
262
347
|
* @protected
|
|
263
348
|
*/
|
|
264
|
-
_updateChildren: function (
|
|
349
|
+
_updateChildren: function (nextNestedChildrenElements, transaction, context) {
|
|
265
350
|
var prevChildren = this._renderedChildren;
|
|
266
|
-
var nextChildren =
|
|
351
|
+
var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
|
|
267
352
|
this._renderedChildren = nextChildren;
|
|
268
353
|
if (!nextChildren && !prevChildren) {
|
|
269
354
|
return;
|
|
@@ -287,7 +372,7 @@ var ReactMultiChild = {
|
|
|
287
372
|
if (prevChild) {
|
|
288
373
|
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
|
|
289
374
|
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
|
|
290
|
-
this.
|
|
375
|
+
this._unmountChild(prevChild);
|
|
291
376
|
}
|
|
292
377
|
// The child must be instantiated before it's mounted.
|
|
293
378
|
this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
|
|
@@ -297,7 +382,7 @@ var ReactMultiChild = {
|
|
|
297
382
|
// Remove children that are no longer present.
|
|
298
383
|
for (name in prevChildren) {
|
|
299
384
|
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
|
|
300
|
-
this.
|
|
385
|
+
this._unmountChild(prevChildren[name]);
|
|
301
386
|
}
|
|
302
387
|
}
|
|
303
388
|
},
|
|
@@ -339,7 +424,7 @@ var ReactMultiChild = {
|
|
|
339
424
|
* @protected
|
|
340
425
|
*/
|
|
341
426
|
createChild: function (child, mountImage) {
|
|
342
|
-
|
|
427
|
+
enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
|
|
343
428
|
},
|
|
344
429
|
|
|
345
430
|
/**
|
|
@@ -362,6 +447,16 @@ var ReactMultiChild = {
|
|
|
362
447
|
enqueueTextContent(this._rootNodeID, textContent);
|
|
363
448
|
},
|
|
364
449
|
|
|
450
|
+
/**
|
|
451
|
+
* Sets this markup string.
|
|
452
|
+
*
|
|
453
|
+
* @param {string} markup Markup to set.
|
|
454
|
+
* @protected
|
|
455
|
+
*/
|
|
456
|
+
setMarkup: function (markup) {
|
|
457
|
+
enqueueSetMarkup(this._rootNodeID, markup);
|
|
458
|
+
},
|
|
459
|
+
|
|
365
460
|
/**
|
|
366
461
|
* Mounts a child with the supplied name.
|
|
367
462
|
*
|
|
@@ -382,15 +477,14 @@ var ReactMultiChild = {
|
|
|
382
477
|
},
|
|
383
478
|
|
|
384
479
|
/**
|
|
385
|
-
* Unmounts a rendered child
|
|
480
|
+
* Unmounts a rendered child.
|
|
386
481
|
*
|
|
387
482
|
* NOTE: This is part of `updateChildren` and is here for readability.
|
|
388
483
|
*
|
|
389
484
|
* @param {ReactComponent} child Component to unmount.
|
|
390
|
-
* @param {string} name Name of the child in `this._renderedChildren`.
|
|
391
485
|
* @private
|
|
392
486
|
*/
|
|
393
|
-
|
|
487
|
+
_unmountChild: function (child) {
|
|
394
488
|
this.removeChild(child);
|
|
395
489
|
child._mountIndex = null;
|
|
396
490
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var keyMirror = require(
|
|
14
|
+
var keyMirror = require('fbjs/lib/keyMirror');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* When a component's children are updated, a series of update configuration
|
|
@@ -25,6 +25,7 @@ var ReactMultiChildUpdateTypes = keyMirror({
|
|
|
25
25
|
INSERT_MARKUP: null,
|
|
26
26
|
MOVE_EXISTING: null,
|
|
27
27
|
REMOVE_NODE: null,
|
|
28
|
+
SET_MARKUP: null,
|
|
28
29
|
TEXT_CONTENT: null
|
|
29
30
|
});
|
|
30
31
|
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var assign = require(
|
|
15
|
-
var invariant = require(
|
|
14
|
+
var assign = require('./Object.assign');
|
|
15
|
+
var invariant = require('fbjs/lib/invariant');
|
|
16
16
|
|
|
17
17
|
var autoGenerateWrapperClass = null;
|
|
18
18
|
var genericComponentClass = null;
|
|
@@ -35,11 +35,6 @@ var ReactNativeComponentInjection = {
|
|
|
35
35
|
// tag. That particular tag will use this class instead of the generic one.
|
|
36
36
|
injectComponentClasses: function (componentClasses) {
|
|
37
37
|
assign(tagToComponentClass, componentClasses);
|
|
38
|
-
},
|
|
39
|
-
// Temporary hack since we expect DOM refs to behave like composites,
|
|
40
|
-
// for this release.
|
|
41
|
-
injectAutoWrapper: function (wrapperFactory) {
|
|
42
|
-
autoGenerateWrapperClass = wrapperFactory;
|
|
43
38
|
}
|
|
44
39
|
};
|
|
45
40
|
|
|
@@ -68,7 +63,7 @@ function getComponentClassForElement(element) {
|
|
|
68
63
|
* @return {function} The internal class constructor function.
|
|
69
64
|
*/
|
|
70
65
|
function createInternalComponent(element) {
|
|
71
|
-
!genericComponentClass ?
|
|
66
|
+
!genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
|
|
72
67
|
return new genericComponentClass(element.type, element.props);
|
|
73
68
|
}
|
|
74
69
|
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2015, 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 ReactNoopUpdateQueue
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var warning = require('fbjs/lib/warning');
|
|
15
|
+
|
|
16
|
+
function warnTDZ(publicInstance, callerName) {
|
|
17
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
18
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* This is the abstract API for an update queue.
|
|
24
|
+
*/
|
|
25
|
+
var ReactNoopUpdateQueue = {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Checks whether or not this composite component is mounted.
|
|
29
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
|
30
|
+
* @return {boolean} True if mounted, false otherwise.
|
|
31
|
+
* @protected
|
|
32
|
+
* @final
|
|
33
|
+
*/
|
|
34
|
+
isMounted: function (publicInstance) {
|
|
35
|
+
return false;
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Enqueue a callback that will be executed after all the pending updates
|
|
40
|
+
* have processed.
|
|
41
|
+
*
|
|
42
|
+
* @param {ReactClass} publicInstance The instance to use as `this` context.
|
|
43
|
+
* @param {?function} callback Called after state is updated.
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
enqueueCallback: function (publicInstance, callback) {},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Forces an update. This should only be invoked when it is known with
|
|
50
|
+
* certainty that we are **not** in a DOM transaction.
|
|
51
|
+
*
|
|
52
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
53
|
+
* component's state has changed but `setState` was not called.
|
|
54
|
+
*
|
|
55
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
56
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
57
|
+
*
|
|
58
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
enqueueForceUpdate: function (publicInstance) {
|
|
62
|
+
warnTDZ(publicInstance, 'forceUpdate');
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
67
|
+
* You should treat `this.state` as immutable.
|
|
68
|
+
*
|
|
69
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
70
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
71
|
+
*
|
|
72
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
73
|
+
* @param {object} completeState Next state.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
enqueueReplaceState: function (publicInstance, completeState) {
|
|
77
|
+
warnTDZ(publicInstance, 'replaceState');
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
|
82
|
+
* internal. This provides a merging strategy that is not available to deep
|
|
83
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
84
|
+
* during the merge.
|
|
85
|
+
*
|
|
86
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
87
|
+
* @param {object} partialState Next partial state to be merged with state.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
enqueueSetState: function (publicInstance, partialState) {
|
|
91
|
+
warnTDZ(publicInstance, 'setState');
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Sets a subset of the props.
|
|
96
|
+
*
|
|
97
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
98
|
+
* @param {object} partialProps Subset of the next props.
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
enqueueSetProps: function (publicInstance, partialProps) {
|
|
102
|
+
warnTDZ(publicInstance, 'setProps');
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Replaces all of the props.
|
|
107
|
+
*
|
|
108
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
109
|
+
* @param {object} props New props.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
enqueueReplaceProps: function (publicInstance, props) {
|
|
113
|
+
warnTDZ(publicInstance, 'replaceProps');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
module.exports = ReactNoopUpdateQueue;
|