react 0.14.0-beta1 → 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 (169) hide show
  1. package/addons.js +5 -2
  2. package/dist/JSXTransformer.js +588 -227
  3. package/dist/react-with-addons.js +3118 -2707
  4. package/dist/react-with-addons.min.js +6 -6
  5. package/dist/react.js +3713 -3317
  6. package/dist/react.min.js +6 -5
  7. package/lib/AutoFocusUtils.js +3 -3
  8. package/lib/BeforeInputEventPlugin.js +13 -13
  9. package/lib/CSSProperty.js +3 -0
  10. package/lib/CSSPropertyOperations.js +13 -13
  11. package/lib/CallbackQueue.js +4 -4
  12. package/lib/ChangeEventPlugin.js +12 -12
  13. package/lib/DOMChildrenOperations.js +10 -6
  14. package/lib/DOMProperty.js +8 -8
  15. package/lib/DOMPropertyOperations.js +9 -9
  16. package/lib/Danger.js +14 -14
  17. package/lib/DefaultEventPluginOrder.js +2 -2
  18. package/lib/EnterLeaveEventPlugin.js +5 -5
  19. package/lib/EventConstants.js +23 -1
  20. package/lib/EventPluginHub.js +11 -11
  21. package/lib/EventPluginRegistry.js +8 -8
  22. package/lib/EventPluginUtils.js +11 -11
  23. package/lib/EventPropagators.js +7 -7
  24. package/lib/FallbackCompositionState.js +3 -3
  25. package/lib/HTMLDOMPropertyConfig.js +4 -2
  26. package/lib/LinkedStateMixin.js +2 -2
  27. package/lib/LinkedValueUtils.js +8 -8
  28. package/lib/MetaMatchers.js +118 -0
  29. package/lib/OrderedMap.js +453 -0
  30. package/lib/PooledClass.js +2 -2
  31. package/lib/React.js +6 -6
  32. package/lib/ReactBrowserComponentMixin.js +4 -4
  33. package/lib/ReactBrowserEventEmitter.js +30 -7
  34. package/lib/ReactCSSTransitionGroup.js +16 -5
  35. package/lib/ReactCSSTransitionGroupChild.js +12 -11
  36. package/lib/ReactChildReconciler.js +25 -18
  37. package/lib/ReactChildren.js +6 -6
  38. package/lib/ReactClass.js +42 -42
  39. package/lib/ReactComponent.js +13 -13
  40. package/lib/ReactComponentBrowserEnvironment.js +2 -2
  41. package/lib/ReactComponentEnvironment.js +2 -2
  42. package/lib/ReactComponentWithPureRenderMixin.js +1 -1
  43. package/lib/ReactCompositeComponent.js +38 -38
  44. package/lib/ReactDOM.js +72 -159
  45. package/lib/ReactDOMComponent.js +104 -60
  46. package/lib/ReactDOMFactories.js +177 -0
  47. package/lib/ReactDOMIDOperations.js +10 -24
  48. package/lib/ReactDOMInput.js +8 -8
  49. package/lib/ReactDOMOption.js +7 -7
  50. package/lib/ReactDOMSelect.js +8 -8
  51. package/lib/ReactDOMSelection.js +3 -3
  52. package/lib/ReactDOMServer.js +2 -2
  53. package/lib/ReactDOMTextComponent.js +11 -11
  54. package/lib/ReactDOMTextarea.js +11 -11
  55. package/lib/ReactDefaultBatchingStrategy.js +4 -4
  56. package/lib/ReactDefaultInjection.js +24 -24
  57. package/lib/ReactDefaultPerf.js +7 -7
  58. package/lib/ReactDefaultPerfAnalysis.js +6 -9
  59. package/lib/ReactElement.js +4 -4
  60. package/lib/ReactElementValidator.js +21 -21
  61. package/lib/ReactEmptyComponent.js +4 -4
  62. package/lib/ReactEventEmitterMixin.js +1 -1
  63. package/lib/ReactEventListener.js +19 -14
  64. package/lib/ReactFragment.js +11 -11
  65. package/lib/ReactInjection.js +11 -11
  66. package/lib/ReactInputSelection.js +4 -4
  67. package/lib/ReactInstanceHandles.js +10 -11
  68. package/lib/ReactIsomorphic.js +11 -11
  69. package/lib/ReactLink.js +1 -1
  70. package/lib/ReactMarkupChecksum.js +6 -2
  71. package/lib/ReactMount.js +68 -48
  72. package/lib/ReactMultiChild.js +83 -22
  73. package/lib/ReactMultiChildUpdateTypes.js +2 -1
  74. package/lib/ReactNativeComponent.js +3 -3
  75. package/lib/ReactNoopUpdateQueue.js +3 -3
  76. package/lib/ReactOwner.js +3 -3
  77. package/lib/ReactPerf.js +2 -2
  78. package/lib/ReactPropTransferer.js +3 -3
  79. package/lib/ReactPropTypeLocationNames.js +1 -1
  80. package/lib/ReactPropTypeLocations.js +1 -1
  81. package/lib/ReactPropTypes.js +34 -8
  82. package/lib/ReactReconcileTransaction.js +6 -6
  83. package/lib/ReactReconciler.js +12 -12
  84. package/lib/ReactRef.js +1 -1
  85. package/lib/ReactServerBatchingStrategy.js +5 -5
  86. package/lib/ReactServerRendering.js +12 -12
  87. package/lib/ReactServerRenderingTransaction.js +5 -5
  88. package/lib/ReactTestUtils.js +26 -27
  89. package/lib/ReactTransitionChildMapping.js +2 -2
  90. package/lib/ReactTransitionEvents.js +1 -1
  91. package/lib/ReactTransitionGroup.js +5 -6
  92. package/lib/ReactUpdateQueue.js +17 -17
  93. package/lib/ReactUpdates.js +14 -14
  94. package/lib/ReactWithAddons.js +14 -14
  95. package/lib/ResponderEventPlugin.js +514 -0
  96. package/lib/ResponderSyntheticEvent.js +40 -0
  97. package/lib/ResponderTouchHistoryStore.js +180 -0
  98. package/lib/SVGDOMPropertyConfig.js +1 -1
  99. package/lib/SelectEventPlugin.js +9 -9
  100. package/lib/SimpleEventPlugin.js +201 -25
  101. package/lib/SyntheticClipboardEvent.js +1 -1
  102. package/lib/SyntheticCompositionEvent.js +1 -1
  103. package/lib/SyntheticDragEvent.js +1 -1
  104. package/lib/SyntheticEvent.js +3 -3
  105. package/lib/SyntheticFocusEvent.js +1 -1
  106. package/lib/SyntheticInputEvent.js +1 -1
  107. package/lib/SyntheticKeyboardEvent.js +4 -4
  108. package/lib/SyntheticMouseEvent.js +3 -3
  109. package/lib/SyntheticTouchEvent.js +2 -2
  110. package/lib/SyntheticUIEvent.js +2 -2
  111. package/lib/SyntheticWheelEvent.js +1 -1
  112. package/lib/TapEventPlugin.js +119 -0
  113. package/lib/Transaction.js +6 -6
  114. package/lib/accumulate.js +44 -0
  115. package/lib/accumulateInto.js +2 -2
  116. package/lib/adler32.js +19 -7
  117. package/lib/cloneWithProps.js +11 -6
  118. package/lib/createHierarchyRenderer.js +85 -0
  119. package/lib/dangerousStyleValue.js +1 -1
  120. package/lib/deprecated.js +4 -4
  121. package/lib/findDOMNode.js +9 -9
  122. package/lib/flattenChildren.js +4 -4
  123. package/lib/getEventKey.js +1 -1
  124. package/lib/getTestDocument.js +28 -0
  125. package/lib/getTextContentAccessor.js +1 -1
  126. package/lib/instantiateReactComponent.js +12 -12
  127. package/lib/isEventSupported.js +1 -1
  128. package/lib/onlyChild.js +3 -3
  129. package/lib/quoteAttributeValueForBrowser.js +1 -1
  130. package/lib/reactComponentExpect.js +210 -0
  131. package/lib/renderSubtreeIntoContainer.js +1 -1
  132. package/lib/setInnerHTML.js +1 -1
  133. package/lib/setTextContent.js +3 -3
  134. package/lib/shallowCompare.js +1 -1
  135. package/lib/sliceChildren.js +51 -0
  136. package/lib/traverseAllChildren.js +14 -13
  137. package/lib/update.js +13 -13
  138. package/lib/validateDOMNesting.js +6 -6
  139. package/lib/webcomponents.js +6379 -0
  140. package/package.json +4 -6
  141. package/react.js +1 -1
  142. package/lib/CSSCore.js +0 -97
  143. package/lib/EventListener.js +0 -84
  144. package/lib/ExecutionEnvironment.js +0 -38
  145. package/lib/ReactDOMClient.js +0 -90
  146. package/lib/camelize.js +0 -32
  147. package/lib/camelizeStyleName.js +0 -40
  148. package/lib/containsNode.js +0 -55
  149. package/lib/createArrayFromMixed.js +0 -85
  150. package/lib/createNodesFromMarkup.js +0 -84
  151. package/lib/emptyFunction.js +0 -38
  152. package/lib/emptyObject.js +0 -20
  153. package/lib/focusNode.js +0 -26
  154. package/lib/getActiveElement.js +0 -29
  155. package/lib/getMarkupWrap.js +0 -93
  156. package/lib/getUnboundedScrollPosition.js +0 -38
  157. package/lib/hyphenate.js +0 -33
  158. package/lib/hyphenateStyleName.js +0 -39
  159. package/lib/invariant.js +0 -49
  160. package/lib/isNode.js +0 -23
  161. package/lib/isTextNode.js +0 -25
  162. package/lib/keyMirror.js +0 -48
  163. package/lib/keyOf.js +0 -35
  164. package/lib/mapObject.js +0 -51
  165. package/lib/performance.js +0 -23
  166. package/lib/performanceNow.js +0 -28
  167. package/lib/shallowEqual.js +0 -48
  168. package/lib/toArray.js +0 -57
  169. package/lib/warning.js +0 -57
