react 0.12.0 → 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 +2345 -910
- package/dist/react-with-addons.js +5273 -4111
- package/dist/react-with-addons.min.js +5 -6
- package/dist/react.js +4840 -3940
- 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 +21 -1
- 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 +1 -1
- 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 +1 -1
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/Object.assign.js +3 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +17 -50
- 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 +121 -0
- package/lib/ReactChildren.js +10 -8
- package/lib/ReactClass.js +874 -0
- package/lib/ReactComponent.js +45 -286
- package/lib/ReactComponentBase.js +126 -0
- package/lib/ReactComponentBrowserEnvironment.js +10 -83
- package/lib/ReactComponentEnvironment.js +57 -0
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +700 -1045
- 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 +120 -77
- 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/ReactDOMTextComponent.js +124 -0
- package/lib/ReactDOMTextarea.js +5 -6
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +14 -8
- package/lib/ReactDefaultPerf.js +8 -7
- package/lib/ReactDefaultPerfAnalysis.js +1 -1
- package/lib/ReactElement.js +22 -15
- package/lib/ReactElementValidator.js +192 -53
- package/lib/ReactEmptyComponent.js +29 -11
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +3 -3
- 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/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +202 -66
- package/lib/ReactMultiChild.js +44 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +47 -10
- 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/ReactRef.js +96 -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 +83 -26
- package/lib/ReactTransitionChildMapping.js +1 -1
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +48 -7
- package/lib/ReactUpdates.js +46 -45
- 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/accumulate.js +47 -0
- 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 +89 -66
- 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 +9 -2
- package/package.json +1 -1
- package/lib/CompositionEventPlugin.js +0 -257
- package/lib/ReactLegacyElement.js +0 -243
- package/lib/ReactTextComponent.js +0 -104
- 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 ' +
|
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,34 @@
|
|
|
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 ReactComponentBase = require("./ReactComponentBase");
|
|
21
|
+
var ReactClass = require("./ReactClass");
|
|
19
22
|
var ReactContext = require("./ReactContext");
|
|
20
23
|
var ReactCurrentOwner = require("./ReactCurrentOwner");
|
|
21
24
|
var ReactElement = require("./ReactElement");
|
|
22
25
|
var ReactElementValidator = require("./ReactElementValidator");
|
|
23
26
|
var ReactDOM = require("./ReactDOM");
|
|
24
27
|
var ReactDOMComponent = require("./ReactDOMComponent");
|
|
28
|
+
var ReactDOMTextComponent = require("./ReactDOMTextComponent");
|
|
25
29
|
var ReactDefaultInjection = require("./ReactDefaultInjection");
|
|
26
30
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
27
|
-
var ReactLegacyElement = require("./ReactLegacyElement");
|
|
28
31
|
var ReactMount = require("./ReactMount");
|
|
29
32
|
var ReactMultiChild = require("./ReactMultiChild");
|
|
30
33
|
var ReactPerf = require("./ReactPerf");
|
|
31
34
|
var ReactPropTypes = require("./ReactPropTypes");
|
|
35
|
+
var ReactRef = require("./ReactRef");
|
|
32
36
|
var ReactServerRendering = require("./ReactServerRendering");
|
|
33
|
-
var ReactTextComponent = require("./ReactTextComponent");
|
|
34
37
|
|
|
35
38
|
var assign = require("./Object.assign");
|
|
36
|
-
var
|
|
39
|
+
var findDOMNode = require("./findDOMNode");
|
|
37
40
|
var onlyChild = require("./onlyChild");
|
|
38
41
|
|
|
39
42
|
ReactDefaultInjection.inject();
|
|
@@ -46,14 +49,6 @@ if ("production" !== process.env.NODE_ENV) {
|
|
|
46
49
|
createFactory = ReactElementValidator.createFactory;
|
|
47
50
|
}
|
|
48
51
|
|
|
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
52
|
var render = ReactPerf.measure('React', 'render', ReactMount.render);
|
|
58
53
|
|
|
59
54
|
var React = {
|
|
@@ -63,56 +58,30 @@ var React = {
|
|
|
63
58
|
count: ReactChildren.count,
|
|
64
59
|
only: onlyChild
|
|
65
60
|
},
|
|
61
|
+
Component: ReactComponentBase,
|
|
66
62
|
DOM: ReactDOM,
|
|
67
63
|
PropTypes: ReactPropTypes,
|
|
68
64
|
initializeTouchEvents: function(shouldUseTouch) {
|
|
69
65
|
EventPluginUtils.useTouchEvents = shouldUseTouch;
|
|
70
66
|
},
|
|
71
|
-
createClass:
|
|
67
|
+
createClass: ReactClass.createClass,
|
|
72
68
|
createElement: createElement,
|
|
73
69
|
createFactory: createFactory,
|
|
70
|
+
createRef: function() {
|
|
71
|
+
return new ReactRef();
|
|
72
|
+
},
|
|
74
73
|
constructAndRenderComponent: ReactMount.constructAndRenderComponent,
|
|
75
74
|
constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
|
|
75
|
+
findDOMNode: findDOMNode,
|
|
76
76
|
render: render,
|
|
77
77
|
renderToString: ReactServerRendering.renderToString,
|
|
78
78
|
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
|
|
79
79
|
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
|
|
80
|
-
isValidClass: ReactLegacyElement.isValidClass,
|
|
81
80
|
isValidElement: ReactElement.isValidElement,
|
|
82
81
|
withContext: ReactContext.withContext,
|
|
83
82
|
|
|
84
83
|
// 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
|
-
)
|
|
84
|
+
__spread: assign
|
|
116
85
|
};
|
|
117
86
|
|
|
118
87
|
// Inject the runtime into a devtools global hook regardless of browser.
|
|
@@ -128,7 +97,7 @@ if (
|
|
|
128
97
|
InstanceHandles: ReactInstanceHandles,
|
|
129
98
|
Mount: ReactMount,
|
|
130
99
|
MultiChild: ReactMultiChild,
|
|
131
|
-
TextComponent:
|
|
100
|
+
TextComponent: ReactDOMTextComponent
|
|
132
101
|
});
|
|
133
102
|
}
|
|
134
103
|
|
|
@@ -177,8 +146,6 @@ if ("production" !== process.env.NODE_ENV) {
|
|
|
177
146
|
}
|
|
178
147
|
}
|
|
179
148
|
|
|
180
|
-
|
|
181
|
-
// internal version.
|
|
182
|
-
React.version = '0.12.0';
|
|
149
|
+
React.version = '0.13.0-alpha.2';
|
|
183
150
|
|
|
184
151
|
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,121 @@
|
|
|
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 flattenChildren = require("./flattenChildren");
|
|
16
|
+
var instantiateReactComponent = require("./instantiateReactComponent");
|
|
17
|
+
var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* ReactChildReconciler provides helpers for initializing or updating a set of
|
|
21
|
+
* children. Its output is suitable for passing it onto ReactMultiChild which
|
|
22
|
+
* does diffed reordering and insertion.
|
|
23
|
+
*/
|
|
24
|
+
var ReactChildReconciler = {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Generates a "mount image" for each of the supplied children. In the case
|
|
28
|
+
* of `ReactDOMComponent`, a mount image is a string of markup.
|
|
29
|
+
*
|
|
30
|
+
* @param {?object} nestedChildNodes Nested child maps.
|
|
31
|
+
* @return {?object} A set of child instances.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
instantiateChildren: function(nestedChildNodes, transaction, context) {
|
|
35
|
+
var children = flattenChildren(nestedChildNodes);
|
|
36
|
+
for (var name in children) {
|
|
37
|
+
if (children.hasOwnProperty(name)) {
|
|
38
|
+
var child = children[name];
|
|
39
|
+
// The rendered children must be turned into instances as they're
|
|
40
|
+
// mounted.
|
|
41
|
+
var childInstance = instantiateReactComponent(child, null);
|
|
42
|
+
children[name] = childInstance;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return children;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Updates the rendered children and returns a new set of children.
|
|
50
|
+
*
|
|
51
|
+
* @param {?object} prevChildren Previously initialized set of children.
|
|
52
|
+
* @param {?object} nextNestedChildNodes Nested child maps.
|
|
53
|
+
* @param {ReactReconcileTransaction} transaction
|
|
54
|
+
* @param {object} context
|
|
55
|
+
* @return {?object} A new set of child instances.
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
updateChildren: function(
|
|
59
|
+
prevChildren,
|
|
60
|
+
nextNestedChildNodes,
|
|
61
|
+
transaction,
|
|
62
|
+
context) {
|
|
63
|
+
// We currently don't have a way to track moves here but if we use iterators
|
|
64
|
+
// instead of for..in we can zip the iterators and check if an item has
|
|
65
|
+
// moved.
|
|
66
|
+
// TODO: If nothing has changed, return the prevChildren object so that we
|
|
67
|
+
// can quickly bailout if nothing has changed.
|
|
68
|
+
var nextChildren = flattenChildren(nextNestedChildNodes);
|
|
69
|
+
if (!nextChildren && !prevChildren) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
var name;
|
|
73
|
+
for (name in nextChildren) {
|
|
74
|
+
if (!nextChildren.hasOwnProperty(name)) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
var prevChild = prevChildren && prevChildren[name];
|
|
78
|
+
var prevElement = prevChild && prevChild._currentElement;
|
|
79
|
+
var nextElement = nextChildren[name];
|
|
80
|
+
if (shouldUpdateReactComponent(prevElement, nextElement)) {
|
|
81
|
+
prevChild.receiveComponent(nextElement, transaction, context);
|
|
82
|
+
nextChildren[name] = prevChild;
|
|
83
|
+
} else {
|
|
84
|
+
if (prevChild) {
|
|
85
|
+
prevChild.unmountComponent();
|
|
86
|
+
}
|
|
87
|
+
// The child must be instantiated before it's mounted.
|
|
88
|
+
var nextChildInstance = instantiateReactComponent(
|
|
89
|
+
nextElement,
|
|
90
|
+
null
|
|
91
|
+
);
|
|
92
|
+
nextChildren[name] = nextChildInstance;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Unmount children that are no longer present.
|
|
96
|
+
for (name in prevChildren) {
|
|
97
|
+
if (prevChildren.hasOwnProperty(name) &&
|
|
98
|
+
!(nextChildren && nextChildren.hasOwnProperty(name))) {
|
|
99
|
+
prevChildren[name].unmountComponent();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return nextChildren;
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Unmounts all rendered children. This should be used to clean up children
|
|
107
|
+
* when this component is unmounted.
|
|
108
|
+
*
|
|
109
|
+
* @param {?object} renderedChildren Previously initialized set of children.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
unmountChildren: function(renderedChildren) {
|
|
113
|
+
for (var name in renderedChildren) {
|
|
114
|
+
var renderedChild = renderedChildren[name];
|
|
115
|
+
renderedChild.unmountComponent();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
module.exports = ReactChildReconciler;
|