react 0.14.0-alpha2 → 0.14.0-beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/addons.js +6 -3
- package/dist/JSXTransformer.js +634 -274
- package/dist/react-with-addons.js +5350 -4954
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +4777 -4408
- package/dist/react.min.js +6 -5
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +15 -5
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +3 -0
- package/lib/CSSPropertyOperations.js +13 -13
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +16 -14
- package/lib/DOMChildrenOperations.js +10 -6
- package/lib/DOMProperty.js +82 -117
- package/lib/DOMPropertyOperations.js +78 -33
- package/lib/Danger.js +14 -14
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +8 -8
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +13 -13
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +17 -17
- package/lib/EventPropagators.js +7 -7
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +13 -3
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +50 -38
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +14 -2
- package/lib/React.js +6 -6
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +16 -5
- package/lib/ReactCSSTransitionGroupChild.js +20 -11
- package/lib/ReactChildReconciler.js +25 -18
- package/lib/ReactChildren.js +9 -9
- package/lib/ReactClass.js +65 -83
- package/lib/ReactComponent.js +22 -17
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +3 -3
- package/lib/ReactCompositeComponent.js +80 -111
- package/lib/ReactDOM.js +72 -158
- package/lib/ReactDOMButton.js +15 -26
- package/lib/ReactDOMComponent.js +378 -56
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/ReactDOMIDOperations.js +23 -23
- package/lib/ReactDOMInput.js +83 -99
- package/lib/ReactDOMOption.js +25 -45
- package/lib/ReactDOMSelect.js +88 -98
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +2 -2
- package/lib/ReactDOMTextComponent.js +11 -11
- package/lib/ReactDOMTextarea.js +48 -61
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +24 -71
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -9
- package/lib/ReactElement.js +22 -83
- package/lib/ReactElementValidator.js +48 -117
- package/lib/ReactEmptyComponent.js +4 -4
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +3 -4
- package/lib/ReactEventListener.js +57 -12
- package/lib/ReactFragment.js +22 -17
- package/lib/ReactInjection.js +11 -11
- package/lib/ReactInputSelection.js +8 -7
- package/lib/ReactInstanceHandles.js +12 -12
- package/lib/ReactIsomorphic.js +11 -11
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +88 -88
- package/lib/ReactMultiChild.js +83 -22
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -8
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +49 -11
- package/lib/ReactReconcileTransaction.js +8 -8
- package/lib/ReactReconciler.js +18 -20
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +22 -9
- package/lib/ReactServerRenderingTransaction.js +7 -7
- package/lib/ReactTestUtils.js +80 -58
- package/lib/ReactTransitionChildMapping.js +2 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +61 -36
- package/lib/ReactUpdates.js +14 -17
- package/lib/ReactWithAddons.js +14 -16
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +14 -15
- package/lib/SimpleEventPlugin.js +205 -29
- package/lib/SyntheticClipboardEvent.js +3 -3
- package/lib/SyntheticCompositionEvent.js +3 -3
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +9 -8
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +3 -3
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +5 -5
- package/lib/SyntheticTouchEvent.js +4 -4
- package/lib/SyntheticUIEvent.js +4 -4
- package/lib/SyntheticWheelEvent.js +3 -3
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +16 -10
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +12 -7
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +47 -0
- package/lib/findDOMNode.js +11 -12
- package/lib/flattenChildren.js +4 -4
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +0 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +24 -20
- package/lib/isEventSupported.js +1 -1
- package/lib/isTextInputElement.js +2 -1
- package/lib/joinClasses.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +210 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +2 -2
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/sliceChildren.js +51 -0
- package/lib/traverseAllChildren.js +15 -14
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +14 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +53 -1
- package/addons/CSSTransitionGroup.js +0 -1
- package/addons/LinkedStateMixin.js +0 -1
- package/addons/Perf.js +0 -1
- package/addons/PureRenderMixin.js +0 -1
- package/addons/TestUtils.js +0 -1
- package/addons/TransitionGroup.js +0 -1
- package/addons/batchedUpdates.js +0 -1
- package/addons/cloneWithProps.js +0 -1
- package/addons/createFragment.js +0 -1
- package/addons/renderSubtreeIntoContainer.js +0 -1
- package/addons/shallowCompare.js +0 -1
- package/addons/update.js +0 -1
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/LocalEventTrapMixin.js +0 -46
- package/lib/ReactContext.js +0 -32
- package/lib/ReactDOMClient.js +0 -85
- package/lib/ReactDOMForm.js +0 -47
- package/lib/ReactDOMIframe.js +0 -43
- package/lib/ReactDOMImg.js +0 -44
- package/lib/ReactLifeCycle.js +0 -35
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createFullPageComponent.js +0 -51
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/emptyObject.js +0 -20
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -115
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/isTextNode.js +0 -25
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -61
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule accumulate
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var invariant = require('fbjs/lib/invariant');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Accumulates items that must not be null or undefined.
|
|
18
|
+
*
|
|
19
|
+
* This is used to conserve memory by avoiding array allocations.
|
|
20
|
+
*
|
|
21
|
+
* @return {*|array<*>} An accumulation of items.
|
|
22
|
+
*/
|
|
23
|
+
function accumulate(current, next) {
|
|
24
|
+
!(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulate(...): Accumulated items must be not be null or undefined.') : invariant(false) : undefined;
|
|
25
|
+
if (current == null) {
|
|
26
|
+
return next;
|
|
27
|
+
} else {
|
|
28
|
+
// Both are not empty. Warning: Never call x.concat(y) when you are not
|
|
29
|
+
// certain that x is an Array (x could be a string with concat method).
|
|
30
|
+
var currentIsArray = Array.isArray(current);
|
|
31
|
+
var nextIsArray = Array.isArray(next);
|
|
32
|
+
if (currentIsArray) {
|
|
33
|
+
return current.concat(next);
|
|
34
|
+
} else {
|
|
35
|
+
if (nextIsArray) {
|
|
36
|
+
return [current].concat(next);
|
|
37
|
+
} else {
|
|
38
|
+
return [current, next];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = accumulate;
|
package/lib/accumulateInto.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var invariant = require(
|
|
14
|
+
var invariant = require('fbjs/lib/invariant');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
@@ -28,7 +28,7 @@ var invariant = require("./invariant");
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
function accumulateInto(current, next) {
|
|
31
|
-
|
|
31
|
+
!(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
|
|
32
32
|
if (current == null) {
|
|
33
33
|
return next;
|
|
34
34
|
}
|
package/lib/adler32.js
CHANGED
|
@@ -13,17 +13,29 @@
|
|
|
13
13
|
|
|
14
14
|
var MOD = 65521;
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
16
|
+
// adler32 is not cryptographically strong, and is only used to sanity check that
|
|
17
|
+
// markup generated on the server matches the markup generated on the client.
|
|
18
|
+
// This implementation (a modified version of the SheetJS version) has been optimized
|
|
19
|
+
// for our use case, at the expense of conforming to the adler32 specification
|
|
20
|
+
// for non-ascii inputs.
|
|
20
21
|
function adler32(data) {
|
|
21
22
|
var a = 1;
|
|
22
23
|
var b = 0;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
var i = 0;
|
|
25
|
+
var l = data.length;
|
|
26
|
+
var m = l & ~0x3;
|
|
27
|
+
while (i < m) {
|
|
28
|
+
for (; i < Math.min(i + 4096, m); i += 4) {
|
|
29
|
+
b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
|
|
30
|
+
}
|
|
31
|
+
a %= MOD;
|
|
32
|
+
b %= MOD;
|
|
26
33
|
}
|
|
34
|
+
for (; i < l; i++) {
|
|
35
|
+
b += a += data.charCodeAt(i);
|
|
36
|
+
}
|
|
37
|
+
a %= MOD;
|
|
38
|
+
b %= MOD;
|
|
27
39
|
return a | b << 16;
|
|
28
40
|
}
|
|
29
41
|
|
package/lib/cloneWithProps.js
CHANGED
|
@@ -12,14 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var ReactElement = require(
|
|
16
|
-
var ReactPropTransferer = require(
|
|
15
|
+
var ReactElement = require('./ReactElement');
|
|
16
|
+
var ReactPropTransferer = require('./ReactPropTransferer');
|
|
17
17
|
|
|
18
|
-
var keyOf = require(
|
|
19
|
-
var warning = require(
|
|
18
|
+
var keyOf = require('fbjs/lib/keyOf');
|
|
19
|
+
var warning = require('fbjs/lib/warning');
|
|
20
20
|
|
|
21
21
|
var CHILDREN_PROP = keyOf({ children: null });
|
|
22
22
|
|
|
23
|
+
var didDeprecatedWarn = false;
|
|
24
|
+
|
|
23
25
|
/**
|
|
24
26
|
* Sometimes you want to change the props of a child passed to you. Usually
|
|
25
27
|
* this is to add a CSS class.
|
|
@@ -28,10 +30,13 @@ var CHILDREN_PROP = keyOf({ children: null });
|
|
|
28
30
|
* @param {object} props props you'd like to modify. className and style will be
|
|
29
31
|
* merged automatically.
|
|
30
32
|
* @return {ReactElement} a clone of child with props merged in.
|
|
33
|
+
* @deprecated
|
|
31
34
|
*/
|
|
32
35
|
function cloneWithProps(child, props) {
|
|
33
|
-
if (
|
|
34
|
-
|
|
36
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
37
|
+
process.env.NODE_ENV !== 'production' ? warning(didDeprecatedWarn, 'cloneWithProps(...) is deprecated. ' + 'Please use React.cloneElement instead.') : undefined;
|
|
38
|
+
didDeprecatedWarn = true;
|
|
39
|
+
process.env.NODE_ENV !== 'production' ? warning(!child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.') : undefined;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
var newProps = ReactPropTransferer.mergeProps(props, child.props);
|
|
@@ -41,7 +46,7 @@ function cloneWithProps(child, props) {
|
|
|
41
46
|
newProps.children = child.props.children;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
// The current API doesn't retain _owner
|
|
49
|
+
// The current API doesn't retain _owner, which is why this
|
|
45
50
|
// doesn't use ReactElement.cloneAndReplaceProps.
|
|
46
51
|
return ReactElement.createElement(child.type, newProps);
|
|
47
52
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule createHierarchyRenderer
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var React = require('./React');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Creates a render method that makes it easier to create, render, and inspect a
|
|
18
|
+
* hierarchy of mock React component classes.
|
|
19
|
+
*
|
|
20
|
+
* A component class is created for each of the supplied render methods. Each
|
|
21
|
+
* render method is invoked with the classes created using the render methods
|
|
22
|
+
* that come after it in the supplied list of render methods.
|
|
23
|
+
*
|
|
24
|
+
* var renderHierarchy = createHierarchyRenderer(
|
|
25
|
+
* function ComponentA(ComponentB, ComponentC) {...},
|
|
26
|
+
* function ComponentB(ComponentC) {...},
|
|
27
|
+
* function ComponentC() {...}
|
|
28
|
+
* );
|
|
29
|
+
*
|
|
30
|
+
* When the hierarchy is invoked, a two-dimensional array is returned. Each
|
|
31
|
+
* array corresponds to a supplied render method and contains the instances
|
|
32
|
+
* returned by that render method in the order it was invoked.
|
|
33
|
+
*
|
|
34
|
+
* var instances = renderHierarchy(
|
|
35
|
+
* function(ComponentA[, ComponentB, ComponentC]) {
|
|
36
|
+
* React.render(<ComponentA />, ...);
|
|
37
|
+
* })
|
|
38
|
+
* );
|
|
39
|
+
* instances[0][0]; // First return value of first render method.
|
|
40
|
+
* instances[1][0]; // First return value of second render method.
|
|
41
|
+
* instances[1][1]; // Second return value of second render method.
|
|
42
|
+
*
|
|
43
|
+
* Refs should be used to reference components that are not the return value of
|
|
44
|
+
* render methods.
|
|
45
|
+
*
|
|
46
|
+
* expect(instances[0][0].refs.X).toBe(...);
|
|
47
|
+
*
|
|
48
|
+
* NOTE: The component classes created for each render method are re-used for
|
|
49
|
+
* each invocation of the hierarchy renderer. If new classes are needed, you
|
|
50
|
+
* should re-execute `createHierarchyRenderer` with the same arguments.
|
|
51
|
+
*
|
|
52
|
+
* @param {array<function>} ...renderMethods
|
|
53
|
+
* @return {function}
|
|
54
|
+
*/
|
|
55
|
+
function createHierarchyRenderer() {
|
|
56
|
+
for (var _len = arguments.length, renderMethods = Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
|
+
renderMethods[_key] = arguments[_key];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var instances;
|
|
61
|
+
var Components = renderMethods.reduceRight(function (ComponentsAccumulator, renderMethod, depth) {
|
|
62
|
+
var Component = React.createClass({
|
|
63
|
+
displayName: renderMethod.name,
|
|
64
|
+
render: function () {
|
|
65
|
+
instances[depth].push(this);
|
|
66
|
+
return renderMethod.apply(this, ComponentsAccumulator);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return [Component].concat(ComponentsAccumulator);
|
|
70
|
+
}, []);
|
|
71
|
+
/**
|
|
72
|
+
* @param {function} renderComponent
|
|
73
|
+
* @return {array<array<*>>}
|
|
74
|
+
*/
|
|
75
|
+
function renderHierarchy(renderComponent) {
|
|
76
|
+
instances = renderMethods.map(function () {
|
|
77
|
+
return [];
|
|
78
|
+
});
|
|
79
|
+
renderComponent.apply(null, Components);
|
|
80
|
+
return instances;
|
|
81
|
+
}
|
|
82
|
+
return renderHierarchy;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = createHierarchyRenderer;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule deprecated
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var assign = require('./Object.assign');
|
|
15
|
+
var warning = require('fbjs/lib/warning');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This will log a single deprecation notice per function and forward the call
|
|
19
|
+
* on to the new API.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} fnName The name of the function
|
|
22
|
+
* @param {string} newModule The module that fn will exist in
|
|
23
|
+
* @param {*} ctx The context this forwarded call should run in
|
|
24
|
+
* @param {function} fn The function to forward on to
|
|
25
|
+
* @return {function} The function that will warn once and then call fn
|
|
26
|
+
*/
|
|
27
|
+
function deprecated(fnName, newModule, ctx, fn) {
|
|
28
|
+
var warned = false;
|
|
29
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
30
|
+
var newFn = function () {
|
|
31
|
+
process.env.NODE_ENV !== 'production' ? warning(warned,
|
|
32
|
+
// Require examples in this string must be split to prevent React's
|
|
33
|
+
// build tools from mistaking them for real requires.
|
|
34
|
+
// Otherwise the build tools will attempt to build a '%s' module.
|
|
35
|
+
'`require' + '("react").%s` is deprecated. Please use `require' + '("%s").%s` ' + 'instead.', fnName, newModule, fnName) : undefined;
|
|
36
|
+
warned = true;
|
|
37
|
+
return fn.apply(ctx, arguments);
|
|
38
|
+
};
|
|
39
|
+
// We need to make sure all properties of the original fn are copied over.
|
|
40
|
+
// In particular, this is needed to support PropTypes
|
|
41
|
+
return assign(newFn, fn);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return fn;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = deprecated;
|
package/lib/findDOMNode.js
CHANGED
|
@@ -12,39 +12,38 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var ReactCurrentOwner = require(
|
|
16
|
-
var ReactInstanceMap = require(
|
|
17
|
-
var ReactMount = require(
|
|
15
|
+
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
16
|
+
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
17
|
+
var ReactMount = require('./ReactMount');
|
|
18
18
|
|
|
19
|
-
var invariant = require(
|
|
20
|
-
var
|
|
21
|
-
var warning = require("./warning");
|
|
19
|
+
var invariant = require('fbjs/lib/invariant');
|
|
20
|
+
var warning = require('fbjs/lib/warning');
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Returns the DOM node rendered by this element.
|
|
25
24
|
*
|
|
26
25
|
* @param {ReactComponent|DOMElement} componentOrElement
|
|
27
|
-
* @return {DOMElement} The root node of this element.
|
|
26
|
+
* @return {?DOMElement} The root node of this element.
|
|
28
27
|
*/
|
|
29
28
|
function findDOMNode(componentOrElement) {
|
|
30
|
-
if (
|
|
29
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
31
30
|
var owner = ReactCurrentOwner.current;
|
|
32
31
|
if (owner !== null) {
|
|
33
|
-
|
|
32
|
+
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
|
|
34
33
|
owner._warnedAboutRefsInRender = true;
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
if (componentOrElement == null) {
|
|
38
37
|
return null;
|
|
39
38
|
}
|
|
40
|
-
if (
|
|
39
|
+
if (componentOrElement.nodeType === 1) {
|
|
41
40
|
return componentOrElement;
|
|
42
41
|
}
|
|
43
42
|
if (ReactInstanceMap.has(componentOrElement)) {
|
|
44
43
|
return ReactMount.getNodeFromInstance(componentOrElement);
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
!(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Component (with keys: %s) contains `render` method ' + 'but is not mounted in the DOM', Object.keys(componentOrElement)) : invariant(false) : undefined;
|
|
46
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
module.exports = findDOMNode;
|
package/lib/flattenChildren.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var traverseAllChildren = require(
|
|
15
|
-
var warning = require(
|
|
14
|
+
var traverseAllChildren = require('./traverseAllChildren');
|
|
15
|
+
var warning = require('fbjs/lib/warning');
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @param {function} traverseContext Context passed through traversal.
|
|
@@ -23,8 +23,8 @@ function flattenSingleChildIntoContext(traverseContext, child, name) {
|
|
|
23
23
|
// We found a component instance.
|
|
24
24
|
var result = traverseContext;
|
|
25
25
|
var keyUnique = result[name] === undefined;
|
|
26
|
-
if (
|
|
27
|
-
|
|
26
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
27
|
+
process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
|
|
28
28
|
}
|
|
29
29
|
if (keyUnique && child != null) {
|
|
30
30
|
result[name] = child;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @param {array} an "accumulation" of items which is either an Array or
|
|
15
|
+
* @param {array} arr an "accumulation" of items which is either an Array or
|
|
16
16
|
* a single item. Useful when paired with the `accumulate` module. This is a
|
|
17
17
|
* simple utility that allows us to reason about a collection of items, but
|
|
18
18
|
* handling the case when there is exactly one item (and we do not need to
|
package/lib/getEventCharCode.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* presumably because it does not produce a tab-character in browsers.
|
|
21
21
|
*
|
|
22
22
|
* @param {object} nativeEvent Native browser event.
|
|
23
|
-
* @return {
|
|
23
|
+
* @return {number} Normalized `charCode` property.
|
|
24
24
|
*/
|
|
25
25
|
function getEventCharCode(nativeEvent) {
|
|
26
26
|
var charCode;
|
package/lib/getEventKey.js
CHANGED
|
@@ -28,7 +28,6 @@ var modifierKeyToProp = {
|
|
|
28
28
|
// modifier keys exposed by the event itself, does not support Lock-keys.
|
|
29
29
|
// Currently, all major browsers except Chrome seems to support Lock-keys.
|
|
30
30
|
function modifierStateGetter(keyArg) {
|
|
31
|
-
/*jshint validthis:true */
|
|
32
31
|
var syntheticEvent = this;
|
|
33
32
|
var nativeEvent = syntheticEvent.nativeEvent;
|
|
34
33
|
if (nativeEvent.getModifierState) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2015, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule getTestDocument
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
function getTestDocument(markup) {
|
|
15
|
+
var iframe = document.createElement('iframe');
|
|
16
|
+
iframe.style.display = 'none';
|
|
17
|
+
document.body.appendChild(iframe);
|
|
18
|
+
|
|
19
|
+
var testDocument = iframe.contentDocument || iframe.contentWindow.document;
|
|
20
|
+
testDocument.open();
|
|
21
|
+
testDocument.write(markup || '<!doctype html><html><meta charset=utf-8><title>test doc</title>');
|
|
22
|
+
testDocument.close();
|
|
23
|
+
|
|
24
|
+
iframe.parentNode.removeChild(iframe);
|
|
25
|
+
return testDocument;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = getTestDocument;
|