react 0.14.10 → 15.0.0

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 (193) hide show
  1. package/LICENSE +1 -1
  2. package/dist/react-with-addons.js +4900 -4627
  3. package/dist/react-with-addons.min.js +7 -7
  4. package/dist/react.js +4556 -4059
  5. package/dist/react.min.js +7 -7
  6. package/lib/AutoFocusUtils.js +3 -15
  7. package/lib/BeforeInputEventPlugin.js +8 -25
  8. package/lib/CSSProperty.js +10 -1
  9. package/lib/CSSPropertyOperations.js +49 -19
  10. package/lib/CallbackQueue.js +16 -4
  11. package/lib/ChangeEventPlugin.js +58 -54
  12. package/lib/DOMChildrenOperations.js +91 -61
  13. package/lib/DOMLazyTree.js +105 -0
  14. package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
  15. package/lib/DOMProperty.js +18 -39
  16. package/lib/DOMPropertyOperations.js +42 -53
  17. package/lib/Danger.js +13 -14
  18. package/lib/DefaultEventPluginOrder.js +1 -1
  19. package/lib/EnterLeaveEventPlugin.js +24 -43
  20. package/lib/EventConstants.js +6 -1
  21. package/lib/EventPluginHub.js +22 -66
  22. package/lib/EventPluginRegistry.js +30 -9
  23. package/lib/EventPluginUtils.js +61 -36
  24. package/lib/EventPropagators.js +19 -17
  25. package/lib/FallbackCompositionState.js +4 -4
  26. package/lib/HTMLDOMPropertyConfig.js +131 -152
  27. package/lib/LinkedStateMixin.js +1 -2
  28. package/lib/LinkedValueUtils.js +6 -7
  29. package/lib/MetaMatchers.js +2 -2
  30. package/lib/OrderedMap.js +17 -16
  31. package/lib/PooledClass.js +2 -2
  32. package/lib/React.js +50 -20
  33. package/lib/ReactBrowserEventEmitter.js +19 -26
  34. package/lib/ReactCSSTransitionGroup.js +4 -5
  35. package/lib/ReactCSSTransitionGroupChild.js +1 -6
  36. package/lib/ReactChildReconciler.js +15 -13
  37. package/lib/ReactChildren.js +5 -4
  38. package/lib/ReactClass.js +44 -92
  39. package/lib/ReactComponent.js +9 -10
  40. package/lib/ReactComponentBrowserEnvironment.js +9 -6
  41. package/lib/ReactComponentEnvironment.js +4 -4
  42. package/lib/ReactComponentWithPureRenderMixin.js +2 -2
  43. package/lib/ReactCompositeComponent.js +166 -74
  44. package/lib/ReactCurrentOwner.js +2 -1
  45. package/lib/ReactDOM.js +27 -15
  46. package/lib/ReactDOMButton.js +2 -2
  47. package/lib/ReactDOMComponent.js +186 -250
  48. package/lib/ReactDOMComponentFlags.js +18 -0
  49. package/lib/ReactDOMComponentTree.js +186 -0
  50. package/lib/ReactDOMContainerInfo.js +32 -0
  51. package/lib/ReactDOMDebugTool.js +61 -0
  52. package/lib/ReactDOMEmptyComponent.js +60 -0
  53. package/lib/ReactDOMFactories.js +1 -2
  54. package/lib/ReactDOMFeatureFlags.js +2 -2
  55. package/lib/ReactDOMIDOperations.js +5 -60
  56. package/lib/ReactDOMInput.js +73 -23
  57. package/lib/ReactDOMInstrumentation.js +16 -0
  58. package/lib/ReactDOMOption.js +14 -12
  59. package/lib/ReactDOMSelect.js +43 -19
  60. package/lib/ReactDOMSelection.js +4 -4
  61. package/lib/ReactDOMServer.js +1 -1
  62. package/lib/ReactDOMTextComponent.js +87 -45
  63. package/lib/ReactDOMTextarea.js +39 -11
  64. package/lib/ReactDOMTreeTraversal.js +134 -0
  65. package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
  66. package/lib/ReactDebugInstanceMap.js +102 -0
  67. package/lib/ReactDebugTool.js +72 -0
  68. package/lib/ReactDefaultBatchingStrategy.js +4 -3
  69. package/lib/ReactDefaultInjection.js +11 -15
  70. package/lib/ReactDefaultPerf.js +105 -26
  71. package/lib/ReactDefaultPerfAnalysis.js +23 -15
  72. package/lib/ReactElement.js +63 -23
  73. package/lib/ReactElementValidator.js +9 -9
  74. package/lib/ReactEmptyComponent.js +8 -33
  75. package/lib/ReactErrorUtils.js +1 -2
  76. package/lib/ReactEventEmitterMixin.js +3 -8
  77. package/lib/ReactEventListener.js +23 -77
  78. package/lib/ReactFeatureFlags.js +21 -0
  79. package/lib/ReactFragment.js +6 -6
  80. package/lib/ReactInjection.js +3 -3
  81. package/lib/ReactInputSelection.js +4 -4
  82. package/lib/ReactInstanceHandles.js +10 -12
  83. package/lib/ReactInstanceMap.js +2 -1
  84. package/lib/ReactInstrumentation.js +16 -0
  85. package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
  86. package/lib/ReactLink.js +2 -3
  87. package/lib/ReactMarkupChecksum.js +8 -3
  88. package/lib/ReactMount.js +88 -460
  89. package/lib/ReactMultiChild.js +106 -200
  90. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  91. package/lib/ReactNativeComponent.js +6 -5
  92. package/lib/ReactNodeTypes.js +37 -0
  93. package/lib/ReactNoopUpdateQueue.js +2 -25
  94. package/lib/ReactOwner.js +7 -6
  95. package/lib/ReactPerf.js +2 -2
  96. package/lib/ReactPropTransferer.js +5 -4
  97. package/lib/ReactPropTypeLocationNames.js +1 -1
  98. package/lib/ReactPropTypeLocations.js +1 -1
  99. package/lib/ReactPropTypes.js +31 -7
  100. package/lib/ReactReconcileTransaction.js +20 -9
  101. package/lib/ReactReconciler.js +29 -6
  102. package/lib/ReactRef.js +1 -1
  103. package/lib/ReactServerBatchingStrategy.js +1 -2
  104. package/lib/ReactServerRendering.js +17 -35
  105. package/lib/ReactServerRenderingTransaction.js +11 -29
  106. package/lib/ReactSimpleEmptyComponent.js +36 -0
  107. package/lib/ReactStateSetters.js +1 -1
  108. package/lib/ReactTestUtils.js +47 -28
  109. package/lib/ReactTransitionChildMapping.js +1 -2
  110. package/lib/ReactTransitionEvents.js +8 -44
  111. package/lib/ReactTransitionGroup.js +4 -3
  112. package/lib/ReactUMDEntry.js +26 -0
  113. package/lib/ReactUpdateQueue.js +24 -66
  114. package/lib/ReactUpdates.js +29 -11
  115. package/lib/ReactVersion.js +2 -2
  116. package/lib/ReactWithAddons.js +1 -21
  117. package/lib/ReactWithAddonsUMDEntry.js +26 -0
  118. package/lib/ResponderEventPlugin.js +54 -66
  119. package/lib/ResponderSyntheticEvent.js +2 -3
  120. package/lib/ResponderTouchHistoryStore.js +5 -5
  121. package/lib/SVGDOMPropertyConfig.js +267 -94
  122. package/lib/SelectEventPlugin.js +13 -18
  123. package/lib/SimpleEventPlugin.js +57 -17
  124. package/lib/SyntheticAnimationEvent.js +39 -0
  125. package/lib/SyntheticClipboardEvent.js +2 -3
  126. package/lib/SyntheticCompositionEvent.js +2 -3
  127. package/lib/SyntheticDragEvent.js +2 -3
  128. package/lib/SyntheticEvent.js +102 -21
  129. package/lib/SyntheticFocusEvent.js +2 -3
  130. package/lib/SyntheticInputEvent.js +2 -3
  131. package/lib/SyntheticKeyboardEvent.js +2 -3
  132. package/lib/SyntheticMouseEvent.js +2 -3
  133. package/lib/SyntheticTouchEvent.js +2 -3
  134. package/lib/SyntheticTransitionEvent.js +39 -0
  135. package/lib/SyntheticUIEvent.js +2 -3
  136. package/lib/SyntheticWheelEvent.js +2 -3
  137. package/lib/TapEventPlugin.js +3 -12
  138. package/lib/Transaction.js +3 -3
  139. package/lib/ViewportMetrics.js +1 -1
  140. package/lib/accumulate.js +2 -2
  141. package/lib/accumulateInto.js +2 -2
  142. package/lib/adler32.js +3 -2
  143. package/lib/canDefineProperty.js +1 -1
  144. package/lib/createHierarchyRenderer.js +1 -1
  145. package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
  146. package/lib/dangerousStyleValue.js +25 -3
  147. package/lib/deprecated.js +7 -4
  148. package/lib/escapeTextContentForBrowser.js +1 -1
  149. package/lib/findDOMNode.js +15 -8
  150. package/lib/flattenChildren.js +2 -2
  151. package/lib/forEachAccumulated.js +2 -1
  152. package/lib/getEventCharCode.js +2 -2
  153. package/lib/getEventKey.js +1 -2
  154. package/lib/getEventModifierState.js +1 -2
  155. package/lib/getEventTarget.js +8 -2
  156. package/lib/getIteratorFn.js +2 -2
  157. package/lib/getNativeComponentFromComposite.js +30 -0
  158. package/lib/getNodeForCharacterOffset.js +2 -1
  159. package/lib/getTestDocument.js +1 -1
  160. package/lib/getTextContentAccessor.js +1 -1
  161. package/lib/getVendorPrefixedEventName.js +101 -0
  162. package/lib/instantiateReactComponent.js +12 -13
  163. package/lib/isEventSupported.js +2 -2
  164. package/lib/isTextInputElement.js +2 -1
  165. package/lib/onlyChild.js +2 -2
  166. package/lib/quoteAttributeValueForBrowser.js +1 -1
  167. package/lib/reactComponentExpect.js +5 -4
  168. package/lib/renderSubtreeIntoContainer.js +1 -1
  169. package/lib/setInnerHTML.js +6 -14
  170. package/lib/setTextContent.js +1 -1
  171. package/lib/shallowCompare.js +1 -1
  172. package/lib/shouldUpdateReactComponent.js +2 -3
  173. package/lib/sliceChildren.js +1 -1
  174. package/lib/traverseAllChildren.js +8 -8
  175. package/lib/update.js +16 -15
  176. package/lib/validateDOMNesting.js +18 -13
  177. package/package.json +23 -32
  178. package/addons.js +0 -13
  179. package/cjs/react-jsx-dev-runtime.development.js +0 -861
  180. package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
  181. package/cjs/react-jsx-runtime.development.js +0 -883
  182. package/cjs/react-jsx-runtime.production.min.js +0 -10
  183. package/jsx-dev-runtime.js +0 -7
  184. package/jsx-runtime.js +0 -7
  185. package/lib/Object.assign.js +0 -47
  186. package/lib/React.native.js +0 -5
  187. package/lib/ReactBrowserComponentMixin.js +0 -36
  188. package/lib/ReactEmptyComponentRegistry.js +0 -48
  189. package/lib/ReactIsomorphic.js +0 -74
  190. package/lib/ReactRootIndex.js +0 -29
  191. package/lib/ServerReactRootIndex.js +0 -29
  192. package/lib/cloneWithProps.js +0 -54
  193. package/lib/webcomponents.js +0 -6379
