2020-03-31 20:57:48 +08:00
/ * * @ l i c e n s e R e a c t v 1 6 . 1 2 . 0
2020-01-28 13:08:03 +08:00
* react - is . development . js
*
* Copyright ( c ) Facebook , Inc . and its affiliates .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
* /
'use strict' ;
if ( process . env . NODE _ENV !== "production" ) {
( function ( ) {
'use strict' ;
2020-03-31 20:57:48 +08:00
Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
2020-01-28 13:08:03 +08:00
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var hasSymbol = typeof Symbol === 'function' && Symbol . for ;
var REACT _ELEMENT _TYPE = hasSymbol ? Symbol . for ( 'react.element' ) : 0xeac7 ;
var REACT _PORTAL _TYPE = hasSymbol ? Symbol . for ( 'react.portal' ) : 0xeaca ;
var REACT _FRAGMENT _TYPE = hasSymbol ? Symbol . for ( 'react.fragment' ) : 0xeacb ;
var REACT _STRICT _MODE _TYPE = hasSymbol ? Symbol . for ( 'react.strict_mode' ) : 0xeacc ;
var REACT _PROFILER _TYPE = hasSymbol ? Symbol . for ( 'react.profiler' ) : 0xead2 ;
var REACT _PROVIDER _TYPE = hasSymbol ? Symbol . for ( 'react.provider' ) : 0xeacd ;
var REACT _CONTEXT _TYPE = hasSymbol ? Symbol . for ( 'react.context' ) : 0xeace ; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
// (unstable) APIs that have been removed. Can we remove the symbols?
var REACT _ASYNC _MODE _TYPE = hasSymbol ? Symbol . for ( 'react.async_mode' ) : 0xeacf ;
var REACT _CONCURRENT _MODE _TYPE = hasSymbol ? Symbol . for ( 'react.concurrent_mode' ) : 0xeacf ;
var REACT _FORWARD _REF _TYPE = hasSymbol ? Symbol . for ( 'react.forward_ref' ) : 0xead0 ;
var REACT _SUSPENSE _TYPE = hasSymbol ? Symbol . for ( 'react.suspense' ) : 0xead1 ;
var REACT _SUSPENSE _LIST _TYPE = hasSymbol ? Symbol . for ( 'react.suspense_list' ) : 0xead8 ;
var REACT _MEMO _TYPE = hasSymbol ? Symbol . for ( 'react.memo' ) : 0xead3 ;
var REACT _LAZY _TYPE = hasSymbol ? Symbol . for ( 'react.lazy' ) : 0xead4 ;
var REACT _FUNDAMENTAL _TYPE = hasSymbol ? Symbol . for ( 'react.fundamental' ) : 0xead5 ;
var REACT _RESPONDER _TYPE = hasSymbol ? Symbol . for ( 'react.responder' ) : 0xead6 ;
var REACT _SCOPE _TYPE = hasSymbol ? Symbol . for ( 'react.scope' ) : 0xead7 ;
function isValidElementType ( type ) {
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2020-03-31 20:57:48 +08:00
type === REACT _FRAGMENT _TYPE || type === REACT _CONCURRENT _MODE _TYPE || type === REACT _PROFILER _TYPE || type === REACT _STRICT _MODE _TYPE || type === REACT _SUSPENSE _TYPE || type === REACT _SUSPENSE _LIST _TYPE || typeof type === 'object' && type !== null && ( type . $$typeof === REACT _LAZY _TYPE || type . $$typeof === REACT _MEMO _TYPE || type . $$typeof === REACT _PROVIDER _TYPE || type . $$typeof === REACT _CONTEXT _TYPE || type . $$typeof === REACT _FORWARD _REF _TYPE || type . $$typeof === REACT _FUNDAMENTAL _TYPE || type . $$typeof === REACT _RESPONDER _TYPE || type . $$typeof === REACT _SCOPE _TYPE ) ;
2020-01-28 13:08:03 +08:00
}
2020-03-31 20:57:48 +08:00
/ * *
* Forked from fbjs / warning :
* https : //github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
*
* Only change is we use console . warn instead of console . error ,
* and do nothing when 'console' is not supported .
* This really simplifies the code .
* -- -
* Similar to invariant but only logs a warning if the condition is not met .
* This can be used to log issues in development environments in critical
* paths . Removing the logging code for production environments will keep the
* same logic and follow the same code paths .
* /
var lowPriorityWarningWithoutStack = function ( ) { } ;
{
var printWarning = function ( format ) {
for ( var _len = arguments . length , args = new Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
args [ _key - 1 ] = arguments [ _key ] ;
}
var argIndex = 0 ;
var message = 'Warning: ' + format . replace ( /%s/g , function ( ) {
return args [ argIndex ++ ] ;
} ) ;
if ( typeof console !== 'undefined' ) {
console . warn ( message ) ;
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error ( message ) ;
} catch ( x ) { }
} ;
lowPriorityWarningWithoutStack = function ( condition , format ) {
if ( format === undefined ) {
throw new Error ( '`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument' ) ;
}
if ( ! condition ) {
for ( var _len2 = arguments . length , args = new Array ( _len2 > 2 ? _len2 - 2 : 0 ) , _key2 = 2 ; _key2 < _len2 ; _key2 ++ ) {
args [ _key2 - 2 ] = arguments [ _key2 ] ;
}
printWarning . apply ( void 0 , [ format ] . concat ( args ) ) ;
}
} ;
}
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack ;
2020-01-28 13:08:03 +08:00
function typeOf ( object ) {
if ( typeof object === 'object' && object !== null ) {
var $$typeof = object . $$typeof ;
switch ( $$typeof ) {
case REACT _ELEMENT _TYPE :
var type = object . type ;
switch ( type ) {
case REACT _ASYNC _MODE _TYPE :
case REACT _CONCURRENT _MODE _TYPE :
case REACT _FRAGMENT _TYPE :
case REACT _PROFILER _TYPE :
case REACT _STRICT _MODE _TYPE :
case REACT _SUSPENSE _TYPE :
return type ;
default :
var $$typeofType = type && type . $$typeof ;
switch ( $$typeofType ) {
case REACT _CONTEXT _TYPE :
case REACT _FORWARD _REF _TYPE :
case REACT _LAZY _TYPE :
case REACT _MEMO _TYPE :
case REACT _PROVIDER _TYPE :
return $$typeofType ;
default :
return $$typeof ;
}
}
case REACT _PORTAL _TYPE :
return $$typeof ;
}
}
return undefined ;
} // AsyncMode is deprecated along with isAsyncMode
var AsyncMode = REACT _ASYNC _MODE _TYPE ;
var ConcurrentMode = REACT _CONCURRENT _MODE _TYPE ;
var ContextConsumer = REACT _CONTEXT _TYPE ;
var ContextProvider = REACT _PROVIDER _TYPE ;
var Element = REACT _ELEMENT _TYPE ;
var ForwardRef = REACT _FORWARD _REF _TYPE ;
var Fragment = REACT _FRAGMENT _TYPE ;
var Lazy = REACT _LAZY _TYPE ;
var Memo = REACT _MEMO _TYPE ;
var Portal = REACT _PORTAL _TYPE ;
var Profiler = REACT _PROFILER _TYPE ;
var StrictMode = REACT _STRICT _MODE _TYPE ;
var Suspense = REACT _SUSPENSE _TYPE ;
var hasWarnedAboutDeprecatedIsAsyncMode = false ; // AsyncMode should be deprecated
function isAsyncMode ( object ) {
{
if ( ! hasWarnedAboutDeprecatedIsAsyncMode ) {
2020-03-31 20:57:48 +08:00
hasWarnedAboutDeprecatedIsAsyncMode = true ;
lowPriorityWarningWithoutStack$1 ( false , 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.' ) ;
2020-01-28 13:08:03 +08:00
}
}
return isConcurrentMode ( object ) || typeOf ( object ) === REACT _ASYNC _MODE _TYPE ;
}
function isConcurrentMode ( object ) {
return typeOf ( object ) === REACT _CONCURRENT _MODE _TYPE ;
}
function isContextConsumer ( object ) {
return typeOf ( object ) === REACT _CONTEXT _TYPE ;
}
function isContextProvider ( object ) {
return typeOf ( object ) === REACT _PROVIDER _TYPE ;
}
function isElement ( object ) {
return typeof object === 'object' && object !== null && object . $$typeof === REACT _ELEMENT _TYPE ;
}
function isForwardRef ( object ) {
return typeOf ( object ) === REACT _FORWARD _REF _TYPE ;
}
function isFragment ( object ) {
return typeOf ( object ) === REACT _FRAGMENT _TYPE ;
}
function isLazy ( object ) {
return typeOf ( object ) === REACT _LAZY _TYPE ;
}
function isMemo ( object ) {
return typeOf ( object ) === REACT _MEMO _TYPE ;
}
function isPortal ( object ) {
return typeOf ( object ) === REACT _PORTAL _TYPE ;
}
function isProfiler ( object ) {
return typeOf ( object ) === REACT _PROFILER _TYPE ;
}
function isStrictMode ( object ) {
return typeOf ( object ) === REACT _STRICT _MODE _TYPE ;
}
function isSuspense ( object ) {
return typeOf ( object ) === REACT _SUSPENSE _TYPE ;
}
2020-03-31 20:57:48 +08:00
exports . typeOf = typeOf ;
2020-01-28 13:08:03 +08:00
exports . AsyncMode = AsyncMode ;
exports . ConcurrentMode = ConcurrentMode ;
exports . ContextConsumer = ContextConsumer ;
exports . ContextProvider = ContextProvider ;
exports . Element = Element ;
exports . ForwardRef = ForwardRef ;
exports . Fragment = Fragment ;
exports . Lazy = Lazy ;
exports . Memo = Memo ;
exports . Portal = Portal ;
exports . Profiler = Profiler ;
exports . StrictMode = StrictMode ;
exports . Suspense = Suspense ;
2020-03-31 20:57:48 +08:00
exports . isValidElementType = isValidElementType ;
2020-01-28 13:08:03 +08:00
exports . isAsyncMode = isAsyncMode ;
exports . isConcurrentMode = isConcurrentMode ;
exports . isContextConsumer = isContextConsumer ;
exports . isContextProvider = isContextProvider ;
exports . isElement = isElement ;
exports . isForwardRef = isForwardRef ;
exports . isFragment = isFragment ;
exports . isLazy = isLazy ;
exports . isMemo = isMemo ;
exports . isPortal = isPortal ;
exports . isProfiler = isProfiler ;
exports . isStrictMode = isStrictMode ;
exports . isSuspense = isSuspense ;
} ) ( ) ;
}