react 0.13.0-alpha.1 → 0.13.0-alpha.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.
- package/dist/JSXTransformer.js +452 -360
- package/dist/react-with-addons.js +1407 -1021
- package/dist/react-with-addons.min.js +5 -6
- package/dist/react.js +1317 -933
- package/dist/react.min.js +5 -6
- package/lib/AutoFocusMixin.js +1 -1
- package/lib/BeforeInputEventPlugin.js +4 -4
- package/lib/CSSProperty.js +1 -1
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/CallbackQueue.js +2 -2
- package/lib/ChangeEventPlugin.js +1 -1
- package/lib/ClientReactRootIndex.js +1 -1
- package/lib/DOMChildrenOperations.js +6 -4
- package/lib/DOMProperty.js +1 -1
- package/lib/DOMPropertyOperations.js +1 -1
- package/lib/Danger.js +6 -5
- package/lib/DefaultEventPluginOrder.js +1 -1
- package/lib/EnterLeaveEventPlugin.js +1 -1
- package/lib/EventConstants.js +1 -1
- package/lib/EventPluginHub.js +9 -7
- package/lib/EventPluginRegistry.js +1 -1
- package/lib/EventPluginUtils.js +1 -1
- package/lib/EventPropagators.js +1 -1
- package/lib/FallbackCompositionState.js +6 -4
- package/lib/HTMLDOMPropertyConfig.js +12 -7
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +3 -3
- package/lib/LocalEventTrapMixin.js +1 -1
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +4 -2
- package/lib/ReactBrowserComponentMixin.js +1 -1
- package/lib/ReactBrowserEventEmitter.js +2 -2
- package/lib/ReactCSSTransitionGroup.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +4 -2
- package/lib/ReactChildReconciler.js +2 -2
- package/lib/ReactChildren.js +10 -8
- package/lib/ReactClass.js +30 -72
- package/lib/ReactComponent.js +10 -1
- package/lib/ReactComponentBase.js +126 -0
- package/lib/ReactComponentBrowserEnvironment.js +1 -1
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +90 -17
- package/lib/ReactContext.js +1 -1
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +1 -1
- package/lib/ReactDOMButton.js +1 -1
- package/lib/ReactDOMComponent.js +23 -8
- package/lib/ReactDOMForm.js +1 -1
- package/lib/ReactDOMIDOperations.js +1 -1
- package/lib/ReactDOMImg.js +1 -1
- package/lib/ReactDOMInput.js +1 -1
- package/lib/ReactDOMOption.js +1 -1
- package/lib/ReactDOMSelect.js +2 -2
- package/lib/ReactDOMSelection.js +1 -1
- package/lib/ReactDOMTextComponent.js +1 -1
- package/lib/ReactDOMTextarea.js +1 -1
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +1 -1
- package/lib/ReactDefaultPerf.js +1 -1
- package/lib/ReactElement.js +5 -4
- package/lib/ReactElementValidator.js +91 -1
- package/lib/ReactEmptyComponent.js +12 -1
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +3 -3
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +1 -1
- package/lib/ReactInstanceHandles.js +3 -2
- package/lib/ReactInstanceMap.js +1 -1
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +10 -3
- package/lib/ReactMultiChild.js +12 -3
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +1 -1
- package/lib/ReactOwner.js +1 -1
- package/lib/ReactPerf.js +1 -1
- package/lib/ReactPropTransferer.js +2 -2
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +13 -5
- package/lib/ReactPutListenerQueue.js +1 -1
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactRef.js +1 -1
- package/lib/ReactRootIndex.js +1 -1
- package/lib/ReactServerRendering.js +3 -2
- package/lib/ReactServerRenderingTransaction.js +1 -1
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +1 -1
- package/lib/ReactTransitionChildMapping.js +1 -1
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +1 -1
- package/lib/ReactUpdates.js +4 -4
- package/lib/ReactWithAddons.js +1 -1
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +3 -3
- package/lib/ServerReactRootIndex.js +1 -1
- package/lib/SimpleEventPlugin.js +1 -1
- package/lib/SyntheticClipboardEvent.js +1 -2
- package/lib/SyntheticCompositionEvent.js +1 -2
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +11 -3
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -2
- package/lib/SyntheticKeyboardEvent.js +1 -1
- package/lib/SyntheticMouseEvent.js +1 -1
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/Transaction.js +3 -3
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +1 -1
- package/lib/accumulateInto.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/cloneWithProps.js +1 -1
- package/lib/createFullPageComponent.js +1 -1
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/escapeTextForBrowser.js +6 -6
- package/lib/findDOMNode.js +8 -9
- package/lib/flattenChildren.js +10 -8
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -1
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +1 -1
- package/lib/getNodeForCharacterOffset.js +2 -2
- package/lib/getReactRootElementInContainer.js +1 -1
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +1 -1
- package/lib/isEventSupported.js +1 -1
- package/lib/isTextInputElement.js +1 -1
- package/lib/joinClasses.js +1 -1
- package/lib/keyMirror.js +1 -1
- package/lib/memoizeStringOnly.js +4 -5
- package/lib/onlyChild.js +1 -1
- package/lib/setInnerHTML.js +12 -1
- package/lib/shallowEqual.js +1 -1
- package/lib/shouldUpdateReactComponent.js +41 -7
- package/lib/traverseAllChildren.js +1 -1
- package/lib/update.js +1 -1
- package/lib/warning.js +8 -1
- package/package.json +1 -1
package/lib/ReactPropTypes.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactPropTypes
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactElement = require("./ReactElement");
|
|
15
15
|
var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
|
|
@@ -98,6 +98,7 @@ function createChainableTypeChecker(validate) {
|
|
|
98
98
|
("`" + componentName + "`.")
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
|
+
return null;
|
|
101
102
|
} else {
|
|
102
103
|
return validate(props, propName, componentName, location);
|
|
103
104
|
}
|
|
@@ -125,12 +126,13 @@ function createPrimitiveTypeChecker(expectedType) {
|
|
|
125
126
|
("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
|
|
126
127
|
);
|
|
127
128
|
}
|
|
129
|
+
return null;
|
|
128
130
|
}
|
|
129
131
|
return createChainableTypeChecker(validate);
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
function createAnyTypeChecker() {
|
|
133
|
-
return createChainableTypeChecker(emptyFunction.thatReturns());
|
|
135
|
+
return createChainableTypeChecker(emptyFunction.thatReturns(null));
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
function createArrayOfTypeChecker(typeChecker) {
|
|
@@ -150,6 +152,7 @@ function createArrayOfTypeChecker(typeChecker) {
|
|
|
150
152
|
return error;
|
|
151
153
|
}
|
|
152
154
|
}
|
|
155
|
+
return null;
|
|
153
156
|
}
|
|
154
157
|
return createChainableTypeChecker(validate);
|
|
155
158
|
}
|
|
@@ -163,6 +166,7 @@ function createElementTypeChecker() {
|
|
|
163
166
|
("`" + componentName + "`, expected a ReactElement.")
|
|
164
167
|
);
|
|
165
168
|
}
|
|
169
|
+
return null;
|
|
166
170
|
}
|
|
167
171
|
return createChainableTypeChecker(validate);
|
|
168
172
|
}
|
|
@@ -177,6 +181,7 @@ function createInstanceTypeChecker(expectedClass) {
|
|
|
177
181
|
("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
|
|
178
182
|
);
|
|
179
183
|
}
|
|
184
|
+
return null;
|
|
180
185
|
}
|
|
181
186
|
return createChainableTypeChecker(validate);
|
|
182
187
|
}
|
|
@@ -186,7 +191,7 @@ function createEnumTypeChecker(expectedValues) {
|
|
|
186
191
|
var propValue = props[propName];
|
|
187
192
|
for (var i = 0; i < expectedValues.length; i++) {
|
|
188
193
|
if (propValue === expectedValues[i]) {
|
|
189
|
-
return;
|
|
194
|
+
return null;
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
|
|
@@ -219,6 +224,7 @@ function createObjectOfTypeChecker(typeChecker) {
|
|
|
219
224
|
}
|
|
220
225
|
}
|
|
221
226
|
}
|
|
227
|
+
return null;
|
|
222
228
|
}
|
|
223
229
|
return createChainableTypeChecker(validate);
|
|
224
230
|
}
|
|
@@ -228,7 +234,7 @@ function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
|
228
234
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
229
235
|
var checker = arrayOfTypeCheckers[i];
|
|
230
236
|
if (checker(props, propName, componentName, location) == null) {
|
|
231
|
-
return;
|
|
237
|
+
return null;
|
|
232
238
|
}
|
|
233
239
|
}
|
|
234
240
|
|
|
@@ -250,6 +256,7 @@ function createNodeChecker() {
|
|
|
250
256
|
("`" + componentName + "`, expected a ReactNode.")
|
|
251
257
|
);
|
|
252
258
|
}
|
|
259
|
+
return null;
|
|
253
260
|
}
|
|
254
261
|
return createChainableTypeChecker(validate);
|
|
255
262
|
}
|
|
@@ -275,12 +282,13 @@ function createShapeTypeChecker(shapeTypes) {
|
|
|
275
282
|
return error;
|
|
276
283
|
}
|
|
277
284
|
}
|
|
285
|
+
return null;
|
|
278
286
|
}
|
|
279
287
|
return createChainableTypeChecker(validate, 'expected `object`');
|
|
280
288
|
}
|
|
281
289
|
|
|
282
290
|
function isNode(propValue) {
|
|
283
|
-
switch(typeof propValue) {
|
|
291
|
+
switch (typeof propValue) {
|
|
284
292
|
case 'number':
|
|
285
293
|
case 'string':
|
|
286
294
|
return true;
|
package/lib/ReactRef.js
CHANGED
package/lib/ReactRootIndex.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @typechecks static-only
|
|
10
10
|
* @providesModule ReactServerRendering
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var ReactElement = require("./ReactElement");
|
|
15
15
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
@@ -38,7 +38,8 @@ function renderToString(element) {
|
|
|
38
38
|
|
|
39
39
|
return transaction.perform(function() {
|
|
40
40
|
var componentInstance = instantiateReactComponent(element, null);
|
|
41
|
-
var markup =
|
|
41
|
+
var markup =
|
|
42
|
+
componentInstance.mountComponent(id, transaction, emptyObject);
|
|
42
43
|
return ReactMarkupChecksum.addChecksumToMarkup(markup);
|
|
43
44
|
}, null);
|
|
44
45
|
} finally {
|
package/lib/ReactStateSetters.js
CHANGED
package/lib/ReactTestUtils.js
CHANGED
package/lib/ReactUpdates.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactUpdates
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var CallbackQueue = require("./CallbackQueue");
|
|
15
15
|
var PooledClass = require("./PooledClass");
|
|
@@ -152,7 +152,7 @@ function runBatchedUpdates(transaction) {
|
|
|
152
152
|
for (var j = 0; j < callbacks.length; j++) {
|
|
153
153
|
transaction.callbackQueue.enqueue(
|
|
154
154
|
callbacks[j],
|
|
155
|
-
component
|
|
155
|
+
component.getPublicInstance()
|
|
156
156
|
);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
@@ -192,11 +192,11 @@ flushBatchedUpdates = ReactPerf.measure(
|
|
|
192
192
|
*/
|
|
193
193
|
function enqueueUpdate(component, callback) {
|
|
194
194
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
195
|
-
!callback || typeof callback ===
|
|
195
|
+
!callback || typeof callback === 'function',
|
|
196
196
|
'enqueueUpdate(...): You called `setProps`, `replaceProps`, ' +
|
|
197
197
|
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
|
|
198
198
|
'isn\'t callable.'
|
|
199
|
-
) : invariant(!callback || typeof callback ===
|
|
199
|
+
) : invariant(!callback || typeof callback === 'function'));
|
|
200
200
|
ensureInjected();
|
|
201
201
|
|
|
202
202
|
// Various parts of our code (such as ReactCompositeComponent's
|
package/lib/ReactWithAddons.js
CHANGED
package/lib/SelectEventPlugin.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule SelectEventPlugin
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var EventConstants = require("./EventConstants");
|
|
15
15
|
var EventPropagators = require("./EventPropagators");
|
|
@@ -94,8 +94,8 @@ function constructSelectEvent(nativeEvent) {
|
|
|
94
94
|
// won't dispatch.
|
|
95
95
|
if (mouseDown ||
|
|
96
96
|
activeElement == null ||
|
|
97
|
-
activeElement
|
|
98
|
-
return;
|
|
97
|
+
activeElement !== getActiveElement()) {
|
|
98
|
+
return null;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
// Only fire when selection has actually changed.
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var SyntheticEvent = require("./SyntheticEvent");
|
|
16
16
|
|
|
@@ -41,4 +41,3 @@ function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
|
41
41
|
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
|
|
42
42
|
|
|
43
43
|
module.exports = SyntheticClipboardEvent;
|
|
44
|
-
|
package/lib/SyntheticEvent.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var PooledClass = require("./PooledClass");
|
|
16
16
|
|
|
@@ -88,13 +88,21 @@ assign(SyntheticEvent.prototype, {
|
|
|
88
88
|
preventDefault: function() {
|
|
89
89
|
this.defaultPrevented = true;
|
|
90
90
|
var event = this.nativeEvent;
|
|
91
|
-
|
|
91
|
+
if (event.preventDefault) {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
} else {
|
|
94
|
+
event.returnValue = false;
|
|
95
|
+
}
|
|
92
96
|
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
|
|
93
97
|
},
|
|
94
98
|
|
|
95
99
|
stopPropagation: function() {
|
|
96
100
|
var event = this.nativeEvent;
|
|
97
|
-
|
|
101
|
+
if (event.stopPropagation) {
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
} else {
|
|
104
|
+
event.cancelBubble = true;
|
|
105
|
+
}
|
|
98
106
|
this.isPropagationStopped = emptyFunction.thatReturnsTrue;
|
|
99
107
|
},
|
|
100
108
|
|