package/lib/deprecated.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -11,7 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var assign = require('./Object.assign');
14
+ var _assign = require('object-assign');
15
+
15
16
  var warning = require('fbjs/lib/warning');
16
17
 
17
18
  /**
@@ -30,16 +31,18 @@ function deprecated(fnName, newModule, newPackage, ctx, fn) {
30
31
  if (process.env.NODE_ENV !== 'production') {
31
32
  var newFn = function () {
32
33
  process.env.NODE_ENV !== 'production' ? warning(warned,
34
+ /* eslint-disable no-useless-concat */
33
35
  // Require examples in this string must be split to prevent React's
34
36
  // build tools from mistaking them for real requires.
35
37
  // Otherwise the build tools will attempt to build a '%s' module.
36
- 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
38
+ 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : void 0;
39
+ /* eslint-enable no-useless-concat */
37
40
  warned = true;
38
41
  return fn.apply(ctx, arguments);
39
42
  };
40
43
  // We need to make sure all properties of the original fn are copied over.
41
44
  // In particular, this is needed to support PropTypes
42
- return assign(newFn, fn);
45
+ return _assign(newFn, fn);
43
46
  }
44
47
 
45
48
  return fn;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,15 +7,15 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule findDOMNode
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
15
14
  var ReactCurrentOwner = require('./ReactCurrentOwner');
