react 0.8.0 → 0.10.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 (160) hide show
  1. package/README.md +0 -8
  2. package/addons.js +0 -3
  3. package/lib/AutoFocusMixin.js +32 -0
  4. package/lib/CSSCore.js +23 -22
  5. package/lib/CSSProperty.js +32 -1
  6. package/lib/CSSPropertyOperations.js +1 -1
  7. package/lib/ChangeEventPlugin.js +27 -5
  8. package/lib/ClientReactRootIndex.js +30 -0
  9. package/lib/CompositionEventPlugin.js +58 -10
  10. package/lib/DOMChildrenOperations.js +39 -3
  11. package/lib/DOMProperty.js +9 -5
  12. package/lib/DOMPropertyOperations.js +21 -8
  13. package/lib/Danger.js +9 -8
  14. package/lib/DefaultDOMPropertyConfig.js +23 -14
  15. package/lib/DefaultEventPluginOrder.js +1 -1
  16. package/lib/EnterLeaveEventPlugin.js +38 -5
  17. package/lib/EventConstants.js +4 -1
  18. package/lib/EventListener.js +42 -34
  19. package/lib/EventPluginHub.js +118 -13
  20. package/lib/EventPluginRegistry.js +62 -18
  21. package/lib/EventPluginUtils.js +33 -4
  22. package/lib/EventPropagators.js +7 -43
  23. package/lib/ExecutionEnvironment.js +4 -1
  24. package/lib/LinkedStateMixin.js +1 -1
  25. package/lib/LinkedValueUtils.js +160 -0
  26. package/lib/MobileSafariClickEventPlugin.js +1 -1
  27. package/lib/PooledClass.js +7 -1
  28. package/lib/React.js +30 -4
  29. package/lib/ReactBrowserComponentMixin.js +42 -0
  30. package/lib/ReactCSSTransitionGroup.js +65 -0
  31. package/lib/{ReactTransitionableChild.js → ReactCSSTransitionGroupChild.js} +22 -36
  32. package/lib/ReactChildren.js +4 -4
  33. package/lib/ReactComponent.js +163 -83
  34. package/lib/ReactComponentBrowserEnvironment.js +55 -71
  35. package/lib/ReactCompositeComponent.js +686 -119
  36. package/lib/ReactContext.js +67 -0
  37. package/lib/ReactCurrentOwner.js +1 -1
  38. package/lib/ReactDOM.js +19 -6
  39. package/lib/ReactDOMButton.js +6 -1
  40. package/lib/ReactDOMComponent.js +66 -24
  41. package/lib/ReactDOMForm.js +13 -3
  42. package/lib/ReactDOMIDOperations.js +106 -61
  43. package/lib/ReactDOMImg.js +61 -0
  44. package/lib/ReactDOMInput.js +28 -15
  45. package/lib/ReactDOMOption.js +13 -8
  46. package/lib/ReactDOMSelect.js +38 -18
  47. package/lib/ReactDOMSelection.js +1 -1
  48. package/lib/ReactDOMTextarea.js +19 -11
  49. package/lib/ReactDefaultBatchingStrategy.js +1 -1
  50. package/lib/ReactDefaultInjection.js +60 -26
  51. package/lib/ReactDefaultPerf.js +208 -371
  52. package/lib/ReactDefaultPerfAnalysis.js +199 -0
  53. package/lib/ReactErrorUtils.js +6 -15
  54. package/lib/ReactEventEmitter.js +144 -146
  55. package/lib/ReactEventEmitterMixin.js +1 -33
  56. package/lib/ReactEventTopLevelCallback.js +75 -15
  57. package/lib/ReactInjection.js +43 -0
  58. package/lib/ReactInputSelection.js +3 -2
  59. package/lib/ReactInstanceHandles.js +36 -20
  60. package/lib/ReactLink.js +2 -2
  61. package/lib/ReactMarkupChecksum.js +1 -1
  62. package/lib/ReactMount.js +136 -104
  63. package/lib/ReactMountReady.js +2 -2
  64. package/lib/ReactMultiChild.js +40 -49
  65. package/lib/ReactMultiChildUpdateTypes.js +3 -1
  66. package/lib/ReactOwner.js +17 -4
  67. package/lib/ReactPerf.js +6 -9
  68. package/lib/ReactPropTransferer.js +41 -22
  69. package/lib/ReactPropTypeLocationNames.js +31 -0
  70. package/lib/{ReactComponentEnvironment.js → ReactPropTypeLocations.js} +11 -6
  71. package/lib/ReactPropTypes.js +249 -48
  72. package/lib/ReactPutListenerQueue.js +61 -0
  73. package/lib/ReactReconcileTransaction.js +28 -7
  74. package/lib/ReactRootIndex.js +36 -0
  75. package/lib/ReactServerRendering.js +46 -19
  76. package/lib/ReactServerRenderingTransaction.js +116 -0
  77. package/lib/ReactStateSetters.js +1 -1
  78. package/lib/ReactTestUtils.js +394 -0
  79. package/lib/ReactTextComponent.js +33 -6
  80. package/lib/{ReactTransitionKeySet.js → ReactTransitionChildMapping.js} +43 -48
  81. package/lib/ReactTransitionEvents.js +1 -1
  82. package/lib/ReactTransitionGroup.js +133 -58
  83. package/lib/ReactUpdates.js +15 -12
  84. package/lib/ReactWithAddons.js +15 -3
  85. package/lib/SelectEventPlugin.js +23 -40
  86. package/lib/ServerReactRootIndex.js +36 -0
  87. package/lib/SimpleEventPlugin.js +55 -7
  88. package/lib/SyntheticClipboardEvent.js +8 -2
  89. package/lib/SyntheticCompositionEvent.js +1 -1
  90. package/lib/SyntheticDragEvent.js +44 -0
  91. package/lib/SyntheticEvent.js +3 -2
  92. package/lib/SyntheticFocusEvent.js +1 -1
  93. package/lib/SyntheticKeyboardEvent.js +5 -3
  94. package/lib/SyntheticMouseEvent.js +1 -1
  95. package/lib/SyntheticTouchEvent.js +1 -1
  96. package/lib/SyntheticUIEvent.js +1 -1
  97. package/lib/SyntheticWheelEvent.js +11 -8
  98. package/lib/Transaction.js +62 -37
  99. package/lib/ViewportMetrics.js +1 -1
  100. package/lib/accumulate.js +1 -1
  101. package/lib/adler32.js +1 -1
  102. package/lib/cloneWithProps.js +59 -0
  103. package/lib/containsNode.js +1 -1
  104. package/lib/copyProperties.js +1 -1
  105. package/lib/createArrayFrom.js +11 -14
  106. package/lib/createFullPageComponent.js +63 -0
  107. package/lib/createNodesFromMarkup.js +1 -1
  108. package/lib/createObjectFrom.js +1 -1
  109. package/lib/cx.js +3 -3
  110. package/lib/dangerousStyleValue.js +1 -1
  111. package/lib/emptyFunction.js +1 -1
  112. package/lib/emptyObject.js +27 -0
  113. package/lib/escapeTextForBrowser.js +1 -1
  114. package/lib/flattenChildren.js +6 -3
  115. package/lib/focusNode.js +33 -0
  116. package/lib/forEachAccumulated.js +1 -1
  117. package/lib/getActiveElement.js +5 -4
  118. package/lib/getEventKey.js +85 -0
  119. package/lib/getEventTarget.js +1 -1
  120. package/lib/getMarkupWrap.js +11 -1
  121. package/lib/getNodeForCharacterOffset.js +1 -1
  122. package/lib/getReactRootElementInContainer.js +1 -1
  123. package/lib/getTextContentAccessor.js +6 -4
  124. package/lib/getUnboundedScrollPosition.js +3 -3
  125. package/lib/hyphenate.js +1 -1
  126. package/lib/instantiateReactComponent.js +70 -0
  127. package/lib/invariant.js +20 -12
  128. package/lib/isEventSupported.js +8 -12
  129. package/lib/isNode.js +2 -2
  130. package/lib/isTextInputElement.js +1 -1
  131. package/lib/isTextNode.js +1 -1
  132. package/lib/joinClasses.js +1 -1
  133. package/lib/keyMirror.js +1 -1
  134. package/lib/keyOf.js +1 -1
  135. package/lib/memoizeStringOnly.js +1 -1
  136. package/lib/merge.js +1 -1
  137. package/lib/mergeHelpers.js +6 -7
  138. package/lib/mergeInto.js +1 -1
  139. package/lib/mixInto.js +1 -1
  140. package/lib/monitorCodeUse.js +37 -0
  141. package/lib/objMap.js +1 -1
  142. package/lib/objMapKeyVal.js +1 -1
  143. package/lib/onlyChild.js +43 -0
  144. package/lib/performanceNow.js +1 -1
  145. package/lib/shallowEqual.js +1 -1
  146. package/lib/shouldUpdateReactComponent.js +61 -0
  147. package/lib/toArray.js +75 -0
  148. package/lib/traverseAllChildren.js +72 -9
  149. package/lib/update.js +159 -0
  150. package/lib/warning.js +48 -0
  151. package/package.json +3 -3
  152. package/react.js +0 -3
  153. package/ReactJSErrors.js +0 -40
  154. package/lib/$.js +0 -46
  155. package/lib/CallbackRegistry.js +0 -91
  156. package/lib/LinkedValueMixin.js +0 -68
  157. package/lib/ex.js +0 -49
  158. package/lib/filterAttributes.js +0 -45
  159. package/lib/ge.js +0 -76
  160. package/lib/mutateHTMLNodeWithMarkup.js +0 -100
