react 0.14.0-alpha1 → 0.14.0-beta2

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 (195) hide show
  1. package/README.md +5 -2
  2. package/addons.js +5 -2
  3. package/dist/JSXTransformer.js +634 -274
  4. package/dist/react-with-addons.js +5376 -4800
  5. package/dist/react-with-addons.min.js +6 -6
  6. package/dist/react.js +5175 -4626
  7. package/dist/react.min.js +6 -5
  8. package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +15 -5
  9. package/lib/BeforeInputEventPlugin.js +13 -13
  10. package/lib/CSSProperty.js +3 -0
  11. package/lib/CSSPropertyOperations.js +13 -13
  12. package/lib/CallbackQueue.js +4 -4
  13. package/lib/ChangeEventPlugin.js +16 -14
  14. package/lib/DOMChildrenOperations.js +10 -6
  15. package/lib/DOMProperty.js +82 -119
  16. package/lib/DOMPropertyOperations.js +78 -33
  17. package/lib/Danger.js +14 -16
  18. package/lib/DefaultEventPluginOrder.js +2 -2
  19. package/lib/EnterLeaveEventPlugin.js +8 -8
  20. package/lib/EventConstants.js +23 -1
  21. package/lib/EventPluginHub.js +13 -13
  22. package/lib/EventPluginRegistry.js +8 -8
  23. package/lib/EventPluginUtils.js +17 -17
  24. package/lib/EventPropagators.js +7 -7
  25. package/lib/FallbackCompositionState.js +3 -3
  26. package/lib/HTMLDOMPropertyConfig.js +14 -5
  27. package/lib/LinkedStateMixin.js +2 -2
  28. package/lib/LinkedValueUtils.js +50 -38
  29. package/lib/MetaMatchers.js +118 -0
  30. package/lib/OrderedMap.js +453 -0
  31. package/lib/PooledClass.js +14 -2
  32. package/lib/React.js +9 -111
  33. package/lib/ReactBrowserComponentMixin.js +4 -4
  34. package/lib/ReactBrowserEventEmitter.js +30 -7
  35. package/lib/ReactCSSTransitionGroup.js +16 -5
  36. package/lib/ReactCSSTransitionGroupChild.js +20 -11
  37. package/lib/ReactChildReconciler.js +25 -18
  38. package/lib/ReactChildren.js +24 -22
  39. package/lib/ReactClass.js +68 -86
  40. package/lib/ReactComponent.js +22 -17
  41. package/lib/ReactComponentBrowserEnvironment.js +2 -4
  42. package/lib/ReactComponentEnvironment.js +2 -2
  43. package/lib/ReactComponentWithPureRenderMixin.js +3 -3
  44. package/lib/ReactCompositeComponent.js +80 -111
  45. package/lib/ReactDOM.js +72 -158
  46. package/lib/ReactDOMButton.js +15 -26
  47. package/lib/ReactDOMComponent.js +384 -62
  48. package/lib/ReactDOMFactories.js +177 -0
  49. package/lib/ReactDOMIDOperations.js +23 -25
  50. package/lib/ReactDOMInput.js +83 -99
  51. package/lib/ReactDOMOption.js +38 -42
  52. package/lib/ReactDOMSelect.js +88 -98
  53. package/lib/ReactDOMSelection.js +3 -3
  54. package/lib/ReactDOMServer.js +24 -0
  55. package/lib/ReactDOMTextComponent.js +13 -13
  56. package/lib/ReactDOMTextarea.js +48 -61
  57. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  58. package/lib/ReactDefaultInjection.js +34 -71
  59. package/lib/ReactDefaultPerf.js +7 -7
  60. package/lib/ReactDefaultPerfAnalysis.js +6 -9
  61. package/lib/ReactElement.js +35 -92
  62. package/lib/ReactElementValidator.js +53 -130
  63. package/lib/ReactEmptyComponent.js +4 -4
  64. package/lib/ReactErrorUtils.js +1 -1
  65. package/lib/ReactEventEmitterMixin.js +3 -4
  66. package/lib/ReactEventListener.js +57 -12
  67. package/lib/ReactFragment.js +22 -17
  68. package/lib/ReactInjection.js +11 -11
  69. package/lib/ReactInputSelection.js +8 -7
  70. package/lib/ReactInstanceHandles.js +12 -12
  71. package/lib/ReactIsomorphic.js +70 -0
  72. package/lib/ReactLink.js +1 -1
  73. package/lib/ReactMarkupChecksum.js +6 -2
  74. package/lib/ReactMount.js +90 -89
  75. package/lib/ReactMultiChild.js +83 -22
  76. package/lib/ReactMultiChildUpdateTypes.js +2 -1
  77. package/lib/ReactNativeComponent.js +3 -8
  78. package/lib/ReactNoopUpdateQueue.js +118 -0
  79. package/lib/ReactOwner.js +3 -3
  80. package/lib/ReactPerf.js +2 -2
  81. package/lib/ReactPropTransferer.js +3 -3
  82. package/lib/ReactPropTypeLocationNames.js +1 -1
  83. package/lib/ReactPropTypeLocations.js +1 -1
  84. package/lib/ReactPropTypes.js +72 -33
  85. package/lib/ReactReconcileTransaction.js +8 -8
  86. package/lib/ReactReconciler.js +18 -20
  87. package/lib/ReactRef.js +1 -1
  88. package/lib/ReactServerBatchingStrategy.js +23 -0
  89. package/lib/ReactServerRendering.js +22 -9
  90. package/lib/ReactServerRenderingTransaction.js +7 -7
  91. package/lib/ReactTestUtils.js +80 -58
  92. package/lib/ReactTransitionChildMapping.js +2 -2
  93. package/lib/ReactTransitionEvents.js +1 -1
  94. package/lib/ReactTransitionGroup.js +5 -6
  95. package/lib/ReactUpdateQueue.js +61 -36
  96. package/lib/ReactUpdates.js +14 -17
  97. package/lib/ReactWithAddons.js +14 -16
  98. package/lib/ResponderEventPlugin.js +514 -0
  99. package/lib/ResponderSyntheticEvent.js +40 -0
  100. package/lib/ResponderTouchHistoryStore.js +180 -0
  101. package/lib/SVGDOMPropertyConfig.js +1 -3
  102. package/lib/SelectEventPlugin.js +14 -15
  103. package/lib/SimpleEventPlugin.js +205 -29
  104. package/lib/SyntheticClipboardEvent.js +3 -3
  105. package/lib/SyntheticCompositionEvent.js +3 -3
  106. package/lib/SyntheticDragEvent.js +3 -3
  107. package/lib/SyntheticEvent.js +9 -8
  108. package/lib/SyntheticFocusEvent.js +3 -3
  109. package/lib/SyntheticInputEvent.js +3 -3
  110. package/lib/SyntheticKeyboardEvent.js +6 -6
  111. package/lib/SyntheticMouseEvent.js +5 -5
  112. package/lib/SyntheticTouchEvent.js +4 -4
  113. package/lib/SyntheticUIEvent.js +4 -4
  114. package/lib/SyntheticWheelEvent.js +3 -3
  115. package/lib/TapEventPlugin.js +119 -0
  116. package/lib/Transaction.js +16 -10
  117. package/lib/accumulate.js +44 -0
  118. package/lib/accumulateInto.js +2 -2
  119. package/lib/adler32.js +19 -9
  120. package/lib/cloneWithProps.js +12 -7
  121. package/lib/createHierarchyRenderer.js +85 -0
  122. package/lib/dangerousStyleValue.js +1 -1
  123. package/lib/deprecated.js +47 -0
  124. package/lib/findDOMNode.js +11 -12
  125. package/lib/flattenChildren.js +4 -4
  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 +0 -1
  130. package/lib/getTestDocument.js +28 -0
  131. package/lib/getTextContentAccessor.js +1 -1
  132. package/lib/instantiateReactComponent.js +24 -20
  133. package/lib/isEventSupported.js +1 -1
  134. package/lib/isTextInputElement.js +2 -1
  135. package/lib/joinClasses.js +1 -1
  136. package/lib/onlyChild.js +3 -3
  137. package/lib/quoteAttributeValueForBrowser.js +1 -1
  138. package/lib/reactComponentExpect.js +210 -0
  139. package/lib/renderSubtreeIntoContainer.js +1 -1
  140. package/lib/setInnerHTML.js +2 -2
  141. package/lib/setTextContent.js +3 -3
  142. package/lib/shallowCompare.js +1 -1
  143. package/lib/sliceChildren.js +51 -0
  144. package/lib/traverseAllChildren.js +24 -27
  145. package/lib/update.js +13 -13
  146. package/lib/validateDOMNesting.js +199 -100
  147. package/lib/webcomponents.js +6379 -0
  148. package/package.json +4 -6
  149. package/react.js +53 -1
  150. package/addons/CSSTransitionGroup.js +0 -1
  151. package/addons/LinkedStateMixin.js +0 -1
  152. package/addons/Perf.js +0 -1
  153. package/addons/PureRenderMixin.js +0 -1
  154. package/addons/TestUtils.js +0 -1
  155. package/addons/TransitionGroup.js +0 -1
  156. package/addons/batchedUpdates.js +0 -1
  157. package/addons/cloneWithProps.js +0 -1
  158. package/addons/createFragment.js +0 -1
  159. package/addons/renderSubtreeIntoContainer.js +0 -1
  160. package/addons/shallowCompare.js +0 -1
  161. package/addons/update.js +0 -1
  162. package/lib/CSSCore.js +0 -97
  163. package/lib/EventListener.js +0 -84
  164. package/lib/ExecutionEnvironment.js +0 -38
  165. package/lib/LocalEventTrapMixin.js +0 -46
  166. package/lib/ReactContext.js +0 -32
  167. package/lib/ReactDOMForm.js +0 -47
  168. package/lib/ReactDOMIframe.js +0 -43
  169. package/lib/ReactDOMImg.js +0 -44
  170. package/lib/ReactLifeCycle.js +0 -35
  171. package/lib/camelize.js +0 -32
  172. package/lib/camelizeStyleName.js +0 -40
  173. package/lib/containsNode.js +0 -55
  174. package/lib/createArrayFromMixed.js +0 -85
  175. package/lib/createFullPageComponent.js +0 -51
  176. package/lib/createNodesFromMarkup.js +0 -84
  177. package/lib/emptyFunction.js +0 -38
  178. package/lib/emptyObject.js +0 -20
  179. package/lib/focusNode.js +0 -26
  180. package/lib/getActiveElement.js +0 -29
  181. package/lib/getMarkupWrap.js +0 -115
  182. package/lib/getUnboundedScrollPosition.js +0 -38
  183. package/lib/hyphenate.js +0 -33
  184. package/lib/hyphenateStyleName.js +0 -39
  185. package/lib/invariant.js +0 -49
  186. package/lib/isNode.js +0 -23
  187. package/lib/isTextNode.js +0 -25
  188. package/lib/keyMirror.js +0 -48
  189. package/lib/keyOf.js +0 -35
  190. package/lib/mapObject.js +0 -51
  191. package/lib/performance.js +0 -23
  192. package/lib/performanceNow.js +0 -28
  193. package/lib/shallowEqual.js +0 -48
  194. package/lib/toArray.js +0 -57
  195. package/lib/warning.js +0 -61
