source: node_modules/react-dom/cjs/react-dom.development.js@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 17.3 KB
Line 
1/**
2 * @license React
3 * react-dom.development.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */
10
11"use strict";
12"production" !== process.env.NODE_ENV &&
13 (function () {
14 function noop() {}
15 function testStringCoercion(value) {
16 return "" + value;
17 }
18 function createPortal$1(children, containerInfo, implementation) {
19 var key =
20 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
21 try {
22 testStringCoercion(key);
23 var JSCompiler_inline_result = !1;
24 } catch (e) {
25 JSCompiler_inline_result = !0;
26 }
27 JSCompiler_inline_result &&
28 (console.error(
29 "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
30 ("function" === typeof Symbol &&
31 Symbol.toStringTag &&
32 key[Symbol.toStringTag]) ||
33 key.constructor.name ||
34 "Object"
35 ),
36 testStringCoercion(key));
37 return {
38 $$typeof: REACT_PORTAL_TYPE,
39 key: null == key ? null : "" + key,
40 children: children,
41 containerInfo: containerInfo,
42 implementation: implementation
43 };
44 }
45 function getCrossOriginStringAs(as, input) {
46 if ("font" === as) return "";
47 if ("string" === typeof input)
48 return "use-credentials" === input ? input : "";
49 }
50 function getValueDescriptorExpectingObjectForWarning(thing) {
51 return null === thing
52 ? "`null`"
53 : void 0 === thing
54 ? "`undefined`"
55 : "" === thing
56 ? "an empty string"
57 : 'something with type "' + typeof thing + '"';
58 }
59 function getValueDescriptorExpectingEnumForWarning(thing) {
60 return null === thing
61 ? "`null`"
62 : void 0 === thing
63 ? "`undefined`"
64 : "" === thing
65 ? "an empty string"
66 : "string" === typeof thing
67 ? JSON.stringify(thing)
68 : "number" === typeof thing
69 ? "`" + thing + "`"
70 : 'something with type "' + typeof thing + '"';
71 }
72 function resolveDispatcher() {
73 var dispatcher = ReactSharedInternals.H;
74 null === dispatcher &&
75 console.error(
76 "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
77 );
78 return dispatcher;
79 }
80 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
81 "function" ===
82 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
83 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
84 var React = require("react"),
85 Internals = {
86 d: {
87 f: noop,
88 r: function () {
89 throw Error(
90 "Invalid form element. requestFormReset must be passed a form that was rendered by React."
91 );
92 },
93 D: noop,
94 C: noop,
95 L: noop,
96 m: noop,
97 X: noop,
98 S: noop,
99 M: noop
100 },
101 p: 0,
102 findDOMNode: null
103 },
104 REACT_PORTAL_TYPE = Symbol.for("react.portal"),
105 ReactSharedInternals =
106 React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
107 ("function" === typeof Map &&
108 null != Map.prototype &&
109 "function" === typeof Map.prototype.forEach &&
110 "function" === typeof Set &&
111 null != Set.prototype &&
112 "function" === typeof Set.prototype.clear &&
113 "function" === typeof Set.prototype.forEach) ||
114 console.error(
115 "React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"
116 );
117 exports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
118 Internals;
119 exports.createPortal = function (children, container) {
120 var key =
121 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
122 if (
123 !container ||
124 (1 !== container.nodeType &&
125 9 !== container.nodeType &&
126 11 !== container.nodeType)
127 )
128 throw Error("Target container is not a DOM element.");
129 return createPortal$1(children, container, null, key);
130 };
131 exports.flushSync = function (fn) {
132 var previousTransition = ReactSharedInternals.T,
133 previousUpdatePriority = Internals.p;
134 try {
135 if (((ReactSharedInternals.T = null), (Internals.p = 2), fn))
136 return fn();
137 } finally {
138 (ReactSharedInternals.T = previousTransition),
139 (Internals.p = previousUpdatePriority),
140 Internals.d.f() &&
141 console.error(
142 "flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."
143 );
144 }
145 };
146 exports.preconnect = function (href, options) {
147 "string" === typeof href && href
148 ? null != options && "object" !== typeof options
149 ? console.error(
150 "ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",
151 getValueDescriptorExpectingEnumForWarning(options)
152 )
153 : null != options &&
154 "string" !== typeof options.crossOrigin &&
155 console.error(
156 "ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",
157 getValueDescriptorExpectingObjectForWarning(options.crossOrigin)
158 )
159 : console.error(
160 "ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
161 getValueDescriptorExpectingObjectForWarning(href)
162 );
163 "string" === typeof href &&
164 (options
165 ? ((options = options.crossOrigin),
166 (options =
167 "string" === typeof options
168 ? "use-credentials" === options
169 ? options
170 : ""
171 : void 0))
172 : (options = null),
173 Internals.d.C(href, options));
174 };
175 exports.prefetchDNS = function (href) {
176 if ("string" !== typeof href || !href)
177 console.error(
178 "ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
179 getValueDescriptorExpectingObjectForWarning(href)
180 );
181 else if (1 < arguments.length) {
182 var options = arguments[1];
183 "object" === typeof options && options.hasOwnProperty("crossOrigin")
184 ? console.error(
185 "ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
186 getValueDescriptorExpectingEnumForWarning(options)
187 )
188 : console.error(
189 "ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
190 getValueDescriptorExpectingEnumForWarning(options)
191 );
192 }
193 "string" === typeof href && Internals.d.D(href);
194 };
195 exports.preinit = function (href, options) {
196 "string" === typeof href && href
197 ? null == options || "object" !== typeof options
198 ? console.error(
199 "ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",
200 getValueDescriptorExpectingEnumForWarning(options)
201 )
202 : "style" !== options.as &&
203 "script" !== options.as &&
204 console.error(
205 'ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',
206 getValueDescriptorExpectingEnumForWarning(options.as)
207 )
208 : console.error(
209 "ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
210 getValueDescriptorExpectingObjectForWarning(href)
211 );
212 if (
213 "string" === typeof href &&
214 options &&
215 "string" === typeof options.as
216 ) {
217 var as = options.as,
218 crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),
219 integrity =
220 "string" === typeof options.integrity ? options.integrity : void 0,
221 fetchPriority =
222 "string" === typeof options.fetchPriority
223 ? options.fetchPriority
224 : void 0;
225 "style" === as
226 ? Internals.d.S(
227 href,
228 "string" === typeof options.precedence
229 ? options.precedence
230 : void 0,
231 {
232 crossOrigin: crossOrigin,
233 integrity: integrity,
234 fetchPriority: fetchPriority
235 }
236 )
237 : "script" === as &&
238 Internals.d.X(href, {
239 crossOrigin: crossOrigin,
240 integrity: integrity,
241 fetchPriority: fetchPriority,
242 nonce: "string" === typeof options.nonce ? options.nonce : void 0
243 });
244 }
245 };
246 exports.preinitModule = function (href, options) {
247 var encountered = "";
248 ("string" === typeof href && href) ||
249 (encountered +=
250 " The `href` argument encountered was " +
251 getValueDescriptorExpectingObjectForWarning(href) +
252 ".");
253 void 0 !== options && "object" !== typeof options
254 ? (encountered +=
255 " The `options` argument encountered was " +
256 getValueDescriptorExpectingObjectForWarning(options) +
257 ".")
258 : options &&
259 "as" in options &&
260 "script" !== options.as &&
261 (encountered +=
262 " The `as` option encountered was " +
263 getValueDescriptorExpectingEnumForWarning(options.as) +
264 ".");
265 if (encountered)
266 console.error(
267 "ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",
268 encountered
269 );
270 else
271 switch (
272 ((encountered =
273 options && "string" === typeof options.as ? options.as : "script"),
274 encountered)
275 ) {
276 case "script":
277 break;
278 default:
279 (encountered =
280 getValueDescriptorExpectingEnumForWarning(encountered)),
281 console.error(
282 'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',
283 encountered,
284 href
285 );
286 }
287 if ("string" === typeof href)
288 if ("object" === typeof options && null !== options) {
289 if (null == options.as || "script" === options.as)
290 (encountered = getCrossOriginStringAs(
291 options.as,
292 options.crossOrigin
293 )),
294 Internals.d.M(href, {
295 crossOrigin: encountered,
296 integrity:
297 "string" === typeof options.integrity
298 ? options.integrity
299 : void 0,
300 nonce:
301 "string" === typeof options.nonce ? options.nonce : void 0
302 });
303 } else null == options && Internals.d.M(href);
304 };
305 exports.preload = function (href, options) {
306 var encountered = "";
307 ("string" === typeof href && href) ||
308 (encountered +=
309 " The `href` argument encountered was " +
310 getValueDescriptorExpectingObjectForWarning(href) +
311 ".");
312 null == options || "object" !== typeof options
313 ? (encountered +=
314 " The `options` argument encountered was " +
315 getValueDescriptorExpectingObjectForWarning(options) +
316 ".")
317 : ("string" === typeof options.as && options.as) ||
318 (encountered +=
319 " The `as` option encountered was " +
320 getValueDescriptorExpectingObjectForWarning(options.as) +
321 ".");
322 encountered &&
323 console.error(
324 'ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',
325 encountered
326 );
327 if (
328 "string" === typeof href &&
329 "object" === typeof options &&
330 null !== options &&
331 "string" === typeof options.as
332 ) {
333 encountered = options.as;
334 var crossOrigin = getCrossOriginStringAs(
335 encountered,
336 options.crossOrigin
337 );
338 Internals.d.L(href, encountered, {
339 crossOrigin: crossOrigin,
340 integrity:
341 "string" === typeof options.integrity ? options.integrity : void 0,
342 nonce: "string" === typeof options.nonce ? options.nonce : void 0,
343 type: "string" === typeof options.type ? options.type : void 0,
344 fetchPriority:
345 "string" === typeof options.fetchPriority
346 ? options.fetchPriority
347 : void 0,
348 referrerPolicy:
349 "string" === typeof options.referrerPolicy
350 ? options.referrerPolicy
351 : void 0,
352 imageSrcSet:
353 "string" === typeof options.imageSrcSet
354 ? options.imageSrcSet
355 : void 0,
356 imageSizes:
357 "string" === typeof options.imageSizes
358 ? options.imageSizes
359 : void 0,
360 media: "string" === typeof options.media ? options.media : void 0
361 });
362 }
363 };
364 exports.preloadModule = function (href, options) {
365 var encountered = "";
366 ("string" === typeof href && href) ||
367 (encountered +=
368 " The `href` argument encountered was " +
369 getValueDescriptorExpectingObjectForWarning(href) +
370 ".");
371 void 0 !== options && "object" !== typeof options
372 ? (encountered +=
373 " The `options` argument encountered was " +
374 getValueDescriptorExpectingObjectForWarning(options) +
375 ".")
376 : options &&
377 "as" in options &&
378 "string" !== typeof options.as &&
379 (encountered +=
380 " The `as` option encountered was " +
381 getValueDescriptorExpectingObjectForWarning(options.as) +
382 ".");
383 encountered &&
384 console.error(
385 'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',
386 encountered
387 );
388 "string" === typeof href &&
389 (options
390 ? ((encountered = getCrossOriginStringAs(
391 options.as,
392 options.crossOrigin
393 )),
394 Internals.d.m(href, {
395 as:
396 "string" === typeof options.as && "script" !== options.as
397 ? options.as
398 : void 0,
399 crossOrigin: encountered,
400 integrity:
401 "string" === typeof options.integrity
402 ? options.integrity
403 : void 0
404 }))
405 : Internals.d.m(href));
406 };
407 exports.requestFormReset = function (form) {
408 Internals.d.r(form);
409 };
410 exports.unstable_batchedUpdates = function (fn, a) {
411 return fn(a);
412 };
413 exports.useFormState = function (action, initialState, permalink) {
414 return resolveDispatcher().useFormState(action, initialState, permalink);
415 };
416 exports.useFormStatus = function () {
417 return resolveDispatcher().useHostTransitionStatus();
418 };
419 exports.version = "19.2.3";
420 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
421 "function" ===
422 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
423 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
424 })();
Note: See TracBrowser for help on using the repository browser.