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
package/lib/ReactLink.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 ReactLink
|
|
17
10
|
* @typechecks static-only
|
|
@@ -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 ReactMarkupChecksum
|
|
17
10
|
*/
|
package/lib/ReactMount.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 ReactMount
|
|
17
10
|
*/
|
|
@@ -21,17 +14,23 @@
|
|
|
21
14
|
var DOMProperty = require("./DOMProperty");
|
|
22
15
|
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
|
|
23
16
|
var ReactCurrentOwner = require("./ReactCurrentOwner");
|
|
24
|
-
var
|
|
17
|
+
var ReactElement = require("./ReactElement");
|
|
18
|
+
var ReactLegacyElement = require("./ReactLegacyElement");
|
|
25
19
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
26
20
|
var ReactPerf = require("./ReactPerf");
|
|
27
21
|
|
|
28
22
|
var containsNode = require("./containsNode");
|
|
23
|
+
var deprecated = require("./deprecated");
|
|
29
24
|
var getReactRootElementInContainer = require("./getReactRootElementInContainer");
|
|
30
25
|
var instantiateReactComponent = require("./instantiateReactComponent");
|
|
31
26
|
var invariant = require("./invariant");
|
|
32
27
|
var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
|
|
33
28
|
var warning = require("./warning");
|
|
34
29
|
|
|
30
|
+
var createElement = ReactLegacyElement.wrapCreateElement(
|
|
31
|
+
ReactElement.createElement
|
|
32
|
+
);
|
|
33
|
+
|
|
35
34
|
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
|
|
36
35
|
|
|
37
36
|
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
|
|
@@ -199,7 +198,7 @@ function findDeepestCachedAncestor(targetID) {
|
|
|
199
198
|
* representative DOM elements and inserting them into a supplied `container`.
|
|
200
199
|
* Any prior content inside `container` is destroyed in the process.
|
|
201
200
|
*
|
|
202
|
-
* ReactMount.
|
|
201
|
+
* ReactMount.render(
|
|
203
202
|
* component,
|
|
204
203
|
* document.getElementById('container')
|
|
205
204
|
* );
|
|
@@ -305,7 +304,7 @@ var ReactMount = {
|
|
|
305
304
|
'componentDidUpdate.'
|
|
306
305
|
) : null);
|
|
307
306
|
|
|
308
|
-
var componentInstance = instantiateReactComponent(nextComponent);
|
|
307
|
+
var componentInstance = instantiateReactComponent(nextComponent, null);
|
|
309
308
|
var reactRootID = ReactMount._registerComponent(
|
|
310
309
|
componentInstance,
|
|
311
310
|
container
|
|
@@ -333,35 +332,38 @@ var ReactMount = {
|
|
|
333
332
|
* perform an update on it and only mutate the DOM as necessary to reflect the
|
|
334
333
|
* latest React component.
|
|
335
334
|
*
|
|
336
|
-
* @param {
|
|
335
|
+
* @param {ReactElement} nextElement Component element to render.
|
|
337
336
|
* @param {DOMElement} container DOM element to render into.
|
|
338
337
|
* @param {?function} callback function triggered on completion
|
|
339
338
|
* @return {ReactComponent} Component instance rendered in `container`.
|
|
340
339
|
*/
|
|
341
|
-
|
|
340
|
+
render: function(nextElement, container, callback) {
|
|
342
341
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
343
|
-
|
|
344
|
-
'renderComponent(): Invalid component
|
|
342
|
+
ReactElement.isValidElement(nextElement),
|
|
343
|
+
'renderComponent(): Invalid component element.%s',
|
|
345
344
|
(
|
|
346
|
-
|
|
345
|
+
typeof nextElement === 'string' ?
|
|
346
|
+
' Instead of passing an element string, make sure to instantiate ' +
|
|
347
|
+
'it by passing it to React.createElement.' :
|
|
348
|
+
ReactLegacyElement.isValidFactory(nextElement) ?
|
|
347
349
|
' Instead of passing a component class, make sure to instantiate ' +
|
|
348
|
-
'it
|
|
349
|
-
// Check if it quacks like a
|
|
350
|
-
typeof
|
|
350
|
+
'it by passing it to React.createElement.' :
|
|
351
|
+
// Check if it quacks like a element
|
|
352
|
+
typeof nextElement.props !== "undefined" ?
|
|
351
353
|
' This may be caused by unintentionally loading two independent ' +
|
|
352
354
|
'copies of React.' :
|
|
353
355
|
''
|
|
354
356
|
)
|
|
355
|
-
) : invariant(
|
|
357
|
+
) : invariant(ReactElement.isValidElement(nextElement)));
|
|
356
358
|
|
|
357
359
|
var prevComponent = instancesByReactRootID[getReactRootID(container)];
|
|
358
360
|
|
|
359
361
|
if (prevComponent) {
|
|
360
|
-
var
|
|
361
|
-
if (shouldUpdateReactComponent(
|
|
362
|
+
var prevElement = prevComponent._currentElement;
|
|
363
|
+
if (shouldUpdateReactComponent(prevElement, nextElement)) {
|
|
362
364
|
return ReactMount._updateRootComponent(
|
|
363
365
|
prevComponent,
|
|
364
|
-
|
|
366
|
+
nextElement,
|
|
365
367
|
container,
|
|
366
368
|
callback
|
|
367
369
|
);
|
|
@@ -377,7 +379,7 @@ var ReactMount = {
|
|
|
377
379
|
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
|
|
378
380
|
|
|
379
381
|
var component = ReactMount._renderNewRootComponent(
|
|
380
|
-
|
|
382
|
+
nextElement,
|
|
381
383
|
container,
|
|
382
384
|
shouldReuseMarkup
|
|
383
385
|
);
|
|
@@ -395,7 +397,8 @@ var ReactMount = {
|
|
|
395
397
|
* @return {ReactComponent} Component instance rendered in `container`.
|
|
396
398
|
*/
|
|
397
399
|
constructAndRenderComponent: function(constructor, props, container) {
|
|
398
|
-
|
|
400
|
+
var element = createElement(constructor, props);
|
|
401
|
+
return ReactMount.render(element, container);
|
|
399
402
|
},
|
|
400
403
|
|
|
401
404
|
/**
|
|
@@ -654,9 +657,10 @@ var ReactMount = {
|
|
|
654
657
|
false,
|
|
655
658
|
'findComponentRoot(..., %s): Unable to find element. This probably ' +
|
|
656
659
|
'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
|
|
657
|
-
'usually due to forgetting a <tbody> when using tables, nesting
|
|
658
|
-
'or <a
|
|
659
|
-
'
|
|
660
|
+
'usually due to forgetting a <tbody> when using tables, nesting tags ' +
|
|
661
|
+
'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
|
|
662
|
+
'parent. ' +
|
|
663
|
+
'Try inspecting the child nodes of the element with React ID `%s`.',
|
|
660
664
|
targetID,
|
|
661
665
|
ReactMount.getID(ancestorNode)
|
|
662
666
|
) : invariant(false));
|
|
@@ -678,4 +682,13 @@ var ReactMount = {
|
|
|
678
682
|
purgeID: purgeID
|
|
679
683
|
};
|
|
680
684
|
|
|
685
|
+
// Deprecations (remove for 0.13)
|
|
686
|
+
ReactMount.renderComponent = deprecated(
|
|
687
|
+
'ReactMount',
|
|
688
|
+
'renderComponent',
|
|
689
|
+
'render',
|
|
690
|
+
this,
|
|
691
|
+
ReactMount.render
|
|
692
|
+
);
|
|
693
|
+
|
|
681
694
|
module.exports = ReactMount;
|
package/lib/ReactMultiChild.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 ReactMultiChild
|
|
17
10
|
* @typechecks static-only
|
|
@@ -195,7 +188,7 @@ var ReactMultiChild = {
|
|
|
195
188
|
if (children.hasOwnProperty(name)) {
|
|
196
189
|
// The rendered children must be turned into instances as they're
|
|
197
190
|
// mounted.
|
|
198
|
-
var childInstance = instantiateReactComponent(child);
|
|
191
|
+
var childInstance = instantiateReactComponent(child, null);
|
|
199
192
|
children[name] = childInstance;
|
|
200
193
|
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
|
|
201
194
|
var rootID = this._rootNodeID + name;
|
|
@@ -286,12 +279,12 @@ var ReactMultiChild = {
|
|
|
286
279
|
continue;
|
|
287
280
|
}
|
|
288
281
|
var prevChild = prevChildren && prevChildren[name];
|
|
289
|
-
var
|
|
290
|
-
var
|
|
291
|
-
if (shouldUpdateReactComponent(
|
|
282
|
+
var prevElement = prevChild && prevChild._currentElement;
|
|
283
|
+
var nextElement = nextChildren[name];
|
|
284
|
+
if (shouldUpdateReactComponent(prevElement, nextElement)) {
|
|
292
285
|
this.moveChild(prevChild, nextIndex, lastIndex);
|
|
293
286
|
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
|
|
294
|
-
prevChild.receiveComponent(
|
|
287
|
+
prevChild.receiveComponent(nextElement, transaction);
|
|
295
288
|
prevChild._mountIndex = nextIndex;
|
|
296
289
|
} else {
|
|
297
290
|
if (prevChild) {
|
|
@@ -300,7 +293,10 @@ var ReactMultiChild = {
|
|
|
300
293
|
this._unmountChildByName(prevChild, name);
|
|
301
294
|
}
|
|
302
295
|
// The child must be instantiated before it's mounted.
|
|
303
|
-
var nextChildInstance = instantiateReactComponent(
|
|
296
|
+
var nextChildInstance = instantiateReactComponent(
|
|
297
|
+
nextElement,
|
|
298
|
+
null
|
|
299
|
+
);
|
|
304
300
|
this._mountChildByNameAtIndex(
|
|
305
301
|
nextChildInstance, name, nextIndex, transaction
|
|
306
302
|
);
|
|
@@ -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 ReactMultiChildUpdateTypes
|
|
17
10
|
*/
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2014, 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 ReactNativeComponent
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
14
|
+
var assign = require("./Object.assign");
|
|
15
|
+
var invariant = require("./invariant");
|
|
16
|
+
|
|
17
|
+
var genericComponentClass = null;
|
|
18
|
+
// This registry keeps track of wrapper classes around native tags
|
|
19
|
+
var tagToComponentClass = {};
|
|
20
|
+
|
|
21
|
+
var ReactNativeComponentInjection = {
|
|
22
|
+
// This accepts a class that receives the tag string. This is a catch all
|
|
23
|
+
// that can render any kind of tag.
|
|
24
|
+
injectGenericComponentClass: function(componentClass) {
|
|
25
|
+
genericComponentClass = componentClass;
|
|
26
|
+
},
|
|
27
|
+
// This accepts a keyed object with classes as values. Each key represents a
|
|
28
|
+
// tag. That particular tag will use this class instead of the generic one.
|
|
29
|
+
injectComponentClasses: function(componentClasses) {
|
|
30
|
+
assign(tagToComponentClass, componentClasses);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create an internal class for a specific tag.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} tag The tag for which to create an internal instance.
|
|
38
|
+
* @param {any} props The props passed to the instance constructor.
|
|
39
|
+
* @return {ReactComponent} component The injected empty component.
|
|
40
|
+
*/
|
|
41
|
+
function createInstanceForTag(tag, props, parentType) {
|
|
42
|
+
var componentClass = tagToComponentClass[tag];
|
|
43
|
+
if (componentClass == null) {
|
|
44
|
+
("production" !== process.env.NODE_ENV ? invariant(
|
|
45
|
+
genericComponentClass,
|
|
46
|
+
'There is no registered component for the tag %s',
|
|
47
|
+
tag
|
|
48
|
+
) : invariant(genericComponentClass));
|
|
49
|
+
return new genericComponentClass(tag, props);
|
|
50
|
+
}
|
|
51
|
+
if (parentType === tag) {
|
|
52
|
+
// Avoid recursion
|
|
53
|
+
("production" !== process.env.NODE_ENV ? invariant(
|
|
54
|
+
genericComponentClass,
|
|
55
|
+
'There is no registered component for the tag %s',
|
|
56
|
+
tag
|
|
57
|
+
) : invariant(genericComponentClass));
|
|
58
|
+
return new genericComponentClass(tag, props);
|
|
59
|
+
}
|
|
60
|
+
// Unwrap legacy factories
|
|
61
|
+
return new componentClass.type(props);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var ReactNativeComponent = {
|
|
65
|
+
createInstanceForTag: createInstanceForTag,
|
|
66
|
+
injection: ReactNativeComponentInjection
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
module.exports = ReactNativeComponent;
|
package/lib/ReactOwner.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 ReactOwner
|
|
17
10
|
*/
|
package/lib/ReactPerf.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 ReactPerf
|
|
17
10
|
* @typechecks static-only
|
|
@@ -47,7 +40,7 @@ var ReactPerf = {
|
|
|
47
40
|
measure: function(objName, fnName, func) {
|
|
48
41
|
if ("production" !== process.env.NODE_ENV) {
|
|
49
42
|
var measuredFunc = null;
|
|
50
|
-
|
|
43
|
+
var wrapper = function() {
|
|
51
44
|
if (ReactPerf.enableMeasure) {
|
|
52
45
|
if (!measuredFunc) {
|
|
53
46
|
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
|
|
@@ -56,6 +49,8 @@ var ReactPerf = {
|
|
|
56
49
|
}
|
|
57
50
|
return func.apply(this, arguments);
|
|
58
51
|
};
|
|
52
|
+
wrapper.displayName = objName + '_' + fnName;
|
|
53
|
+
return wrapper;
|
|
59
54
|
}
|
|
60
55
|
return func;
|
|
61
56
|
},
|
|
@@ -1,27 +1,23 @@
|
|
|
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 ReactPropTransferer
|
|
17
10
|
*/
|
|
18
11
|
|
|
19
12
|
"use strict";
|
|
20
13
|
|
|
14
|
+
var assign = require("./Object.assign");
|
|
21
15
|
var emptyFunction = require("./emptyFunction");
|
|
22
16
|
var invariant = require("./invariant");
|
|
23
17
|
var joinClasses = require("./joinClasses");
|
|
24
|
-
var
|
|
18
|
+
var warning = require("./warning");
|
|
19
|
+
|
|
20
|
+
var didWarn = false;
|
|
25
21
|
|
|
26
22
|
/**
|
|
27
23
|
* Creates a transfer strategy that will merge prop values using the supplied
|
|
@@ -44,7 +40,7 @@ var transferStrategyMerge = createTransferStrategy(function(a, b) {
|
|
|
44
40
|
// `merge` overrides the first object's (`props[key]` above) keys using the
|
|
45
41
|
// second object's (`value`) keys. An object's style's existing `propA` would
|
|
46
42
|
// get overridden. Flip the order here.
|
|
47
|
-
return
|
|
43
|
+
return assign({}, b, a);
|
|
48
44
|
});
|
|
49
45
|
|
|
50
46
|
/**
|
|
@@ -61,14 +57,6 @@ var TransferStrategies = {
|
|
|
61
57
|
* Transfer the `className` prop by merging them.
|
|
62
58
|
*/
|
|
63
59
|
className: createTransferStrategy(joinClasses),
|
|
64
|
-
/**
|
|
65
|
-
* Never transfer the `key` prop.
|
|
66
|
-
*/
|
|
67
|
-
key: emptyFunction,
|
|
68
|
-
/**
|
|
69
|
-
* Never transfer the `ref` prop.
|
|
70
|
-
*/
|
|
71
|
-
ref: emptyFunction,
|
|
72
60
|
/**
|
|
73
61
|
* Transfer the `style` prop (which is an object) by merging them.
|
|
74
62
|
*/
|
|
@@ -118,7 +106,7 @@ var ReactPropTransferer = {
|
|
|
118
106
|
* @return {object} a new object containing both sets of props merged.
|
|
119
107
|
*/
|
|
120
108
|
mergeProps: function(oldProps, newProps) {
|
|
121
|
-
return transferInto(
|
|
109
|
+
return transferInto(assign({}, oldProps), newProps);
|
|
122
110
|
},
|
|
123
111
|
|
|
124
112
|
/**
|
|
@@ -134,26 +122,39 @@ var ReactPropTransferer = {
|
|
|
134
122
|
*
|
|
135
123
|
* This is usually used to pass down props to a returned root component.
|
|
136
124
|
*
|
|
137
|
-
* @param {
|
|
138
|
-
* @return {
|
|
125
|
+
* @param {ReactElement} element Component receiving the properties.
|
|
126
|
+
* @return {ReactElement} The supplied `component`.
|
|
139
127
|
* @final
|
|
140
128
|
* @protected
|
|
141
129
|
*/
|
|
142
|
-
transferPropsTo: function(
|
|
130
|
+
transferPropsTo: function(element) {
|
|
143
131
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
144
|
-
|
|
132
|
+
element._owner === this,
|
|
145
133
|
'%s: You can\'t call transferPropsTo() on a component that you ' +
|
|
146
134
|
'don\'t own, %s. This usually means you are calling ' +
|
|
147
135
|
'transferPropsTo() on a component passed in as props or children.',
|
|
148
136
|
this.constructor.displayName,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
137
|
+
typeof element.type === 'string' ?
|
|
138
|
+
element.type :
|
|
139
|
+
element.type.displayName
|
|
140
|
+
) : invariant(element._owner === this));
|
|
141
|
+
|
|
142
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
143
|
+
if (!didWarn) {
|
|
144
|
+
didWarn = true;
|
|
145
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
146
|
+
false,
|
|
147
|
+
'transferPropsTo is deprecated. ' +
|
|
148
|
+
'See http://fb.me/react-transferpropsto for more information.'
|
|
149
|
+
) : null);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Because elements are immutable we have to merge into the existing
|
|
153
154
|
// props object rather than clone it.
|
|
154
|
-
transferInto(
|
|
155
|
+
transferInto(element.props, this.props);
|
|
155
156
|
|
|
156
|
-
return
|
|
157
|
+
return element;
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
}
|