add hw2
This commit is contained in:
201
node_modules/@react-aria/ssr/LICENSE
generated
vendored
Normal file
201
node_modules/@react-aria/ssr/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Adobe
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
3
node_modules/@react-aria/ssr/README.md
generated
vendored
Normal file
3
node_modules/@react-aria/ssr/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# @react-aria/ssr
|
||||
|
||||
This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
|
||||
154
node_modules/@react-aria/ssr/dist/SSRProvider.main.js
generated
vendored
Normal file
154
node_modules/@react-aria/ssr/dist/SSRProvider.main.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
var $14Xyt$react = require("react");
|
||||
|
||||
|
||||
function $parcel$interopDefault(a) {
|
||||
return a && a.__esModule ? a.default : a;
|
||||
}
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "SSRProvider", () => $97d95f6660b1bb14$export$9f8ac96af4b1b2ae);
|
||||
$parcel$export(module.exports, "useIsSSR", () => $97d95f6660b1bb14$export$535bd6ca7f90a273);
|
||||
$parcel$export(module.exports, "useSSRSafeId", () => $97d95f6660b1bb14$export$619500959fc48b26);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is
|
||||
// guarded by a check that it only runs on the client side.
|
||||
// eslint-disable-next-line rulesdir/useLayoutEffectRule
|
||||
|
||||
// Default context value to use in case there is no SSRProvider. This is fine for
|
||||
// client-only apps. In order to support multiple copies of React Aria potentially
|
||||
// being on the page at once, the prefix is set to a random number. SSRProvider
|
||||
// will reset this to zero for consistency between server and client, so in the
|
||||
// SSR case multiple copies of React Aria is not supported.
|
||||
const $97d95f6660b1bb14$var$defaultContext = {
|
||||
prefix: String(Math.round(Math.random() * 10000000000)),
|
||||
current: 0
|
||||
};
|
||||
const $97d95f6660b1bb14$var$SSRContext = /*#__PURE__*/ (0, ($parcel$interopDefault($14Xyt$react))).createContext($97d95f6660b1bb14$var$defaultContext);
|
||||
const $97d95f6660b1bb14$var$IsSSRContext = /*#__PURE__*/ (0, ($parcel$interopDefault($14Xyt$react))).createContext(false);
|
||||
// This is only used in React < 18.
|
||||
function $97d95f6660b1bb14$var$LegacySSRProvider(props) {
|
||||
let cur = (0, $14Xyt$react.useContext)($97d95f6660b1bb14$var$SSRContext);
|
||||
let counter = $97d95f6660b1bb14$var$useCounter(cur === $97d95f6660b1bb14$var$defaultContext);
|
||||
let [isSSR, setIsSSR] = (0, $14Xyt$react.useState)(true);
|
||||
let value = (0, $14Xyt$react.useMemo)(()=>({
|
||||
// If this is the first SSRProvider, start with an empty string prefix, otherwise
|
||||
// append and increment the counter.
|
||||
prefix: cur === $97d95f6660b1bb14$var$defaultContext ? '' : `${cur.prefix}-${counter}`,
|
||||
current: 0
|
||||
}), [
|
||||
cur,
|
||||
counter
|
||||
]);
|
||||
// If on the client, and the component was initially server rendered,
|
||||
// then schedule a layout effect to update the component after hydration.
|
||||
if (typeof document !== 'undefined') // This if statement technically breaks the rules of hooks, but is safe
|
||||
// because the condition never changes after mounting.
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
(0, $14Xyt$react.useLayoutEffect)(()=>{
|
||||
setIsSSR(false);
|
||||
}, []);
|
||||
return /*#__PURE__*/ (0, ($parcel$interopDefault($14Xyt$react))).createElement($97d95f6660b1bb14$var$SSRContext.Provider, {
|
||||
value: value
|
||||
}, /*#__PURE__*/ (0, ($parcel$interopDefault($14Xyt$react))).createElement($97d95f6660b1bb14$var$IsSSRContext.Provider, {
|
||||
value: isSSR
|
||||
}, props.children));
|
||||
}
|
||||
let $97d95f6660b1bb14$var$warnedAboutSSRProvider = false;
|
||||
function $97d95f6660b1bb14$export$9f8ac96af4b1b2ae(props) {
|
||||
if (typeof (0, ($parcel$interopDefault($14Xyt$react)))['useId'] === 'function') {
|
||||
if (process.env.NODE_ENV !== 'test' && process.env.NODE_ENV !== 'production' && !$97d95f6660b1bb14$var$warnedAboutSSRProvider) {
|
||||
console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');
|
||||
$97d95f6660b1bb14$var$warnedAboutSSRProvider = true;
|
||||
}
|
||||
return /*#__PURE__*/ (0, ($parcel$interopDefault($14Xyt$react))).createElement((0, ($parcel$interopDefault($14Xyt$react))).Fragment, null, props.children);
|
||||
}
|
||||
return /*#__PURE__*/ (0, ($parcel$interopDefault($14Xyt$react))).createElement($97d95f6660b1bb14$var$LegacySSRProvider, props);
|
||||
}
|
||||
let $97d95f6660b1bb14$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
let $97d95f6660b1bb14$var$componentIds = new WeakMap();
|
||||
function $97d95f6660b1bb14$var$useCounter(isDisabled = false) {
|
||||
let ctx = (0, $14Xyt$react.useContext)($97d95f6660b1bb14$var$SSRContext);
|
||||
let ref = (0, $14Xyt$react.useRef)(null);
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
if (ref.current === null && !isDisabled) {
|
||||
var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
||||
// In strict mode, React renders components twice, and the ref will be reset to null on the second render.
|
||||
// This means our id counter will be incremented twice instead of once. This is a problem because on the
|
||||
// server, components are only rendered once and so ids generated on the server won't match the client.
|
||||
// In React 18, useId was introduced to solve this, but it is not available in older versions. So to solve this
|
||||
// we need to use some React internals to access the underlying Fiber instance, which is stable between renders.
|
||||
// This is exposed as ReactCurrentOwner in development, which is all we need since StrictMode only runs in development.
|
||||
// To ensure that we only increment the global counter once, we store the starting id for this component in
|
||||
// a weak map associated with the Fiber. On the second render, we reset the global counter to this value.
|
||||
// Since React runs the second render immediately after the first, this is safe.
|
||||
// @ts-ignore
|
||||
let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = (0, ($parcel$interopDefault($14Xyt$react))).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
|
||||
if (currentOwner) {
|
||||
let prevComponentValue = $97d95f6660b1bb14$var$componentIds.get(currentOwner);
|
||||
if (prevComponentValue == null) // On the first render, and first call to useId, store the id and state in our weak map.
|
||||
$97d95f6660b1bb14$var$componentIds.set(currentOwner, {
|
||||
id: ctx.current,
|
||||
state: currentOwner.memoizedState
|
||||
});
|
||||
else if (currentOwner.memoizedState !== prevComponentValue.state) {
|
||||
// On the second render, the memoizedState gets reset by React.
|
||||
// Reset the counter, and remove from the weak map so we don't
|
||||
// do this for subsequent useId calls.
|
||||
ctx.current = prevComponentValue.id;
|
||||
$97d95f6660b1bb14$var$componentIds.delete(currentOwner);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
ref.current = ++ctx.current;
|
||||
}
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
return ref.current;
|
||||
}
|
||||
function $97d95f6660b1bb14$var$useLegacySSRSafeId(defaultId) {
|
||||
let ctx = (0, $14Xyt$react.useContext)($97d95f6660b1bb14$var$SSRContext);
|
||||
// If we are rendering in a non-DOM environment, and there's no SSRProvider,
|
||||
// provide a warning to hint to the developer to add one.
|
||||
if (ctx === $97d95f6660b1bb14$var$defaultContext && !$97d95f6660b1bb14$var$canUseDOM && process.env.NODE_ENV !== 'production') console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');
|
||||
let counter = $97d95f6660b1bb14$var$useCounter(!!defaultId);
|
||||
let prefix = ctx === $97d95f6660b1bb14$var$defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;
|
||||
return defaultId || `${prefix}-${counter}`;
|
||||
}
|
||||
function $97d95f6660b1bb14$var$useModernSSRSafeId(defaultId) {
|
||||
let id = (0, ($parcel$interopDefault($14Xyt$react))).useId();
|
||||
let [didSSR] = (0, $14Xyt$react.useState)($97d95f6660b1bb14$export$535bd6ca7f90a273());
|
||||
let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${$97d95f6660b1bb14$var$defaultContext.prefix}`;
|
||||
return defaultId || `${prefix}-${id}`;
|
||||
}
|
||||
const $97d95f6660b1bb14$export$619500959fc48b26 = typeof (0, ($parcel$interopDefault($14Xyt$react)))['useId'] === 'function' ? $97d95f6660b1bb14$var$useModernSSRSafeId : $97d95f6660b1bb14$var$useLegacySSRSafeId;
|
||||
function $97d95f6660b1bb14$var$getSnapshot() {
|
||||
return false;
|
||||
}
|
||||
function $97d95f6660b1bb14$var$getServerSnapshot() {
|
||||
return true;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function $97d95f6660b1bb14$var$subscribe(onStoreChange) {
|
||||
// noop
|
||||
return ()=>{};
|
||||
}
|
||||
function $97d95f6660b1bb14$export$535bd6ca7f90a273() {
|
||||
// In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
|
||||
if (typeof (0, ($parcel$interopDefault($14Xyt$react)))['useSyncExternalStore'] === 'function') return (0, ($parcel$interopDefault($14Xyt$react)))['useSyncExternalStore']($97d95f6660b1bb14$var$subscribe, $97d95f6660b1bb14$var$getSnapshot, $97d95f6660b1bb14$var$getServerSnapshot);
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
return (0, $14Xyt$react.useContext)($97d95f6660b1bb14$var$IsSSRContext);
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=SSRProvider.main.js.map
|
||||
1
node_modules/@react-aria/ssr/dist/SSRProvider.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/ssr/dist/SSRProvider.main.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
143
node_modules/@react-aria/ssr/dist/SSRProvider.mjs
generated
vendored
Normal file
143
node_modules/@react-aria/ssr/dist/SSRProvider.mjs
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
import $670gB$react, {useContext as $670gB$useContext, useState as $670gB$useState, useMemo as $670gB$useMemo, useLayoutEffect as $670gB$useLayoutEffect, useRef as $670gB$useRef} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is
|
||||
// guarded by a check that it only runs on the client side.
|
||||
// eslint-disable-next-line rulesdir/useLayoutEffectRule
|
||||
|
||||
// Default context value to use in case there is no SSRProvider. This is fine for
|
||||
// client-only apps. In order to support multiple copies of React Aria potentially
|
||||
// being on the page at once, the prefix is set to a random number. SSRProvider
|
||||
// will reset this to zero for consistency between server and client, so in the
|
||||
// SSR case multiple copies of React Aria is not supported.
|
||||
const $b5e257d569688ac6$var$defaultContext = {
|
||||
prefix: String(Math.round(Math.random() * 10000000000)),
|
||||
current: 0
|
||||
};
|
||||
const $b5e257d569688ac6$var$SSRContext = /*#__PURE__*/ (0, $670gB$react).createContext($b5e257d569688ac6$var$defaultContext);
|
||||
const $b5e257d569688ac6$var$IsSSRContext = /*#__PURE__*/ (0, $670gB$react).createContext(false);
|
||||
// This is only used in React < 18.
|
||||
function $b5e257d569688ac6$var$LegacySSRProvider(props) {
|
||||
let cur = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
||||
let counter = $b5e257d569688ac6$var$useCounter(cur === $b5e257d569688ac6$var$defaultContext);
|
||||
let [isSSR, setIsSSR] = (0, $670gB$useState)(true);
|
||||
let value = (0, $670gB$useMemo)(()=>({
|
||||
// If this is the first SSRProvider, start with an empty string prefix, otherwise
|
||||
// append and increment the counter.
|
||||
prefix: cur === $b5e257d569688ac6$var$defaultContext ? '' : `${cur.prefix}-${counter}`,
|
||||
current: 0
|
||||
}), [
|
||||
cur,
|
||||
counter
|
||||
]);
|
||||
// If on the client, and the component was initially server rendered,
|
||||
// then schedule a layout effect to update the component after hydration.
|
||||
if (typeof document !== 'undefined') // This if statement technically breaks the rules of hooks, but is safe
|
||||
// because the condition never changes after mounting.
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
(0, $670gB$useLayoutEffect)(()=>{
|
||||
setIsSSR(false);
|
||||
}, []);
|
||||
return /*#__PURE__*/ (0, $670gB$react).createElement($b5e257d569688ac6$var$SSRContext.Provider, {
|
||||
value: value
|
||||
}, /*#__PURE__*/ (0, $670gB$react).createElement($b5e257d569688ac6$var$IsSSRContext.Provider, {
|
||||
value: isSSR
|
||||
}, props.children));
|
||||
}
|
||||
let $b5e257d569688ac6$var$warnedAboutSSRProvider = false;
|
||||
function $b5e257d569688ac6$export$9f8ac96af4b1b2ae(props) {
|
||||
if (typeof (0, $670gB$react)['useId'] === 'function') {
|
||||
if (process.env.NODE_ENV !== 'test' && process.env.NODE_ENV !== 'production' && !$b5e257d569688ac6$var$warnedAboutSSRProvider) {
|
||||
console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');
|
||||
$b5e257d569688ac6$var$warnedAboutSSRProvider = true;
|
||||
}
|
||||
return /*#__PURE__*/ (0, $670gB$react).createElement((0, $670gB$react).Fragment, null, props.children);
|
||||
}
|
||||
return /*#__PURE__*/ (0, $670gB$react).createElement($b5e257d569688ac6$var$LegacySSRProvider, props);
|
||||
}
|
||||
let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
let $b5e257d569688ac6$var$componentIds = new WeakMap();
|
||||
function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
|
||||
let ctx = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
||||
let ref = (0, $670gB$useRef)(null);
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
if (ref.current === null && !isDisabled) {
|
||||
var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
||||
// In strict mode, React renders components twice, and the ref will be reset to null on the second render.
|
||||
// This means our id counter will be incremented twice instead of once. This is a problem because on the
|
||||
// server, components are only rendered once and so ids generated on the server won't match the client.
|
||||
// In React 18, useId was introduced to solve this, but it is not available in older versions. So to solve this
|
||||
// we need to use some React internals to access the underlying Fiber instance, which is stable between renders.
|
||||
// This is exposed as ReactCurrentOwner in development, which is all we need since StrictMode only runs in development.
|
||||
// To ensure that we only increment the global counter once, we store the starting id for this component in
|
||||
// a weak map associated with the Fiber. On the second render, we reset the global counter to this value.
|
||||
// Since React runs the second render immediately after the first, this is safe.
|
||||
// @ts-ignore
|
||||
let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = (0, $670gB$react).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
|
||||
if (currentOwner) {
|
||||
let prevComponentValue = $b5e257d569688ac6$var$componentIds.get(currentOwner);
|
||||
if (prevComponentValue == null) // On the first render, and first call to useId, store the id and state in our weak map.
|
||||
$b5e257d569688ac6$var$componentIds.set(currentOwner, {
|
||||
id: ctx.current,
|
||||
state: currentOwner.memoizedState
|
||||
});
|
||||
else if (currentOwner.memoizedState !== prevComponentValue.state) {
|
||||
// On the second render, the memoizedState gets reset by React.
|
||||
// Reset the counter, and remove from the weak map so we don't
|
||||
// do this for subsequent useId calls.
|
||||
ctx.current = prevComponentValue.id;
|
||||
$b5e257d569688ac6$var$componentIds.delete(currentOwner);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
ref.current = ++ctx.current;
|
||||
}
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
return ref.current;
|
||||
}
|
||||
function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) {
|
||||
let ctx = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
||||
// If we are rendering in a non-DOM environment, and there's no SSRProvider,
|
||||
// provide a warning to hint to the developer to add one.
|
||||
if (ctx === $b5e257d569688ac6$var$defaultContext && !$b5e257d569688ac6$var$canUseDOM && process.env.NODE_ENV !== 'production') console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');
|
||||
let counter = $b5e257d569688ac6$var$useCounter(!!defaultId);
|
||||
let prefix = ctx === $b5e257d569688ac6$var$defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;
|
||||
return defaultId || `${prefix}-${counter}`;
|
||||
}
|
||||
function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) {
|
||||
let id = (0, $670gB$react).useId();
|
||||
let [didSSR] = (0, $670gB$useState)($b5e257d569688ac6$export$535bd6ca7f90a273());
|
||||
let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`;
|
||||
return defaultId || `${prefix}-${id}`;
|
||||
}
|
||||
const $b5e257d569688ac6$export$619500959fc48b26 = typeof (0, $670gB$react)['useId'] === 'function' ? $b5e257d569688ac6$var$useModernSSRSafeId : $b5e257d569688ac6$var$useLegacySSRSafeId;
|
||||
function $b5e257d569688ac6$var$getSnapshot() {
|
||||
return false;
|
||||
}
|
||||
function $b5e257d569688ac6$var$getServerSnapshot() {
|
||||
return true;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function $b5e257d569688ac6$var$subscribe(onStoreChange) {
|
||||
// noop
|
||||
return ()=>{};
|
||||
}
|
||||
function $b5e257d569688ac6$export$535bd6ca7f90a273() {
|
||||
// In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
|
||||
if (typeof (0, $670gB$react)['useSyncExternalStore'] === 'function') return (0, $670gB$react)['useSyncExternalStore']($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
return (0, $670gB$useContext)($b5e257d569688ac6$var$IsSSRContext);
|
||||
}
|
||||
|
||||
|
||||
export {$b5e257d569688ac6$export$9f8ac96af4b1b2ae as SSRProvider, $b5e257d569688ac6$export$535bd6ca7f90a273 as useIsSSR, $b5e257d569688ac6$export$619500959fc48b26 as useSSRSafeId};
|
||||
//# sourceMappingURL=SSRProvider.module.js.map
|
||||
143
node_modules/@react-aria/ssr/dist/SSRProvider.module.js
generated
vendored
Normal file
143
node_modules/@react-aria/ssr/dist/SSRProvider.module.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
import $670gB$react, {useContext as $670gB$useContext, useState as $670gB$useState, useMemo as $670gB$useMemo, useLayoutEffect as $670gB$useLayoutEffect, useRef as $670gB$useRef} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is
|
||||
// guarded by a check that it only runs on the client side.
|
||||
// eslint-disable-next-line rulesdir/useLayoutEffectRule
|
||||
|
||||
// Default context value to use in case there is no SSRProvider. This is fine for
|
||||
// client-only apps. In order to support multiple copies of React Aria potentially
|
||||
// being on the page at once, the prefix is set to a random number. SSRProvider
|
||||
// will reset this to zero for consistency between server and client, so in the
|
||||
// SSR case multiple copies of React Aria is not supported.
|
||||
const $b5e257d569688ac6$var$defaultContext = {
|
||||
prefix: String(Math.round(Math.random() * 10000000000)),
|
||||
current: 0
|
||||
};
|
||||
const $b5e257d569688ac6$var$SSRContext = /*#__PURE__*/ (0, $670gB$react).createContext($b5e257d569688ac6$var$defaultContext);
|
||||
const $b5e257d569688ac6$var$IsSSRContext = /*#__PURE__*/ (0, $670gB$react).createContext(false);
|
||||
// This is only used in React < 18.
|
||||
function $b5e257d569688ac6$var$LegacySSRProvider(props) {
|
||||
let cur = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
||||
let counter = $b5e257d569688ac6$var$useCounter(cur === $b5e257d569688ac6$var$defaultContext);
|
||||
let [isSSR, setIsSSR] = (0, $670gB$useState)(true);
|
||||
let value = (0, $670gB$useMemo)(()=>({
|
||||
// If this is the first SSRProvider, start with an empty string prefix, otherwise
|
||||
// append and increment the counter.
|
||||
prefix: cur === $b5e257d569688ac6$var$defaultContext ? '' : `${cur.prefix}-${counter}`,
|
||||
current: 0
|
||||
}), [
|
||||
cur,
|
||||
counter
|
||||
]);
|
||||
// If on the client, and the component was initially server rendered,
|
||||
// then schedule a layout effect to update the component after hydration.
|
||||
if (typeof document !== 'undefined') // This if statement technically breaks the rules of hooks, but is safe
|
||||
// because the condition never changes after mounting.
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
(0, $670gB$useLayoutEffect)(()=>{
|
||||
setIsSSR(false);
|
||||
}, []);
|
||||
return /*#__PURE__*/ (0, $670gB$react).createElement($b5e257d569688ac6$var$SSRContext.Provider, {
|
||||
value: value
|
||||
}, /*#__PURE__*/ (0, $670gB$react).createElement($b5e257d569688ac6$var$IsSSRContext.Provider, {
|
||||
value: isSSR
|
||||
}, props.children));
|
||||
}
|
||||
let $b5e257d569688ac6$var$warnedAboutSSRProvider = false;
|
||||
function $b5e257d569688ac6$export$9f8ac96af4b1b2ae(props) {
|
||||
if (typeof (0, $670gB$react)['useId'] === 'function') {
|
||||
if (process.env.NODE_ENV !== 'test' && process.env.NODE_ENV !== 'production' && !$b5e257d569688ac6$var$warnedAboutSSRProvider) {
|
||||
console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');
|
||||
$b5e257d569688ac6$var$warnedAboutSSRProvider = true;
|
||||
}
|
||||
return /*#__PURE__*/ (0, $670gB$react).createElement((0, $670gB$react).Fragment, null, props.children);
|
||||
}
|
||||
return /*#__PURE__*/ (0, $670gB$react).createElement($b5e257d569688ac6$var$LegacySSRProvider, props);
|
||||
}
|
||||
let $b5e257d569688ac6$var$canUseDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
let $b5e257d569688ac6$var$componentIds = new WeakMap();
|
||||
function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
|
||||
let ctx = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
||||
let ref = (0, $670gB$useRef)(null);
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
if (ref.current === null && !isDisabled) {
|
||||
var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
||||
// In strict mode, React renders components twice, and the ref will be reset to null on the second render.
|
||||
// This means our id counter will be incremented twice instead of once. This is a problem because on the
|
||||
// server, components are only rendered once and so ids generated on the server won't match the client.
|
||||
// In React 18, useId was introduced to solve this, but it is not available in older versions. So to solve this
|
||||
// we need to use some React internals to access the underlying Fiber instance, which is stable between renders.
|
||||
// This is exposed as ReactCurrentOwner in development, which is all we need since StrictMode only runs in development.
|
||||
// To ensure that we only increment the global counter once, we store the starting id for this component in
|
||||
// a weak map associated with the Fiber. On the second render, we reset the global counter to this value.
|
||||
// Since React runs the second render immediately after the first, this is safe.
|
||||
// @ts-ignore
|
||||
let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = (0, $670gB$react).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
|
||||
if (currentOwner) {
|
||||
let prevComponentValue = $b5e257d569688ac6$var$componentIds.get(currentOwner);
|
||||
if (prevComponentValue == null) // On the first render, and first call to useId, store the id and state in our weak map.
|
||||
$b5e257d569688ac6$var$componentIds.set(currentOwner, {
|
||||
id: ctx.current,
|
||||
state: currentOwner.memoizedState
|
||||
});
|
||||
else if (currentOwner.memoizedState !== prevComponentValue.state) {
|
||||
// On the second render, the memoizedState gets reset by React.
|
||||
// Reset the counter, and remove from the weak map so we don't
|
||||
// do this for subsequent useId calls.
|
||||
ctx.current = prevComponentValue.id;
|
||||
$b5e257d569688ac6$var$componentIds.delete(currentOwner);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
ref.current = ++ctx.current;
|
||||
}
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
return ref.current;
|
||||
}
|
||||
function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) {
|
||||
let ctx = (0, $670gB$useContext)($b5e257d569688ac6$var$SSRContext);
|
||||
// If we are rendering in a non-DOM environment, and there's no SSRProvider,
|
||||
// provide a warning to hint to the developer to add one.
|
||||
if (ctx === $b5e257d569688ac6$var$defaultContext && !$b5e257d569688ac6$var$canUseDOM && process.env.NODE_ENV !== 'production') console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');
|
||||
let counter = $b5e257d569688ac6$var$useCounter(!!defaultId);
|
||||
let prefix = ctx === $b5e257d569688ac6$var$defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;
|
||||
return defaultId || `${prefix}-${counter}`;
|
||||
}
|
||||
function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) {
|
||||
let id = (0, $670gB$react).useId();
|
||||
let [didSSR] = (0, $670gB$useState)($b5e257d569688ac6$export$535bd6ca7f90a273());
|
||||
let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`;
|
||||
return defaultId || `${prefix}-${id}`;
|
||||
}
|
||||
const $b5e257d569688ac6$export$619500959fc48b26 = typeof (0, $670gB$react)['useId'] === 'function' ? $b5e257d569688ac6$var$useModernSSRSafeId : $b5e257d569688ac6$var$useLegacySSRSafeId;
|
||||
function $b5e257d569688ac6$var$getSnapshot() {
|
||||
return false;
|
||||
}
|
||||
function $b5e257d569688ac6$var$getServerSnapshot() {
|
||||
return true;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function $b5e257d569688ac6$var$subscribe(onStoreChange) {
|
||||
// noop
|
||||
return ()=>{};
|
||||
}
|
||||
function $b5e257d569688ac6$export$535bd6ca7f90a273() {
|
||||
// In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
|
||||
if (typeof (0, $670gB$react)['useSyncExternalStore'] === 'function') return (0, $670gB$react)['useSyncExternalStore']($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
return (0, $670gB$useContext)($b5e257d569688ac6$var$IsSSRContext);
|
||||
}
|
||||
|
||||
|
||||
export {$b5e257d569688ac6$export$9f8ac96af4b1b2ae as SSRProvider, $b5e257d569688ac6$export$535bd6ca7f90a273 as useIsSSR, $b5e257d569688ac6$export$619500959fc48b26 as useSSRSafeId};
|
||||
//# sourceMappingURL=SSRProvider.module.js.map
|
||||
1
node_modules/@react-aria/ssr/dist/SSRProvider.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/ssr/dist/SSRProvider.module.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
17
node_modules/@react-aria/ssr/dist/import.mjs
generated
vendored
Normal file
17
node_modules/@react-aria/ssr/dist/import.mjs
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import {SSRProvider as $b5e257d569688ac6$export$9f8ac96af4b1b2ae, useIsSSR as $b5e257d569688ac6$export$535bd6ca7f90a273, useSSRSafeId as $b5e257d569688ac6$export$619500959fc48b26} from "./SSRProvider.mjs";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export {$b5e257d569688ac6$export$9f8ac96af4b1b2ae as SSRProvider, $b5e257d569688ac6$export$619500959fc48b26 as useSSRSafeId, $b5e257d569688ac6$export$535bd6ca7f90a273 as useIsSSR};
|
||||
//# sourceMappingURL=module.js.map
|
||||
24
node_modules/@react-aria/ssr/dist/main.js
generated
vendored
Normal file
24
node_modules/@react-aria/ssr/dist/main.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var $97d95f6660b1bb14$exports = require("./SSRProvider.main.js");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "SSRProvider", () => $97d95f6660b1bb14$exports.SSRProvider);
|
||||
$parcel$export(module.exports, "useSSRSafeId", () => $97d95f6660b1bb14$exports.useSSRSafeId);
|
||||
$parcel$export(module.exports, "useIsSSR", () => $97d95f6660b1bb14$exports.useIsSSR);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
node_modules/@react-aria/ssr/dist/main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/ssr/dist/main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/ssr/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';\nexport type {SSRProviderProps} from './SSRProvider';\n"],"names":[],"version":3,"file":"main.js.map","sourceRoot":"../../../../"}
|
||||
17
node_modules/@react-aria/ssr/dist/module.js
generated
vendored
Normal file
17
node_modules/@react-aria/ssr/dist/module.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import {SSRProvider as $b5e257d569688ac6$export$9f8ac96af4b1b2ae, useIsSSR as $b5e257d569688ac6$export$535bd6ca7f90a273, useSSRSafeId as $b5e257d569688ac6$export$619500959fc48b26} from "./SSRProvider.module.js";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export {$b5e257d569688ac6$export$9f8ac96af4b1b2ae as SSRProvider, $b5e257d569688ac6$export$619500959fc48b26 as useSSRSafeId, $b5e257d569688ac6$export$535bd6ca7f90a273 as useIsSSR};
|
||||
//# sourceMappingURL=module.js.map
|
||||
1
node_modules/@react-aria/ssr/dist/module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/ssr/dist/module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/ssr/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';\nexport type {SSRProviderProps} from './SSRProvider';\n"],"names":[],"version":3,"file":"module.js.map","sourceRoot":"../../../../"}
|
||||
22
node_modules/@react-aria/ssr/dist/types.d.ts
generated
vendored
Normal file
22
node_modules/@react-aria/ssr/dist/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { JSX, ReactNode } from "react";
|
||||
export interface SSRProviderProps {
|
||||
/** Your application here. */
|
||||
children: ReactNode;
|
||||
}
|
||||
/**
|
||||
* When using SSR with React Aria in React 16 or 17, applications must be wrapped in an SSRProvider.
|
||||
* This ensures that auto generated ids are consistent between the client and server.
|
||||
*/
|
||||
export function SSRProvider(props: SSRProviderProps): JSX.Element;
|
||||
declare function useLegacySSRSafeId(defaultId?: string): string;
|
||||
declare function useModernSSRSafeId(defaultId?: string): string;
|
||||
/** @private */
|
||||
export const useSSRSafeId: typeof useModernSSRSafeId | typeof useLegacySSRSafeId;
|
||||
/**
|
||||
* Returns whether the component is currently being server side rendered or
|
||||
* hydrated on the client. Can be used to delay browser-specific rendering
|
||||
* until after hydration.
|
||||
*/
|
||||
export function useIsSSR(): boolean;
|
||||
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/@react-aria/ssr/dist/types.d.ts.map
generated
vendored
Normal file
1
node_modules/@react-aria/ssr/dist/types.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";AAyCA;IACE,6BAA6B;IAC7B,QAAQ,EAAE,SAAS,CAAA;CACpB;AAoCD;;;GAGG;AACH,4BAA4B,KAAK,EAAE,gBAAgB,GAAG,IAAI,OAAO,CAShE;AAmDD,oCAA4B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAYtD;AAED,oCAA4B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAKtD;AAGD,eAAe;AACf,OAAO,MAAM,cAAc,yBAAyB,GAAG,yBAA0G,CAAC;AAgBlK;;;;GAIG;AACH,4BAA4B,OAAO,CAQlC","sources":["packages/@react-aria/ssr/src/packages/@react-aria/ssr/src/SSRProvider.tsx","packages/@react-aria/ssr/src/packages/@react-aria/ssr/src/index.ts","packages/@react-aria/ssr/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';\nexport type {SSRProviderProps} from './SSRProvider';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
||||
49
node_modules/@react-aria/ssr/package.json
generated
vendored
Normal file
49
node_modules/@react-aria/ssr/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "@react-aria/ssr",
|
||||
"version": "3.9.10",
|
||||
"description": "Spectrum UI components in React",
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/main.js",
|
||||
"module": "dist/module.js",
|
||||
"exports": {
|
||||
"source": "./src/index.ts",
|
||||
"types": [
|
||||
"./dist/types.d.ts",
|
||||
"./src/index.ts"
|
||||
],
|
||||
"import": "./dist/import.mjs",
|
||||
"require": "./dist/main.js"
|
||||
},
|
||||
"types": "dist/types.d.ts",
|
||||
"source": "src/index.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/adobe/react-spectrum"
|
||||
},
|
||||
"dependencies": {
|
||||
"@swc/helpers": "^0.5.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
},
|
||||
"targets": {
|
||||
"main": {
|
||||
"context": "node"
|
||||
},
|
||||
"module": {
|
||||
"context": "node"
|
||||
}
|
||||
},
|
||||
"gitHead": "8b9348ff255e018b2dd9b27e2a45507cadfa1d35"
|
||||
}
|
||||
197
node_modules/@react-aria/ssr/src/SSRProvider.tsx
generated
vendored
Normal file
197
node_modules/@react-aria/ssr/src/SSRProvider.tsx
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
// We must avoid a circular dependency with @react-aria/utils, and this useLayoutEffect is
|
||||
// guarded by a check that it only runs on the client side.
|
||||
// eslint-disable-next-line rulesdir/useLayoutEffectRule
|
||||
import React, {JSX, ReactNode, useContext, useLayoutEffect, useMemo, useRef, useState} from 'react';
|
||||
|
||||
// To support SSR, the auto incrementing id counter is stored in a context. This allows
|
||||
// it to be reset on every request to ensure the client and server are consistent.
|
||||
// There is also a prefix string that is used to support async loading components
|
||||
// Each async boundary must be wrapped in an SSR provider, which appends to the prefix
|
||||
// and resets the current id counter. This ensures that async loaded components have
|
||||
// consistent ids regardless of the loading order.
|
||||
interface SSRContextValue {
|
||||
prefix: string,
|
||||
current: number
|
||||
}
|
||||
|
||||
// Default context value to use in case there is no SSRProvider. This is fine for
|
||||
// client-only apps. In order to support multiple copies of React Aria potentially
|
||||
// being on the page at once, the prefix is set to a random number. SSRProvider
|
||||
// will reset this to zero for consistency between server and client, so in the
|
||||
// SSR case multiple copies of React Aria is not supported.
|
||||
const defaultContext: SSRContextValue = {
|
||||
prefix: String(Math.round(Math.random() * 10000000000)),
|
||||
current: 0
|
||||
};
|
||||
|
||||
const SSRContext = React.createContext<SSRContextValue>(defaultContext);
|
||||
const IsSSRContext = React.createContext(false);
|
||||
|
||||
export interface SSRProviderProps {
|
||||
/** Your application here. */
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
// This is only used in React < 18.
|
||||
function LegacySSRProvider(props: SSRProviderProps): JSX.Element {
|
||||
let cur = useContext(SSRContext);
|
||||
let counter = useCounter(cur === defaultContext);
|
||||
let [isSSR, setIsSSR] = useState(true);
|
||||
let value: SSRContextValue = useMemo(() => ({
|
||||
// If this is the first SSRProvider, start with an empty string prefix, otherwise
|
||||
// append and increment the counter.
|
||||
prefix: cur === defaultContext ? '' : `${cur.prefix}-${counter}`,
|
||||
current: 0
|
||||
}), [cur, counter]);
|
||||
|
||||
// If on the client, and the component was initially server rendered,
|
||||
// then schedule a layout effect to update the component after hydration.
|
||||
if (typeof document !== 'undefined') {
|
||||
// This if statement technically breaks the rules of hooks, but is safe
|
||||
// because the condition never changes after mounting.
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
useLayoutEffect(() => {
|
||||
setIsSSR(false);
|
||||
}, []);
|
||||
}
|
||||
|
||||
return (
|
||||
<SSRContext.Provider value={value}>
|
||||
<IsSSRContext.Provider value={isSSR}>
|
||||
{props.children}
|
||||
</IsSSRContext.Provider>
|
||||
</SSRContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
let warnedAboutSSRProvider = false;
|
||||
|
||||
/**
|
||||
* When using SSR with React Aria in React 16 or 17, applications must be wrapped in an SSRProvider.
|
||||
* This ensures that auto generated ids are consistent between the client and server.
|
||||
*/
|
||||
export function SSRProvider(props: SSRProviderProps): JSX.Element {
|
||||
if (typeof React['useId'] === 'function') {
|
||||
if (process.env.NODE_ENV !== 'test' && process.env.NODE_ENV !== 'production' && !warnedAboutSSRProvider) {
|
||||
console.warn('In React 18, SSRProvider is not necessary and is a noop. You can remove it from your app.');
|
||||
warnedAboutSSRProvider = true;
|
||||
}
|
||||
return <>{props.children}</>;
|
||||
}
|
||||
return <LegacySSRProvider {...props} />;
|
||||
}
|
||||
|
||||
let canUseDOM = Boolean(
|
||||
typeof window !== 'undefined' &&
|
||||
window.document &&
|
||||
window.document.createElement
|
||||
);
|
||||
|
||||
let componentIds = new WeakMap();
|
||||
|
||||
function useCounter(isDisabled = false) {
|
||||
let ctx = useContext(SSRContext);
|
||||
let ref = useRef<number | null>(null);
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
if (ref.current === null && !isDisabled) {
|
||||
// In strict mode, React renders components twice, and the ref will be reset to null on the second render.
|
||||
// This means our id counter will be incremented twice instead of once. This is a problem because on the
|
||||
// server, components are only rendered once and so ids generated on the server won't match the client.
|
||||
// In React 18, useId was introduced to solve this, but it is not available in older versions. So to solve this
|
||||
// we need to use some React internals to access the underlying Fiber instance, which is stable between renders.
|
||||
// This is exposed as ReactCurrentOwner in development, which is all we need since StrictMode only runs in development.
|
||||
// To ensure that we only increment the global counter once, we store the starting id for this component in
|
||||
// a weak map associated with the Fiber. On the second render, we reset the global counter to this value.
|
||||
// Since React runs the second render immediately after the first, this is safe.
|
||||
// @ts-ignore
|
||||
let currentOwner = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;
|
||||
if (currentOwner) {
|
||||
let prevComponentValue = componentIds.get(currentOwner);
|
||||
if (prevComponentValue == null) {
|
||||
// On the first render, and first call to useId, store the id and state in our weak map.
|
||||
componentIds.set(currentOwner, {
|
||||
id: ctx.current,
|
||||
state: currentOwner.memoizedState
|
||||
});
|
||||
} else if (currentOwner.memoizedState !== prevComponentValue.state) {
|
||||
// On the second render, the memoizedState gets reset by React.
|
||||
// Reset the counter, and remove from the weak map so we don't
|
||||
// do this for subsequent useId calls.
|
||||
ctx.current = prevComponentValue.id;
|
||||
componentIds.delete(currentOwner);
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
ref.current = ++ctx.current;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line rulesdir/pure-render
|
||||
return ref.current;
|
||||
}
|
||||
|
||||
function useLegacySSRSafeId(defaultId?: string): string {
|
||||
let ctx = useContext(SSRContext);
|
||||
|
||||
// If we are rendering in a non-DOM environment, and there's no SSRProvider,
|
||||
// provide a warning to hint to the developer to add one.
|
||||
if (ctx === defaultContext && !canUseDOM && process.env.NODE_ENV !== 'production') {
|
||||
console.warn('When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.');
|
||||
}
|
||||
|
||||
let counter = useCounter(!!defaultId);
|
||||
let prefix = ctx === defaultContext && process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${ctx.prefix}`;
|
||||
return defaultId || `${prefix}-${counter}`;
|
||||
}
|
||||
|
||||
function useModernSSRSafeId(defaultId?: string): string {
|
||||
let id = React.useId();
|
||||
let [didSSR] = useState(useIsSSR());
|
||||
let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${defaultContext.prefix}`;
|
||||
return defaultId || `${prefix}-${id}`;
|
||||
}
|
||||
|
||||
// Use React.useId in React 18 if available, otherwise fall back to our old implementation.
|
||||
/** @private */
|
||||
export const useSSRSafeId: typeof useModernSSRSafeId | typeof useLegacySSRSafeId = typeof React['useId'] === 'function' ? useModernSSRSafeId : useLegacySSRSafeId;
|
||||
|
||||
function getSnapshot() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getServerSnapshot() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function subscribe(onStoreChange: () => void): () => void {
|
||||
// noop
|
||||
return () => {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the component is currently being server side rendered or
|
||||
* hydrated on the client. Can be used to delay browser-specific rendering
|
||||
* until after hydration.
|
||||
*/
|
||||
export function useIsSSR(): boolean {
|
||||
// In React 18, we can use useSyncExternalStore to detect if we're server rendering or hydrating.
|
||||
if (typeof React['useSyncExternalStore'] === 'function') {
|
||||
return React['useSyncExternalStore'](subscribe, getSnapshot, getServerSnapshot);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
return useContext(IsSSRContext);
|
||||
}
|
||||
13
node_modules/@react-aria/ssr/src/index.ts
generated
vendored
Normal file
13
node_modules/@react-aria/ssr/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
export {SSRProvider, useSSRSafeId, useIsSSR} from './SSRProvider';
|
||||
export type {SSRProviderProps} from './SSRProvider';
|
||||
Reference in New Issue
Block a user