react 0.13.2 → 0.14.0-alpha3

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 (197) hide show
  1. package/README.md +1 -1
  2. package/addons.js +7 -0
  3. package/addons/CSSTransitionGroup.js +1 -0
  4. package/addons/LinkedStateMixin.js +1 -0
  5. package/addons/Perf.js +1 -0
  6. package/addons/PureRenderMixin.js +1 -0
  7. package/addons/TestUtils.js +1 -0
  8. package/addons/TransitionGroup.js +1 -0
  9. package/addons/batchedUpdates.js +1 -0
  10. package/addons/cloneWithProps.js +1 -0
  11. package/addons/createFragment.js +1 -0
  12. package/addons/renderSubtreeIntoContainer.js +1 -0
  13. package/addons/shallowCompare.js +1 -0
  14. package/addons/update.js +1 -0
  15. package/dist/JSXTransformer.js +3355 -1685
  16. package/dist/react-with-addons.js +3320 -5133
  17. package/dist/react-with-addons.min.js +6 -7
  18. package/dist/react.js +2962 -4548
  19. package/dist/react.min.js +5 -5
  20. package/lib/AutoFocusMixin.js +4 -3
  21. package/lib/BeforeInputEventPlugin.js +30 -118
  22. package/lib/CSSCore.js +12 -23
  23. package/lib/CSSProperty.js +4 -3
  24. package/lib/CSSPropertyOperations.js +14 -30
  25. package/lib/CallbackQueue.js +7 -10
  26. package/lib/ChangeEventPlugin.js +24 -88
  27. package/lib/ClientReactRootIndex.js +2 -2
  28. package/lib/DOMChildrenOperations.js +13 -33
  29. package/lib/DOMProperty.js +41 -67
  30. package/lib/DOMPropertyOperations.js +30 -51
  31. package/lib/Danger.js +19 -62
  32. package/lib/DefaultEventPluginOrder.js +2 -12
  33. package/lib/EnterLeaveEventPlugin.js +11 -33
  34. package/lib/EventConstants.js +2 -2
  35. package/lib/EventListener.js +11 -13
  36. package/lib/EventPluginHub.js +44 -47
  37. package/lib/EventPluginRegistry.js +18 -74
  38. package/lib/EventPluginUtils.js +27 -38
  39. package/lib/EventPropagators.js +23 -26
  40. package/lib/ExecutionEnvironment.js +4 -8
  41. package/lib/FallbackCompositionState.js +3 -3
  42. package/lib/HTMLDOMPropertyConfig.js +7 -19
  43. package/lib/LinkedStateMixin.js +3 -6
  44. package/lib/LinkedValueUtils.js +34 -64
  45. package/lib/LocalEventTrapMixin.js +9 -16
  46. package/lib/Object.assign.js +1 -1
  47. package/lib/PooledClass.js +8 -11
  48. package/lib/React.js +9 -129
  49. package/lib/ReactBrowserComponentMixin.js +9 -2
  50. package/lib/ReactBrowserEventEmitter.js +26 -82
  51. package/lib/ReactCSSTransitionGroup.js +13 -24
  52. package/lib/ReactCSSTransitionGroupChild.js +18 -28
  53. package/lib/ReactChildReconciler.js +11 -19
  54. package/lib/ReactChildren.js +21 -28
  55. package/lib/ReactClass.js +81 -234
  56. package/lib/ReactComponent.js +17 -33
  57. package/lib/ReactComponentBrowserEnvironment.js +4 -8
  58. package/lib/ReactComponentEnvironment.js +6 -12
  59. package/lib/ReactComponentWithPureRenderMixin.js +4 -5
  60. package/lib/ReactCompositeComponent.js +87 -311
  61. package/lib/ReactContext.js +2 -44
  62. package/lib/ReactCurrentOwner.js +1 -3
  63. package/lib/ReactDOM.js +4 -2
  64. package/lib/ReactDOMButton.js +3 -4
  65. package/lib/ReactDOMClient.js +85 -0
  66. package/lib/ReactDOMComponent.js +182 -146
  67. package/lib/ReactDOMForm.js +3 -3
  68. package/lib/ReactDOMIDOperations.js +11 -22
  69. package/lib/ReactDOMIframe.js +3 -3
  70. package/lib/ReactDOMImg.js +3 -3
  71. package/lib/ReactDOMInput.js +22 -35
  72. package/lib/ReactDOMOption.js +67 -10
  73. package/lib/ReactDOMSelect.js +50 -28
  74. package/lib/ReactDOMSelection.js +5 -20
  75. package/lib/ReactDOMServer.js +24 -0
  76. package/lib/ReactDOMTextComponent.js +17 -18
  77. package/lib/ReactDOMTextarea.js +15 -27
  78. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  79. package/lib/ReactDefaultInjection.js +31 -40
  80. package/lib/ReactDefaultPerf.js +36 -69
  81. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  82. package/lib/ReactElement.js +24 -57
  83. package/lib/ReactElementValidator.js +38 -105
  84. package/lib/ReactEmptyComponent.js +7 -11
  85. package/lib/ReactErrorUtils.js +2 -2
  86. package/lib/ReactEventEmitterMixin.js +3 -12
  87. package/lib/ReactEventListener.js +16 -38
  88. package/lib/ReactFragment.js +23 -54
  89. package/lib/ReactInjection.js +1 -1
  90. package/lib/ReactInputSelection.js +11 -21
  91. package/lib/ReactInstanceHandles.js +27 -57
  92. package/lib/ReactInstanceMap.js +5 -5
  93. package/lib/ReactIsomorphic.js +70 -0
  94. package/lib/ReactLifeCycle.js +1 -1
  95. package/lib/ReactLink.js +2 -4
  96. package/lib/ReactMarkupChecksum.js +5 -10
  97. package/lib/ReactMount.js +137 -260
  98. package/lib/ReactMultiChild.js +19 -45
  99. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  100. package/lib/ReactNativeComponent.js +7 -11
  101. package/lib/ReactOwner.js +7 -24
  102. package/lib/ReactPerf.js +8 -12
  103. package/lib/ReactPropTransferer.js +4 -4
  104. package/lib/ReactPropTypeLocationNames.js +2 -2
  105. package/lib/ReactPropTypeLocations.js +1 -1
  106. package/lib/ReactPropTypes.js +41 -61
  107. package/lib/ReactReconcileTransaction.js +9 -34
  108. package/lib/ReactReconciler.js +9 -19
  109. package/lib/ReactRef.js +5 -8
  110. package/lib/ReactRootIndex.js +2 -2
  111. package/lib/ReactServerRendering.js +7 -15
  112. package/lib/ReactServerRenderingTransaction.js +7 -32
  113. package/lib/ReactStateSetters.js +6 -6
  114. package/lib/ReactTestUtils.js +93 -165
  115. package/lib/ReactTransitionChildMapping.js +5 -7
  116. package/lib/ReactTransitionEvents.js +5 -5
  117. package/lib/ReactTransitionGroup.js +30 -52
  118. package/lib/ReactUpdateQueue.js +27 -90
  119. package/lib/ReactUpdates.js +27 -79
  120. package/lib/ReactWithAddons.js +7 -6
  121. package/lib/SVGDOMPropertyConfig.js +41 -4
  122. package/lib/SelectEventPlugin.js +28 -29
  123. package/lib/ServerReactRootIndex.js +2 -2
  124. package/lib/SimpleEventPlugin.js +136 -128
  125. package/lib/SyntheticClipboardEvent.js +3 -7
  126. package/lib/SyntheticCompositionEvent.js +3 -9
  127. package/lib/SyntheticDragEvent.js +1 -1
  128. package/lib/SyntheticEvent.js +8 -10
  129. package/lib/SyntheticFocusEvent.js +1 -1
  130. package/lib/SyntheticInputEvent.js +3 -9
  131. package/lib/SyntheticKeyboardEvent.js +4 -4
  132. package/lib/SyntheticMouseEvent.js +8 -14
  133. package/lib/SyntheticTouchEvent.js +1 -1
  134. package/lib/SyntheticUIEvent.js +3 -3
  135. package/lib/SyntheticWheelEvent.js +11 -15
  136. package/lib/Transaction.js +12 -24
  137. package/lib/ViewportMetrics.js +2 -2
  138. package/lib/accumulateInto.js +2 -5
  139. package/lib/adler32.js +2 -4
  140. package/lib/camelize.js +4 -2
  141. package/lib/camelizeStyleName.js +2 -2
  142. package/lib/cloneWithProps.js +5 -11
  143. package/lib/containsNode.js +29 -16
  144. package/lib/createArrayFromMixed.js +17 -16
  145. package/lib/createFullPageComponent.js +4 -11
  146. package/lib/createNodesFromMarkup.js +6 -8
  147. package/lib/dangerousStyleValue.js +2 -3
  148. package/lib/emptyFunction.js +10 -4
  149. package/lib/emptyObject.js +1 -1
  150. package/lib/escapeTextContentForBrowser.js +1 -1
  151. package/lib/findDOMNode.js +5 -24
  152. package/lib/flattenChildren.js +4 -10
  153. package/lib/focusNode.js +2 -3
  154. package/lib/forEachAccumulated.js +2 -2
  155. package/lib/getActiveElement.js +4 -2
  156. package/lib/getEventCharCode.js +1 -1
  157. package/lib/getEventKey.js +1 -1
  158. package/lib/getEventModifierState.js +1 -1
  159. package/lib/getEventTarget.js +1 -1
  160. package/lib/getIteratorFn.js +2 -4
  161. package/lib/getMarkupWrap.js +7 -5
  162. package/lib/getNodeForCharacterOffset.js +1 -1
  163. package/lib/getTextContentAccessor.js +2 -4
  164. package/lib/getUnboundedScrollPosition.js +1 -1
  165. package/lib/hyphenate.js +3 -1
  166. package/lib/hyphenateStyleName.js +2 -2
  167. package/lib/instantiateReactComponent.js +14 -38
  168. package/lib/invariant.js +8 -12
  169. package/lib/isEventSupported.js +7 -10
  170. package/lib/isNode.js +4 -6
  171. package/lib/isTextInputElement.js +2 -4
  172. package/lib/isTextNode.js +3 -1
  173. package/lib/joinClasses.js +2 -2
  174. package/lib/keyMirror.js +3 -6
  175. package/lib/keyOf.js +4 -3
  176. package/lib/mapObject.js +1 -1
  177. package/lib/memoizeStringOnly.js +2 -2
  178. package/lib/onlyChild.js +2 -5
  179. package/lib/performance.js +2 -5
  180. package/lib/performanceNow.js +3 -1
  181. package/lib/quoteAttributeValueForBrowser.js +1 -1
  182. package/lib/renderSubtreeIntoContainer.js +16 -0
  183. package/lib/setInnerHTML.js +11 -8
  184. package/lib/setTextContent.js +3 -3
  185. package/lib/shallowCompare.js +24 -0
  186. package/lib/shallowEqual.js +17 -11
  187. package/lib/shouldUpdateReactComponent.js +3 -64
  188. package/lib/toArray.js +8 -19
  189. package/lib/traverseAllChildren.js +22 -89
  190. package/lib/update.js +25 -85
  191. package/lib/validateDOMNesting.js +363 -0
  192. package/lib/warning.js +17 -15
  193. package/package.json +3 -3
  194. package/lib/MobileSafariClickEventPlugin.js +0 -56
  195. package/lib/ReactPutListenerQueue.js +0 -54
  196. package/lib/cx.js +0 -52
  197. package/lib/getReactRootElementInContainer.js +0 -33
