react 0.12.2 → 0.13.0-alpha.1

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 (77) hide show
  1. package/dist/JSXTransformer.js +6 -4
  2. package/dist/react-with-addons.js +4022 -3267
  3. package/dist/react-with-addons.min.js +6 -6
  4. package/dist/react.js +3853 -3358
  5. package/dist/react.min.js +6 -6
  6. package/lib/BeforeInputEventPlugin.js +388 -111
  7. package/lib/CSSPropertyOperations.js +20 -0
  8. package/lib/ChangeEventPlugin.js +2 -2
  9. package/lib/Danger.js +1 -1
  10. package/lib/DefaultEventPluginOrder.js +0 -1
  11. package/lib/ExecutionEnvironment.js +2 -3
  12. package/lib/FallbackCompositionState.js +87 -0
  13. package/lib/HTMLDOMPropertyConfig.js +1 -0
  14. package/lib/Object.assign.js +3 -1
  15. package/lib/React.js +14 -49
  16. package/lib/ReactBrowserComponentMixin.js +2 -12
  17. package/lib/ReactBrowserEventEmitter.js +2 -4
  18. package/lib/ReactCSSTransitionGroup.js +3 -0
  19. package/lib/ReactCSSTransitionGroupChild.js +8 -0
  20. package/lib/ReactChildReconciler.js +121 -0
  21. package/lib/ReactClass.js +916 -0
  22. package/lib/ReactComponent.js +36 -286
  23. package/lib/ReactComponentBrowserEnvironment.js +9 -82
  24. package/lib/ReactComponentEnvironment.js +57 -0
  25. package/lib/ReactCompositeComponent.js +608 -1026
  26. package/lib/ReactContext.js +5 -1
  27. package/lib/ReactDOM.js +2 -7
  28. package/lib/ReactDOMButton.js +4 -5
  29. package/lib/ReactDOMComponent.js +97 -69
  30. package/lib/ReactDOMForm.js +4 -5
  31. package/lib/ReactDOMIDOperations.js +55 -73
  32. package/lib/ReactDOMImg.js +3 -5
  33. package/lib/ReactDOMInput.js +4 -5
  34. package/lib/ReactDOMOption.js +4 -5
  35. package/lib/ReactDOMSelect.js +55 -63
  36. package/lib/ReactDOMSelection.js +5 -1
  37. package/lib/{ReactTextComponent.js → ReactDOMTextComponent.js} +54 -34
  38. package/lib/ReactDOMTextarea.js +4 -5
  39. package/lib/ReactDefaultInjection.js +13 -7
  40. package/lib/ReactDefaultPerf.js +6 -5
  41. package/lib/ReactDefaultPerfAnalysis.js +1 -1
  42. package/lib/ReactElement.js +17 -11
  43. package/lib/ReactElementValidator.js +74 -37
  44. package/lib/ReactEmptyComponent.js +17 -10
  45. package/lib/ReactInjection.js +6 -4
  46. package/lib/ReactInputSelection.js +2 -3
  47. package/lib/ReactInstanceMap.js +47 -0
  48. package/lib/ReactMount.js +193 -64
  49. package/lib/ReactMultiChild.js +32 -42
  50. package/lib/ReactNativeComponent.js +45 -8
  51. package/lib/ReactOwner.js +3 -47
  52. package/lib/ReactPerf.js +20 -0
  53. package/lib/ReactPropTransferer.js +0 -55
  54. package/lib/ReactPropTypes.js +1 -17
  55. package/lib/ReactRef.js +96 -0
  56. package/lib/ReactServerRendering.js +3 -2
  57. package/lib/ReactTestUtils.js +82 -25
  58. package/lib/ReactTransitionGroup.js +47 -6
  59. package/lib/ReactUpdates.js +43 -42
  60. package/lib/SyntheticMouseEvent.js +1 -3
  61. package/lib/ViewportMetrics.js +1 -4
  62. package/lib/accumulate.js +47 -0
  63. package/lib/cloneWithProps.js +2 -2
  64. package/lib/copyProperties.js +2 -0
  65. package/lib/createFullPageComponent.js +2 -2
  66. package/lib/findDOMNode.js +52 -0
  67. package/lib/flattenChildren.js +1 -14
  68. package/lib/getIteratorFn.js +42 -0
  69. package/lib/instantiateReactComponent.js +88 -65
  70. package/lib/isNode.js +3 -4
  71. package/lib/isTextInputElement.js +1 -2
  72. package/lib/shouldUpdateReactComponent.js +13 -5
  73. package/lib/traverseAllChildren.js +110 -54
  74. package/package.json +1 -1
  75. package/lib/CompositionEventPlugin.js +0 -257
  76. package/lib/ReactLegacyElement.js +0 -243
  77. package/lib/deprecated.js +0 -47
