react 0.14.0-beta1 → 0.14.0-beta2
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/addons.js +5 -2
- package/dist/JSXTransformer.js +588 -227
- package/dist/react-with-addons.js +3118 -2707
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +3713 -3317
- package/dist/react.min.js +6 -5
- package/lib/AutoFocusUtils.js +3 -3
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +3 -0
- package/lib/CSSPropertyOperations.js +13 -13
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +12 -12
- package/lib/DOMChildrenOperations.js +10 -6
- package/lib/DOMProperty.js +8 -8
- package/lib/DOMPropertyOperations.js +9 -9
- package/lib/Danger.js +14 -14
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +5 -5
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +11 -11
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +11 -11
- package/lib/EventPropagators.js +7 -7
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +4 -2
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +8 -8
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +2 -2
- package/lib/React.js +6 -6
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +16 -5
- package/lib/ReactCSSTransitionGroupChild.js +12 -11
- package/lib/ReactChildReconciler.js +25 -18
- package/lib/ReactChildren.js +6 -6
- package/lib/ReactClass.js +42 -42
- package/lib/ReactComponent.js +13 -13
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +38 -38
- package/lib/ReactDOM.js +72 -159
- package/lib/ReactDOMComponent.js +104 -60
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/ReactDOMIDOperations.js +10 -24
- package/lib/ReactDOMInput.js +8 -8
- package/lib/ReactDOMOption.js +7 -7
- package/lib/ReactDOMSelect.js +8 -8
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +2 -2
- package/lib/ReactDOMTextComponent.js +11 -11
- package/lib/ReactDOMTextarea.js +11 -11
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +24 -24
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -9
- package/lib/ReactElement.js +4 -4
- package/lib/ReactElementValidator.js +21 -21
- package/lib/ReactEmptyComponent.js +4 -4
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +19 -14
- package/lib/ReactFragment.js +11 -11
- package/lib/ReactInjection.js +11 -11
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -11
- package/lib/ReactIsomorphic.js +11 -11
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +68 -48
- package/lib/ReactMultiChild.js +83 -22
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -3
- package/lib/ReactNoopUpdateQueue.js +3 -3
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +34 -8
- package/lib/ReactReconcileTransaction.js +6 -6
- package/lib/ReactReconciler.js +12 -12
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +5 -5
- package/lib/ReactServerRendering.js +12 -12
- package/lib/ReactServerRenderingTransaction.js +5 -5
- package/lib/ReactTestUtils.js +26 -27
- package/lib/ReactTransitionChildMapping.js +2 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +17 -17
- package/lib/ReactUpdates.js +14 -14
- package/lib/ReactWithAddons.js +14 -14
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +9 -9
- package/lib/SimpleEventPlugin.js +201 -25
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +3 -3
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +3 -3
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +6 -6
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +11 -6
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +4 -4
- package/lib/findDOMNode.js +9 -9
- package/lib/flattenChildren.js +4 -4
- package/lib/getEventKey.js +1 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +12 -12
- package/lib/isEventSupported.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +210 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +1 -1
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/sliceChildren.js +51 -0
- package/lib/traverseAllChildren.js +14 -13
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +6 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +1 -1
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/ReactDOMClient.js +0 -90
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/emptyObject.js +0 -20
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -93
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/isTextNode.js +0 -25
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -57
package/lib/ReactElement.js
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactCurrentOwner = require(
|
|
14
|
+
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
15
15
|
|
|
16
|
-
var assign = require(
|
|
16
|
+
var assign = require('./Object.assign');
|
|
17
17
|
|
|
18
18
|
var RESERVED_PROPS = {
|
|
19
19
|
key: true,
|
|
@@ -42,7 +42,7 @@ var ReactElement = function (type, key, ref, owner, props) {
|
|
|
42
42
|
|
|
43
43
|
this.props = props;
|
|
44
44
|
|
|
45
|
-
if (
|
|
45
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
46
46
|
// The validation flag is currently mutative. We put it on
|
|
47
47
|
// an external backing store so that we can freeze the whole object.
|
|
48
48
|
// This can be replaced with a WeakMap once they are implemented in
|
|
@@ -134,7 +134,7 @@ ReactElement.createFactory = function (type) {
|
|
|
134
134
|
ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
|
|
135
135
|
var newElement = new ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._owner, newProps);
|
|
136
136
|
|
|
137
|
-
if (
|
|
137
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
138
138
|
// If the key on the original is valid, then the clone is valid
|
|
139
139
|
newElement._store.validated = oldElement._store.validated;
|
|
140
140
|
}
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
|
-
var ReactElement = require(
|
|
22
|
-
var ReactFragment = require(
|
|
23
|
-
var ReactPropTypeLocations = require(
|
|
24
|
-
var ReactPropTypeLocationNames = require(
|
|
25
|
-
var ReactCurrentOwner = require(
|
|
21
|
+
var ReactElement = require('./ReactElement');
|
|
22
|
+
var ReactFragment = require('./ReactFragment');
|
|
23
|
+
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
|
|
24
|
+
var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
|
|
25
|
+
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
26
26
|
|
|
27
|
-
var getIteratorFn = require(
|
|
28
|
-
var invariant = require(
|
|
29
|
-
var warning = require(
|
|
27
|
+
var getIteratorFn = require('./getIteratorFn');
|
|
28
|
+
var invariant = require('fbjs/lib/invariant');
|
|
29
|
+
var warning = require('fbjs/lib/warning');
|
|
30
30
|
|
|
31
31
|
function getDeclarationErrorAddendum() {
|
|
32
32
|
if (ReactCurrentOwner.current) {
|
|
@@ -99,7 +99,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
99
99
|
// we already showed the warning
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
/**
|
|
@@ -120,7 +120,7 @@ function validatePropertyKey(name, element, parentType) {
|
|
|
120
120
|
// we already showed the warning
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Child objects should have non-numeric keys so ordering is preserved.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
@@ -224,19 +224,19 @@ function checkPropTypes(componentName, propTypes, props, location) {
|
|
|
224
224
|
try {
|
|
225
225
|
// This is intentionally an invariant that gets caught. It's the same
|
|
226
226
|
// behavior as without this statement except with a better message.
|
|
227
|
-
!(typeof propTypes[propName] === 'function') ?
|
|
227
|
+
!(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
|
|
228
228
|
error = propTypes[propName](props, propName, componentName, location);
|
|
229
229
|
} catch (ex) {
|
|
230
230
|
error = ex;
|
|
231
231
|
}
|
|
232
|
-
|
|
232
|
+
process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
|
|
233
233
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
234
234
|
// Only monitor this failure once because there tends to be a lot of the
|
|
235
235
|
// same error.
|
|
236
236
|
loggedTypeFailures[error.message] = true;
|
|
237
237
|
|
|
238
238
|
var addendum = getDeclarationErrorAddendum();
|
|
239
|
-
|
|
239
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -258,7 +258,7 @@ function validatePropTypes(element) {
|
|
|
258
258
|
checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
|
|
259
259
|
}
|
|
260
260
|
if (typeof componentClass.getDefaultProps === 'function') {
|
|
261
|
-
|
|
261
|
+
process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
|
@@ -267,7 +267,7 @@ var ReactElementValidator = {
|
|
|
267
267
|
createElement: function (type, props, children) {
|
|
268
268
|
// We warn in this case but don't throw. We expect the element creation to
|
|
269
269
|
// succeed and there will likely be errors in render.
|
|
270
|
-
|
|
270
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof type === 'string' || typeof type === 'function', 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
|
|
271
271
|
|
|
272
272
|
var element = ReactElement.createElement.apply(this, arguments);
|
|
273
273
|
|
|
@@ -291,19 +291,21 @@ var ReactElementValidator = {
|
|
|
291
291
|
// Legacy hook TODO: Warn if this is accessed
|
|
292
292
|
validatedFactory.type = type;
|
|
293
293
|
|
|
294
|
-
if (
|
|
294
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
295
295
|
try {
|
|
296
296
|
Object.defineProperty(validatedFactory, 'type', {
|
|
297
297
|
enumerable: false,
|
|
298
298
|
get: function () {
|
|
299
|
-
|
|
299
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
|
|
300
300
|
Object.defineProperty(this, 'type', {
|
|
301
301
|
value: type
|
|
302
302
|
});
|
|
303
303
|
return type;
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
|
-
} catch (x) {
|
|
306
|
+
} catch (x) {
|
|
307
|
+
// IE will fail on defineProperty (es5-shim/sham too)
|
|
308
|
+
}
|
|
307
309
|
}
|
|
308
310
|
|
|
309
311
|
return validatedFactory;
|
|
@@ -320,6 +322,4 @@ var ReactElementValidator = {
|
|
|
320
322
|
|
|
321
323
|
};
|
|
322
324
|
|
|
323
|
-
module.exports = ReactElementValidator;
|
|
324
|
-
|
|
325
|
-
// IE will fail on defineProperty (es5-shim/sham too)
|
|
325
|
+
module.exports = ReactElementValidator;
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactElement = require(
|
|
15
|
-
var ReactInstanceMap = require(
|
|
14
|
+
var ReactElement = require('./ReactElement');
|
|
15
|
+
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
16
16
|
|
|
17
|
-
var invariant = require(
|
|
17
|
+
var invariant = require('fbjs/lib/invariant');
|
|
18
18
|
|
|
19
19
|
var component;
|
|
20
20
|
// This registry keeps track of the React IDs of the components that rendered to
|
|
@@ -48,7 +48,7 @@ ReactEmptyComponentType.prototype.componentWillUnmount = function () {
|
|
|
48
48
|
deregisterNullComponentID(internalInstance._rootNodeID);
|
|
49
49
|
};
|
|
50
50
|
ReactEmptyComponentType.prototype.render = function () {
|
|
51
|
-
!component ?
|
|
51
|
+
!component ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to return null from a render, but no null placeholder component ' + 'was injected.') : invariant(false) : undefined;
|
|
52
52
|
return component();
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var EventListener = require(
|
|
16
|
-
var ExecutionEnvironment = require(
|
|
17
|
-
var PooledClass = require(
|
|
18
|
-
var ReactInstanceHandles = require(
|
|
19
|
-
var ReactMount = require(
|
|
20
|
-
var ReactUpdates = require(
|
|
15
|
+
var EventListener = require('fbjs/lib/EventListener');
|
|
16
|
+
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
17
|
+
var PooledClass = require('./PooledClass');
|
|
18
|
+
var ReactInstanceHandles = require('./ReactInstanceHandles');
|
|
19
|
+
var ReactMount = require('./ReactMount');
|
|
20
|
+
var ReactUpdates = require('./ReactUpdates');
|
|
21
21
|
|
|
22
|
-
var assign = require(
|
|
23
|
-
var getEventTarget = require(
|
|
24
|
-
var getUnboundedScrollPosition = require(
|
|
22
|
+
var assign = require('./Object.assign');
|
|
23
|
+
var getEventTarget = require('./getEventTarget');
|
|
24
|
+
var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
|
|
25
25
|
|
|
26
26
|
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
|
|
27
27
|
|
|
@@ -59,7 +59,7 @@ assign(TopLevelCallbackBookKeeping.prototype, {
|
|
|
59
59
|
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
|
|
60
60
|
|
|
61
61
|
function handleTopLevelImpl(bookKeeping) {
|
|
62
|
-
if (bookKeeping.nativeEvent.path) {
|
|
62
|
+
if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
|
|
63
63
|
// New browsers have a path attribute on native events
|
|
64
64
|
handleTopLevelWithPath(bookKeeping);
|
|
65
65
|
} else {
|
|
@@ -93,27 +93,32 @@ function handleTopLevelWithoutPath(bookKeeping) {
|
|
|
93
93
|
function handleTopLevelWithPath(bookKeeping) {
|
|
94
94
|
var path = bookKeeping.nativeEvent.path;
|
|
95
95
|
var currentNativeTarget = path[0];
|
|
96
|
+
var eventsFired = 0;
|
|
96
97
|
for (var i = 0; i < path.length; i++) {
|
|
97
98
|
var currentPathElement = path[i];
|
|
98
|
-
var
|
|
99
|
+
var currentPathElementID = ReactMount.getID(currentPathElement);
|
|
99
100
|
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
|
|
100
101
|
currentNativeTarget = path[i + 1];
|
|
101
102
|
}
|
|
102
103
|
if (ReactMount.isRenderedByReact(currentPathElement)) {
|
|
103
|
-
var
|
|
104
|
+
var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
|
|
104
105
|
bookKeeping.ancestors.push(currentPathElement);
|
|
105
106
|
|
|
106
107
|
var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
|
|
108
|
+
eventsFired++;
|
|
107
109
|
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
|
|
108
110
|
|
|
109
111
|
// Jump to the root of this React render tree
|
|
110
|
-
while (
|
|
112
|
+
while (currentPathElementID !== newRootID) {
|
|
111
113
|
i++;
|
|
112
114
|
currentPathElement = path[i];
|
|
113
|
-
|
|
115
|
+
currentPathElementID = ReactMount.getID(currentPathElement);
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
}
|
|
119
|
+
if (eventsFired === 0) {
|
|
120
|
+
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
|
121
|
+
}
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
function scrollValueMonitor(cb) {
|
package/lib/ReactFragment.js
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactElement = require(
|
|
14
|
+
var ReactElement = require('./ReactElement');
|
|
15
15
|
|
|
16
|
-
var warning = require(
|
|
16
|
+
var warning = require('fbjs/lib/warning');
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* We used to allow keyed objects to serve as a collection of ReactElements,
|
|
@@ -27,7 +27,7 @@ var fragmentKey;
|
|
|
27
27
|
var didWarnKey;
|
|
28
28
|
var canWarnForReactFragment;
|
|
29
29
|
|
|
30
|
-
if (
|
|
30
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
31
31
|
fragmentKey = '_reactFragment';
|
|
32
32
|
didWarnKey = '_reactDidWarn';
|
|
33
33
|
|
|
@@ -52,12 +52,12 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
52
52
|
Object.defineProperty(obj, key, {
|
|
53
53
|
enumerable: true,
|
|
54
54
|
get: function () {
|
|
55
|
-
|
|
55
|
+
process.env.NODE_ENV !== 'production' ? warning(this[didWarnKey], 'A ReactFragment is an opaque type. Accessing any of its ' + 'properties is deprecated. Pass it to one of the React.Children ' + 'helpers.') : undefined;
|
|
56
56
|
this[didWarnKey] = true;
|
|
57
57
|
return this[fragmentKey][key];
|
|
58
58
|
},
|
|
59
59
|
set: function (value) {
|
|
60
|
-
|
|
60
|
+
process.env.NODE_ENV !== 'production' ? warning(this[didWarnKey], 'A ReactFragment is an immutable opaque type. Mutating its ' + 'properties is deprecated.') : undefined;
|
|
61
61
|
this[didWarnKey] = true;
|
|
62
62
|
this[fragmentKey][key] = value;
|
|
63
63
|
}
|
|
@@ -83,13 +83,13 @@ var ReactFragment = {
|
|
|
83
83
|
// Wrap a keyed object in an opaque proxy that warns you if you access any
|
|
84
84
|
// of its properties.
|
|
85
85
|
create: function (object) {
|
|
86
|
-
if (
|
|
86
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
87
87
|
if (typeof object !== 'object' || !object || Array.isArray(object)) {
|
|
88
|
-
|
|
88
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
|
|
89
89
|
return object;
|
|
90
90
|
}
|
|
91
91
|
if (ReactElement.isValidElement(object)) {
|
|
92
|
-
|
|
92
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
|
|
93
93
|
return object;
|
|
94
94
|
}
|
|
95
95
|
if (canWarnForReactFragment) {
|
|
@@ -115,10 +115,10 @@ var ReactFragment = {
|
|
|
115
115
|
// Extract the original keyed object from the fragment opaque type. Warn if
|
|
116
116
|
// a plain object is passed here.
|
|
117
117
|
extract: function (fragment) {
|
|
118
|
-
if (
|
|
118
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
119
119
|
if (canWarnForReactFragment) {
|
|
120
120
|
if (!fragment[fragmentKey]) {
|
|
121
|
-
|
|
121
|
+
process.env.NODE_ENV !== 'production' ? warning(didWarnForFragment(fragment), 'Any use of a keyed object should be wrapped in ' + 'React.addons.createFragment(object) before being passed as a ' + 'child.') : undefined;
|
|
122
122
|
return fragment;
|
|
123
123
|
}
|
|
124
124
|
return fragment[fragmentKey];
|
|
@@ -130,7 +130,7 @@ var ReactFragment = {
|
|
|
130
130
|
// is a fragment-like object, warn that it should be wrapped. Ignore if we
|
|
131
131
|
// can't determine what kind of object this is.
|
|
132
132
|
extractIfFragment: function (fragment) {
|
|
133
|
-
if (
|
|
133
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
134
134
|
if (canWarnForReactFragment) {
|
|
135
135
|
// If it is the opaque type, return the keyed object.
|
|
136
136
|
if (fragment[fragmentKey]) {
|
package/lib/ReactInjection.js
CHANGED
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var DOMProperty = require(
|
|
15
|
-
var EventPluginHub = require(
|
|
16
|
-
var ReactComponentEnvironment = require(
|
|
17
|
-
var ReactClass = require(
|
|
18
|
-
var ReactEmptyComponent = require(
|
|
19
|
-
var ReactBrowserEventEmitter = require(
|
|
20
|
-
var ReactNativeComponent = require(
|
|
21
|
-
var ReactDOMComponent = require(
|
|
22
|
-
var ReactPerf = require(
|
|
23
|
-
var ReactRootIndex = require(
|
|
24
|
-
var ReactUpdates = require(
|
|
14
|
+
var DOMProperty = require('./DOMProperty');
|
|
15
|
+
var EventPluginHub = require('./EventPluginHub');
|
|
16
|
+
var ReactComponentEnvironment = require('./ReactComponentEnvironment');
|
|
17
|
+
var ReactClass = require('./ReactClass');
|
|
18
|
+
var ReactEmptyComponent = require('./ReactEmptyComponent');
|
|
19
|
+
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
20
|
+
var ReactNativeComponent = require('./ReactNativeComponent');
|
|
21
|
+
var ReactDOMComponent = require('./ReactDOMComponent');
|
|
22
|
+
var ReactPerf = require('./ReactPerf');
|
|
23
|
+
var ReactRootIndex = require('./ReactRootIndex');
|
|
24
|
+
var ReactUpdates = require('./ReactUpdates');
|
|
25
25
|
|
|
26
26
|
var ReactInjection = {
|
|
27
27
|
Component: ReactComponentEnvironment.injection,
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactDOMSelection = require(
|
|
14
|
+
var ReactDOMSelection = require('./ReactDOMSelection');
|
|
15
15
|
|
|
16
|
-
var containsNode = require(
|
|
17
|
-
var focusNode = require(
|
|
18
|
-
var getActiveElement = require(
|
|
16
|
+
var containsNode = require('fbjs/lib/containsNode');
|
|
17
|
+
var focusNode = require('fbjs/lib/focusNode');
|
|
18
|
+
var getActiveElement = require('fbjs/lib/getActiveElement');
|
|
19
19
|
|
|
20
20
|
function isInDocument(node) {
|
|
21
21
|
return containsNode(document.documentElement, node);
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var ReactRootIndex = require(
|
|
15
|
+
var ReactRootIndex = require('./ReactRootIndex');
|
|
16
16
|
|
|
17
|
-
var invariant = require(
|
|
17
|
+
var invariant = require('fbjs/lib/invariant');
|
|
18
18
|
|
|
19
19
|
var SEPARATOR = '.';
|
|
20
20
|
var SEPARATOR_LENGTH = SEPARATOR.length;
|
|
@@ -91,8 +91,8 @@ function getParentID(id) {
|
|
|
91
91
|
* @private
|
|
92
92
|
*/
|
|
93
93
|
function getNextDescendantID(ancestorID, destinationID) {
|
|
94
|
-
!(isValidID(ancestorID) && isValidID(destinationID)) ?
|
|
95
|
-
!isAncestorIDOf(ancestorID, destinationID) ?
|
|
94
|
+
!(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
|
|
95
|
+
!isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
|
|
96
96
|
if (ancestorID === destinationID) {
|
|
97
97
|
return ancestorID;
|
|
98
98
|
}
|
|
@@ -134,7 +134,7 @@ function getFirstCommonAncestorID(oneID, twoID) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
|
|
137
|
-
!isValidID(longestCommonID) ?
|
|
137
|
+
!isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
|
|
138
138
|
return longestCommonID;
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -154,13 +154,13 @@ function getFirstCommonAncestorID(oneID, twoID) {
|
|
|
154
154
|
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
|
155
155
|
start = start || '';
|
|
156
156
|
stop = stop || '';
|
|
157
|
-
!(start !== stop) ?
|
|
157
|
+
!(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
|
|
158
158
|
var traverseUp = isAncestorIDOf(stop, start);
|
|
159
|
-
!(traverseUp || isAncestorIDOf(start, stop)) ?
|
|
159
|
+
!(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
|
|
160
160
|
// Traverse from `start` to `stop` one depth at a time.
|
|
161
161
|
var depth = 0;
|
|
162
162
|
var traverse = traverseUp ? getParentID : getNextDescendantID;
|
|
163
|
-
for (var id = start;; id = traverse(id, stop)) {
|
|
163
|
+
for (var id = start;; /* until break */id = traverse(id, stop)) {
|
|
164
164
|
var ret;
|
|
165
165
|
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
|
|
166
166
|
ret = cb(id, traverseUp, arg);
|
|
@@ -169,7 +169,7 @@ function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
|
|
169
169
|
// Only break //after// visiting `stop`.
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
172
|
-
!(depth++ < MAX_TREE_DEPTH) ?
|
|
172
|
+
!(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
@@ -299,5 +299,4 @@ var ReactInstanceHandles = {
|
|
|
299
299
|
|
|
300
300
|
};
|
|
301
301
|
|
|
302
|
-
module.exports = ReactInstanceHandles;
|
|
303
|
-
/* until break */
|
|
302
|
+
module.exports = ReactInstanceHandles;
|
package/lib/ReactIsomorphic.js
CHANGED
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var ReactChildren = require(
|
|
15
|
-
var ReactComponent = require(
|
|
16
|
-
var ReactClass = require(
|
|
17
|
-
var
|
|
18
|
-
var ReactElement = require(
|
|
19
|
-
var ReactElementValidator = require(
|
|
20
|
-
var ReactPropTypes = require(
|
|
14
|
+
var ReactChildren = require('./ReactChildren');
|
|
15
|
+
var ReactComponent = require('./ReactComponent');
|
|
16
|
+
var ReactClass = require('./ReactClass');
|
|
17
|
+
var ReactDOMFactories = require('./ReactDOMFactories');
|
|
18
|
+
var ReactElement = require('./ReactElement');
|
|
19
|
+
var ReactElementValidator = require('./ReactElementValidator');
|
|
20
|
+
var ReactPropTypes = require('./ReactPropTypes');
|
|
21
21
|
|
|
22
|
-
var assign = require(
|
|
23
|
-
var onlyChild = require(
|
|
22
|
+
var assign = require('./Object.assign');
|
|
23
|
+
var onlyChild = require('./onlyChild');
|
|
24
24
|
|
|
25
25
|
var createElement = ReactElement.createElement;
|
|
26
26
|
var createFactory = ReactElement.createFactory;
|
|
27
27
|
var cloneElement = ReactElement.cloneElement;
|
|
28
28
|
|
|
29
|
-
if (
|
|
29
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
30
30
|
createElement = ReactElementValidator.createElement;
|
|
31
31
|
createFactory = ReactElementValidator.createFactory;
|
|
32
32
|
cloneElement = ReactElementValidator.cloneElement;
|
|
@@ -61,7 +61,7 @@ var React = {
|
|
|
61
61
|
|
|
62
62
|
// This looks DOM specific but these are actually isomorphic helpers
|
|
63
63
|
// since they are just generating DOM strings.
|
|
64
|
-
DOM:
|
|
64
|
+
DOM: ReactDOMFactories,
|
|
65
65
|
|
|
66
66
|
// Hook for JSX spread, don't use this for anything else.
|
|
67
67
|
__spread: assign
|