@@ -11,7 +11,7 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var invariant = require("./invariant");
14
+ var invariant = require('fbjs/lib/invariant');
15
15
 
16
16
  /**
17
17
  * Static poolers. Several custom versions for each potential number of
@@ -53,6 +53,17 @@ var threeArgumentPooler = function (a1, a2, a3) {
53
53
  }
54
54
  };
55
55
 
56
+ var fourArgumentPooler = function (a1, a2, a3, a4) {
57
+ var Klass = this;
58
+ if (Klass.instancePool.length) {
59
+ var instance = Klass.instancePool.pop();
60
+ Klass.call(instance, a1, a2, a3, a4);
61
+ return instance;
62
+ } else {
63
+ return new Klass(a1, a2, a3, a4);
64
+ }
65
+ };
66
+
56
67
  var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
57
68
  var Klass = this;
58
69
  if (Klass.instancePool.length) {
@@ -66,7 +77,7 @@ var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
66
77
 
67
78
  var standardReleaser = function (instance) {
68
79
  var Klass = this;
69
- 'production' !== process.env.NODE_ENV ? invariant(instance instanceof Klass, 'Trying to release an instance into a pool of a different type.') : invariant(instance instanceof Klass);
80
+ !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
70
81
  if (instance.destructor) {
71
82
  instance.destructor();
72
83
  }
@@ -103,6 +114,7 @@ var PooledClass = {
103
114
  oneArgumentPooler: oneArgumentPooler,
104
115
  twoArgumentPooler: twoArgumentPooler,
105
116
  threeArgumentPooler: threeArgumentPooler,
117
+ fourArgumentPooler: fourArgumentPooler,
106
118
  fiveArgumentPooler: fiveArgumentPooler
107
119
  };
108
120
 
package/lib/React.js CHANGED
@@ -9,122 +9,20 @@
9
9
  * @providesModule React
10
10
  */
