react 0.14.10 → 15.0.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.
- package/LICENSE +1 -1
- package/dist/react-with-addons.js +4900 -4627
- package/dist/react-with-addons.min.js +7 -7
- package/dist/react.js +4556 -4059
- package/dist/react.min.js +7 -7
- package/lib/AutoFocusUtils.js +3 -15
- package/lib/BeforeInputEventPlugin.js +8 -25
- package/lib/CSSProperty.js +10 -1
- package/lib/CSSPropertyOperations.js +49 -19
- package/lib/CallbackQueue.js +16 -4
- package/lib/ChangeEventPlugin.js +58 -54
- package/lib/DOMChildrenOperations.js +91 -61
- package/lib/DOMLazyTree.js +105 -0
- package/lib/{ClientReactRootIndex.js → DOMNamespaces.js} +7 -10
- package/lib/DOMProperty.js +18 -39
- package/lib/DOMPropertyOperations.js +42 -53
- package/lib/Danger.js +13 -14
- package/lib/DefaultEventPluginOrder.js +1 -1
- package/lib/EnterLeaveEventPlugin.js +24 -43
- package/lib/EventConstants.js +6 -1
- package/lib/EventPluginHub.js +22 -66
- package/lib/EventPluginRegistry.js +30 -9
- package/lib/EventPluginUtils.js +61 -36
- package/lib/EventPropagators.js +19 -17
- package/lib/FallbackCompositionState.js +4 -4
- package/lib/HTMLDOMPropertyConfig.js +131 -152
- package/lib/LinkedStateMixin.js +1 -2
- package/lib/LinkedValueUtils.js +6 -7
- package/lib/MetaMatchers.js +2 -2
- package/lib/OrderedMap.js +17 -16
- package/lib/PooledClass.js +2 -2
- package/lib/React.js +50 -20
- package/lib/ReactBrowserEventEmitter.js +19 -26
- package/lib/ReactCSSTransitionGroup.js +4 -5
- package/lib/ReactCSSTransitionGroupChild.js +1 -6
- package/lib/ReactChildReconciler.js +15 -13
- package/lib/ReactChildren.js +5 -4
- package/lib/ReactClass.js +44 -92
- package/lib/ReactComponent.js +9 -10
- package/lib/ReactComponentBrowserEnvironment.js +9 -6
- package/lib/ReactComponentEnvironment.js +4 -4
- package/lib/ReactComponentWithPureRenderMixin.js +2 -2
- package/lib/ReactCompositeComponent.js +166 -74
- package/lib/ReactCurrentOwner.js +2 -1
- package/lib/ReactDOM.js +27 -15
- package/lib/ReactDOMButton.js +2 -2
- package/lib/ReactDOMComponent.js +186 -250
- package/lib/ReactDOMComponentFlags.js +18 -0
- package/lib/ReactDOMComponentTree.js +186 -0
- package/lib/ReactDOMContainerInfo.js +32 -0
- package/lib/ReactDOMDebugTool.js +61 -0
- package/lib/ReactDOMEmptyComponent.js +60 -0
- package/lib/ReactDOMFactories.js +1 -2
- package/lib/ReactDOMFeatureFlags.js +2 -2
- package/lib/ReactDOMIDOperations.js +5 -60
- package/lib/ReactDOMInput.js +73 -23
- package/lib/ReactDOMInstrumentation.js +16 -0
- package/lib/ReactDOMOption.js +14 -12
- package/lib/ReactDOMSelect.js +43 -19
- package/lib/ReactDOMSelection.js +4 -4
- package/lib/ReactDOMServer.js +1 -1
- package/lib/ReactDOMTextComponent.js +87 -45
- package/lib/ReactDOMTextarea.js +39 -11
- package/lib/ReactDOMTreeTraversal.js +134 -0
- package/lib/ReactDOMUnknownPropertyDevtool.js +64 -0
- package/lib/ReactDebugInstanceMap.js +102 -0
- package/lib/ReactDebugTool.js +72 -0
- package/lib/ReactDefaultBatchingStrategy.js +4 -3
- package/lib/ReactDefaultInjection.js +11 -15
- package/lib/ReactDefaultPerf.js +105 -26
- package/lib/ReactDefaultPerfAnalysis.js +23 -15
- package/lib/ReactElement.js +63 -23
- package/lib/ReactElementValidator.js +9 -9
- package/lib/ReactEmptyComponent.js +8 -33
- package/lib/ReactErrorUtils.js +1 -2
- package/lib/ReactEventEmitterMixin.js +3 -8
- package/lib/ReactEventListener.js +23 -77
- package/lib/ReactFeatureFlags.js +21 -0
- package/lib/ReactFragment.js +6 -6
- package/lib/ReactInjection.js +3 -3
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -12
- package/lib/ReactInstanceMap.js +2 -1
- package/lib/ReactInstrumentation.js +16 -0
- package/lib/ReactInvalidSetStateWarningDevTool.js +36 -0
- package/lib/ReactLink.js +2 -3
- package/lib/ReactMarkupChecksum.js +8 -3
- package/lib/ReactMount.js +88 -460
- package/lib/ReactMultiChild.js +106 -200
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +6 -5
- package/lib/ReactNodeTypes.js +37 -0
- package/lib/ReactNoopUpdateQueue.js +2 -25
- package/lib/ReactOwner.js +7 -6
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +5 -4
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +31 -7
- package/lib/ReactReconcileTransaction.js +20 -9
- package/lib/ReactReconciler.js +29 -6
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +1 -2
- package/lib/ReactServerRendering.js +17 -35
- package/lib/ReactServerRenderingTransaction.js +11 -29
- package/lib/ReactSimpleEmptyComponent.js +36 -0
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +47 -28
- package/lib/ReactTransitionChildMapping.js +1 -2
- package/lib/ReactTransitionEvents.js +8 -44
- package/lib/ReactTransitionGroup.js +4 -3
- package/lib/ReactUMDEntry.js +26 -0
- package/lib/ReactUpdateQueue.js +24 -66
- package/lib/ReactUpdates.js +29 -11
- package/lib/ReactVersion.js +2 -2
- package/lib/ReactWithAddons.js +1 -21
- package/lib/ReactWithAddonsUMDEntry.js +26 -0
- package/lib/ResponderEventPlugin.js +54 -66
- package/lib/ResponderSyntheticEvent.js +2 -3
- package/lib/ResponderTouchHistoryStore.js +5 -5
- package/lib/SVGDOMPropertyConfig.js +267 -94
- package/lib/SelectEventPlugin.js +13 -18
- package/lib/SimpleEventPlugin.js +57 -17
- package/lib/SyntheticAnimationEvent.js +39 -0
- package/lib/SyntheticClipboardEvent.js +2 -3
- package/lib/SyntheticCompositionEvent.js +2 -3
- package/lib/SyntheticDragEvent.js +2 -3
- package/lib/SyntheticEvent.js +102 -21
- package/lib/SyntheticFocusEvent.js +2 -3
- package/lib/SyntheticInputEvent.js +2 -3
- package/lib/SyntheticKeyboardEvent.js +2 -3
- package/lib/SyntheticMouseEvent.js +2 -3
- package/lib/SyntheticTouchEvent.js +2 -3
- package/lib/SyntheticTransitionEvent.js +39 -0
- package/lib/SyntheticUIEvent.js +2 -3
- package/lib/SyntheticWheelEvent.js +2 -3
- package/lib/TapEventPlugin.js +3 -12
- package/lib/Transaction.js +3 -3
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +2 -2
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +3 -2
- package/lib/canDefineProperty.js +1 -1
- package/lib/createHierarchyRenderer.js +1 -1
- package/lib/createMicrosoftUnsafeLocalFunction.js +32 -0
- package/lib/dangerousStyleValue.js +25 -3
- package/lib/deprecated.js +7 -4
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +15 -8
- package/lib/flattenChildren.js +2 -2
- package/lib/forEachAccumulated.js +2 -1
- package/lib/getEventCharCode.js +2 -2
- package/lib/getEventKey.js +1 -2
- package/lib/getEventModifierState.js +1 -2
- package/lib/getEventTarget.js +8 -2
- package/lib/getIteratorFn.js +2 -2
- package/lib/getNativeComponentFromComposite.js +30 -0
- package/lib/getNodeForCharacterOffset.js +2 -1
- package/lib/getTestDocument.js +1 -1
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/getVendorPrefixedEventName.js +101 -0
- package/lib/instantiateReactComponent.js +12 -13
- package/lib/isEventSupported.js +2 -2
- package/lib/isTextInputElement.js +2 -1
- package/lib/onlyChild.js +2 -2
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +5 -4
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +6 -14
- package/lib/setTextContent.js +1 -1
- package/lib/shallowCompare.js +1 -1
- package/lib/shouldUpdateReactComponent.js +2 -3
- package/lib/sliceChildren.js +1 -1
- package/lib/traverseAllChildren.js +8 -8
- package/lib/update.js +16 -15
- package/lib/validateDOMNesting.js +18 -13
- package/package.json +23 -32
- package/addons.js +0 -13
- package/cjs/react-jsx-dev-runtime.development.js +0 -861
- package/cjs/react-jsx-dev-runtime.production.min.js +0 -9
- package/cjs/react-jsx-runtime.development.js +0 -883
- package/cjs/react-jsx-runtime.production.min.js +0 -10
- package/jsx-dev-runtime.js +0 -7
- package/jsx-runtime.js +0 -7
- package/lib/Object.assign.js +0 -47
- package/lib/React.native.js +0 -5
- package/lib/ReactBrowserComponentMixin.js +0 -36
- package/lib/ReactEmptyComponentRegistry.js +0 -48
- package/lib/ReactIsomorphic.js +0 -74
- package/lib/ReactRootIndex.js +0 -29
- package/lib/ServerReactRootIndex.js +0 -29
- package/lib/cloneWithProps.js +0 -54
- package/lib/webcomponents.js +0 -6379
package/lib/isEventSupported.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -41,7 +41,7 @@ function isEventSupported(eventNameSuffix, capture) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
var eventName = 'on' + eventNameSuffix;
|
|
44
|
-
var isSupported =
|
|
44
|
+
var isSupported = eventName in document;
|
|
45
45
|
|
|
46
46
|
if (!isSupported) {
|
|
47
47
|
var element = document.createElement('div');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
|
|
16
16
|
*/
|
|
17
|
+
|
|
17
18
|
var supportedInputTypes = {
|
|
18
19
|
'color': true,
|
|
19
20
|
'date': true,
|
package/lib/onlyChild.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -26,7 +26,7 @@ var invariant = require('fbjs/lib/invariant');
|
|
|
26
26
|
* structure.
|
|
27
27
|
*/
|
|
28
28
|
function onlyChild(children) {
|
|
29
|
-
!ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) :
|
|
29
|
+
!ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : void 0;
|
|
30
30
|
return children;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
+
var _assign = require('object-assign');
|
|
16
|
+
|
|
15
17
|
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
16
18
|
var ReactTestUtils = require('./ReactTestUtils');
|
|
17
19
|
|
|
18
|
-
var assign = require('./Object.assign');
|
|
19
20
|
var invariant = require('fbjs/lib/invariant');
|
|
20
21
|
|
|
21
22
|
function reactComponentExpect(instance) {
|
|
@@ -30,7 +31,7 @@ function reactComponentExpect(instance) {
|
|
|
30
31
|
expect(instance).not.toBeNull();
|
|
31
32
|
expect(instance).not.toBeUndefined();
|
|
32
33
|
|
|
33
|
-
!ReactTestUtils.isCompositeComponent(instance) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'reactComponentExpect(...): instance must be a composite component') : invariant(false) :
|
|
34
|
+
!ReactTestUtils.isCompositeComponent(instance) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'reactComponentExpect(...): instance must be a composite component') : invariant(false) : void 0;
|
|
34
35
|
var internalInstance = ReactInstanceMap.get(instance);
|
|
35
36
|
|
|
36
37
|
expect(typeof internalInstance).toBe('object');
|
|
@@ -44,7 +45,7 @@ function reactComponentExpectInternal(internalInstance) {
|
|
|
44
45
|
this._instance = internalInstance;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
_assign(reactComponentExpectInternal.prototype, {
|
|
48
49
|
// Getters -------------------------------------------------------------------
|
|
49
50
|
|
|
50
51
|
/**
|
package/lib/setInnerHTML.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
* @providesModule setInnerHTML
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/* globals MSApp */
|
|
13
|
-
|
|
14
12
|
'use strict';
|
|
15
13
|
|
|
16
14
|
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
@@ -18,6 +16,8 @@ var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
|
18
16
|
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
|
|
19
17
|
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
|
|
20
18
|
|
|
19
|
+
var createMicrosoftUnsafeLocalFunction = require('./createMicrosoftUnsafeLocalFunction');
|
|
20
|
+
|
|
21
21
|
/**
|
|
22
22
|
* Set the innerHTML property of a node, ensuring that whitespace is preserved
|
|
23
23
|
* even in IE8.
|
|
@@ -26,18 +26,9 @@ var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
|
|
|
26
26
|
* @param {string} html
|
|
27
27
|
* @internal
|
|
28
28
|
*/
|
|
29
|
-
var setInnerHTML = function (node, html) {
|
|
29
|
+
var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
|
|
30
30
|
node.innerHTML = html;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// Win8 apps: Allow all html to be inserted
|
|
34
|
-
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
|
|
35
|
-
setInnerHTML = function (node, html) {
|
|
36
|
-
MSApp.execUnsafeLocalFunction(function () {
|
|
37
|
-
node.innerHTML = html;
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
}
|
|
31
|
+
});
|
|
41
32
|
|
|
42
33
|
if (ExecutionEnvironment.canUseDOM) {
|
|
43
34
|
// IE8: When updating a just created node with innerHTML only leading
|
|
@@ -85,6 +76,7 @@ if (ExecutionEnvironment.canUseDOM) {
|
|
|
85
76
|
}
|
|
86
77
|
};
|
|
87
78
|
}
|
|
79
|
+
testElement = null;
|
|
88
80
|
}
|
|
89
81
|
|
|
90
82
|
module.exports = setInnerHTML;
|
package/lib/setTextContent.js
CHANGED
package/lib/shallowCompare.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
9
|
* @providesModule shouldUpdateReactComponent
|
|
10
|
-
* @typechecks static-only
|
|
11
10
|
*/
|
|
12
11
|
|
|
13
12
|
'use strict';
|
|
@@ -23,6 +22,7 @@
|
|
|
23
22
|
* @return {boolean} True if the existing instance should be updated.
|
|
24
23
|
* @protected
|
|
25
24
|
*/
|
|
25
|
+
|
|
26
26
|
function shouldUpdateReactComponent(prevElement, nextElement) {
|
|
27
27
|
var prevEmpty = prevElement === null || prevElement === false;
|
|
28
28
|
var nextEmpty = nextElement === null || nextElement === false;
|
|
@@ -37,7 +37,6 @@ function shouldUpdateReactComponent(prevElement, nextElement) {
|
|
|
37
37
|
} else {
|
|
38
38
|
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
|
|
39
39
|
}
|
|
40
|
-
return false;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
module.exports = shouldUpdateReactComponent;
|
package/lib/sliceChildren.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -13,13 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
15
15
|
var ReactElement = require('./ReactElement');
|
|
16
|
-
var ReactInstanceHandles = require('./ReactInstanceHandles');
|
|
17
16
|
|
|
18
17
|
var getIteratorFn = require('./getIteratorFn');
|
|
19
18
|
var invariant = require('fbjs/lib/invariant');
|
|
20
19
|
var warning = require('fbjs/lib/warning');
|
|
21
20
|
|
|
22
|
-
var SEPARATOR =
|
|
21
|
+
var SEPARATOR = '.';
|
|
23
22
|
var SUBSEPARATOR = ':';
|
|
24
23
|
|
|
25
24
|
/**
|
|
@@ -29,11 +28,10 @@ var SUBSEPARATOR = ':';
|
|
|
29
28
|
|
|
30
29
|
var userProvidedKeyEscaperLookup = {
|
|
31
30
|
'=': '=0',
|
|
32
|
-
'.': '=1',
|
|
33
31
|
':': '=2'
|
|
34
32
|
};
|
|
35
33
|
|
|
36
|
-
var userProvidedKeyEscapeRegex = /[
|
|
34
|
+
var userProvidedKeyEscapeRegex = /[=:]/g;
|
|
37
35
|
|
|
38
36
|
var didWarnAboutMaps = false;
|
|
39
37
|
|
|
@@ -49,7 +47,9 @@ function userProvidedKeyEscaper(match) {
|
|
|
49
47
|
* @return {string}
|
|
50
48
|
*/
|
|
51
49
|
function getComponentKey(component, index) {
|
|
52
|
-
|
|
50
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
51
|
+
// that we don't block potential future ES APIs.
|
|
52
|
+
if (component && typeof component === 'object' && component.key != null) {
|
|
53
53
|
// Explicit key
|
|
54
54
|
return wrapUserProvidedKey(component.key);
|
|
55
55
|
}
|
|
@@ -127,7 +127,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
127
127
|
}
|
|
128
128
|
} else {
|
|
129
129
|
if (process.env.NODE_ENV !== 'production') {
|
|
130
|
-
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') :
|
|
130
|
+
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : void 0;
|
|
131
131
|
didWarnAboutMaps = true;
|
|
132
132
|
}
|
|
133
133
|
// Iterator will provide entry [k,v] tuples rather than values.
|
|
@@ -155,7 +155,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
var childrenString = String(children);
|
|
158
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) :
|
|
158
|
+
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : void 0;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
package/lib/update.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -13,16 +13,17 @@
|
|
|
13
13
|
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _assign = require('object-assign');
|
|
17
|
+
|
|
17
18
|
var keyOf = require('fbjs/lib/keyOf');
|
|
18
19
|
var invariant = require('fbjs/lib/invariant');
|
|
19
|
-
var hasOwnProperty =
|
|
20
|
+
var hasOwnProperty = {}.hasOwnProperty;
|
|
20
21
|
|
|
21
22
|
function shallowCopy(x) {
|
|
22
23
|
if (Array.isArray(x)) {
|
|
23
24
|
return x.concat();
|
|
24
25
|
} else if (x && typeof x === 'object') {
|
|
25
|
-
return
|
|
26
|
+
return _assign(new x.constructor(), x);
|
|
26
27
|
} else {
|
|
27
28
|
return x;
|
|
28
29
|
}
|
|
@@ -44,16 +45,16 @@ ALL_COMMANDS_LIST.forEach(function (command) {
|
|
|
44
45
|
});
|
|
45
46
|
|
|
46
47
|
function invariantArrayCase(value, spec, command) {
|
|
47
|
-
!Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) :
|
|
48
|
+
!Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) : void 0;
|
|
48
49
|
var specValue = spec[command];
|
|
49
|
-
!Array.isArray(specValue) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) :
|
|
50
|
+
!Array.isArray(specValue) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : void 0;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
function update(value, spec) {
|
|
53
|
-
!(typeof spec === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) :
|
|
54
|
+
!(typeof spec === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : void 0;
|
|
54
55
|
|
|
55
56
|
if (hasOwnProperty.call(spec, COMMAND_SET)) {
|
|
56
|
-
!(Object.keys(spec).length === 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) :
|
|
57
|
+
!(Object.keys(spec).length === 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) : void 0;
|
|
57
58
|
|
|
58
59
|
return spec[COMMAND_SET];
|
|
59
60
|
}
|
|
@@ -62,9 +63,9 @@ function update(value, spec) {
|
|
|
62
63
|
|
|
63
64
|
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
|
|
64
65
|
var mergeObj = spec[COMMAND_MERGE];
|
|
65
|
-
!(mergeObj && typeof mergeObj === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) :
|
|
66
|
-
!(nextValue && typeof nextValue === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) :
|
|
67
|
-
|
|
66
|
+
!(mergeObj && typeof mergeObj === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : void 0;
|
|
67
|
+
!(nextValue && typeof nextValue === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : void 0;
|
|
68
|
+
_assign(nextValue, spec[COMMAND_MERGE]);
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
|
|
@@ -82,16 +83,16 @@ function update(value, spec) {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
|
|
85
|
-
!Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) :
|
|
86
|
-
!Array.isArray(spec[COMMAND_SPLICE]) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) :
|
|
86
|
+
!Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) : void 0;
|
|
87
|
+
!Array.isArray(spec[COMMAND_SPLICE]) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : void 0;
|
|
87
88
|
spec[COMMAND_SPLICE].forEach(function (args) {
|
|
88
|
-
!Array.isArray(args) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) :
|
|
89
|
+
!Array.isArray(args) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : void 0;
|
|
89
90
|
nextValue.splice.apply(nextValue, args);
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
|
|
94
|
-
!(typeof spec[COMMAND_APPLY] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) :
|
|
95
|
+
!(typeof spec[COMMAND_APPLY] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) : void 0;
|
|
95
96
|
nextValue = spec[COMMAND_APPLY](nextValue);
|
|
96
97
|
}
|
|
97
98
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2015, Facebook, Inc.
|
|
2
|
+
* Copyright 2015-present, Facebook, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the BSD-style license found in the
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _assign = require('object-assign');
|
|
15
|
+
|
|
15
16
|
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
16
17
|
var warning = require('fbjs/lib/warning');
|
|
17
18
|
|
|
@@ -47,7 +48,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
47
48
|
var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
|
|
48
49
|
|
|
49
50
|
var emptyAncestorInfo = {
|
|
50
|
-
|
|
51
|
+
current: null,
|
|
51
52
|
|
|
52
53
|
formTag: null,
|
|
53
54
|
aTagInScope: null,
|
|
@@ -60,7 +61,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
var updatedAncestorInfo = function (oldInfo, tag, instance) {
|
|
63
|
-
var ancestorInfo =
|
|
64
|
+
var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
|
|
64
65
|
var info = { tag: tag, instance: instance };
|
|
65
66
|
|
|
66
67
|
if (inScopeTags.indexOf(tag) !== -1) {
|
|
@@ -79,7 +80,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
79
80
|
ancestorInfo.dlItemTagAutoclosing = null;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
ancestorInfo.
|
|
83
|
+
ancestorInfo.current = info;
|
|
83
84
|
|
|
84
85
|
if (tag === 'form') {
|
|
85
86
|
ancestorInfo.formTag = info;
|
|
@@ -152,6 +153,8 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
152
153
|
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
|
|
153
154
|
case 'html':
|
|
154
155
|
return tag === 'head' || tag === 'body';
|
|
156
|
+
case '#document':
|
|
157
|
+
return tag === 'html';
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
// Probably in the "in body" parsing mode, so we outlaw only tag combos
|
|
@@ -175,6 +178,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
175
178
|
case 'colgroup':
|
|
176
179
|
case 'frame':
|
|
177
180
|
case 'head':
|
|
181
|
+
case 'html':
|
|
178
182
|
case 'tbody':
|
|
179
183
|
case 'td':
|
|
180
184
|
case 'tfoot':
|
|
@@ -273,9 +277,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
273
277
|
}
|
|
274
278
|
|
|
275
279
|
var stack = [];
|
|
276
|
-
/*eslint-disable space-after-keywords */
|
|
277
280
|
do {
|
|
278
|
-
/*eslint-enable space-after-keywords */
|
|
279
281
|
stack.push(instance);
|
|
280
282
|
} while (instance = instance._currentElement._owner);
|
|
281
283
|
stack.reverse();
|
|
@@ -286,7 +288,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
286
288
|
|
|
287
289
|
validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
|
|
288
290
|
ancestorInfo = ancestorInfo || emptyAncestorInfo;
|
|
289
|
-
var parentInfo = ancestorInfo.
|
|
291
|
+
var parentInfo = ancestorInfo.current;
|
|
290
292
|
var parentTag = parentInfo && parentInfo.tag;
|
|
291
293
|
|
|
292
294
|
var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
|
|
@@ -335,26 +337,29 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
335
337
|
}
|
|
336
338
|
didWarn[warnKey] = true;
|
|
337
339
|
|
|
340
|
+
var tagDisplayName = childTag;
|
|
341
|
+
if (childTag !== '#text') {
|
|
342
|
+
tagDisplayName = '<' + childTag + '>';
|
|
343
|
+
}
|
|
344
|
+
|
|
338
345
|
if (invalidParent) {
|
|
339
346
|
var info = '';
|
|
340
347
|
if (ancestorTag === 'table' && childTag === 'tr') {
|
|
341
348
|
info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
|
|
342
349
|
}
|
|
343
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...):
|
|
350
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>. ' + 'See %s.%s', tagDisplayName, ancestorTag, ownerInfo, info) : void 0;
|
|
344
351
|
} else {
|
|
345
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...):
|
|
352
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>. See %s.', tagDisplayName, ancestorTag, ownerInfo) : void 0;
|
|
346
353
|
}
|
|
347
354
|
}
|
|
348
355
|
};
|
|
349
356
|
|
|
350
|
-
validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
|
|
351
|
-
|
|
352
357
|
validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
|
|
353
358
|
|
|
354
359
|
// For testing
|
|
355
360
|
validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
|
|
356
361
|
ancestorInfo = ancestorInfo || emptyAncestorInfo;
|
|
357
|
-
var parentInfo = ancestorInfo.
|
|
362
|
+
var parentInfo = ancestorInfo.current;
|
|
358
363
|
var parentTag = parentInfo && parentInfo.tag;
|
|
359
364
|
return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
|
|
360
365
|
};
|