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.
Files changed (153) hide show
  1. package/dist/JSXTransformer.js +2345 -910
  2. package/dist/react-with-addons.js +5273 -4111
  3. package/dist/react-with-addons.min.js +5 -6
  4. package/dist/react.js +4840 -3940
  5. package/dist/react.min.js +5 -6
  6. package/lib/AutoFocusMixin.js +1 -1
  7. package/lib/BeforeInputEventPlugin.js +389 -112
  8. package/lib/CSSProperty.js +6 -3
  9. package/lib/CSSPropertyOperations.js +21 -1
  10. package/lib/CallbackQueue.js +2 -2
  11. package/lib/ChangeEventPlugin.js +3 -3
  12. package/lib/ClientReactRootIndex.js +1 -1
  13. package/lib/DOMChildrenOperations.js +6 -4
  14. package/lib/DOMProperty.js +1 -1
  15. package/lib/DOMPropertyOperations.js +1 -1
  16. package/lib/Danger.js +7 -6
  17. package/lib/DefaultEventPluginOrder.js +1 -2
  18. package/lib/EnterLeaveEventPlugin.js +1 -1
  19. package/lib/EventConstants.js +1 -1
  20. package/lib/EventPluginHub.js +9 -7
  21. package/lib/EventPluginRegistry.js +1 -1
  22. package/lib/EventPluginUtils.js +1 -1
  23. package/lib/EventPropagators.js +1 -1
  24. package/lib/ExecutionEnvironment.js +2 -3
  25. package/lib/FallbackCompositionState.js +89 -0
  26. package/lib/HTMLDOMPropertyConfig.js +19 -7
  27. package/lib/LinkedStateMixin.js +1 -1
  28. package/lib/LinkedValueUtils.js +3 -3
  29. package/lib/LocalEventTrapMixin.js +1 -1
  30. package/lib/MobileSafariClickEventPlugin.js +1 -1
  31. package/lib/Object.assign.js +3 -1
  32. package/lib/PooledClass.js +1 -1
  33. package/lib/React.js +17 -50
  34. package/lib/ReactBrowserComponentMixin.js +3 -13
  35. package/lib/ReactBrowserEventEmitter.js +4 -6
  36. package/lib/ReactCSSTransitionGroup.js +4 -1
  37. package/lib/ReactCSSTransitionGroupChild.js +12 -2
  38. package/lib/ReactChildReconciler.js +121 -0
  39. package/lib/ReactChildren.js +10 -8
  40. package/lib/ReactClass.js +874 -0
  41. package/lib/ReactComponent.js +45 -286
  42. package/lib/ReactComponentBase.js +126 -0
  43. package/lib/ReactComponentBrowserEnvironment.js +10 -83
  44. package/lib/ReactComponentEnvironment.js +57 -0
  45. package/lib/ReactComponentWithPureRenderMixin.js +1 -1
  46. package/lib/ReactCompositeComponent.js +700 -1045
  47. package/lib/ReactContext.js +6 -2
  48. package/lib/ReactCurrentOwner.js +1 -1
  49. package/lib/ReactDOM.js +3 -8
  50. package/lib/ReactDOMButton.js +5 -6
  51. package/lib/ReactDOMComponent.js +120 -77
  52. package/lib/ReactDOMForm.js +5 -6
  53. package/lib/ReactDOMIDOperations.js +56 -74
  54. package/lib/ReactDOMImg.js +4 -6
  55. package/lib/ReactDOMInput.js +5 -6
  56. package/lib/ReactDOMOption.js +5 -6
  57. package/lib/ReactDOMSelect.js +57 -65
  58. package/lib/ReactDOMSelection.js +6 -2
  59. package/lib/ReactDOMTextComponent.js +124 -0
  60. package/lib/ReactDOMTextarea.js +5 -6
  61. package/lib/ReactDefaultBatchingStrategy.js +1 -1
  62. package/lib/ReactDefaultInjection.js +14 -8
  63. package/lib/ReactDefaultPerf.js +8 -7
  64. package/lib/ReactDefaultPerfAnalysis.js +1 -1
  65. package/lib/ReactElement.js +22 -15
  66. package/lib/ReactElementValidator.js +192 -53
  67. package/lib/ReactEmptyComponent.js +29 -11
  68. package/lib/ReactEventEmitterMixin.js +1 -1
  69. package/lib/ReactEventListener.js +3 -3
  70. package/lib/ReactInjection.js +7 -5
  71. package/lib/ReactInputSelection.js +3 -4
  72. package/lib/ReactInstanceHandles.js +3 -2
  73. package/lib/ReactInstanceMap.js +47 -0
  74. package/lib/ReactLink.js +1 -1
  75. package/lib/ReactMarkupChecksum.js +1 -1
  76. package/lib/ReactMount.js +202 -66
  77. package/lib/ReactMultiChild.js +44 -45
  78. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  79. package/lib/ReactNativeComponent.js +47 -10
  80. package/lib/ReactOwner.js +4 -48
  81. package/lib/ReactPerf.js +21 -1
  82. package/lib/ReactPropTransferer.js +2 -57
  83. package/lib/ReactPropTypeLocationNames.js +1 -1
  84. package/lib/ReactPropTypeLocations.js +1 -1
  85. package/lib/ReactPropTypes.js +14 -22
  86. package/lib/ReactPutListenerQueue.js +1 -1
  87. package/lib/ReactReconcileTransaction.js +1 -1
  88. package/lib/ReactRef.js +96 -0
  89. package/lib/ReactRootIndex.js +1 -1
  90. package/lib/ReactServerRendering.js +5 -3
  91. package/lib/ReactServerRenderingTransaction.js +1 -1
  92. package/lib/ReactStateSetters.js +1 -1
  93. package/lib/ReactTestUtils.js +83 -26
  94. package/lib/ReactTransitionChildMapping.js +1 -1
  95. package/lib/ReactTransitionEvents.js +1 -1
  96. package/lib/ReactTransitionGroup.js +48 -7
  97. package/lib/ReactUpdates.js +46 -45
  98. package/lib/ReactWithAddons.js +1 -1
  99. package/lib/SVGDOMPropertyConfig.js +1 -1
  100. package/lib/SelectEventPlugin.js +3 -3
  101. package/lib/ServerReactRootIndex.js +1 -1
  102. package/lib/SimpleEventPlugin.js +1 -1
  103. package/lib/SyntheticClipboardEvent.js +1 -2
  104. package/lib/SyntheticCompositionEvent.js +1 -2
  105. package/lib/SyntheticDragEvent.js +1 -1
  106. package/lib/SyntheticEvent.js +11 -3
  107. package/lib/SyntheticFocusEvent.js +1 -1
  108. package/lib/SyntheticInputEvent.js +1 -2
  109. package/lib/SyntheticKeyboardEvent.js +1 -1
  110. package/lib/SyntheticMouseEvent.js +2 -4
  111. package/lib/SyntheticTouchEvent.js +1 -1
  112. package/lib/SyntheticUIEvent.js +1 -1
  113. package/lib/SyntheticWheelEvent.js +1 -1
  114. package/lib/Transaction.js +3 -3
  115. package/lib/ViewportMetrics.js +2 -5
  116. package/lib/accumulate.js +47 -0
  117. package/lib/accumulateInto.js +1 -1
  118. package/lib/adler32.js +1 -1
  119. package/lib/cloneWithProps.js +3 -3
  120. package/lib/copyProperties.js +2 -0
  121. package/lib/createFullPageComponent.js +3 -3
  122. package/lib/dangerousStyleValue.js +1 -1
  123. package/lib/escapeTextForBrowser.js +6 -6
  124. package/lib/findDOMNode.js +51 -0
  125. package/lib/flattenChildren.js +11 -22
  126. package/lib/forEachAccumulated.js +1 -1
  127. package/lib/getEventCharCode.js +1 -1
  128. package/lib/getEventKey.js +1 -1
  129. package/lib/getEventModifierState.js +1 -1
  130. package/lib/getEventTarget.js +1 -1
  131. package/lib/getIteratorFn.js +42 -0
  132. package/lib/getNodeForCharacterOffset.js +2 -2
  133. package/lib/getReactRootElementInContainer.js +1 -1
  134. package/lib/getTextContentAccessor.js +1 -1
  135. package/lib/instantiateReactComponent.js +89 -66
  136. package/lib/isEventSupported.js +1 -1
  137. package/lib/isNode.js +3 -4
  138. package/lib/isTextInputElement.js +2 -3
  139. package/lib/joinClasses.js +1 -1
  140. package/lib/keyMirror.js +1 -1
  141. package/lib/memoizeStringOnly.js +4 -5
  142. package/lib/onlyChild.js +1 -1
  143. package/lib/setInnerHTML.js +12 -1
  144. package/lib/shallowEqual.js +1 -1
  145. package/lib/shouldUpdateReactComponent.js +48 -6
  146. package/lib/traverseAllChildren.js +111 -55
  147. package/lib/update.js +1 -1
  148. package/lib/warning.js +9 -2
  149. package/package.json +1 -1
  150. package/lib/CompositionEventPlugin.js +0 -257
  151. package/lib/ReactLegacyElement.js +0 -243
  152. package/lib/ReactTextComponent.js +0 -104
  153. package/lib/deprecated.js +0 -47