11
11
 
12
- /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
13
-
14
12
  'use strict';
15
13
 
16
- var ReactChildren = require("./ReactChildren");
17
- var ReactComponent = require("./ReactComponent");
18
- var ReactClass = require("./ReactClass");
19
- var ReactCurrentOwner = require("./ReactCurrentOwner");
20
- var ReactElement = require("./ReactElement");
21
- var ReactElementValidator = require("./ReactElementValidator");
22
- var ReactDOM = require("./ReactDOM");
23
- var ReactDOMTextComponent = require("./ReactDOMTextComponent");
24
- var ReactDefaultInjection = require("./ReactDefaultInjection");
25
- var ReactInstanceHandles = require("./ReactInstanceHandles");
26
- var ReactMount = require("./ReactMount");
27
- var ReactPerf = require("./ReactPerf");
28
- var ReactPropTypes = require("./ReactPropTypes");
29
- var ReactReconciler = require("./ReactReconciler");
30
- var ReactServerRendering = require("./ReactServerRendering");
31
-
32
- var assign = require("./Object.assign");
33
- var findDOMNode = require("./findDOMNode");
34
- var onlyChild = require("./onlyChild");
35
- var warning = require("./warning");
36
-
37
- ReactDefaultInjection.inject();
38
-
39
- var createElement = ReactElement.createElement;
40
- var createFactory = ReactElement.createFactory;
41
- var cloneElement = ReactElement.cloneElement;
42
-
43
- if ('production' !== process.env.NODE_ENV) {
44
- createElement = ReactElementValidator.createElement;
45
- createFactory = ReactElementValidator.createFactory;
46
- cloneElement = ReactElementValidator.cloneElement;
47
- }
48
-
49
- var render = ReactPerf.measure('React', 'render', ReactMount.render);
50
-
51
- var React = {
52
- Children: {
53
- map: ReactChildren.map,
54
- forEach: ReactChildren.forEach,
55
- count: ReactChildren.count,
56
- only: onlyChild
57
- },
58
- Component: ReactComponent,
59
- DOM: ReactDOM,
60
- PropTypes: ReactPropTypes,
61
- createClass: ReactClass.createClass,
62
- createElement: createElement,
63
- cloneElement: cloneElement,
64
- createFactory: createFactory,
65
- createMixin: function (mixin) {
66
- // Currently a noop. Will be used to validate and trace mixins.
67
- return mixin;
68
- },
69
- constructAndRenderComponent: ReactMount.constructAndRenderComponent,
70
- constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
71
- findDOMNode: findDOMNode,
72
- render: render,
73
- renderToString: ReactServerRendering.renderToString,
74
- renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
75
- unmountComponentAtNode: ReactMount.unmountComponentAtNode,
76
- isValidElement: ReactElement.isValidElement,
77
-
78
- // Hook for JSX spread, don't use this for anything else.
79
- __spread: assign
80
- };
81
-
82
- // Inject the runtime into a devtools global hook regardless of browser.
83
- // Allows for debugging when the hook is injected on the page.
84
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
85
- __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
86
- CurrentOwner: ReactCurrentOwner,
87
- InstanceHandles: ReactInstanceHandles,
88
- Mount: ReactMount,
89
- Reconciler: ReactReconciler,
90
- TextComponent: ReactDOMTextComponent
91
- });
92
- }
93
-
94
- if ('production' !== process.env.NODE_ENV) {
95
- var ExecutionEnvironment = require("./ExecutionEnvironment");
96
- if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
97
-
98
- // If we're in Chrome, look for the devtools marker and provide a download
99
- // link if not installed.
100
- if (navigator.userAgent.indexOf('Chrome') > -1) {
101
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
102
- console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
103
- }
104
- }
105
-
106
- // If we're in IE8, check to see if we are in combatibility mode and provide
107
- // information on preventing compatibility mode
108
- var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
109
-
110
- 'production' !== process.env.NODE_ENV ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : null;
14
+ var ReactDOM = require('./ReactDOM');
15
+ var ReactDOMServer = require('./ReactDOMServer');
16
+ var ReactIsomorphic = require('./ReactIsomorphic');
111
17
 
