react-is
Advanced tools
Comparing version 19.0.0-canary-2b036d3f1-20240327 to 19.0.0-canary-33a32441e9-20240418
@@ -40,14 +40,7 @@ /** | ||
var enableScopeAPI = false; // Experimental Create Event Handle API. | ||
var enableCacheElement = false; | ||
var enableTransitionTracing = false; // No known bugs, but needs performance testing | ||
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber | ||
// Ready for next major. | ||
// | ||
// Alias __NEXT_MAJOR__ to false for easier skimming. | ||
// ----------------------------------------------------------------------------- | ||
var __NEXT_MAJOR__ = false; // Removes legacy style context | ||
var enableRenderableContext = __NEXT_MAJOR__; // ----------------------------------------------------------------------------- | ||
var enableRenderableContext = true; // Enables the `initialValue` option for `useDeferredValue` | ||
// stuff. Intended to enable React core members to more easily debug scheduling | ||
@@ -65,3 +58,3 @@ // issues in DEV builds. | ||
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { | ||
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableTransitionTracing ) { | ||
return true; | ||
@@ -71,3 +64,3 @@ } | ||
if (typeof type === 'object' && type !== null) { | ||
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || !enableRenderableContext && type.$$typeof === REACT_PROVIDER_TYPE || enableRenderableContext && type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object | ||
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || !enableRenderableContext || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
@@ -111,3 +104,3 @@ // we don't know which Flight build this will end up being used | ||
case REACT_CONSUMER_TYPE: | ||
if (enableRenderableContext) { | ||
{ | ||
return $$typeofType; | ||
@@ -119,5 +112,2 @@ } | ||
case REACT_PROVIDER_TYPE: | ||
if (!enableRenderableContext) { | ||
return $$typeofType; | ||
} | ||
@@ -139,4 +129,4 @@ // Fall through | ||
} | ||
var ContextConsumer = enableRenderableContext ? REACT_CONSUMER_TYPE : REACT_CONTEXT_TYPE; | ||
var ContextProvider = enableRenderableContext ? REACT_CONTEXT_TYPE : REACT_PROVIDER_TYPE; | ||
var ContextConsumer = REACT_CONSUMER_TYPE ; | ||
var ContextProvider = REACT_CONTEXT_TYPE ; | ||
var Element = REACT_ELEMENT_TYPE; | ||
@@ -153,13 +143,9 @@ var ForwardRef = REACT_FORWARD_REF_TYPE; | ||
function isContextConsumer(object) { | ||
if (enableRenderableContext) { | ||
{ | ||
return typeOf(object) === REACT_CONSUMER_TYPE; | ||
} else { | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} | ||
} | ||
function isContextProvider(object) { | ||
if (enableRenderableContext) { | ||
{ | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} else { | ||
return typeOf(object) === REACT_PROVIDER_TYPE; | ||
} | ||
@@ -166,0 +152,0 @@ } |
@@ -36,14 +36,7 @@ /** | ||
const enableScopeAPI = false; // Experimental Create Event Handle API. | ||
const enableCacheElement = false; | ||
const enableTransitionTracing = false; // No known bugs, but needs performance testing | ||
const enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber | ||
// Ready for next major. | ||
// | ||
// Alias __NEXT_MAJOR__ to false for easier skimming. | ||
// ----------------------------------------------------------------------------- | ||
const __NEXT_MAJOR__ = false; // Removes legacy style context | ||
const enableRenderableContext = __NEXT_MAJOR__; // ----------------------------------------------------------------------------- | ||
const enableRenderableContext = true; // Enables the `initialValue` option for `useDeferredValue` | ||
// stuff. Intended to enable React core members to more easily debug scheduling | ||
@@ -61,3 +54,3 @@ // issues in DEV builds. | ||
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { | ||
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableTransitionTracing ) { | ||
return true; | ||
@@ -67,3 +60,3 @@ } | ||
if (typeof type === 'object' && type !== null) { | ||
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || !enableRenderableContext && type.$$typeof === REACT_PROVIDER_TYPE || enableRenderableContext && type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object | ||
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || !enableRenderableContext || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
@@ -107,3 +100,3 @@ // we don't know which Flight build this will end up being used | ||
case REACT_CONSUMER_TYPE: | ||
if (enableRenderableContext) { | ||
{ | ||
return $$typeofType; | ||
@@ -115,5 +108,2 @@ } | ||
case REACT_PROVIDER_TYPE: | ||
if (!enableRenderableContext) { | ||
return $$typeofType; | ||
} | ||
@@ -135,4 +125,4 @@ // Fall through | ||
} | ||
const ContextConsumer = enableRenderableContext ? REACT_CONSUMER_TYPE : REACT_CONTEXT_TYPE; | ||
const ContextProvider = enableRenderableContext ? REACT_CONTEXT_TYPE : REACT_PROVIDER_TYPE; | ||
const ContextConsumer = REACT_CONSUMER_TYPE ; | ||
const ContextProvider = REACT_CONTEXT_TYPE ; | ||
const Element = REACT_ELEMENT_TYPE; | ||
@@ -149,13 +139,9 @@ const ForwardRef = REACT_FORWARD_REF_TYPE; | ||
function isContextConsumer(object) { | ||
if (enableRenderableContext) { | ||
{ | ||
return typeOf(object) === REACT_CONSUMER_TYPE; | ||
} else { | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} | ||
} | ||
function isContextProvider(object) { | ||
if (enableRenderableContext) { | ||
{ | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} else { | ||
return typeOf(object) === REACT_PROVIDER_TYPE; | ||
} | ||
@@ -162,0 +148,0 @@ } |
@@ -10,7 +10,7 @@ /* | ||
*/ | ||
'use strict';var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.consumer"),k=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u=Symbol.for("react.client.reference"); | ||
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case l:case q:case p:return a;case h:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=k;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m; | ||
exports.SuspenseList=n;exports.isContextConsumer=function(a){return v(a)===k};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};exports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f}; | ||
exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===k||a.$$typeof===g||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v; | ||
'use strict';var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler");Symbol.for("react.provider");var g=Symbol.for("react.consumer"),h=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),n=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),t=Symbol.for("react.client.reference"); | ||
function u(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:return a;case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=g;exports.ContextProvider=h;exports.Element=b;exports.ForwardRef=k;exports.Fragment=d;exports.Lazy=p;exports.Memo=n;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=l; | ||
exports.SuspenseList=m;exports.isContextConsumer=function(a){return u(a)===g};exports.isContextProvider=function(a){return u(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return u(a)===k};exports.isFragment=function(a){return u(a)===d};exports.isLazy=function(a){return u(a)===p};exports.isMemo=function(a){return u(a)===n};exports.isPortal=function(a){return u(a)===c};exports.isProfiler=function(a){return u(a)===f}; | ||
exports.isStrictMode=function(a){return u(a)===e};exports.isSuspense=function(a){return u(a)===l};exports.isSuspenseList=function(a){return u(a)===m};exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===l||a===m||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===h||a.$$typeof===g||a.$$typeof===k||a.$$typeof===t||void 0!==a.getModuleId)?!0:!1};exports.typeOf=u; | ||
//# sourceMappingURL=react-is.production.min.js.map |
{ | ||
"name": "react-is", | ||
"version": "19.0.0-canary-2b036d3f1-20240327", | ||
"version": "19.0.0-canary-33a32441e9-20240418", | ||
"description": "Brand checking of React Elements.", | ||
@@ -24,5 +24,4 @@ "main": "index.js", | ||
"index.js", | ||
"cjs/", | ||
"umd/" | ||
"cjs/" | ||
] | ||
} |
@@ -43,3 +43,2 @@ # `react-is` | ||
ReactIs.isValidElementType(Context.Consumer); // true | ||
ReactIs.isValidElementType(React.createFactory("div")); // true | ||
``` | ||
@@ -46,0 +45,0 @@ |
Sorry, the diff of this file is not supported yet
24045
8
372
104