react 0.14.0-beta1 → 0.14.0
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/addons.js +8 -3
- package/dist/react-with-addons.js +5048 -4095
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +4555 -3729
- package/dist/react.min.js +6 -5
- package/lib/AutoFocusUtils.js +3 -3
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +18 -3
- package/lib/CSSPropertyOperations.js +27 -14
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +15 -14
- package/lib/DOMChildrenOperations.js +22 -7
- package/lib/DOMProperty.js +8 -8
- package/lib/DOMPropertyOperations.js +23 -10
- package/lib/Danger.js +21 -16
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +18 -10
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +29 -21
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +34 -38
- package/lib/EventPropagators.js +8 -8
- package/lib/FallbackCompositionState.js +9 -3
- package/lib/HTMLDOMPropertyConfig.js +24 -4
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +8 -8
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +3 -5
- package/lib/React.js +18 -7
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +36 -7
- package/lib/ReactCSSTransitionGroup.js +35 -9
- package/lib/ReactCSSTransitionGroupChild.js +48 -30
- package/lib/ReactChildReconciler.js +24 -19
- package/lib/ReactChildren.js +72 -32
- package/lib/ReactClass.js +46 -46
- package/lib/ReactComponent.js +18 -16
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +95 -44
- package/lib/ReactDOM.js +74 -159
- package/lib/ReactDOMComponent.js +235 -93
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
- package/lib/ReactDOMIDOperations.js +8 -81
- package/lib/ReactDOMInput.js +18 -9
- package/lib/ReactDOMOption.js +7 -7
- package/lib/ReactDOMSelect.js +9 -9
- package/lib/ReactDOMSelection.js +19 -3
- package/lib/ReactDOMServer.js +5 -3
- package/lib/ReactDOMTextComponent.js +33 -20
- package/lib/ReactDOMTextarea.js +14 -12
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +23 -25
- package/lib/ReactDefaultPerf.js +17 -11
- package/lib/ReactDefaultPerfAnalysis.js +13 -12
- package/lib/ReactElement.js +85 -39
- package/lib/ReactElementValidator.js +47 -90
- package/lib/ReactEmptyComponent.js +26 -62
- package/lib/ReactEmptyComponentRegistry.js +48 -0
- package/lib/ReactErrorUtils.js +53 -9
- package/lib/ReactEventEmitterMixin.js +2 -2
- package/lib/ReactEventListener.js +33 -21
- package/lib/ReactFragment.js +27 -118
- package/lib/ReactInjection.js +10 -12
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -11
- package/lib/ReactIsomorphic.js +15 -11
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +186 -85
- package/lib/ReactMultiChild.js +119 -25
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -3
- package/lib/ReactNoopUpdateQueue.js +3 -3
- 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 +38 -9
- package/lib/ReactReconcileTransaction.js +10 -8
- package/lib/ReactReconciler.js +5 -6
- package/lib/ReactRef.js +14 -2
- package/lib/ReactServerBatchingStrategy.js +5 -5
- package/lib/ReactServerRendering.js +12 -12
- package/lib/ReactServerRenderingTransaction.js +6 -5
- package/lib/ReactTestUtils.js +47 -39
- package/lib/ReactTransitionChildMapping.js +3 -6
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +19 -19
- package/lib/ReactUpdates.js +15 -15
- package/lib/{performance.js → ReactVersion.js} +3 -12
- package/lib/ReactWithAddons.js +24 -15
- 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 +19 -9
- package/lib/SimpleEventPlugin.js +198 -43
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +18 -4
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +3 -3
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +7 -7
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +11 -6
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +7 -6
- package/lib/findDOMNode.js +9 -9
- package/lib/flattenChildren.js +4 -4
- package/lib/getEventKey.js +1 -1
- package/lib/{isTextNode.js → getTestDocument.js} +7 -11
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +15 -17
- package/lib/isEventSupported.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 +1 -1
- 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 +25 -18
- 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 +1 -51
- package/dist/JSXTransformer.js +0 -17588
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/ReactDOMClient.js +0 -90
- 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/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 -93
- 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/joinClasses.js +0 -39
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/memoizeStringOnly.js +0 -31
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -57
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;
|
|
@@ -63,7 +63,7 @@ function getComponentClassForElement(element) {
|
|
|
63
63
|
* @return {function} The internal class constructor function.
|
|
64
64
|
*/
|
|
65
65
|
function createInternalComponent(element) {
|
|
66
|
-
!genericComponentClass ?
|
|
66
|
+
!genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
|
|
67
67
|
return new genericComponentClass(element.type, element.props);
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var warning = require(
|
|
14
|
+
var warning = require('fbjs/lib/warning');
|
|
15
15
|
|
|
16
16
|
function warnTDZ(publicInstance, callerName) {
|
|
17
|
-
if (
|
|
18
|
-
|
|
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
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
package/lib/ReactOwner.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var invariant = require(
|
|
14
|
+
var invariant = require('fbjs/lib/invariant');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* ReactOwners are capable of storing references to owned components.
|
|
@@ -64,7 +64,7 @@ var ReactOwner = {
|
|
|
64
64
|
* @internal
|
|
65
65
|
*/
|
|
66
66
|
addComponentAsRefTo: function (component, ref, owner) {
|
|
67
|
-
!ReactOwner.isValidOwner(owner) ?
|
|
67
|
+
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
|
|
68
68
|
owner.attachRef(ref, component);
|
|
69
69
|
},
|
|
70
70
|
|
|
@@ -78,7 +78,7 @@ var ReactOwner = {
|
|
|
78
78
|
* @internal
|
|
79
79
|
*/
|
|
80
80
|
removeComponentAsRefFrom: function (component, ref, owner) {
|
|
81
|
-
!ReactOwner.isValidOwner(owner) ?
|
|
81
|
+
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
|
|
82
82
|
// Check that `component` is still the current ref because we do not want to
|
|
83
83
|
// detach the ref if another component stole it.
|
|
84
84
|
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
|
package/lib/ReactPerf.js
CHANGED
|
@@ -35,7 +35,7 @@ var ReactPerf = {
|
|
|
35
35
|
* @param {object<string>} methodNames
|
|
36
36
|
*/
|
|
37
37
|
measureMethods: function (object, objectName, methodNames) {
|
|
38
|
-
if (
|
|
38
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
39
39
|
for (var key in methodNames) {
|
|
40
40
|
if (!methodNames.hasOwnProperty(key)) {
|
|
41
41
|
continue;
|
|
@@ -54,7 +54,7 @@ var ReactPerf = {
|
|
|
54
54
|
* @return {function}
|
|
55
55
|
*/
|
|
56
56
|
measure: function (objName, fnName, func) {
|
|
57
|
-
if (
|
|
57
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
58
58
|
var measuredFunc = null;
|
|
59
59
|
var wrapper = function () {
|
|
60
60
|
if (ReactPerf.enableMeasure) {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var assign = require(
|
|
15
|
-
var emptyFunction = require(
|
|
16
|
-
var joinClasses = require(
|
|
14
|
+
var assign = require('./Object.assign');
|
|
15
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
16
|
+
var joinClasses = require('fbjs/lib/joinClasses');
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Creates a transfer strategy that will merge prop values using the supplied
|
package/lib/ReactPropTypes.js
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactElement = require(
|
|
15
|
-
var
|
|
16
|
-
var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
|
|
14
|
+
var ReactElement = require('./ReactElement');
|
|
15
|
+
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
|
|
17
16
|
|
|
18
|
-
var emptyFunction = require(
|
|
17
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
18
|
+
var getIteratorFn = require('./getIteratorFn');
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Collection of methods that allow declaration and validation of props that are
|
|
@@ -163,7 +163,8 @@ function createInstanceTypeChecker(expectedClass) {
|
|
|
163
163
|
if (!(props[propName] instanceof expectedClass)) {
|
|
164
164
|
var locationName = ReactPropTypeLocationNames[location];
|
|
165
165
|
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
166
|
-
|
|
166
|
+
var actualClassName = getClassName(props[propName]);
|
|
167
|
+
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
167
168
|
}
|
|
168
169
|
return null;
|
|
169
170
|
}
|
|
@@ -283,12 +284,32 @@ function isNode(propValue) {
|
|
|
283
284
|
if (propValue === null || ReactElement.isValidElement(propValue)) {
|
|
284
285
|
return true;
|
|
285
286
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
|
|
288
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
289
|
+
if (iteratorFn) {
|
|
290
|
+
var iterator = iteratorFn.call(propValue);
|
|
291
|
+
var step;
|
|
292
|
+
if (iteratorFn !== propValue.entries) {
|
|
293
|
+
while (!(step = iterator.next()).done) {
|
|
294
|
+
if (!isNode(step.value)) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
} else {
|
|
299
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
300
|
+
while (!(step = iterator.next()).done) {
|
|
301
|
+
var entry = step.value;
|
|
302
|
+
if (entry) {
|
|
303
|
+
if (!isNode(entry[1])) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
290
308
|
}
|
|
309
|
+
} else {
|
|
310
|
+
return false;
|
|
291
311
|
}
|
|
312
|
+
|
|
292
313
|
return true;
|
|
293
314
|
default:
|
|
294
315
|
return false;
|
|
@@ -324,4 +345,12 @@ function getPreciseType(propValue) {
|
|
|
324
345
|
return propType;
|
|
325
346
|
}
|
|
326
347
|
|
|
348
|
+
// Returns class name of the object, if any.
|
|
349
|
+
function getClassName(propValue) {
|
|
350
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
351
|
+
return '<<anonymous>>';
|
|
352
|
+
}
|
|
353
|
+
return propValue.constructor.name;
|
|
354
|
+
}
|
|
355
|
+
|
|
327
356
|
module.exports = ReactPropTypes;
|