package/lib/toArray.js ADDED
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Copyright 2014 Facebook, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * @providesModule toArray
17
+ * @typechecks
18
+ */
19
+
20
+ var invariant = require("./invariant");
21
+
22
+ /**
23
+ * Convert array-like objects to arrays.
24
+ *
25
+ * This API assumes the caller knows the contents of the data type. For less
26
+ * well defined inputs use createArrayFrom.
27
+ *
28
+ * @param {object|function} obj
29
+ * @return {array}
30
+ */
31
+ function toArray(obj) {
32
+ var length = obj.length;
33
+
34
+ // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
35
+ // old versions of Safari).
36
+ ("production" !== process.env.NODE_ENV ? invariant(
37
+ !Array.isArray(obj) &&
38
+ (typeof obj === 'object' || typeof obj === 'function'),
39
+ 'toArray: Array-like object expected'
40
+ ) : invariant(!Array.isArray(obj) &&
41
+ (typeof obj === 'object' || typeof obj === 'function')));
42
+
43
+ ("production" !== process.env.NODE_ENV ? invariant(
44
+ typeof length === 'number',
45
+ 'toArray: Object needs a length property'
46
+ ) : invariant(typeof length === 'number'));
47
+
48
+ ("production" !== process.env.NODE_ENV ? invariant(
49
+ length === 0 ||
50
+ (length - 1) in obj,
51
+ 'toArray: Object should have keys for indices'
52
+ ) : invariant(length === 0 ||
53
+ (length - 1) in obj));
54
+
55
+ // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
56
+ // without method will throw during the slice call and skip straight to the
57
+ // fallback.
58
+ if (obj.hasOwnProperty) {
59
+ try {
60
+ return Array.prototype.slice.call(obj);
61
+ } catch (e) {
62
+ // IE < 9 does not support Array#slice on collections objects
63
+ }
64
+ }
65
+
66
+ // Fall back to copying key by key. This assumes all keys have a value,
67
+ // so will not preserve sparsely populated inputs.
68
+ var ret = Array(length);
69
+ for (var ii = 0; ii < length; ii++) {
70
+ ret[ii] = obj[ii];
71
+ }
72
+ return ret;
73
+ }
74
+
75
+ module.exports = toArray;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2013 Facebook, Inc.
2
+ * Copyright 2013-2014 Facebook, Inc.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -18,11 +18,14 @@
18
18
 
