react 0.12.2 → 0.13.0-beta.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 (184) hide show
  1. package/dist/JSXTransformer.js +986 -511
  2. package/dist/react-with-addons.js +6076 -4560
  3. package/dist/react-with-addons.min.js +6 -7
  4. package/dist/react.js +5386 -4170
  5. package/dist/react.min.js +6 -7
  6. package/lib/AutoFocusMixin.js +2 -2
  7. package/lib/BeforeInputEventPlugin.js +388 -115
  8. package/lib/CSSCore.js +1 -1
  9. package/lib/CSSProperty.js +2 -2
  10. package/lib/CSSPropertyOperations.js +58 -11
  11. package/lib/CallbackQueue.js +3 -3
  12. package/lib/ChangeEventPlugin.js +4 -4
  13. package/lib/ClientReactRootIndex.js +2 -2
  14. package/lib/DOMChildrenOperations.js +10 -47
  15. package/lib/DOMProperty.js +2 -2
  16. package/lib/DOMPropertyOperations.js +11 -16
  17. package/lib/Danger.js +8 -7
  18. package/lib/DefaultEventPluginOrder.js +3 -4
  19. package/lib/EnterLeaveEventPlugin.js +2 -2
  20. package/lib/EventConstants.js +2 -2
  21. package/lib/EventListener.js +1 -1
  22. package/lib/EventPluginHub.js +10 -8
  23. package/lib/EventPluginRegistry.js +2 -2
  24. package/lib/EventPluginUtils.js +4 -4
  25. package/lib/EventPropagators.js +2 -2
  26. package/lib/ExecutionEnvironment.js +3 -4
  27. package/lib/FallbackCompositionState.js +89 -0
  28. package/lib/HTMLDOMPropertyConfig.js +23 -10
  29. package/lib/LinkedStateMixin.js +2 -2
  30. package/lib/LinkedValueUtils.js +4 -4
  31. package/lib/LocalEventTrapMixin.js +10 -3
  32. package/lib/MobileSafariClickEventPlugin.js +2 -2
  33. package/lib/Object.assign.js +4 -2
  34. package/lib/PooledClass.js +2 -2
  35. package/lib/React.js +19 -58
  36. package/lib/ReactBrowserComponentMixin.js +4 -14
  37. package/lib/ReactBrowserEventEmitter.js +6 -8
  38. package/lib/ReactCSSTransitionGroup.js +5 -2
  39. package/lib/ReactCSSTransitionGroupChild.js +20 -7
  40. package/lib/ReactChildReconciler.js +125 -0
  41. package/lib/ReactChildren.js +13 -10
  42. package/lib/ReactClass.js +918 -0
  43. package/lib/ReactComponent.js +98 -406
  44. package/lib/ReactComponentBrowserEnvironment.js +11 -84
  45. package/lib/ReactComponentEnvironment.js +57 -0
  46. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  47. package/lib/ReactCompositeComponent.js +574 -1140
  48. package/lib/ReactContext.js +17 -3
  49. package/lib/ReactCurrentOwner.js +2 -2
  50. package/lib/ReactDOM.js +4 -9
  51. package/lib/ReactDOMButton.js +6 -7
  52. package/lib/ReactDOMComponent.js +123 -105
  53. package/lib/ReactDOMForm.js +6 -7
  54. package/lib/ReactDOMIDOperations.js +59 -77
  55. package/lib/ReactDOMIframe.js +43 -0
  56. package/lib/ReactDOMImg.js +5 -7
  57. package/lib/ReactDOMInput.js +6 -7
  58. package/lib/ReactDOMOption.js +6 -7
  59. package/lib/ReactDOMSelect.js +58 -66
  60. package/lib/ReactDOMSelection.js +7 -3
  61. package/lib/{ReactTextComponent.js → ReactDOMTextComponent.js} +48 -37
  62. package/lib/ReactDOMTextarea.js +6 -7
  63. package/lib/ReactDefaultBatchingStrategy.js +5 -5
  64. package/lib/ReactDefaultInjection.js +39 -9
  65. package/lib/ReactDefaultPerf.js +17 -8
  66. package/lib/ReactDefaultPerfAnalysis.js +2 -2
  67. package/lib/ReactElement.js +23 -15
  68. package/lib/ReactElementValidator.js +206 -89
  69. package/lib/ReactEmptyComponent.js +33 -15
  70. package/lib/ReactErrorUtils.js +1 -1
  71. package/lib/ReactEventEmitterMixin.js +2 -2
  72. package/lib/ReactEventListener.js +4 -5
  73. package/lib/ReactFragment.js +172 -0
  74. package/lib/ReactInjection.js +8 -6
  75. package/lib/ReactInputSelection.js +4 -5
  76. package/lib/ReactInstanceHandles.js +4 -3
  77. package/lib/ReactInstanceMap.js +47 -0
  78. package/lib/ReactLifeCycle.js +35 -0
  79. package/lib/ReactLink.js +2 -2
  80. package/lib/ReactMarkupChecksum.js +2 -2
  81. package/lib/ReactMount.js +264 -71
  82. package/lib/ReactMultiChild.js +50 -48
  83. package/lib/ReactMultiChildUpdateTypes.js +2 -2
  84. package/lib/ReactNativeComponent.js +59 -25
  85. package/lib/ReactOwner.js +5 -49
  86. package/lib/ReactPerf.js +22 -2
  87. package/lib/ReactPropTransferer.js +3 -58
  88. package/lib/ReactPropTypeLocationNames.js +2 -2
  89. package/lib/ReactPropTypeLocations.js +2 -2
  90. package/lib/ReactPropTypes.js +17 -25
  91. package/lib/ReactPutListenerQueue.js +2 -2
  92. package/lib/ReactReconcileTransaction.js +2 -2
  93. package/lib/ReactReconciler.js +121 -0
  94. package/lib/ReactRef.js +69 -0
  95. package/lib/ReactRootIndex.js +2 -2
  96. package/lib/ReactServerRendering.js +6 -4
  97. package/lib/ReactServerRenderingTransaction.js +2 -2
  98. package/lib/ReactStateSetters.js +2 -2
  99. package/lib/ReactTestUtils.js +113 -27
  100. package/lib/ReactTransitionChildMapping.js +8 -4
  101. package/lib/ReactTransitionEvents.js +2 -2
  102. package/lib/ReactTransitionGroup.js +53 -12
  103. package/lib/ReactUpdateQueue.js +295 -0
  104. package/lib/ReactUpdates.js +54 -62
  105. package/lib/ReactWithAddons.js +4 -2
  106. package/lib/SVGDOMPropertyConfig.js +2 -2
  107. package/lib/SelectEventPlugin.js +4 -4
  108. package/lib/ServerReactRootIndex.js +2 -2
  109. package/lib/SimpleEventPlugin.js +4 -4
  110. package/lib/SyntheticClipboardEvent.js +2 -3
  111. package/lib/SyntheticCompositionEvent.js +2 -3
  112. package/lib/SyntheticDragEvent.js +2 -2
  113. package/lib/SyntheticEvent.js +12 -4
  114. package/lib/SyntheticFocusEvent.js +2 -2
  115. package/lib/SyntheticInputEvent.js +2 -3
  116. package/lib/SyntheticKeyboardEvent.js +2 -2
  117. package/lib/SyntheticMouseEvent.js +3 -5
  118. package/lib/SyntheticTouchEvent.js +2 -2
  119. package/lib/SyntheticUIEvent.js +2 -2
  120. package/lib/SyntheticWheelEvent.js +2 -2
  121. package/lib/Transaction.js +4 -4
  122. package/lib/ViewportMetrics.js +3 -6
  123. package/lib/accumulateInto.js +2 -2
  124. package/lib/adler32.js +2 -2
  125. package/lib/camelize.js +1 -1
  126. package/lib/camelizeStyleName.js +1 -1
  127. package/lib/cloneWithProps.js +4 -4
  128. package/lib/containsNode.js +1 -1
  129. package/lib/{createArrayFrom.js → createArrayFromMixed.js} +6 -6
  130. package/lib/createFullPageComponent.js +4 -4
  131. package/lib/createNodesFromMarkup.js +4 -4
  132. package/lib/cx.js +1 -1
  133. package/lib/dangerousStyleValue.js +2 -2
  134. package/lib/emptyFunction.js +1 -1
  135. package/lib/emptyObject.js +1 -1
  136. package/lib/{escapeTextForBrowser.js → escapeTextContentForBrowser.js} +10 -11
  137. package/lib/findDOMNode.js +51 -0
  138. package/lib/flattenChildren.js +12 -23
  139. package/lib/focusNode.js +1 -1
  140. package/lib/forEachAccumulated.js +2 -2
  141. package/lib/getActiveElement.js +1 -1
  142. package/lib/getEventCharCode.js +2 -2
  143. package/lib/getEventKey.js +2 -2
  144. package/lib/getEventModifierState.js +2 -2
  145. package/lib/getEventTarget.js +2 -2
  146. package/lib/getIteratorFn.js +42 -0
  147. package/lib/getMarkupWrap.js +1 -1
  148. package/lib/getNodeForCharacterOffset.js +3 -3
  149. package/lib/getReactRootElementInContainer.js +2 -2
  150. package/lib/getTextContentAccessor.js +2 -2
  151. package/lib/getUnboundedScrollPosition.js +1 -1
  152. package/lib/hyphenate.js +1 -1
  153. package/lib/hyphenateStyleName.js +1 -1
  154. package/lib/instantiateReactComponent.js +90 -68
  155. package/lib/invariant.js +1 -1
  156. package/lib/isEventSupported.js +2 -2
  157. package/lib/isNode.js +4 -5
  158. package/lib/isTextInputElement.js +3 -4
  159. package/lib/isTextNode.js +1 -1
  160. package/lib/joinClasses.js +2 -2
  161. package/lib/keyMirror.js +2 -2
  162. package/lib/keyOf.js +1 -1
  163. package/lib/mapObject.js +1 -1
  164. package/lib/memoizeStringOnly.js +5 -6
  165. package/lib/onlyChild.js +2 -2
  166. package/lib/performance.js +1 -1
  167. package/lib/performanceNow.js +1 -1
  168. package/lib/quoteAttributeValueForBrowser.js +26 -0
  169. package/lib/setInnerHTML.js +13 -2
  170. package/lib/setTextContent.js +40 -0
  171. package/lib/shallowEqual.js +2 -2
  172. package/lib/shouldUpdateReactComponent.js +71 -7
  173. package/lib/toArray.js +2 -2
  174. package/lib/traverseAllChildren.js +114 -56
  175. package/lib/update.js +2 -2
  176. package/lib/warning.js +20 -2
  177. package/package.json +1 -1
  178. package/lib/CompositionEventPlugin.js +0 -257
  179. package/lib/ReactLegacyElement.js +0 -243
  180. package/lib/copyProperties.js +0 -54
  181. package/lib/deprecated.js +0 -47
  182. package/lib/merge.js +0 -34
  183. package/lib/mergeInto.js +0 -24
  184. package/lib/monitorCodeUse.js +0 -30
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2014, Facebook, Inc.
2
+ * Copyright 2013-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -10,14 +10,13 @@
10
10
  * @typechecks static-only
