react 0.9.0 → 0.10.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/lib/AutoFocusMixin.js +3 -1
- package/lib/DOMChildrenOperations.js +12 -6
- package/lib/DOMProperty.js +6 -4
- package/lib/DOMPropertyOperations.js +6 -6
- package/lib/DefaultDOMPropertyConfig.js +5 -12
- package/lib/EventPluginHub.js +2 -0
- package/lib/LinkedValueUtils.js +22 -23
- package/lib/React.js +3 -1
- package/lib/ReactBrowserComponentMixin.js +42 -0
- package/lib/ReactCSSTransitionGroup.js +10 -10
- package/lib/ReactComponent.js +76 -31
- package/lib/ReactComponentBrowserEnvironment.js +1 -35
- package/lib/ReactCompositeComponent.js +199 -67
- package/lib/ReactDOM.js +5 -5
- package/lib/ReactDOMButton.js +2 -1
- package/lib/ReactDOMComponent.js +22 -5
- package/lib/ReactDOMForm.js +3 -0
- package/lib/ReactDOMImg.js +3 -0
- package/lib/ReactDOMInput.js +2 -1
- package/lib/ReactDOMOption.js +11 -7
- package/lib/ReactDOMSelect.js +2 -1
- package/lib/ReactDOMTextarea.js +7 -3
- package/lib/ReactDefaultInjection.js +10 -0
- package/lib/ReactInjection.js +4 -0
- package/lib/ReactInputSelection.js +2 -1
- package/lib/ReactMount.js +13 -5
- package/lib/ReactMultiChild.js +10 -3
- package/lib/ReactOwner.js +6 -1
- package/lib/ReactPropTransferer.js +1 -1
- package/lib/ReactReconcileTransaction.js +7 -6
- package/lib/ReactServerRendering.js +38 -8
- package/lib/ReactServerRenderingTransaction.js +116 -0
- package/lib/ReactTextComponent.js +24 -2
- package/lib/ReactWithAddons.js +3 -1
- package/lib/cloneWithProps.js +7 -7
- package/lib/{ReactComponentEnvironment.js → emptyObject.js} +6 -5
- package/lib/focusNode.js +33 -0
- package/lib/instantiateReactComponent.js +70 -0
- package/lib/isNode.js +1 -1
- package/lib/monitorCodeUse.js +37 -0
- package/lib/shouldUpdateReactComponent.js +17 -14
- package/lib/traverseAllChildren.js +2 -1
- package/lib/update.js +159 -0
- package/package.json +1 -1
package/lib/AutoFocusMixin.js
CHANGED
|
@@ -57,18 +57,24 @@ function insertChildAt(parentNode, childNode, index) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* Sets the text content of `node` to `text`.
|
|
62
|
-
*
|
|
63
|
-
* @param {DOMElement} node Node to change
|
|
64
|
-
* @param {string} text New text content
|
|
65
|
-
*/
|
|
66
60
|
var updateTextContent;
|
|
67
61
|
if (textContentAccessor === 'textContent') {
|
|
62
|
+
/**
|
|
63
|
+
* Sets the text content of `node` to `text`.
|
|
64
|
+
*
|
|
65
|
+
* @param {DOMElement} node Node to change
|
|
66
|
+
* @param {string} text New text content
|
|
67
|
+
*/
|
|
68
68
|
updateTextContent = function(node, text) {
|
|
69
69
|
node.textContent = text;
|
|
70
70
|
};
|
|
71
71
|
} else {
|
|
72
|
+
/**
|
|
73
|
+
* Sets the text content of `node` to `text`.
|
|
74
|
+
*
|
|
75
|
+
* @param {DOMElement} node Node to change
|
|
76
|
+
* @param {string} text New text content
|
|
77
|
+
*/
|
|
72
78
|
updateTextContent = function(node, text) {
|
|
73
79
|
// In order to preserve newlines correctly, we can't use .innerText to set
|
|
74
80
|
// the contents (see #1080), so we empty the element then append a text node
|
package/lib/DOMProperty.js
CHANGED
|
@@ -234,11 +234,13 @@ var DOMProperty = {
|
|
|
234
234
|
* @method
|
|
235
235
|
*/
|
|
236
236
|
isCustomAttribute: function(attributeName) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
|
|
238
|
+
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
|
|
239
|
+
if (isCustomAttributeFn(attributeName)) {
|
|
240
|
+
return true;
|
|
240
241
|
}
|
|
241
|
-
|
|
242
|
+
}
|
|
243
|
+
return false;
|
|
242
244
|
},
|
|
243
245
|
|
|
244
246
|
/**
|
|
@@ -23,6 +23,7 @@ var DOMProperty = require("./DOMProperty");
|
|
|
23
23
|
|
|
24
24
|
var escapeTextForBrowser = require("./escapeTextForBrowser");
|
|
25
25
|
var memoizeStringOnly = require("./memoizeStringOnly");
|
|
26
|
+
var warning = require("./warning");
|
|
26
27
|
|
|
27
28
|
function shouldIgnoreValue(name, value) {
|
|
28
29
|
return value == null ||
|
|
@@ -57,11 +58,10 @@ if ("production" !== process.env.NODE_ENV) {
|
|
|
57
58
|
|
|
58
59
|
// For now, only warn when we have a suggested correction. This prevents
|
|
59
60
|
// logging too much when using transferPropsTo.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
61
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
62
|
+
standardName == null,
|
|
63
|
+
'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?'
|
|
64
|
+
) : null);
|
|
65
65
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
@@ -162,7 +162,7 @@ var DOMPropertyOperations = {
|
|
|
162
162
|
var propName = DOMProperty.getPropertyName[name];
|
|
163
163
|
var defaultValue = DOMProperty.getDefaultValueForProperty(
|
|
164
164
|
node.nodeName,
|
|
165
|
-
|
|
165
|
+
propName
|
|
166
166
|
);
|
|
167
167
|
if (!DOMProperty.hasSideEffects[name] ||
|
|
168
168
|
node[propName] !== defaultValue) {
|
|
@@ -114,6 +114,7 @@ var DefaultDOMPropertyConfig = {
|
|
|
114
114
|
spellCheck: null,
|
|
115
115
|
src: null,
|
|
116
116
|
srcDoc: MUST_USE_PROPERTY,
|
|
117
|
+
srcSet: null,
|
|
117
118
|
step: null,
|
|
118
119
|
style: null,
|
|
119
120
|
tabIndex: null,
|
|
@@ -153,6 +154,7 @@ var DefaultDOMPropertyConfig = {
|
|
|
153
154
|
stroke: MUST_USE_ATTRIBUTE,
|
|
154
155
|
strokeLinecap: MUST_USE_ATTRIBUTE,
|
|
155
156
|
strokeWidth: MUST_USE_ATTRIBUTE,
|
|
157
|
+
textAnchor: MUST_USE_ATTRIBUTE,
|
|
156
158
|
transform: MUST_USE_ATTRIBUTE,
|
|
157
159
|
version: MUST_USE_ATTRIBUTE,
|
|
158
160
|
viewBox: MUST_USE_ATTRIBUTE,
|
|
@@ -173,6 +175,7 @@ var DefaultDOMPropertyConfig = {
|
|
|
173
175
|
stopOpacity: 'stop-opacity',
|
|
174
176
|
strokeLinecap: 'stroke-linecap',
|
|
175
177
|
strokeWidth: 'stroke-width',
|
|
178
|
+
textAnchor: 'text-anchor',
|
|
176
179
|
viewBox: 'viewBox'
|
|
177
180
|
},
|
|
178
181
|
DOMPropertyNames: {
|
|
@@ -185,18 +188,8 @@ var DefaultDOMPropertyConfig = {
|
|
|
185
188
|
hrefLang: 'hreflang',
|
|
186
189
|
radioGroup: 'radiogroup',
|
|
187
190
|
spellCheck: 'spellcheck',
|
|
188
|
-
srcDoc: 'srcdoc'
|
|
189
|
-
|
|
190
|
-
DOMMutationMethods: {
|
|
191
|
-
/**
|
|
192
|
-
* Setting `className` to null may cause it to be set to the string "null".
|
|
193
|
-
*
|
|
194
|
-
* @param {DOMElement} node
|
|
195
|
-
* @param {*} value
|
|
196
|
-
*/
|
|
197
|
-
className: function(node, value) {
|
|
198
|
-
node.className = value || '';
|
|
199
|
-
}
|
|
191
|
+
srcDoc: 'srcdoc',
|
|
192
|
+
srcSet: 'srcset'
|
|
200
193
|
}
|
|
201
194
|
};
|
|
202
195
|
|
package/lib/EventPluginHub.js
CHANGED
|
@@ -26,6 +26,7 @@ var accumulate = require("./accumulate");
|
|
|
26
26
|
var forEachAccumulated = require("./forEachAccumulated");
|
|
27
27
|
var invariant = require("./invariant");
|
|
28
28
|
var isEventSupported = require("./isEventSupported");
|
|
29
|
+
var monitorCodeUse = require("./monitorCodeUse");
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Internal store for event listeners
|
|
@@ -168,6 +169,7 @@ var EventPluginHub = {
|
|
|
168
169
|
// bubble.
|
|
169
170
|
if (registrationName === 'onScroll' &&
|
|
170
171
|
!isEventSupported('scroll', true)) {
|
|
172
|
+
monitorCodeUse('react_no_scroll_event');
|
|
171
173
|
console.warn('This browser doesn\'t support the `onScroll` event');
|
|
172
174
|
}
|
|
173
175
|
}
|
package/lib/LinkedValueUtils.js
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
var ReactPropTypes = require("./ReactPropTypes");
|
|
23
23
|
|
|
24
24
|
var invariant = require("./invariant");
|
|
25
|
+
var warning = require("./warning");
|
|
25
26
|
|
|
26
27
|
var hasReadOnlyValue = {
|
|
27
28
|
'button': true,
|
|
@@ -84,33 +85,31 @@ var LinkedValueUtils = {
|
|
|
84
85
|
propTypes: {
|
|
85
86
|
value: function(props, propName, componentName) {
|
|
86
87
|
if ("production" !== process.env.NODE_ENV) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
88
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
89
|
+
!props[propName] ||
|
|
90
|
+
hasReadOnlyValue[props.type] ||
|
|
91
|
+
props.onChange ||
|
|
92
|
+
props.readOnly ||
|
|
93
|
+
props.disabled,
|
|
94
|
+
'You provided a `value` prop to a form field without an ' +
|
|
95
|
+
'`onChange` handler. This will render a read-only field. If ' +
|
|
96
|
+
'the field should be mutable use `defaultValue`. Otherwise, ' +
|
|
97
|
+
'set either `onChange` or `readOnly`.'
|
|
98
|
+
) : null);
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
checked: function(props, propName, componentName) {
|
|
102
102
|
if ("production" !== process.env.NODE_ENV) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
103
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
104
|
+
!props[propName] ||
|
|
105
|
+
props.onChange ||
|
|
106
|
+
props.readOnly ||
|
|
107
|
+
props.disabled,
|
|
108
|
+
'You provided a `checked` prop to a form field without an ' +
|
|
109
|
+
'`onChange` handler. This will render a read-only field. If ' +
|
|
110
|
+
'the field should be mutable use `defaultChecked`. Otherwise, ' +
|
|
111
|
+
'set either `onChange` or `readOnly`.'
|
|
112
|
+
) : null);
|
|
114
113
|
}
|
|
115
114
|
},
|
|
116
115
|
onChange: ReactPropTypes.func
|
package/lib/React.js
CHANGED
|
@@ -60,6 +60,8 @@ var React = {
|
|
|
60
60
|
ReactMount.renderComponent
|
|
61
61
|
),
|
|
62
62
|
renderComponentToString: ReactServerRendering.renderComponentToString,
|
|
63
|
+
renderComponentToStaticMarkup:
|
|
64
|
+
ReactServerRendering.renderComponentToStaticMarkup,
|
|
63
65
|
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
|
|
64
66
|
isValidClass: ReactCompositeComponent.isValidClass,
|
|
65
67
|
isValidComponent: ReactComponent.isValidComponent,
|
|
@@ -90,6 +92,6 @@ if ("production" !== process.env.NODE_ENV) {
|
|
|
90
92
|
|
|
91
93
|
// Version exists only in the open-source version of React, not in Facebook's
|
|
92
94
|
// internal version.
|
|
93
|
-
React.version = '0.
|
|
95
|
+
React.version = '0.10.0-rc1';
|
|
94
96
|
|
|
95
97
|
module.exports = React;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
* @providesModule ReactBrowserComponentMixin
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
"use strict";
|
|
20
|
+
|
|
21
|
+
var ReactMount = require("./ReactMount");
|
|
22
|
+
|
|
23
|
+
var invariant = require("./invariant");
|
|
24
|
+
|
|
25
|
+
var ReactBrowserComponentMixin = {
|
|
26
|
+
/**
|
|
27
|
+
* Returns the DOM node rendered by this component.
|
|
28
|
+
*
|
|
29
|
+
* @return {DOMElement} The root node of this component.
|
|
30
|
+
* @final
|
|
31
|
+
* @protected
|
|
32
|
+
*/
|
|
33
|
+
getDOMNode: function() {
|
|
34
|
+
("production" !== process.env.NODE_ENV ? invariant(
|
|
35
|
+
this.isMounted(),
|
|
36
|
+
'getDOMNode(): A component must be mounted to have a DOM node.'
|
|
37
|
+
) : invariant(this.isMounted()));
|
|
38
|
+
return ReactMount.getNode(this._rootNodeID);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
module.exports = ReactBrowserComponentMixin;
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @typechecks
|
|
17
17
|
* @providesModule ReactCSSTransitionGroup
|
|
18
|
-
* @jsx React.DOM
|
|
19
18
|
*/
|
|
20
19
|
|
|
21
20
|
"use strict";
|
|
@@ -25,7 +24,7 @@ var React = require("./React");
|
|
|
25
24
|
var ReactTransitionGroup = require("./ReactTransitionGroup");
|
|
26
25
|
var ReactCSSTransitionGroupChild = require("./ReactCSSTransitionGroupChild");
|
|
27
26
|
|
|
28
|
-
var ReactCSSTransitionGroup = React.createClass({
|
|
27
|
+
var ReactCSSTransitionGroup = React.createClass({
|
|
29
28
|
propTypes: {
|
|
30
29
|
transitionName: React.PropTypes.string.isRequired,
|
|
31
30
|
transitionEnter: React.PropTypes.bool,
|
|
@@ -43,19 +42,20 @@ var ReactCSSTransitionGroup = React.createClass({displayName: 'ReactCSSTransitio
|
|
|
43
42
|
// We need to provide this childFactory so that
|
|
44
43
|
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
|
|
45
44
|
// leave while it is leaving.
|
|
46
|
-
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
enter:this.props.transitionEnter,
|
|
50
|
-
leave:this.props.transitionLeave
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
return ReactCSSTransitionGroupChild(
|
|
46
|
+
{
|
|
47
|
+
name: this.props.transitionName,
|
|
48
|
+
enter: this.props.transitionEnter,
|
|
49
|
+
leave: this.props.transitionLeave
|
|
50
|
+
},
|
|
51
|
+
child
|
|
53
52
|
);
|
|
54
53
|
},
|
|
55
54
|
|
|
56
55
|
render: function() {
|
|
57
56
|
return this.transferPropsTo(
|
|
58
|
-
ReactTransitionGroup(
|
|
57
|
+
ReactTransitionGroup(
|
|
58
|
+
{childFactory: this._wrapChild},
|
|
59
59
|
this.props.children
|
|
60
60
|
)
|
|
61
61
|
);
|
package/lib/ReactComponent.js
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
"use strict";
|
|
20
20
|
|
|
21
|
-
var ReactComponentEnvironment = require("./ReactComponentEnvironment");
|
|
22
21
|
var ReactCurrentOwner = require("./ReactCurrentOwner");
|
|
23
22
|
var ReactOwner = require("./ReactOwner");
|
|
24
23
|
var ReactUpdates = require("./ReactUpdates");
|
|
@@ -26,6 +25,7 @@ var ReactUpdates = require("./ReactUpdates");
|
|
|
26
25
|
var invariant = require("./invariant");
|
|
27
26
|
var keyMirror = require("./keyMirror");
|
|
28
27
|
var merge = require("./merge");
|
|
28
|
+
var monitorCodeUse = require("./monitorCodeUse");
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Every React component is in one of these life cycles.
|
|
@@ -50,9 +50,32 @@ var ComponentLifeCycle = keyMirror({
|
|
|
50
50
|
|
|
51
51
|
var ownerHasExplicitKeyWarning = {};
|
|
52
52
|
var ownerHasPropertyWarning = {};
|
|
53
|
+
var ownerHasMonitoredObjectMap = {};
|
|
53
54
|
|
|
54
55
|
var NUMERIC_PROPERTY_REGEX = /^\d+$/;
|
|
55
56
|
|
|
57
|
+
var injected = false;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Optionally injectable environment dependent cleanup hook. (server vs.
|
|
61
|
+
* browser etc). Example: A browser system caches DOM nodes based on component
|
|
62
|
+
* ID and must remove that cache entry when this instance is unmounted.
|
|
63
|
+
*
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
66
|
+
var unmountIDFromEnvironment = null;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The "image" of a component tree, is the platform specific (typically
|
|
70
|
+
* serialized) data that represents a tree of lower level UI building blocks.
|
|
71
|
+
* On the web, this "image" is HTML markup which describes a construction of
|
|
72
|
+
* low level `div` and `span` nodes. Other platforms may have different
|
|
73
|
+
* encoding of this "image". This must be injected.
|
|
74
|
+
*
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
var mountImageIntoNode = null;
|
|
78
|
+
|
|
56
79
|
/**
|
|
57
80
|
* Warn if the component doesn't have an explicit key assigned to it.
|
|
58
81
|
* This component is in an array. The array could grow and shrink or be
|
|
@@ -82,9 +105,11 @@ function validateExplicitKey(component) {
|
|
|
82
105
|
|
|
83
106
|
var message = 'Each child in an array should have a unique "key" prop. ' +
|
|
84
107
|
'Check the render method of ' + currentName + '.';
|
|
108
|
+
|
|
109
|
+
var childOwnerName = null;
|
|
85
110
|
if (!component.isOwnedBy(ReactCurrentOwner.current)) {
|
|
86
111
|
// Name of the component that originally created this child.
|
|
87
|
-
|
|
112
|
+
childOwnerName =
|
|
88
113
|
component._owner &&
|
|
89
114
|
component._owner.constructor.displayName;
|
|
90
115
|
|
|
@@ -95,6 +120,10 @@ function validateExplicitKey(component) {
|
|
|
95
120
|
}
|
|
96
121
|
|
|
97
122
|
message += ' See http://fb.me/react-warning-keys for more information.';
|
|
123
|
+
monitorCodeUse('react_key_warning', {
|
|
124
|
+
component: currentName,
|
|
125
|
+
componentOwner: childOwnerName
|
|
126
|
+
});
|
|
98
127
|
console.warn(message);
|
|
99
128
|
}
|
|
100
129
|
|
|
@@ -115,6 +144,7 @@ function validatePropertyKey(name) {
|
|
|
115
144
|
}
|
|
116
145
|
ownerHasPropertyWarning[currentName] = true;
|
|
117
146
|
|
|
147
|
+
monitorCodeUse('react_numeric_key_warning');
|
|
118
148
|
console.warn(
|
|
119
149
|
'Child objects should have non-numeric keys so ordering is preserved. ' +
|
|
120
150
|
'Check the render method of ' + currentName + '. ' +
|
|
@@ -123,6 +153,25 @@ function validatePropertyKey(name) {
|
|
|
123
153
|
}
|
|
124
154
|
}
|
|
125
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Log that we're using an object map. We're considering deprecating this
|
|
158
|
+
* feature and replace it with proper Map and ImmutableMap data structures.
|
|
159
|
+
*
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
function monitorUseOfObjectMap() {
|
|
163
|
+
// Name of the component whose render method tried to pass children.
|
|
164
|
+
// We only use this to avoid spewing the logs. We lose additional
|
|
165
|
+
// owner stacks but hopefully one level is enough to trace the source.
|
|
166
|
+
var currentName = (ReactCurrentOwner.current &&
|
|
167
|
+
ReactCurrentOwner.current.constructor.displayName) || '';
|
|
168
|
+
if (ownerHasMonitoredObjectMap.hasOwnProperty(currentName)) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
ownerHasMonitoredObjectMap[currentName] = true;
|
|
172
|
+
monitorCodeUse('react_object_map_children');
|
|
173
|
+
}
|
|
174
|
+
|
|
126
175
|
/**
|
|
127
176
|
* Ensure that every component either is passed in a static location, in an
|
|
128
177
|
* array with an explicit keys property defined, or in an object literal
|
|
@@ -144,6 +193,7 @@ function validateChildKeys(component) {
|
|
|
144
193
|
// This component was passed in a valid location.
|
|
145
194
|
component.__keyValidated__ = true;
|
|
146
195
|
} else if (component && typeof component === 'object') {
|
|
196
|
+
monitorUseOfObjectMap();
|
|
147
197
|
for (var name in component) {
|
|
148
198
|
validatePropertyKey(name, component);
|
|
149
199
|
}
|
|
@@ -177,6 +227,23 @@ function validateChildKeys(component) {
|
|
|
177
227
|
*/
|
|
178
228
|
var ReactComponent = {
|
|
179
229
|
|
|
230
|
+
injection: {
|
|
231
|
+
injectEnvironment: function(ReactComponentEnvironment) {
|
|
232
|
+
("production" !== process.env.NODE_ENV ? invariant(
|
|
233
|
+
!injected,
|
|
234
|
+
'ReactComponent: injectEnvironment() can only be called once.'
|
|
235
|
+
) : invariant(!injected));
|
|
236
|
+
mountImageIntoNode = ReactComponentEnvironment.mountImageIntoNode;
|
|
237
|
+
unmountIDFromEnvironment =
|
|
238
|
+
ReactComponentEnvironment.unmountIDFromEnvironment;
|
|
239
|
+
ReactComponent.BackendIDOperations =
|
|
240
|
+
ReactComponentEnvironment.BackendIDOperations;
|
|
241
|
+
ReactComponent.ReactReconcileTransaction =
|
|
242
|
+
ReactComponentEnvironment.ReactReconcileTransaction;
|
|
243
|
+
injected = true;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
|
|
180
247
|
/**
|
|
181
248
|
* @param {?object} object
|
|
182
249
|
* @return {boolean} True if `object` is a valid component.
|
|
@@ -209,27 +276,7 @@ var ReactComponent = {
|
|
|
209
276
|
*
|
|
210
277
|
* @internal
|
|
211
278
|
*/
|
|
212
|
-
BackendIDOperations:
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Optionally injectable environment dependent cleanup hook. (server vs.
|
|
216
|
-
* browser etc). Example: A browser system caches DOM nodes based on component
|
|
217
|
-
* ID and must remove that cache entry when this instance is unmounted.
|
|
218
|
-
*
|
|
219
|
-
* @private
|
|
220
|
-
*/
|
|
221
|
-
unmountIDFromEnvironment: ReactComponentEnvironment.unmountIDFromEnvironment,
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* The "image" of a component tree, is the platform specific (typically
|
|
225
|
-
* serialized) data that represents a tree of lower level UI building blocks.
|
|
226
|
-
* On the web, this "image" is HTML markup which describes a construction of
|
|
227
|
-
* low level `div` and `span` nodes. Other platforms may have different
|
|
228
|
-
* encoding of this "image". This must be injected.
|
|
229
|
-
*
|
|
230
|
-
* @private
|
|
231
|
-
*/
|
|
232
|
-
mountImageIntoNode: ReactComponentEnvironment.mountImageIntoNode,
|
|
279
|
+
BackendIDOperations: null,
|
|
233
280
|
|
|
234
281
|
/**
|
|
235
282
|
* React references `ReactReconcileTransaction` using this property in order
|
|
@@ -237,8 +284,7 @@ var ReactComponent = {
|
|
|
237
284
|
*
|
|
238
285
|
* @internal
|
|
239
286
|
*/
|
|
240
|
-
ReactReconcileTransaction:
|
|
241
|
-
ReactComponentEnvironment.ReactReconcileTransaction,
|
|
287
|
+
ReactReconcileTransaction: null,
|
|
242
288
|
|
|
243
289
|
/**
|
|
244
290
|
* Base functionality for every ReactComponent constructor. Mixed into the
|
|
@@ -246,7 +292,7 @@ var ReactComponent = {
|
|
|
246
292
|
*
|
|
247
293
|
* @lends {ReactComponent.prototype}
|
|
248
294
|
*/
|
|
249
|
-
Mixin:
|
|
295
|
+
Mixin: {
|
|
250
296
|
|
|
251
297
|
/**
|
|
252
298
|
* Checks whether or not this component is mounted.
|
|
@@ -354,7 +400,7 @@ var ReactComponent = {
|
|
|
354
400
|
* `ReactComponent.Mixin.mountComponent.call(this, ...)`.
|
|
355
401
|
*
|
|
356
402
|
* @param {string} rootID DOM ID of the root node.
|
|
357
|
-
* @param {ReactReconcileTransaction} transaction
|
|
403
|
+
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
|
358
404
|
* @param {number} mountDepth number of components in the owner hierarchy.
|
|
359
405
|
* @return {?string} Rendered markup to be inserted into the DOM.
|
|
360
406
|
* @internal
|
|
@@ -396,7 +442,7 @@ var ReactComponent = {
|
|
|
396
442
|
if (props.ref != null) {
|
|
397
443
|
ReactOwner.removeComponentAsRefFrom(this, props.ref, this._owner);
|
|
398
444
|
}
|
|
399
|
-
|
|
445
|
+
unmountIDFromEnvironment(this._rootNodeID);
|
|
400
446
|
this._rootNodeID = null;
|
|
401
447
|
this._lifeCycleState = ComponentLifeCycle.UNMOUNTED;
|
|
402
448
|
},
|
|
@@ -425,7 +471,6 @@ var ReactComponent = {
|
|
|
425
471
|
/**
|
|
426
472
|
* Call `_performUpdateIfNecessary` within a new transaction.
|
|
427
473
|
*
|
|
428
|
-
* @param {ReactReconcileTransaction} transaction
|
|
429
474
|
* @internal
|
|
430
475
|
*/
|
|
431
476
|
performUpdateIfNecessary: function() {
|
|
@@ -514,7 +559,7 @@ var ReactComponent = {
|
|
|
514
559
|
transaction,
|
|
515
560
|
shouldReuseMarkup) {
|
|
516
561
|
var markup = this.mountComponent(rootID, transaction, 0);
|
|
517
|
-
|
|
562
|
+
mountImageIntoNode(markup, container, shouldReuseMarkup);
|
|
518
563
|
},
|
|
519
564
|
|
|
520
565
|
/**
|
|
@@ -544,7 +589,7 @@ var ReactComponent = {
|
|
|
544
589
|
}
|
|
545
590
|
return owner.refs[ref];
|
|
546
591
|
}
|
|
547
|
-
}
|
|
592
|
+
}
|
|
548
593
|
};
|
|
549
594
|
|
|
550
595
|
module.exports = ReactComponent;
|