112
- var expectedFeatures = [
113
- // shims
114
- Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
18
+ var assign = require('./Object.assign');
115
19
 
116
- // shams
117
- Object.create, Object.freeze];
20
+ var React = {};
118
21
 
119
- for (var i = 0; i < expectedFeatures.length; i++) {
120
- if (!expectedFeatures[i]) {
121
- console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
122
- break;
123
- }
124
- }
125
- }
126
- }
22
+ assign(React, ReactIsomorphic);
23
+ assign(React, ReactDOM);
24
+ assign(React, ReactDOMServer);
127
25
 
128
- React.version = '0.14.0-alpha1';
26
+ React.version = '0.14.0-beta2';
129
27
 
130
28
  module.exports = React;
@@ -11,10 +11,10 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactInstanceMap = require("./ReactInstanceMap");
14
+ var ReactInstanceMap = require('./ReactInstanceMap');
15
15
 
16
- var findDOMNode = require("./findDOMNode");
17
- var warning = require("./warning");
16
+ var findDOMNode = require('./findDOMNode');
17
+ var warning = require('fbjs/lib/warning');
18
18
 
19
19
  var didWarnKey = '_getDOMNodeDidWarn';
20
20
 
@@ -27,7 +27,7 @@ var ReactBrowserComponentMixin = {
27
27
  * @protected
28
28
  */
29
29
  getDOMNode: function () {
30
- 'production' !== process.env.NODE_ENV ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'React.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : null;
30
+ process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'React.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
31
31
  this.constructor[didWarnKey] = true;
32
32
  return findDOMNode(this);
33
33
  }
@@ -12,14 +12,14 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var EventConstants = require("./EventConstants");
16
- var EventPluginHub = require("./EventPluginHub");
17
- var EventPluginRegistry = require("./EventPluginRegistry");
18
- var ReactEventEmitterMixin = require("./ReactEventEmitterMixin");
19
- var ViewportMetrics = require("./ViewportMetrics");
15
+ var EventConstants = require('./EventConstants');
16
+ var EventPluginHub = require('./EventPluginHub');
17
+ var EventPluginRegistry = require('./EventPluginRegistry');
18
+ var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
19
+ var ViewportMetrics = require('./ViewportMetrics');
20
20
 
21
- var assign = require("./Object.assign");
22
- var isEventSupported = require("./isEventSupported");
21
+ var assign = require('./Object.assign');
22
+ var isEventSupported = require('./isEventSupported');
23
23
 
24
24
  /**
25
25
  * Summary of `ReactBrowserEventEmitter` event handling:
@@ -84,7 +84,10 @@ var reactTopListenersCounter = 0;
84
84
  // lower node than `document`), binding at `document` would cause duplicate
85
85
  // events so we don't include them here
86
86
  var topEventMapping = {
87
+ topAbort: 'abort',
87
88
  topBlur: 'blur',
89
+ topCanPlay: 'canplay',
90
+ topCanPlayThrough: 'canplaythrough',
88
91
  topChange: 'change',
89
92
  topClick: 'click',
90
93
  topCompositionEnd: 'compositionend',
@@ -102,24 +105,44 @@ var topEventMapping = {
102
105
  topDragOver: 'dragover',
103
106
  topDragStart: 'dragstart',
104
107
  topDrop: 'drop',
108
+ topDurationChange: 'durationchange',
109
+ topEmptied: 'emptied',
110
+ topEnded: 'ended',
111
+ topError: 'error',
105
112
  topFocus: 'focus',
106
113
  topInput: 'input',
107
114
  topKeyDown: 'keydown',
108
115
  topKeyPress: 'keypress',
109
116
  topKeyUp: 'keyup',
117
+ topLoadedData: 'loadeddata',
118
+ topLoadedMetadata: 'loadedmetadata',
119
+ topLoadStart: 'loadstart',
110
120
  topMouseDown: 'mousedown',
111
121
  topMouseMove: 'mousemove',
112
122
  topMouseOut: 'mouseout',
113
123
  topMouseOver: 'mouseover',
114
124
  topMouseUp: 'mouseup',
125
+ topOnEncrypted: 'onencrypted',
126
+ topPause: 'pause',
115
127
  topPaste: 'paste',
128
+ topPlay: 'play',
129
+ topPlaying: 'playing',
130
+ topProgress: 'progress',
131
+ topRateChange: 'ratechange',
132
+ topSeeking: 'seeking',
133
+ topSeeked: 'seeked',
116
134
  topScroll: 'scroll',
117
135
  topSelectionChange: 'selectionchange',
136
+ topStalled: 'stalled',
137
+ topSuspend: 'suspend',
118
138
  topTextInput: 'textInput',
139
+ topTimeUpdate: 'timeupdate',
119
140
  topTouchCancel: 'touchcancel',
120
141
  topTouchEnd: 'touchend',
121
142
  topTouchMove: 'touchmove',
122
143
  topTouchStart: 'touchstart',
144
+ topVolumeChange: 'volumechange',
145
+ topWaiting: 'waiting',
123
146
  topWheel: 'wheel'
124
147
  };
125
148
 
@@ -12,18 +12,29 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var React = require("./React");
15
+ var React = require('./React');
16
16
 
17
- var assign = require("./Object.assign");
17
+ var assign = require('./Object.assign');
18
18
 
19
- var ReactTransitionGroup = React.createFactory(require("./ReactTransitionGroup"));
20
- var ReactCSSTransitionGroupChild = React.createFactory(require("./ReactCSSTransitionGroupChild"));
19
+ var ReactTransitionGroup = React.createFactory(require('./ReactTransitionGroup'));
20
+ var ReactCSSTransitionGroupChild = React.createFactory(require('./ReactCSSTransitionGroupChild'));
21
21
 
22
22
  var ReactCSSTransitionGroup = React.createClass({
23
23
  displayName: 'ReactCSSTransitionGroup',
24
24
 
25
25
  propTypes: {
26
- transitionName: React.PropTypes.string.isRequired,
26
+ transitionName: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
27
+ enter: React.PropTypes.string,
28
+ leave: React.PropTypes.string,
29
+ active: React.PropTypes.string
30
+ }), React.PropTypes.shape({
31
+ enter: React.PropTypes.string,
32
+ enterActive: React.PropTypes.string,
33
+ leave: React.PropTypes.string,
34
+ leaveActive: React.PropTypes.string,
35
+ appear: React.PropTypes.string,
36
+ appearActive: React.PropTypes.string
37
+ })]).isRequired,
27
38
  transitionAppear: React.PropTypes.bool,
28
39
  transitionEnter: React.PropTypes.bool,
29
40
  transitionLeave: React.PropTypes.bool
@@ -12,13 +12,13 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var React = require("./React");
15
+ var React = require('./React');
16
16
 
17
- var CSSCore = require("./CSSCore");
18
- var ReactTransitionEvents = require("./ReactTransitionEvents");
17
+ var CSSCore = require('fbjs/lib/CSSCore');
18
+ var ReactTransitionEvents = require('./ReactTransitionEvents');
19
19
 
20
- var onlyChild = require("./onlyChild");
21
- var warning = require("./warning");
20
+ var onlyChild = require('./onlyChild');
21
+ var warning = require('fbjs/lib/warning');
22
22
 
23
23
  // We don't remove the element from the DOM until we receive an animationend or
24
24
  // transitionend event. If the user screws up and forgets to add an animation
@@ -29,9 +29,9 @@ var NO_EVENT_TIMEOUT = 5000;
29
29
 
30
30
  var noEventListener = null;
31
31
 
32
- if ('production' !== process.env.NODE_ENV) {
32
+ if (process.env.NODE_ENV !== 'production') {
33
33
  noEventListener = function () {
34
- 'production' !== process.env.NODE_ENV ? warning(false, 'transition(): tried to perform an animation without ' + 'an animationend or transitionend event after timeout (' + '%sms). You should either disable this ' + 'transition in JS or add a CSS animation/transition.', NO_EVENT_TIMEOUT) : null;
34
+ process.env.NODE_ENV !== 'production' ? warning(false, 'transition(): tried to perform an animation without ' + 'an animationend or transitionend event after timeout (' + '%sms). You should either disable this ' + 'transition in JS or add a CSS animation/transition.', NO_EVENT_TIMEOUT) : undefined;
35
35
  };
36
36
  }
37
37
 
@@ -40,15 +40,24 @@ var ReactCSSTransitionGroupChild = React.createClass({
40
40
 
41
41
  transition: function (animationType, finishCallback) {
42
42
  var node = React.findDOMNode(this);
43
- var className = this.props.name + '-' + animationType;
44
- var activeClassName = className + '-active';
43
+
44
+ if (!node) {
45
+ if (finishCallback) {
46
+ finishCallback();
47
+ }
48
+ return;
49
+ }
50
+
51
+ var className = this.props.name[animationType] || this.props.name + '-' + animationType;
52
+ var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
53
+
45
54
  var noEventTimeout = null;
46
55
 
47
56
  var endListener = function (e) {
48
57
  if (e && e.target !== node) {
49
58
  return;
50
59
  }
51
- if ('production' !== process.env.NODE_ENV) {
60
+ if (process.env.NODE_ENV !== 'production') {
52
61
  clearTimeout(noEventTimeout);
53
62
  }
54
63
 
@@ -71,7 +80,7 @@ var ReactCSSTransitionGroupChild = React.createClass({
71
80
  // Need to do this to actually trigger a transition.
72
81
  this.queueClass(activeClassName);
73
82
 
74
- if ('production' !== process.env.NODE_ENV) {
83
+ if (process.env.NODE_ENV !== 'production') {
75
84
  noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
76
85
  }
77
86
  },
@@ -12,11 +12,24 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- var ReactReconciler = require("./ReactReconciler");
15
+ var ReactReconciler = require('./ReactReconciler');
16
16
 
17
- var flattenChildren = require("./flattenChildren");
18
- var instantiateReactComponent = require("./instantiateReactComponent");
19
- var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
17
+ var flattenChildren = require('./flattenChildren');
18
+ var instantiateReactComponent = require('./instantiateReactComponent');
19
+ var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
20
+ var traverseAllChildren = require('./traverseAllChildren');
21
+ var warning = require('fbjs/lib/warning');
22
+
23
+ function instantiateChild(childInstances, child, name) {
24
+ // We found a component instance.
25
+ var keyUnique = childInstances[name] === undefined;
26
+ if (process.env.NODE_ENV !== 'production') {
27
+ process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
28
+ }
29
+ if (child != null && keyUnique) {
30
+ childInstances[name] = instantiateReactComponent(child, null);
31
+ }
32
+ }
20
33
 
21
34
  /**
22
35
  * ReactChildReconciler provides helpers for initializing or updating a set of
@@ -24,7 +37,6 @@ var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
24
37
  * does diffed reordering and insertion.
25
38
  */
26
39
  var ReactChildReconciler = {
27
-
28
40
  /**
29
41
  * Generates a "mount image" for each of the supplied children. In the case
30
42
  * of `ReactDOMComponent`, a mount image is a string of markup.
@@ -34,36 +46,31 @@ var ReactChildReconciler = {
34
46
  * @internal
35
47
  */
36
48
  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
- }
49
+ if (nestedChildNodes == null) {
50
+ return null;
46
51
  }
47
- return children;
52
+ var childInstances = {};
53
+ traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
54
+ return childInstances;
48
55
  },
49
56
 
50
57
  /**
51
58
  * Updates the rendered children and returns a new set of children.
52
59
  *
53
60
  * @param {?object} prevChildren Previously initialized set of children.
54
- * @param {?object} nextNestedChildNodes Nested child maps.
61
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
55
62
  * @param {ReactReconcileTransaction} transaction
56
63
  * @param {object} context
57
64
  * @return {?object} A new set of child instances.
58
65
  * @internal
59
66
  */
60
- updateChildren: function (prevChildren, nextNestedChildNodes, transaction, context) {
67
+ updateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
61
68
  // We currently don't have a way to track moves here but if we use iterators
62
69
  // instead of for..in we can zip the iterators and check if an item has
63
70
  // moved.
64
71
  // TODO: If nothing has changed, return the prevChildren object so that we
65
72
  // can quickly bailout if nothing has changed.
66
- var nextChildren = flattenChildren(nextNestedChildNodes);
73
+ var nextChildren = flattenChildren(nextNestedChildrenElements);
67
74
  if (!nextChildren && !prevChildren) {
68
75
  return null;
69
76
  }