react 0.14.0-alpha1 → 0.14.0-beta2
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 +5 -2
- package/dist/JSXTransformer.js +634 -274
- package/dist/react-with-addons.js +5376 -4800
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +5175 -4626
- 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 +3 -0
- package/lib/CSSPropertyOperations.js +13 -13
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +16 -14
- package/lib/DOMChildrenOperations.js +10 -6
- package/lib/DOMProperty.js +82 -119
- package/lib/DOMPropertyOperations.js +78 -33
- package/lib/Danger.js +14 -16
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +8 -8
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +13 -13
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +17 -17
- package/lib/EventPropagators.js +7 -7
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +14 -5
- 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 +14 -2
- package/lib/React.js +9 -111
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +16 -5
- package/lib/ReactCSSTransitionGroupChild.js +20 -11
- package/lib/ReactChildReconciler.js +25 -18
- package/lib/ReactChildren.js +24 -22
- package/lib/ReactClass.js +68 -86
- package/lib/ReactComponent.js +22 -17
- package/lib/ReactComponentBrowserEnvironment.js +2 -4
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +3 -3
- package/lib/ReactCompositeComponent.js +80 -111
- package/lib/ReactDOM.js +72 -158
- package/lib/ReactDOMButton.js +15 -26
- package/lib/ReactDOMComponent.js +384 -62
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/ReactDOMIDOperations.js +23 -25
- package/lib/ReactDOMInput.js +83 -99
- package/lib/ReactDOMOption.js +38 -42
- package/lib/ReactDOMSelect.js +88 -98
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +24 -0
- package/lib/ReactDOMTextComponent.js +13 -13
- package/lib/ReactDOMTextarea.js +48 -61
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +34 -71
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -9
- package/lib/ReactElement.js +35 -92
- package/lib/ReactElementValidator.js +53 -130
- package/lib/ReactEmptyComponent.js +4 -4
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +3 -4
- package/lib/ReactEventListener.js +57 -12
- package/lib/ReactFragment.js +22 -17
- package/lib/ReactInjection.js +11 -11
- package/lib/ReactInputSelection.js +8 -7
- package/lib/ReactInstanceHandles.js +12 -12
- package/lib/ReactIsomorphic.js +70 -0
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +90 -89
- package/lib/ReactMultiChild.js +83 -22
- 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 +72 -33
- package/lib/ReactReconcileTransaction.js +8 -8
- package/lib/ReactReconciler.js +18 -20
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +22 -9
- package/lib/ReactServerRenderingTransaction.js +7 -7
- package/lib/ReactTestUtils.js +80 -58
- package/lib/ReactTransitionChildMapping.js +2 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +61 -36
- package/lib/ReactUpdates.js +14 -17
- package/lib/ReactWithAddons.js +14 -16
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -3
- package/lib/SelectEventPlugin.js +14 -15
- package/lib/SimpleEventPlugin.js +205 -29
- package/lib/SyntheticClipboardEvent.js +3 -3
- package/lib/SyntheticCompositionEvent.js +3 -3
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +9 -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 +16 -10
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -9
- package/lib/cloneWithProps.js +12 -7
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +47 -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 +24 -20
- 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 +210 -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/sliceChildren.js +51 -0
- package/lib/traverseAllChildren.js +24 -27
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +199 -100
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +53 -1
- 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/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/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/emptyObject.js +0 -20
- 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/isTextNode.js +0 -25
- 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,11 @@
|
|
|
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 ReactReconciler = require(
|
|
19
|
-
var ReactChildReconciler = require(
|
|
18
|
+
var ReactReconciler = require('./ReactReconciler');
|
|
19
|
+
var ReactChildReconciler = require('./ReactChildReconciler');
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Updating children of a component may trigger recursive updates. The depth is
|
|
@@ -53,14 +53,14 @@ var markupQueue = [];
|
|
|
53
53
|
* @param {number} toIndex Destination index.
|
|
54
54
|
* @private
|
|
55
55
|
*/
|
|
56
|
-
function
|
|
56
|
+
function enqueueInsertMarkup(parentID, markup, toIndex) {
|
|
57
57
|
// NOTE: Null values reduce hidden classes.
|
|
58
58
|
updateQueue.push({
|
|
59
59
|
parentID: parentID,
|
|
60
60
|
parentNode: null,
|
|
61
61
|
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
|
|
62
62
|
markupIndex: markupQueue.push(markup) - 1,
|
|
63
|
-
|
|
63
|
+
content: null,
|
|
64
64
|
fromIndex: null,
|
|
65
65
|
toIndex: toIndex
|
|
66
66
|
});
|
|
@@ -81,7 +81,7 @@ function enqueueMove(parentID, fromIndex, toIndex) {
|
|
|
81
81
|
parentNode: null,
|
|
82
82
|
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
|
|
83
83
|
markupIndex: null,
|
|
84
|
-
|
|
84
|
+
content: null,
|
|
85
85
|
fromIndex: fromIndex,
|
|
86
86
|
toIndex: toIndex
|
|
87
87
|
});
|
|
@@ -101,12 +101,32 @@ function enqueueRemove(parentID, fromIndex) {
|
|
|
101
101
|
parentNode: null,
|
|
102
102
|
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
|
|
103
103
|
markupIndex: null,
|
|
104
|
-
|
|
104
|
+
content: null,
|
|
105
105
|
fromIndex: fromIndex,
|
|
106
106
|
toIndex: null
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Enqueues setting the markup of a node.
|
|
112
|
+
*
|
|
113
|
+
* @param {string} parentID ID of the parent component.
|
|
114
|
+
* @param {string} markup Markup that renders into an element.
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
function enqueueSetMarkup(parentID, markup) {
|
|
118
|
+
// NOTE: Null values reduce hidden classes.
|
|
119
|
+
updateQueue.push({
|
|
120
|
+
parentID: parentID,
|
|
121
|
+
parentNode: null,
|
|
122
|
+
type: ReactMultiChildUpdateTypes.SET_MARKUP,
|
|
123
|
+
markupIndex: null,
|
|
124
|
+
content: markup,
|
|
125
|
+
fromIndex: null,
|
|
126
|
+
toIndex: null
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
110
130
|
/**
|
|
111
131
|
* Enqueues setting the text content.
|
|
112
132
|
*
|
|
@@ -121,7 +141,7 @@ function enqueueTextContent(parentID, textContent) {
|
|
|
121
141
|
parentNode: null,
|
|
122
142
|
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
|
|
123
143
|
markupIndex: null,
|
|
124
|
-
|
|
144
|
+
content: textContent,
|
|
125
145
|
fromIndex: null,
|
|
126
146
|
toIndex: null
|
|
127
147
|
});
|
|
@@ -209,7 +229,7 @@ var ReactMultiChild = {
|
|
|
209
229
|
// TODO: The setTextContent operation should be enough
|
|
210
230
|
for (var name in prevChildren) {
|
|
211
231
|
if (prevChildren.hasOwnProperty(name)) {
|
|
212
|
-
this.
|
|
232
|
+
this._unmountChild(prevChildren[name]);
|
|
213
233
|
}
|
|
214
234
|
}
|
|
215
235
|
// Set new text content.
|
|
@@ -227,18 +247,50 @@ var ReactMultiChild = {
|
|
|
227
247
|
}
|
|
228
248
|
},
|
|
229
249
|
|
|
250
|
+
/**
|
|
251
|
+
* Replaces any rendered children with a markup string.
|
|
252
|
+
*
|
|
253
|
+
* @param {string} nextMarkup String of markup.
|
|
254
|
+
* @internal
|
|
255
|
+
*/
|
|
256
|
+
updateMarkup: function (nextMarkup) {
|
|
257
|
+
updateDepth++;
|
|
258
|
+
var errorThrown = true;
|
|
259
|
+
try {
|
|
260
|
+
var prevChildren = this._renderedChildren;
|
|
261
|
+
// Remove any rendered children.
|
|
262
|
+
ReactChildReconciler.unmountChildren(prevChildren);
|
|
263
|
+
for (var name in prevChildren) {
|
|
264
|
+
if (prevChildren.hasOwnProperty(name)) {
|
|
265
|
+
this._unmountChildByName(prevChildren[name], name);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
this.setMarkup(nextMarkup);
|
|
269
|
+
errorThrown = false;
|
|
270
|
+
} finally {
|
|
271
|
+
updateDepth--;
|
|
272
|
+
if (!updateDepth) {
|
|
273
|
+
if (errorThrown) {
|
|
274
|
+
clearQueue();
|
|
275
|
+
} else {
|
|
276
|
+
processQueue();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
|
|
230
282
|
/**
|
|
231
283
|
* Updates the rendered children with new children.
|
|
232
284
|
*
|
|
233
|
-
* @param {?object}
|
|
285
|
+
* @param {?object} nextNestedChildrenElements Nested child element maps.
|
|
234
286
|
* @param {ReactReconcileTransaction} transaction
|
|
235
287
|
* @internal
|
|
236
288
|
*/
|
|
237
|
-
updateChildren: function (
|
|
289
|
+
updateChildren: function (nextNestedChildrenElements, transaction, context) {
|
|
238
290
|
updateDepth++;
|
|
239
291
|
var errorThrown = true;
|
|
240
292
|
try {
|
|
241
|
-
this._updateChildren(
|
|
293
|
+
this._updateChildren(nextNestedChildrenElements, transaction, context);
|
|
242
294
|
errorThrown = false;
|
|
243
295
|
} finally {
|
|
244
296
|
updateDepth--;
|
|
@@ -256,14 +308,14 @@ var ReactMultiChild = {
|
|
|
256
308
|
* Improve performance by isolating this hot code path from the try/catch
|
|
257
309
|
* block in `updateChildren`.
|
|
258
310
|
*
|
|
259
|
-
* @param {?object}
|
|
311
|
+
* @param {?object} nextNestedChildrenElements Nested child element maps.
|
|
260
312
|
* @param {ReactReconcileTransaction} transaction
|
|
261
313
|
* @final
|
|
262
314
|
* @protected
|
|
263
315
|
*/
|
|
264
|
-
_updateChildren: function (
|
|
316
|
+
_updateChildren: function (nextNestedChildrenElements, transaction, context) {
|
|
265
317
|
var prevChildren = this._renderedChildren;
|
|
266
|
-
var nextChildren = ReactChildReconciler.updateChildren(prevChildren,
|
|
318
|
+
var nextChildren = ReactChildReconciler.updateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
|
|
267
319
|
this._renderedChildren = nextChildren;
|
|
268
320
|
if (!nextChildren && !prevChildren) {
|
|
269
321
|
return;
|
|
@@ -287,7 +339,7 @@ var ReactMultiChild = {
|
|
|
287
339
|
if (prevChild) {
|
|
288
340
|
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
|
|
289
341
|
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
|
|
290
|
-
this.
|
|
342
|
+
this._unmountChild(prevChild);
|
|
291
343
|
}
|
|
292
344
|
// The child must be instantiated before it's mounted.
|
|
293
345
|
this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
|
|
@@ -297,7 +349,7 @@ var ReactMultiChild = {
|
|
|
297
349
|
// Remove children that are no longer present.
|
|
298
350
|
for (name in prevChildren) {
|
|
299
351
|
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
|
|
300
|
-
this.
|
|
352
|
+
this._unmountChild(prevChildren[name]);
|
|
301
353
|
}
|
|
302
354
|
}
|
|
303
355
|
},
|
|
@@ -339,7 +391,7 @@ var ReactMultiChild = {
|
|
|
339
391
|
* @protected
|
|
340
392
|
*/
|
|
341
393
|
createChild: function (child, mountImage) {
|
|
342
|
-
|
|
394
|
+
enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
|
|
343
395
|
},
|
|
344
396
|
|
|
345
397
|
/**
|
|
@@ -362,6 +414,16 @@ var ReactMultiChild = {
|
|
|
362
414
|
enqueueTextContent(this._rootNodeID, textContent);
|
|
363
415
|
},
|
|
364
416
|
|
|
417
|
+
/**
|
|
418
|
+
* Sets this markup string.
|
|
419
|
+
*
|
|
420
|
+
* @param {string} markup Markup to set.
|
|
421
|
+
* @protected
|
|
422
|
+
*/
|
|
423
|
+
setMarkup: function (markup) {
|
|
424
|
+
enqueueSetMarkup(this._rootNodeID, markup);
|
|
425
|
+
},
|
|
426
|
+
|
|
365
427
|
/**
|
|
366
428
|
* Mounts a child with the supplied name.
|
|
367
429
|
*
|
|
@@ -382,15 +444,14 @@ var ReactMultiChild = {
|
|
|
382
444
|
},
|
|
383
445
|
|
|
384
446
|
/**
|
|
385
|
-
* Unmounts a rendered child
|
|
447
|
+
* Unmounts a rendered child.
|
|
386
448
|
*
|
|
387
449
|
* NOTE: This is part of `updateChildren` and is here for readability.
|
|
388
450
|
*
|
|
389
451
|
* @param {ReactComponent} child Component to unmount.
|
|
390
|
-
* @param {string} name Name of the child in `this._renderedChildren`.
|
|
391
452
|
* @private
|
|
392
453
|
*/
|
|
393
|
-
|
|
454
|
+
_unmountChild: function (child) {
|
|
394
455
|
this.removeChild(child);
|
|
395
456
|
child._mountIndex = null;
|
|
396
457
|
}
|
|
@@ -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
|
-
|
|
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;
|
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
|
-
|
|
67
|
+
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to add a ref to a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : 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
|
-
|
|
81
|
+
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' + 'usually means that you\'re trying to remove a ref from a component that ' + 'doesn\'t have an owner (that is, was not created inside of another ' + 'component\'s `render` method). Try rendering this component inside of ' + 'a new top-level component which will hold the ref.') : 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('./joinClasses');
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Creates a transfer strategy that will merge prop values using the supplied
|