15
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
16
16
  var ReactInstanceMap = require('./ReactInstanceMap');
17
- var ReactMount = require('./ReactMount');
18
17
 
18
+ var getNativeComponentFromComposite = require('./getNativeComponentFromComposite');
19
19
  var invariant = require('fbjs/lib/invariant');
20
20
  var warning = require('fbjs/lib/warning');
21
21
 
@@ -29,7 +29,7 @@ function findDOMNode(componentOrElement) {
29
29
  if (process.env.NODE_ENV !== 'production') {
30
30
  var owner = ReactCurrentOwner.current;
31
31
  if (owner !== null) {
32
- process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
32
+ process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
33
33
  owner._warnedAboutRefsInRender = true;
34
34
  }
35
35
  }
@@ -39,11 +39,18 @@ function findDOMNode(componentOrElement) {
39
39
  if (componentOrElement.nodeType === 1) {
40
40
  return componentOrElement;
41
41
  }
42
- if (ReactInstanceMap.has(componentOrElement)) {
43
- return ReactMount.getNodeFromInstance(componentOrElement);
42
+
43
+ var inst = ReactInstanceMap.get(componentOrElement);
44
+ if (inst) {
45
+ inst = getNativeComponentFromComposite(inst);
46
+ return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
47
+ }
48
+
49
+ if (typeof componentOrElement.render === 'function') {
50
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : void 0;
51
+ } else {
52
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : void 0;
44
53
  }
45
- !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
46
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
47
54
  }
48
55
 
49
56
  module.exports = findDOMNode;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -24,7 +24,7 @@ function flattenSingleChildIntoContext(traverseContext, child, name) {
24
24
  var result = traverseContext;
25
25
  var keyUnique = result[name] === undefined;
26
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;
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) : void 0;
28
28
  }
29
29
  if (keyUnique && child != null) {
30
30
  result[name] = child;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -18,6 +18,7 @@
18
18
  * handling the case when there is exactly one item (and we do not need to
19
19
  * allocate an array).
20
20
  */
21
+
21
22
  var forEachAccumulated = function (arr, cb, scope) {
22
23
  if (Array.isArray(arr)) {
23
24
  arr.forEach(cb, scope);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,7 +7,6 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule getEventCharCode
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
@@ -22,6 +21,7 @@
22
21
  * @param {object} nativeEvent Native browser event.
23
22
  * @return {number} Normalized `charCode` property.
24
23
  */
24
+
25
25
  function getEventCharCode(nativeEvent) {
26
26
  var charCode;
27
27
  var keyCode = nativeEvent.keyCode;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,7 +7,6 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule getEventKey
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,7 +7,6 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule getEventModifierState
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,7 +7,6 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule getEventTarget
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
@@ -19,8 +18,15 @@
19
18
  * @param {object} nativeEvent Native browser event.
20
19
  * @return {DOMEventTarget} Target node.
21
20
  */
21
+
22
22
  function getEventTarget(nativeEvent) {
23
23
  var target = nativeEvent.target || nativeEvent.srcElement || window;
24
+
25
+ // Normalize SVG <use> element events #4963
26
+ if (target.correspondingUseElement) {
27
+ target = target.correspondingUseElement;
28
+ }
29
+
24
30
  // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
25
31
  // @see http://www.quirksmode.org/js/events_properties.html
26
32
  return target.nodeType === 3 ? target.parentNode : target;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,12 +7,12 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule getIteratorFn
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
15
14
  /* global Symbol */
15
+
16
16
  var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
17
17
  var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
18
18
 
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule getNativeComponentFromComposite
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var ReactNodeTypes = require('./ReactNodeTypes');
15
+
16
+ function getNativeComponentFromComposite(inst) {
17
+ var type;
18
+
19
+ while ((type = inst._renderedNodeType) === ReactNodeTypes.COMPOSITE) {
20
+ inst = inst._renderedComponent;
21
+ }
22
+
23
+ if (type === ReactNodeTypes.NATIVE) {
24
+ return inst._renderedComponent;
25
+ } else if (type === ReactNodeTypes.EMPTY) {
26
+ return null;
27
+ }
28
+ }
29
+
30
+ module.exports = getNativeComponentFromComposite;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -17,6 +17,7 @@
17
17
  * @param {DOMElement|DOMTextNode} node
18
18
  * @return {DOMElement|DOMTextNode}
19
19
  */
20
+
20
21
  function getLeafNode(node) {
21
22
  while (node && node.firstChild) {
22
23
  node = node.firstChild;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule getVendorPrefixedEventName
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
15
+
16
+ /**
17
+ * Generate a mapping of standard vendor prefixes using the defined style property and event name.
18
+ *
19
+ * @param {string} styleProp
20
+ * @param {string} eventName
21
+ * @returns {object}
22
+ */
23
+ function makePrefixMap(styleProp, eventName) {
24
+ var prefixes = {};
25
+
26
+ prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
27
+ prefixes['Webkit' + styleProp] = 'webkit' + eventName;
28
+ prefixes['Moz' + styleProp] = 'moz' + eventName;
29
+ prefixes['ms' + styleProp] = 'MS' + eventName;
30
+ prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
31
+
32
+ return prefixes;
33
+ }
34
+
35
+ /**
36
+ * A list of event names to a configurable list of vendor prefixes.
37
+ */
38
+ var vendorPrefixes = {
39
+ animationend: makePrefixMap('Animation', 'AnimationEnd'),
40
+ animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
41
+ animationstart: makePrefixMap('Animation', 'AnimationStart'),
42
+ transitionend: makePrefixMap('Transition', 'TransitionEnd')
43
+ };
44
+
45
+ /**
46
+ * Event names that have already been detected and prefixed (if applicable).
47
+ */
48
+ var prefixedEventNames = {};
49
+
50
+ /**
51
+ * Element to check for prefixes on.
52
+ */
53
+ var style = {};
54
+
55
+ /**
56
+ * Bootstrap if a DOM exists.
57
+ */
58
+ if (ExecutionEnvironment.canUseDOM) {
59
+ style = document.createElement('div').style;
60
+
61
+ // On some platforms, in particular some releases of Android 4.x,
62
+ // the un-prefixed "animation" and "transition" properties are defined on the
63
+ // style object but the events that fire will still be prefixed, so we need
64
+ // to check if the un-prefixed events are usable, and if not remove them from the map.
65
+ if (!('AnimationEvent' in window)) {
66
+ delete vendorPrefixes.animationend.animation;
67
+ delete vendorPrefixes.animationiteration.animation;
68
+ delete vendorPrefixes.animationstart.animation;
69
+ }
70
+
71
+ // Same as above
72
+ if (!('TransitionEvent' in window)) {
73
+ delete vendorPrefixes.transitionend.transition;
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Attempts to determine the correct vendor prefixed event name.
79
+ *
80
+ * @param {string} eventName
81
+ * @returns {string}
82
+ */
83
+ function getVendorPrefixedEventName(eventName) {
84
+ if (prefixedEventNames[eventName]) {
85
+ return prefixedEventNames[eventName];
86
+ } else if (!vendorPrefixes[eventName]) {
87
+ return eventName;
88
+ }
89
+
90
+ var prefixMap = vendorPrefixes[eventName];
91
+
92
+ for (var styleProp in prefixMap) {
93
+ if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
94
+ return prefixedEventNames[eventName] = prefixMap[styleProp];
95
+ }
96
+ }
97
+
98
+ return '';
99
+ }
100
+
101
+ module.exports = getVendorPrefixedEventName;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013-2015, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
3
  * All rights reserved.
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
@@ -7,22 +7,24 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule instantiateReactComponent
10
- * @typechecks static-only
11
10
  */
12
11
 
13
12
  'use strict';
14
13
 
14
+ var _assign = require('object-assign');
15
+
15
16
  var ReactCompositeComponent = require('./ReactCompositeComponent');
16
17
  var ReactEmptyComponent = require('./ReactEmptyComponent');
17
18
  var ReactNativeComponent = require('./ReactNativeComponent');
18
19
 
19
- var assign = require('./Object.assign');
20
20
  var invariant = require('fbjs/lib/invariant');
21
21
  var warning = require('fbjs/lib/warning');
22
22
 
23
23
  // To avoid a cyclic dependency, we create the final class in this module
24
- var ReactCompositeComponentWrapper = function () {};
25
- assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
24
+ var ReactCompositeComponentWrapper = function (element) {
25
+ this.construct(element);
26
+ };
27
+ _assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
26
28
  _instantiateReactComponent: instantiateReactComponent
27
29
  });
28
30
 
@@ -58,10 +60,10 @@ function instantiateReactComponent(node) {
58
60
  var instance;
59
61
 
60
62
  if (node === null || node === false) {
61
- instance = new ReactEmptyComponent(instantiateReactComponent);
63
+ instance = ReactEmptyComponent.create(instantiateReactComponent);
62
64
  } else if (typeof node === 'object') {
63
65
  var element = node;
64
- !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
66
+ !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : void 0;
65
67
 
66
68
  // Special case string values
67
69
  if (typeof element.type === 'string') {
@@ -72,21 +74,18 @@ function instantiateReactComponent(node) {
72
74
  // representation, we can drop this code path.
73
75
  instance = new element.type(element);
74
76
  } else {
75
- instance = new ReactCompositeComponentWrapper();
77
+ instance = new ReactCompositeComponentWrapper(element);
76
78
  }
77
79
  } else if (typeof node === 'string' || typeof node === 'number') {
78
80
  instance = ReactNativeComponent.createInstanceForText(node);
79
81
  } else {
80
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
82
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : void 0;
81
83
  }
82
84
 
83
85
  if (process.env.NODE_ENV !== 'production') {
84
- process.env.NODE_ENV !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
86
+ process.env.NODE_ENV !== 'production' ? warning(typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.getNativeNode === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : void 0;
85
87
  }
86
88
 
87
- // Sets up the instance. This can probably just move into the constructor now.
88
- instance.construct(node);
89
-
90
89
  // These two fields are used by the DOM and ART diffing algorithms
91
90
  // respectively. Instead of using expandos on components, we should be
92
91
  // storing the state needed by the diffing algorithms elsewhere.