11
11
  */
12
12
 
13
- "use strict";
13
+ 'use strict';
14
14
 
15
- var ReactComponent = require("./ReactComponent");
15
+ var ReactComponentEnvironment = require("./ReactComponentEnvironment");
16
16
  var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
17
17
 
18
- var flattenChildren = require("./flattenChildren");
19
- var instantiateReactComponent = require("./instantiateReactComponent");
20
- var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
18
+ var ReactReconciler = require("./ReactReconciler");
19
+ var ReactChildReconciler = require("./ReactChildReconciler");
21
20
 
22
21
  /**
23
22
  * Updating children of a component may trigger recursive updates. The depth is
@@ -135,7 +134,7 @@ function enqueueTextContent(parentID, textContent) {
135
134
  */
136
135
  function processQueue() {
137
136
  if (updateQueue.length) {
138
- ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(
137
+ ReactComponentEnvironment.processChildrenUpdates(
139
138
  updateQueue,
140
139
  markupQueue
141
140
  );
@@ -178,26 +177,25 @@ var ReactMultiChild = {
178
177
  * @return {array} An array of mounted representations.
179
178
  * @internal
180
179
  */
181
- mountChildren: function(nestedChildren, transaction) {
182
- var children = flattenChildren(nestedChildren);
180
+ mountChildren: function(nestedChildren, transaction, context) {
181
+ var children = ReactChildReconciler.instantiateChildren(
182
+ nestedChildren, transaction, context
183
+ );
184
+ this._renderedChildren = children;
183
185
  var mountImages = [];
184
186
  var index = 0;
185
- this._renderedChildren = children;
186
187
  for (var name in children) {
187
- var child = children[name];
188
188
  if (children.hasOwnProperty(name)) {
189
- // The rendered children must be turned into instances as they're
190
- // mounted.
191
- var childInstance = instantiateReactComponent(child, null);
192
- children[name] = childInstance;
189
+ var child = children[name];
193
190
  // Inlined for performance, see `ReactInstanceHandles.createReactID`.
194
191
  var rootID = this._rootNodeID + name;
195
- var mountImage = childInstance.mountComponent(
192
+ var mountImage = ReactReconciler.mountComponent(
193
+ child,
196
194
  rootID,
197
195
  transaction,
198
- this._mountDepth + 1
196
+ context
199
197
  );
200
- childInstance._mountIndex = index;
198
+ child._mountIndex = index;
201
199
  mountImages.push(mountImage);
202
200
  index++;
203
201
  }
@@ -217,6 +215,8 @@ var ReactMultiChild = {
217
215
  try {
218
216
  var prevChildren = this._renderedChildren;
219
217
  // Remove any rendered children.
218
+ ReactChildReconciler.unmountChildren(prevChildren);
219
+ // TODO: The setTextContent operation should be enough
220
220
  for (var name in prevChildren) {
221
221
  if (prevChildren.hasOwnProperty(name)) {
222
222
  this._unmountChildByName(prevChildren[name], name);
@@ -228,7 +228,11 @@ var ReactMultiChild = {
228
228
  } finally {
229
229
  updateDepth--;
230
230
  if (!updateDepth) {
231
- errorThrown ? clearQueue() : processQueue();
231
+ if (errorThrown) {
232
+ clearQueue();
233
+ } else {
234
+ processQueue();
235
+ }
232
236
  }
233
237
  }
234
238
  },
@@ -240,17 +244,22 @@ var ReactMultiChild = {
240
244
  * @param {ReactReconcileTransaction} transaction
241
245
  * @internal
242
246
  */
243
- updateChildren: function(nextNestedChildren, transaction) {
247
+ updateChildren: function(nextNestedChildren, transaction, context) {
244
248
  updateDepth++;
245
249
  var errorThrown = true;
246
250
  try {
247
- this._updateChildren(nextNestedChildren, transaction);
251
+ this._updateChildren(nextNestedChildren, transaction, context);
248
252
  errorThrown = false;
249
253
  } finally {
250
254
  updateDepth--;
251
255
  if (!updateDepth) {
252
- errorThrown ? clearQueue() : processQueue();
256
+ if (errorThrown) {
257
+ clearQueue();
258
+ } else {
259
+ processQueue();
260
+ }
253
261
  }
262
+
254
263
  }
255
264
  },
256
265
 
@@ -263,9 +272,12 @@ var ReactMultiChild = {
263
272
  * @final
264
273
  * @protected
265
274
  */
266
- _updateChildren: function(nextNestedChildren, transaction) {
267
- var nextChildren = flattenChildren(nextNestedChildren);
275
+ _updateChildren: function(nextNestedChildren, transaction, context) {
268
276
  var prevChildren = this._renderedChildren;
277
+ var nextChildren = ReactChildReconciler.updateChildren(
278
+ prevChildren, nextNestedChildren, transaction, context
279
+ );
280
+ this._renderedChildren = nextChildren;
269
281
  if (!nextChildren && !prevChildren) {
270
282
  return;
271
283
  }
@@ -279,12 +291,10 @@ var ReactMultiChild = {
279
291
  continue;
280
292
  }
281
293
  var prevChild = prevChildren && prevChildren[name];
282
- var prevElement = prevChild && prevChild._currentElement;
283
- var nextElement = nextChildren[name];
284
- if (shouldUpdateReactComponent(prevElement, nextElement)) {
294
+ var nextChild = nextChildren[name];
295
+ if (prevChild === nextChild) {
285
296
  this.moveChild(prevChild, nextIndex, lastIndex);
286
297
  lastIndex = Math.max(prevChild._mountIndex, lastIndex);
287
- prevChild.receiveComponent(nextElement, transaction);
288
298
  prevChild._mountIndex = nextIndex;
289
299
  } else {
290
300
  if (prevChild) {
@@ -293,12 +303,8 @@ var ReactMultiChild = {
293
303
  this._unmountChildByName(prevChild, name);
294
304
  }
295
305
  // The child must be instantiated before it's mounted.
296
- var nextChildInstance = instantiateReactComponent(
297
- nextElement,
298
- null
299
- );
300
306
  this._mountChildByNameAtIndex(
301
- nextChildInstance, name, nextIndex, transaction
307
+ nextChild, name, nextIndex, transaction, context
302
308
  );
303
309
  }
304
310
  nextIndex++;
@@ -306,7 +312,7 @@ var ReactMultiChild = {
306
312
  // Remove children that are no longer present.
307
313
  for (name in prevChildren) {
308
314
  if (prevChildren.hasOwnProperty(name) &&
309
- !(nextChildren && nextChildren[name])) {
315
+ !(nextChildren && nextChildren.hasOwnProperty(name))) {
310
316
  this._unmountChildByName(prevChildren[name], name);
311
317
  }
312
318
  }
@@ -320,13 +326,7 @@ var ReactMultiChild = {
320
326
  */
321
327
  unmountChildren: function() {
322
328
  var renderedChildren = this._renderedChildren;
323
- for (var name in renderedChildren) {
324
- var renderedChild = renderedChildren[name];
325
- // TODO: When is this not true?
326
- if (renderedChild.unmountComponent) {
327
- renderedChild.unmountComponent();
328
- }
329
- }
329
+ ReactChildReconciler.unmountChildren(renderedChildren);
330
330
  this._renderedChildren = null;
331
331
  },
332
332
 
@@ -389,18 +389,22 @@ var ReactMultiChild = {
389
389
  * @param {ReactReconcileTransaction} transaction
390
390
  * @private
391
391
  */
392
- _mountChildByNameAtIndex: function(child, name, index, transaction) {
392
+ _mountChildByNameAtIndex: function(
393
+ child,
394
+ name,
395
+ index,
396
+ transaction,
397
+ context) {
393
398
  // Inlined for performance, see `ReactInstanceHandles.createReactID`.
394
399
  var rootID = this._rootNodeID + name;
395
- var mountImage = child.mountComponent(
400
+ var mountImage = ReactReconciler.mountComponent(
401
+ child,
396
402
  rootID,
397
403
  transaction,
398
- this._mountDepth + 1
404
+ context
399
405
  );
400
406
  child._mountIndex = index;
401
407
  this.createChild(child, mountImage);
402
- this._renderedChildren = this._renderedChildren || {};
403
- this._renderedChildren[name] = child;
404
408
  },
405
409
 
406
410
  /**
@@ -415,8 +419,6 @@ var ReactMultiChild = {
415
419
  _unmountChildByName: function(child, name) {
416
420
  this.removeChild(child);
417
421
  child._mountIndex = null;
418
- child.unmountComponent();
419
- delete this._renderedChildren[name];
420
422
  }
421
423
 
422
424
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2014, Facebook, Inc.
2
+ * Copyright 2013-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -9,7 +9,7 @@
9
9
  * @providesModule ReactMultiChildUpdateTypes
10
10
  */
11
11
 
12
- "use strict";
12
+ 'use strict';
13
13
 
14
14
  var keyMirror = require("./keyMirror");
15
15
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2014, Facebook, Inc.
2
+ * Copyright 2014-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -9,14 +9,16 @@
9
9
  * @providesModule ReactNativeComponent
10
10
  */
11
11
 
12
- "use strict";
12
+ 'use strict';
13
13
 
14
14
  var assign = require("./Object.assign");
15
15
  var invariant = require("./invariant");
16
16
 
17
+ var autoGenerateWrapperClass = null;
17
18
  var genericComponentClass = null;
18
19
  // This registry keeps track of wrapper classes around native tags
19
20
  var tagToComponentClass = {};
21
+ var textComponentClass = null;
20
22
 
21
23
  var ReactNativeComponentInjection = {
22
24
  // This accepts a class that receives the tag string. This is a catch all
@@ -24,45 +26,77 @@ var ReactNativeComponentInjection = {
24
26
  injectGenericComponentClass: function(componentClass) {
25
27
  genericComponentClass = componentClass;
26
28
  },
29
+ // This accepts a text component class that takes the text string to be
30
+ // rendered as props.
31
+ injectTextComponentClass: function(componentClass) {
32
+ textComponentClass = componentClass;
33
+ },
27
34
  // This accepts a keyed object with classes as values. Each key represents a
28
35
  // tag. That particular tag will use this class instead of the generic one.
29
36
  injectComponentClasses: function(componentClasses) {
30
37
  assign(tagToComponentClass, componentClasses);
38
+ },
39
+ // Temporary hack since we expect DOM refs to behave like composites,
40
+ // for this release.
41
+ injectAutoWrapper: function(wrapperFactory) {
42
+ autoGenerateWrapperClass = wrapperFactory;
31
43
  }
32
44
  };
33
45
 
34
46
  /**
35
- * Create an internal class for a specific tag.
47
+ * Get a composite component wrapper class for a specific tag.
36
48
  *
37
- * @param {string} tag The tag for which to create an internal instance.
38
- * @param {any} props The props passed to the instance constructor.
39
- * @return {ReactComponent} component The injected empty component.
49
+ * @param {ReactElement} element The tag for which to get the class.
50
+ * @return {function} The React class constructor function.
40
51
  */
41
- function createInstanceForTag(tag, props, parentType) {
52
+ function getComponentClassForElement(element) {
53
+ if (typeof element.type === 'function') {
54
+ return element.type;
55
+ }
56
+ var tag = element.type;
42
57
  var componentClass = tagToComponentClass[tag];
43
58
  if (componentClass == null) {
44
- ("production" !== process.env.NODE_ENV ? invariant(
45
- genericComponentClass,
46
- 'There is no registered component for the tag %s',
47
- tag
48
- ) : invariant(genericComponentClass));
49
- return new genericComponentClass(tag, props);
59
+ tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
50
60
  }
51
- if (parentType === tag) {
52
- // Avoid recursion
53
- ("production" !== process.env.NODE_ENV ? invariant(
54
- genericComponentClass,
55
- 'There is no registered component for the tag %s',
56
- tag
57
- ) : invariant(genericComponentClass));
58
- return new genericComponentClass(tag, props);
59
- }
60
- // Unwrap legacy factories
61
- return new componentClass.type(props);
61
+ return componentClass;
62
+ }
63
+
64
+ /**
65
+ * Get a native internal component class for a specific tag.
66
+ *
67
+ * @param {ReactElement} element The element to create.
68
+ * @return {function} The internal class constructor function.
69
+ */
70
+ function createInternalComponent(element) {
71
+ ("production" !== process.env.NODE_ENV ? invariant(
72
+ genericComponentClass,
73
+ 'There is no registered component for the tag %s',
74
+ element.type
75
+ ) : invariant(genericComponentClass));
76
+ return new genericComponentClass(element.type, element.props);
77
+ }
78
+
79
+ /**
80
+ * @param {ReactText} text
81
+ * @return {ReactComponent}
82
+ */
83
+ function createInstanceForText(text) {
84
+ return new textComponentClass(text);
85
+ }
86
+
87
+ /**
88
+ * @param {ReactComponent} component
89
+ * @return {boolean}
90
+ */
91
+ function isTextComponent(component) {
92
+ return component instanceof textComponentClass;
62
93
  }
63
94
 
64
95
  var ReactNativeComponent = {
65
- createInstanceForTag: createInstanceForTag,
96
+ getComponentClassForElement: getComponentClassForElement,
97
+ createInternalComponent: createInternalComponent,
98
+ createInstanceForText: createInstanceForText,
99
+ isTextComponent: isTextComponent,
66
100
  injection: ReactNativeComponentInjection
67
101
  };
68
102
 
package/lib/ReactOwner.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2014, Facebook, Inc.
2
+ * Copyright 2013-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -9,9 +9,8 @@
9
9
  * @providesModule ReactOwner
10
10
  */
11
11
 
12
- "use strict";
12
+ 'use strict';
13
13
 
14
- var emptyObject = require("./emptyObject");
15
14
  var invariant = require("./invariant");
16
15
 
17
16
  /**
@@ -53,9 +52,8 @@ var ReactOwner = {
53
52
  */
54
53
  isValidOwner: function(object) {
55
54
  return !!(
56
- object &&
57
- typeof object.attachRef === 'function' &&
58
- typeof object.detachRef === 'function'
55
+ (object &&
56
+ typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
59
57
  );
60
58
  },
61
59
 
@@ -100,51 +98,9 @@ var ReactOwner = {
100
98
  ) : invariant(ReactOwner.isValidOwner(owner)));
101
99
  // Check that `component` is still the current ref because we do not want to
102
100
  // detach the ref if another component stole it.
103
- if (owner.refs[ref] === component) {
101
+ if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
104
102
  owner.detachRef(ref);
105
103
  }
106
- },
107
-
108
- /**
109
- * A ReactComponent must mix this in to have refs.
110
- *
111
- * @lends {ReactOwner.prototype}
112
- */
113
- Mixin: {
114
-
115
- construct: function() {
116
- this.refs = emptyObject;
117
- },
118
-
119
- /**
120
- * Lazily allocates the refs object and stores `component` as `ref`.
121
- *
122
- * @param {string} ref Reference name.
123
- * @param {component} component Component to store as `ref`.
124
- * @final
125
- * @private
126
- */
127
- attachRef: function(ref, component) {
128
- ("production" !== process.env.NODE_ENV ? invariant(
129
- component.isOwnedBy(this),
130
- 'attachRef(%s, ...): Only a component\'s owner can store a ref to it.',
131
- ref
132
- ) : invariant(component.isOwnedBy(this)));
133
- var refs = this.refs === emptyObject ? (this.refs = {}) : this.refs;
134
- refs[ref] = component;
135
- },
136
-
137
- /**
138
- * Detaches a reference name.
139
- *
140
- * @param {string} ref Name to dereference.
141
- * @final
142
- * @private
143
- */
144
- detachRef: function(ref) {
145
- delete this.refs[ref];
146
- }
147
-
148
104
  }
149
105
 
150
106
  };
package/lib/ReactPerf.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2014, Facebook, Inc.
2
+ * Copyright 2013-2015, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -10,7 +10,7 @@
10
10
  * @typechecks static-only
11
11
  */
12
12
 
13
- "use strict";
13
+ 'use strict';
14
14
 
15
15
  /**
16
16
  * ReactPerf is a general AOP system designed to measure performance. This
@@ -29,6 +29,26 @@ var ReactPerf = {
29
29
  */
30
30
  storedMeasure: _noMeasure,
31
31
 
32
+ /**
33
+ * @param {object} object
34
+ * @param {string} objectName
35
+ * @param {object<string>} methodNames
36
+ */
37
+ measureMethods: function(object, objectName, methodNames) {
38
+ if ("production" !== process.env.NODE_ENV) {
39
+ for (var key in methodNames) {
40
+ if (!methodNames.hasOwnProperty(key)) {
41
+ continue;
42
+ }
43
+ object[key] = ReactPerf.measure(
44
+ objectName,
45
+ methodNames[key],
46
+ object[key]
47
+ );
48
+ }
49
+ }
50
+ },
51
+
32
52
  /**
33
53
  * Use this to wrap methods you want to measure. Zero overhead in production.
34
54
  *