package/lib/warning.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * @providesModule warning
10
10
  */
11
11
 
12
- "use strict";
12
+ 'use strict';
13
13
 
14
14
  var emptyFunction = require("./emptyFunction");
15
15
 
@@ -22,20 +22,18 @@ var emptyFunction = require("./emptyFunction");
22
22
 
23
23
  var warning = emptyFunction;
24
24
 
25
- if ("production" !== process.env.NODE_ENV) {
26
- warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
25
+ if ('production' !== process.env.NODE_ENV) {
26
+ warning = function (condition, format) {
27
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
28
+ args[_key - 2] = arguments[_key];
29
+ }
30
+
27
31
  if (format === undefined) {
28
- throw new Error(
29
- '`warning(condition, format, ...args)` requires a warning ' +
30
- 'message argument'
31
- );
32
+ throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
32
33
  }
33
34
 
34
35
  if (format.length < 10 || /^[s\W]*$/.test(format)) {
35
- throw new Error(
36
- 'The warning format should be able to uniquely identify this ' +
37
- 'warning. Please, use a more descriptive format than: ' + format
38
- );
36
+ throw new Error('The warning format should be able to uniquely identify this ' + 'warning. Please, use a more descriptive format than: ' + format);
39
37
  }
40
38
 
41
39
  if (format.indexOf('Failed Composite propType: ') === 0) {
@@ -44,16 +42,20 @@ if ("production" !== process.env.NODE_ENV) {
44
42
 
45
43
  if (!condition) {
46
44
  var argIndex = 0;
47
- var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
48
- console.warn(message);
45
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
46
+ return args[argIndex++];
47
+ });
48
+ if (typeof console !== 'undefined') {
49
+ console.error(message);
50
+ }
49
51
  try {
50
52
  // --- Welcome to debugging React ---
51
53
  // This error was thrown as a convenience so that you can use this stack
52
54
  // to find the callsite that caused this warning to fire.
53
55
  throw new Error(message);
54
- } catch(x) {}
56
+ } catch (x) {}
55
57
  }
56
58
  };
