react 0.12.2 → 0.13.0-beta.2
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/dist/JSXTransformer.js +986 -511
- package/dist/react-with-addons.js +6076 -4560
- package/dist/react-with-addons.min.js +6 -7
- package/dist/react.js +5386 -4170
- package/dist/react.min.js +6 -7
- package/lib/AutoFocusMixin.js +2 -2
- package/lib/BeforeInputEventPlugin.js +388 -115
- package/lib/CSSCore.js +1 -1
- package/lib/CSSProperty.js +2 -2
- package/lib/CSSPropertyOperations.js +58 -11
- package/lib/CallbackQueue.js +3 -3
- package/lib/ChangeEventPlugin.js +4 -4
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +10 -47
- package/lib/DOMProperty.js +2 -2
- package/lib/DOMPropertyOperations.js +11 -16
- package/lib/Danger.js +8 -7
- package/lib/DefaultEventPluginOrder.js +3 -4
- package/lib/EnterLeaveEventPlugin.js +2 -2
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +1 -1
- package/lib/EventPluginHub.js +10 -8
- package/lib/EventPluginRegistry.js +2 -2
- package/lib/EventPluginUtils.js +4 -4
- package/lib/EventPropagators.js +2 -2
- package/lib/ExecutionEnvironment.js +3 -4
- package/lib/FallbackCompositionState.js +89 -0
- package/lib/HTMLDOMPropertyConfig.js +23 -10
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +4 -4
- package/lib/LocalEventTrapMixin.js +10 -3
- package/lib/MobileSafariClickEventPlugin.js +2 -2
- package/lib/Object.assign.js +4 -2
- package/lib/PooledClass.js +2 -2
- package/lib/React.js +19 -58
- package/lib/ReactBrowserComponentMixin.js +4 -14
- package/lib/ReactBrowserEventEmitter.js +6 -8
- package/lib/ReactCSSTransitionGroup.js +5 -2
- package/lib/ReactCSSTransitionGroupChild.js +20 -7
- package/lib/ReactChildReconciler.js +125 -0
- package/lib/ReactChildren.js +13 -10
- package/lib/ReactClass.js +918 -0
- package/lib/ReactComponent.js +98 -406
- package/lib/ReactComponentBrowserEnvironment.js +11 -84
- package/lib/ReactComponentEnvironment.js +57 -0
- package/lib/ReactComponentWithPureRenderMixin.js +2 -2
- package/lib/ReactCompositeComponent.js +574 -1140
- package/lib/ReactContext.js +17 -3
- package/lib/ReactCurrentOwner.js +2 -2
- package/lib/ReactDOM.js +4 -9
- package/lib/ReactDOMButton.js +6 -7
- package/lib/ReactDOMComponent.js +123 -105
- package/lib/ReactDOMForm.js +6 -7
- package/lib/ReactDOMIDOperations.js +59 -77
- package/lib/ReactDOMIframe.js +43 -0
- package/lib/ReactDOMImg.js +5 -7
- package/lib/ReactDOMInput.js +6 -7
- package/lib/ReactDOMOption.js +6 -7
- package/lib/ReactDOMSelect.js +58 -66
- package/lib/ReactDOMSelection.js +7 -3
- package/lib/{ReactTextComponent.js → ReactDOMTextComponent.js} +48 -37
- package/lib/ReactDOMTextarea.js +6 -7
- package/lib/ReactDefaultBatchingStrategy.js +5 -5
- package/lib/ReactDefaultInjection.js +39 -9
- package/lib/ReactDefaultPerf.js +17 -8
- package/lib/ReactDefaultPerfAnalysis.js +2 -2
- package/lib/ReactElement.js +23 -15
- package/lib/ReactElementValidator.js +206 -89
- package/lib/ReactEmptyComponent.js +33 -15
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +2 -2
- package/lib/ReactEventListener.js +4 -5
- package/lib/ReactFragment.js +172 -0
- package/lib/ReactInjection.js +8 -6
- package/lib/ReactInputSelection.js +4 -5
- package/lib/ReactInstanceHandles.js +4 -3
- package/lib/ReactInstanceMap.js +47 -0
- package/lib/ReactLifeCycle.js +35 -0
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +2 -2
- package/lib/ReactMount.js +264 -71
- package/lib/ReactMultiChild.js +50 -48
- package/lib/ReactMultiChildUpdateTypes.js +2 -2
- package/lib/ReactNativeComponent.js +59 -25
- package/lib/ReactOwner.js +5 -49
- package/lib/ReactPerf.js +22 -2
- package/lib/ReactPropTransferer.js +3 -58
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +2 -2
- package/lib/ReactPropTypes.js +17 -25
- package/lib/ReactPutListenerQueue.js +2 -2
- package/lib/ReactReconcileTransaction.js +2 -2
- package/lib/ReactReconciler.js +121 -0
- package/lib/ReactRef.js +69 -0
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerRendering.js +6 -4
- package/lib/ReactServerRenderingTransaction.js +2 -2
- package/lib/ReactStateSetters.js +2 -2
- package/lib/ReactTestUtils.js +113 -27
- package/lib/ReactTransitionChildMapping.js +8 -4
- package/lib/ReactTransitionEvents.js +2 -2
- package/lib/ReactTransitionGroup.js +53 -12
- package/lib/ReactUpdateQueue.js +295 -0
- package/lib/ReactUpdates.js +54 -62
- package/lib/ReactWithAddons.js +4 -2
- package/lib/SVGDOMPropertyConfig.js +2 -2
- package/lib/SelectEventPlugin.js +4 -4
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +4 -4
- package/lib/SyntheticClipboardEvent.js +2 -3
- package/lib/SyntheticCompositionEvent.js +2 -3
- package/lib/SyntheticDragEvent.js +2 -2
- package/lib/SyntheticEvent.js +12 -4
- package/lib/SyntheticFocusEvent.js +2 -2
- package/lib/SyntheticInputEvent.js +2 -3
- package/lib/SyntheticKeyboardEvent.js +2 -2
- package/lib/SyntheticMouseEvent.js +3 -5
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +2 -2
- package/lib/Transaction.js +4 -4
- package/lib/ViewportMetrics.js +3 -6
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +2 -2
- package/lib/camelize.js +1 -1
- package/lib/camelizeStyleName.js +1 -1
- package/lib/cloneWithProps.js +4 -4
- package/lib/containsNode.js +1 -1
- package/lib/{createArrayFrom.js → createArrayFromMixed.js} +6 -6
- package/lib/createFullPageComponent.js +4 -4
- package/lib/createNodesFromMarkup.js +4 -4
- package/lib/cx.js +1 -1
- package/lib/dangerousStyleValue.js +2 -2
- package/lib/emptyFunction.js +1 -1
- package/lib/emptyObject.js +1 -1
- package/lib/{escapeTextForBrowser.js → escapeTextContentForBrowser.js} +10 -11
- package/lib/findDOMNode.js +51 -0
- package/lib/flattenChildren.js +12 -23
- package/lib/focusNode.js +1 -1
- package/lib/forEachAccumulated.js +2 -2
- package/lib/getActiveElement.js +1 -1
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +2 -2
- package/lib/getEventModifierState.js +2 -2
- package/lib/getEventTarget.js +2 -2
- package/lib/getIteratorFn.js +42 -0
- package/lib/getMarkupWrap.js +1 -1
- package/lib/getNodeForCharacterOffset.js +3 -3
- package/lib/getReactRootElementInContainer.js +2 -2
- package/lib/getTextContentAccessor.js +2 -2
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +1 -1
- package/lib/hyphenateStyleName.js +1 -1
- package/lib/instantiateReactComponent.js +90 -68
- package/lib/invariant.js +1 -1
- package/lib/isEventSupported.js +2 -2
- package/lib/isNode.js +4 -5
- package/lib/isTextInputElement.js +3 -4
- package/lib/isTextNode.js +1 -1
- package/lib/joinClasses.js +2 -2
- package/lib/keyMirror.js +2 -2
- package/lib/keyOf.js +1 -1
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +5 -6
- package/lib/onlyChild.js +2 -2
- package/lib/performance.js +1 -1
- package/lib/performanceNow.js +1 -1
- package/lib/quoteAttributeValueForBrowser.js +26 -0
- package/lib/setInnerHTML.js +13 -2
- package/lib/setTextContent.js +40 -0
- package/lib/shallowEqual.js +2 -2
- package/lib/shouldUpdateReactComponent.js +71 -7
- package/lib/toArray.js +2 -2
- package/lib/traverseAllChildren.js +114 -56
- package/lib/update.js +2 -2
- package/lib/warning.js +20 -2
- package/package.json +1 -1
- package/lib/CompositionEventPlugin.js +0 -257
- package/lib/ReactLegacyElement.js +0 -243
- package/lib/copyProperties.js +0 -54
- package/lib/deprecated.js +0 -47
- package/lib/merge.js +0 -34
- package/lib/mergeInto.js +0 -24
- package/lib/monitorCodeUse.js +0 -30
package/lib/ReactDOMSelection.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactDOMSelection
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
15
15
|
|
|
@@ -189,7 +189,11 @@ function setModernOffsets(node, offsets) {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
var useIEOffsets =
|
|
192
|
+
var useIEOffsets = (
|
|
193
|
+
ExecutionEnvironment.canUseDOM &&
|
|
194
|
+
'selection' in document &&
|
|
195
|
+
!('getSelection' in window)
|
|
196
|
+
);
|
|
193
197
|
|
|
194
198
|
var ReactDOMSelection = {
|
|
195
199
|
/**
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule
|
|
9
|
+
* @providesModule ReactDOMTextComponent
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var DOMPropertyOperations = require("./DOMPropertyOperations");
|
|
16
|
-
var
|
|
17
|
-
|
|
16
|
+
var ReactComponentBrowserEnvironment =
|
|
17
|
+
require("./ReactComponentBrowserEnvironment");
|
|
18
|
+
var ReactDOMComponent = require("./ReactDOMComponent");
|
|
18
19
|
|
|
19
20
|
var assign = require("./Object.assign");
|
|
20
|
-
var
|
|
21
|
+
var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Text nodes violate a couple assumptions that React makes about components:
|
|
@@ -30,15 +31,29 @@ var escapeTextForBrowser = require("./escapeTextForBrowser");
|
|
|
30
31
|
*
|
|
31
32
|
* TODO: Investigate representing React components in the DOM with text nodes.
|
|
32
33
|
*
|
|
33
|
-
* @class
|
|
34
|
+
* @class ReactDOMTextComponent
|
|
34
35
|
* @extends ReactComponent
|
|
35
36
|
* @internal
|
|
36
37
|
*/
|
|
37
|
-
var
|
|
38
|
-
// This constructor and
|
|
38
|
+
var ReactDOMTextComponent = function(props) {
|
|
39
|
+
// This constructor and its argument is currently used by mocks.
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
assign(
|
|
42
|
+
assign(ReactDOMTextComponent.prototype, {
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {ReactText} text
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
construct: function(text) {
|
|
49
|
+
// TODO: This is really a ReactText (ReactNode), not a ReactElement
|
|
50
|
+
this._currentElement = text;
|
|
51
|
+
this._stringText = '' + text;
|
|
52
|
+
|
|
53
|
+
// Properties
|
|
54
|
+
this._rootNodeID = null;
|
|
55
|
+
this._mountIndex = 0;
|
|
56
|
+
},
|
|
42
57
|
|
|
43
58
|
/**
|
|
44
59
|
* Creates the markup for this text node. This node is not intended to have
|
|
@@ -46,19 +61,12 @@ assign(ReactTextComponent.prototype, ReactComponent.Mixin, {
|
|
|
46
61
|
*
|
|
47
62
|
* @param {string} rootID DOM ID of the root node.
|
|
48
63
|
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
|
49
|
-
* @param {number} mountDepth number of components in the owner hierarchy
|
|
50
64
|
* @return {string} Markup for this text node.
|
|
51
65
|
* @internal
|
|
52
66
|
*/
|
|
53
|
-
mountComponent: function(rootID, transaction,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
rootID,
|
|
57
|
-
transaction,
|
|
58
|
-
mountDepth
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
var escapedText = escapeTextForBrowser(this.props);
|
|
67
|
+
mountComponent: function(rootID, transaction, context) {
|
|
68
|
+
this._rootNodeID = rootID;
|
|
69
|
+
var escapedText = escapeTextContentForBrowser(this._stringText);
|
|
62
70
|
|
|
63
71
|
if (transaction.renderToStaticMarkup) {
|
|
64
72
|
// Normally we'd wrap this in a `span` for the reasons stated above, but
|
|
@@ -77,28 +85,31 @@ assign(ReactTextComponent.prototype, ReactComponent.Mixin, {
|
|
|
77
85
|
/**
|
|
78
86
|
* Updates this component by updating the text content.
|
|
79
87
|
*
|
|
80
|
-
* @param {
|
|
88
|
+
* @param {ReactText} nextText The next text content
|
|
81
89
|
* @param {ReactReconcileTransaction} transaction
|
|
82
90
|
* @internal
|
|
83
91
|
*/
|
|
84
|
-
receiveComponent: function(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
receiveComponent: function(nextText, transaction) {
|
|
93
|
+
if (nextText !== this._currentElement) {
|
|
94
|
+
this._currentElement = nextText;
|
|
95
|
+
var nextStringText = '' + nextText;
|
|
96
|
+
if (nextStringText !== this._stringText) {
|
|
97
|
+
// TODO: Save this as pending props and use performUpdateIfNecessary
|
|
98
|
+
// and/or updateComponent to do the actual update for consistency with
|
|
99
|
+
// other component types?
|
|
100
|
+
this._stringText = nextStringText;
|
|
101
|
+
ReactDOMComponent.BackendIDOperations.updateTextContentByID(
|
|
102
|
+
this._rootNodeID,
|
|
103
|
+
nextStringText
|
|
104
|
+
);
|
|
105
|
+
}
|
|
92
106
|
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
unmountComponent: function() {
|
|
110
|
+
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
|
|
93
111
|
}
|
|
94
112
|
|
|
95
113
|
});
|
|
96
114
|
|
|
97
|
-
|
|
98
|
-
// Bypass validation and configuration
|
|
99
|
-
return new ReactElement(ReactTextComponent, null, null, null, null, text);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
ReactTextComponentFactory.type = ReactTextComponent;
|
|
103
|
-
|
|
104
|
-
module.exports = ReactTextComponentFactory;
|
|
115
|
+
module.exports = ReactDOMTextComponent;
|
package/lib/ReactDOMTextarea.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
* @providesModule ReactDOMTextarea
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var AutoFocusMixin = require("./AutoFocusMixin");
|
|
15
15
|
var DOMPropertyOperations = require("./DOMPropertyOperations");
|
|
16
16
|
var LinkedValueUtils = require("./LinkedValueUtils");
|
|
17
17
|
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
18
|
-
var
|
|
18
|
+
var ReactClass = require("./ReactClass");
|
|
19
19
|
var ReactElement = require("./ReactElement");
|
|
20
|
-
var ReactDOM = require("./ReactDOM");
|
|
21
20
|
var ReactUpdates = require("./ReactUpdates");
|
|
22
21
|
|
|
23
22
|
var assign = require("./Object.assign");
|
|
@@ -25,8 +24,7 @@ var invariant = require("./invariant");
|
|
|
25
24
|
|
|
26
25
|
var warning = require("./warning");
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
var textarea = ReactElement.createFactory(ReactDOM.textarea.type);
|
|
27
|
+
var textarea = ReactElement.createFactory('textarea');
|
|
30
28
|
|
|
31
29
|
function forceUpdateIfMounted() {
|
|
32
30
|
/*jshint validthis:true */
|
|
@@ -50,8 +48,9 @@ function forceUpdateIfMounted() {
|
|
|
50
48
|
* The rendered element will be initialized with an empty value, the prop
|
|
51
49
|
* `defaultValue` if specified, or the children content (deprecated).
|
|
52
50
|
*/
|
|
53
|
-
var ReactDOMTextarea =
|
|
51
|
+
var ReactDOMTextarea = ReactClass.createClass({
|
|
54
52
|
displayName: 'ReactDOMTextarea',
|
|
53
|
+
tagName: 'TEXTAREA',
|
|
55
54
|
|
|
56
55
|
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
|
|
57
56
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactDefaultBatchingStrategy
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactUpdates = require("./ReactUpdates");
|
|
15
15
|
var Transaction = require("./Transaction");
|
|
@@ -54,16 +54,16 @@ var ReactDefaultBatchingStrategy = {
|
|
|
54
54
|
* Call the provided function in a context within which calls to `setState`
|
|
55
55
|
* and friends are batched such that components aren't updated unnecessarily.
|
|
56
56
|
*/
|
|
57
|
-
batchedUpdates: function(callback, a, b) {
|
|
57
|
+
batchedUpdates: function(callback, a, b, c, d) {
|
|
58
58
|
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
|
|
59
59
|
|
|
60
60
|
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
|
|
61
61
|
|
|
62
62
|
// The code is written this way to avoid extra allocations
|
|
63
63
|
if (alreadyBatchingUpdates) {
|
|
64
|
-
callback(a, b);
|
|
64
|
+
callback(a, b, c, d);
|
|
65
65
|
} else {
|
|
66
|
-
transaction.perform(callback, null, a, b);
|
|
66
|
+
transaction.perform(callback, null, a, b, c, d);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
* @providesModule ReactDefaultInjection
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var BeforeInputEventPlugin = require("./BeforeInputEventPlugin");
|
|
15
15
|
var ChangeEventPlugin = require("./ChangeEventPlugin");
|
|
16
16
|
var ClientReactRootIndex = require("./ClientReactRootIndex");
|
|
17
|
-
var CompositionEventPlugin = require("./CompositionEventPlugin");
|
|
18
17
|
var DefaultEventPluginOrder = require("./DefaultEventPluginOrder");
|
|
19
18
|
var EnterLeaveEventPlugin = require("./EnterLeaveEventPlugin");
|
|
20
19
|
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
21
20
|
var HTMLDOMPropertyConfig = require("./HTMLDOMPropertyConfig");
|
|
22
21
|
var MobileSafariClickEventPlugin = require("./MobileSafariClickEventPlugin");
|
|
23
22
|
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
|
|
23
|
+
var ReactClass = require("./ReactClass");
|
|
24
24
|
var ReactComponentBrowserEnvironment =
|
|
25
25
|
require("./ReactComponentBrowserEnvironment");
|
|
26
26
|
var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy");
|
|
@@ -28,14 +28,19 @@ var ReactDOMComponent = require("./ReactDOMComponent");
|
|
|
28
28
|
var ReactDOMButton = require("./ReactDOMButton");
|
|
29
29
|
var ReactDOMForm = require("./ReactDOMForm");
|
|
30
30
|
var ReactDOMImg = require("./ReactDOMImg");
|
|
31
|
+
var ReactDOMIDOperations = require("./ReactDOMIDOperations");
|
|
32
|
+
var ReactDOMIframe = require("./ReactDOMIframe");
|
|
31
33
|
var ReactDOMInput = require("./ReactDOMInput");
|
|
32
34
|
var ReactDOMOption = require("./ReactDOMOption");
|
|
33
35
|
var ReactDOMSelect = require("./ReactDOMSelect");
|
|
34
36
|
var ReactDOMTextarea = require("./ReactDOMTextarea");
|
|
37
|
+
var ReactDOMTextComponent = require("./ReactDOMTextComponent");
|
|
38
|
+
var ReactElement = require("./ReactElement");
|
|
35
39
|
var ReactEventListener = require("./ReactEventListener");
|
|
36
40
|
var ReactInjection = require("./ReactInjection");
|
|
37
41
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
38
42
|
var ReactMount = require("./ReactMount");
|
|
43
|
+
var ReactReconcileTransaction = require("./ReactReconcileTransaction");
|
|
39
44
|
var SelectEventPlugin = require("./SelectEventPlugin");
|
|
40
45
|
var ServerReactRootIndex = require("./ServerReactRootIndex");
|
|
41
46
|
var SimpleEventPlugin = require("./SimpleEventPlugin");
|
|
@@ -43,6 +48,22 @@ var SVGDOMPropertyConfig = require("./SVGDOMPropertyConfig");
|
|
|
43
48
|
|
|
44
49
|
var createFullPageComponent = require("./createFullPageComponent");
|
|
45
50
|
|
|
51
|
+
function autoGenerateWrapperClass(type) {
|
|
52
|
+
return ReactClass.createClass({
|
|
53
|
+
tagName: type.toUpperCase(),
|
|
54
|
+
render: function() {
|
|
55
|
+
return new ReactElement(
|
|
56
|
+
type,
|
|
57
|
+
null,
|
|
58
|
+
null,
|
|
59
|
+
null,
|
|
60
|
+
null,
|
|
61
|
+
this.props
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
46
67
|
function inject() {
|
|
47
68
|
ReactInjection.EventEmitter.injectReactEventListener(
|
|
48
69
|
ReactEventListener
|
|
@@ -63,7 +84,6 @@ function inject() {
|
|
|
63
84
|
SimpleEventPlugin: SimpleEventPlugin,
|
|
64
85
|
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
|
|
65
86
|
ChangeEventPlugin: ChangeEventPlugin,
|
|
66
|
-
CompositionEventPlugin: CompositionEventPlugin,
|
|
67
87
|
MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
|
|
68
88
|
SelectEventPlugin: SelectEventPlugin,
|
|
69
89
|
BeforeInputEventPlugin: BeforeInputEventPlugin
|
|
@@ -73,9 +93,22 @@ function inject() {
|
|
|
73
93
|
ReactDOMComponent
|
|
74
94
|
);
|
|
75
95
|
|
|
96
|
+
ReactInjection.NativeComponent.injectTextComponentClass(
|
|
97
|
+
ReactDOMTextComponent
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
ReactInjection.NativeComponent.injectAutoWrapper(
|
|
101
|
+
autoGenerateWrapperClass
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
// This needs to happen before createFullPageComponent() otherwise the mixin
|
|
105
|
+
// won't be included.
|
|
106
|
+
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
|
|
107
|
+
|
|
76
108
|
ReactInjection.NativeComponent.injectComponentClasses({
|
|
77
109
|
'button': ReactDOMButton,
|
|
78
110
|
'form': ReactDOMForm,
|
|
111
|
+
'iframe': ReactDOMIframe,
|
|
79
112
|
'img': ReactDOMImg,
|
|
80
113
|
'input': ReactDOMInput,
|
|
81
114
|
'option': ReactDOMOption,
|
|
@@ -87,17 +120,13 @@ function inject() {
|
|
|
87
120
|
'body': createFullPageComponent('body')
|
|
88
121
|
});
|
|
89
122
|
|
|
90
|
-
// This needs to happen after createFullPageComponent() otherwise the mixin
|
|
91
|
-
// gets double injected.
|
|
92
|
-
ReactInjection.CompositeComponent.injectMixin(ReactBrowserComponentMixin);
|
|
93
|
-
|
|
94
123
|
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
|
|
95
124
|
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
|
|
96
125
|
|
|
97
126
|
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
|
|
98
127
|
|
|
99
128
|
ReactInjection.Updates.injectReconcileTransaction(
|
|
100
|
-
|
|
129
|
+
ReactReconcileTransaction
|
|
101
130
|
);
|
|
102
131
|
ReactInjection.Updates.injectBatchingStrategy(
|
|
103
132
|
ReactDefaultBatchingStrategy
|
|
@@ -110,6 +139,7 @@ function inject() {
|
|
|
110
139
|
);
|
|
111
140
|
|
|
112
141
|
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
|
|
142
|
+
ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
|
|
113
143
|
|
|
114
144
|
if ("production" !== process.env.NODE_ENV) {
|
|
115
145
|
var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
|
package/lib/ReactDefaultPerf.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var DOMProperty = require("./DOMProperty");
|
|
16
16
|
var ReactDefaultPerfAnalysis = require("./ReactDefaultPerfAnalysis");
|
|
@@ -169,7 +169,7 @@ var ReactDefaultPerf = {
|
|
|
169
169
|
rv = func.apply(this, args);
|
|
170
170
|
totalTime = performanceNow() - start;
|
|
171
171
|
|
|
172
|
-
if (fnName === '
|
|
172
|
+
if (fnName === '_mountImageIntoNode') {
|
|
173
173
|
var mountID = ReactMount.getID(args[1]);
|
|
174
174
|
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
|
|
175
175
|
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
|
|
@@ -206,9 +206,9 @@ var ReactDefaultPerf = {
|
|
|
206
206
|
}
|
|
207
207
|
return rv;
|
|
208
208
|
} else if (moduleName === 'ReactCompositeComponent' && (
|
|
209
|
-
|
|
210
|
-
fnName === '
|
|
211
|
-
fnName === '_renderValidatedComponent')) {
|
|
209
|
+
(// TODO: receiveComponent()?
|
|
210
|
+
(fnName === 'mountComponent' ||
|
|
211
|
+
fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
|
|
212
212
|
|
|
213
213
|
var rootNodeID = fnName === 'mountComponent' ?
|
|
214
214
|
args[0] :
|
|
@@ -242,9 +242,18 @@ var ReactDefaultPerf = {
|
|
|
242
242
|
addValue(entry.inclusive, rootNodeID, totalTime);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
var displayName = null;
|
|
246
|
+
if (this._instance.constructor.displayName) {
|
|
247
|
+
displayName = this._instance.constructor.displayName;
|
|
248
|
+
} else if (this._currentElement.type) {
|
|
249
|
+
displayName = this._currentElement.type;
|
|
250
|
+
}
|
|
251
|
+
|
|
245
252
|
entry.displayNames[rootNodeID] = {
|
|
246
|
-
current:
|
|
247
|
-
owner: this._owner ?
|
|
253
|
+
current: displayName,
|
|
254
|
+
owner: this._currentElement._owner ?
|
|
255
|
+
this._currentElement._owner._instance.constructor.displayName :
|
|
256
|
+
'<root>'
|
|
248
257
|
};
|
|
249
258
|
|
|
250
259
|
return rv;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -14,7 +14,7 @@ var assign = require("./Object.assign");
|
|
|
14
14
|
// Don't try to save users less than 1.2ms (a number I made up)
|
|
15
15
|
var DONT_CARE_THRESHOLD = 1.2;
|
|
16
16
|
var DOM_OPERATION_TYPES = {
|
|
17
|
-
'
|
|
17
|
+
'_mountImageIntoNode': 'set innerHTML',
|
|
18
18
|
INSERT_MARKUP: 'set innerHTML',
|
|
19
19
|
MOVE_EXISTING: 'move',
|
|
20
20
|
REMOVE_NODE: 'remove',
|
package/lib/ReactElement.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2014, Facebook, Inc.
|
|
2
|
+
* Copyright 2014-2015, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
* @providesModule ReactElement
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactContext = require("./ReactContext");
|
|
15
15
|
var ReactCurrentOwner = require("./ReactCurrentOwner");
|
|
16
16
|
|
|
17
|
+
var assign = require("./Object.assign");
|
|
17
18
|
var warning = require("./warning");
|
|
18
19
|
|
|
19
20
|
var RESERVED_PROPS = {
|
|
@@ -44,8 +45,9 @@ function defineWarningProperty(object, key) {
|
|
|
44
45
|
set: function(value) {
|
|
45
46
|
("production" !== process.env.NODE_ENV ? warning(
|
|
46
47
|
false,
|
|
47
|
-
'Don\'t set the
|
|
48
|
-
'
|
|
48
|
+
'Don\'t set the %s property of the React element. Instead, ' +
|
|
49
|
+
'specify the correct value when initially creating the element.',
|
|
50
|
+
key
|
|
49
51
|
) : null);
|
|
50
52
|
this._store[key] = value;
|
|
51
53
|
}
|
|
@@ -106,7 +108,21 @@ var ReactElement = function(type, key, ref, owner, context, props) {
|
|
|
106
108
|
// an external backing store so that we can freeze the whole object.
|
|
107
109
|
// This can be replaced with a WeakMap once they are implemented in
|
|
108
110
|
// commonly used development environments.
|
|
109
|
-
this._store = {
|
|
111
|
+
this._store = { props: props, originalProps: assign({}, props) };
|
|
112
|
+
|
|
113
|
+
// To make comparing ReactElements easier for testing purposes, we make
|
|
114
|
+
// the validation flag non-enumerable (where possible, which should
|
|
115
|
+
// include every environment we run tests in), so the test framework
|
|
116
|
+
// ignores it.
|
|
117
|
+
try {
|
|
118
|
+
Object.defineProperty(this._store, 'validated', {
|
|
119
|
+
configurable: false,
|
|
120
|
+
enumerable: false,
|
|
121
|
+
writable: true
|
|
122
|
+
});
|
|
123
|
+
} catch (x) {
|
|
124
|
+
}
|
|
125
|
+
this._store.validated = false;
|
|
110
126
|
|
|
111
127
|
// We're not allowed to set props directly on the object so we early
|
|
112
128
|
// return and rely on the prototype membrane to forward to the backing
|
|
@@ -141,16 +157,7 @@ ReactElement.createElement = function(type, config, children) {
|
|
|
141
157
|
|
|
142
158
|
if (config != null) {
|
|
143
159
|
ref = config.ref === undefined ? null : config.ref;
|
|
144
|
-
|
|
145
|
-
("production" !== process.env.NODE_ENV ? warning(
|
|
146
|
-
config.key !== null,
|
|
147
|
-
'createElement(...): Encountered component with a `key` of null. In ' +
|
|
148
|
-
'a future version, this will be treated as equivalent to the string ' +
|
|
149
|
-
'\'null\'; instead, provide an explicit key or use undefined.'
|
|
150
|
-
) : null);
|
|
151
|
-
}
|
|
152
|
-
// TODO: Change this back to `config.key === undefined`
|
|
153
|
-
key = config.key == null ? null : '' + config.key;
|
|
160
|
+
key = config.key === undefined ? null : '' + config.key;
|
|
154
161
|
// Remaining properties are added to a new props object
|
|
155
162
|
for (propName in config) {
|
|
156
163
|
if (config.hasOwnProperty(propName) &&
|
|
@@ -199,6 +206,7 @@ ReactElement.createFactory = function(type) {
|
|
|
199
206
|
// easily accessed on elements. E.g. <Foo />.type === Foo.type.
|
|
200
207
|
// This should not be named `constructor` since this may not be the function
|
|
201
208
|
// that created the element, and it may not even be a constructor.
|
|
209
|
+
// Legacy hook TODO: Warn if this is accessed
|
|
202
210
|
factory.type = type;
|
|
203
211
|
return factory;
|
|
204
212
|
};
|