@@ -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
@@ -77,7 +77,7 @@ var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
77
77
 
78
78
  var standardReleaser = function (instance) {
79
79
  var Klass = this;
80
- !(instance instanceof Klass) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
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;
81
81
  if (instance.destructor) {
82
82
  instance.destructor();
83
83
  }
package/lib/React.js CHANGED
@@ -11,18 +11,18 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactDOMClient = require("./ReactDOMClient");
15
- var ReactDOMServer = require("./ReactDOMServer");
16
- var ReactIsomorphic = require("./ReactIsomorphic");
14
+ var ReactDOM = require('./ReactDOM');
15
+ var ReactDOMServer = require('./ReactDOMServer');
16
+ var ReactIsomorphic = require('./ReactIsomorphic');
17
17
 
18
- var assign = require("./Object.assign");
18
+ var assign = require('./Object.assign');
19
19
 
20
20
  var React = {};
21
21
 
22
22
  assign(React, ReactIsomorphic);
23
- assign(React, ReactDOMClient);
23
+ assign(React, ReactDOM);
24
24
  assign(React, ReactDOMServer);
25
25
 
26
- React.version = '0.14.0-beta1';
26
+ React.version = '0.14.0-beta2';
27
27
 
28
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') : undefined;
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) : undefined;
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
 