57
59
  }
58
60
 
59
- module.exports = warning;
61
+ module.exports = warning;
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "react",
3
3
  "description": "React is a JavaScript library for building user interfaces.",
4
- "version": "0.13.2",
4
+ "version": "0.14.0-alpha3",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],
8
8
  "homepage": "https://github.com/facebook/react/tree/master/npm-react",
9
- "bugs": "https://github.com/facebook/react/issues?labels=react-core",
9
+ "bugs": "https://github.com/facebook/react/issues",
10
10
  "license": "BSD-3-Clause",
11
11
  "files": [
12
- "README.md",
13
12
  "addons.js",
14
13
  "react.js",
14
+ "addons/",
15
15
  "dist/",
16
16
  "lib/"
17
17
  ],
@@ -1,56 +0,0 @@
1
- /**
2
- * Copyright 2013-2015, 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 MobileSafariClickEventPlugin
10
- * @typechecks static-only
11
- */
12
-
13
- 'use strict';
14
-
15
- var EventConstants = require("./EventConstants");
16
-
17
- var emptyFunction = require("./emptyFunction");
18
-
19
- var topLevelTypes = EventConstants.topLevelTypes;
20
-
21
- /**
22
- * Mobile Safari does not fire properly bubble click events on non-interactive
23
- * elements, which means delegated click listeners do not fire. The workaround
24
- * for this bug involves attaching an empty click listener on the target node.
25
- *
26
- * This particular plugin works around the bug by attaching an empty click
27
- * listener on `touchstart` (which does fire on every element).
28
- */
29
- var MobileSafariClickEventPlugin = {
30
-
31
- eventTypes: null,
32
-
33
- /**
34
- * @param {string} topLevelType Record from `EventConstants`.
35
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
36
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
37
- * @param {object} nativeEvent Native browser event.
38
- * @return {*} An accumulation of synthetic events.
39
- * @see {EventPluginHub.extractEvents}
40
- */
41
- extractEvents: function(
42
- topLevelType,
43
- topLevelTarget,
44
- topLevelTargetID,
45
- nativeEvent) {
46
- if (topLevelType === topLevelTypes.topTouchStart) {
47
- var target = nativeEvent.target;
48
- if (target && !target.onclick) {
49
- target.onclick = emptyFunction;
50
- }
51
- }
52
- }
53
-
54
- };
55
-
56
- module.exports = MobileSafariClickEventPlugin;
@@ -1,54 +0,0 @@
1
- /**
2
- * Copyright 2013-2015, 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 ReactPutListenerQueue
10
- */
11
-
12
- 'use strict';
13
-
14
- var PooledClass = require("./PooledClass");
15
- var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
16
-
17
- var assign = require("./Object.assign");
18
-
19
- function ReactPutListenerQueue() {
20
- this.listenersToPut = [];
21
- }
22
-
23
- assign(ReactPutListenerQueue.prototype, {
24
- enqueuePutListener: function(rootNodeID, propKey, propValue) {
25
- this.listenersToPut.push({
26
- rootNodeID: rootNodeID,
27
- propKey: propKey,
28
- propValue: propValue
29
- });
30
- },
31
-
32
- putListeners: function() {
33
- for (var i = 0; i < this.listenersToPut.length; i++) {
34
- var listenerToPut = this.listenersToPut[i];
35
- ReactBrowserEventEmitter.putListener(
36
- listenerToPut.rootNodeID,
37
- listenerToPut.propKey,
38
- listenerToPut.propValue
39
- );
40
- }
41
- },
42
-
43
- reset: function() {
44
- this.listenersToPut.length = 0;
45
- },
46
-
47
- destructor: function() {
48
- this.reset();
49
- }
50
- });
51
-
52
- PooledClass.addPoolingTo(ReactPutListenerQueue);
53
-
54
- module.exports = ReactPutListenerQueue;
package/lib/cx.js DELETED
@@ -1,52 +0,0 @@
1
- /**
2
- * Copyright 2013-2015, 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 cx
10
- */
11
-
12
- /**
13
- * This function is used to mark string literals representing CSS class names
14
- * so that they can be transformed statically. This allows for modularization
15
- * and minification of CSS class names.
16
- *
17
- * In static_upstream, this function is actually implemented, but it should
18
- * eventually be replaced with something more descriptive, and the transform
19
- * that is used in the main stack should be ported for use elsewhere.
20
- *
21
- * @param string|object className to modularize, or an object of key/values.
22
- * In the object case, the values are conditions that
23
- * determine if the className keys should be included.
24
- * @param [string ...] Variable list of classNames in the string case.
25
- * @return string Renderable space-separated CSS className.
26
- */
27
-
28
- 'use strict';
29
- var warning = require("./warning");
30
-
31
- var warned = false;
32
-
33
- function cx(classNames) {
34
- if ("production" !== process.env.NODE_ENV) {
35
- ("production" !== process.env.NODE_ENV ? warning(
36
- warned,
37
- 'React.addons.classSet will be deprecated in a future version. See ' +
38
- 'http://fb.me/react-addons-classset'
39
- ) : null);
40
- warned = true;
41
- }
42
-
43
- if (typeof classNames == 'object') {
44
- return Object.keys(classNames).filter(function(className) {
45
- return classNames[className];
46
- }).join(' ');
47
- } else {
48
- return Array.prototype.join.call(arguments, ' ');
49
- }
50
- }
51
-
52
- module.exports = cx;
@@ -1,33 +0,0 @@
1
- /**
2
- * Copyright 2013-2015, 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 getReactRootElementInContainer
10
- */
11
-
12
- 'use strict';
13
-
14
- var DOC_NODE_TYPE = 9;
15
-
16
- /**
17
- * @param {DOMElement|DOMDocument} container DOM element that may contain
18
- * a React component
19
- * @return {?*} DOM element that may have the reactRoot ID, or null.
20
- */
21
- function getReactRootElementInContainer(container) {
22
- if (!container) {
23
- return null;
24
- }
25
-
26
- if (container.nodeType === DOC_NODE_TYPE) {
27
- return container.documentElement;
28
- } else {
29
- return container.firstChild;
30
- }
31
- }
32
-
33
- module.exports = getReactRootElementInContainer;