@@ -1,243 +0,0 @@
1
- /**
2
- * Copyright 2014, 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 ReactLegacyElement
10
- */
11
-
12
- "use strict";
13
-
14
- var ReactCurrentOwner = require("./ReactCurrentOwner");
15
-
16
- var invariant = require("./invariant");
17
- var monitorCodeUse = require("./monitorCodeUse");
18
- var warning = require("./warning");
19
-
20
- var legacyFactoryLogs = {};
21
- function warnForLegacyFactoryCall() {
22
- if (!ReactLegacyElementFactory._isLegacyCallWarningEnabled) {
23
- return;
24
- }
25
- var owner = ReactCurrentOwner.current;
26
- var name = owner && owner.constructor ? owner.constructor.displayName : '';
27
- if (!name) {
28
- name = 'Something';
29
- }
30
- if (legacyFactoryLogs.hasOwnProperty(name)) {
31
- return;
32
- }
33
- legacyFactoryLogs[name] = true;
34
- ("production" !== process.env.NODE_ENV ? warning(
35
- false,
36
- name + ' is calling a React component directly. ' +
37
- 'Use a factory or JSX instead. See: http://fb.me/react-legacyfactory'
38
- ) : null);
39
- monitorCodeUse('react_legacy_factory_call', { version: 3, name: name });
40
- }
41
-
42
- function warnForPlainFunctionType(type) {
43
- var isReactClass =
44
- type.prototype &&
45
- typeof type.prototype.mountComponent === 'function' &&
46
- typeof type.prototype.receiveComponent === 'function';
47
- if (isReactClass) {
48
- ("production" !== process.env.NODE_ENV ? warning(
49
- false,
50
- 'Did not expect to get a React class here. Use `Component` instead ' +
51
- 'of `Component.type` or `this.constructor`.'
52
- ) : null);
53
- } else {
54
- if (!type._reactWarnedForThisType) {
55
- try {
56
- type._reactWarnedForThisType = true;
57
- } catch (x) {
58
- // just incase this is a frozen object or some special object
59
- }
60
- monitorCodeUse(
61
- 'react_non_component_in_jsx',
62
- { version: 3, name: type.name }
63
- );
64
- }
65
- ("production" !== process.env.NODE_ENV ? warning(
66
- false,
67
- 'This JSX uses a plain function. Only React components are ' +
68
- 'valid in React\'s JSX transform.'
69
- ) : null);
70
- }
71
- }
72
-
73
- function warnForNonLegacyFactory(type) {
74
- ("production" !== process.env.NODE_ENV ? warning(
75
- false,
76
- 'Do not pass React.DOM.' + type.type + ' to JSX or createFactory. ' +
77
- 'Use the string "' + type.type + '" instead.'
78
- ) : null);
79
- }
80
-
81
- /**
82
- * Transfer static properties from the source to the target. Functions are
83
- * rebound to have this reflect the original source.
84
- */
85
- function proxyStaticMethods(target, source) {
86
- if (typeof source !== 'function') {
87
- return;
88
- }
89
- for (var key in source) {
90
- if (source.hasOwnProperty(key)) {
91
- var value = source[key];
92
- if (typeof value === 'function') {
93
- var bound = value.bind(source);
94
- // Copy any properties defined on the function, such as `isRequired` on
95
- // a PropTypes validator.
96
- for (var k in value) {
97
- if (value.hasOwnProperty(k)) {
98
- bound[k] = value[k];
99
- }
100
- }
101
- target[key] = bound;
102
- } else {
103
- target[key] = value;
104
- }
105
- }
106
- }
107
- }
108
-
109
- // We use an object instead of a boolean because booleans are ignored by our
110
- // mocking libraries when these factories gets mocked.
111
- var LEGACY_MARKER = {};
112
- var NON_LEGACY_MARKER = {};
113
-
114
- var ReactLegacyElementFactory = {};
115
-
116
- ReactLegacyElementFactory.wrapCreateFactory = function(createFactory) {
117
- var legacyCreateFactory = function(type) {
118
- if (typeof type !== 'function') {
119
- // Non-function types cannot be legacy factories
120
- return createFactory(type);
121
- }
122
-
123
- if (type.isReactNonLegacyFactory) {
124
- // This is probably a factory created by ReactDOM we unwrap it to get to
125
- // the underlying string type. It shouldn't have been passed here so we
126
- // warn.
127
- if ("production" !== process.env.NODE_ENV) {
128
- warnForNonLegacyFactory(type);
129
- }
130
- return createFactory(type.type);
131
- }
132
-
133
- if (type.isReactLegacyFactory) {
134
- // This is probably a legacy factory created by ReactCompositeComponent.
135
- // We unwrap it to get to the underlying class.
136
- return createFactory(type.type);
137
- }
138
-
139
- if ("production" !== process.env.NODE_ENV) {
140
- warnForPlainFunctionType(type);
141
- }
142
-
143
- // Unless it's a legacy factory, then this is probably a plain function,
144
- // that is expecting to be invoked by JSX. We can just return it as is.
145
- return type;
146
- };
147
- return legacyCreateFactory;
148
- };
149
-
150
- ReactLegacyElementFactory.wrapCreateElement = function(createElement) {
151
- var legacyCreateElement = function(type, props, children) {
152
- if (typeof type !== 'function') {
153
- // Non-function types cannot be legacy factories
154
- return createElement.apply(this, arguments);
155
- }
156
-
157
- var args;
158
-
159
- if (type.isReactNonLegacyFactory) {
160
- // This is probably a factory created by ReactDOM we unwrap it to get to
161
- // the underlying string type. It shouldn't have been passed here so we
162
- // warn.
163
- if ("production" !== process.env.NODE_ENV) {
164
- warnForNonLegacyFactory(type);
165
- }
166
- args = Array.prototype.slice.call(arguments, 0);
167
- args[0] = type.type;
168
- return createElement.apply(this, args);
169
- }
170
-
171
- if (type.isReactLegacyFactory) {
172
- // This is probably a legacy factory created by ReactCompositeComponent.
173
- // We unwrap it to get to the underlying class.
174
- if (type._isMockFunction) {
175
- // If this is a mock function, people will expect it to be called. We
176
- // will actually call the original mock factory function instead. This
177
- // future proofs unit testing that assume that these are classes.
178
- type.type._mockedReactClassConstructor = type;
179
- }
180
- args = Array.prototype.slice.call(arguments, 0);
181
- args[0] = type.type;
182
- return createElement.apply(this, args);
183
- }
184
-
185
- if ("production" !== process.env.NODE_ENV) {
186
- warnForPlainFunctionType(type);
187
- }
188
-
189
- // This is being called with a plain function we should invoke it
190
- // immediately as if this was used with legacy JSX.
191
- return type.apply(null, Array.prototype.slice.call(arguments, 1));
192
- };
193
- return legacyCreateElement;
194
- };
195
-
196
- ReactLegacyElementFactory.wrapFactory = function(factory) {
197
- ("production" !== process.env.NODE_ENV ? invariant(
198
- typeof factory === 'function',
199
- 'This is suppose to accept a element factory'
200
- ) : invariant(typeof factory === 'function'));
201
- var legacyElementFactory = function(config, children) {
202
- // This factory should not be called when JSX is used. Use JSX instead.
203
- if ("production" !== process.env.NODE_ENV) {
204
- warnForLegacyFactoryCall();
205
- }
206
- return factory.apply(this, arguments);
207
- };
208
- proxyStaticMethods(legacyElementFactory, factory.type);
209
- legacyElementFactory.isReactLegacyFactory = LEGACY_MARKER;
210
- legacyElementFactory.type = factory.type;
211
- return legacyElementFactory;
212
- };
213
-
214
- // This is used to mark a factory that will remain. E.g. we're allowed to call
215
- // it as a function. However, you're not suppose to pass it to createElement
216
- // or createFactory, so it will warn you if you do.
217
- ReactLegacyElementFactory.markNonLegacyFactory = function(factory) {
218
- factory.isReactNonLegacyFactory = NON_LEGACY_MARKER;
219
- return factory;
220
- };
221
-
222
- // Checks if a factory function is actually a legacy factory pretending to
223
- // be a class.
224
- ReactLegacyElementFactory.isValidFactory = function(factory) {
225
- // TODO: This will be removed and moved into a class validator or something.
226
- return typeof factory === 'function' &&
227
- factory.isReactLegacyFactory === LEGACY_MARKER;
228
- };
229
-
230
- ReactLegacyElementFactory.isValidClass = function(factory) {
231
- if ("production" !== process.env.NODE_ENV) {
232
- ("production" !== process.env.NODE_ENV ? warning(
233
- false,
234
- 'isValidClass is deprecated and will be removed in a future release. ' +
235
- 'Use a more specific validator instead.'
236
- ) : null);
237
- }
238
- return ReactLegacyElementFactory.isValidFactory(factory);
239
- };
240
-
241
- ReactLegacyElementFactory._isLegacyCallWarningEnabled = true;
242
-
243
- module.exports = ReactLegacyElementFactory;
package/lib/deprecated.js DELETED
@@ -1,47 +0,0 @@
1
- /**
2
- * Copyright 2013-2014, 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 deprecated
10
- */
11
-
12
- var assign = require("./Object.assign");
13
- var warning = require("./warning");
14
-
15
- /**
16
- * This will log a single deprecation notice per function and forward the call
17
- * on to the new API.
18
- *
19
- * @param {string} namespace The namespace of the call, eg 'React'
20
- * @param {string} oldName The old function name, eg 'renderComponent'
21
- * @param {string} newName The new function name, eg 'render'
22
- * @param {*} ctx The context this forwarded call should run in
23
- * @param {function} fn The function to forward on to
24
- * @return {*} Will be the value as returned from `fn`
25
- */
26
- function deprecated(namespace, oldName, newName, ctx, fn) {
27
- var warned = false;
28
- if ("production" !== process.env.NODE_ENV) {
29
- var newFn = function() {
30
- ("production" !== process.env.NODE_ENV ? warning(
31
- warned,
32
- (namespace + "." + oldName + " will be deprecated in a future version. ") +
33
- ("Use " + namespace + "." + newName + " instead.")
34
- ) : null);
35
- warned = true;
36
- return fn.apply(ctx, arguments);
37
- };
38
- newFn.displayName = (namespace + "_" + oldName);
39
- // We need to make sure all properties of the original fn are copied over.
40
- // In particular, this is needed to support PropTypes
41
- return assign(newFn, fn);
42
- }
43
-
44
- return fn;
45
- }
46
-
47
- module.exports = deprecated;