react 0.9.0-rc1 → 0.11.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/README.md +3 -0
- package/dist/JSXTransformer.js +13445 -0
- package/dist/react-with-addons.js +20226 -0
- package/dist/react-with-addons.min.js +22 -0
- package/dist/react.js +18434 -0
- package/dist/react.min.js +21 -0
- package/lib/AutoFocusMixin.js +4 -2
- package/lib/BeforeInputEventPlugin.js +222 -0
- package/lib/CSSCore.js +1 -1
- package/lib/CSSProperty.js +1 -1
- package/lib/CSSPropertyOperations.js +4 -4
- package/lib/{ReactMountReady.js → CallbackQueue.js} +33 -25
- package/lib/ChangeEventPlugin.js +2 -2
- package/lib/ClientReactRootIndex.js +1 -1
- package/lib/CompositionEventPlugin.js +6 -2
- package/lib/DOMChildrenOperations.js +34 -21
- package/lib/DOMProperty.js +52 -22
- package/lib/DOMPropertyOperations.js +29 -17
- package/lib/Danger.js +1 -1
- package/lib/DefaultEventPluginOrder.js +2 -1
- package/lib/EnterLeaveEventPlugin.js +1 -1
- package/lib/EventConstants.js +2 -1
- package/lib/EventListener.js +5 -2
- package/lib/EventPluginHub.js +5 -6
- package/lib/EventPluginRegistry.js +27 -4
- package/lib/EventPluginUtils.js +12 -2
- package/lib/EventPropagators.js +1 -1
- package/lib/ExecutionEnvironment.js +9 -3
- package/lib/{DefaultDOMPropertyConfig.js → HTMLDOMPropertyConfig.js} +47 -58
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +27 -29
- package/lib/LocalEventTrapMixin.js +52 -0
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +39 -4
- package/lib/ReactBrowserComponentMixin.js +46 -0
- package/lib/{ReactEventEmitter.js → ReactBrowserEventEmitter.js} +118 -95
- package/lib/ReactCSSTransitionGroup.js +13 -11
- package/lib/ReactCSSTransitionGroupChild.js +3 -6
- package/lib/ReactChildren.js +35 -14
- package/lib/ReactComponent.js +120 -224
- package/lib/ReactComponentBrowserEnvironment.js +4 -37
- package/lib/ReactComponentWithPureRenderMixin.js +54 -0
- package/lib/ReactCompositeComponent.js +250 -288
- package/lib/ReactContext.js +1 -1
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +26 -24
- package/lib/ReactDOMButton.js +3 -2
- package/lib/ReactDOMComponent.js +43 -24
- package/lib/ReactDOMForm.js +8 -13
- package/lib/ReactDOMIDOperations.js +3 -32
- package/lib/ReactDOMImg.js +8 -14
- package/lib/ReactDOMInput.js +3 -2
- package/lib/ReactDOMOption.js +12 -8
- package/lib/ReactDOMSelect.js +19 -17
- package/lib/ReactDOMSelection.js +36 -11
- package/lib/ReactDOMTextarea.js +10 -8
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +28 -15
- package/lib/ReactDefaultPerf.js +29 -12
- package/lib/ReactDefaultPerfAnalysis.js +5 -1
- package/lib/ReactDescriptor.js +243 -0
- package/lib/ReactDescriptorValidator.js +283 -0
- package/lib/ReactEmptyComponent.js +78 -0
- package/lib/ReactErrorUtils.js +1 -1
- package/lib/ReactEventEmitterMixin.js +2 -4
- package/lib/ReactEventListener.js +189 -0
- package/lib/ReactInjection.js +9 -3
- package/lib/ReactInputSelection.js +3 -2
- package/lib/ReactInstanceHandles.js +1 -1
- package/lib/ReactLink.js +25 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +62 -22
- package/lib/ReactMultiChild.js +19 -14
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactOwner.js +7 -2
- package/lib/ReactPerf.js +1 -1
- package/lib/ReactPropTransferer.js +45 -30
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +222 -238
- package/lib/ReactPutListenerQueue.js +3 -3
- package/lib/ReactReconcileTransaction.js +22 -21
- package/lib/ReactRootIndex.js +1 -1
- package/lib/ReactServerRendering.js +42 -12
- package/lib/ReactServerRenderingTransaction.js +115 -0
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +412 -0
- package/lib/ReactTextComponent.js +22 -14
- package/lib/ReactTransitionChildMapping.js +3 -3
- package/lib/ReactTransitionEvents.js +20 -1
- package/lib/ReactTransitionGroup.js +10 -7
- package/lib/ReactUpdates.js +140 -23
- package/lib/ReactWithAddons.js +13 -3
- package/lib/SVGDOMPropertyConfig.js +97 -0
- package/lib/SelectEventPlugin.js +1 -1
- package/lib/ServerReactRootIndex.js +1 -1
- package/lib/SimpleEventPlugin.js +8 -2
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +1 -1
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +52 -0
- package/lib/SyntheticKeyboardEvent.js +34 -5
- package/lib/SyntheticMouseEvent.js +4 -1
- package/lib/SyntheticTouchEvent.js +5 -2
- package/lib/SyntheticUIEvent.js +25 -3
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/Transaction.js +1 -33
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/cloneWithProps.js +11 -9
- package/lib/containsNode.js +1 -1
- package/lib/copyProperties.js +1 -1
- package/lib/createArrayFrom.js +1 -1
- package/lib/createFullPageComponent.js +2 -2
- package/lib/createNodesFromMarkup.js +1 -1
- package/lib/cx.js +1 -1
- package/lib/dangerousStyleValue.js +12 -6
- package/lib/emptyFunction.js +1 -1
- package/lib/{ReactComponentEnvironment.js → emptyObject.js} +7 -6
- package/lib/escapeTextForBrowser.js +3 -4
- package/lib/flattenChildren.js +10 -8
- package/lib/focusNode.js +33 -0
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getActiveElement.js +1 -1
- package/lib/getEventKey.js +36 -6
- package/lib/getEventModifierState.js +52 -0
- package/lib/getEventTarget.js +1 -1
- package/lib/getMarkupWrap.js +3 -1
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getReactRootElementInContainer.js +1 -1
- package/lib/getTextContentAccessor.js +2 -2
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +4 -1
- package/lib/hyphenateStyleName.js +46 -0
- package/lib/instantiateReactComponent.js +62 -0
- package/lib/invariant.js +21 -23
- package/lib/isEventSupported.js +1 -1
- package/lib/isNode.js +2 -2
- package/lib/isTextInputElement.js +1 -1
- package/lib/isTextNode.js +1 -1
- package/lib/joinClasses.js +1 -1
- package/lib/keyMirror.js +1 -1
- package/lib/keyOf.js +1 -1
- package/lib/{objMap.js → mapObject.js} +9 -4
- package/lib/memoizeStringOnly.js +1 -1
- package/lib/merge.js +1 -1
- package/lib/mergeHelpers.js +12 -1
- package/lib/mergeInto.js +4 -3
- package/lib/mixInto.js +1 -1
- package/lib/monitorCodeUse.js +37 -0
- package/lib/onlyChild.js +4 -4
- package/lib/performance.js +33 -0
- package/lib/performanceNow.js +6 -15
- package/lib/setInnerHTML.js +77 -0
- package/lib/shallowEqual.js +1 -1
- package/lib/shouldUpdateReactComponent.js +15 -29
- package/lib/toArray.js +1 -1
- package/lib/traverseAllChildren.js +10 -6
- package/lib/update.js +171 -0
- package/lib/warning.js +19 -11
- package/package.json +5 -3
- package/lib/ReactEventTopLevelCallback.js +0 -109
- package/lib/createObjectFrom.js +0 -61
- package/lib/objMapKeyVal.js +0 -47
package/lib/warning.js
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
* @providesModule warning
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
"use strict";
|
|
20
|
+
|
|
21
|
+
var emptyFunction = require("./emptyFunction");
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
@@ -23,18 +26,23 @@
|
|
|
23
26
|
* paths. Removing the logging code for production environments will keep the
|
|
24
27
|
* same logic and follow the same code paths.
|
|
25
28
|
*/
|
|
26
|
-
function warning(condition, format ) {var args=Array.prototype.slice.call(arguments,2);
|
|
27
|
-
if (format === undefined) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
'`warning(condition, format, ...args)` requires a warning ' +
|
|
30
|
-
'message argument'
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
var warning = emptyFunction;
|
|
31
|
+
|
|
32
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
33
|
+
warning = function(condition, format ) {var args=Array.prototype.slice.call(arguments,2);
|
|
34
|
+
if (format === undefined) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
'`warning(condition, format, ...args)` requires a warning ' +
|
|
37
|
+
'message argument'
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!condition) {
|
|
42
|
+
var argIndex = 0;
|
|
43
|
+
console.warn('Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];}));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
module.exports = warning;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react",
|
|
3
|
-
"
|
|
3
|
+
"description": "React is a JavaScript library for building user interfaces.",
|
|
4
|
+
"version": "0.11.0-rc1",
|
|
4
5
|
"keywords": [
|
|
5
6
|
"react"
|
|
6
7
|
],
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
"README.md",
|
|
17
18
|
"addons.js",
|
|
18
19
|
"react.js",
|
|
20
|
+
"dist/",
|
|
19
21
|
"lib/"
|
|
20
22
|
],
|
|
21
23
|
"main": "react.js",
|
|
@@ -26,8 +28,8 @@
|
|
|
26
28
|
"engines": {
|
|
27
29
|
"node": ">=0.10.0"
|
|
28
30
|
},
|
|
29
|
-
"
|
|
30
|
-
"envify": "
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"envify": "^2.0.0"
|
|
31
33
|
},
|
|
32
34
|
"browserify": {
|
|
33
35
|
"transform": [
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013 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 ReactEventTopLevelCallback
|
|
17
|
-
* @typechecks static-only
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
"use strict";
|
|
21
|
-
|
|
22
|
-
var ReactEventEmitter = require("./ReactEventEmitter");
|
|
23
|
-
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
24
|
-
var ReactMount = require("./ReactMount");
|
|
25
|
-
|
|
26
|
-
var getEventTarget = require("./getEventTarget");
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @type {boolean}
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
var _topLevelListenersEnabled = true;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Finds the parent React component of `node`.
|
|
36
|
-
*
|
|
37
|
-
* @param {*} node
|
|
38
|
-
* @return {?DOMEventTarget} Parent container, or `null` if the specified node
|
|
39
|
-
* is not nested.
|
|
40
|
-
*/
|
|
41
|
-
function findParent(node) {
|
|
42
|
-
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
|
|
43
|
-
// traversal, but caching is difficult to do correctly without using a
|
|
44
|
-
// mutation observer to listen for all DOM changes.
|
|
45
|
-
var nodeID = ReactMount.getID(node);
|
|
46
|
-
var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
|
|
47
|
-
var container = ReactMount.findReactContainerForID(rootID);
|
|
48
|
-
var parent = ReactMount.getFirstReactDOM(container);
|
|
49
|
-
return parent;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Top-level callback creator used to implement event handling using delegation.
|
|
54
|
-
* This is used via dependency injection.
|
|
55
|
-
*/
|
|
56
|
-
var ReactEventTopLevelCallback = {
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Sets whether or not any created callbacks should be enabled.
|
|
60
|
-
*
|
|
61
|
-
* @param {boolean} enabled True if callbacks should be enabled.
|
|
62
|
-
*/
|
|
63
|
-
setEnabled: function(enabled) {
|
|
64
|
-
_topLevelListenersEnabled = !!enabled;
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @return {boolean} True if callbacks are enabled.
|
|
69
|
-
*/
|
|
70
|
-
isEnabled: function() {
|
|
71
|
-
return _topLevelListenersEnabled;
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Creates a callback for the supplied `topLevelType` that could be added as
|
|
76
|
-
* a listener to the document. The callback computes a `topLevelTarget` which
|
|
77
|
-
* should be the root node of a mounted React component where the listener
|
|
78
|
-
* is attached.
|
|
79
|
-
*
|
|
80
|
-
* @param {string} topLevelType Record from `EventConstants`.
|
|
81
|
-
* @return {function} Callback for handling top-level events.
|
|
82
|
-
*/
|
|
83
|
-
createTopLevelCallback: function(topLevelType) {
|
|
84
|
-
return function(nativeEvent) {
|
|
85
|
-
if (!_topLevelListenersEnabled) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
var topLevelTarget = ReactMount.getFirstReactDOM(
|
|
89
|
-
getEventTarget(nativeEvent)
|
|
90
|
-
) || window;
|
|
91
|
-
|
|
92
|
-
// Loop through the hierarchy, in case there's any nested components.
|
|
93
|
-
while (topLevelTarget) {
|
|
94
|
-
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
|
|
95
|
-
ReactEventEmitter.handleTopLevel(
|
|
96
|
-
topLevelType,
|
|
97
|
-
topLevelTarget,
|
|
98
|
-
topLevelTargetID,
|
|
99
|
-
nativeEvent
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
topLevelTarget = findParent(topLevelTarget);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
module.exports = ReactEventTopLevelCallback;
|
package/lib/createObjectFrom.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013 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 createObjectFrom
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Construct an object from an array of keys
|
|
21
|
-
* and optionally specified value or list of values.
|
|
22
|
-
*
|
|
23
|
-
* >>> createObjectFrom(['a','b','c']);
|
|
24
|
-
* {a: true, b: true, c: true}
|
|
25
|
-
*
|
|
26
|
-
* >>> createObjectFrom(['a','b','c'], false);
|
|
27
|
-
* {a: false, b: false, c: false}
|
|
28
|
-
*
|
|
29
|
-
* >>> createObjectFrom(['a','b','c'], 'monkey');
|
|
30
|
-
* {c:'monkey', b:'monkey' c:'monkey'}
|
|
31
|
-
*
|
|
32
|
-
* >>> createObjectFrom(['a','b','c'], [1,2,3]);
|
|
33
|
-
* {a: 1, b: 2, c: 3}
|
|
34
|
-
*
|
|
35
|
-
* >>> createObjectFrom(['women', 'men'], [true, false]);
|
|
36
|
-
* {women: true, men: false}
|
|
37
|
-
*
|
|
38
|
-
* @param Array list of keys
|
|
39
|
-
* @param mixed optional value or value array. defaults true.
|
|
40
|
-
* @returns object
|
|
41
|
-
*/
|
|
42
|
-
function createObjectFrom(keys, values /* = true */) {
|
|
43
|
-
if ("production" !== process.env.NODE_ENV) {
|
|
44
|
-
if (!Array.isArray(keys)) {
|
|
45
|
-
throw new TypeError('Must pass an array of keys.');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
var object = {};
|
|
50
|
-
var isArray = Array.isArray(values);
|
|
51
|
-
if (typeof values == 'undefined') {
|
|
52
|
-
values = true;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
for (var ii = keys.length; ii--;) {
|
|
56
|
-
object[keys[ii]] = isArray ? values[ii] : values;
|
|
57
|
-
}
|
|
58
|
-
return object;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
module.exports = createObjectFrom;
|
package/lib/objMapKeyVal.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013 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 objMapKeyVal
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
"use strict";
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Behaves the same as `objMap` but invokes func with the key first, and value
|
|
23
|
-
* second. Use `objMap` unless you need this special case.
|
|
24
|
-
* Invokes func as:
|
|
25
|
-
*
|
|
26
|
-
* func(key, value, iteration)
|
|
27
|
-
*
|
|
28
|
-
* @param {?object} obj Object to map keys over
|
|
29
|
-
* @param {!function} func Invoked for each key/val pair.
|
|
30
|
-
* @param {?*} context
|
|
31
|
-
* @return {?object} Result of mapping or null if obj is falsey
|
|
32
|
-
*/
|
|
33
|
-
function objMapKeyVal(obj, func, context) {
|
|
34
|
-
if (!obj) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
var i = 0;
|
|
38
|
-
var ret = {};
|
|
39
|
-
for (var key in obj) {
|
|
40
|
-
if (obj.hasOwnProperty(key)) {
|
|
41
|
-
ret[key] = func.call(context, key, obj[key], i++);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return ret;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports = objMapKeyVal;
|