19
19
  "use strict";
20
20
 
21
- var ReactComponent = require("./ReactComponent");
21
+ var ReactInstanceHandles = require("./ReactInstanceHandles");
22
22
  var ReactTextComponent = require("./ReactTextComponent");
23
23
 
24
24
  var invariant = require("./invariant");
25
25
 
26
+ var SEPARATOR = ReactInstanceHandles.SEPARATOR;
27
+ var SUBSEPARATOR = ':';
28
+
26
29
  /**
27
30
  * TODO: Test that:
28
31
  * 1. `mapChildren` transforms strings and numbers into `ReactTextComponent`.
@@ -31,6 +34,58 @@ var invariant = require("./invariant");
31
34
  * });
32
35
  */
33
36
 
37
+ var userProvidedKeyEscaperLookup = {
38
+ '=': '=0',
39
+ '.': '=1',
40
+ ':': '=2'
41
+ };
42
+
43
+ var userProvidedKeyEscapeRegex = /[=.:]/g;
44
+
45
+ function userProvidedKeyEscaper(match) {
46
+ return userProvidedKeyEscaperLookup[match];
47
+ }
48
+
49
+ /**
50
+ * Generate a key string that identifies a component within a set.
51
+ *
52
+ * @param {*} component A component that could contain a manual key.
53
+ * @param {number} index Index that is used if a manual key is not provided.
54
+ * @return {string}
55
+ */
56
+ function getComponentKey(component, index) {
57
+ if (component && component.props && component.props.key != null) {
58
+ // Explicit key
59
+ return wrapUserProvidedKey(component.props.key);
60
+ }
61
+ // Implicit key determined by the index in the set
62
+ return index.toString(36);
63
+ }
64
+
65
+ /**
66
+ * Escape a component key so that it is safe to use in a reactid.
67
+ *
68
+ * @param {*} key Component key to be escaped.
69
+ * @return {string} An escaped string.
70
+ */
71
+ function escapeUserProvidedKey(text) {
72
+ return ('' + text).replace(
73
+ userProvidedKeyEscapeRegex,
74
+ userProvidedKeyEscaper
75
+ );
76
+ }
77
+
78
+ /**
79
+ * Wrap a `key` value explicitly provided by the user to distinguish it from
80
+ * implicitly-generated keys generated by a component's index in its parent.
81
+ *
82
+ * @param {string} key Value of a user-provided `key` attribute
83
+ * @return {string}
84
+ */
85
+ function wrapUserProvidedKey(key) {
86
+ return '$' + escapeUserProvidedKey(key);
87
+ }
88
+
34
89
  /**
35
90
  * @param {?*} children Children tree container.
36
91
  * @param {!string} nameSoFar Name of the key path so far.
@@ -46,7 +101,11 @@ var traverseAllChildrenImpl =
46
101
  if (Array.isArray(children)) {
47
102
  for (var i = 0; i < children.length; i++) {
48
103
  var child = children[i];
49
- var nextName = nameSoFar + ReactComponent.getKey(child, i);
104
+ var nextName = (
105
+ nameSoFar +
106
+ (nameSoFar ? SUBSEPARATOR : SEPARATOR) +
107
+ getComponentKey(child, i)
108
+ );
50
109
  var nextIndex = indexSoFar + subtreeCount;
51
110
  subtreeCount += traverseAllChildrenImpl(
52
111
  child,
@@ -61,14 +120,14 @@ var traverseAllChildrenImpl =
61
120
  var isOnlyChild = nameSoFar === '';
62
121
  // If it's the only child, treat the name as if it was wrapped in an array
63
122
  // so that it's consistent if the number of children grows
64
- var storageName = isOnlyChild ?
65
- ReactComponent.getKey(children, 0):
66
- nameSoFar;
67
- if (children === null || children === undefined || type === 'boolean') {
123
+ var storageName =
124
+ isOnlyChild ? SEPARATOR + getComponentKey(children, 0) : nameSoFar;
125
+ if (children == null || type === 'boolean') {
68
126
  // All of the above are perceived as null.
69
127
  callback(traverseContext, null, storageName, indexSoFar);
70
128
  subtreeCount = 1;
71
- } else if (children.mountComponentIntoNode) {
129
+ } else if (children.type && children.type.prototype &&
130
+ children.type.prototype.mountComponentIntoNode) {
72
131
  callback(traverseContext, children, storageName, indexSoFar);
73
132
  subtreeCount = 1;
74
133
  } else {
@@ -82,7 +141,11 @@ var traverseAllChildrenImpl =
82
141
  if (children.hasOwnProperty(key)) {
83
142
  subtreeCount += traverseAllChildrenImpl(
84
143
  children[key],
85
- nameSoFar + '{' + key + '}',
144
+ (
145
+ nameSoFar + (nameSoFar ? SUBSEPARATOR : SEPARATOR) +
146
+ wrapUserProvidedKey(key) + SUBSEPARATOR +
147
+ getComponentKey(children[key], 0)
148
+ ),
86
149
  indexSoFar + subtreeCount,
87
150
  callback,
88
151
  traverseContext
package/lib/update.js ADDED
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Copyright 2013-2014 Facebook, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * @providesModule update
17
+ */
18
+
19
+ "use strict";
20
+
21
+ var copyProperties = require("./copyProperties");
22
+ var keyOf = require("./keyOf");
23
+ var invariant = require("./invariant");
24
+
25
+ function shallowCopy(x) {
26
+ if (Array.isArray(x)) {
27
+ return x.concat();
28
+ } else if (x && typeof x === 'object') {
29
+ return copyProperties(new x.constructor(), x);
30
+ } else {
31
+ return x;
32
+ }
33
+ }
34
+
35
+ var DIRECTIVE_PUSH = keyOf({$push: null});
36
+ var DIRECTIVE_UNSHIFT = keyOf({$unshift: null});
37
+ var DIRECTIVE_SPLICE = keyOf({$splice: null});
38
+ var DIRECTIVE_SET = keyOf({$set: null});
39
+ var DIRECTIVE_MERGE = keyOf({$merge: null});
40
+
41
+ var ALL_DIRECTIVES_LIST = [
42
+ DIRECTIVE_PUSH,
43
+ DIRECTIVE_UNSHIFT,
44
+ DIRECTIVE_SPLICE,
45
+ DIRECTIVE_SET,
46
+ DIRECTIVE_MERGE
47
+ ];
48
+
49
+ var ALL_DIRECTIVES_SET = {};
50
+
51
+ ALL_DIRECTIVES_LIST.forEach(function(directive) {
52
+ ALL_DIRECTIVES_SET[directive] = true;
53
+ });
54
+
55
+ function invariantArrayCase(value, spec, directive) {
56
+ ("production" !== process.env.NODE_ENV ? invariant(
57
+ Array.isArray(value),
58
+ 'update(): expected target of %s to be an array; got %s.',
59
+ directive,
60
+ value
61
+ ) : invariant(Array.isArray(value)));
62
+ var specValue = spec[directive];
63
+ ("production" !== process.env.NODE_ENV ? invariant(
64
+ Array.isArray(specValue),
65
+ 'update(): expected spec of %s to be an array; got %s. ' +
66
+ 'Did you forget to wrap your parameter in an array?',
67
+ directive,
68
+ specValue
69
+ ) : invariant(Array.isArray(specValue)));
70
+ }
71
+
72
+ function update(value, spec) {
73
+ ("production" !== process.env.NODE_ENV ? invariant(
74
+ typeof spec === 'object',
75
+ 'update(): You provided a key path to update() that did not contain one ' +
76
+ 'of %s. Did you forget to include {%s: ...}?',
77
+ ALL_DIRECTIVES_LIST.join(', '),
78
+ DIRECTIVE_SET
79
+ ) : invariant(typeof spec === 'object'));
80
+
81
+ if (spec.hasOwnProperty(DIRECTIVE_SET)) {
82
+ ("production" !== process.env.NODE_ENV ? invariant(
83
+ Object.keys(spec).length === 1,
84
+ 'Cannot have more than one key in an object with %s',
85
+ DIRECTIVE_SET
86
+ ) : invariant(Object.keys(spec).length === 1));
87
+
88
+ return spec[DIRECTIVE_SET];
89
+ }
90
+
91
+ var nextValue = shallowCopy(value);
92
+
93
+ if (spec.hasOwnProperty(DIRECTIVE_MERGE)) {
94
+ var mergeObj = spec[DIRECTIVE_MERGE];
95
+ ("production" !== process.env.NODE_ENV ? invariant(
96
+ mergeObj && typeof mergeObj === 'object',
97
+ 'update(): %s expects a spec of type \'object\'; got %s',
98
+ DIRECTIVE_MERGE,
99
+ mergeObj
100
+ ) : invariant(mergeObj && typeof mergeObj === 'object'));
101
+ ("production" !== process.env.NODE_ENV ? invariant(
102
+ nextValue && typeof nextValue === 'object',
103
+ 'update(): %s expects a target of type \'object\'; got %s',
104
+ DIRECTIVE_MERGE,
105
+ nextValue
106
+ ) : invariant(nextValue && typeof nextValue === 'object'));
107
+ copyProperties(nextValue, spec[DIRECTIVE_MERGE]);
108
+ }
109
+
110
+ if (spec.hasOwnProperty(DIRECTIVE_PUSH)) {
111
+ invariantArrayCase(value, spec, DIRECTIVE_PUSH);
112
+ spec[DIRECTIVE_PUSH].forEach(function(item) {
113
+ nextValue.push(item);
114
+ });
115
+ }
116
+
117
+ if (spec.hasOwnProperty(DIRECTIVE_UNSHIFT)) {
118
+ invariantArrayCase(value, spec, DIRECTIVE_UNSHIFT);
119
+ spec[DIRECTIVE_UNSHIFT].forEach(function(item) {
120
+ nextValue.unshift(item);
121
+ });
122
+ }
123
+
124
+ if (spec.hasOwnProperty(DIRECTIVE_SPLICE)) {
125
+ ("production" !== process.env.NODE_ENV ? invariant(
126
+ Array.isArray(value),
127
+ 'Expected %s target to be an array; got %s',
128
+ DIRECTIVE_SPLICE,
129
+ value
130
+ ) : invariant(Array.isArray(value)));
131
+ ("production" !== process.env.NODE_ENV ? invariant(
132
+ Array.isArray(spec[DIRECTIVE_SPLICE]),
133
+ 'update(): expected spec of %s to be an array of arrays; got %s. ' +
134
+ 'Did you forget to wrap your parameters in an array?',
135
+ DIRECTIVE_SPLICE,
136
+ spec[DIRECTIVE_SPLICE]
137
+ ) : invariant(Array.isArray(spec[DIRECTIVE_SPLICE])));
138
+ spec[DIRECTIVE_SPLICE].forEach(function(args) {
139
+ ("production" !== process.env.NODE_ENV ? invariant(
140
+ Array.isArray(args),
141
+ 'update(): expected spec of %s to be an array of arrays; got %s. ' +
142
+ 'Did you forget to wrap your parameters in an array?',
143
+ DIRECTIVE_SPLICE,
144
+ spec[DIRECTIVE_SPLICE]
145
+ ) : invariant(Array.isArray(args)));
146
+ nextValue.splice.apply(nextValue, args);
147
+ });
148
+ }
149
+
150
+ for (var k in spec) {
151
+ if (!ALL_DIRECTIVES_SET[k]) {
152
+ nextValue[k] = update(value[k], spec[k]);
153
+ }
154
+ }
155
+
156
+ return nextValue;
157
+ }
158
+
159
+ module.exports = update;
package/lib/warning.js ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright 2014 Facebook, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * @providesModule warning
17
+ */
18
+
19
+ "use strict";
20
+
21
+ var emptyFunction = require("./emptyFunction");
22
+
23
+ /**
24
+ * Similar to invariant but only logs a warning if the condition is not met.
25
+ * This can be used to log issues in development environments in critical
26
+ * paths. Removing the logging code for production environments will keep the
27
+ * same logic and follow the same code paths.
28
+ */
29
+
30
+ var warning = emptyFunction;
31
+
32
+ if ("production" !== process.env.NODE_ENV) {
33
+ warning = function(condition, format ) {var args=Array.prototype.slice.call(arguments,2);
34
+ if (format === undefined) {
35
+ throw new Error(
36
+ '`warning(condition, format, ...args)` requires a warning ' +
37
+ 'message argument'
38
+ );
39
+ }
40
+
41
+ if (!condition) {
42
+ var argIndex = 0;
43
+ console.warn('Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];}));
44
+ }
45
+ };
46
+ }
47
+
48
+ module.exports = warning;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "react",
3
- "version": "0.8.0",
3
+ "description": "React is a JavaScript library for building user interfaces.",
4
+ "version": "0.10.0",
4
5
  "keywords": [
5
6
  "react"
6
7
  ],
@@ -16,7 +17,6 @@
16
17
  "README.md",
17
18
  "addons.js",
18
19
  "react.js",
19
- "ReactJSErrors.js",
20
20
  "lib/"
21
21
  ],
