@cedarjs/router 5.0.6 → 5.0.7-next.219
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/Set.d.ts +8 -0
- package/dist/Set.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/package.json +26 -68
- package/dist/cjs/ActivePageContext.d.ts +0 -15
- package/dist/cjs/ActivePageContext.d.ts.map +0 -1
- package/dist/cjs/ActivePageContext.js +0 -42
- package/dist/cjs/AuthenticatedRoute.d.ts +0 -11
- package/dist/cjs/AuthenticatedRoute.d.ts.map +0 -1
- package/dist/cjs/AuthenticatedRoute.js +0 -83
- package/dist/cjs/PageLoadingContext.d.ts +0 -14
- package/dist/cjs/PageLoadingContext.d.ts.map +0 -1
- package/dist/cjs/PageLoadingContext.js +0 -64
- package/dist/cjs/Route.d.ts +0 -32
- package/dist/cjs/Route.d.ts.map +0 -1
- package/dist/cjs/Route.js +0 -41
- package/dist/cjs/Set.d.ts +0 -58
- package/dist/cjs/Set.d.ts.map +0 -1
- package/dist/cjs/Set.js +0 -67
- package/dist/cjs/a11yUtils.d.ts +0 -14
- package/dist/cjs/a11yUtils.d.ts.map +0 -1
- package/dist/cjs/a11yUtils.js +0 -61
- package/dist/cjs/active-route-loader.d.ts +0 -12
- package/dist/cjs/active-route-loader.d.ts.map +0 -1
- package/dist/cjs/active-route-loader.js +0 -116
- package/dist/cjs/analyzeRoutes.d.ts +0 -44
- package/dist/cjs/analyzeRoutes.d.ts.map +0 -1
- package/dist/cjs/analyzeRoutes.js +0 -143
- package/dist/cjs/createNamedContext.d.ts +0 -3
- package/dist/cjs/createNamedContext.d.ts.map +0 -1
- package/dist/cjs/createNamedContext.js +0 -33
- package/dist/cjs/dummyComponent.d.ts +0 -3
- package/dist/cjs/dummyComponent.d.ts.map +0 -1
- package/dist/cjs/dummyComponent.js +0 -24
- package/dist/cjs/history.d.ts +0 -24
- package/dist/cjs/history.d.ts.map +0 -1
- package/dist/cjs/history.js +0 -145
- package/dist/cjs/index.d.ts +0 -35
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/index.js +0 -110
- package/dist/cjs/link.d.ts +0 -9
- package/dist/cjs/link.d.ts.map +0 -1
- package/dist/cjs/link.js +0 -62
- package/dist/cjs/location.d.ts +0 -28
- package/dist/cjs/location.d.ts.map +0 -1
- package/dist/cjs/location.js +0 -110
- package/dist/cjs/namedRoutes.d.ts +0 -3
- package/dist/cjs/namedRoutes.d.ts.map +0 -1
- package/dist/cjs/namedRoutes.js +0 -28
- package/dist/cjs/navLink.d.ts +0 -11
- package/dist/cjs/navLink.d.ts.map +0 -1
- package/dist/cjs/navLink.js +0 -70
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/page.d.ts +0 -28
- package/dist/cjs/page.d.ts.map +0 -1
- package/dist/cjs/page.js +0 -42
- package/dist/cjs/params.d.ts +0 -13
- package/dist/cjs/params.d.ts.map +0 -1
- package/dist/cjs/params.js +0 -64
- package/dist/cjs/react-util.d.ts +0 -3
- package/dist/cjs/react-util.d.ts.map +0 -1
- package/dist/cjs/react-util.js +0 -37
- package/dist/cjs/redirect.d.ts +0 -12
- package/dist/cjs/redirect.d.ts.map +0 -1
- package/dist/cjs/redirect.js +0 -35
- package/dist/cjs/route-announcement.d.ts +0 -13
- package/dist/cjs/route-announcement.d.ts.map +0 -1
- package/dist/cjs/route-announcement.js +0 -61
- package/dist/cjs/route-focus.d.ts +0 -12
- package/dist/cjs/route-focus.d.ts.map +0 -1
- package/dist/cjs/route-focus.js +0 -36
- package/dist/cjs/route-validators.d.ts +0 -21
- package/dist/cjs/route-validators.d.ts.map +0 -1
- package/dist/cjs/route-validators.js +0 -71
- package/dist/cjs/routeParamsTypes.d.ts +0 -49
- package/dist/cjs/routeParamsTypes.d.ts.map +0 -1
- package/dist/cjs/routeParamsTypes.js +0 -16
- package/dist/cjs/router-context.d.ts +0 -23
- package/dist/cjs/router-context.d.ts.map +0 -1
- package/dist/cjs/router-context.js +0 -69
- package/dist/cjs/router.d.ts +0 -11
- package/dist/cjs/router.d.ts.map +0 -1
- package/dist/cjs/router.js +0 -207
- package/dist/cjs/rsc/ClientRouter.d.ts +0 -4
- package/dist/cjs/rsc/ClientRouter.d.ts.map +0 -1
- package/dist/cjs/rsc/ClientRouter.js +0 -90
- package/dist/cjs/rsc/RscCache.d.ts +0 -23
- package/dist/cjs/rsc/RscCache.d.ts.map +0 -1
- package/dist/cjs/rsc/RscCache.js +0 -110
- package/dist/cjs/rsc/RscRoutes.d.ts +0 -7
- package/dist/cjs/rsc/RscRoutes.d.ts.map +0 -1
- package/dist/cjs/rsc/RscRoutes.js +0 -124
- package/dist/cjs/rsc/ServerRouteLoader.d.ts +0 -12
- package/dist/cjs/rsc/ServerRouteLoader.d.ts.map +0 -1
- package/dist/cjs/rsc/ServerRouteLoader.js +0 -65
- package/dist/cjs/rsc/ServerRouter.d.ts +0 -11
- package/dist/cjs/rsc/ServerRouter.d.ts.map +0 -1
- package/dist/cjs/rsc/ServerRouter.js +0 -170
- package/dist/cjs/rsc/SsrRouter.d.ts +0 -4
- package/dist/cjs/rsc/SsrRouter.d.ts.map +0 -1
- package/dist/cjs/rsc/SsrRouter.js +0 -56
- package/dist/cjs/rsc/clientSsr.d.ts +0 -2
- package/dist/cjs/rsc/clientSsr.d.ts.map +0 -1
- package/dist/cjs/rsc/clientSsr.js +0 -114
- package/dist/cjs/rsc/rscCss.d.ts +0 -2
- package/dist/cjs/rsc/rscCss.d.ts.map +0 -1
- package/dist/cjs/rsc/rscCss.js +0 -94
- package/dist/cjs/rsc/ssrModuleMap.d.ts +0 -14
- package/dist/cjs/rsc/ssrModuleMap.d.ts.map +0 -1
- package/dist/cjs/rsc/ssrModuleMap.js +0 -49
- package/dist/cjs/rsc/utils.d.ts +0 -22
- package/dist/cjs/rsc/utils.d.ts.map +0 -1
- package/dist/cjs/rsc/utils.js +0 -68
- package/dist/cjs/rsc-link.d.ts +0 -6
- package/dist/cjs/rsc-link.d.ts.map +0 -1
- package/dist/cjs/rsc-link.js +0 -41
- package/dist/cjs/skipNav.d.ts +0 -81
- package/dist/cjs/skipNav.d.ts.map +0 -1
- package/dist/cjs/skipNav.js +0 -69
- package/dist/cjs/splash-page.d.ts +0 -12
- package/dist/cjs/splash-page.d.ts.map +0 -1
- package/dist/cjs/splash-page.js +0 -503
- package/dist/cjs/useBlocker.d.ts +0 -11
- package/dist/cjs/useBlocker.d.ts.map +0 -1
- package/dist/cjs/useBlocker.js +0 -65
- package/dist/cjs/useIsMounted.d.ts +0 -2
- package/dist/cjs/useIsMounted.d.ts.map +0 -1
- package/dist/cjs/useIsMounted.js +0 -37
- package/dist/cjs/useMatch.d.ts +0 -43
- package/dist/cjs/useMatch.d.ts.map +0 -1
- package/dist/cjs/useMatch.js +0 -72
- package/dist/cjs/useRouteName.d.ts +0 -3
- package/dist/cjs/useRouteName.d.ts.map +0 -1
- package/dist/cjs/useRouteName.js +0 -40
- package/dist/cjs/useRoutePaths.d.ts +0 -4
- package/dist/cjs/useRoutePaths.d.ts.map +0 -1
- package/dist/cjs/useRoutePaths.js +0 -50
- package/dist/cjs/util.d.ts +0 -121
- package/dist/cjs/util.d.ts.map +0 -1
- package/dist/cjs/util.js +0 -214
package/dist/cjs/history.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var history_exports = {};
|
|
20
|
-
__export(history_exports, {
|
|
21
|
-
back: () => back,
|
|
22
|
-
block: () => block,
|
|
23
|
-
gHistory: () => gHistory,
|
|
24
|
-
navigate: () => navigate,
|
|
25
|
-
unblock: () => unblock
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(history_exports);
|
|
28
|
-
const createHistory = () => {
|
|
29
|
-
const listeners = {};
|
|
30
|
-
const blockers = [];
|
|
31
|
-
let beforeUnloadListener = null;
|
|
32
|
-
const history = {
|
|
33
|
-
listen: (listener) => {
|
|
34
|
-
const rndId = Math.random().toString(36).substring(2, 15);
|
|
35
|
-
const listenerId = "CEDAR_HISTORY_LISTENER_ID_" + rndId;
|
|
36
|
-
listeners[listenerId] = listener;
|
|
37
|
-
globalThis.addEventListener("popstate", listener);
|
|
38
|
-
return listenerId;
|
|
39
|
-
},
|
|
40
|
-
navigate: (to, options = {
|
|
41
|
-
scroll: true
|
|
42
|
-
}) => {
|
|
43
|
-
const performNavigation = () => {
|
|
44
|
-
const { pathname, search, hash } = new URL(
|
|
45
|
-
globalThis?.location?.origin + to
|
|
46
|
-
);
|
|
47
|
-
if (globalThis?.location?.pathname !== pathname || globalThis?.location?.search !== search || globalThis?.location?.hash !== hash) {
|
|
48
|
-
if (options?.replace) {
|
|
49
|
-
globalThis.history.replaceState({}, "", to);
|
|
50
|
-
} else {
|
|
51
|
-
globalThis.history.pushState({}, "", to);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
for (const listener of Object.values(listeners)) {
|
|
55
|
-
listener(void 0, options);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
if (blockers.length > 0) {
|
|
59
|
-
processBlockers(0, performNavigation);
|
|
60
|
-
} else {
|
|
61
|
-
performNavigation();
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
back: () => {
|
|
65
|
-
const performBack = () => {
|
|
66
|
-
globalThis.history.back();
|
|
67
|
-
for (const listener of Object.values(listeners)) {
|
|
68
|
-
listener();
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
if (blockers.length > 0) {
|
|
72
|
-
processBlockers(0, performBack);
|
|
73
|
-
} else {
|
|
74
|
-
performBack();
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
remove: (listenerId) => {
|
|
78
|
-
if (listeners[listenerId]) {
|
|
79
|
-
const listener = listeners[listenerId];
|
|
80
|
-
globalThis.removeEventListener("popstate", listener);
|
|
81
|
-
delete listeners[listenerId];
|
|
82
|
-
} else {
|
|
83
|
-
console.warn(`History Listener with ID: ${listenerId} does not exist.`);
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
block: (id, callback) => {
|
|
87
|
-
const existingBlockerIndex = blockers.findIndex(
|
|
88
|
-
(blocker) => blocker.id === id
|
|
89
|
-
);
|
|
90
|
-
if (existingBlockerIndex !== -1) {
|
|
91
|
-
blockers[existingBlockerIndex] = { id, callback };
|
|
92
|
-
} else {
|
|
93
|
-
blockers.push({ id, callback });
|
|
94
|
-
if (blockers.length === 1) {
|
|
95
|
-
addBeforeUnloadListener();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
unblock: (id) => {
|
|
100
|
-
const index = blockers.findIndex((blocker) => blocker.id === id);
|
|
101
|
-
if (index !== -1) {
|
|
102
|
-
blockers.splice(index, 1);
|
|
103
|
-
if (blockers.length === 0) {
|
|
104
|
-
removeBeforeUnloadListener();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const processBlockers = (index, navigate2) => {
|
|
110
|
-
if (index < blockers.length) {
|
|
111
|
-
blockers[index].callback({
|
|
112
|
-
retry: () => processBlockers(index + 1, navigate2)
|
|
113
|
-
});
|
|
114
|
-
} else {
|
|
115
|
-
navigate2();
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const addBeforeUnloadListener = () => {
|
|
119
|
-
if (!beforeUnloadListener) {
|
|
120
|
-
beforeUnloadListener = (event) => {
|
|
121
|
-
if (blockers.length > 0) {
|
|
122
|
-
event.preventDefault();
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
globalThis.addEventListener("beforeunload", beforeUnloadListener);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
const removeBeforeUnloadListener = () => {
|
|
129
|
-
if (beforeUnloadListener) {
|
|
130
|
-
globalThis.removeEventListener("beforeunload", beforeUnloadListener);
|
|
131
|
-
beforeUnloadListener = null;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
return history;
|
|
135
|
-
};
|
|
136
|
-
const gHistory = createHistory();
|
|
137
|
-
const { navigate, back, block, unblock } = gHistory;
|
|
138
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
139
|
-
0 && (module.exports = {
|
|
140
|
-
back,
|
|
141
|
-
block,
|
|
142
|
-
gHistory,
|
|
143
|
-
navigate,
|
|
144
|
-
unblock
|
|
145
|
-
});
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export { navigate, back } from './history.js';
|
|
2
|
-
export { NavLink } from './navLink.js';
|
|
3
|
-
export { Link } from './link.js';
|
|
4
|
-
export { useLocation, LocationProvider } from './location.js';
|
|
5
|
-
export { Redirect } from './redirect.js';
|
|
6
|
-
export { usePageLoadingContext, PageLoadingContextProvider, } from './PageLoadingContext.js';
|
|
7
|
-
export { useParams, ParamsProvider, ParamsContext } from './params.js';
|
|
8
|
-
export { Router } from './router.js';
|
|
9
|
-
export { Route } from './Route.js';
|
|
10
|
-
export { namedRoutes as routes } from './namedRoutes.js';
|
|
11
|
-
export * from './Set.js';
|
|
12
|
-
export { default as RouteAnnouncement } from './route-announcement.js';
|
|
13
|
-
export * from './route-announcement.js';
|
|
14
|
-
export { default as RouteFocus } from './route-focus.js';
|
|
15
|
-
export * from './route-focus.js';
|
|
16
|
-
export * from './useRouteName.js';
|
|
17
|
-
export * from './useRoutePaths.js';
|
|
18
|
-
export * from './useMatch.js';
|
|
19
|
-
export * from './useBlocker.js';
|
|
20
|
-
export { parseSearch, getRouteRegexAndParams, matchPath } from './util.js';
|
|
21
|
-
export { SkipNavLink, SkipNavContent } from './skipNav.js';
|
|
22
|
-
/**
|
|
23
|
-
* A more specific interface is created in `.cedar/types/includes/web-routerRoutes`
|
|
24
|
-
* when the site is built, which will describe all known routes.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* interface AvailableRoutes {
|
|
28
|
-
* home: (params?: RouteParams<"/">) => "/"
|
|
29
|
-
* post: (params?: RouteParams<"/posts/{id:Int}">) => "/posts/{id:Int}"
|
|
30
|
-
* }
|
|
31
|
-
*/
|
|
32
|
-
export interface AvailableRoutes {
|
|
33
|
-
}
|
|
34
|
-
export * from './routeParamsTypes.js';
|
|
35
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EACL,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAExD,cAAc,UAAU,CAAA;AAExB,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACtE,cAAc,yBAAyB,CAAA;AACvC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAE/B,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE1E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE1D;;;;;;;;;GASG;AAGH,MAAM,WAAW,eAAe;CAAG;AAGnC,cAAc,uBAAuB,CAAA"}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var index_exports = {};
|
|
31
|
-
__export(index_exports, {
|
|
32
|
-
Link: () => import_link.Link,
|
|
33
|
-
LocationProvider: () => import_location.LocationProvider,
|
|
34
|
-
NavLink: () => import_navLink.NavLink,
|
|
35
|
-
PageLoadingContextProvider: () => import_PageLoadingContext.PageLoadingContextProvider,
|
|
36
|
-
ParamsContext: () => import_params.ParamsContext,
|
|
37
|
-
ParamsProvider: () => import_params.ParamsProvider,
|
|
38
|
-
Redirect: () => import_redirect.Redirect,
|
|
39
|
-
Route: () => import_Route.Route,
|
|
40
|
-
RouteAnnouncement: () => import_route_announcement.default,
|
|
41
|
-
RouteFocus: () => import_route_focus.default,
|
|
42
|
-
Router: () => import_router.Router,
|
|
43
|
-
SkipNavContent: () => import_skipNav.SkipNavContent,
|
|
44
|
-
SkipNavLink: () => import_skipNav.SkipNavLink,
|
|
45
|
-
back: () => import_history.back,
|
|
46
|
-
getRouteRegexAndParams: () => import_util.getRouteRegexAndParams,
|
|
47
|
-
matchPath: () => import_util.matchPath,
|
|
48
|
-
navigate: () => import_history.navigate,
|
|
49
|
-
parseSearch: () => import_util.parseSearch,
|
|
50
|
-
routes: () => import_namedRoutes.namedRoutes,
|
|
51
|
-
useLocation: () => import_location.useLocation,
|
|
52
|
-
usePageLoadingContext: () => import_PageLoadingContext.usePageLoadingContext,
|
|
53
|
-
useParams: () => import_params.useParams
|
|
54
|
-
});
|
|
55
|
-
module.exports = __toCommonJS(index_exports);
|
|
56
|
-
var import_history = require("./history.js");
|
|
57
|
-
var import_navLink = require("./navLink.js");
|
|
58
|
-
var import_link = require("./link.js");
|
|
59
|
-
var import_location = require("./location.js");
|
|
60
|
-
var import_redirect = require("./redirect.js");
|
|
61
|
-
var import_PageLoadingContext = require("./PageLoadingContext.js");
|
|
62
|
-
var import_params = require("./params.js");
|
|
63
|
-
var import_router = require("./router.js");
|
|
64
|
-
var import_Route = require("./Route.js");
|
|
65
|
-
var import_namedRoutes = require("./namedRoutes.js");
|
|
66
|
-
__reExport(index_exports, require("./Set.js"), module.exports);
|
|
67
|
-
var import_route_announcement = __toESM(require("./route-announcement.js"), 1);
|
|
68
|
-
__reExport(index_exports, require("./route-announcement.js"), module.exports);
|
|
69
|
-
var import_route_focus = __toESM(require("./route-focus.js"), 1);
|
|
70
|
-
__reExport(index_exports, require("./route-focus.js"), module.exports);
|
|
71
|
-
__reExport(index_exports, require("./useRouteName.js"), module.exports);
|
|
72
|
-
__reExport(index_exports, require("./useRoutePaths.js"), module.exports);
|
|
73
|
-
__reExport(index_exports, require("./useMatch.js"), module.exports);
|
|
74
|
-
__reExport(index_exports, require("./useBlocker.js"), module.exports);
|
|
75
|
-
var import_util = require("./util.js");
|
|
76
|
-
var import_skipNav = require("./skipNav.js");
|
|
77
|
-
__reExport(index_exports, require("./routeParamsTypes.js"), module.exports);
|
|
78
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
-
0 && (module.exports = {
|
|
80
|
-
Link,
|
|
81
|
-
LocationProvider,
|
|
82
|
-
NavLink,
|
|
83
|
-
PageLoadingContextProvider,
|
|
84
|
-
ParamsContext,
|
|
85
|
-
ParamsProvider,
|
|
86
|
-
Redirect,
|
|
87
|
-
Route,
|
|
88
|
-
RouteAnnouncement,
|
|
89
|
-
RouteFocus,
|
|
90
|
-
Router,
|
|
91
|
-
SkipNavContent,
|
|
92
|
-
SkipNavLink,
|
|
93
|
-
back,
|
|
94
|
-
getRouteRegexAndParams,
|
|
95
|
-
matchPath,
|
|
96
|
-
navigate,
|
|
97
|
-
parseSearch,
|
|
98
|
-
routes,
|
|
99
|
-
useLocation,
|
|
100
|
-
usePageLoadingContext,
|
|
101
|
-
useParams,
|
|
102
|
-
...require("./Set.js"),
|
|
103
|
-
...require("./route-announcement.js"),
|
|
104
|
-
...require("./route-focus.js"),
|
|
105
|
-
...require("./useRouteName.js"),
|
|
106
|
-
...require("./useRoutePaths.js"),
|
|
107
|
-
...require("./useMatch.js"),
|
|
108
|
-
...require("./useBlocker.js"),
|
|
109
|
-
...require("./routeParamsTypes.js")
|
|
110
|
-
});
|
package/dist/cjs/link.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { NavigateOptions } from './history.js';
|
|
3
|
-
export interface LinkProps {
|
|
4
|
-
to: string;
|
|
5
|
-
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
6
|
-
options?: NavigateOptions;
|
|
7
|
-
}
|
|
8
|
-
export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
|
|
9
|
-
//# sourceMappingURL=link.d.ts.map
|
package/dist/cjs/link.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/link.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAGzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;IACpD,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B;AAED,eAAO,MAAM,IAAI,qIA+Bf,CAAA"}
|
package/dist/cjs/link.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var link_exports = {};
|
|
31
|
-
__export(link_exports, {
|
|
32
|
-
Link: () => Link
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(link_exports);
|
|
35
|
-
var import_react = __toESM(require("react"), 1);
|
|
36
|
-
var import_history = require("./history.js");
|
|
37
|
-
const Link = (0, import_react.forwardRef)(({ to, onClick, options, ...rest }, ref) => /* @__PURE__ */ import_react.default.createElement(
|
|
38
|
-
"a",
|
|
39
|
-
{
|
|
40
|
-
href: to,
|
|
41
|
-
ref,
|
|
42
|
-
...rest,
|
|
43
|
-
onClick: (event) => {
|
|
44
|
-
if (event.button !== 0 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
event.preventDefault();
|
|
48
|
-
if (onClick) {
|
|
49
|
-
const result = onClick(event);
|
|
50
|
-
if (typeof result !== "boolean" || result) {
|
|
51
|
-
(0, import_history.navigate)(to, options);
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
(0, import_history.navigate)(to, options);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
));
|
|
59
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
-
0 && (module.exports = {
|
|
61
|
-
Link
|
|
62
|
-
});
|
package/dist/cjs/location.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { TrailingSlashesTypes } from './util.js';
|
|
3
|
-
export interface LocationContextType extends URL {
|
|
4
|
-
}
|
|
5
|
-
declare const LocationContext: React.Context<LocationContextType | undefined>;
|
|
6
|
-
interface Location extends URL {
|
|
7
|
-
}
|
|
8
|
-
interface LocationProviderProps {
|
|
9
|
-
location?: Location;
|
|
10
|
-
trailingSlashes?: TrailingSlashesTypes;
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
}
|
|
13
|
-
interface LocationProviderState {
|
|
14
|
-
context: Location | undefined;
|
|
15
|
-
}
|
|
16
|
-
declare class LocationProvider extends React.Component<LocationProviderProps, LocationProviderState> {
|
|
17
|
-
static contextType: React.Context<LocationContextType | undefined>;
|
|
18
|
-
context: React.ContextType<typeof LocationContext>;
|
|
19
|
-
HISTORY_LISTENER_ID: string | undefined;
|
|
20
|
-
state: LocationProviderState;
|
|
21
|
-
getContext(): URL | undefined;
|
|
22
|
-
componentDidMount(): void;
|
|
23
|
-
componentWillUnmount(): void;
|
|
24
|
-
render(): React.JSX.Element;
|
|
25
|
-
}
|
|
26
|
-
declare const useLocation: () => LocationContextType;
|
|
27
|
-
export { LocationProvider, LocationContext, useLocation };
|
|
28
|
-
//# sourceMappingURL=location.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../src/location.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGrD,MAAM,WAAW,mBAAoB,SAAQ,GAAG;CAAG;AAEnD,QAAA,MAAM,eAAe,gDAAsD,CAAA;AAG3E,UAAU,QAAS,SAAQ,GAAG;CAAG;AAEjC,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,eAAe,CAAC,EAAE,oBAAoB,CAAA;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,UAAU,qBAAqB;IAC7B,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAA;CAC9B;AAED,cAAM,gBAAiB,SAAQ,KAAK,CAAC,SAAS,CAC5C,qBAAqB,EACrB,qBAAqB,CACtB;IAIC,MAAM,CAAC,WAAW,iDAAkB;IAE5B,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAA;IAC1D,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAY;IAEnD,KAAK,EAAE,qBAAqB,CAE3B;IAED,UAAU;IA0CV,iBAAiB;IAiBjB,oBAAoB;IAMpB,MAAM;CAOP;AAED,QAAA,MAAM,WAAW,2BAQhB,CAAA;AAED,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/cjs/location.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var location_exports = {};
|
|
31
|
-
__export(location_exports, {
|
|
32
|
-
LocationContext: () => LocationContext,
|
|
33
|
-
LocationProvider: () => LocationProvider,
|
|
34
|
-
useLocation: () => useLocation
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(location_exports);
|
|
37
|
-
var import_react = __toESM(require("react"), 1);
|
|
38
|
-
var import_createNamedContext = require("./createNamedContext.js");
|
|
39
|
-
var import_history = require("./history.js");
|
|
40
|
-
const LocationContext = (0, import_createNamedContext.createNamedContext)("Location");
|
|
41
|
-
class LocationProvider extends import_react.default.Component {
|
|
42
|
-
// When prerendering, there might be more than one level of location
|
|
43
|
-
// providers. Use the values from the one above.
|
|
44
|
-
// (this is basically the class component version of `useLocation()`)
|
|
45
|
-
static contextType = LocationContext;
|
|
46
|
-
HISTORY_LISTENER_ID = void 0;
|
|
47
|
-
state = {
|
|
48
|
-
context: this.getContext()
|
|
49
|
-
};
|
|
50
|
-
getContext() {
|
|
51
|
-
let windowLocation;
|
|
52
|
-
if (typeof window !== "undefined") {
|
|
53
|
-
const { pathname } = window.location;
|
|
54
|
-
switch (this.props.trailingSlashes) {
|
|
55
|
-
case "never":
|
|
56
|
-
if (pathname.endsWith("/")) {
|
|
57
|
-
window.history.replaceState(
|
|
58
|
-
{},
|
|
59
|
-
"",
|
|
60
|
-
pathname.substr(0, pathname.length - 1)
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
case "always":
|
|
65
|
-
if (!pathname.endsWith("/")) {
|
|
66
|
-
window.history.replaceState({}, "", pathname + "/");
|
|
67
|
-
}
|
|
68
|
-
break;
|
|
69
|
-
default:
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
windowLocation = new URL(window.location.href);
|
|
73
|
-
}
|
|
74
|
-
return this.props.location || this.context || windowLocation;
|
|
75
|
-
}
|
|
76
|
-
// componentDidMount() is not called during server rendering (aka SSR and
|
|
77
|
-
// prerendering)
|
|
78
|
-
componentDidMount() {
|
|
79
|
-
this.HISTORY_LISTENER_ID = import_history.gHistory.listen((_, options) => {
|
|
80
|
-
const context = this.getContext();
|
|
81
|
-
this.setState((lastState) => {
|
|
82
|
-
if ((context?.pathname !== lastState?.context?.pathname || context?.search !== lastState?.context?.search) && options?.scroll === true) {
|
|
83
|
-
globalThis?.scrollTo(0, 0);
|
|
84
|
-
}
|
|
85
|
-
return { context };
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
componentWillUnmount() {
|
|
90
|
-
if (this.HISTORY_LISTENER_ID) {
|
|
91
|
-
import_history.gHistory.remove(this.HISTORY_LISTENER_ID);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
render() {
|
|
95
|
-
return /* @__PURE__ */ import_react.default.createElement(LocationContext.Provider, { value: this.state.context }, this.props.children);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const useLocation = () => {
|
|
99
|
-
const location = import_react.default.useContext(LocationContext);
|
|
100
|
-
if (location === void 0) {
|
|
101
|
-
throw new Error("useLocation must be used within a LocationProvider");
|
|
102
|
-
}
|
|
103
|
-
return location;
|
|
104
|
-
};
|
|
105
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
-
0 && (module.exports = {
|
|
107
|
-
LocationContext,
|
|
108
|
-
LocationProvider,
|
|
109
|
-
useLocation
|
|
110
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"namedRoutes.d.ts","sourceRoot":"","sources":["../../src/namedRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMjD,eAAO,MAAM,WAAW,EAAE,eAAoB,CAAA"}
|
package/dist/cjs/namedRoutes.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var namedRoutes_exports = {};
|
|
20
|
-
__export(namedRoutes_exports, {
|
|
21
|
-
namedRoutes: () => namedRoutes
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(namedRoutes_exports);
|
|
24
|
-
const namedRoutes = {};
|
|
25
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
-
0 && (module.exports = {
|
|
27
|
-
namedRoutes
|
|
28
|
-
});
|
package/dist/cjs/navLink.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { LinkProps } from './link.js';
|
|
3
|
-
import type { FlattenSearchParams } from './util.js';
|
|
4
|
-
interface NavLinkProps extends LinkProps {
|
|
5
|
-
activeClassName: string;
|
|
6
|
-
activeMatchParams?: FlattenSearchParams;
|
|
7
|
-
matchSubPaths?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=navLink.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navLink.d.ts","sourceRoot":"","sources":["../../src/navLink.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAGzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAG1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAEpD,UAAU,YAAa,SAAQ,SAAS;IACtC,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,mBAAmB,CAAA;IACvC,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,OAAO,wIAkCnB,CAAA"}
|
package/dist/cjs/navLink.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var navLink_exports = {};
|
|
31
|
-
__export(navLink_exports, {
|
|
32
|
-
NavLink: () => NavLink
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(navLink_exports);
|
|
35
|
-
var import_react = __toESM(require("react"), 1);
|
|
36
|
-
var import_link = require("./link.js");
|
|
37
|
-
var import_useMatch = require("./useMatch.js");
|
|
38
|
-
var import_util = require("./util.js");
|
|
39
|
-
const NavLink = (0, import_react.forwardRef)(
|
|
40
|
-
({
|
|
41
|
-
to,
|
|
42
|
-
activeClassName,
|
|
43
|
-
activeMatchParams,
|
|
44
|
-
matchSubPaths,
|
|
45
|
-
className,
|
|
46
|
-
onClick,
|
|
47
|
-
...rest
|
|
48
|
-
}, ref) => {
|
|
49
|
-
const [pathname, queryString] = to.split("?");
|
|
50
|
-
const searchParams = activeMatchParams || (0, import_util.flattenSearchParams)(queryString);
|
|
51
|
-
const matchInfo = (0, import_useMatch.useMatch)(pathname, {
|
|
52
|
-
searchParams,
|
|
53
|
-
matchSubPaths
|
|
54
|
-
});
|
|
55
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
56
|
-
import_link.Link,
|
|
57
|
-
{
|
|
58
|
-
ref,
|
|
59
|
-
to,
|
|
60
|
-
onClick,
|
|
61
|
-
className: matchInfo.match ? activeClassName : className,
|
|
62
|
-
...rest
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
NavLink
|
|
70
|
-
});
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
package/dist/cjs/page.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface Spec {
|
|
2
|
-
name: string;
|
|
3
|
-
prerenderLoader: (name?: string) => {
|
|
4
|
-
default: React.ComponentType<unknown>;
|
|
5
|
-
};
|
|
6
|
-
LazyComponent: React.LazyExoticComponent<React.ComponentType<unknown>> | React.ComponentType<unknown>;
|
|
7
|
-
}
|
|
8
|
-
export declare function isSpec(specOrPage: Spec | React.ComponentType): specOrPage is Spec;
|
|
9
|
-
/**
|
|
10
|
-
* Pages can be imported automatically or manually. Automatic imports are actually
|
|
11
|
-
* objects and take the following form (which we call a 'spec'):
|
|
12
|
-
*
|
|
13
|
-
* const WhateverPage = {
|
|
14
|
-
* name: 'WhateverPage',
|
|
15
|
-
* LazyComponent: lazy(() => import('src/pages/WhateverPage'))
|
|
16
|
-
* prerenderLoader: ...
|
|
17
|
-
* }
|
|
18
|
-
*
|
|
19
|
-
* Manual imports simply load the page:
|
|
20
|
-
*
|
|
21
|
-
* import WhateverPage from 'src/pages/WhateverPage'
|
|
22
|
-
*
|
|
23
|
-
* Before passing a "page" to the PageLoader, we will normalize the manually
|
|
24
|
-
* imported version into a spec.
|
|
25
|
-
*/
|
|
26
|
-
export declare function normalizePage(specOrPage: Spec | React.ComponentType<unknown>): Spec;
|
|
27
|
-
export type PageType = Spec | React.ComponentType<any> | ((props: any) => JSX.Element);
|
|
28
|
-
//# sourceMappingURL=page.d.ts.map
|