@@ -11,7 +11,7 @@
11
11
 
12
12
  /*jslint bitwise: true*/
13
13
 
14
- "use strict";
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: null, // Supported in Mobile Safari for keyboard hints
157
- autoCorrect: null, // Supported in Mobile Safari for keyboard hints
158
- itemProp: MUST_USE_ATTRIBUTE, // Microdata: http://schema.org/docs/gs.html
159
- itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, // Microdata: http://schema.org/docs/gs.html
160
- itemType: MUST_USE_ATTRIBUTE, // Microdata: http://schema.org/docs/gs.html
161
- property: null // Supports OG in meta tags
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',
@@ -10,7 +10,7 @@
10
10
  * @typechecks static-only
11
11
  */
12
12
 
13
- "use strict";
13
+ 'use strict';
14
14
 
15
15
  var ReactLink = require("./ReactLink");
16
16
  var ReactStateSetters = require("./ReactStateSetters");
@@ -10,7 +10,7 @@
10
10
  * @typechecks static-only
11
11
  */
12
12
 
13
- "use strict";
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
- "use strict";
12
+ 'use strict';
13
13
 
14
14
  var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
15
15
 
@@ -10,7 +10,7 @@
10
10
  * @typechecks static-only
11
11
  */
12
12
 
13
- "use strict";
13
+ 'use strict';
14
14
 
15
15
  var EventConstants = require("./EventConstants");
16
16
 
@@ -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;
@@ -9,7 +9,7 @@
9
9
  * @providesModule PooledClass
10
10
  */
11
11
 
12
- "use strict";
12
+ 'use strict';
13
13
 
14
14
  var invariant = require("./invariant");
15
15
 
package/lib/React.js CHANGED
@@ -9,31 +9,34 @@
9
9
  * @providesModule React
10
10
  */
11
11
 
12
- "use strict";
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 ReactCompositeComponent = require("./ReactCompositeComponent");
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 deprecated = require("./deprecated");
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: ReactCompositeComponent.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: ReactTextComponent
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
- // Version exists only in the open-source version of React, not in Facebook's
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
- "use strict";
12
+ 'use strict';
13
13
 
14
- var ReactEmptyComponent = require("./ReactEmptyComponent");
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
- ("production" !== process.env.NODE_ENV ? invariant(
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
- "use strict";
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 = "_reactListenersID" + String(Math.random()).slice(2);
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
- "use strict";
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
- "use strict";
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
- finishCallback && finishCallback();
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;