22
22
  "main": "react.js",
@@ -28,7 +28,7 @@
28
28
  "node": ">=0.10.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "envify": "~0.2.0"
31
+ "envify": "~1.2.0"
32
32
  },
33
33
  "browserify": {
34
34
  "transform": [
package/react.js CHANGED
@@ -1,4 +1 @@
1
1
  module.exports = require('./lib/React');
2
- if ('production' !== process.env.NODE_ENV) {
3
- module.exports = require('./ReactJSErrors').wrap(module.exports);
4
- }
package/ReactJSErrors.js DELETED
@@ -1,40 +0,0 @@
1
- 'use strict';
2
-
3
- var copyProperties = require('./lib/copyProperties');
4
-
5
- var WARNING_MESSAGE = (
6
- 'It looks like you\'re trying to use jeffbski\'s React.js project.\n' +
7
- 'The `react` npm package now points to the React JavaScript library for ' +
8
- 'building user interfaces, not the React.js project for managing asynchronous ' +
9
- 'control flow. If you\'re looking for that library, please npm install autoflow.'
10
- );
11
-
12
- function error() {
13
- throw new Error(WARNING_MESSAGE);
14
- }
15
-
16
- // Model the React.js project's public interface exactly.
17
-
18
- function ReactJSShim() {
19
- error();
20
- }
21
-
22
- ReactJSShim.logEvents = error;
23
- ReactJSShim.resolvePromises = error;
24
- ReactJSShim.trackTasks = error;
25
- ReactJSShim.createEventCollector = error;
26
-
27
- // These could throw using defineProperty() but supporting older browsers will
28
- // be painful. Additionally any error messages around this will contain the string
29
- // so I think this is sufficient.
30
- ReactJSShim.options = WARNING_MESSAGE;
31
- ReactJSShim.events = WARNING_MESSAGE;
32
-
33
- var ReactJSErrors = {
34
- wrap: function(module) {
35
- copyProperties(ReactJSShim, module);
36
- return ReactJSShim;
37
- }
38
- };
39
-
40
- module.exports = ReactJSErrors;