react 0.11.2 → 0.12.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 +2714 -7859
- package/dist/react-with-addons.js +3139 -3593
- package/dist/react-with-addons.min.js +11 -17
- package/dist/react.js +2940 -3308
- package/dist/react.min.js +11 -16
- package/lib/AutoFocusMixin.js +5 -12
- package/lib/BeforeInputEventPlugin.js +12 -14
- package/lib/CSSCore.js +6 -13
- package/lib/CSSProperty.js +10 -14
- package/lib/CSSPropertyOperations.js +46 -12
- package/lib/CallbackQueue.js +7 -14
- package/lib/ChangeEventPlugin.js +5 -12
- package/lib/ClientReactRootIndex.js +5 -12
- package/lib/CompositionEventPlugin.js +5 -12
- package/lib/DOMChildrenOperations.js +8 -15
- package/lib/DOMProperty.js +16 -19
- package/lib/DOMPropertyOperations.js +14 -14
- package/lib/Danger.js +12 -17
- package/lib/DefaultEventPluginOrder.js +5 -12
- package/lib/EnterLeaveEventPlugin.js +5 -12
- package/lib/EventConstants.js +5 -12
- package/lib/EventListener.js +14 -0
- package/lib/EventPluginHub.js +8 -26
- package/lib/EventPluginRegistry.js +5 -12
- package/lib/EventPluginUtils.js +5 -12
- package/lib/EventPropagators.js +12 -17
- package/lib/ExecutionEnvironment.js +5 -12
- package/lib/HTMLDOMPropertyConfig.js +16 -15
- package/lib/LinkedStateMixin.js +5 -12
- package/lib/LinkedValueUtils.js +5 -12
- package/lib/LocalEventTrapMixin.js +8 -14
- package/lib/MobileSafariClickEventPlugin.js +5 -12
- package/lib/Object.assign.js +45 -0
- package/lib/PooledClass.js +5 -12
- package/lib/React.js +87 -54
- package/lib/ReactBrowserComponentMixin.js +5 -12
- package/lib/ReactBrowserEventEmitter.js +7 -14
- package/lib/ReactCSSTransitionGroup.js +15 -17
- package/lib/ReactCSSTransitionGroupChild.js +9 -13
- package/lib/ReactChildren.js +5 -12
- package/lib/ReactComponent.js +61 -68
- package/lib/ReactComponentBrowserEnvironment.js +5 -12
- package/lib/ReactComponentWithPureRenderMixin.js +5 -12
- package/lib/ReactCompositeComponent.js +191 -180
- package/lib/ReactContext.js +8 -15
- package/lib/ReactCurrentOwner.js +5 -12
- package/lib/ReactDOM.js +145 -177
- package/lib/ReactDOMButton.js +8 -14
- package/lib/ReactDOMComponent.js +103 -38
- package/lib/ReactDOMForm.js +9 -15
- package/lib/ReactDOMIDOperations.js +5 -12
- package/lib/ReactDOMImg.js +8 -14
- package/lib/ReactDOMInput.js +30 -38
- package/lib/ReactDOMOption.js +8 -14
- package/lib/ReactDOMSelect.js +25 -24
- package/lib/ReactDOMSelection.js +11 -18
- package/lib/ReactDOMTextarea.js +19 -24
- package/lib/ReactDefaultBatchingStrategy.js +14 -18
- package/lib/ReactDefaultInjection.js +23 -26
- package/lib/ReactDefaultPerf.js +14 -17
- package/lib/ReactDefaultPerfAnalysis.js +18 -17
- package/lib/ReactElement.js +242 -0
- package/lib/{ReactDescriptorValidator.js → ReactElementValidator.js} +51 -56
- package/lib/ReactEmptyComponent.js +8 -13
- package/lib/ReactErrorUtils.js +5 -12
- package/lib/ReactEventEmitterMixin.js +5 -12
- package/lib/ReactEventListener.js +7 -14
- package/lib/ReactInjection.js +7 -14
- package/lib/ReactInputSelection.js +5 -12
- package/lib/ReactInstanceHandles.js +5 -12
- package/lib/ReactLegacyElement.js +243 -0
- package/lib/ReactLink.js +5 -12
- package/lib/ReactMarkupChecksum.js +5 -12
- package/lib/ReactMount.js +45 -32
- package/lib/ReactMultiChild.js +14 -18
- package/lib/ReactMultiChildUpdateTypes.js +5 -12
- package/lib/ReactNativeComponent.js +69 -0
- package/lib/ReactOwner.js +5 -12
- package/lib/ReactPerf.js +8 -13
- package/lib/ReactPropTransferer.js +34 -33
- package/lib/ReactPropTypeLocationNames.js +5 -12
- package/lib/ReactPropTypeLocations.js +5 -12
- package/lib/ReactPropTypes.js +38 -29
- package/lib/ReactPutListenerQueue.js +7 -14
- package/lib/ReactReconcileTransaction.js +7 -15
- package/lib/ReactRootIndex.js +5 -12
- package/lib/ReactServerRendering.js +21 -34
- package/lib/ReactServerRenderingTransaction.js +11 -15
- package/lib/ReactStateSetters.js +5 -12
- package/lib/ReactTestUtils.js +31 -33
- package/lib/ReactTextComponent.js +18 -21
- package/lib/ReactTransitionChildMapping.js +6 -13
- package/lib/ReactTransitionEvents.js +5 -12
- package/lib/ReactTransitionGroup.js +14 -17
- package/lib/ReactUpdates.js +43 -22
- package/lib/ReactWithAddons.js +7 -13
- package/lib/SVGDOMPropertyConfig.js +5 -12
- package/lib/SelectEventPlugin.js +13 -20
- package/lib/ServerReactRootIndex.js +5 -12
- package/lib/SimpleEventPlugin.js +20 -15
- package/lib/SyntheticClipboardEvent.js +5 -12
- package/lib/SyntheticCompositionEvent.js +5 -12
- package/lib/SyntheticDragEvent.js +5 -12
- package/lib/SyntheticEvent.js +9 -17
- package/lib/SyntheticFocusEvent.js +5 -12
- package/lib/SyntheticInputEvent.js +4 -11
- package/lib/SyntheticKeyboardEvent.js +17 -19
- package/lib/SyntheticMouseEvent.js +5 -12
- package/lib/SyntheticTouchEvent.js +5 -12
- package/lib/SyntheticUIEvent.js +5 -12
- package/lib/SyntheticWheelEvent.js +5 -12
- package/lib/Transaction.js +5 -12
- package/lib/ViewportMetrics.js +5 -12
- package/lib/accumulateInto.js +62 -0
- package/lib/adler32.js +6 -13
- package/lib/camelize.js +30 -0
- package/lib/camelizeStyleName.js +40 -0
- package/lib/cloneWithProps.js +9 -15
- package/lib/containsNode.js +5 -12
- package/lib/copyProperties.js +12 -12
- package/lib/createArrayFrom.js +5 -12
- package/lib/createFullPageComponent.js +12 -18
- package/lib/createNodesFromMarkup.js +5 -12
- package/lib/cx.js +5 -12
- package/lib/dangerousStyleValue.js +5 -12
- package/lib/deprecated.js +47 -0
- package/lib/emptyFunction.js +11 -22
- package/lib/emptyObject.js +5 -12
- package/lib/escapeTextForBrowser.js +5 -12
- package/lib/flattenChildren.js +19 -13
- package/lib/focusNode.js +10 -16
- package/lib/forEachAccumulated.js +5 -12
- package/lib/getActiveElement.js +5 -12
- package/lib/getEventCharCode.js +50 -0
- package/lib/getEventKey.js +9 -21
- package/lib/getEventModifierState.js +4 -11
- package/lib/getEventTarget.js +5 -12
- package/lib/getMarkupWrap.js +5 -12
- package/lib/getNodeForCharacterOffset.js +5 -12
- package/lib/getReactRootElementInContainer.js +5 -12
- package/lib/getTextContentAccessor.js +5 -12
- package/lib/getUnboundedScrollPosition.js +5 -12
- package/lib/hyphenate.js +5 -12
- package/lib/hyphenateStyleName.js +8 -15
- package/lib/instantiateReactComponent.js +90 -42
- package/lib/invariant.js +5 -12
- package/lib/isEventSupported.js +5 -12
- package/lib/isNode.js +5 -12
- package/lib/isTextInputElement.js +5 -12
- package/lib/isTextNode.js +5 -12
- package/lib/joinClasses.js +8 -13
- package/lib/keyMirror.js +5 -12
- package/lib/keyOf.js +5 -12
- package/lib/mapObject.js +35 -36
- package/lib/memoizeStringOnly.js +5 -12
- package/lib/merge.js +14 -17
- package/lib/mergeInto.js +13 -35
- package/lib/monitorCodeUse.js +5 -12
- package/lib/onlyChild.js +8 -15
- package/lib/performance.js +5 -12
- package/lib/performanceNow.js +5 -12
- package/lib/setInnerHTML.js +10 -19
- package/lib/shallowEqual.js +6 -13
- package/lib/shouldUpdateReactComponent.js +14 -22
- package/lib/toArray.js +5 -12
- package/lib/traverseAllChildren.js +34 -48
- package/lib/update.js +8 -15
- package/lib/warning.js +6 -13
- package/package.json +3 -8
- package/lib/ReactDescriptor.js +0 -251
- package/lib/accumulate.js +0 -54
- package/lib/mergeHelpers.js +0 -147
- package/lib/mixInto.js +0 -34
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule ReactPropTypeLocationNames
|
|
17
10
|
*/
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule ReactPropTypeLocations
|
|
17
10
|
*/
|
package/lib/ReactPropTypes.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule ReactPropTypes
|
|
17
10
|
*/
|
|
18
11
|
|
|
19
12
|
"use strict";
|
|
20
13
|
|
|
21
|
-
var
|
|
14
|
+
var ReactElement = require("./ReactElement");
|
|
22
15
|
var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
|
|
23
16
|
|
|
17
|
+
var deprecated = require("./deprecated");
|
|
24
18
|
var emptyFunction = require("./emptyFunction");
|
|
25
19
|
|
|
26
20
|
/**
|
|
@@ -72,6 +66,9 @@ var emptyFunction = require("./emptyFunction");
|
|
|
72
66
|
|
|
73
67
|
var ANONYMOUS = '<<anonymous>>';
|
|
74
68
|
|
|
69
|
+
var elementTypeChecker = createElementTypeChecker();
|
|
70
|
+
var nodeTypeChecker = createNodeChecker();
|
|
71
|
+
|
|
75
72
|
var ReactPropTypes = {
|
|
76
73
|
array: createPrimitiveTypeChecker('array'),
|
|
77
74
|
bool: createPrimitiveTypeChecker('boolean'),
|
|
@@ -82,13 +79,28 @@ var ReactPropTypes = {
|
|
|
82
79
|
|
|
83
80
|
any: createAnyTypeChecker(),
|
|
84
81
|
arrayOf: createArrayOfTypeChecker,
|
|
85
|
-
|
|
82
|
+
element: elementTypeChecker,
|
|
86
83
|
instanceOf: createInstanceTypeChecker,
|
|
84
|
+
node: nodeTypeChecker,
|
|
87
85
|
objectOf: createObjectOfTypeChecker,
|
|
88
86
|
oneOf: createEnumTypeChecker,
|
|
89
87
|
oneOfType: createUnionTypeChecker,
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
shape: createShapeTypeChecker,
|
|
89
|
+
|
|
90
|
+
component: deprecated(
|
|
91
|
+
'React.PropTypes',
|
|
92
|
+
'component',
|
|
93
|
+
'element',
|
|
94
|
+
this,
|
|
95
|
+
elementTypeChecker
|
|
96
|
+
),
|
|
97
|
+
renderable: deprecated(
|
|
98
|
+
'React.PropTypes',
|
|
99
|
+
'renderable',
|
|
100
|
+
'node',
|
|
101
|
+
this,
|
|
102
|
+
nodeTypeChecker
|
|
103
|
+
)
|
|
92
104
|
};
|
|
93
105
|
|
|
94
106
|
function createChainableTypeChecker(validate) {
|
|
@@ -158,13 +170,13 @@ function createArrayOfTypeChecker(typeChecker) {
|
|
|
158
170
|
return createChainableTypeChecker(validate);
|
|
159
171
|
}
|
|
160
172
|
|
|
161
|
-
function
|
|
173
|
+
function createElementTypeChecker() {
|
|
162
174
|
function validate(props, propName, componentName, location) {
|
|
163
|
-
if (!
|
|
175
|
+
if (!ReactElement.isValidElement(props[propName])) {
|
|
164
176
|
var locationName = ReactPropTypeLocationNames[location];
|
|
165
177
|
return new Error(
|
|
166
178
|
("Invalid " + locationName + " `" + propName + "` supplied to ") +
|
|
167
|
-
("`" + componentName + "`, expected a
|
|
179
|
+
("`" + componentName + "`, expected a ReactElement.")
|
|
168
180
|
);
|
|
169
181
|
}
|
|
170
182
|
}
|
|
@@ -245,13 +257,13 @@ function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
|
245
257
|
return createChainableTypeChecker(validate);
|
|
246
258
|
}
|
|
247
259
|
|
|
248
|
-
function
|
|
260
|
+
function createNodeChecker() {
|
|
249
261
|
function validate(props, propName, componentName, location) {
|
|
250
|
-
if (!
|
|
262
|
+
if (!isNode(props[propName])) {
|
|
251
263
|
var locationName = ReactPropTypeLocationNames[location];
|
|
252
264
|
return new Error(
|
|
253
265
|
("Invalid " + locationName + " `" + propName + "` supplied to ") +
|
|
254
|
-
("`" + componentName + "`, expected a
|
|
266
|
+
("`" + componentName + "`, expected a ReactNode.")
|
|
255
267
|
);
|
|
256
268
|
}
|
|
257
269
|
}
|
|
@@ -283,11 +295,8 @@ function createShapeTypeChecker(shapeTypes) {
|
|
|
283
295
|
return createChainableTypeChecker(validate, 'expected `object`');
|
|
284
296
|
}
|
|
285
297
|
|
|
286
|
-
function
|
|
298
|
+
function isNode(propValue) {
|
|
287
299
|
switch(typeof propValue) {
|
|
288
|
-
// TODO: this was probably written with the assumption that we're not
|
|
289
|
-
// returning `this.props.component` directly from `render`. This is
|
|
290
|
-
// currently not supported but we should, to make it consistent.
|
|
291
300
|
case 'number':
|
|
292
301
|
case 'string':
|
|
293
302
|
return true;
|
|
@@ -295,13 +304,13 @@ function isRenderable(propValue) {
|
|
|
295
304
|
return !propValue;
|
|
296
305
|
case 'object':
|
|
297
306
|
if (Array.isArray(propValue)) {
|
|
298
|
-
return propValue.every(
|
|
307
|
+
return propValue.every(isNode);
|
|
299
308
|
}
|
|
300
|
-
if (
|
|
309
|
+
if (ReactElement.isValidElement(propValue)) {
|
|
301
310
|
return true;
|
|
302
311
|
}
|
|
303
312
|
for (var k in propValue) {
|
|
304
|
-
if (!
|
|
313
|
+
if (!isNode(propValue[k])) {
|
|
305
314
|
return false;
|
|
306
315
|
}
|
|
307
316
|
}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule ReactPutListenerQueue
|
|
17
10
|
*/
|
|
@@ -21,13 +14,13 @@
|
|
|
21
14
|
var PooledClass = require("./PooledClass");
|
|
22
15
|
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
|
|
23
16
|
|
|
24
|
-
var
|
|
17
|
+
var assign = require("./Object.assign");
|
|
25
18
|
|
|
26
19
|
function ReactPutListenerQueue() {
|
|
27
20
|
this.listenersToPut = [];
|
|
28
21
|
}
|
|
29
22
|
|
|
30
|
-
|
|
23
|
+
assign(ReactPutListenerQueue.prototype, {
|
|
31
24
|
enqueuePutListener: function(rootNodeID, propKey, propValue) {
|
|
32
25
|
this.listenersToPut.push({
|
|
33
26
|
rootNodeID: rootNodeID,
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule ReactReconcileTransaction
|
|
17
10
|
* @typechecks static-only
|
|
@@ -26,7 +19,7 @@ var ReactInputSelection = require("./ReactInputSelection");
|
|
|
26
19
|
var ReactPutListenerQueue = require("./ReactPutListenerQueue");
|
|
27
20
|
var Transaction = require("./Transaction");
|
|
28
21
|
|
|
29
|
-
var
|
|
22
|
+
var assign = require("./Object.assign");
|
|
30
23
|
|
|
31
24
|
/**
|
|
32
25
|
* Ensures that, when possible, the selection range (currently selected text
|
|
@@ -174,8 +167,7 @@ var Mixin = {
|
|
|
174
167
|
};
|
|
175
168
|
|
|
176
169
|
|
|
177
|
-
|
|
178
|
-
mixInto(ReactReconcileTransaction, Mixin);
|
|
170
|
+
assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
|
|
179
171
|
|
|
180
172
|
PooledClass.addPoolingTo(ReactReconcileTransaction);
|
|
181
173
|
|
package/lib/ReactRootIndex.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule ReactRootIndex
|
|
17
10
|
* @typechecks
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @typechecks static-only
|
|
17
10
|
* @providesModule ReactServerRendering
|
|
18
11
|
*/
|
|
19
12
|
"use strict";
|
|
20
13
|
|
|
21
|
-
var
|
|
14
|
+
var ReactElement = require("./ReactElement");
|
|
22
15
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
23
16
|
var ReactMarkupChecksum = require("./ReactMarkupChecksum");
|
|
24
17
|
var ReactServerRenderingTransaction =
|
|
@@ -28,20 +21,14 @@ var instantiateReactComponent = require("./instantiateReactComponent");
|
|
|
28
21
|
var invariant = require("./invariant");
|
|
29
22
|
|
|
30
23
|
/**
|
|
31
|
-
* @param {
|
|
24
|
+
* @param {ReactElement} element
|
|
32
25
|
* @return {string} the HTML markup
|
|
33
26
|
*/
|
|
34
|
-
function
|
|
35
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
36
|
-
ReactDescriptor.isValidDescriptor(component),
|
|
37
|
-
'renderComponentToString(): You must pass a valid ReactComponent.'
|
|
38
|
-
) : invariant(ReactDescriptor.isValidDescriptor(component)));
|
|
39
|
-
|
|
27
|
+
function renderToString(element) {
|
|
40
28
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
41
|
-
|
|
42
|
-
'
|
|
43
|
-
|
|
44
|
-
) : invariant(!(arguments.length === 2 && typeof arguments[1] === 'function')));
|
|
29
|
+
ReactElement.isValidElement(element),
|
|
30
|
+
'renderToString(): You must pass a valid ReactElement.'
|
|
31
|
+
) : invariant(ReactElement.isValidElement(element)));
|
|
45
32
|
|
|
46
33
|
var transaction;
|
|
47
34
|
try {
|
|
@@ -49,7 +36,7 @@ function renderComponentToString(component) {
|
|
|
49
36
|
transaction = ReactServerRenderingTransaction.getPooled(false);
|
|
50
37
|
|
|
51
38
|
return transaction.perform(function() {
|
|
52
|
-
var componentInstance = instantiateReactComponent(
|
|
39
|
+
var componentInstance = instantiateReactComponent(element, null);
|
|
53
40
|
var markup = componentInstance.mountComponent(id, transaction, 0);
|
|
54
41
|
return ReactMarkupChecksum.addChecksumToMarkup(markup);
|
|
55
42
|
}, null);
|
|
@@ -59,15 +46,15 @@ function renderComponentToString(component) {
|
|
|
59
46
|
}
|
|
60
47
|
|
|
61
48
|
/**
|
|
62
|
-
* @param {
|
|
49
|
+
* @param {ReactElement} element
|
|
63
50
|
* @return {string} the HTML markup, without the extra React ID and checksum
|
|
64
|
-
* (for generating static pages)
|
|
51
|
+
* (for generating static pages)
|
|
65
52
|
*/
|
|
66
|
-
function
|
|
53
|
+
function renderToStaticMarkup(element) {
|
|
67
54
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
68
|
-
|
|
69
|
-
'
|
|
70
|
-
) : invariant(
|
|
55
|
+
ReactElement.isValidElement(element),
|
|
56
|
+
'renderToStaticMarkup(): You must pass a valid ReactElement.'
|
|
57
|
+
) : invariant(ReactElement.isValidElement(element)));
|
|
71
58
|
|
|
72
59
|
var transaction;
|
|
73
60
|
try {
|
|
@@ -75,7 +62,7 @@ function renderComponentToStaticMarkup(component) {
|
|
|
75
62
|
transaction = ReactServerRenderingTransaction.getPooled(true);
|
|
76
63
|
|
|
77
64
|
return transaction.perform(function() {
|
|
78
|
-
var componentInstance = instantiateReactComponent(
|
|
65
|
+
var componentInstance = instantiateReactComponent(element, null);
|
|
79
66
|
return componentInstance.mountComponent(id, transaction, 0);
|
|
80
67
|
}, null);
|
|
81
68
|
} finally {
|
|
@@ -84,6 +71,6 @@ function renderComponentToStaticMarkup(component) {
|
|
|
84
71
|
}
|
|
85
72
|
|
|
86
73
|
module.exports = {
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
renderToString: renderToString,
|
|
75
|
+
renderToStaticMarkup: renderToStaticMarkup
|
|
89
76
|
};
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule ReactServerRenderingTransaction
|
|
17
10
|
* @typechecks
|
|
@@ -24,8 +17,8 @@ var CallbackQueue = require("./CallbackQueue");
|
|
|
24
17
|
var ReactPutListenerQueue = require("./ReactPutListenerQueue");
|
|
25
18
|
var Transaction = require("./Transaction");
|
|
26
19
|
|
|
20
|
+
var assign = require("./Object.assign");
|
|
27
21
|
var emptyFunction = require("./emptyFunction");
|
|
28
|
-
var mixInto = require("./mixInto");
|
|
29
22
|
|
|
30
23
|
/**
|
|
31
24
|
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
|
|
@@ -107,8 +100,11 @@ var Mixin = {
|
|
|
107
100
|
};
|
|
108
101
|
|
|
109
102
|
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
assign(
|
|
104
|
+
ReactServerRenderingTransaction.prototype,
|
|
105
|
+
Transaction.Mixin,
|
|
106
|
+
Mixin
|
|
107
|
+
);
|
|
112
108
|
|
|
113
109
|
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
|
|
114
110
|
|
package/lib/ReactStateSetters.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule ReactStateSetters
|
|
17
10
|
*/
|