Projekt

Obecné

Profil

Stáhnout (7.31 KB) Statistiky
| Větev: | Revize:
1
/** @license React v16.13.1
2
 * react-is.development.js
3
 *
4
 * Copyright (c) Facebook, Inc. and its affiliates.
5
 *
6
 * This source code is licensed under the MIT license found in the
7
 * LICENSE file in the root directory of this source tree.
8
 */
9

    
10
'use strict';
11

    
12
(function (global, factory) {
13
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
14
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
15
  (global = global || self, factory(global.ReactIs = {}));
16
}(this, (function (exports) { 'use strict';
17

    
18
  // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
19
  // nor polyfill, then a plain number is used for performance.
20
  var hasSymbol = typeof Symbol === 'function' && Symbol.for;
21
  var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
22
  var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
23
  var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
24
  var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
25
  var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
26
  var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
27
  var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
28
  // (unstable) APIs that have been removed. Can we remove the symbols?
29

    
30
  var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
31
  var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
32
  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
33
  var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
34
  var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
35
  var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
36
  var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
37
  var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
38
  var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
39
  var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
40
  var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
41

    
42
  function isValidElementType(type) {
43
    return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
44
    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 || type.$$typeof === REACT_BLOCK_TYPE);
45
  }
46

    
47
  function typeOf(object) {
48
    if (typeof object === 'object' && object !== null) {
49
      var $$typeof = object.$$typeof;
50

    
51
      switch ($$typeof) {
52
        case REACT_ELEMENT_TYPE:
53
          var type = object.type;
54

    
55
          switch (type) {
56
            case REACT_ASYNC_MODE_TYPE:
57
            case REACT_CONCURRENT_MODE_TYPE:
58
            case REACT_FRAGMENT_TYPE:
59
            case REACT_PROFILER_TYPE:
60
            case REACT_STRICT_MODE_TYPE:
61
            case REACT_SUSPENSE_TYPE:
62
              return type;
63

    
64
            default:
65
              var $$typeofType = type && type.$$typeof;
66

    
67
              switch ($$typeofType) {
68
                case REACT_CONTEXT_TYPE:
69
                case REACT_FORWARD_REF_TYPE:
70
                case REACT_LAZY_TYPE:
71
                case REACT_MEMO_TYPE:
72
                case REACT_PROVIDER_TYPE:
73
                  return $$typeofType;
74

    
75
                default:
76
                  return $$typeof;
77
              }
78

    
79
          }
80

    
81
        case REACT_PORTAL_TYPE:
82
          return $$typeof;
83
      }
84
    }
85

    
86
    return undefined;
87
  } // AsyncMode is deprecated along with isAsyncMode
88

    
89
  var AsyncMode = REACT_ASYNC_MODE_TYPE;
90
  var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
91
  var ContextConsumer = REACT_CONTEXT_TYPE;
92
  var ContextProvider = REACT_PROVIDER_TYPE;
93
  var Element = REACT_ELEMENT_TYPE;
94
  var ForwardRef = REACT_FORWARD_REF_TYPE;
95
  var Fragment = REACT_FRAGMENT_TYPE;
96
  var Lazy = REACT_LAZY_TYPE;
97
  var Memo = REACT_MEMO_TYPE;
98
  var Portal = REACT_PORTAL_TYPE;
99
  var Profiler = REACT_PROFILER_TYPE;
100
  var StrictMode = REACT_STRICT_MODE_TYPE;
101
  var Suspense = REACT_SUSPENSE_TYPE;
102
  var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
103

    
104
  function isAsyncMode(object) {
105
    {
106
      if (!hasWarnedAboutDeprecatedIsAsyncMode) {
107
        hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
108

    
109
        console['warn']('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.');
110
      }
111
    }
112

    
113
    return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
114
  }
115
  function isConcurrentMode(object) {
116
    return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
117
  }
118
  function isContextConsumer(object) {
119
    return typeOf(object) === REACT_CONTEXT_TYPE;
120
  }
121
  function isContextProvider(object) {
122
    return typeOf(object) === REACT_PROVIDER_TYPE;
123
  }
124
  function isElement(object) {
125
    return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
126
  }
127
  function isForwardRef(object) {
128
    return typeOf(object) === REACT_FORWARD_REF_TYPE;
129
  }
130
  function isFragment(object) {
131
    return typeOf(object) === REACT_FRAGMENT_TYPE;
132
  }
133
  function isLazy(object) {
134
    return typeOf(object) === REACT_LAZY_TYPE;
135
  }
136
  function isMemo(object) {
137
    return typeOf(object) === REACT_MEMO_TYPE;
138
  }
139
  function isPortal(object) {
140
    return typeOf(object) === REACT_PORTAL_TYPE;
141
  }
142
  function isProfiler(object) {
143
    return typeOf(object) === REACT_PROFILER_TYPE;
144
  }
145
  function isStrictMode(object) {
146
    return typeOf(object) === REACT_STRICT_MODE_TYPE;
147
  }
148
  function isSuspense(object) {
149
    return typeOf(object) === REACT_SUSPENSE_TYPE;
150
  }
151

    
152
  exports.AsyncMode = AsyncMode;
153
  exports.ConcurrentMode = ConcurrentMode;
154
  exports.ContextConsumer = ContextConsumer;
155
  exports.ContextProvider = ContextProvider;
156
  exports.Element = Element;
157
  exports.ForwardRef = ForwardRef;
158
  exports.Fragment = Fragment;
159
  exports.Lazy = Lazy;
160
  exports.Memo = Memo;
161
  exports.Portal = Portal;
162
  exports.Profiler = Profiler;
163
  exports.StrictMode = StrictMode;
164
  exports.Suspense = Suspense;
165
  exports.isAsyncMode = isAsyncMode;
166
  exports.isConcurrentMode = isConcurrentMode;
167
  exports.isContextConsumer = isContextConsumer;
168
  exports.isContextProvider = isContextProvider;
169
  exports.isElement = isElement;
170
  exports.isForwardRef = isForwardRef;
171
  exports.isFragment = isFragment;
172
  exports.isLazy = isLazy;
173
  exports.isMemo = isMemo;
174
  exports.isPortal = isPortal;
175
  exports.isProfiler = isProfiler;
176
  exports.isStrictMode = isStrictMode;
177
  exports.isSuspense = isSuspense;
178
  exports.isValidElementType = isValidElementType;
179
  exports.typeOf = typeOf;
180

    
181
})));
(1-1/2)