@@ -48,15 +48,16 @@ var ReactCSSTransitionGroupChild = React.createClass({
48
48
  return;
49
49
  }
50
50
 
51
- var className = this.props.name + '-' + animationType;
52
- var activeClassName = className + '-active';
51
+ var className = this.props.name[animationType] || this.props.name + '-' + animationType;
52
+ var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
53
+
53
54
  var noEventTimeout = null;
54
55
 
55
56
  var endListener = function (e) {
56
57
  if (e && e.target !== node) {
57
58
  return;
58
59
  }
59
- if ('production' !== process.env.NODE_ENV) {
60
+ if (process.env.NODE_ENV !== 'production') {
60
61
  clearTimeout(noEventTimeout);
61
62
  }
62
63
 
@@ -79,7 +80,7 @@ var ReactCSSTransitionGroupChild = React.createClass({
79
80
  // Need to do this to actually trigger a transition.
80
81
  this.queueClass(activeClassName);
81
82
 
82
- if ('production' !== process.env.NODE_ENV) {
83
+ if (process.env.NODE_ENV !== 'production') {
83
84
  noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
84
85
  }
85
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
  }
@@ -11,11 +11,11 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var PooledClass = require("./PooledClass");
15
- var ReactFragment = require("./ReactFragment");
14
+ var PooledClass = require('./PooledClass');
15
+ var ReactFragment = require('./ReactFragment');
16
16
 
17
- var traverseAllChildren = require("./traverseAllChildren");
18
- var warning = require("./warning");
17
+ var traverseAllChildren = require('./traverseAllChildren');
18
+ var warning = require('fbjs/lib/warning');
19
19
 
20
20
  var twoArgumentPooler = PooledClass.twoArgumentPooler;
21
21
  var threeArgumentPooler = PooledClass.threeArgumentPooler;
@@ -82,8 +82,8 @@ function mapSingleChildIntoContext(traverseContext, child, name) {
82
82
  var mapResult = bookKeeping.result;
83
83
 
84
84
  var keyUnique = mapResult[name] === undefined;
85
- if ('production' !== process.env.NODE_ENV) {
86
- 'production' !== process.env.NODE_ENV ? warning(keyUnique, 'ReactChildren.map(...): 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;
85
+ if (process.env.NODE_ENV !== 'production') {
86
+ process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'ReactChildren.map(...): 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;
87
87
  }
88
88
 
89
89
  if (keyUnique) {
package/lib/ReactClass.js CHANGED
@@ -11,19 +11,19 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var ReactComponent = require("./ReactComponent");
15
- var ReactElement = require("./ReactElement");
16
- var ReactErrorUtils = require("./ReactErrorUtils");
17
- var ReactPropTypeLocations = require("./ReactPropTypeLocations");
18
- var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
19
- var ReactNoopUpdateQueue = require("./ReactNoopUpdateQueue");
20
-
21
- var assign = require("./Object.assign");
22
- var emptyObject = require("./emptyObject");
23
- var invariant = require("./invariant");
24
- var keyMirror = require("./keyMirror");
25
- var keyOf = require("./keyOf");
26
- var warning = require("./warning");
14
+ var ReactComponent = require('./ReactComponent');
15
+ var ReactElement = require('./ReactElement');
16
+ var ReactErrorUtils = require('./ReactErrorUtils');
17
+ var ReactPropTypeLocations = require('./ReactPropTypeLocations');
18
+ var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
19
+ var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
20
+
21
+ var assign = require('./Object.assign');
22
+ var emptyObject = require('fbjs/lib/emptyObject');
23
+ var invariant = require('fbjs/lib/invariant');
24
+ var keyMirror = require('fbjs/lib/keyMirror');
25
+ var keyOf = require('fbjs/lib/keyOf');
26
+ var warning = require('fbjs/lib/warning');
27
27
 
28
28
  var MIXINS_KEY = keyOf({ mixins: null });
29
29
 
@@ -58,7 +58,7 @@ var warnedSetProps = false;
58
58
  function warnSetProps() {
59
59
  if (!warnedSetProps) {
60
60
  warnedSetProps = true;
61
- 'production' !== process.env.NODE_ENV ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call React.render again at the top level.') : undefined;
61
+ process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call React.render again at the top level.') : undefined;
62
62
  }
63
63
  }
64
64
 
@@ -328,13 +328,13 @@ var RESERVED_SPEC_KEYS = {
328
328
  }
329
329
  },
330
330
  childContextTypes: function (Constructor, childContextTypes) {
331
- if ('production' !== process.env.NODE_ENV) {
331
+ if (process.env.NODE_ENV !== 'production') {
332
332
  validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
333
333
  }
334
334
  Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
335
335
  },
336
336
  contextTypes: function (Constructor, contextTypes) {
337
- if ('production' !== process.env.NODE_ENV) {
337
+ if (process.env.NODE_ENV !== 'production') {
338
338
  validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
339
339
  }
340
340
  Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
@@ -351,7 +351,7 @@ var RESERVED_SPEC_KEYS = {
351
351
  }
352
352
  },
353
353
  propTypes: function (Constructor, propTypes) {
354
- if ('production' !== process.env.NODE_ENV) {
354
+ if (process.env.NODE_ENV !== 'production') {
355
355
  validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
356
356
  }
357
357
  Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
@@ -366,7 +366,7 @@ function validateTypeDef(Constructor, typeDef, location) {
366
366
  if (typeDef.hasOwnProperty(propName)) {
367
367
  // use a warning instead of an invariant so components
368
368
  // don't show up in prod but not in __DEV__
369
- 'production' !== process.env.NODE_ENV ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
369
+ process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
370
370
  }
371
371
  }
372
372
  }
@@ -376,12 +376,12 @@ function validateMethodOverride(proto, name) {
376
376
 
377
377
  // Disallow overriding of base class methods unless explicitly allowed.
378
378
  if (ReactClassMixin.hasOwnProperty(name)) {
379
- !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
379
+ !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
380
380
  }
381
381
 
382
382
  // Disallow defining methods more than once unless explicitly allowed.
383
383
  if (proto.hasOwnProperty(name)) {
384
- !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
384
+ !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
385
385
  }
386
386
  }
387
387
 
@@ -394,8 +394,8 @@ function mixSpecIntoComponent(Constructor, spec) {
394
394
  return;
395
395
  }
396
396
 
397
- !(typeof spec !== 'function') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
398
- !!ReactElement.isValidElement(spec) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
397
+ !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
398
+ !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
399
399
 
400
400
  var proto = Constructor.prototype;
401
401
 
@@ -442,7 +442,7 @@ function mixSpecIntoComponent(Constructor, spec) {
442
442
  var specPolicy = ReactClassInterface[name];
443
443
 
444
444
  // These cases should already be caught by validateMethodOverride.
445
- !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
445
+ !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
446
446
 
447
447
  // For methods which are defined more than once, call the existing
448
448
  // methods before calling the new property, merging if appropriate.
@@ -453,7 +453,7 @@ function mixSpecIntoComponent(Constructor, spec) {
453
453
  }
454
454
  } else {
455
455
  proto[name] = property;
456
- if ('production' !== process.env.NODE_ENV) {
456
+ if (process.env.NODE_ENV !== 'production') {
457
457
  // Add verbose displayName to the function, which helps when looking
458
458
  // at profiling tools.
459
459
  if (typeof property === 'function' && spec.displayName) {
@@ -477,10 +477,10 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
477
477
  }
478
478
 
479
479
  var isReserved = (name in RESERVED_SPEC_KEYS);
480
- !!isReserved ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
480
+ !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
481
481
 
482
482
  var isInherited = (name in Constructor);
483
- !!isInherited ? 'production' !== process.env.NODE_ENV ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
483
+ !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
484
484
  Constructor[name] = property;
485
485
  }
486
486
  }
@@ -493,11 +493,11 @@ function mixStaticSpecIntoComponent(Constructor, statics) {
493
493
  * @return {object} one after it has been mutated to contain everything in two.
494
494
  */
495
495
  function mergeIntoWithNoDuplicateKeys(one, two) {
496
- !(one && two && typeof one === 'object' && typeof two === 'object') ? 'production' !== process.env.NODE_ENV ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
496
+ !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
497
497
 
498
498
  for (var key in two) {
499
499
  if (two.hasOwnProperty(key)) {
500
- !(one[key] === undefined) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
500
+ !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
501
501
  one[key] = two[key];
502
502
  }
503
503
  }
@@ -552,7 +552,7 @@ function createChainedFunction(one, two) {
552
552
  */
553
553
  function bindAutoBindMethod(component, method) {
554
554
  var boundMethod = method.bind(component);
555
- if ('production' !== process.env.NODE_ENV) {
555
+ if (process.env.NODE_ENV !== 'production') {
556
556
  boundMethod.__reactBoundContext = component;
557
557
  boundMethod.__reactBoundMethod = method;
558
558
  boundMethod.__reactBoundArguments = null;
@@ -568,9 +568,9 @@ function bindAutoBindMethod(component, method) {
568
568
  // ignore the value of "this" that the user is trying to use, so
569
569
  // let's warn.
570
570
  if (newThis !== component && newThis !== null) {
571
- 'production' !== process.env.NODE_ENV ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
571
+ process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
572
572
  } else if (!args.length) {
573
- 'production' !== process.env.NODE_ENV ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
573
+ process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
574
574
  return boundMethod;
575
575
  }
576
576
  var reboundMethod = _bind.apply(boundMethod, arguments);
@@ -635,7 +635,7 @@ var ReactClassMixin = {
635
635
  * @deprecated
636
636
  */
637
637
  setProps: function (partialProps, callback) {
638
- if ('production' !== process.env.NODE_ENV) {
638
+ if (process.env.NODE_ENV !== 'production') {
639
639
  warnSetProps();
640
640
  }
641
641
  this.updater.enqueueSetProps(this, partialProps);
@@ -654,7 +654,7 @@ var ReactClassMixin = {
654
654
  * @deprecated
655
655
  */
656
656
  replaceProps: function (newProps, callback) {
657
- if ('production' !== process.env.NODE_ENV) {
657
+ if (process.env.NODE_ENV !== 'production') {
658
658
  warnSetProps();
659
659
  }
660
660
  this.updater.enqueueReplaceProps(this, newProps);
@@ -686,8 +686,8 @@ var ReactClass = {
686
686
  // This constructor is overridden by mocks. The argument is used
687
687
  // by mocks to assert on what gets mounted.
688
688
 
689
- if ('production' !== process.env.NODE_ENV) {
690
- 'production' !== process.env.NODE_ENV ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
689
+ if (process.env.NODE_ENV !== 'production') {
690
+ process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
691
691
  }
692
692
 
693
693
  // Wire up auto-binding
@@ -706,7 +706,7 @@ var ReactClass = {
706
706
  // getInitialState and componentWillMount methods for initialization.
707
707
 
708
708
  var initialState = this.getInitialState ? this.getInitialState() : null;
709
- if ('production' !== process.env.NODE_ENV) {
709
+ if (process.env.NODE_ENV !== 'production') {
710
710
  // We allow auto-mocks to proceed as if they're returning null.
711
711
  if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
712
712
  // This is probably bad practice. Consider warning here and
@@ -714,7 +714,7 @@ var ReactClass = {
714
714
  initialState = null;
715
715
  }
716
716
  }
717
- !(typeof initialState === 'object' && !Array.isArray(initialState)) ? 'production' !== process.env.NODE_ENV ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
717
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
718
718
 
719
719
  this.state = initialState;
720
720
  };
@@ -730,7 +730,7 @@ var ReactClass = {
730
730
  Constructor.defaultProps = Constructor.getDefaultProps();
731
731
  }
732
732
 
733
- if ('production' !== process.env.NODE_ENV) {
733
+ if (process.env.NODE_ENV !== 'production') {
734
734
  // This is a tag to indicate that the use of these method names is ok,
735
735
  // since it's used with createClass. If it's not, then it's likely a
736
736
  // mistake so we'll warn you to use the static property, property
@@ -743,11 +743,11 @@ var ReactClass = {
743
743
  }
744
744
  }
745
745
 
746
- !Constructor.prototype.render ? 'production' !== process.env.NODE_ENV ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
746
+ !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
747
747
 
748
- if ('production' !== process.env.NODE_ENV) {
749
- 'production' !== process.env.NODE_ENV ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
750
- 'production' !== process.env.NODE_ENV ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
748
+ if (process.env.NODE_ENV !== 'production') {
749
+ process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
750
+ process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
751
751
  }
752
752
 
753
753
  // Reduce time spent doing lookups by setting these on the prototype.