react 0.13.0-alpha.1 → 0.13.0-alpha.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 +452 -360
- package/dist/react-with-addons.js +1407 -1021
- package/dist/react-with-addons.min.js +5 -6
- package/dist/react.js +1317 -933
- package/dist/react.min.js +5 -6
- package/lib/AutoFocusMixin.js +1 -1
- package/lib/BeforeInputEventPlugin.js +4 -4
- package/lib/CSSProperty.js +1 -1
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/CallbackQueue.js +2 -2
- package/lib/ChangeEventPlugin.js +1 -1
- package/lib/ClientReactRootIndex.js +1 -1
- package/lib/DOMChildrenOperations.js +6 -4
- package/lib/DOMProperty.js +1 -1
- package/lib/DOMPropertyOperations.js +1 -1
- package/lib/Danger.js +6 -5
- package/lib/DefaultEventPluginOrder.js +1 -1
- package/lib/EnterLeaveEventPlugin.js +1 -1
- package/lib/EventConstants.js +1 -1
- package/lib/EventPluginHub.js +9 -7
- package/lib/EventPluginRegistry.js +1 -1
- package/lib/EventPluginUtils.js +1 -1
- package/lib/EventPropagators.js +1 -1
- package/lib/FallbackCompositionState.js +6 -4
- package/lib/HTMLDOMPropertyConfig.js +12 -7
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +3 -3
- package/lib/LocalEventTrapMixin.js +1 -1
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +4 -2
- package/lib/ReactBrowserComponentMixin.js +1 -1
- package/lib/ReactBrowserEventEmitter.js +2 -2
- package/lib/ReactCSSTransitionGroup.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +4 -2
- package/lib/ReactChildReconciler.js +2 -2
- package/lib/ReactChildren.js +10 -8
- package/lib/ReactClass.js +30 -72
- package/lib/ReactComponent.js +10 -1
- package/lib/ReactComponentBase.js +126 -0
- package/lib/ReactComponentBrowserEnvironment.js +1 -1
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +90 -17
- package/lib/ReactContext.js +1 -1
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +1 -1
- package/lib/ReactDOMButton.js +1 -1
- package/lib/ReactDOMComponent.js +23 -8
- package/lib/ReactDOMForm.js +1 -1
- package/lib/ReactDOMIDOperations.js +1 -1
- package/lib/ReactDOMImg.js +1 -1
- package/lib/ReactDOMInput.js +1 -1
- package/lib/ReactDOMOption.js +1 -1
- package/lib/ReactDOMSelect.js +2 -2
- package/lib/ReactDOMSelection.js +1 -1
- package/lib/ReactDOMTextComponent.js +1 -1
- package/lib/ReactDOMTextarea.js +1 -1
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +1 -1
- package/lib/ReactDefaultPerf.js +1 -1
- package/lib/ReactElement.js +5 -4
- package/lib/ReactElementValidator.js +91 -1
- package/lib/ReactEmptyComponent.js +12 -1
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +3 -3
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +1 -1
- package/lib/ReactInstanceHandles.js +3 -2
- package/lib/ReactInstanceMap.js +1 -1
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +10 -3
- package/lib/ReactMultiChild.js +12 -3
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +1 -1
- package/lib/ReactOwner.js +1 -1
- package/lib/ReactPerf.js +1 -1
- package/lib/ReactPropTransferer.js +2 -2
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +13 -5
- package/lib/ReactPutListenerQueue.js +1 -1
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactRef.js +1 -1
- package/lib/ReactRootIndex.js +1 -1
- package/lib/ReactServerRendering.js +3 -2
- package/lib/ReactServerRenderingTransaction.js +1 -1
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +1 -1
- package/lib/ReactTransitionChildMapping.js +1 -1
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +1 -1
- package/lib/ReactUpdates.js +4 -4
- package/lib/ReactWithAddons.js +1 -1
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +3 -3
- package/lib/ServerReactRootIndex.js +1 -1
- package/lib/SimpleEventPlugin.js +1 -1
- package/lib/SyntheticClipboardEvent.js +1 -2
- package/lib/SyntheticCompositionEvent.js +1 -2
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +11 -3
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -2
- package/lib/SyntheticKeyboardEvent.js +1 -1
- package/lib/SyntheticMouseEvent.js +1 -1
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/Transaction.js +3 -3
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +1 -1
- package/lib/accumulateInto.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/cloneWithProps.js +1 -1
- package/lib/createFullPageComponent.js +1 -1
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/escapeTextForBrowser.js +6 -6
- package/lib/findDOMNode.js +8 -9
- package/lib/flattenChildren.js +10 -8
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -1
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +1 -1
- package/lib/getNodeForCharacterOffset.js +2 -2
- package/lib/getReactRootElementInContainer.js +1 -1
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +1 -1
- package/lib/isEventSupported.js +1 -1
- package/lib/isTextInputElement.js +1 -1
- package/lib/joinClasses.js +1 -1
- package/lib/keyMirror.js +1 -1
- package/lib/memoizeStringOnly.js +4 -5
- package/lib/onlyChild.js +1 -1
- package/lib/setInnerHTML.js +12 -1
- package/lib/shallowEqual.js +1 -1
- package/lib/shouldUpdateReactComponent.js +41 -7
- package/lib/traverseAllChildren.js +1 -1
- package/lib/update.js +1 -1
- package/lib/warning.js +8 -1
- package/package.json +1 -1
package/lib/SyntheticUIEvent.js
CHANGED
package/lib/Transaction.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule Transaction
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var invariant = require("./invariant");
|
|
15
15
|
|
|
@@ -203,8 +203,8 @@ var Mixin = {
|
|
|
203
203
|
// close -- if it's still set to true in the finally block, it means
|
|
204
204
|
// wrapper.close threw.
|
|
205
205
|
errorThrown = true;
|
|
206
|
-
if (initData !== Transaction.OBSERVED_ERROR) {
|
|
207
|
-
wrapper.close
|
|
206
|
+
if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
|
|
207
|
+
wrapper.close.call(this, initData);
|
|
208
208
|
}
|
|
209
209
|
errorThrown = false;
|
|
210
210
|
} finally {
|
package/lib/ViewportMetrics.js
CHANGED
package/lib/accumulate.js
CHANGED
package/lib/accumulateInto.js
CHANGED
package/lib/adler32.js
CHANGED
package/lib/cloneWithProps.js
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var ESCAPE_LOOKUP = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
16
|
+
'&': '&',
|
|
17
|
+
'>': '>',
|
|
18
|
+
'<': '<',
|
|
19
|
+
'"': '"',
|
|
20
|
+
'\'': '''
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
var ESCAPE_REGEX = /[&><"']/g;
|
package/lib/findDOMNode.js
CHANGED
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var ReactComponent = require("./ReactComponent");
|
|
13
|
+
'use strict';
|
|
16
14
|
var ReactInstanceMap = require("./ReactInstanceMap");
|
|
17
15
|
var ReactMount = require("./ReactMount");
|
|
18
16
|
|
|
@@ -22,7 +20,7 @@ var isNode = require("./isNode");
|
|
|
22
20
|
/**
|
|
23
21
|
* Returns the DOM node rendered by this element.
|
|
24
22
|
*
|
|
25
|
-
* @param {ReactComponent|DOMElement}
|
|
23
|
+
* @param {ReactComponent|DOMElement} componentOrElement
|
|
26
24
|
* @return {DOMElement} The root node of this element.
|
|
27
25
|
*/
|
|
28
26
|
function findDOMNode(componentOrElement) {
|
|
@@ -36,12 +34,13 @@ function findDOMNode(componentOrElement) {
|
|
|
36
34
|
return ReactMount.getNodeFromInstance(componentOrElement);
|
|
37
35
|
}
|
|
38
36
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
componentOrElement.render == null ||
|
|
38
|
+
typeof componentOrElement.render !== 'function',
|
|
39
|
+
'Component (with keys: %s) contains `render` method ' +
|
|
40
|
+
'but is not mounted in the DOM',
|
|
41
41
|
Object.keys(componentOrElement)
|
|
42
|
-
) : invariant(
|
|
43
|
-
|
|
44
|
-
));
|
|
42
|
+
) : invariant(componentOrElement.render == null ||
|
|
43
|
+
typeof componentOrElement.render !== 'function'));
|
|
45
44
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
46
45
|
false,
|
|
47
46
|
'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
|
package/lib/flattenChildren.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule flattenChildren
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var traverseAllChildren = require("./traverseAllChildren");
|
|
15
15
|
var warning = require("./warning");
|
|
@@ -23,13 +23,15 @@ function flattenSingleChildIntoContext(traverseContext, child, name) {
|
|
|
23
23
|
// We found a component instance.
|
|
24
24
|
var result = traverseContext;
|
|
25
25
|
var keyUnique = !result.hasOwnProperty(name);
|
|
26
|
-
("production" !== process.env.NODE_ENV
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
27
|
+
("production" !== process.env.NODE_ENV ? warning(
|
|
28
|
+
keyUnique,
|
|
29
|
+
'flattenChildren(...): Encountered two children with the same key, ' +
|
|
30
|
+
'`%s`. Child keys must be unique; when two children share a key, only ' +
|
|
31
|
+
'the first child will be used.',
|
|
32
|
+
name
|
|
33
|
+
) : null);
|
|
34
|
+
}
|
|
33
35
|
if (keyUnique && child != null) {
|
|
34
36
|
result[name] = child;
|
|
35
37
|
}
|
package/lib/getEventCharCode.js
CHANGED
package/lib/getEventKey.js
CHANGED
package/lib/getEventTarget.js
CHANGED
package/lib/getIteratorFn.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule getNodeForCharacterOffset
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Given any node return the first leaf node without children.
|
|
@@ -53,7 +53,7 @@ function getNodeForCharacterOffset(root, offset) {
|
|
|
53
53
|
var nodeEnd = 0;
|
|
54
54
|
|
|
55
55
|
while (node) {
|
|
56
|
-
if (node.nodeType
|
|
56
|
+
if (node.nodeType === 3) {
|
|
57
57
|
nodeEnd = nodeStart + node.textContent.length;
|
|
58
58
|
|
|
59
59
|
if (nodeStart <= offset && nodeEnd >= offset) {
|
package/lib/isEventSupported.js
CHANGED
package/lib/joinClasses.js
CHANGED
package/lib/keyMirror.js
CHANGED
package/lib/memoizeStringOnly.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Memoizes the return value of a function that accepts one string argument.
|
|
@@ -21,11 +21,10 @@
|
|
|
21
21
|
function memoizeStringOnly(callback) {
|
|
22
22
|
var cache = {};
|
|
23
23
|
return function(string) {
|
|
24
|
-
if (cache.hasOwnProperty(string)) {
|
|
25
|
-
|
|
26
|
-
} else {
|
|
27
|
-
return cache[string] = callback.call(this, string);
|
|
24
|
+
if (!cache.hasOwnProperty(string)) {
|
|
25
|
+
cache[string] = callback.call(this, string);
|
|
28
26
|
}
|
|
27
|
+
return cache[string];
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
|
package/lib/onlyChild.js
CHANGED
package/lib/setInnerHTML.js
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* @providesModule setInnerHTML
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/* globals MSApp */
|
|
13
|
+
|
|
14
|
+
'use strict';
|
|
13
15
|
|
|
14
16
|
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
15
17
|
|
|
@@ -28,6 +30,15 @@ var setInnerHTML = function(node, html) {
|
|
|
28
30
|
node.innerHTML = html;
|
|
29
31
|
};
|
|
30
32
|
|
|
33
|
+
// Win8 apps: Allow all html to be inserted
|
|
34
|
+
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
|
|
35
|
+
setInnerHTML = function(node, html) {
|
|
36
|
+
MSApp.execUnsafeLocalFunction(function() {
|
|
37
|
+
node.innerHTML = html;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
if (ExecutionEnvironment.canUseDOM) {
|
|
32
43
|
// IE8: When updating a just created node with innerHTML only leading
|
|
33
44
|
// whitespace is removed. When updating an existing node with innerHTML
|
package/lib/shallowEqual.js
CHANGED
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
var monitorCodeUse = require("./monitorCodeUse");
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Given a `prevElement` and `nextElement`, determines if the existing
|
|
@@ -30,12 +32,44 @@ function shouldUpdateReactComponent(prevElement, nextElement) {
|
|
|
30
32
|
if (prevType === 'string' || prevType === 'number') {
|
|
31
33
|
return (nextType === 'string' || nextType === 'number');
|
|
32
34
|
} else {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
prevElement.
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
if (nextType === 'object' &&
|
|
36
|
+
prevElement.type === nextElement.type &&
|
|
37
|
+
prevElement.key === nextElement.key) {
|
|
38
|
+
var ownersMatch = prevElement._owner === nextElement._owner;
|
|
39
|
+
var prevName = null;
|
|
40
|
+
var nextName = null;
|
|
41
|
+
var nextDisplayName = null;
|
|
42
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
43
|
+
if (!ownersMatch) {
|
|
44
|
+
if (prevElement._owner != null &&
|
|
45
|
+
prevElement._owner.getPublicInstance() != null &&
|
|
46
|
+
prevElement._owner.getPublicInstance().constructor != null) {
|
|
47
|
+
prevName =
|
|
48
|
+
prevElement._owner.getPublicInstance().constructor.displayName;
|
|
49
|
+
}
|
|
50
|
+
if (nextElement._owner != null &&
|
|
51
|
+
nextElement._owner.getPublicInstance() != null &&
|
|
52
|
+
nextElement._owner.getPublicInstance().constructor != null) {
|
|
53
|
+
nextName =
|
|
54
|
+
nextElement._owner.getPublicInstance().constructor.displayName;
|
|
55
|
+
}
|
|
56
|
+
if (nextElement.type != null &&
|
|
57
|
+
nextElement.type.displayName != null) {
|
|
58
|
+
nextDisplayName = nextElement.type.displayName;
|
|
59
|
+
}
|
|
60
|
+
monitorCodeUse(
|
|
61
|
+
'react_should_update_owner_is_useful',
|
|
62
|
+
{
|
|
63
|
+
key: prevElement.key,
|
|
64
|
+
prevOwner: prevName,
|
|
65
|
+
nextOwner: nextName,
|
|
66
|
+
nextDisplayName: nextDisplayName
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return ownersMatch;
|
|
72
|
+
}
|
|
39
73
|
}
|
|
40
74
|
}
|
|
41
75
|
return false;
|