react-router 0.0.0-experimental-1ebb6d403 → 0.0.0-experimental-01a3132e6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/{chunk-5XVYBMAF.mjs → chunk-IMLGQ7TF.mjs} +211 -216
- package/dist/development/dom-export.d.mts +1 -1
- package/dist/development/dom-export.d.ts +1 -1
- package/dist/development/dom-export.js +68 -71
- package/dist/development/dom-export.mjs +2 -2
- package/dist/{production/fog-of-war-7V7BguJA.d.ts → development/fog-of-war-CcF9dOvO.d.ts} +7 -1
- package/dist/development/{fog-of-war-NQCW9yWR.d.mts → fog-of-war-D5Q4Ix4U.d.mts} +7 -1
- package/dist/development/index.d.mts +3 -11
- package/dist/development/index.d.ts +3 -11
- package/dist/development/index.js +211 -216
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/production/{chunk-CKFZHSMW.mjs → chunk-3NLLFLDL.mjs} +211 -216
- package/dist/production/dom-export.d.mts +1 -1
- package/dist/production/dom-export.d.ts +1 -1
- package/dist/production/dom-export.js +68 -71
- package/dist/production/dom-export.mjs +2 -2
- package/dist/{development/fog-of-war-7V7BguJA.d.ts → production/fog-of-war-CcF9dOvO.d.ts} +7 -1
- package/dist/production/{fog-of-war-NQCW9yWR.d.mts → fog-of-war-D5Q4Ix4U.d.mts} +7 -1
- package/dist/production/index.d.mts +3 -11
- package/dist/production/index.d.ts +3 -11
- package/dist/production/index.js +211 -216
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/package.json +2 -17
- package/dist/development/server.d.mts +0 -988
- package/dist/development/server.d.ts +0 -988
- package/dist/development/server.js +0 -1429
- package/dist/development/server.mjs +0 -1406
- package/dist/production/server.d.mts +0 -988
- package/dist/production/server.d.ts +0 -988
- package/dist/production/server.js +0 -1405
- package/dist/production/server.mjs +0 -1382
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-01a3132e6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -4024,7 +4024,7 @@ function createDeferred() {
|
|
|
4024
4024
|
}
|
|
4025
4025
|
|
|
4026
4026
|
// lib/components.tsx
|
|
4027
|
-
import * as
|
|
4027
|
+
import * as React3 from "react";
|
|
4028
4028
|
|
|
4029
4029
|
// lib/context.ts
|
|
4030
4030
|
import * as React from "react";
|
|
@@ -4642,23 +4642,8 @@ function warnOnce(condition, message) {
|
|
|
4642
4642
|
}
|
|
4643
4643
|
}
|
|
4644
4644
|
|
|
4645
|
-
// lib/
|
|
4646
|
-
import * as React3 from "react";
|
|
4645
|
+
// lib/components.tsx
|
|
4647
4646
|
var ENABLE_DEV_WARNINGS2 = true;
|
|
4648
|
-
function createHref(to) {
|
|
4649
|
-
return typeof to === "string" ? to : createPath(to);
|
|
4650
|
-
}
|
|
4651
|
-
function encodeLocation(to) {
|
|
4652
|
-
let href = typeof to === "string" ? to : createPath(to);
|
|
4653
|
-
href = href.replace(/ $/, "%20");
|
|
4654
|
-
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
4655
|
-
return {
|
|
4656
|
-
pathname: encoded.pathname,
|
|
4657
|
-
search: encoded.search,
|
|
4658
|
-
hash: encoded.hash
|
|
4659
|
-
};
|
|
4660
|
-
}
|
|
4661
|
-
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
4662
4647
|
function mapRouteProperties(route) {
|
|
4663
4648
|
let updates = {
|
|
4664
4649
|
// Note: this check also occurs in createRoutesFromChildren so update
|
|
@@ -4709,8 +4694,6 @@ function mapRouteProperties(route) {
|
|
|
4709
4694
|
}
|
|
4710
4695
|
return updates;
|
|
4711
4696
|
}
|
|
4712
|
-
|
|
4713
|
-
// lib/components.tsx
|
|
4714
4697
|
function createMemoryRouter(routes, opts) {
|
|
4715
4698
|
return createRouter({
|
|
4716
4699
|
basename: opts?.basename,
|
|
@@ -4749,16 +4732,16 @@ function RouterProvider({
|
|
|
4749
4732
|
router,
|
|
4750
4733
|
flushSync: reactDomFlushSyncImpl
|
|
4751
4734
|
}) {
|
|
4752
|
-
let [state, setStateImpl] =
|
|
4753
|
-
let [pendingState, setPendingState] =
|
|
4754
|
-
let [vtContext, setVtContext] =
|
|
4735
|
+
let [state, setStateImpl] = React3.useState(router.state);
|
|
4736
|
+
let [pendingState, setPendingState] = React3.useState();
|
|
4737
|
+
let [vtContext, setVtContext] = React3.useState({
|
|
4755
4738
|
isTransitioning: false
|
|
4756
4739
|
});
|
|
4757
|
-
let [renderDfd, setRenderDfd] =
|
|
4758
|
-
let [transition, setTransition] =
|
|
4759
|
-
let [interruption, setInterruption] =
|
|
4760
|
-
let fetcherData =
|
|
4761
|
-
let setState =
|
|
4740
|
+
let [renderDfd, setRenderDfd] = React3.useState();
|
|
4741
|
+
let [transition, setTransition] = React3.useState();
|
|
4742
|
+
let [interruption, setInterruption] = React3.useState();
|
|
4743
|
+
let fetcherData = React3.useRef(/* @__PURE__ */ new Map());
|
|
4744
|
+
let setState = React3.useCallback(
|
|
4762
4745
|
(newState, { deletedFetchers, flushSync, viewTransitionOpts }) => {
|
|
4763
4746
|
newState.fetchers.forEach((fetcher, key) => {
|
|
4764
4747
|
if (fetcher.data !== void 0) {
|
|
@@ -4779,7 +4762,7 @@ function RouterProvider({
|
|
|
4779
4762
|
if (reactDomFlushSyncImpl && flushSync) {
|
|
4780
4763
|
reactDomFlushSyncImpl(() => setStateImpl(newState));
|
|
4781
4764
|
} else {
|
|
4782
|
-
|
|
4765
|
+
React3.startTransition(() => setStateImpl(newState));
|
|
4783
4766
|
}
|
|
4784
4767
|
return;
|
|
4785
4768
|
}
|
|
@@ -4830,18 +4813,18 @@ function RouterProvider({
|
|
|
4830
4813
|
},
|
|
4831
4814
|
[router.window, reactDomFlushSyncImpl, transition, renderDfd]
|
|
4832
4815
|
);
|
|
4833
|
-
|
|
4834
|
-
|
|
4816
|
+
React3.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
|
|
4817
|
+
React3.useEffect(() => {
|
|
4835
4818
|
if (vtContext.isTransitioning && !vtContext.flushSync) {
|
|
4836
4819
|
setRenderDfd(new Deferred());
|
|
4837
4820
|
}
|
|
4838
4821
|
}, [vtContext]);
|
|
4839
|
-
|
|
4822
|
+
React3.useEffect(() => {
|
|
4840
4823
|
if (renderDfd && pendingState && router.window) {
|
|
4841
4824
|
let newState = pendingState;
|
|
4842
4825
|
let renderPromise = renderDfd.promise;
|
|
4843
4826
|
let transition2 = router.window.document.startViewTransition(async () => {
|
|
4844
|
-
|
|
4827
|
+
React3.startTransition(() => setStateImpl(newState));
|
|
4845
4828
|
await renderPromise;
|
|
4846
4829
|
});
|
|
4847
4830
|
transition2.finished.finally(() => {
|
|
@@ -4853,12 +4836,12 @@ function RouterProvider({
|
|
|
4853
4836
|
setTransition(transition2);
|
|
4854
4837
|
}
|
|
4855
4838
|
}, [pendingState, renderDfd, router.window]);
|
|
4856
|
-
|
|
4839
|
+
React3.useEffect(() => {
|
|
4857
4840
|
if (renderDfd && pendingState && state.location.key === pendingState.location.key) {
|
|
4858
4841
|
renderDfd.resolve();
|
|
4859
4842
|
}
|
|
4860
4843
|
}, [renderDfd, transition, state.location, pendingState]);
|
|
4861
|
-
|
|
4844
|
+
React3.useEffect(() => {
|
|
4862
4845
|
if (!vtContext.isTransitioning && interruption) {
|
|
4863
4846
|
setPendingState(interruption.state);
|
|
4864
4847
|
setVtContext({
|
|
@@ -4870,7 +4853,7 @@ function RouterProvider({
|
|
|
4870
4853
|
setInterruption(void 0);
|
|
4871
4854
|
}
|
|
4872
4855
|
}, [vtContext.isTransitioning, interruption]);
|
|
4873
|
-
let navigator2 =
|
|
4856
|
+
let navigator2 = React3.useMemo(() => {
|
|
4874
4857
|
return {
|
|
4875
4858
|
createHref: router.createHref,
|
|
4876
4859
|
encodeLocation: router.encodeLocation,
|
|
@@ -4887,7 +4870,7 @@ function RouterProvider({
|
|
|
4887
4870
|
};
|
|
4888
4871
|
}, [router]);
|
|
4889
4872
|
let basename = router.basename || "/";
|
|
4890
|
-
let dataRouterContext =
|
|
4873
|
+
let dataRouterContext = React3.useMemo(
|
|
4891
4874
|
() => ({
|
|
4892
4875
|
router,
|
|
4893
4876
|
navigator: navigator2,
|
|
@@ -4896,7 +4879,7 @@ function RouterProvider({
|
|
|
4896
4879
|
}),
|
|
4897
4880
|
[router, navigator2, basename]
|
|
4898
4881
|
);
|
|
4899
|
-
return /* @__PURE__ */
|
|
4882
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React3.createElement(DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React3.createElement(FetchersContext.Provider, { value: fetcherData.current }, /* @__PURE__ */ React3.createElement(ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React3.createElement(
|
|
4900
4883
|
Router,
|
|
4901
4884
|
{
|
|
4902
4885
|
basename,
|
|
@@ -4904,7 +4887,7 @@ function RouterProvider({
|
|
|
4904
4887
|
navigationType: state.historyAction,
|
|
4905
4888
|
navigator: navigator2
|
|
4906
4889
|
},
|
|
4907
|
-
/* @__PURE__ */
|
|
4890
|
+
/* @__PURE__ */ React3.createElement(
|
|
4908
4891
|
MemoizedDataRoutes,
|
|
4909
4892
|
{
|
|
4910
4893
|
routes: router.routes,
|
|
@@ -4914,7 +4897,7 @@ function RouterProvider({
|
|
|
4914
4897
|
)
|
|
4915
4898
|
))))), null);
|
|
4916
4899
|
}
|
|
4917
|
-
var MemoizedDataRoutes =
|
|
4900
|
+
var MemoizedDataRoutes = React3.memo(DataRoutes);
|
|
4918
4901
|
function DataRoutes({
|
|
4919
4902
|
routes,
|
|
4920
4903
|
future,
|
|
@@ -4928,7 +4911,7 @@ function MemoryRouter({
|
|
|
4928
4911
|
initialEntries,
|
|
4929
4912
|
initialIndex
|
|
4930
4913
|
}) {
|
|
4931
|
-
let historyRef =
|
|
4914
|
+
let historyRef = React3.useRef();
|
|
4932
4915
|
if (historyRef.current == null) {
|
|
4933
4916
|
historyRef.current = createMemoryHistory({
|
|
4934
4917
|
initialEntries,
|
|
@@ -4937,18 +4920,18 @@ function MemoryRouter({
|
|
|
4937
4920
|
});
|
|
4938
4921
|
}
|
|
4939
4922
|
let history = historyRef.current;
|
|
4940
|
-
let [state, setStateImpl] =
|
|
4923
|
+
let [state, setStateImpl] = React3.useState({
|
|
4941
4924
|
action: history.action,
|
|
4942
4925
|
location: history.location
|
|
4943
4926
|
});
|
|
4944
|
-
let setState =
|
|
4927
|
+
let setState = React3.useCallback(
|
|
4945
4928
|
(newState) => {
|
|
4946
|
-
|
|
4929
|
+
React3.startTransition(() => setStateImpl(newState));
|
|
4947
4930
|
},
|
|
4948
4931
|
[setStateImpl]
|
|
4949
4932
|
);
|
|
4950
|
-
|
|
4951
|
-
return /* @__PURE__ */
|
|
4933
|
+
React3.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
4934
|
+
return /* @__PURE__ */ React3.createElement(
|
|
4952
4935
|
Router,
|
|
4953
4936
|
{
|
|
4954
4937
|
basename,
|
|
@@ -4971,12 +4954,12 @@ function Navigate({
|
|
|
4971
4954
|
// the router loaded. We can help them understand how to avoid that.
|
|
4972
4955
|
`<Navigate> may be used only in the context of a <Router> component.`
|
|
4973
4956
|
);
|
|
4974
|
-
let { static: isStatic } =
|
|
4957
|
+
let { static: isStatic } = React3.useContext(NavigationContext);
|
|
4975
4958
|
warning(
|
|
4976
4959
|
!isStatic,
|
|
4977
4960
|
`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`
|
|
4978
4961
|
);
|
|
4979
|
-
let { matches } =
|
|
4962
|
+
let { matches } = React3.useContext(RouteContext);
|
|
4980
4963
|
let { pathname: locationPathname } = useLocation();
|
|
4981
4964
|
let navigate = useNavigate();
|
|
4982
4965
|
let path = resolveTo(
|
|
@@ -4986,7 +4969,7 @@ function Navigate({
|
|
|
4986
4969
|
relative === "path"
|
|
4987
4970
|
);
|
|
4988
4971
|
let jsonPath = JSON.stringify(path);
|
|
4989
|
-
|
|
4972
|
+
React3.useEffect(() => {
|
|
4990
4973
|
navigate(JSON.parse(jsonPath), { replace: replace2, state, relative });
|
|
4991
4974
|
}, [navigate, jsonPath, relative, replace2, state]);
|
|
4992
4975
|
return null;
|
|
@@ -5013,7 +4996,7 @@ function Router({
|
|
|
5013
4996
|
`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
|
|
5014
4997
|
);
|
|
5015
4998
|
let basename = basenameProp.replace(/^\/*/, "/");
|
|
5016
|
-
let navigationContext =
|
|
4999
|
+
let navigationContext = React3.useMemo(
|
|
5017
5000
|
() => ({
|
|
5018
5001
|
basename,
|
|
5019
5002
|
navigator: navigator2,
|
|
@@ -5032,7 +5015,7 @@ function Router({
|
|
|
5032
5015
|
state = null,
|
|
5033
5016
|
key = "default"
|
|
5034
5017
|
} = locationProp;
|
|
5035
|
-
let locationContext =
|
|
5018
|
+
let locationContext = React3.useMemo(() => {
|
|
5036
5019
|
let trailingPathname = stripBasename(pathname, basename);
|
|
5037
5020
|
if (trailingPathname == null) {
|
|
5038
5021
|
return null;
|
|
@@ -5055,7 +5038,7 @@ function Router({
|
|
|
5055
5038
|
if (locationContext == null) {
|
|
5056
5039
|
return null;
|
|
5057
5040
|
}
|
|
5058
|
-
return /* @__PURE__ */
|
|
5041
|
+
return /* @__PURE__ */ React3.createElement(NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React3.createElement(LocationContext.Provider, { children, value: locationContext }));
|
|
5059
5042
|
}
|
|
5060
5043
|
function Routes({
|
|
5061
5044
|
children,
|
|
@@ -5068,9 +5051,9 @@ function Await({
|
|
|
5068
5051
|
errorElement,
|
|
5069
5052
|
resolve
|
|
5070
5053
|
}) {
|
|
5071
|
-
return /* @__PURE__ */
|
|
5054
|
+
return /* @__PURE__ */ React3.createElement(AwaitErrorBoundary, { resolve, errorElement }, /* @__PURE__ */ React3.createElement(ResolveAwait, null, children));
|
|
5072
5055
|
}
|
|
5073
|
-
var AwaitErrorBoundary = class extends
|
|
5056
|
+
var AwaitErrorBoundary = class extends React3.Component {
|
|
5074
5057
|
constructor(props) {
|
|
5075
5058
|
super(props);
|
|
5076
5059
|
this.state = { error: null };
|
|
@@ -5116,10 +5099,10 @@ var AwaitErrorBoundary = class extends React4.Component {
|
|
|
5116
5099
|
throw promise._error;
|
|
5117
5100
|
}
|
|
5118
5101
|
if (status === 2 /* error */) {
|
|
5119
|
-
return /* @__PURE__ */
|
|
5102
|
+
return /* @__PURE__ */ React3.createElement(AwaitContext.Provider, { value: promise, children: errorElement });
|
|
5120
5103
|
}
|
|
5121
5104
|
if (status === 1 /* success */) {
|
|
5122
|
-
return /* @__PURE__ */
|
|
5105
|
+
return /* @__PURE__ */ React3.createElement(AwaitContext.Provider, { value: promise, children });
|
|
5123
5106
|
}
|
|
5124
5107
|
throw promise;
|
|
5125
5108
|
}
|
|
@@ -5129,16 +5112,16 @@ function ResolveAwait({
|
|
|
5129
5112
|
}) {
|
|
5130
5113
|
let data2 = useAsyncValue();
|
|
5131
5114
|
let toRender = typeof children === "function" ? children(data2) : children;
|
|
5132
|
-
return /* @__PURE__ */
|
|
5115
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, toRender);
|
|
5133
5116
|
}
|
|
5134
5117
|
function createRoutesFromChildren(children, parentPath = []) {
|
|
5135
5118
|
let routes = [];
|
|
5136
|
-
|
|
5137
|
-
if (!
|
|
5119
|
+
React3.Children.forEach(children, (element, index) => {
|
|
5120
|
+
if (!React3.isValidElement(element)) {
|
|
5138
5121
|
return;
|
|
5139
5122
|
}
|
|
5140
5123
|
let treePath = [...parentPath, index];
|
|
5141
|
-
if (element.type ===
|
|
5124
|
+
if (element.type === React3.Fragment) {
|
|
5142
5125
|
routes.push.apply(
|
|
5143
5126
|
routes,
|
|
5144
5127
|
createRoutesFromChildren(element.props.children, treePath)
|
|
@@ -5187,7 +5170,7 @@ function renderMatches(matches) {
|
|
|
5187
5170
|
}
|
|
5188
5171
|
|
|
5189
5172
|
// lib/dom/lib.tsx
|
|
5190
|
-
import * as
|
|
5173
|
+
import * as React10 from "react";
|
|
5191
5174
|
|
|
5192
5175
|
// lib/dom/dom.ts
|
|
5193
5176
|
var defaultMethod = "get";
|
|
@@ -5318,7 +5301,7 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
5318
5301
|
}
|
|
5319
5302
|
|
|
5320
5303
|
// lib/dom/ssr/components.tsx
|
|
5321
|
-
import * as
|
|
5304
|
+
import * as React9 from "react";
|
|
5322
5305
|
|
|
5323
5306
|
// lib/dom/ssr/invariant.ts
|
|
5324
5307
|
function invariant2(value, message) {
|
|
@@ -5570,7 +5553,7 @@ function createHtml(html) {
|
|
|
5570
5553
|
}
|
|
5571
5554
|
|
|
5572
5555
|
// lib/dom/ssr/single-fetch.tsx
|
|
5573
|
-
import * as
|
|
5556
|
+
import * as React4 from "react";
|
|
5574
5557
|
import { decode } from "turbo-stream";
|
|
5575
5558
|
|
|
5576
5559
|
// lib/dom/ssr/data.ts
|
|
@@ -5628,7 +5611,7 @@ function StreamTransfer({
|
|
|
5628
5611
|
throw promise;
|
|
5629
5612
|
}
|
|
5630
5613
|
let { done, value } = promise.result;
|
|
5631
|
-
let scriptTag = value ? /* @__PURE__ */
|
|
5614
|
+
let scriptTag = value ? /* @__PURE__ */ React4.createElement(
|
|
5632
5615
|
"script",
|
|
5633
5616
|
{
|
|
5634
5617
|
nonce,
|
|
@@ -5640,7 +5623,7 @@ function StreamTransfer({
|
|
|
5640
5623
|
}
|
|
5641
5624
|
) : null;
|
|
5642
5625
|
if (done) {
|
|
5643
|
-
return /* @__PURE__ */
|
|
5626
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, scriptTag, /* @__PURE__ */ React4.createElement(
|
|
5644
5627
|
"script",
|
|
5645
5628
|
{
|
|
5646
5629
|
nonce,
|
|
@@ -5650,7 +5633,7 @@ function StreamTransfer({
|
|
|
5650
5633
|
}
|
|
5651
5634
|
));
|
|
5652
5635
|
} else {
|
|
5653
|
-
return /* @__PURE__ */
|
|
5636
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, scriptTag, /* @__PURE__ */ React4.createElement(React4.Suspense, null, /* @__PURE__ */ React4.createElement(
|
|
5654
5637
|
StreamTransfer,
|
|
5655
5638
|
{
|
|
5656
5639
|
context,
|
|
@@ -5936,14 +5919,14 @@ function createDeferred2() {
|
|
|
5936
5919
|
}
|
|
5937
5920
|
|
|
5938
5921
|
// lib/dom/ssr/fog-of-war.ts
|
|
5939
|
-
import * as
|
|
5922
|
+
import * as React8 from "react";
|
|
5940
5923
|
|
|
5941
5924
|
// lib/dom/ssr/routes.tsx
|
|
5942
|
-
import * as
|
|
5925
|
+
import * as React7 from "react";
|
|
5943
5926
|
|
|
5944
5927
|
// lib/dom/ssr/errorBoundaries.tsx
|
|
5945
|
-
import * as
|
|
5946
|
-
var RemixErrorBoundary = class extends
|
|
5928
|
+
import * as React5 from "react";
|
|
5929
|
+
var RemixErrorBoundary = class extends React5.Component {
|
|
5947
5930
|
constructor(props) {
|
|
5948
5931
|
super(props);
|
|
5949
5932
|
this.state = { error: props.error || null, location: props.location };
|
|
@@ -5959,7 +5942,7 @@ var RemixErrorBoundary = class extends React6.Component {
|
|
|
5959
5942
|
}
|
|
5960
5943
|
render() {
|
|
5961
5944
|
if (this.state.error) {
|
|
5962
|
-
return /* @__PURE__ */
|
|
5945
|
+
return /* @__PURE__ */ React5.createElement(
|
|
5963
5946
|
RemixRootDefaultErrorBoundary,
|
|
5964
5947
|
{
|
|
5965
5948
|
error: this.state.error,
|
|
@@ -5976,7 +5959,7 @@ function RemixRootDefaultErrorBoundary({
|
|
|
5976
5959
|
isOutsideRemixApp
|
|
5977
5960
|
}) {
|
|
5978
5961
|
console.error(error);
|
|
5979
|
-
let heyDeveloper = /* @__PURE__ */
|
|
5962
|
+
let heyDeveloper = /* @__PURE__ */ React5.createElement(
|
|
5980
5963
|
"script",
|
|
5981
5964
|
{
|
|
5982
5965
|
dangerouslySetInnerHTML: {
|
|
@@ -5989,7 +5972,7 @@ function RemixRootDefaultErrorBoundary({
|
|
|
5989
5972
|
}
|
|
5990
5973
|
);
|
|
5991
5974
|
if (isRouteErrorResponse(error)) {
|
|
5992
|
-
return /* @__PURE__ */
|
|
5975
|
+
return /* @__PURE__ */ React5.createElement(BoundaryShell, { title: "Unhandled Thrown Response!" }, /* @__PURE__ */ React5.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), heyDeveloper);
|
|
5993
5976
|
}
|
|
5994
5977
|
let errorInstance;
|
|
5995
5978
|
if (error instanceof Error) {
|
|
@@ -5998,14 +5981,14 @@ function RemixRootDefaultErrorBoundary({
|
|
|
5998
5981
|
let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
|
|
5999
5982
|
errorInstance = new Error(errorString);
|
|
6000
5983
|
}
|
|
6001
|
-
return /* @__PURE__ */
|
|
5984
|
+
return /* @__PURE__ */ React5.createElement(
|
|
6002
5985
|
BoundaryShell,
|
|
6003
5986
|
{
|
|
6004
5987
|
title: "Application Error!",
|
|
6005
5988
|
isOutsideRemixApp
|
|
6006
5989
|
},
|
|
6007
|
-
/* @__PURE__ */
|
|
6008
|
-
/* @__PURE__ */
|
|
5990
|
+
/* @__PURE__ */ React5.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"),
|
|
5991
|
+
/* @__PURE__ */ React5.createElement(
|
|
6009
5992
|
"pre",
|
|
6010
5993
|
{
|
|
6011
5994
|
style: {
|
|
@@ -6030,19 +6013,19 @@ function BoundaryShell({
|
|
|
6030
6013
|
if (routeModules.root?.Layout && !isOutsideRemixApp) {
|
|
6031
6014
|
return children;
|
|
6032
6015
|
}
|
|
6033
|
-
return /* @__PURE__ */
|
|
6016
|
+
return /* @__PURE__ */ React5.createElement("html", { lang: "en" }, /* @__PURE__ */ React5.createElement("head", null, /* @__PURE__ */ React5.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React5.createElement(
|
|
6034
6017
|
"meta",
|
|
6035
6018
|
{
|
|
6036
6019
|
name: "viewport",
|
|
6037
6020
|
content: "width=device-width,initial-scale=1,viewport-fit=cover"
|
|
6038
6021
|
}
|
|
6039
|
-
), /* @__PURE__ */
|
|
6022
|
+
), /* @__PURE__ */ React5.createElement("title", null, title)), /* @__PURE__ */ React5.createElement("body", null, /* @__PURE__ */ React5.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children, renderScripts ? /* @__PURE__ */ React5.createElement(Scripts, null) : null)));
|
|
6040
6023
|
}
|
|
6041
6024
|
|
|
6042
6025
|
// lib/dom/ssr/fallback.tsx
|
|
6043
|
-
import * as
|
|
6026
|
+
import * as React6 from "react";
|
|
6044
6027
|
function RemixRootDefaultHydrateFallback() {
|
|
6045
|
-
return /* @__PURE__ */
|
|
6028
|
+
return /* @__PURE__ */ React6.createElement(BoundaryShell, { title: "Loading...", renderScripts: true }, /* @__PURE__ */ React6.createElement(
|
|
6046
6029
|
"script",
|
|
6047
6030
|
{
|
|
6048
6031
|
dangerouslySetInnerHTML: {
|
|
@@ -6076,17 +6059,17 @@ function groupRoutesByParentId(manifest) {
|
|
|
6076
6059
|
function getRouteComponents(route, routeModule, isSpaMode) {
|
|
6077
6060
|
let Component4 = getRouteModuleComponent(routeModule);
|
|
6078
6061
|
let HydrateFallback = routeModule.HydrateFallback && (!isSpaMode || route.id === "root") ? routeModule.HydrateFallback : route.id === "root" ? RemixRootDefaultHydrateFallback : void 0;
|
|
6079
|
-
let ErrorBoundary = routeModule.ErrorBoundary ? routeModule.ErrorBoundary : route.id === "root" ? () => /* @__PURE__ */
|
|
6062
|
+
let ErrorBoundary = routeModule.ErrorBoundary ? routeModule.ErrorBoundary : route.id === "root" ? () => /* @__PURE__ */ React7.createElement(RemixRootDefaultErrorBoundary, { error: useRouteError() }) : void 0;
|
|
6080
6063
|
if (route.id === "root" && routeModule.Layout) {
|
|
6081
6064
|
return {
|
|
6082
6065
|
...Component4 ? {
|
|
6083
|
-
element: /* @__PURE__ */
|
|
6066
|
+
element: /* @__PURE__ */ React7.createElement(routeModule.Layout, null, /* @__PURE__ */ React7.createElement(Component4, null))
|
|
6084
6067
|
} : { Component: Component4 },
|
|
6085
6068
|
...ErrorBoundary ? {
|
|
6086
|
-
errorElement: /* @__PURE__ */
|
|
6069
|
+
errorElement: /* @__PURE__ */ React7.createElement(routeModule.Layout, null, /* @__PURE__ */ React7.createElement(ErrorBoundary, null))
|
|
6087
6070
|
} : { ErrorBoundary },
|
|
6088
6071
|
...HydrateFallback ? {
|
|
6089
|
-
hydrateFallbackElement: /* @__PURE__ */
|
|
6072
|
+
hydrateFallbackElement: /* @__PURE__ */ React7.createElement(routeModule.Layout, null, /* @__PURE__ */ React7.createElement(HydrateFallback, null))
|
|
6090
6073
|
} : { HydrateFallback }
|
|
6091
6074
|
};
|
|
6092
6075
|
}
|
|
@@ -6444,7 +6427,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, isSpaMode, b
|
|
|
6444
6427
|
};
|
|
6445
6428
|
}
|
|
6446
6429
|
function useFogOFWarDiscovery(router, manifest, routeModules, isSpaMode) {
|
|
6447
|
-
|
|
6430
|
+
React8.useEffect(() => {
|
|
6448
6431
|
if (!isFogOfWarEnabled(isSpaMode) || navigator.connection?.saveData === true) {
|
|
6449
6432
|
return;
|
|
6450
6433
|
}
|
|
@@ -6573,7 +6556,7 @@ function debounce(callback, wait) {
|
|
|
6573
6556
|
|
|
6574
6557
|
// lib/dom/ssr/components.tsx
|
|
6575
6558
|
function useDataRouterContext2() {
|
|
6576
|
-
let context =
|
|
6559
|
+
let context = React9.useContext(DataRouterContext);
|
|
6577
6560
|
invariant2(
|
|
6578
6561
|
context,
|
|
6579
6562
|
"You must render this element inside a <DataRouterContext.Provider> element"
|
|
@@ -6581,17 +6564,17 @@ function useDataRouterContext2() {
|
|
|
6581
6564
|
return context;
|
|
6582
6565
|
}
|
|
6583
6566
|
function useDataRouterStateContext() {
|
|
6584
|
-
let context =
|
|
6567
|
+
let context = React9.useContext(DataRouterStateContext);
|
|
6585
6568
|
invariant2(
|
|
6586
6569
|
context,
|
|
6587
6570
|
"You must render this element inside a <DataRouterStateContext.Provider> element"
|
|
6588
6571
|
);
|
|
6589
6572
|
return context;
|
|
6590
6573
|
}
|
|
6591
|
-
var FrameworkContext =
|
|
6574
|
+
var FrameworkContext = React9.createContext(void 0);
|
|
6592
6575
|
FrameworkContext.displayName = "FrameworkContext";
|
|
6593
6576
|
function useFrameworkContext() {
|
|
6594
|
-
let context =
|
|
6577
|
+
let context = React9.useContext(FrameworkContext);
|
|
6595
6578
|
invariant2(
|
|
6596
6579
|
context,
|
|
6597
6580
|
"You must render this element inside a <HydratedRouter> element"
|
|
@@ -6599,12 +6582,12 @@ function useFrameworkContext() {
|
|
|
6599
6582
|
return context;
|
|
6600
6583
|
}
|
|
6601
6584
|
function usePrefetchBehavior(prefetch, theirElementProps) {
|
|
6602
|
-
let frameworkContext =
|
|
6603
|
-
let [maybePrefetch, setMaybePrefetch] =
|
|
6604
|
-
let [shouldPrefetch, setShouldPrefetch] =
|
|
6585
|
+
let frameworkContext = React9.useContext(FrameworkContext);
|
|
6586
|
+
let [maybePrefetch, setMaybePrefetch] = React9.useState(false);
|
|
6587
|
+
let [shouldPrefetch, setShouldPrefetch] = React9.useState(false);
|
|
6605
6588
|
let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
|
|
6606
|
-
let ref =
|
|
6607
|
-
|
|
6589
|
+
let ref = React9.useRef(null);
|
|
6590
|
+
React9.useEffect(() => {
|
|
6608
6591
|
if (prefetch === "render") {
|
|
6609
6592
|
setShouldPrefetch(true);
|
|
6610
6593
|
}
|
|
@@ -6621,7 +6604,7 @@ function usePrefetchBehavior(prefetch, theirElementProps) {
|
|
|
6621
6604
|
};
|
|
6622
6605
|
}
|
|
6623
6606
|
}, [prefetch]);
|
|
6624
|
-
|
|
6607
|
+
React9.useEffect(() => {
|
|
6625
6608
|
if (maybePrefetch) {
|
|
6626
6609
|
let id = setTimeout(() => {
|
|
6627
6610
|
setShouldPrefetch(true);
|
|
@@ -6678,12 +6661,12 @@ function Links() {
|
|
|
6678
6661
|
let { isSpaMode, manifest, routeModules, criticalCss } = useFrameworkContext();
|
|
6679
6662
|
let { errors, matches: routerMatches } = useDataRouterStateContext();
|
|
6680
6663
|
let matches = getActiveMatches(routerMatches, errors, isSpaMode);
|
|
6681
|
-
let keyedLinks =
|
|
6664
|
+
let keyedLinks = React9.useMemo(
|
|
6682
6665
|
() => getKeyedLinksForMatches(matches, routeModules, manifest),
|
|
6683
6666
|
[matches, routeModules, manifest]
|
|
6684
6667
|
);
|
|
6685
|
-
return /* @__PURE__ */
|
|
6686
|
-
({ key, link }) => isPageLinkDescriptor(link) ? /* @__PURE__ */
|
|
6668
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, criticalCss ? /* @__PURE__ */ React9.createElement("style", { dangerouslySetInnerHTML: { __html: criticalCss } }) : null, keyedLinks.map(
|
|
6669
|
+
({ key, link }) => isPageLinkDescriptor(link) ? /* @__PURE__ */ React9.createElement(PrefetchPageLinks, { key, ...link }) : /* @__PURE__ */ React9.createElement("link", { key, ...link })
|
|
6687
6670
|
));
|
|
6688
6671
|
}
|
|
6689
6672
|
function PrefetchPageLinks({
|
|
@@ -6691,19 +6674,19 @@ function PrefetchPageLinks({
|
|
|
6691
6674
|
...dataLinkProps
|
|
6692
6675
|
}) {
|
|
6693
6676
|
let { router } = useDataRouterContext2();
|
|
6694
|
-
let matches =
|
|
6677
|
+
let matches = React9.useMemo(
|
|
6695
6678
|
() => matchRoutes(router.routes, page, router.basename),
|
|
6696
6679
|
[router.routes, page, router.basename]
|
|
6697
6680
|
);
|
|
6698
6681
|
if (!matches) {
|
|
6699
6682
|
return null;
|
|
6700
6683
|
}
|
|
6701
|
-
return /* @__PURE__ */
|
|
6684
|
+
return /* @__PURE__ */ React9.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
|
|
6702
6685
|
}
|
|
6703
6686
|
function useKeyedPrefetchLinks(matches) {
|
|
6704
6687
|
let { manifest, routeModules } = useFrameworkContext();
|
|
6705
|
-
let [keyedPrefetchLinks, setKeyedPrefetchLinks] =
|
|
6706
|
-
|
|
6688
|
+
let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React9.useState([]);
|
|
6689
|
+
React9.useEffect(() => {
|
|
6707
6690
|
let interrupted = false;
|
|
6708
6691
|
void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
|
|
6709
6692
|
(links) => {
|
|
@@ -6726,7 +6709,7 @@ function PrefetchPageLinksImpl({
|
|
|
6726
6709
|
let location = useLocation();
|
|
6727
6710
|
let { manifest, routeModules } = useFrameworkContext();
|
|
6728
6711
|
let { loaderData, matches } = useDataRouterStateContext();
|
|
6729
|
-
let newMatchesForData =
|
|
6712
|
+
let newMatchesForData = React9.useMemo(
|
|
6730
6713
|
() => getNewMatchesForLinks(
|
|
6731
6714
|
page,
|
|
6732
6715
|
nextMatches,
|
|
@@ -6737,7 +6720,7 @@ function PrefetchPageLinksImpl({
|
|
|
6737
6720
|
),
|
|
6738
6721
|
[page, nextMatches, matches, manifest, location]
|
|
6739
6722
|
);
|
|
6740
|
-
let newMatchesForAssets =
|
|
6723
|
+
let newMatchesForAssets = React9.useMemo(
|
|
6741
6724
|
() => getNewMatchesForLinks(
|
|
6742
6725
|
page,
|
|
6743
6726
|
nextMatches,
|
|
@@ -6748,7 +6731,7 @@ function PrefetchPageLinksImpl({
|
|
|
6748
6731
|
),
|
|
6749
6732
|
[page, nextMatches, matches, manifest, location]
|
|
6750
6733
|
);
|
|
6751
|
-
let dataHrefs =
|
|
6734
|
+
let dataHrefs = React9.useMemo(() => {
|
|
6752
6735
|
if (page === location.pathname + location.search + location.hash) {
|
|
6753
6736
|
return [];
|
|
6754
6737
|
}
|
|
@@ -6787,15 +6770,15 @@ function PrefetchPageLinksImpl({
|
|
|
6787
6770
|
page,
|
|
6788
6771
|
routeModules
|
|
6789
6772
|
]);
|
|
6790
|
-
let moduleHrefs =
|
|
6773
|
+
let moduleHrefs = React9.useMemo(
|
|
6791
6774
|
() => getModuleLinkHrefs(newMatchesForAssets, manifest),
|
|
6792
6775
|
[newMatchesForAssets, manifest]
|
|
6793
6776
|
);
|
|
6794
6777
|
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
6795
|
-
return /* @__PURE__ */
|
|
6778
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React9.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React9.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
|
|
6796
6779
|
// these don't spread `linkProps` because they are full link descriptors
|
|
6797
6780
|
// already with their own props
|
|
6798
|
-
/* @__PURE__ */
|
|
6781
|
+
/* @__PURE__ */ React9.createElement("link", { key, ...link })
|
|
6799
6782
|
)));
|
|
6800
6783
|
}
|
|
6801
6784
|
function Meta() {
|
|
@@ -6853,7 +6836,7 @@ function Meta() {
|
|
|
6853
6836
|
meta = [...routeMeta];
|
|
6854
6837
|
leafMeta = meta;
|
|
6855
6838
|
}
|
|
6856
|
-
return /* @__PURE__ */
|
|
6839
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, meta.flat().map((metaProps) => {
|
|
6857
6840
|
if (!metaProps) {
|
|
6858
6841
|
return null;
|
|
6859
6842
|
}
|
|
@@ -6866,22 +6849,22 @@ function Meta() {
|
|
|
6866
6849
|
return null;
|
|
6867
6850
|
}
|
|
6868
6851
|
let Comp = tagName;
|
|
6869
|
-
return /* @__PURE__ */
|
|
6852
|
+
return /* @__PURE__ */ React9.createElement(Comp, { key: JSON.stringify(rest), ...rest });
|
|
6870
6853
|
}
|
|
6871
6854
|
if ("title" in metaProps) {
|
|
6872
|
-
return /* @__PURE__ */
|
|
6855
|
+
return /* @__PURE__ */ React9.createElement("title", { key: "title" }, String(metaProps.title));
|
|
6873
6856
|
}
|
|
6874
6857
|
if ("charset" in metaProps) {
|
|
6875
6858
|
metaProps.charSet ?? (metaProps.charSet = metaProps.charset);
|
|
6876
6859
|
delete metaProps.charset;
|
|
6877
6860
|
}
|
|
6878
6861
|
if ("charSet" in metaProps && metaProps.charSet != null) {
|
|
6879
|
-
return typeof metaProps.charSet === "string" ? /* @__PURE__ */
|
|
6862
|
+
return typeof metaProps.charSet === "string" ? /* @__PURE__ */ React9.createElement("meta", { key: "charSet", charSet: metaProps.charSet }) : null;
|
|
6880
6863
|
}
|
|
6881
6864
|
if ("script:ld+json" in metaProps) {
|
|
6882
6865
|
try {
|
|
6883
6866
|
let json = JSON.stringify(metaProps["script:ld+json"]);
|
|
6884
|
-
return /* @__PURE__ */
|
|
6867
|
+
return /* @__PURE__ */ React9.createElement(
|
|
6885
6868
|
"script",
|
|
6886
6869
|
{
|
|
6887
6870
|
key: `script:ld+json:${json}`,
|
|
@@ -6893,7 +6876,7 @@ function Meta() {
|
|
|
6893
6876
|
return null;
|
|
6894
6877
|
}
|
|
6895
6878
|
}
|
|
6896
|
-
return /* @__PURE__ */
|
|
6879
|
+
return /* @__PURE__ */ React9.createElement("meta", { key: JSON.stringify(metaProps), ...metaProps });
|
|
6897
6880
|
}));
|
|
6898
6881
|
}
|
|
6899
6882
|
function isValidMetaTag(tagName) {
|
|
@@ -6909,10 +6892,10 @@ function Scripts(props) {
|
|
|
6909
6892
|
renderMeta.didRenderScripts = true;
|
|
6910
6893
|
}
|
|
6911
6894
|
let matches = getActiveMatches(routerMatches, null, isSpaMode);
|
|
6912
|
-
|
|
6895
|
+
React9.useEffect(() => {
|
|
6913
6896
|
isHydrated = true;
|
|
6914
6897
|
}, []);
|
|
6915
|
-
let initialScripts =
|
|
6898
|
+
let initialScripts = React9.useMemo(() => {
|
|
6916
6899
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
6917
6900
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
6918
6901
|
let routeModulesScript = !isStatic ? " " : `${manifest.hmr?.runtime ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
@@ -6932,7 +6915,7 @@ ${matches.map(
|
|
|
6932
6915
|
window.__reactRouterRouteModules = {${matches.map((match, index) => `${JSON.stringify(match.route.id)}:route${index}`).join(",")}};
|
|
6933
6916
|
|
|
6934
6917
|
import(${JSON.stringify(manifest.entry.module)});`;
|
|
6935
|
-
return /* @__PURE__ */
|
|
6918
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
|
|
6936
6919
|
"script",
|
|
6937
6920
|
{
|
|
6938
6921
|
...props,
|
|
@@ -6940,7 +6923,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
6940
6923
|
dangerouslySetInnerHTML: createHtml(contextScript),
|
|
6941
6924
|
type: void 0
|
|
6942
6925
|
}
|
|
6943
|
-
), /* @__PURE__ */
|
|
6926
|
+
), /* @__PURE__ */ React9.createElement(
|
|
6944
6927
|
"script",
|
|
6945
6928
|
{
|
|
6946
6929
|
...props,
|
|
@@ -6956,21 +6939,21 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
6956
6939
|
return route ? (route.imports || []).concat([route.module]) : [];
|
|
6957
6940
|
}).flat(1);
|
|
6958
6941
|
let preloads = isHydrated ? [] : manifest.entry.imports.concat(routePreloads);
|
|
6959
|
-
return isHydrated ? null : /* @__PURE__ */
|
|
6942
|
+
return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
|
|
6960
6943
|
"link",
|
|
6961
6944
|
{
|
|
6962
6945
|
rel: "modulepreload",
|
|
6963
6946
|
href: manifest.url,
|
|
6964
6947
|
crossOrigin: props.crossOrigin
|
|
6965
6948
|
}
|
|
6966
|
-
) : null, /* @__PURE__ */
|
|
6949
|
+
) : null, /* @__PURE__ */ React9.createElement(
|
|
6967
6950
|
"link",
|
|
6968
6951
|
{
|
|
6969
6952
|
rel: "modulepreload",
|
|
6970
6953
|
href: manifest.entry.module,
|
|
6971
6954
|
crossOrigin: props.crossOrigin
|
|
6972
6955
|
}
|
|
6973
|
-
), dedupe(preloads).map((path) => /* @__PURE__ */
|
|
6956
|
+
), dedupe(preloads).map((path) => /* @__PURE__ */ React9.createElement(
|
|
6974
6957
|
"link",
|
|
6975
6958
|
{
|
|
6976
6959
|
key: path,
|
|
@@ -6999,7 +6982,7 @@ function mergeRefs(...refs) {
|
|
|
6999
6982
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7000
6983
|
try {
|
|
7001
6984
|
if (isBrowser) {
|
|
7002
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
6985
|
+
window.__reactRouterVersion = "0.0.0-experimental-01a3132e6";
|
|
7003
6986
|
}
|
|
7004
6987
|
} catch (e) {
|
|
7005
6988
|
}
|
|
@@ -7079,23 +7062,23 @@ function BrowserRouter({
|
|
|
7079
7062
|
children,
|
|
7080
7063
|
window: window2
|
|
7081
7064
|
}) {
|
|
7082
|
-
let historyRef =
|
|
7065
|
+
let historyRef = React10.useRef();
|
|
7083
7066
|
if (historyRef.current == null) {
|
|
7084
7067
|
historyRef.current = createBrowserHistory({ window: window2, v5Compat: true });
|
|
7085
7068
|
}
|
|
7086
7069
|
let history = historyRef.current;
|
|
7087
|
-
let [state, setStateImpl] =
|
|
7070
|
+
let [state, setStateImpl] = React10.useState({
|
|
7088
7071
|
action: history.action,
|
|
7089
7072
|
location: history.location
|
|
7090
7073
|
});
|
|
7091
|
-
let setState =
|
|
7074
|
+
let setState = React10.useCallback(
|
|
7092
7075
|
(newState) => {
|
|
7093
|
-
|
|
7076
|
+
React10.startTransition(() => setStateImpl(newState));
|
|
7094
7077
|
},
|
|
7095
7078
|
[setStateImpl]
|
|
7096
7079
|
);
|
|
7097
|
-
|
|
7098
|
-
return /* @__PURE__ */
|
|
7080
|
+
React10.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
7081
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7099
7082
|
Router,
|
|
7100
7083
|
{
|
|
7101
7084
|
basename,
|
|
@@ -7107,23 +7090,23 @@ function BrowserRouter({
|
|
|
7107
7090
|
);
|
|
7108
7091
|
}
|
|
7109
7092
|
function HashRouter({ basename, children, window: window2 }) {
|
|
7110
|
-
let historyRef =
|
|
7093
|
+
let historyRef = React10.useRef();
|
|
7111
7094
|
if (historyRef.current == null) {
|
|
7112
7095
|
historyRef.current = createHashHistory({ window: window2, v5Compat: true });
|
|
7113
7096
|
}
|
|
7114
7097
|
let history = historyRef.current;
|
|
7115
|
-
let [state, setStateImpl] =
|
|
7098
|
+
let [state, setStateImpl] = React10.useState({
|
|
7116
7099
|
action: history.action,
|
|
7117
7100
|
location: history.location
|
|
7118
7101
|
});
|
|
7119
|
-
let setState =
|
|
7102
|
+
let setState = React10.useCallback(
|
|
7120
7103
|
(newState) => {
|
|
7121
|
-
|
|
7104
|
+
React10.startTransition(() => setStateImpl(newState));
|
|
7122
7105
|
},
|
|
7123
7106
|
[setStateImpl]
|
|
7124
7107
|
);
|
|
7125
|
-
|
|
7126
|
-
return /* @__PURE__ */
|
|
7108
|
+
React10.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
7109
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7127
7110
|
Router,
|
|
7128
7111
|
{
|
|
7129
7112
|
basename,
|
|
@@ -7139,18 +7122,18 @@ function HistoryRouter({
|
|
|
7139
7122
|
children,
|
|
7140
7123
|
history
|
|
7141
7124
|
}) {
|
|
7142
|
-
let [state, setStateImpl] =
|
|
7125
|
+
let [state, setStateImpl] = React10.useState({
|
|
7143
7126
|
action: history.action,
|
|
7144
7127
|
location: history.location
|
|
7145
7128
|
});
|
|
7146
|
-
let setState =
|
|
7129
|
+
let setState = React10.useCallback(
|
|
7147
7130
|
(newState) => {
|
|
7148
|
-
|
|
7131
|
+
React10.startTransition(() => setStateImpl(newState));
|
|
7149
7132
|
},
|
|
7150
7133
|
[setStateImpl]
|
|
7151
7134
|
);
|
|
7152
|
-
|
|
7153
|
-
return /* @__PURE__ */
|
|
7135
|
+
React10.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
7136
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7154
7137
|
Router,
|
|
7155
7138
|
{
|
|
7156
7139
|
basename,
|
|
@@ -7162,8 +7145,8 @@ function HistoryRouter({
|
|
|
7162
7145
|
);
|
|
7163
7146
|
}
|
|
7164
7147
|
HistoryRouter.displayName = "unstable_HistoryRouter";
|
|
7165
|
-
var
|
|
7166
|
-
var Link =
|
|
7148
|
+
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
7149
|
+
var Link = React10.forwardRef(
|
|
7167
7150
|
function LinkWithRef({
|
|
7168
7151
|
onClick,
|
|
7169
7152
|
discover = "render",
|
|
@@ -7178,8 +7161,8 @@ var Link = React11.forwardRef(
|
|
|
7178
7161
|
viewTransition,
|
|
7179
7162
|
...rest
|
|
7180
7163
|
}, forwardedRef) {
|
|
7181
|
-
let { basename } =
|
|
7182
|
-
let isAbsolute = typeof to === "string" &&
|
|
7164
|
+
let { basename } = React10.useContext(NavigationContext);
|
|
7165
|
+
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
|
|
7183
7166
|
let absoluteHref;
|
|
7184
7167
|
let isExternal = false;
|
|
7185
7168
|
if (typeof to === "string" && isAbsolute) {
|
|
@@ -7223,7 +7206,7 @@ var Link = React11.forwardRef(
|
|
|
7223
7206
|
}
|
|
7224
7207
|
let link = (
|
|
7225
7208
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
7226
|
-
/* @__PURE__ */
|
|
7209
|
+
/* @__PURE__ */ React10.createElement(
|
|
7227
7210
|
"a",
|
|
7228
7211
|
{
|
|
7229
7212
|
...rest,
|
|
@@ -7236,11 +7219,11 @@ var Link = React11.forwardRef(
|
|
|
7236
7219
|
}
|
|
7237
7220
|
)
|
|
7238
7221
|
);
|
|
7239
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */
|
|
7222
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page: href })) : link;
|
|
7240
7223
|
}
|
|
7241
7224
|
);
|
|
7242
7225
|
Link.displayName = "Link";
|
|
7243
|
-
var NavLink =
|
|
7226
|
+
var NavLink = React10.forwardRef(
|
|
7244
7227
|
function NavLinkWithRef({
|
|
7245
7228
|
"aria-current": ariaCurrentProp = "page",
|
|
7246
7229
|
caseSensitive = false,
|
|
@@ -7254,8 +7237,8 @@ var NavLink = React11.forwardRef(
|
|
|
7254
7237
|
}, ref) {
|
|
7255
7238
|
let path = useResolvedPath(to, { relative: rest.relative });
|
|
7256
7239
|
let location = useLocation();
|
|
7257
|
-
let routerState =
|
|
7258
|
-
let { navigator: navigator2, basename } =
|
|
7240
|
+
let routerState = React10.useContext(DataRouterStateContext);
|
|
7241
|
+
let { navigator: navigator2, basename } = React10.useContext(NavigationContext);
|
|
7259
7242
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
7260
7243
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
7261
7244
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -7291,7 +7274,7 @@ var NavLink = React11.forwardRef(
|
|
|
7291
7274
|
].filter(Boolean).join(" ");
|
|
7292
7275
|
}
|
|
7293
7276
|
let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
|
|
7294
|
-
return /* @__PURE__ */
|
|
7277
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7295
7278
|
Link,
|
|
7296
7279
|
{
|
|
7297
7280
|
...rest,
|
|
@@ -7307,7 +7290,7 @@ var NavLink = React11.forwardRef(
|
|
|
7307
7290
|
}
|
|
7308
7291
|
);
|
|
7309
7292
|
NavLink.displayName = "NavLink";
|
|
7310
|
-
var Form =
|
|
7293
|
+
var Form = React10.forwardRef(
|
|
7311
7294
|
({
|
|
7312
7295
|
discover = "render",
|
|
7313
7296
|
fetcherKey,
|
|
@@ -7326,7 +7309,7 @@ var Form = React11.forwardRef(
|
|
|
7326
7309
|
let submit = useSubmit();
|
|
7327
7310
|
let formAction = useFormAction(action, { relative });
|
|
7328
7311
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
7329
|
-
let isAbsolute = typeof action === "string" &&
|
|
7312
|
+
let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
|
|
7330
7313
|
let submitHandler = (event) => {
|
|
7331
7314
|
onSubmit && onSubmit(event);
|
|
7332
7315
|
if (event.defaultPrevented) return;
|
|
@@ -7344,7 +7327,7 @@ var Form = React11.forwardRef(
|
|
|
7344
7327
|
viewTransition
|
|
7345
7328
|
});
|
|
7346
7329
|
};
|
|
7347
|
-
return /* @__PURE__ */
|
|
7330
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7348
7331
|
"form",
|
|
7349
7332
|
{
|
|
7350
7333
|
ref: forwardedRef,
|
|
@@ -7363,12 +7346,12 @@ function ScrollRestoration({
|
|
|
7363
7346
|
storageKey,
|
|
7364
7347
|
...props
|
|
7365
7348
|
}) {
|
|
7366
|
-
let remixContext =
|
|
7367
|
-
let { basename } =
|
|
7349
|
+
let remixContext = React10.useContext(FrameworkContext);
|
|
7350
|
+
let { basename } = React10.useContext(NavigationContext);
|
|
7368
7351
|
let location = useLocation();
|
|
7369
7352
|
let matches = useMatches();
|
|
7370
7353
|
useScrollRestoration({ getKey, storageKey });
|
|
7371
|
-
let ssrKey =
|
|
7354
|
+
let ssrKey = React10.useMemo(
|
|
7372
7355
|
() => {
|
|
7373
7356
|
if (!remixContext || !getKey) return null;
|
|
7374
7357
|
let userKey = getScrollRestorationKey(
|
|
@@ -7402,7 +7385,7 @@ function ScrollRestoration({
|
|
|
7402
7385
|
sessionStorage.removeItem(storageKey2);
|
|
7403
7386
|
}
|
|
7404
7387
|
}).toString();
|
|
7405
|
-
return /* @__PURE__ */
|
|
7388
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7406
7389
|
"script",
|
|
7407
7390
|
{
|
|
7408
7391
|
...props,
|
|
@@ -7420,12 +7403,12 @@ function getDataRouterConsoleError2(hookName) {
|
|
|
7420
7403
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
7421
7404
|
}
|
|
7422
7405
|
function useDataRouterContext3(hookName) {
|
|
7423
|
-
let ctx =
|
|
7406
|
+
let ctx = React10.useContext(DataRouterContext);
|
|
7424
7407
|
invariant(ctx, getDataRouterConsoleError2(hookName));
|
|
7425
7408
|
return ctx;
|
|
7426
7409
|
}
|
|
7427
7410
|
function useDataRouterState2(hookName) {
|
|
7428
|
-
let state =
|
|
7411
|
+
let state = React10.useContext(DataRouterStateContext);
|
|
7429
7412
|
invariant(state, getDataRouterConsoleError2(hookName));
|
|
7430
7413
|
return state;
|
|
7431
7414
|
}
|
|
@@ -7440,7 +7423,7 @@ function useLinkClickHandler(to, {
|
|
|
7440
7423
|
let navigate = useNavigate();
|
|
7441
7424
|
let location = useLocation();
|
|
7442
7425
|
let path = useResolvedPath(to, { relative });
|
|
7443
|
-
return
|
|
7426
|
+
return React10.useCallback(
|
|
7444
7427
|
(event) => {
|
|
7445
7428
|
if (shouldProcessLinkClick(event, target)) {
|
|
7446
7429
|
event.preventDefault();
|
|
@@ -7473,10 +7456,10 @@ function useSearchParams(defaultInit) {
|
|
|
7473
7456
|
typeof URLSearchParams !== "undefined",
|
|
7474
7457
|
`You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.`
|
|
7475
7458
|
);
|
|
7476
|
-
let defaultSearchParamsRef =
|
|
7477
|
-
let hasSetSearchParamsRef =
|
|
7459
|
+
let defaultSearchParamsRef = React10.useRef(createSearchParams(defaultInit));
|
|
7460
|
+
let hasSetSearchParamsRef = React10.useRef(false);
|
|
7478
7461
|
let location = useLocation();
|
|
7479
|
-
let searchParams =
|
|
7462
|
+
let searchParams = React10.useMemo(
|
|
7480
7463
|
() => (
|
|
7481
7464
|
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
7482
7465
|
// Once we call that we want those to take precedence, otherwise you can't
|
|
@@ -7489,7 +7472,7 @@ function useSearchParams(defaultInit) {
|
|
|
7489
7472
|
[location.search]
|
|
7490
7473
|
);
|
|
7491
7474
|
let navigate = useNavigate();
|
|
7492
|
-
let setSearchParams =
|
|
7475
|
+
let setSearchParams = React10.useCallback(
|
|
7493
7476
|
(nextInit, navigateOptions) => {
|
|
7494
7477
|
const newSearchParams = createSearchParams(
|
|
7495
7478
|
typeof nextInit === "function" ? nextInit(searchParams) : nextInit
|
|
@@ -7505,9 +7488,9 @@ var fetcherId = 0;
|
|
|
7505
7488
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
7506
7489
|
function useSubmit() {
|
|
7507
7490
|
let { router } = useDataRouterContext3("useSubmit" /* UseSubmit */);
|
|
7508
|
-
let { basename } =
|
|
7491
|
+
let { basename } = React10.useContext(NavigationContext);
|
|
7509
7492
|
let currentRouteId = useRouteId();
|
|
7510
|
-
return
|
|
7493
|
+
return React10.useCallback(
|
|
7511
7494
|
async (target, options = {}) => {
|
|
7512
7495
|
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
7513
7496
|
target,
|
|
@@ -7542,8 +7525,8 @@ function useSubmit() {
|
|
|
7542
7525
|
);
|
|
7543
7526
|
}
|
|
7544
7527
|
function useFormAction(action, { relative } = {}) {
|
|
7545
|
-
let { basename } =
|
|
7546
|
-
let routeContext =
|
|
7528
|
+
let { basename } = React10.useContext(NavigationContext);
|
|
7529
|
+
let routeContext = React10.useContext(RouteContext);
|
|
7547
7530
|
invariant(routeContext, "useFormAction must be used inside a RouteContext");
|
|
7548
7531
|
let [match] = routeContext.matches.slice(-1);
|
|
7549
7532
|
let path = { ...useResolvedPath(action ? action : ".", { relative }) };
|
|
@@ -7573,8 +7556,8 @@ function useFetcher({
|
|
|
7573
7556
|
} = {}) {
|
|
7574
7557
|
let { router } = useDataRouterContext3("useFetcher" /* UseFetcher */);
|
|
7575
7558
|
let state = useDataRouterState2("useFetcher" /* UseFetcher */);
|
|
7576
|
-
let fetcherData =
|
|
7577
|
-
let route =
|
|
7559
|
+
let fetcherData = React10.useContext(FetchersContext);
|
|
7560
|
+
let route = React10.useContext(RouteContext);
|
|
7578
7561
|
let routeId = route.matches[route.matches.length - 1]?.route.id;
|
|
7579
7562
|
invariant(fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
7580
7563
|
invariant(route, `useFetcher must be used inside a RouteContext`);
|
|
@@ -7582,16 +7565,16 @@ function useFetcher({
|
|
|
7582
7565
|
routeId != null,
|
|
7583
7566
|
`useFetcher can only be used on routes that contain a unique "id"`
|
|
7584
7567
|
);
|
|
7585
|
-
let defaultKey =
|
|
7586
|
-
let [fetcherKey, setFetcherKey] =
|
|
7568
|
+
let defaultKey = React10.useId();
|
|
7569
|
+
let [fetcherKey, setFetcherKey] = React10.useState(key || defaultKey);
|
|
7587
7570
|
if (key && key !== fetcherKey) {
|
|
7588
7571
|
setFetcherKey(key);
|
|
7589
7572
|
}
|
|
7590
|
-
|
|
7573
|
+
React10.useEffect(() => {
|
|
7591
7574
|
router.getFetcher(fetcherKey);
|
|
7592
7575
|
return () => router.deleteFetcher(fetcherKey);
|
|
7593
7576
|
}, [router, fetcherKey]);
|
|
7594
|
-
let load =
|
|
7577
|
+
let load = React10.useCallback(
|
|
7595
7578
|
async (href, opts) => {
|
|
7596
7579
|
invariant(routeId, "No routeId available for fetcher.load()");
|
|
7597
7580
|
await router.fetch(fetcherKey, routeId, href, opts);
|
|
@@ -7599,7 +7582,7 @@ function useFetcher({
|
|
|
7599
7582
|
[fetcherKey, routeId, router]
|
|
7600
7583
|
);
|
|
7601
7584
|
let submitImpl = useSubmit();
|
|
7602
|
-
let submit =
|
|
7585
|
+
let submit = React10.useCallback(
|
|
7603
7586
|
async (target, opts) => {
|
|
7604
7587
|
await submitImpl(target, {
|
|
7605
7588
|
...opts,
|
|
@@ -7609,10 +7592,10 @@ function useFetcher({
|
|
|
7609
7592
|
},
|
|
7610
7593
|
[fetcherKey, submitImpl]
|
|
7611
7594
|
);
|
|
7612
|
-
let FetcherForm =
|
|
7613
|
-
let FetcherForm2 =
|
|
7595
|
+
let FetcherForm = React10.useMemo(() => {
|
|
7596
|
+
let FetcherForm2 = React10.forwardRef(
|
|
7614
7597
|
(props, ref) => {
|
|
7615
|
-
return /* @__PURE__ */
|
|
7598
|
+
return /* @__PURE__ */ React10.createElement(Form, { ...props, navigate: false, fetcherKey, ref });
|
|
7616
7599
|
}
|
|
7617
7600
|
);
|
|
7618
7601
|
FetcherForm2.displayName = "fetcher.Form";
|
|
@@ -7620,7 +7603,7 @@ function useFetcher({
|
|
|
7620
7603
|
}, [fetcherKey]);
|
|
7621
7604
|
let fetcher = state.fetchers.get(fetcherKey) || IDLE_FETCHER;
|
|
7622
7605
|
let data2 = fetcherData.get(fetcherKey);
|
|
7623
|
-
let fetcherWithComponents =
|
|
7606
|
+
let fetcherWithComponents = React10.useMemo(
|
|
7624
7607
|
() => ({
|
|
7625
7608
|
Form: FetcherForm,
|
|
7626
7609
|
submit,
|
|
@@ -7669,18 +7652,18 @@ function useScrollRestoration({
|
|
|
7669
7652
|
let { restoreScrollPosition, preventScrollReset } = useDataRouterState2(
|
|
7670
7653
|
"useScrollRestoration" /* UseScrollRestoration */
|
|
7671
7654
|
);
|
|
7672
|
-
let { basename } =
|
|
7655
|
+
let { basename } = React10.useContext(NavigationContext);
|
|
7673
7656
|
let location = useLocation();
|
|
7674
7657
|
let matches = useMatches();
|
|
7675
7658
|
let navigation = useNavigation();
|
|
7676
|
-
|
|
7659
|
+
React10.useEffect(() => {
|
|
7677
7660
|
window.history.scrollRestoration = "manual";
|
|
7678
7661
|
return () => {
|
|
7679
7662
|
window.history.scrollRestoration = "auto";
|
|
7680
7663
|
};
|
|
7681
7664
|
}, []);
|
|
7682
7665
|
usePageHide(
|
|
7683
|
-
|
|
7666
|
+
React10.useCallback(() => {
|
|
7684
7667
|
if (navigation.state === "idle") {
|
|
7685
7668
|
let key = getScrollRestorationKey(location, matches, basename, getKey);
|
|
7686
7669
|
savedScrollPositions[key] = window.scrollY;
|
|
@@ -7700,7 +7683,7 @@ function useScrollRestoration({
|
|
|
7700
7683
|
}, [navigation.state, getKey, basename, location, matches, storageKey])
|
|
7701
7684
|
);
|
|
7702
7685
|
if (typeof document !== "undefined") {
|
|
7703
|
-
|
|
7686
|
+
React10.useLayoutEffect(() => {
|
|
7704
7687
|
try {
|
|
7705
7688
|
let sessionPositions = sessionStorage.getItem(
|
|
7706
7689
|
storageKey || SCROLL_RESTORATION_STORAGE_KEY
|
|
@@ -7711,7 +7694,7 @@ function useScrollRestoration({
|
|
|
7711
7694
|
} catch (e) {
|
|
7712
7695
|
}
|
|
7713
7696
|
}, [storageKey]);
|
|
7714
|
-
|
|
7697
|
+
React10.useLayoutEffect(() => {
|
|
7715
7698
|
let disableScrollRestoration = router?.enableScrollRestoration(
|
|
7716
7699
|
savedScrollPositions,
|
|
7717
7700
|
() => window.scrollY,
|
|
@@ -7719,7 +7702,7 @@ function useScrollRestoration({
|
|
|
7719
7702
|
);
|
|
7720
7703
|
return () => disableScrollRestoration && disableScrollRestoration();
|
|
7721
7704
|
}, [router, basename, getKey]);
|
|
7722
|
-
|
|
7705
|
+
React10.useLayoutEffect(() => {
|
|
7723
7706
|
if (restoreScrollPosition === false) {
|
|
7724
7707
|
return;
|
|
7725
7708
|
}
|
|
@@ -7745,7 +7728,7 @@ function useScrollRestoration({
|
|
|
7745
7728
|
}
|
|
7746
7729
|
function useBeforeUnload(callback, options) {
|
|
7747
7730
|
let { capture } = options || {};
|
|
7748
|
-
|
|
7731
|
+
React10.useEffect(() => {
|
|
7749
7732
|
let opts = capture != null ? { capture } : void 0;
|
|
7750
7733
|
window.addEventListener("beforeunload", callback, opts);
|
|
7751
7734
|
return () => {
|
|
@@ -7755,7 +7738,7 @@ function useBeforeUnload(callback, options) {
|
|
|
7755
7738
|
}
|
|
7756
7739
|
function usePageHide(callback, options) {
|
|
7757
7740
|
let { capture } = options || {};
|
|
7758
|
-
|
|
7741
|
+
React10.useEffect(() => {
|
|
7759
7742
|
let opts = capture != null ? { capture } : void 0;
|
|
7760
7743
|
window.addEventListener("pagehide", callback, opts);
|
|
7761
7744
|
return () => {
|
|
@@ -7768,7 +7751,7 @@ function usePrompt({
|
|
|
7768
7751
|
message
|
|
7769
7752
|
}) {
|
|
7770
7753
|
let blocker = useBlocker(when);
|
|
7771
|
-
|
|
7754
|
+
React10.useEffect(() => {
|
|
7772
7755
|
if (blocker.state === "blocked") {
|
|
7773
7756
|
let proceed = window.confirm(message);
|
|
7774
7757
|
if (proceed) {
|
|
@@ -7778,14 +7761,14 @@ function usePrompt({
|
|
|
7778
7761
|
}
|
|
7779
7762
|
}
|
|
7780
7763
|
}, [blocker, message]);
|
|
7781
|
-
|
|
7764
|
+
React10.useEffect(() => {
|
|
7782
7765
|
if (blocker.state === "blocked" && !when) {
|
|
7783
7766
|
blocker.reset();
|
|
7784
7767
|
}
|
|
7785
7768
|
}, [blocker, when]);
|
|
7786
7769
|
}
|
|
7787
7770
|
function useViewTransitionState(to, opts = {}) {
|
|
7788
|
-
let vtContext =
|
|
7771
|
+
let vtContext = React10.useContext(ViewTransitionContext);
|
|
7789
7772
|
invariant(
|
|
7790
7773
|
vtContext != null,
|
|
7791
7774
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
@@ -7802,8 +7785,8 @@ function useViewTransitionState(to, opts = {}) {
|
|
|
7802
7785
|
return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
|
|
7803
7786
|
}
|
|
7804
7787
|
|
|
7805
|
-
// lib/dom/
|
|
7806
|
-
import * as
|
|
7788
|
+
// lib/dom/server.tsx
|
|
7789
|
+
import * as React11 from "react";
|
|
7807
7790
|
function StaticRouter({
|
|
7808
7791
|
basename,
|
|
7809
7792
|
children,
|
|
@@ -7821,7 +7804,7 @@ function StaticRouter({
|
|
|
7821
7804
|
key: locationProp.key || "default"
|
|
7822
7805
|
};
|
|
7823
7806
|
let staticNavigator = getStatelessNavigator();
|
|
7824
|
-
return /* @__PURE__ */
|
|
7807
|
+
return /* @__PURE__ */ React11.createElement(
|
|
7825
7808
|
Router,
|
|
7826
7809
|
{
|
|
7827
7810
|
basename,
|
|
@@ -7862,7 +7845,7 @@ function StaticRouterProvider({
|
|
|
7862
7845
|
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
7863
7846
|
}
|
|
7864
7847
|
let { state } = dataRouterContext.router;
|
|
7865
|
-
return /* @__PURE__ */
|
|
7848
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React11.createElement(DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React11.createElement(FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React11.createElement(ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React11.createElement(
|
|
7866
7849
|
Router,
|
|
7867
7850
|
{
|
|
7868
7851
|
basename: dataRouterContext.basename,
|
|
@@ -7871,7 +7854,7 @@ function StaticRouterProvider({
|
|
|
7871
7854
|
navigator: dataRouterContext.navigator,
|
|
7872
7855
|
static: dataRouterContext.static
|
|
7873
7856
|
},
|
|
7874
|
-
/* @__PURE__ */
|
|
7857
|
+
/* @__PURE__ */ React11.createElement(
|
|
7875
7858
|
DataRoutes2,
|
|
7876
7859
|
{
|
|
7877
7860
|
routes: router.routes,
|
|
@@ -7879,7 +7862,7 @@ function StaticRouterProvider({
|
|
|
7879
7862
|
state
|
|
7880
7863
|
}
|
|
7881
7864
|
)
|
|
7882
|
-
))))), hydrateScript ? /* @__PURE__ */
|
|
7865
|
+
))))), hydrateScript ? /* @__PURE__ */ React11.createElement(
|
|
7883
7866
|
"script",
|
|
7884
7867
|
{
|
|
7885
7868
|
suppressHydrationWarning: true,
|
|
@@ -7949,19 +7932,6 @@ function getStatelessNavigator() {
|
|
|
7949
7932
|
}
|
|
7950
7933
|
};
|
|
7951
7934
|
}
|
|
7952
|
-
var ESCAPE_LOOKUP2 = {
|
|
7953
|
-
"&": "\\u0026",
|
|
7954
|
-
">": "\\u003e",
|
|
7955
|
-
"<": "\\u003c",
|
|
7956
|
-
"\u2028": "\\u2028",
|
|
7957
|
-
"\u2029": "\\u2029"
|
|
7958
|
-
};
|
|
7959
|
-
var ESCAPE_REGEX2 = /[&><\u2028\u2029]/g;
|
|
7960
|
-
function htmlEscape(str) {
|
|
7961
|
-
return str.replace(ESCAPE_REGEX2, (match) => ESCAPE_LOOKUP2[match]);
|
|
7962
|
-
}
|
|
7963
|
-
|
|
7964
|
-
// lib/dom/server.tsx
|
|
7965
7935
|
function createStaticHandler2(routes, opts) {
|
|
7966
7936
|
return createStaticHandler(routes, {
|
|
7967
7937
|
...opts,
|
|
@@ -8060,9 +8030,34 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
8060
8030
|
}
|
|
8061
8031
|
};
|
|
8062
8032
|
}
|
|
8033
|
+
function createHref(to) {
|
|
8034
|
+
return typeof to === "string" ? to : createPath(to);
|
|
8035
|
+
}
|
|
8036
|
+
function encodeLocation(to) {
|
|
8037
|
+
let href = typeof to === "string" ? to : createPath(to);
|
|
8038
|
+
href = href.replace(/ $/, "%20");
|
|
8039
|
+
let encoded = ABSOLUTE_URL_REGEX3.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
8040
|
+
return {
|
|
8041
|
+
pathname: encoded.pathname,
|
|
8042
|
+
search: encoded.search,
|
|
8043
|
+
hash: encoded.hash
|
|
8044
|
+
};
|
|
8045
|
+
}
|
|
8046
|
+
var ABSOLUTE_URL_REGEX3 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
8047
|
+
var ESCAPE_LOOKUP2 = {
|
|
8048
|
+
"&": "\\u0026",
|
|
8049
|
+
">": "\\u003e",
|
|
8050
|
+
"<": "\\u003c",
|
|
8051
|
+
"\u2028": "\\u2028",
|
|
8052
|
+
"\u2029": "\\u2029"
|
|
8053
|
+
};
|
|
8054
|
+
var ESCAPE_REGEX2 = /[&><\u2028\u2029]/g;
|
|
8055
|
+
function htmlEscape(str) {
|
|
8056
|
+
return str.replace(ESCAPE_REGEX2, (match) => ESCAPE_LOOKUP2[match]);
|
|
8057
|
+
}
|
|
8063
8058
|
|
|
8064
8059
|
// lib/dom/ssr/server.tsx
|
|
8065
|
-
import * as
|
|
8060
|
+
import * as React12 from "react";
|
|
8066
8061
|
function ServerRouter({
|
|
8067
8062
|
context,
|
|
8068
8063
|
url,
|
|
@@ -8090,7 +8085,7 @@ function ServerRouter({
|
|
|
8090
8085
|
}
|
|
8091
8086
|
}
|
|
8092
8087
|
let router = createStaticRouter(routes, context.staticHandlerContext);
|
|
8093
|
-
return /* @__PURE__ */
|
|
8088
|
+
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(
|
|
8094
8089
|
FrameworkContext.Provider,
|
|
8095
8090
|
{
|
|
8096
8091
|
value: {
|
|
@@ -8104,7 +8099,7 @@ function ServerRouter({
|
|
|
8104
8099
|
renderMeta: context.renderMeta
|
|
8105
8100
|
}
|
|
8106
8101
|
},
|
|
8107
|
-
/* @__PURE__ */
|
|
8102
|
+
/* @__PURE__ */ React12.createElement(RemixErrorBoundary, { location: router.state.location }, /* @__PURE__ */ React12.createElement(
|
|
8108
8103
|
StaticRouterProvider,
|
|
8109
8104
|
{
|
|
8110
8105
|
router,
|
|
@@ -8112,7 +8107,7 @@ function ServerRouter({
|
|
|
8112
8107
|
hydrate: false
|
|
8113
8108
|
}
|
|
8114
8109
|
))
|
|
8115
|
-
), context.serverHandoffStream ? /* @__PURE__ */
|
|
8110
|
+
), context.serverHandoffStream ? /* @__PURE__ */ React12.createElement(React12.Suspense, null, /* @__PURE__ */ React12.createElement(
|
|
8116
8111
|
StreamTransfer,
|
|
8117
8112
|
{
|
|
8118
8113
|
context,
|
|
@@ -8125,7 +8120,7 @@ function ServerRouter({
|
|
|
8125
8120
|
}
|
|
8126
8121
|
|
|
8127
8122
|
// lib/dom/ssr/routes-test-stub.tsx
|
|
8128
|
-
import * as
|
|
8123
|
+
import * as React13 from "react";
|
|
8129
8124
|
function createRoutesStub(routes, context = {}) {
|
|
8130
8125
|
return function RoutesTestStub({
|
|
8131
8126
|
initialEntries,
|
|
@@ -8133,8 +8128,8 @@ function createRoutesStub(routes, context = {}) {
|
|
|
8133
8128
|
hydrationData,
|
|
8134
8129
|
future
|
|
8135
8130
|
}) {
|
|
8136
|
-
let routerRef =
|
|
8137
|
-
let remixContextRef =
|
|
8131
|
+
let routerRef = React13.useRef();
|
|
8132
|
+
let remixContextRef = React13.useRef();
|
|
8138
8133
|
if (routerRef.current == null) {
|
|
8139
8134
|
remixContextRef.current = {
|
|
8140
8135
|
future: {},
|
|
@@ -8160,7 +8155,7 @@ function createRoutesStub(routes, context = {}) {
|
|
|
8160
8155
|
hydrationData
|
|
8161
8156
|
});
|
|
8162
8157
|
}
|
|
8163
|
-
return /* @__PURE__ */
|
|
8158
|
+
return /* @__PURE__ */ React13.createElement(FrameworkContext.Provider, { value: remixContextRef.current }, /* @__PURE__ */ React13.createElement(RouterProvider, { router: routerRef.current }));
|
|
8164
8159
|
};
|
|
8165
8160
|
}
|
|
8166
8161
|
function processRoutes(routes, context, manifest, routeModules, parentId) {
|