react 0.12.1 → 0.13.0-beta.1
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 +352 -251
- package/dist/react-with-addons.js +5409 -4242
- package/dist/react-with-addons.min.js +5 -6
- package/dist/react.js +5012 -4136
- package/dist/react.min.js +5 -6
- package/lib/AutoFocusMixin.js +1 -1
- package/lib/BeforeInputEventPlugin.js +389 -112
- package/lib/CSSProperty.js +6 -3
- package/lib/CSSPropertyOperations.js +57 -10
- package/lib/CallbackQueue.js +2 -2
- package/lib/ChangeEventPlugin.js +3 -3
- package/lib/ClientReactRootIndex.js +1 -1
- package/lib/DOMChildrenOperations.js +6 -4
- package/lib/DOMProperty.js +1 -1
- package/lib/DOMPropertyOperations.js +4 -2
- package/lib/Danger.js +7 -6
- package/lib/DefaultEventPluginOrder.js +1 -2
- 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/ExecutionEnvironment.js +2 -3
- package/lib/FallbackCompositionState.js +89 -0
- package/lib/HTMLDOMPropertyConfig.js +19 -7
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +3 -3
- package/lib/LocalEventTrapMixin.js +9 -2
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/Object.assign.js +3 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +17 -51
- package/lib/ReactBrowserComponentMixin.js +3 -13
- package/lib/ReactBrowserEventEmitter.js +4 -6
- package/lib/ReactCSSTransitionGroup.js +4 -1
- package/lib/ReactCSSTransitionGroupChild.js +12 -2
- package/lib/ReactChildReconciler.js +125 -0
- package/lib/ReactChildren.js +10 -8
- package/lib/ReactClass.js +916 -0
- package/lib/ReactComponent.js +81 -404
- package/lib/ReactComponentBrowserEnvironment.js +10 -83
- package/lib/ReactComponentEnvironment.js +57 -0
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +533 -1132
- package/lib/ReactContext.js +6 -2
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +3 -8
- package/lib/ReactDOMButton.js +5 -6
- package/lib/ReactDOMComponent.js +110 -92
- package/lib/ReactDOMForm.js +5 -6
- package/lib/ReactDOMIDOperations.js +56 -74
- package/lib/ReactDOMImg.js +4 -6
- package/lib/ReactDOMInput.js +5 -6
- package/lib/ReactDOMOption.js +5 -6
- package/lib/ReactDOMSelect.js +57 -65
- package/lib/ReactDOMSelection.js +6 -2
- package/lib/{ReactTextComponent.js → ReactDOMTextComponent.js} +48 -35
- package/lib/ReactDOMTextarea.js +5 -6
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +14 -8
- package/lib/ReactDefaultPerf.js +16 -7
- package/lib/ReactDefaultPerfAnalysis.js +1 -1
- package/lib/ReactElement.js +23 -15
- package/lib/ReactElementValidator.js +209 -57
- package/lib/ReactEmptyComponent.js +29 -11
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +3 -4
- package/lib/ReactInjection.js +7 -5
- package/lib/ReactInputSelection.js +3 -4
- package/lib/ReactInstanceHandles.js +3 -2
- package/lib/ReactInstanceMap.js +47 -0
- package/lib/ReactLifeCycle.js +35 -0
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +239 -68
- package/lib/ReactMultiChild.js +49 -47
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +72 -25
- package/lib/ReactOwner.js +4 -48
- package/lib/ReactPerf.js +21 -1
- package/lib/ReactPropTransferer.js +2 -57
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +14 -22
- package/lib/ReactPutListenerQueue.js +1 -1
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactReconciler.js +107 -0
- package/lib/ReactRef.js +70 -0
- package/lib/ReactRootIndex.js +1 -1
- package/lib/ReactServerRendering.js +5 -3
- package/lib/ReactServerRenderingTransaction.js +1 -1
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +112 -26
- package/lib/ReactTransitionChildMapping.js +1 -1
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +48 -7
- package/lib/ReactUpdateQueue.js +264 -0
- package/lib/ReactUpdates.js +48 -61
- 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 +2 -4
- 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 +2 -5
- package/lib/accumulateInto.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/cloneWithProps.js +3 -3
- package/lib/copyProperties.js +2 -0
- package/lib/createFullPageComponent.js +3 -3
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/escapeTextForBrowser.js +6 -6
- package/lib/findDOMNode.js +51 -0
- package/lib/flattenChildren.js +11 -22
- 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 +42 -0
- package/lib/getNodeForCharacterOffset.js +2 -2
- package/lib/getReactRootElementInContainer.js +1 -1
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +85 -67
- package/lib/isEventSupported.js +1 -1
- package/lib/isNode.js +3 -4
- package/lib/isTextInputElement.js +2 -3
- 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 +48 -6
- package/lib/traverseAllChildren.js +111 -55
- package/lib/update.js +1 -1
- package/lib/warning.js +12 -1
- package/package.json +1 -1
- package/lib/CompositionEventPlugin.js +0 -257
- package/lib/ReactLegacyElement.js +0 -243
- package/lib/deprecated.js +0 -47
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
/*jslint bitwise: true*/
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
'use strict';
|
|
15
15
|
|
|
16
16
|
var DOMProperty = require("./DOMProperty");
|
|
17
17
|
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
@@ -88,8 +88,13 @@ var HTMLDOMPropertyConfig = {
|
|
|
88
88
|
draggable: null,
|
|
89
89
|
encType: null,
|
|
90
90
|
form: MUST_USE_ATTRIBUTE,
|
|
91
|
+
formAction: MUST_USE_ATTRIBUTE,
|
|
92
|
+
formEncType: MUST_USE_ATTRIBUTE,
|
|
93
|
+
formMethod: MUST_USE_ATTRIBUTE,
|
|
91
94
|
formNoValidate: HAS_BOOLEAN_VALUE,
|
|
95
|
+
formTarget: MUST_USE_ATTRIBUTE,
|
|
92
96
|
frameBorder: MUST_USE_ATTRIBUTE,
|
|
97
|
+
headers: null,
|
|
93
98
|
height: MUST_USE_ATTRIBUTE,
|
|
94
99
|
hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
|
95
100
|
href: null,
|
|
@@ -103,6 +108,8 @@ var HTMLDOMPropertyConfig = {
|
|
|
103
108
|
list: MUST_USE_ATTRIBUTE,
|
|
104
109
|
loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
|
105
110
|
manifest: MUST_USE_ATTRIBUTE,
|
|
111
|
+
marginHeight: null,
|
|
112
|
+
marginWidth: null,
|
|
106
113
|
max: null,
|
|
107
114
|
maxLength: MUST_USE_ATTRIBUTE,
|
|
108
115
|
media: MUST_USE_ATTRIBUTE,
|
|
@@ -153,12 +160,17 @@ var HTMLDOMPropertyConfig = {
|
|
|
153
160
|
/**
|
|
154
161
|
* Non-standard Properties
|
|
155
162
|
*/
|
|
156
|
-
autoCapitalize
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
// autoCapitalize and autoCorrect are supported in Mobile Safari for
|
|
164
|
+
// keyboard hints.
|
|
165
|
+
autoCapitalize: null,
|
|
166
|
+
autoCorrect: null,
|
|
167
|
+
// itemProp, itemScope, itemType are for Microdata support. See
|
|
168
|
+
// http://schema.org/docs/gs.html
|
|
169
|
+
itemProp: MUST_USE_ATTRIBUTE,
|
|
170
|
+
itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
|
171
|
+
itemType: MUST_USE_ATTRIBUTE,
|
|
172
|
+
// property is supported for OpenGraph in meta tags.
|
|
173
|
+
property: null
|
|
162
174
|
},
|
|
163
175
|
DOMAttributeNames: {
|
|
164
176
|
acceptCharset: 'accept-charset',
|
package/lib/LinkedStateMixin.js
CHANGED
package/lib/LinkedValueUtils.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var ReactPropTypes = require("./ReactPropTypes");
|
|
16
16
|
|
|
@@ -81,7 +81,7 @@ var LinkedValueUtils = {
|
|
|
81
81
|
props.onChange ||
|
|
82
82
|
props.readOnly ||
|
|
83
83
|
props.disabled) {
|
|
84
|
-
return;
|
|
84
|
+
return null;
|
|
85
85
|
}
|
|
86
86
|
return new Error(
|
|
87
87
|
'You provided a `value` prop to a form field without an ' +
|
|
@@ -95,7 +95,7 @@ var LinkedValueUtils = {
|
|
|
95
95
|
props.onChange ||
|
|
96
96
|
props.readOnly ||
|
|
97
97
|
props.disabled) {
|
|
98
|
-
return;
|
|
98
|
+
return null;
|
|
99
99
|
}
|
|
100
100
|
return new Error(
|
|
101
101
|
'You provided a `checked` prop to a form field without an ' +
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule LocalEventTrapMixin
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
|
|
15
15
|
|
|
@@ -24,10 +24,17 @@ function remove(event) {
|
|
|
24
24
|
var LocalEventTrapMixin = {
|
|
25
25
|
trapBubbledEvent:function(topLevelType, handlerBaseName) {
|
|
26
26
|
("production" !== process.env.NODE_ENV ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
|
|
27
|
+
// If a component renders to null or if another component fatals and causes
|
|
28
|
+
// the state of the tree to be corrupted, `node` here can be null.
|
|
29
|
+
var node = this.getDOMNode();
|
|
30
|
+
("production" !== process.env.NODE_ENV ? invariant(
|
|
31
|
+
node,
|
|
32
|
+
'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
|
|
33
|
+
) : invariant(node));
|
|
27
34
|
var listener = ReactBrowserEventEmitter.trapBubbledEvent(
|
|
28
35
|
topLevelType,
|
|
29
36
|
handlerBaseName,
|
|
30
|
-
|
|
37
|
+
node
|
|
31
38
|
);
|
|
32
39
|
this._localEventListeners =
|
|
33
40
|
accumulateInto(this._localEventListeners, listener);
|
package/lib/Object.assign.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
|
|
13
13
|
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
14
16
|
function assign(target, sources) {
|
|
15
17
|
if (target == null) {
|
|
16
18
|
throw new TypeError('Object.assign target cannot be null or undefined');
|
|
@@ -40,6 +42,6 @@ function assign(target, sources) {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
return to;
|
|
43
|
-
}
|
|
45
|
+
}
|
|
44
46
|
|
|
45
47
|
module.exports = assign;
|
package/lib/PooledClass.js
CHANGED
package/lib/React.js
CHANGED
|
@@ -9,31 +9,32 @@
|
|
|
9
9
|
* @providesModule React
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
|
|
13
|
+
|
|
14
|
+
'use strict';
|
|
13
15
|
|
|
14
16
|
var DOMPropertyOperations = require("./DOMPropertyOperations");
|
|
15
17
|
var EventPluginUtils = require("./EventPluginUtils");
|
|
16
18
|
var ReactChildren = require("./ReactChildren");
|
|
17
19
|
var ReactComponent = require("./ReactComponent");
|
|
18
|
-
var
|
|
20
|
+
var ReactClass = require("./ReactClass");
|
|
19
21
|
var ReactContext = require("./ReactContext");
|
|
20
22
|
var ReactCurrentOwner = require("./ReactCurrentOwner");
|
|
21
23
|
var ReactElement = require("./ReactElement");
|
|
22
24
|
var ReactElementValidator = require("./ReactElementValidator");
|
|
23
25
|
var ReactDOM = require("./ReactDOM");
|
|
24
26
|
var ReactDOMComponent = require("./ReactDOMComponent");
|
|
27
|
+
var ReactDOMTextComponent = require("./ReactDOMTextComponent");
|
|
25
28
|
var ReactDefaultInjection = require("./ReactDefaultInjection");
|
|
26
29
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
27
|
-
var ReactLegacyElement = require("./ReactLegacyElement");
|
|
28
30
|
var ReactMount = require("./ReactMount");
|
|
29
31
|
var ReactMultiChild = require("./ReactMultiChild");
|
|
30
32
|
var ReactPerf = require("./ReactPerf");
|
|
31
33
|
var ReactPropTypes = require("./ReactPropTypes");
|
|
32
34
|
var ReactServerRendering = require("./ReactServerRendering");
|
|
33
|
-
var ReactTextComponent = require("./ReactTextComponent");
|
|
34
35
|
|
|
35
36
|
var assign = require("./Object.assign");
|
|
36
|
-
var
|
|
37
|
+
var findDOMNode = require("./findDOMNode");
|
|
37
38
|
var onlyChild = require("./onlyChild");
|
|
38
39
|
|
|
39
40
|
ReactDefaultInjection.inject();
|
|
@@ -46,14 +47,6 @@ if ("production" !== process.env.NODE_ENV) {
|
|
|
46
47
|
createFactory = ReactElementValidator.createFactory;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
// TODO: Drop legacy elements once classes no longer export these factories
|
|
50
|
-
createElement = ReactLegacyElement.wrapCreateElement(
|
|
51
|
-
createElement
|
|
52
|
-
);
|
|
53
|
-
createFactory = ReactLegacyElement.wrapCreateFactory(
|
|
54
|
-
createFactory
|
|
55
|
-
);
|
|
56
|
-
|
|
57
50
|
var render = ReactPerf.measure('React', 'render', ReactMount.render);
|
|
58
51
|
|
|
59
52
|
var React = {
|
|
@@ -63,56 +56,31 @@ var React = {
|
|
|
63
56
|
count: ReactChildren.count,
|
|
64
57
|
only: onlyChild
|
|
65
58
|
},
|
|
59
|
+
Component: ReactComponent,
|
|
66
60
|
DOM: ReactDOM,
|
|
67
61
|
PropTypes: ReactPropTypes,
|
|
68
62
|
initializeTouchEvents: function(shouldUseTouch) {
|
|
69
63
|
EventPluginUtils.useTouchEvents = shouldUseTouch;
|
|
70
64
|
},
|
|
71
|
-
createClass:
|
|
65
|
+
createClass: ReactClass.createClass,
|
|
72
66
|
createElement: createElement,
|
|
73
67
|
createFactory: createFactory,
|
|
68
|
+
createMixin: function(mixin) {
|
|
69
|
+
// Currently a noop. Will be used to validate and trace mixins.
|
|
70
|
+
return mixin;
|
|
71
|
+
},
|
|
74
72
|
constructAndRenderComponent: ReactMount.constructAndRenderComponent,
|
|
75
73
|
constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
|
|
74
|
+
findDOMNode: findDOMNode,
|
|
76
75
|
render: render,
|
|
77
76
|
renderToString: ReactServerRendering.renderToString,
|
|
78
77
|
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
|
|
79
78
|
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
|
|
80
|
-
isValidClass: ReactLegacyElement.isValidClass,
|
|
81
79
|
isValidElement: ReactElement.isValidElement,
|
|
82
80
|
withContext: ReactContext.withContext,
|
|
83
81
|
|
|
84
82
|
// Hook for JSX spread, don't use this for anything else.
|
|
85
|
-
__spread: assign
|
|
86
|
-
|
|
87
|
-
// Deprecations (remove for 0.13)
|
|
88
|
-
renderComponent: deprecated(
|
|
89
|
-
'React',
|
|
90
|
-
'renderComponent',
|
|
91
|
-
'render',
|
|
92
|
-
this,
|
|
93
|
-
render
|
|
94
|
-
),
|
|
95
|
-
renderComponentToString: deprecated(
|
|
96
|
-
'React',
|
|
97
|
-
'renderComponentToString',
|
|
98
|
-
'renderToString',
|
|
99
|
-
this,
|
|
100
|
-
ReactServerRendering.renderToString
|
|
101
|
-
),
|
|
102
|
-
renderComponentToStaticMarkup: deprecated(
|
|
103
|
-
'React',
|
|
104
|
-
'renderComponentToStaticMarkup',
|
|
105
|
-
'renderToStaticMarkup',
|
|
106
|
-
this,
|
|
107
|
-
ReactServerRendering.renderToStaticMarkup
|
|
108
|
-
),
|
|
109
|
-
isValidComponent: deprecated(
|
|
110
|
-
'React',
|
|
111
|
-
'isValidComponent',
|
|
112
|
-
'isValidElement',
|
|
113
|
-
this,
|
|
114
|
-
ReactElement.isValidElement
|
|
115
|
-
)
|
|
83
|
+
__spread: assign
|
|
116
84
|
};
|
|
117
85
|
|
|
118
86
|
// Inject the runtime into a devtools global hook regardless of browser.
|
|
@@ -121,14 +89,14 @@ if (
|
|
|
121
89
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
122
90
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
|
|
123
91
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
|
|
124
|
-
|
|
92
|
+
// TODO: Inject a hook for notifying devtools of updates
|
|
125
93
|
CurrentOwner: ReactCurrentOwner,
|
|
126
94
|
DOMComponent: ReactDOMComponent,
|
|
127
95
|
DOMPropertyOperations: DOMPropertyOperations,
|
|
128
96
|
InstanceHandles: ReactInstanceHandles,
|
|
129
97
|
Mount: ReactMount,
|
|
130
98
|
MultiChild: ReactMultiChild,
|
|
131
|
-
TextComponent:
|
|
99
|
+
TextComponent: ReactDOMTextComponent
|
|
132
100
|
});
|
|
133
101
|
}
|
|
134
102
|
|
|
@@ -177,8 +145,6 @@ if ("production" !== process.env.NODE_ENV) {
|
|
|
177
145
|
}
|
|
178
146
|
}
|
|
179
147
|
|
|
180
|
-
|
|
181
|
-
// internal version.
|
|
182
|
-
React.version = '0.12.1';
|
|
148
|
+
React.version = '0.13.0-beta.1';
|
|
183
149
|
|
|
184
150
|
module.exports = React;
|
|
@@ -9,12 +9,9 @@
|
|
|
9
9
|
* @providesModule ReactBrowserComponentMixin
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
var ReactMount = require("./ReactMount");
|
|
16
|
-
|
|
17
|
-
var invariant = require("./invariant");
|
|
14
|
+
var findDOMNode = require("./findDOMNode");
|
|
18
15
|
|
|
19
16
|
var ReactBrowserComponentMixin = {
|
|
20
17
|
/**
|
|
@@ -25,14 +22,7 @@ var ReactBrowserComponentMixin = {
|
|
|
25
22
|
* @protected
|
|
26
23
|
*/
|
|
27
24
|
getDOMNode: function() {
|
|
28
|
-
|
|
29
|
-
this.isMounted(),
|
|
30
|
-
'getDOMNode(): A component must be mounted to have a DOM node.'
|
|
31
|
-
) : invariant(this.isMounted()));
|
|
32
|
-
if (ReactEmptyComponent.isNullComponentID(this._rootNodeID)) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return ReactMount.getNode(this._rootNodeID);
|
|
25
|
+
return findDOMNode(this);
|
|
36
26
|
}
|
|
37
27
|
};
|
|
38
28
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var EventConstants = require("./EventConstants");
|
|
16
16
|
var EventPluginHub = require("./EventPluginHub");
|
|
@@ -126,7 +126,7 @@ var topEventMapping = {
|
|
|
126
126
|
/**
|
|
127
127
|
* To ensure no conflicts with other potential React instances on the page
|
|
128
128
|
*/
|
|
129
|
-
var topListenersIDKey =
|
|
129
|
+
var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
|
|
130
130
|
|
|
131
131
|
function getListeningForDocument(mountAt) {
|
|
132
132
|
// In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
|
|
@@ -183,8 +183,7 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
183
183
|
*/
|
|
184
184
|
isEnabled: function() {
|
|
185
185
|
return !!(
|
|
186
|
-
ReactBrowserEventEmitter.ReactEventListener &&
|
|
187
|
-
ReactBrowserEventEmitter.ReactEventListener.isEnabled()
|
|
186
|
+
(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
|
|
188
187
|
);
|
|
189
188
|
},
|
|
190
189
|
|
|
@@ -219,8 +218,7 @@ var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
|
|
219
218
|
for (var i = 0, l = dependencies.length; i < l; i++) {
|
|
220
219
|
var dependency = dependencies[i];
|
|
221
220
|
if (!(
|
|
222
|
-
isListening.hasOwnProperty(dependency) &&
|
|
223
|
-
isListening[dependency]
|
|
221
|
+
(isListening.hasOwnProperty(dependency) && isListening[dependency])
|
|
224
222
|
)) {
|
|
225
223
|
if (dependency === topLevelTypes.topWheel) {
|
|
226
224
|
if (isEventSupported('wheel')) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @providesModule ReactCSSTransitionGroup
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var React = require("./React");
|
|
16
16
|
|
|
@@ -28,12 +28,14 @@ var ReactCSSTransitionGroup = React.createClass({
|
|
|
28
28
|
|
|
29
29
|
propTypes: {
|
|
30
30
|
transitionName: React.PropTypes.string.isRequired,
|
|
31
|
+
transitionAppear: React.PropTypes.bool,
|
|
31
32
|
transitionEnter: React.PropTypes.bool,
|
|
32
33
|
transitionLeave: React.PropTypes.bool
|
|
33
34
|
},
|
|
34
35
|
|
|
35
36
|
getDefaultProps: function() {
|
|
36
37
|
return {
|
|
38
|
+
transitionAppear: false,
|
|
37
39
|
transitionEnter: true,
|
|
38
40
|
transitionLeave: true
|
|
39
41
|
};
|
|
@@ -46,6 +48,7 @@ var ReactCSSTransitionGroup = React.createClass({
|
|
|
46
48
|
return ReactCSSTransitionGroupChild(
|
|
47
49
|
{
|
|
48
50
|
name: this.props.transitionName,
|
|
51
|
+
appear: this.props.transitionAppear,
|
|
49
52
|
enter: this.props.transitionEnter,
|
|
50
53
|
leave: this.props.transitionLeave
|
|
51
54
|
},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @providesModule ReactCSSTransitionGroupChild
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var React = require("./React");
|
|
16
16
|
|
|
@@ -64,7 +64,9 @@ var ReactCSSTransitionGroupChild = React.createClass({
|
|
|
64
64
|
|
|
65
65
|
// Usually this optional callback is used for informing an owner of
|
|
66
66
|
// a leave animation and telling it to remove the child.
|
|
67
|
-
|
|
67
|
+
if (finishCallback) {
|
|
68
|
+
finishCallback();
|
|
69
|
+
}
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
ReactTransitionEvents.addEndEventListener(node, endListener);
|
|
@@ -107,6 +109,14 @@ var ReactCSSTransitionGroupChild = React.createClass({
|
|
|
107
109
|
}
|
|
108
110
|
},
|
|
109
111
|
|
|
112
|
+
componentWillAppear: function(done) {
|
|
113
|
+
if (this.props.appear) {
|
|
114
|
+
this.transition('appear', done);
|
|
115
|
+
} else {
|
|
116
|
+
done();
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
|
|
110
120
|
componentWillEnter: function(done) {
|
|
111
121
|
if (this.props.enter) {
|
|
112
122
|
this.transition('enter', done);
|
|
@@ -0,0 +1,125 @@
|
|
|
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 ReactChildReconciler
|
|
10
|
+
* @typechecks static-only
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
var ReactReconciler = require("./ReactReconciler");
|
|
16
|
+
|
|
17
|
+
var flattenChildren = require("./flattenChildren");
|
|
18
|
+
var instantiateReactComponent = require("./instantiateReactComponent");
|
|
19
|
+
var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* ReactChildReconciler provides helpers for initializing or updating a set of
|
|
23
|
+
* children. Its output is suitable for passing it onto ReactMultiChild which
|
|
24
|
+
* does diffed reordering and insertion.
|
|
25
|
+
*/
|
|
26
|
+
var ReactChildReconciler = {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generates a "mount image" for each of the supplied children. In the case
|
|
30
|
+
* of `ReactDOMComponent`, a mount image is a string of markup.
|
|
31
|
+
*
|
|
32
|
+
* @param {?object} nestedChildNodes Nested child maps.
|
|
33
|
+
* @return {?object} A set of child instances.
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
instantiateChildren: function(nestedChildNodes, transaction, context) {
|
|
37
|
+
var children = flattenChildren(nestedChildNodes);
|
|
38
|
+
for (var name in children) {
|
|
39
|
+
if (children.hasOwnProperty(name)) {
|
|
40
|
+
var child = children[name];
|
|
41
|
+
// The rendered children must be turned into instances as they're
|
|
42
|
+
// mounted.
|
|
43
|
+
var childInstance = instantiateReactComponent(child, null);
|
|
44
|
+
children[name] = childInstance;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return children;
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Updates the rendered children and returns a new set of children.
|
|
52
|
+
*
|
|
53
|
+
* @param {?object} prevChildren Previously initialized set of children.
|
|
54
|
+
* @param {?object} nextNestedChildNodes Nested child maps.
|
|
55
|
+
* @param {ReactReconcileTransaction} transaction
|
|
56
|
+
* @param {object} context
|
|
57
|
+
* @return {?object} A new set of child instances.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
updateChildren: function(
|
|
61
|
+
prevChildren,
|
|
62
|
+
nextNestedChildNodes,
|
|
63
|
+
transaction,
|
|
64
|
+
context) {
|
|
65
|
+
// We currently don't have a way to track moves here but if we use iterators
|
|
66
|
+
// instead of for..in we can zip the iterators and check if an item has
|
|
67
|
+
// moved.
|
|
68
|
+
// TODO: If nothing has changed, return the prevChildren object so that we
|
|
69
|
+
// can quickly bailout if nothing has changed.
|
|
70
|
+
var nextChildren = flattenChildren(nextNestedChildNodes);
|
|
71
|
+
if (!nextChildren && !prevChildren) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
var name;
|
|
75
|
+
for (name in nextChildren) {
|
|
76
|
+
if (!nextChildren.hasOwnProperty(name)) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
var prevChild = prevChildren && prevChildren[name];
|
|
80
|
+
var prevElement = prevChild && prevChild._currentElement;
|
|
81
|
+
var nextElement = nextChildren[name];
|
|
82
|
+
if (shouldUpdateReactComponent(prevElement, nextElement)) {
|
|
83
|
+
ReactReconciler.receiveComponent(
|
|
84
|
+
prevChild, nextElement, transaction, context
|
|
85
|
+
);
|
|
86
|
+
nextChildren[name] = prevChild;
|
|
87
|
+
} else {
|
|
88
|
+
if (prevChild) {
|
|
89
|
+
ReactReconciler.unmountComponent(prevChild, name);
|
|
90
|
+
}
|
|
91
|
+
// The child must be instantiated before it's mounted.
|
|
92
|
+
var nextChildInstance = instantiateReactComponent(
|
|
93
|
+
nextElement,
|
|
94
|
+
null
|
|
95
|
+
);
|
|
96
|
+
nextChildren[name] = nextChildInstance;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Unmount children that are no longer present.
|
|
100
|
+
for (name in prevChildren) {
|
|
101
|
+
if (prevChildren.hasOwnProperty(name) &&
|
|
102
|
+
!(nextChildren && nextChildren.hasOwnProperty(name))) {
|
|
103
|
+
ReactReconciler.unmountComponent(prevChildren[name]);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return nextChildren;
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Unmounts all rendered children. This should be used to clean up children
|
|
111
|
+
* when this component is unmounted.
|
|
112
|
+
*
|
|
113
|
+
* @param {?object} renderedChildren Previously initialized set of children.
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
unmountChildren: function(renderedChildren) {
|
|
117
|
+
for (var name in renderedChildren) {
|
|
118
|
+
var renderedChild = renderedChildren[name];
|
|
119
|
+
ReactReconciler.unmountComponent(renderedChild);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
module.exports = ReactChildReconciler;
|