@vertesia/ui 1.3.0-dev.20260620.061059Z → 1.3.0-dev.20260620.091720Z
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/lib/router/HistoryNavigator.d.ts.map +1 -1
- package/lib/router/HistoryNavigator.js +4 -1
- package/lib/router/HistoryNavigator.js.map +1 -1
- package/lib/router/Nav.d.ts.map +1 -1
- package/lib/router/Nav.js +7 -1
- package/lib/router/Nav.js.map +1 -1
- package/lib/router/Router.d.ts.map +1 -1
- package/lib/router/Router.js +3 -2
- package/lib/router/Router.js.map +1 -1
- package/lib/router/path.d.ts +15 -0
- package/lib/router/path.d.ts.map +1 -1
- package/lib/router/path.js +43 -0
- package/lib/router/path.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/package.json +6 -6
- package/src/router/HistoryNavigator.ts +4 -1
- package/src/router/Nav.tsx +7 -1
- package/src/router/Router.tsx +3 -2
- package/src/router/path.test.ts +87 -0
- package/src/router/path.ts +38 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistoryNavigator.d.ts","sourceRoot":"","sources":["../../src/router/HistoryNavigator.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS,eAAsB,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,MAAM,MAAM,uBAAuB,GAAG,cAAc,GAAG,aAAa,CAAC;AACrE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AACnF,qBAAa,mBAAmB;IAGjB,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,GAAG;IACb,KAAK,CAAC,EAAE,OAAO;IAL1B,SAAS,UAAS;gBAEP,IAAI,EAAE,uBAAuB,EAC7B,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,GAAG,EACb,KAA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C;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAYD,qBAAa,gBAAgB;IAEzB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,iBAAiB,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,IAAI,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC,EAAE,CAAM;IAE1D,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI;IAI1D,kBAAkB,CAAC,KAAK,EAAE,mBAAmB;IAM7C;;;OAGG;IACH,YAAY;IAIZ,eAAe,CAAC,IAAI,EAAE,MAAM;IAO5B;;;;;;;;OAQG;IACH,mBAAmB;IAYnB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;IAoBlD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB;IAmBrD,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe;IA6CrE,KAAK;IA6CL,IAAI;CAIP"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PathWithParams } from './PathWithParams';
|
|
2
|
-
import { joinPath } from './path';
|
|
2
|
+
import { joinPath, withMountBasename } from './path';
|
|
3
3
|
const BASE_PATH = Symbol('BASE_PATH');
|
|
4
4
|
export { BASE_PATH };
|
|
5
5
|
export class LocationChangeEvent {
|
|
@@ -115,6 +115,9 @@ export class HistoryNavigator {
|
|
|
115
115
|
to = joinPath(basePath, to);
|
|
116
116
|
}
|
|
117
117
|
to = this.addStickyParams(to);
|
|
118
|
+
// Keep absolute app routes under the served `<base href>` mount instead of resolving them
|
|
119
|
+
// against the bare origin (which collapses the URL off the mount). No-op when origin-served.
|
|
120
|
+
to = withMountBasename(to);
|
|
118
121
|
this._navigate(new URL(to, window.location.href), 'navigate', options);
|
|
119
122
|
}
|
|
120
123
|
stepBack(steps, options = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistoryNavigator.js","sourceRoot":"","sources":["../../src/router/HistoryNavigator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"HistoryNavigator.js","sourceRoot":"","sources":["../../src/router/HistoryNavigator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAErD,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,CAAC;AAIrB,MAAM,OAAO,mBAAmB;IAGjB;IACA;IACA;IACA;IALX,SAAS,GAAG,KAAK,CAAC;IAClB,YACW,IAA6B,EAC7B,IAAwB,EACxB,QAAa,EACb,KAAe;QAHf,SAAI,GAAJ,IAAI,CAAyB;QAC7B,SAAI,GAAJ,IAAI,CAAoB;QACxB,aAAQ,GAAR,QAAQ,CAAK;QACb,UAAK,GAAL,KAAK,CAAU;IACvB,CAAC;IAEJ,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;IACnC,CAAC;IAED,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;IACpC,CAAC;IAED,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC;IACrC,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;IACpC,CAAC;IAED,IAAI,YAAY;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AgB,CAAC;QACzC,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;QACvD,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnE,CAAC;IAED,IAAI;QACA,IAAI,IAAI,CAAC,iBAAiB;YAAE,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC3F,IAAI,IAAI,CAAC,gBAAgB;YAAE,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACjG,CAAC;CACJ"}
|
package/lib/router/Nav.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Nav.d.ts","sourceRoot":"","sources":["../../src/router/Nav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Nav.d.ts","sourceRoot":"","sources":["../../src/router/Nav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAI5C;;GAEG;AACH,UAAU,QAAQ;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC9C;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,cAAc,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AACD,wBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,OAAc,EAAE,EAAE,QAAQ,+BAkBtE;AAED;;;GAGG;AACH,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AACD,wBAAgB,OAAO,CAAC,EACpB,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAwB,EACxB,OAAO,EACP,gBAAgB,GACnB,EAAE,YAAY,+BA2Bd"}
|
package/lib/router/Nav.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { withMountBasename } from './path';
|
|
2
3
|
import { useNavigate, useRouterContext } from './Router';
|
|
3
4
|
export function Nav({ children, to, onClick, replace = true }) {
|
|
4
5
|
const navigate = useNavigate();
|
|
@@ -22,7 +23,12 @@ export function NavLink({ children, href, className, target, topLevelNav, clearB
|
|
|
22
23
|
const isAnchorOrEmpty = !href || href.startsWith('#');
|
|
23
24
|
const isExternal = /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith('//') || (!!target && target !== '_self');
|
|
24
25
|
const isInternal = !isAnchorOrEmpty && !isExternal;
|
|
25
|
-
|
|
26
|
+
// Keep the rendered href under the served `<base href>` mount (correct middle-click / hover /
|
|
27
|
+
// open-in-new-tab); the onClick navigates via the router which applies the same rule. No-op when
|
|
28
|
+
// origin-served (Studio UI). Click handler below passes the raw `href` — navigate() re-bases it.
|
|
29
|
+
const resolvedHref = isInternal
|
|
30
|
+
? withMountBasename(!skipStickyParams ? router.getTopRouter().navigator.addStickyParams(href) : href)
|
|
31
|
+
: href;
|
|
26
32
|
const _onClick = (ev) => {
|
|
27
33
|
if (ev.defaultPrevented || !isInternal) {
|
|
28
34
|
return;
|
package/lib/router/Nav.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Nav.js","sourceRoot":"","sources":["../../src/router/Nav.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAuBzD,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,EAAY;IACnE,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,CAAC,EAAkB,EAAE,EAAE;QACpC,MAAM,IAAI,GAAI,EAAE,CAAC,MAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrD,MAAM,OAAO,GAAG,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,MAAM,GAAG,EAAE,IAAI,OAAO,CAAC;QAC7B,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YACjB,EAAE,CAAC,eAAe,EAAE,CAAC;YACrB,EAAE,CAAC,cAAc,EAAE,CAAC;YACpB,QAAQ,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9B,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;IACL,CAAC,CAAC;IACF,OAAO,CAGH,eAAM,OAAO,EAAE,QAAQ,YAAG,QAAQ,GAAQ,CAC7C,CAAC;AACN,CAAC;AAmBD,MAAM,UAAU,OAAO,CAAC,EACpB,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,MAAM,EACN,WAAW,EACX,gBAAgB,GAAG,KAAK,EACxB,OAAO,EACP,gBAAgB,GACL;IACX,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACtC,gGAAgG;IAChG,kGAAkG;IAClG,MAAM,eAAe,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,C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AAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,YACzE,QAAQ,GACT,CACP,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../src/router/Router.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAwB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../src/router/Router.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAwB,KAAK,eAAe,EAAsB,MAAM,QAAQ,CAAC;AAExF,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;CAAE,CAAC;AACtF,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;AAC1D,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;CACvD;AACD,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,YAAY,CAAC;CAC/B;AACD,MAAM,MAAM,KAAK,GAAG,cAAc,GAAG,kBAAkB,CAAC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useContext, useEffect } from 'react';
|
|
2
2
|
import { HistoryNavigator } from './HistoryNavigator';
|
|
3
3
|
import { PathMatcher } from './PathMatcher';
|
|
4
|
-
import { isRootPath, joinPath } from './path';
|
|
4
|
+
import { isRootPath, joinPath, stripMountBasename } from './path';
|
|
5
5
|
export class BaseRouter {
|
|
6
6
|
// the path to use when navigating to the root of the router
|
|
7
7
|
index;
|
|
@@ -34,7 +34,8 @@ export class Router extends BaseRouter {
|
|
|
34
34
|
}
|
|
35
35
|
// only process afterChange events
|
|
36
36
|
if (event.name === 'afterChange') {
|
|
37
|
-
|
|
37
|
+
// Match app-relative: strip the served `<base href>` mount prefix (no-op when origin-served).
|
|
38
|
+
const match = this.match(stripMountBasename(event.location.pathname));
|
|
38
39
|
if (match?.value) {
|
|
39
40
|
updateState({
|
|
40
41
|
...match,
|
package/lib/router/Router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../../src/router/Router.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAkD,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAkB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAwB,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../../src/router/Router.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAkD,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAkB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAwB,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAwBxF,MAAM,OAAgB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AAC;QAC1B,OAAO,GAAG,EAAE;YACR,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC;QACjC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAExB,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACd,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;YAC5B,MAAM,QAAQ,GAAG,CAAC,EAAS,EAAE,EAAE;gBAC3B,IAAI,OAAO,EAAE,CAAC;oBACV,EAAE,CAAC,cAAc,EAAE,CAAC;oBACnB,EAAwB,CAAC,WAAW,GAAG,EAAE,CAAC;gBAC/C,CAAC;YACL,CAAC,CAAC;YACF,MAAM,CAAC,gBAAgB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;YAClD,OAAO,GAAG,EAAE;gBACR,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;YACzD,CAAC,CAAC;QACN,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACtB,CAAC"}
|
package/lib/router/path.d.ts
CHANGED
|
@@ -3,6 +3,21 @@ export type PathMatchParams = Record<string, string> & {
|
|
|
3
3
|
};
|
|
4
4
|
export declare function isRootPath(path: string): path is "" | "/";
|
|
5
5
|
export declare function joinPath(path1: string, path2: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* The mount base path from an explicit `<base href>` element, or `''` when there is none.
|
|
8
|
+
*
|
|
9
|
+
* Apps served under a deep gateway mount carry `<base href="/tenants/.../app/">`, injected at serve
|
|
10
|
+
* time. The router otherwise resolves absolute routes against the origin, which collapses the URL
|
|
11
|
+
* off the mount (and breaks in-app links). This returns the base pathname without a trailing slash
|
|
12
|
+
* so {@link withMountBasename} can keep navigation under the mount and {@link stripMountBasename}
|
|
13
|
+
* can match routes app-relative. The Studio UI has no `<base>` element, so this returns `''` and
|
|
14
|
+
* every caller becomes a no-op there.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getMountBasename(): string;
|
|
17
|
+
/** Prepend the mount basename to an absolute app path (no-op when no mount, path is relative, or already prefixed). */
|
|
18
|
+
export declare function withMountBasename(path: string): string;
|
|
19
|
+
/** Strip the mount basename from a browser path so route patterns match app-relative (no-op when no mount). */
|
|
20
|
+
export declare function stripMountBasename(path: string): string;
|
|
6
21
|
export declare function getPathSegments(path: string): string[];
|
|
7
22
|
export declare function toSegments(path: string | string[]): string[];
|
|
8
23
|
//# sourceMappingURL=path.d.ts.map
|
package/lib/router/path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/router/path.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IACnD,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,oBAEtC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAWpD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,YAkB3C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,YAQjD"}
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/router/path.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IACnD,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,oBAEtC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAWpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CASzC;AAED,uHAAuH;AACvH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED,+GAA+G;AAC/G,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,YAkB3C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,YAQjD"}
|
package/lib/router/path.js
CHANGED
|
@@ -16,6 +16,49 @@ export function joinPath(path1, path2) {
|
|
|
16
16
|
}
|
|
17
17
|
return path2;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* The mount base path from an explicit `<base href>` element, or `''` when there is none.
|
|
21
|
+
*
|
|
22
|
+
* Apps served under a deep gateway mount carry `<base href="/tenants/.../app/">`, injected at serve
|
|
23
|
+
* time. The router otherwise resolves absolute routes against the origin, which collapses the URL
|
|
24
|
+
* off the mount (and breaks in-app links). This returns the base pathname without a trailing slash
|
|
25
|
+
* so {@link withMountBasename} can keep navigation under the mount and {@link stripMountBasename}
|
|
26
|
+
* can match routes app-relative. The Studio UI has no `<base>` element, so this returns `''` and
|
|
27
|
+
* every caller becomes a no-op there.
|
|
28
|
+
*/
|
|
29
|
+
export function getMountBasename() {
|
|
30
|
+
if (typeof document === 'undefined')
|
|
31
|
+
return '';
|
|
32
|
+
const base = document.querySelector('base[href]');
|
|
33
|
+
if (!base)
|
|
34
|
+
return '';
|
|
35
|
+
try {
|
|
36
|
+
return new URL(base.href, document.URL).pathname.replace(/\/+$/, '');
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Prepend the mount basename to an absolute app path (no-op when no mount, path is relative, or already prefixed). */
|
|
43
|
+
export function withMountBasename(path) {
|
|
44
|
+
const base = getMountBasename();
|
|
45
|
+
if (!base || !path.startsWith('/'))
|
|
46
|
+
return path;
|
|
47
|
+
if (path === base || path.startsWith(`${base}/`))
|
|
48
|
+
return path;
|
|
49
|
+
return joinPath(base, path);
|
|
50
|
+
}
|
|
51
|
+
/** Strip the mount basename from a browser path so route patterns match app-relative (no-op when no mount). */
|
|
52
|
+
export function stripMountBasename(path) {
|
|
53
|
+
const base = getMountBasename();
|
|
54
|
+
if (!base)
|
|
55
|
+
return path;
|
|
56
|
+
if (path === base)
|
|
57
|
+
return '/';
|
|
58
|
+
if (path.startsWith(`${base}/`))
|
|
59
|
+
return path.slice(base.length) || '/';
|
|
60
|
+
return path;
|
|
61
|
+
}
|
|
19
62
|
export function getPathSegments(path) {
|
|
20
63
|
if (path === '') {
|
|
21
64
|
return [];
|
package/lib/router/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/router/path.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,UAAU,CAAC,IAAY;IACnC,OAAO,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,KAAa;IACjD,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAC1B,CAAC;SAAM,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAC1B,CAAC;SAAM,CAAC;QACJ,KAAK,GAAG,GAAG,KAAK,IAAI,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,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;AAC9C,6CAA6C;AAC7C,wDAAwD;AACxD,4BAA4B;AAC5B,YAAY;AACZ,mDAAmD;AACnD,4CAA4C;AAC5C,+DAA+D;AAC/D,6CAA6C;AAC7C,qCAAqC;AACrC,4CAA4C;AAC5C,0DAA0D;AAC1D,oDAAoD;AACpD,wDAAwD;AACxD,gDAAgD;AAChD,oDAAoD;AACpD,qCAAqC;AACrC,oBAAoB;AACpB,gCAAgC;AAChC,gBAAgB;AAChB,YAAY;AACZ,0CAA0C;AAC1C,QAAQ;AAER,6CAA6C;AAC7C,6CAA6C;AAC7C,4EAA4E;AAC5E,QAAQ;AAER,qFAAqF;AACrF,6CAA6C;AAC7C,6EAA6E;AAC7E,yCAAyC;AACzC,2BAA2B;AAC3B,YAAY;AACZ,6EAA6E;AAC7E,QAAQ;AAER,4CAA4C;AAC5C,0DAA0D;AAC1D,QAAQ;AAER,2CAA2C;AAC3C,0DAA0D;AAC1D,QAAQ;AAER,yBAAyB;AACzB,gDAAgD;AAChD,QAAQ;AAER,yBAAyB;AACzB,0CAA0C;AAC1C,QAAQ;AAER,mBAAmB;AACnB,gDAAgD;AAChD,sDAAsD;AACtD,QAAQ;AAER,IAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useRef as n,useEffect as a,createContext as r,useContext as i,useState as s,useMemo as o}from"react";import{useSafeLayoutEffect as h}from"@vertesia/ui/core";class c{path;params;hash;constructor(t){let e=t.lastIndexOf("#");e>-1?(this.hash=t.substring(e),t=t.substring(0,e)):this.hash="",e=t.indexOf("?"),e>-1?(this.path=t.substring(0,e),this.params=new URLSearchParams(t.substring(e+1))):(this.path=t,this.params=new URLSearchParams)}add(t){for(const[e,n]of Object.entries(t))this.params.set(e,n);return this}toString(){return`${this.path}?${this.params.toString()}${this.hash}`}}function l(t){return"/"===t||""===t}function d(t,e){return e=t.endsWith("/")&&e.startsWith("/")?t+e.substring(1):t.endsWith("/")||e.startsWith("/")?t+e:`${t}/${e}`}function u(t){if(""===t)return[];if("/"===t)return[""];let e=0,n=t.length;return t.startsWith("./")?e=2:t.startsWith("/")&&(e=1),t.endsWith("/")&&(n=t.length-1),(e>0||n<t.length?t.substring(e,n):t).split("/")}function m(t){if("string"==typeof t)return u(t);if(Array.isArray(t))return t;throw new Error(`Unsupported path object: ${t}`)}var f=Object.freeze({__proto__:null,getPathSegments:u,isRootPath:l,joinPath:d,toSegments:m});const p=Symbol("BASE_PATH");class w{name;type;location;state;_canceled=!1;constructor(t,e,n,a){this.name=t,this.type=e,this.location=n,this.state=a}get isPageLoad(){return"initial"===this.type}get isBackForward(){return"popState"===this.type}get isLinkClick(){return"linkClick"===this.type}get isNavigation(){return"navigate"===this.type}get isCancelable(){return"beforeChange"===this.name}cancel(){if("afterChange"===this.name)throw new Error("Cannot cancel afterChange event");this._canceled=!0}}class g extends w{constructor(t,e,n){super("beforeChange",t,e,n)}}class v extends w{constructor(t,e,n){super("afterChange",t,e,n)}}class P{stickyParams;_popStateListener;_linkNavListener;_listeners=[];addListener(t){this._listeners.push(t)}fireLocationChange(t){for(const e of this._listeners)e(t)}firePageLoad(){this.fireLocationChange(new v("initial",new URL(window.location.href)))}addStickyParams(t){return this.stickyParams?new c(t).add(this.stickyParams).toString():t}normalizeCurrentUrl(){if("undefined"==typeof window||!this.stickyParams)return;const t=window.location.pathname+window.location.search+window.location.hash,e=this.addStickyParams(t);if(e!==t){const t=new URL(e,window.location.href);window.history.replaceState(window.history.state,"",t.href)}}navigate(t,e={}){if(e.stepsBack&&e.stepsBack>0)this.stepBack(e.stepsBack,e);else{if(e.basePath){let n=e.basePath;n.startsWith("/")||(n=`/${n}`),t=d(n,t)}t=this.addStickyParams(t),this._navigate(new URL(t,window.location.href),"navigate",e)}}stepBack(t,e={}){const n=window.history.state.historyChain||[],a=n.length>=t?new URL(n[n.length-t].href,window.location.href):new URL(window.location.origin,window.location.href);this._navigate(a,"popState",e);const r={from:window.location.href,historyChain:n.slice(0,-t),data:e.state||void 0,title:e.title||document.title};window.history.replaceState(r,"",a.href),this.fireLocationChange(new v("popState",a,e.state))}_navigate(t,e,n){const a=new g(e,t,n.state);if(this.fireLocationChange(a),a._canceled)return;const r=window.history.state,i={title:n.title||document.title,href:window.location.pathname+window.location.search+window.location.hash};let s=[];!n.replace&&r?.historyChain&&(s=[...r.historyChain]),n.replace||(s.push(i),s.length>10&&(s=s.slice(-10)));const o={from:window.location.href,historyChain:s,data:n.state||void 0,title:n.title||document.title};window.history[n.replace?"replaceState":"pushState"](o,"",t.href),this.fireLocationChange(new v(e,t,n.state))}start(){if("undefined"==typeof window)return;const t=t=>{let e;const n=new URL(window.location.href);let a;t.state?(e="popState",a=t.state.data):e="linkClick",this.fireLocationChange(new v(e,n,a))};this._popStateListener=t,this._linkNavListener=t=>{const e=t.target;if("a"===e.tagName.toLowerCase()&&(e.hasAttribute("download")||e.href?.startsWith("blob:")))return;const n=function(t){if(t&&"a"===t.tagName.toLowerCase()){const e=t?.href.trim();if("string"==typeof e&&e.length>0)return new URL(e)}return null}(e);if(n&&n.origin===window.location.origin){t.preventDefault();const e=new URL(this.addStickyParams(n.href)),a=t[p]||t.target[p];a&&(e.pathname=d(a,e.pathname)),this._navigate(e,"linkClick",{})}},window.addEventListener("popstate",t),document.body.addEventListener("click",this._linkNavListener)}stop(){this._popStateListener&&window.removeEventListener("popstate",this._popStateListener),this._linkNavListener&&document.body.removeEventListener("click",this._linkNavListener)}}function b({basePath:e,children:r}){const i=n(null);return a(()=>{if(i.current){const t=i.current,n=t=>{"a"===t.target.tagName.toLowerCase()&&(t[p]=e)};return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)}}},[e]),t("div",{ref:i,className:"h-full w-full",children:r})}class L{tree=new k;loadMapping(t){for(const[e,n]of Object.entries(t))this.addSegments(u(e),n)}addPath(t,e){this.addSegments(u(t),e)}addSegments(t,e){let n=this.tree;for(let a=0,r=t.length;a<r;a++){const i=t[a];if(":"===i[0]){let e=n.wildcard;if(e){if(!(e instanceof S))throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard ":" segment will overwrite an existing wildcard segment at path: /${t.slice(0,a).join("/")}`)}else e=new S(i),n.wildcard=e;n=e}else{if("*"===i){if(n.wildcard)throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard "*" segment already exists at path: /${t.slice(0,a).join("/")}`);if(n.wildcard=new _(i,e),a<r-1)throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard segment must be the last segment`);return}{let t=n.children[i];t||(t=new C(i),n.children[i]=t),n=t}}}if(void 0!==n.value)throw new Error(`Failed to index path segments: ${t.join("/")}. A value already exists at path: /${t.join("/")}`);n.value=e}match(t){const e=m(t);if(0===e.length)return null;const n={};let a,r,i=this.tree;for(const t of e){const e=i.match(t,n);if(!e)return null;i=e}if(!i.value){if(i instanceof y&&i.wildcard instanceof _&&(i=i.wildcard.match("",n),!i.value))throw new Error("Wildcard segment node `*` must have a value");if(!i.value)return null}return n._&&n._.length>0?(a=e.slice(0,-n._.length),r=n._):a=e,{params:n,matchedSegments:a,remainingSegments:r,value:i.value}}}class y{name;value;children={};wildcard;constructor(t,e){this.name=t,this.value=e}match(t,e){const n=this.children[t];if(n)return n;if(this.wildcard){if(this.wildcard instanceof _)return this.wildcard.match(t,e);if(this.wildcard instanceof S)return e[this.wildcard.paramName]=t,this.wildcard;throw new Error(`Unknown wildcard segment node type: ${this.wildcard.constructor.name}`)}return null}}class k extends y{constructor(){super("#root")}}class C extends y{}class S extends y{paramName;constructor(t,e){super(t,e),this.paramName=t.substring(1)}}class _{name;value;constructor(t,e){this.name=t,this.value=e}match(t,e){return e._?t&&e._.push(t):e._=t?[t]:[],this}}class x{index;matcher=new L;constructor(t,e){this.index=e;for(const e of t)this.matcher.addPath(e.path,e)}match(t){const e=l(t)&&this.index;return this.matcher.match(e?this.index:t)}}class R extends x{prompt;observer;navigator=new P;constructor(t,e){super(t),this.navigator.addListener(t=>{if((!t.isCancelable||!this.prompt?.when||window.confirm(this.prompt.message))&&(this.observer&&this.observer(t),"afterChange"===t.name)){const n=this.match(t.location.pathname);e(n?.value?{...n,state:t.state}:null)}})}getTopRouter(){return this}setStickyParams(t){this.navigator.stickyParams=null!=t?t:void 0,this.navigator.normalizeCurrentUrl()}withObserver(t){return this.observer=t,this}start(){this.navigator.start(),this.navigator.firePageLoad()}stop(){this.navigator.stop()}navigate(t,e){this.navigator.navigate(t,e)}}class E extends x{parent;basePath;constructor(t,e,n){super(n),this.parent=t,this.basePath=e}getTopRouter(){return this.parent instanceof R?this.parent:this.parent.getTopRouter()}navigate(t,e){let n;if(e?.isBasePathNested??!0){const a=e?.basePath;n=a?d(this.basePath,a):this.basePath,this.parent.navigate(t,{...e,basePath:n})}else this.parent.navigate(t,{...e,basePath:e?.basePath})}}const $=r(void 0);function N(){const t=i($);if(!t)throw new Error("useRouter must be used within a RouterProvider");return t}function j(){const{navigate:t}=N();return t}function U(){const{matchedRoutePath:t,router:e}=N();return e instanceof E?e.basePath:t}function W(t){const{params:e}=N();return t?e[t]:e}function A(){const{location:t}=N();return t}function B(t){a(()=>{const e=document.title;return document.title=t,()=>{document.title=e}},[t])}function z(t){const{router:e}=N(),n=e.getTopRouter();a(()=>(n.prompt=t,()=>{n.prompt=void 0}),[t,n]),a(()=>{if(t.when){const e=t.when,n=t=>{e&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}}},[t.when])}function O({children:e,to:n,onClick:a,replace:r=!0}){const i=j();return t("span",{onClick:t=>{const e=t.target.closest("a"),s=e?.getAttribute("href"),o=n??s;e&&o&&(t.stopPropagation(),t.preventDefault(),i(o,{replace:r}),a?.(t))},children:e})}function T({children:e,href:n,className:a,target:r,topLevelNav:i,clearBreadcrumbs:s=!1,replace:o,skipStickyParams:h}){const{router:c}=N(),l=!n||n.startsWith("#"),d=/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("//")||!!r&&"_self"!==r,u=!l&&!d,m=!h&&u?c.getTopRouter().navigator.addStickyParams(n):n;return t("a",{href:m,className:a,target:r,onClick:t=>{if(t.defaultPrevented||!u)return;t.stopPropagation(),t.preventDefault();(i?c.getTopRouter():c).navigate(n,{replace:o??s})},children:e})}function F({spinner:e}){const n=N(),a=n.route;if(a.Component){const e=a.Component;return t(e,{...n.params})}if(a.LazyComponent)return t(D,{route:a,spinner:e});throw new Error(`Invalid route for ${a.path}. Either Component or LazyCOmponent must be specified.`)}function D({route:e,spinner:n}){const[r,i]=s(null);return a(()=>{e.LazyComponent().then(t=>{if(!t.default)throw new Error(`Lazy module for ${e.path} does not have a default export`);i(()=>t.default)})},[e]),r?t(r,{}):n||null}function I({basePath:e,fixLinks:n=!1,children:a}){const r=N(),i=n?e=>t(b,{basePath:r.matchedRoutePath,children:e}):t=>t;return t($.Provider,{value:{...r,navigate:(t,n)=>{if(!1===n?.isBasePathNested)return r.navigate(t,n);const a=n?.basePath?d(e,n.basePath):e;return r.navigate(t,{...n,basePath:a})}},children:i(a||t(F,{}))})}function H(){const t=N();return e("div",{children:["Route not found for path ",t.matchedRoutePath]})}function M(){return{params:{},matchedSegments:[],state:null,value:{path:"virtual:404",Component:()=>t(H,{})}}}function V({routes:e,index:a,children:r,fixLinks:i=!1}){const s=N(),h=n(s.matchedRoutePath),c=o(()=>{if("undefined"==typeof window)return null;const t=new E(s.router,h.current,e);return t.index=a,t},[s.router,a,e]),l=o(()=>{if(c&&s.matchedRoutePath===c.basePath)return c.match(s.remainingPath||"/")||M()},[s.matchedRoutePath,s.remainingPath,c]),d=i?e=>t(b,{basePath:s.matchedRoutePath,children:e}):t=>t;return l&&t($.Provider,{value:{...s,router:c,route:l.value,params:l.params,matchedRoutePath:`/${l.matchedSegments.join("/")}`,remainingPath:l.remainingSegments?`/${l.remainingSegments.join("/")}`:void 0,navigate:(t,e)=>{if(c)return c.navigate(t,e)}},children:d(r||t(F,{}))})}function q({routes:e,index:n,onChange:a,children:r}){const[i,c]=s(void 0),l=o(()=>{if("undefined"==typeof window)return null;const t=new R(e,e=>{null===e&&(e=M()),c({location:window.location,route:e.value,params:e.params,state:e.state,router:t,matchedRoutePath:`/${e.matchedSegments.join("/")}`,remainingPath:e.remainingSegments?`/${e.remainingSegments.join("/")}`:void 0,navigate:(e,n)=>t.navigate(e,n)})}).withObserver(a);return t.index=n,t},[n,a,e]);return h(()=>(l?.start(),()=>{l?.stop()}),[l]),i&&t($.Provider,{value:i,children:r||t(F,{})})}export{v as AfterLocationChangeEvent,p as BASE_PATH,x as BaseRouter,g as BeforeLocationChangeEvent,b as FixLinks,P as HistoryNavigator,w as LocationChangeEvent,O as Nav,T as NavLink,I as NestedNavigationContext,E as NestedRouter,V as NestedRouterProvider,f as Path,L as PathMatcher,$ as ReactRouterContext,F as RouteComponent,R as Router,q as RouterProvider,A as useLocation,j as useNavigate,z as useNavigationPrompt,B as usePageTitle,W as useParams,U as useRouterBasePath,N as useRouterContext};
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useRef as n,useEffect as a,createContext as r,useContext as i,useState as s,useMemo as o}from"react";import{useSafeLayoutEffect as h}from"@vertesia/ui/core";class c{path;params;hash;constructor(t){let e=t.lastIndexOf("#");e>-1?(this.hash=t.substring(e),t=t.substring(0,e)):this.hash="",e=t.indexOf("?"),e>-1?(this.path=t.substring(0,e),this.params=new URLSearchParams(t.substring(e+1))):(this.path=t,this.params=new URLSearchParams)}add(t){for(const[e,n]of Object.entries(t))this.params.set(e,n);return this}toString(){return`${this.path}?${this.params.toString()}${this.hash}`}}function l(t){return"/"===t||""===t}function u(t,e){return e=t.endsWith("/")&&e.startsWith("/")?t+e.substring(1):t.endsWith("/")||e.startsWith("/")?t+e:`${t}/${e}`}function d(){if("undefined"==typeof document)return"";const t=document.querySelector("base[href]");if(!t)return"";try{return new URL(t.href,document.URL).pathname.replace(/\/+$/,"")}catch{return""}}function f(t){const e=d();return e&&t.startsWith("/")?t===e||t.startsWith(`${e}/`)?t:u(e,t):t}function m(t){const e=d();return e?t===e?"/":t.startsWith(`${e}/`)?t.slice(e.length)||"/":t:t}function p(t){if(""===t)return[];if("/"===t)return[""];let e=0,n=t.length;return t.startsWith("./")?e=2:t.startsWith("/")&&(e=1),t.endsWith("/")&&(n=t.length-1),(e>0||n<t.length?t.substring(e,n):t).split("/")}function w(t){if("string"==typeof t)return p(t);if(Array.isArray(t))return t;throw new Error(`Unsupported path object: ${t}`)}var g=Object.freeze({__proto__:null,getMountBasename:d,getPathSegments:p,isRootPath:l,joinPath:u,stripMountBasename:m,toSegments:w,withMountBasename:f});const v=Symbol("BASE_PATH");class P{name;type;location;state;_canceled=!1;constructor(t,e,n,a){this.name=t,this.type=e,this.location=n,this.state=a}get isPageLoad(){return"initial"===this.type}get isBackForward(){return"popState"===this.type}get isLinkClick(){return"linkClick"===this.type}get isNavigation(){return"navigate"===this.type}get isCancelable(){return"beforeChange"===this.name}cancel(){if("afterChange"===this.name)throw new Error("Cannot cancel afterChange event");this._canceled=!0}}class b extends P{constructor(t,e,n){super("beforeChange",t,e,n)}}class L extends P{constructor(t,e,n){super("afterChange",t,e,n)}}class y{stickyParams;_popStateListener;_linkNavListener;_listeners=[];addListener(t){this._listeners.push(t)}fireLocationChange(t){for(const e of this._listeners)e(t)}firePageLoad(){this.fireLocationChange(new L("initial",new URL(window.location.href)))}addStickyParams(t){return this.stickyParams?new c(t).add(this.stickyParams).toString():t}normalizeCurrentUrl(){if("undefined"==typeof window||!this.stickyParams)return;const t=window.location.pathname+window.location.search+window.location.hash,e=this.addStickyParams(t);if(e!==t){const t=new URL(e,window.location.href);window.history.replaceState(window.history.state,"",t.href)}}navigate(t,e={}){if(e.stepsBack&&e.stepsBack>0)this.stepBack(e.stepsBack,e);else{if(e.basePath){let n=e.basePath;n.startsWith("/")||(n=`/${n}`),t=u(n,t)}t=f(t=this.addStickyParams(t)),this._navigate(new URL(t,window.location.href),"navigate",e)}}stepBack(t,e={}){const n=window.history.state.historyChain||[],a=n.length>=t?new URL(n[n.length-t].href,window.location.href):new URL(window.location.origin,window.location.href);this._navigate(a,"popState",e);const r={from:window.location.href,historyChain:n.slice(0,-t),data:e.state||void 0,title:e.title||document.title};window.history.replaceState(r,"",a.href),this.fireLocationChange(new L("popState",a,e.state))}_navigate(t,e,n){const a=new b(e,t,n.state);if(this.fireLocationChange(a),a._canceled)return;const r=window.history.state,i={title:n.title||document.title,href:window.location.pathname+window.location.search+window.location.hash};let s=[];!n.replace&&r?.historyChain&&(s=[...r.historyChain]),n.replace||(s.push(i),s.length>10&&(s=s.slice(-10)));const o={from:window.location.href,historyChain:s,data:n.state||void 0,title:n.title||document.title};window.history[n.replace?"replaceState":"pushState"](o,"",t.href),this.fireLocationChange(new L(e,t,n.state))}start(){if("undefined"==typeof window)return;const t=t=>{let e;const n=new URL(window.location.href);let a;t.state?(e="popState",a=t.state.data):e="linkClick",this.fireLocationChange(new L(e,n,a))};this._popStateListener=t,this._linkNavListener=t=>{const e=t.target;if("a"===e.tagName.toLowerCase()&&(e.hasAttribute("download")||e.href?.startsWith("blob:")))return;const n=function(t){if(t&&"a"===t.tagName.toLowerCase()){const e=t?.href.trim();if("string"==typeof e&&e.length>0)return new URL(e)}return null}(e);if(n&&n.origin===window.location.origin){t.preventDefault();const e=new URL(this.addStickyParams(n.href)),a=t[v]||t.target[v];a&&(e.pathname=u(a,e.pathname)),this._navigate(e,"linkClick",{})}},window.addEventListener("popstate",t),document.body.addEventListener("click",this._linkNavListener)}stop(){this._popStateListener&&window.removeEventListener("popstate",this._popStateListener),this._linkNavListener&&document.body.removeEventListener("click",this._linkNavListener)}}function k({basePath:e,children:r}){const i=n(null);return a(()=>{if(i.current){const t=i.current,n=t=>{"a"===t.target.tagName.toLowerCase()&&(t[v]=e)};return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)}}},[e]),t("div",{ref:i,className:"h-full w-full",children:r})}class S{tree=new _;loadMapping(t){for(const[e,n]of Object.entries(t))this.addSegments(p(e),n)}addPath(t,e){this.addSegments(p(t),e)}addSegments(t,e){let n=this.tree;for(let a=0,r=t.length;a<r;a++){const i=t[a];if(":"===i[0]){let e=n.wildcard;if(e){if(!(e instanceof x))throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard ":" segment will overwrite an existing wildcard segment at path: /${t.slice(0,a).join("/")}`)}else e=new x(i),n.wildcard=e;n=e}else{if("*"===i){if(n.wildcard)throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard "*" segment already exists at path: /${t.slice(0,a).join("/")}`);if(n.wildcard=new $(i,e),a<r-1)throw new Error(`Failed to index path segments: ${t.join("/")}. A wildcard segment must be the last segment`);return}{let t=n.children[i];t||(t=new R(i),n.children[i]=t),n=t}}}if(void 0!==n.value)throw new Error(`Failed to index path segments: ${t.join("/")}. A value already exists at path: /${t.join("/")}`);n.value=e}match(t){const e=w(t);if(0===e.length)return null;const n={};let a,r,i=this.tree;for(const t of e){const e=i.match(t,n);if(!e)return null;i=e}if(!i.value){if(i instanceof C&&i.wildcard instanceof $&&(i=i.wildcard.match("",n),!i.value))throw new Error("Wildcard segment node `*` must have a value");if(!i.value)return null}return n._&&n._.length>0?(a=e.slice(0,-n._.length),r=n._):a=e,{params:n,matchedSegments:a,remainingSegments:r,value:i.value}}}class C{name;value;children={};wildcard;constructor(t,e){this.name=t,this.value=e}match(t,e){const n=this.children[t];if(n)return n;if(this.wildcard){if(this.wildcard instanceof $)return this.wildcard.match(t,e);if(this.wildcard instanceof x)return e[this.wildcard.paramName]=t,this.wildcard;throw new Error(`Unknown wildcard segment node type: ${this.wildcard.constructor.name}`)}return null}}class _ extends C{constructor(){super("#root")}}class R extends C{}class x extends C{paramName;constructor(t,e){super(t,e),this.paramName=t.substring(1)}}class ${name;value;constructor(t,e){this.name=t,this.value=e}match(t,e){return e._?t&&e._.push(t):e._=t?[t]:[],this}}class E{index;matcher=new S;constructor(t,e){this.index=e;for(const e of t)this.matcher.addPath(e.path,e)}match(t){const e=l(t)&&this.index;return this.matcher.match(e?this.index:t)}}class N extends E{prompt;observer;navigator=new y;constructor(t,e){super(t),this.navigator.addListener(t=>{if((!t.isCancelable||!this.prompt?.when||window.confirm(this.prompt.message))&&(this.observer&&this.observer(t),"afterChange"===t.name)){const n=this.match(m(t.location.pathname));e(n?.value?{...n,state:t.state}:null)}})}getTopRouter(){return this}setStickyParams(t){this.navigator.stickyParams=null!=t?t:void 0,this.navigator.normalizeCurrentUrl()}withObserver(t){return this.observer=t,this}start(){this.navigator.start(),this.navigator.firePageLoad()}stop(){this.navigator.stop()}navigate(t,e){this.navigator.navigate(t,e)}}class j extends E{parent;basePath;constructor(t,e,n){super(n),this.parent=t,this.basePath=e}getTopRouter(){return this.parent instanceof N?this.parent:this.parent.getTopRouter()}navigate(t,e){let n;if(e?.isBasePathNested??!0){const a=e?.basePath;n=a?u(this.basePath,a):this.basePath,this.parent.navigate(t,{...e,basePath:n})}else this.parent.navigate(t,{...e,basePath:e?.basePath})}}const U=r(void 0);function W(){const t=i(U);if(!t)throw new Error("useRouter must be used within a RouterProvider");return t}function B(){const{navigate:t}=W();return t}function A(){const{matchedRoutePath:t,router:e}=W();return e instanceof j?e.basePath:t}function z(t){const{params:e}=W();return t?e[t]:e}function O(){const{location:t}=W();return t}function T(t){a(()=>{const e=document.title;return document.title=t,()=>{document.title=e}},[t])}function F(t){const{router:e}=W(),n=e.getTopRouter();a(()=>(n.prompt=t,()=>{n.prompt=void 0}),[t,n]),a(()=>{if(t.when){const e=t.when,n=t=>{e&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}}},[t.when])}function D({children:e,to:n,onClick:a,replace:r=!0}){const i=B();return t("span",{onClick:t=>{const e=t.target.closest("a"),s=e?.getAttribute("href"),o=n??s;e&&o&&(t.stopPropagation(),t.preventDefault(),i(o,{replace:r}),a?.(t))},children:e})}function M({children:e,href:n,className:a,target:r,topLevelNav:i,clearBreadcrumbs:s=!1,replace:o,skipStickyParams:h}){const{router:c}=W(),l=!n||n.startsWith("#"),u=/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("//")||!!r&&"_self"!==r,d=!l&&!u,m=d?f(h?n:c.getTopRouter().navigator.addStickyParams(n)):n;return t("a",{href:m,className:a,target:r,onClick:t=>{if(t.defaultPrevented||!d)return;t.stopPropagation(),t.preventDefault();(i?c.getTopRouter():c).navigate(n,{replace:o??s})},children:e})}function I({spinner:e}){const n=W(),a=n.route;if(a.Component){const e=a.Component;return t(e,{...n.params})}if(a.LazyComponent)return t(q,{route:a,spinner:e});throw new Error(`Invalid route for ${a.path}. Either Component or LazyCOmponent must be specified.`)}function q({route:e,spinner:n}){const[r,i]=s(null);return a(()=>{e.LazyComponent().then(t=>{if(!t.default)throw new Error(`Lazy module for ${e.path} does not have a default export`);i(()=>t.default)})},[e]),r?t(r,{}):n||null}function H({basePath:e,fixLinks:n=!1,children:a}){const r=W(),i=n?e=>t(k,{basePath:r.matchedRoutePath,children:e}):t=>t;return t(U.Provider,{value:{...r,navigate:(t,n)=>{if(!1===n?.isBasePathNested)return r.navigate(t,n);const a=n?.basePath?u(e,n.basePath):e;return r.navigate(t,{...n,basePath:a})}},children:i(a||t(I,{}))})}function V(){const t=W();return e("div",{children:["Route not found for path ",t.matchedRoutePath]})}function G(){return{params:{},matchedSegments:[],state:null,value:{path:"virtual:404",Component:()=>t(V,{})}}}function J({routes:e,index:a,children:r,fixLinks:i=!1}){const s=W(),h=n(s.matchedRoutePath),c=o(()=>{if("undefined"==typeof window)return null;const t=new j(s.router,h.current,e);return t.index=a,t},[s.router,a,e]),l=o(()=>{if(c&&s.matchedRoutePath===c.basePath)return c.match(s.remainingPath||"/")||G()},[s.matchedRoutePath,s.remainingPath,c]),u=i?e=>t(k,{basePath:s.matchedRoutePath,children:e}):t=>t;return l&&t(U.Provider,{value:{...s,router:c,route:l.value,params:l.params,matchedRoutePath:`/${l.matchedSegments.join("/")}`,remainingPath:l.remainingSegments?`/${l.remainingSegments.join("/")}`:void 0,navigate:(t,e)=>{if(c)return c.navigate(t,e)}},children:u(r||t(I,{}))})}function K({routes:e,index:n,onChange:a,children:r}){const[i,c]=s(void 0),l=o(()=>{if("undefined"==typeof window)return null;const t=new N(e,e=>{null===e&&(e=G()),c({location:window.location,route:e.value,params:e.params,state:e.state,router:t,matchedRoutePath:`/${e.matchedSegments.join("/")}`,remainingPath:e.remainingSegments?`/${e.remainingSegments.join("/")}`:void 0,navigate:(e,n)=>t.navigate(e,n)})}).withObserver(a);return t.index=n,t},[n,a,e]);return h(()=>(l?.start(),()=>{l?.stop()}),[l]),i&&t(U.Provider,{value:i,children:r||t(I,{})})}export{L as AfterLocationChangeEvent,v as BASE_PATH,E as BaseRouter,b as BeforeLocationChangeEvent,k as FixLinks,y as HistoryNavigator,P as LocationChangeEvent,D as Nav,M as NavLink,H as NestedNavigationContext,j as NestedRouter,J as NestedRouterProvider,g as Path,S as PathMatcher,U as ReactRouterContext,I as RouteComponent,N as Router,K as RouterProvider,O as useLocation,B as useNavigate,F as useNavigationPrompt,T as usePageTitle,z as useParams,A as useRouterBasePath,W as useRouterContext};
|
|
2
2
|
//# sourceMappingURL=vertesia-ui-router.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertesia-ui-router.js","sources":["router/PathWithParams.js","router/path.js","router/HistoryNavigator.js","router/FixLinks.js","router/PathMatcher.js","router/Router.js","router/Nav.js","router/RouteComponent.js","router/NestedNavigationContext.js","router/Route404.js","router/NestedRouterProvider.js","router/RouterProvider.js"],"sourcesContent":["export class PathWithParams {\n path;\n params;\n hash;\n constructor(path) {\n let i = path.lastIndexOf('#');\n if (i > -1) {\n this.hash = path.substring(i);\n path = path.substring(0, i);\n }\n else {\n this.hash = '';\n }\n i = path.indexOf('?');\n if (i > -1) {\n this.path = path.substring(0, i);\n this.params = new URLSearchParams(path.substring(i + 1));\n }\n else {\n this.path = path;\n this.params = new URLSearchParams();\n }\n }\n add(params) {\n for (const [key, value] of Object.entries(params)) {\n this.params.set(key, value);\n }\n return this;\n }\n toString() {\n return `${this.path}?${this.params.toString()}${this.hash}`;\n }\n}\n//# sourceMappingURL=PathWithParams.js.map","export function isRootPath(path) {\n return path === '/' || path === '';\n}\nexport function joinPath(path1, path2) {\n if (path1.endsWith('/') && path2.startsWith('/')) {\n path2 = path1 + path2.substring(1);\n }\n else if (path1.endsWith('/')) {\n path2 = path1 + path2;\n }\n else if (path2.startsWith('/')) {\n path2 = path1 + path2;\n }\n else {\n path2 = `${path1}/${path2}`;\n }\n return path2;\n}\nexport function getPathSegments(path) {\n if (path === '') {\n return [];\n }\n if (path === '/') {\n return [''];\n }\n let s = 0, e = path.length;\n if (path.startsWith('./')) {\n s = 2;\n }\n else if (path.startsWith('/')) {\n s = 1;\n }\n if (path.endsWith('/')) {\n e = path.length - 1;\n }\n return (s > 0 || e < path.length ? path.substring(s, e) : path).split('/');\n}\nexport function toSegments(path) {\n if (typeof path === 'string') {\n return getPathSegments(path);\n }\n else if (Array.isArray(path)) {\n return path;\n }\n else {\n throw new Error(`Unsupported path object: ${path}`);\n }\n}\n// export class Path {\n// static parse(path: string, abs = false) {\n// if (abs !== undefined) {\n// abs = path.startsWith('/');\n// }\n// return new Path(getPathSegments(path), abs);\n// }\n// constructor(public segments: string[], public isAbsolute = false) {\n// }\n// getParameters() {\n// const out = [];\n// for (const segment of this.segments) {\n// if (segment[0] === ':') {\n// out.push(segment.substring(1));\n// }\n// }\n// if (this.segments[this.segments.length - 1] === '*') {\n// out.push('_');\n// }\n// return out;\n// }\n// resolveParameters(path: string) {\n// const params: PathMatchParams = {};\n// const resolvedSegments = getPathSegments(path);\n// if (resolvedSegments.length < this.segments.length) {\n// return null;\n// }\n// const segments = this.segments;\n// for (let i = 0, l = segments.length; i < l; i++) {\n// const seg = segments[i];\n// if (seg[0] === ':') {\n// params[seg.substring(1)] = resolvedSegments[i];\n// }\n// }\n// if (resolvedSegments.length - this.segments.length) {\n// params._ = resolvedSegments.slice(this.segments.length);\n// }\n// return params;\n// }\n// match(path: string | string[] | Path) {\n// const segments = toSegments(path);\n// if (segments.length < this.segments.length) {\n// return false;\n// }\n// let params: PathMatchParams | undefined;\n// const mySegments = this.segments;\n// for (let i = 0, l = mySegments.length; i < l; i++) {\n// const segment = mySegments[i];\n// if (segment === ':') {\n// if (!params) params = {};\n// params[segment.substring(1)] = segment;\n// } else if (segment !== segments[i]) {\n// if (i === l - 1 && segment === '*') {\n// if (!params) params = {};\n// params._ = segments.slice(i);\n// return params;\n// }\n// return false;\n// }\n// }\n// return params ? params : false;\n// }\n// join(path: Path | string | string[]) {\n// const segments = toSegments(path);\n// return new Path(this.segments.concat(segments), this.isAbsolute);\n// }\n// getRelativePath(path: Path | string | string[], asAbsolute: boolean = false) {\n// const segments = toSegments(path);\n// const extraSegmentsCount = segments.length - this.segments.length;\n// if (extraSegmentsCount <= 0) {\n// return null;\n// }\n// return new Path(segments.slice(this.segments.length), asAbsolute);\n// }\n// prependSegments(segments: string[]) {\n// this.segments = segments.concat(this.segments);\n// }\n// appendSegments(segments: string[]) {\n// this.segments = this.segments.concat(segments);\n// }\n// toAbsolutePath() {\n// return '/' + this.segments.join('/');\n// }\n// toRelativePath() {\n// return this.segments.join('/');\n// }\n// toString() {\n// const path = this.segments.join('/');\n// return this.isAbsolute ? '/' + path : path;\n// }\n// }\n//# sourceMappingURL=path.js.map","import { PathWithParams } from './PathWithParams';\nimport { joinPath } from './path';\nconst BASE_PATH = Symbol('BASE_PATH');\nexport { BASE_PATH };\nexport class LocationChangeEvent {\n name;\n type;\n location;\n state;\n _canceled = false;\n constructor(name, type, location, state) {\n this.name = name;\n this.type = type;\n this.location = location;\n this.state = state;\n }\n get isPageLoad() {\n return this.type === 'initial';\n }\n get isBackForward() {\n return this.type === 'popState';\n }\n get isLinkClick() {\n return this.type === 'linkClick';\n }\n get isNavigation() {\n return this.type === 'navigate';\n }\n get isCancelable() {\n return this.name === 'beforeChange';\n }\n cancel() {\n if (this.name === 'afterChange') {\n throw new Error('Cannot cancel afterChange event');\n }\n this._canceled = true;\n }\n}\nexport class BeforeLocationChangeEvent extends LocationChangeEvent {\n constructor(type, location, state) {\n super('beforeChange', type, location, state);\n }\n}\nexport class AfterLocationChangeEvent extends LocationChangeEvent {\n constructor(type, location, state) {\n super('afterChange', type, location, state);\n }\n}\nfunction getElementHrefAsUrl(elem) {\n if (elem && elem.tagName.toLowerCase() === 'a') {\n const href = elem?.href.trim();\n if (typeof href === 'string' && href.length > 0) {\n return new URL(href);\n }\n }\n return null;\n}\nexport class HistoryNavigator {\n // params to preserve in the query string when navigating\n stickyParams;\n _popStateListener;\n _linkNavListener;\n _listeners = [];\n addListener(listener) {\n this._listeners.push(listener);\n }\n fireLocationChange(event) {\n for (const listener of this._listeners) {\n listener(event);\n }\n }\n /**\n * Should be called when the page is first loaded.\n * It will fire a location change event with type `initial` and the current window.location as the location\n */\n firePageLoad() {\n this.fireLocationChange(new AfterLocationChangeEvent('initial', new URL(window.location.href)));\n }\n addStickyParams(path) {\n if (this.stickyParams) {\n return new PathWithParams(path).add(this.stickyParams).toString();\n }\n return path;\n }\n /**\n * Rewrite the current browser URL in place so that the sticky params are present, without\n * navigating. Used on load / when the params first become known so the address bar reflects\n * the active account/project before the first navigation.\n *\n * Idempotent and side-effect-light: only calls replaceState when the URL would actually\n * change, preserves the existing history state, and never fires a location-change event\n * (so there is no route re-match or component remount).\n */\n normalizeCurrentUrl() {\n if (typeof window === 'undefined' || !this.stickyParams) {\n return;\n }\n const current = window.location.pathname + window.location.search + window.location.hash;\n const normalized = this.addStickyParams(current);\n if (normalized !== current) {\n const to = new URL(normalized, window.location.href);\n window.history.replaceState(window.history.state, '', to.href);\n }\n }\n navigate(to, options = {}) {\n if (options.stepsBack && options.stepsBack > 0) {\n this.stepBack(options.stepsBack, options);\n return;\n }\n if (options.basePath) {\n let basePath = options.basePath;\n if (!basePath.startsWith('/')) {\n basePath = `/${basePath}`;\n }\n to = joinPath(basePath, to);\n }\n to = this.addStickyParams(to);\n this._navigate(new URL(to, window.location.href), 'navigate', options);\n }\n stepBack(steps, options = {}) {\n const historyChain = window.history.state.historyChain || [];\n const to = historyChain.length >= steps\n ? new URL(historyChain[historyChain.length - steps].href, window.location.href)\n : new URL(window.location.origin, window.location.href);\n this._navigate(to, 'popState', options);\n const stateToStore = {\n from: window.location.href,\n historyChain: historyChain.slice(0, -steps),\n data: options.state || undefined,\n title: options.title || document.title,\n };\n window.history.replaceState(stateToStore, '', to.href);\n this.fireLocationChange(new AfterLocationChangeEvent('popState', to, options.state));\n }\n _navigate(to, type, options) {\n const beforeEvent = new BeforeLocationChangeEvent(type, to, options.state);\n this.fireLocationChange(beforeEvent);\n if (beforeEvent._canceled) {\n return;\n }\n // Build navigation chain by preserving previous history\n const currentState = window.history.state;\n const currentTitle = options.title || document.title;\n // Create new history chain entry\n const newChainEntry = {\n title: currentTitle,\n href: window.location.pathname + window.location.search + window.location.hash,\n };\n // Build the history chain - clear if using replace\n let historyChain = [];\n if (!options.replace && currentState?.historyChain) {\n historyChain = [...currentState.historyChain];\n }\n // Only add to chain if not replacing\n if (!options.replace) {\n historyChain.push(newChainEntry);\n // Limit chain length to prevent memory issues (keep last 10 entries)\n if (historyChain.length > 10) {\n historyChain = historyChain.slice(-10);\n }\n }\n const stateToStore = {\n from: window.location.href,\n historyChain: historyChain,\n data: options.state || undefined,\n title: options.title || document.title,\n };\n window.history[options.replace ? 'replaceState' : 'pushState'](stateToStore, '', to.href);\n this.fireLocationChange(new AfterLocationChangeEvent(type, to, options.state));\n }\n start() {\n if (typeof window === 'undefined') {\n return;\n }\n const _popStateListener = (ev) => {\n let type;\n const to = new URL(window.location.href);\n let state;\n if (ev.state) {\n type = 'popState';\n state = ev.state.data;\n }\n else {\n type = 'linkClick';\n }\n this.fireLocationChange(new AfterLocationChangeEvent(type, to, state));\n };\n const _linkNavListener = (ev) => {\n const target = ev.target;\n // Skip anchors with download attribute or blob: URLs - they are file downloads, not navigation\n if (target.tagName.toLowerCase() === 'a' &&\n (target.hasAttribute('download') ||\n target.href?.startsWith('blob:'))) {\n return;\n }\n const url = getElementHrefAsUrl(target);\n if (url && url.origin === window.location.origin) {\n ev.preventDefault();\n const to = new URL(this.addStickyParams(url.href));\n const basePath = ev[BASE_PATH] ||\n ev.target[BASE_PATH];\n if (basePath) {\n to.pathname = joinPath(basePath, to.pathname);\n }\n this._navigate(to, 'linkClick', {});\n }\n };\n this._popStateListener = _popStateListener;\n this._linkNavListener = _linkNavListener;\n window.addEventListener('popstate', _popStateListener);\n document.body.addEventListener('click', this._linkNavListener);\n }\n stop() {\n if (this._popStateListener)\n window.removeEventListener('popstate', this._popStateListener);\n if (this._linkNavListener)\n document.body.removeEventListener('click', this._linkNavListener);\n }\n}\n//# sourceMappingURL=HistoryNavigator.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef } from 'react';\nimport { BASE_PATH } from './HistoryNavigator';\nexport function FixLinks({ basePath, children }) {\n const ref = useRef(null);\n useEffect(() => {\n if (ref.current) {\n const divElem = ref.current;\n const listener = (ev) => {\n const elem = ev.target;\n if (elem.tagName.toLowerCase() === 'a') {\n ev[BASE_PATH] = basePath;\n }\n };\n divElem.addEventListener('click', listener);\n return () => {\n divElem.removeEventListener('click', listener);\n };\n }\n }, [basePath]);\n return (_jsx(\"div\", { ref: ref, className: \"h-full w-full\", children: children }));\n}\n//# sourceMappingURL=FixLinks.js.map","import { getPathSegments, toSegments } from './path';\n/**\n * Path matcher which support :param and *wildcard segments.\n * The wildcard segment is only supported as the last segment\n */\nexport class PathMatcher {\n tree = new RootSegmentNode();\n loadMapping(mapping) {\n for (const [key, value] of Object.entries(mapping)) {\n this.addSegments(getPathSegments(key), value);\n }\n }\n addPath(path, value) {\n this.addSegments(getPathSegments(path), value);\n }\n addSegments(segments, value) {\n let node = this.tree;\n for (let i = 0, l = segments.length; i < l; i++) {\n const segment = segments[i];\n if (segment[0] === ':') {\n let childNode = node.wildcard;\n if (!childNode) {\n childNode = new VariableSegmentNode(segment);\n node.wildcard = childNode;\n }\n else if (!(childNode instanceof VariableSegmentNode)) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard \":\" segment will overwrite an existing wildcard segment at path: ${`/${segments.slice(0, i).join('/')}`}`);\n }\n node = childNode;\n }\n else if (segment === '*') {\n if (node.wildcard) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard \"*\" segment already exists at path: ${`/${segments.slice(0, i).join('/')}`}`);\n }\n node.wildcard = new WildcardSegmentNode(segment, value);\n if (i < l - 1) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard segment must be the last segment`);\n }\n return;\n }\n else {\n let childNode = node.children[segment];\n if (!childNode) {\n childNode = new LiteralSegmentNode(segment);\n node.children[segment] = childNode;\n } // else // a literal segment already exists\n node = childNode;\n }\n }\n if (node.value !== undefined) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A value already exists at path: ${`/${segments.join('/')}`}`);\n }\n node.value = value;\n }\n match(path) {\n const segments = toSegments(path);\n if (segments.length === 0) {\n return null;\n }\n const params = {};\n let node = this.tree;\n for (const segment of segments) {\n const match = node.match(segment, params);\n if (match) {\n node = match;\n }\n else {\n return null;\n }\n }\n if (!node.value) {\n // not a leaf node (partial match)\n if (node instanceof ParentSegmentNode) {\n if (node.wildcard instanceof WildcardSegmentNode) {\n node = node.wildcard.match('', params);\n if (!node.value) {\n throw new Error('Wildcard segment node `*` must have a value');\n }\n }\n }\n if (!node.value)\n return null; // not a leaf node, neither a trailing wildcard (partial match)\n }\n let matchedSegments, remainingSegments;\n if (params._ && params._.length > 0) {\n matchedSegments = segments.slice(0, -params._.length);\n remainingSegments = params._;\n }\n else {\n matchedSegments = segments;\n }\n return { params, matchedSegments, remainingSegments, value: node.value };\n }\n}\nclass ParentSegmentNode {\n name;\n value;\n children = {};\n wildcard;\n constructor(name, value) {\n this.name = name;\n this.value = value;\n }\n match(segment, params) {\n const node = this.children[segment];\n if (node) {\n return node;\n }\n else if (this.wildcard) {\n if (this.wildcard instanceof WildcardSegmentNode) {\n return this.wildcard.match(segment, params);\n }\n else if (this.wildcard instanceof VariableSegmentNode) {\n params[this.wildcard.paramName] = segment;\n return this.wildcard;\n }\n else {\n throw new Error(`Unknown wildcard segment node type: ${this.wildcard.constructor.name}`);\n }\n }\n else {\n return null;\n }\n }\n}\nclass RootSegmentNode extends ParentSegmentNode {\n constructor() {\n super('#root');\n }\n}\nclass LiteralSegmentNode extends ParentSegmentNode {\n}\nclass VariableSegmentNode extends ParentSegmentNode {\n paramName;\n constructor(name, value) {\n super(name, value);\n this.paramName = name.substring(1);\n }\n}\nclass WildcardSegmentNode {\n name;\n value;\n constructor(name, value) {\n this.name = name;\n this.value = value;\n }\n match(segment, params) {\n if (!params._) {\n params._ = segment ? [segment] : [];\n }\n else {\n if (segment)\n params._.push(segment);\n }\n return this;\n }\n}\n//# sourceMappingURL=PathMatcher.js.map","import { createContext, useContext, useEffect } from 'react';\nimport { HistoryNavigator } from './HistoryNavigator';\nimport { PathMatcher } from './PathMatcher';\nimport { isRootPath, joinPath } from './path';\nexport class BaseRouter {\n // the path to use when navigating to the root of the router\n index;\n matcher = new PathMatcher();\n constructor(routes, index) {\n this.index = index;\n for (const route of routes) {\n this.matcher.addPath(route.path, route);\n }\n }\n match(path) {\n const useIndex = isRootPath(path) && this.index;\n // biome-ignore lint/style/noNonNullAssertion: intentional non-null assertion; TS can't prove narrowing here\n return this.matcher.match(useIndex ? this.index : path);\n }\n}\nexport class Router extends BaseRouter {\n prompt;\n observer;\n navigator = new HistoryNavigator();\n constructor(routes, updateState) {\n super(routes);\n this.navigator.addListener((event) => {\n if (event.isCancelable && this.prompt?.when) {\n if (!window.confirm(this.prompt.message))\n return;\n }\n if (this.observer) {\n this.observer(event);\n }\n // only process afterChange events\n if (event.name === 'afterChange') {\n const match = this.match(event.location.pathname);\n if (match?.value) {\n updateState({\n ...match,\n state: event.state,\n });\n }\n else {\n updateState(null);\n }\n }\n });\n }\n getTopRouter() {\n return this;\n }\n /**\n * Subsequent navigations will preserve the given params in the query string.\n * Use null to clear the sticky params.\n * @param params\n */\n setStickyParams(params) {\n this.navigator.stickyParams = params != null ? params : undefined;\n // Reflect the params in the current URL immediately, so the address bar is correct on\n // load (not only after the first navigation).\n this.navigator.normalizeCurrentUrl();\n }\n withObserver(observer) {\n this.observer = observer;\n return this;\n }\n start() {\n this.navigator.start();\n // initialize with the current location\n this.navigator.firePageLoad();\n }\n stop() {\n this.navigator.stop();\n }\n navigate(path, options) {\n this.navigator.navigate(path, options);\n }\n}\nexport class NestedRouter extends BaseRouter {\n parent;\n basePath;\n constructor(parent, basePath, routes) {\n super(routes);\n this.parent = parent;\n this.basePath = basePath;\n }\n getTopRouter() {\n if (this.parent instanceof Router) {\n return this.parent;\n }\n else {\n return this.parent.getTopRouter();\n }\n }\n navigate(path, options) {\n // base path is nested by default in a NestedRouter unless explicitly set to false by caller\n const isBasePathNested = options?.isBasePathNested ?? true;\n let basePath;\n if (isBasePathNested) {\n const childBasePath = options?.basePath;\n // e.g. \"/store\" + \"/objects/123\" => \"/store/objects/123\"\n basePath = childBasePath ? joinPath(this.basePath, childBasePath) : this.basePath;\n this.parent.navigate(path, {\n ...options,\n basePath,\n });\n }\n else {\n // isBasePathNested === false: navigate to an absolute path without adding this router's basePath\n // Pass through to parent without adding our basePath prefix\n this.parent.navigate(path, {\n ...options,\n basePath: options?.basePath,\n });\n }\n }\n}\nconst ReactRouterContext = createContext(undefined);\nexport { ReactRouterContext };\nexport function useRouterContext() {\n const ctx = useContext(ReactRouterContext);\n if (!ctx) {\n throw new Error('useRouter must be used within a RouterProvider');\n }\n return ctx;\n}\nexport function useNavigate() {\n const { navigate } = useRouterContext();\n return navigate;\n}\nexport function useRouterBasePath() {\n const { matchedRoutePath, router } = useRouterContext();\n return router instanceof NestedRouter ? router.basePath : matchedRoutePath;\n}\nexport function useParams(arg) {\n const { params } = useRouterContext();\n if (arg) {\n return params[arg];\n }\n else {\n return params;\n }\n}\nexport function useLocation() {\n const { location } = useRouterContext();\n return location;\n}\nexport function usePageTitle(title) {\n useEffect(() => {\n const prev = document.title;\n document.title = title;\n return () => {\n document.title = prev;\n };\n }, [title]);\n}\nexport function useNavigationPrompt(prompt) {\n const { router } = useRouterContext();\n const topRouter = router.getTopRouter();\n useEffect(() => {\n topRouter.prompt = prompt;\n return () => {\n topRouter.prompt = undefined;\n };\n }, [prompt, topRouter]);\n useEffect(() => {\n if (prompt.when) {\n const doBlock = prompt.when;\n const listener = (ev) => {\n if (doBlock) {\n ev.preventDefault();\n ev.returnValue = '';\n }\n };\n window.addEventListener('beforeunload', listener);\n return () => {\n window.removeEventListener('beforeunload', listener);\n };\n }\n }, [prompt.when]);\n}\n//# sourceMappingURL=Router.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useNavigate, useRouterContext } from './Router';\nexport function Nav({ children, to, onClick, replace = true }) {\n const navigate = useNavigate();\n const _onClick = (ev) => {\n const link = ev.target.closest('a');\n const rawHref = link?.getAttribute('href');\n const target = to ?? rawHref;\n if (link && target) {\n ev.stopPropagation();\n ev.preventDefault();\n navigate(target, { replace });\n onClick?.(ev);\n }\n };\n return (_jsx(\"span\", { onClick: _onClick, children: children }));\n}\nexport function NavLink({ children, href, className, target, topLevelNav, clearBreadcrumbs = false, replace, skipStickyParams, }) {\n const { router } = useRouterContext();\n // In-app route = not an external URL, `_blank` target, or bare hash. Relative paths count too —\n // they must be routed, else the global link listener re-applies the module base path (wrong URL).\n const isAnchorOrEmpty = !href || href.startsWith('#');\n const isExternal = /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith('//') || (!!target && target !== '_self');\n const isInternal = !isAnchorOrEmpty && !isExternal;\n const resolvedHref = !skipStickyParams && isInternal ? router.getTopRouter().navigator.addStickyParams(href) : href;\n const _onClick = (ev) => {\n if (ev.defaultPrevented || !isInternal) {\n return;\n }\n ev.stopPropagation();\n ev.preventDefault();\n const actualRouter = topLevelNav ? router.getTopRouter() : router;\n actualRouter.navigate(href, { replace: replace ?? clearBreadcrumbs });\n };\n return (_jsx(\"a\", { href: resolvedHref, className: className, target: target, onClick: _onClick, children: children }));\n}\n//# sourceMappingURL=Nav.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useState } from 'react';\nimport { useRouterContext } from './Router';\nexport function RouteComponent({ spinner }) {\n const ctx = useRouterContext();\n const route = ctx.route;\n if (route.Component) {\n const Component = route.Component;\n return _jsx(Component, { ...ctx.params });\n }\n else if (route.LazyComponent) {\n return _jsx(LazyRouteComponent, { route: route, spinner: spinner });\n }\n else {\n throw new Error(`Invalid route for ${route.path}. Either Component or LazyCOmponent must be specified.`);\n }\n}\nfunction LazyRouteComponent({ route, spinner }) {\n const [Component, setComponent] = useState(null);\n useEffect(() => {\n void route.LazyComponent().then((module) => {\n if (!module.default) {\n throw new Error(`Lazy module for ${route.path} does not have a default export`);\n }\n // we need to wrap the component type in an arrow function\n // otherwise the setState function will execute the function as a state update function\n setComponent(() => module.default);\n });\n }, [route]);\n return Component ? _jsx(Component, {}) : spinner || null;\n}\n//# sourceMappingURL=RouteComponent.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { FixLinks } from './FixLinks';\nimport { joinPath } from './path';\nimport { RouteComponent } from './RouteComponent';\nimport { ReactRouterContext, useRouterContext } from './Router';\nexport function NestedNavigationContext({ basePath, fixLinks = false, children }) {\n const ctx = useRouterContext();\n const wrapWithFixLinks = fixLinks\n ? (elem) => _jsx(FixLinks, { basePath: ctx.matchedRoutePath, children: elem })\n : (elem) => elem;\n return (_jsx(ReactRouterContext.Provider, { value: {\n ...ctx,\n navigate: (to, options) => {\n if (options?.isBasePathNested === false) {\n // Navigate to an absolute path without adding this context's basePath\n return ctx.navigate(to, options);\n }\n const actualBasePath = options?.basePath ? joinPath(basePath, options.basePath) : basePath;\n return ctx.navigate(to, { ...options, basePath: actualBasePath });\n },\n }, children: wrapWithFixLinks(children ? children : _jsx(RouteComponent, {})) }));\n}\n//# sourceMappingURL=NestedNavigationContext.js.map","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport { useRouterContext } from './Router';\nexport function Route404Component() {\n const ctx = useRouterContext();\n return _jsxs(\"div\", { children: [\"Route not found for path \", ctx.matchedRoutePath] });\n}\nexport function createRoute404() {\n return {\n params: {},\n matchedSegments: [],\n state: null,\n value: {\n path: 'virtual:404',\n Component: () => _jsx(Route404Component, {}),\n },\n };\n}\n//# sourceMappingURL=Route404.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useMemo, useRef } from 'react';\nimport { FixLinks } from './FixLinks';\nimport { createRoute404 } from './Route404';\nimport { RouteComponent } from './RouteComponent';\nimport { NestedRouter, ReactRouterContext, useRouterContext } from './Router';\nexport function NestedRouterProvider({ routes, index, children, fixLinks = false }) {\n const ctx = useRouterContext();\n // Capture basePath once at mount. When the parent router switches to a different\n // top-level route (e.g. /store -> /studio), the lazy loader briefly keeps rendering\n // this (now-stale) module with a new ctx. Keeping basePath stable lets the\n // ctx.matchedRoutePath !== nestedRouter.basePath check below detect the mismatch and\n // skip rendering instead of running match() against the wrong route table.\n const basePathRef = useRef(ctx.matchedRoutePath);\n const nestedRouter = useMemo(() => {\n if (typeof window === 'undefined')\n return null;\n const nestedRouter = new NestedRouter(ctx.router, basePathRef.current, routes);\n nestedRouter.index = index;\n return nestedRouter;\n }, [ctx.router, index, routes]);\n const nestedRouteMatch = useMemo(() => {\n if (!nestedRouter) {\n return undefined;\n }\n if (ctx.matchedRoutePath !== nestedRouter.basePath) {\n // The change belongs to another router level and will be handled there.\n return undefined;\n }\n return nestedRouter.match(ctx.remainingPath || '/') || createRoute404();\n }, [ctx.matchedRoutePath, ctx.remainingPath, nestedRouter]);\n const wrapWithFixLinks = fixLinks\n ? (elem) => _jsx(FixLinks, { basePath: ctx.matchedRoutePath, children: elem })\n : (elem) => elem;\n return (nestedRouteMatch && (_jsx(ReactRouterContext.Provider, { value: {\n ...ctx,\n // biome-ignore lint/style/noNonNullAssertion: intentional non-null assertion; TS can't prove narrowing here\n router: nestedRouter,\n route: nestedRouteMatch.value,\n params: nestedRouteMatch.params,\n matchedRoutePath: `/${nestedRouteMatch.matchedSegments.join('/')}`,\n remainingPath: nestedRouteMatch.remainingSegments\n ? `/${nestedRouteMatch.remainingSegments.join('/')}`\n : undefined,\n navigate: (to, options) => {\n if (nestedRouter) {\n return nestedRouter.navigate(to, options);\n }\n },\n }, children: wrapWithFixLinks(children ? children : _jsx(RouteComponent, {})) })));\n}\n//# sourceMappingURL=NestedRouterProvider.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useSafeLayoutEffect } from '@vertesia/ui/core';\nimport { useMemo, useState } from 'react';\nimport { createRoute404 } from './Route404';\nimport { RouteComponent } from './RouteComponent';\nimport { ReactRouterContext, Router } from './Router';\nexport function RouterProvider({ routes, index, onChange, children }) {\n const [state, setState] = useState(undefined);\n const router = useMemo(() => {\n if (typeof window === 'undefined')\n return null;\n const router = new Router(routes, (match) => {\n if (match === null) {\n match = createRoute404();\n }\n setState({\n location: window.location,\n route: match.value,\n params: match.params,\n state: match.state,\n router: router,\n matchedRoutePath: `/${match.matchedSegments.join('/')}`,\n remainingPath: match.remainingSegments ? `/${match.remainingSegments.join('/')}` : undefined,\n navigate: (to, options) => {\n return router.navigate(to, options);\n },\n });\n }).withObserver(onChange);\n router.index = index;\n return router;\n }, [index, onChange, routes]);\n useSafeLayoutEffect(() => {\n router?.start();\n return () => {\n router?.stop();\n };\n }, [router]);\n return (state && (_jsx(ReactRouterContext.Provider, { value: state, children: children ? children : _jsx(RouteComponent, {}) })));\n}\n//# sourceMappingURL=RouterProvider.js.map"],"names":["PathWithParams","path","params","hash","constructor","i","lastIndexOf","this","substring","indexOf","URLSearchParams","add","key","value","Object","entries","set","toString","isRootPath","joinPath","path1","path2","endsWith","startsWith","getPathSegments","s","e","length","split","toSegments","Array","isArray","Error","BASE_PATH","Symbol","LocationChangeEvent","name","type","location","state","_canceled","isPageLoad","isBackForward","isLinkClick","isNavigation","isCancelable","cancel","BeforeLocationChangeEvent","super","AfterLocationChangeEvent","HistoryNavigator","stickyParams","_popStateListener","_linkNavListener","_listeners","addListener","listener","push","fireLocationChange","event","firePageLoad","URL","window","href","addStickyParams","normalizeCurrentUrl","current","pathname","search","normalized","to","history","replaceState","navigate","options","stepsBack","stepBack","basePath","_navigate","steps","historyChain","origin","stateToStore","from","slice","data","undefined","title","document","beforeEvent","currentState","newChainEntry","replace","start","ev","target","tagName","toLowerCase","hasAttribute","url","elem","trim","getElementHrefAsUrl","preventDefault","addEventListener","body","stop","removeEventListener","FixLinks","children","ref","useRef","useEffect","divElem","_jsx","className","PathMatcher","tree","RootSegmentNode","loadMapping","mapping","addSegments","addPath","segments","node","l","segment","childNode","wildcard","VariableSegmentNode","join","WildcardSegmentNode","LiteralSegmentNode","match","matchedSegments","remainingSegments","ParentSegmentNode","_","paramName","BaseRouter","index","matcher","routes","route","useIndex","Router","prompt","observer","navigator","updateState","when","confirm","message","getTopRouter","setStickyParams","withObserver","NestedRouter","parent","isBasePathNested","childBasePath","ReactRouterContext","createContext","useRouterContext","ctx","useContext","useNavigate","useRouterBasePath","matchedRoutePath","router","useParams","arg","useLocation","usePageTitle","prev","useNavigationPrompt","topRouter","doBlock","returnValue","Nav","onClick","link","closest","rawHref","getAttribute","stopPropagation","NavLink","topLevelNav","clearBreadcrumbs","skipStickyParams","isAnchorOrEmpty","isExternal","test","isInternal","resolvedHref","defaultPrevented","RouteComponent","spinner","Component","LazyComponent","LazyRouteComponent","setComponent","useState","then","module","default","NestedNavigationContext","fixLinks","wrapWithFixLinks","Provider","actualBasePath","Route404Component","_jsxs","createRoute404","NestedRouterProvider","basePathRef","nestedRouter","useMemo","nestedRouteMatch","remainingPath","RouterProvider","onChange","setState","useSafeLayoutEffect"],"mappings":"sNAAO,MAAMA,EACTC,KACAC,OACAC,KACA,WAAAC,CAAYH,GACR,IAAII,EAAIJ,EAAKK,YAAY,KACrBD,GAAI,GACJE,KAAKJ,KAAOF,EAAKO,UAAUH,GA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F,gBAAgBJ,KAAK,OAC5DwF,cAAeD,EAAiBlF,kBAC1B,IAAIkF,EAAiBlF,kBAAkBL,KAAK,YAC5C5C,EACNb,SAAU,CAACH,EAAII,KACX,GAAI6I,EACA,OAAOA,EAAa9I,SAASH,EAAII,KAG1CmC,SAAUkG,EAAiBlG,GAAsBK,EAAKiF,EAAgB,CAAA,KACjF,CC5CO,SAASwB,GAAe7E,OAAEA,EAAMF,MAAEA,EAAKgF,SAAEA,EAAQ/G,SAAEA,IACtD,MAAOtE,EAAOsL,GAAYpB,OAASnH,GAC7BkF,EAASgD,EAAQ,KACnB,GAAsB,oBAAX1J,OACP,OAAO,KACX,MAAM0G,EAAS,IAAIvB,EAAOH,EAAST,IACjB,OAAVA,IACAA,EAAQ+E,KAEZS,EAAS,CACLvL,SAAUwB,OAAOxB,SACjByG,MAAOV,EAAMxH,MACbX,OAAQmI,EAAMnI,OACdqC,MAAO8F,EAAM9F,MACbiI,OAAQA,EACRD,iBAAkB,IAAIlC,EAAMC,gBAAgBJ,KAAK,OACjDwF,cAAerF,EAAME,kBAAoB,IAAIF,EAAME,kBAAkBL,KAAK,YAAS5C,EACnFb,SAAU,CAACH,EAAII,IACJ8F,EAAO/F,SAASH,EAAII,OAGpCiF,aAAaiE,GAEhB,OADApD,EAAO5B,MAAQA,EACR4B,GACR,CAAC5B,EAAOgF,EAAU9E,IAOrB,OANAgF,EAAoB,KAChBtD,GAAQ3E,QACD,KACH2E,GAAQ9D,SAEb,CAAC8D,IACIjI,GAAU2E,EAAK8C,EAAmBgD,SAAU,CAAEnM,MAAO0B,EAAOsE,SAAUA,GAAsBK,EAAKiF,EAAgB,CAAA,IAC7H"}
|
|
1
|
+
{"version":3,"file":"vertesia-ui-router.js","sources":["router/PathWithParams.js","router/path.js","router/HistoryNavigator.js","router/FixLinks.js","router/PathMatcher.js","router/Router.js","router/Nav.js","router/RouteComponent.js","router/NestedNavigationContext.js","router/Route404.js","router/NestedRouterProvider.js","router/RouterProvider.js"],"sourcesContent":["export class PathWithParams {\n path;\n params;\n hash;\n constructor(path) {\n let i = path.lastIndexOf('#');\n if (i > -1) {\n this.hash = path.substring(i);\n path = path.substring(0, i);\n }\n else {\n this.hash = '';\n }\n i = path.indexOf('?');\n if (i > -1) {\n this.path = path.substring(0, i);\n this.params = new URLSearchParams(path.substring(i + 1));\n }\n else {\n this.path = path;\n this.params = new URLSearchParams();\n }\n }\n add(params) {\n for (const [key, value] of Object.entries(params)) {\n this.params.set(key, value);\n }\n return this;\n }\n toString() {\n return `${this.path}?${this.params.toString()}${this.hash}`;\n }\n}\n//# sourceMappingURL=PathWithParams.js.map","export function isRootPath(path) {\n return path === '/' || path === '';\n}\nexport function joinPath(path1, path2) {\n if (path1.endsWith('/') && path2.startsWith('/')) {\n path2 = path1 + path2.substring(1);\n }\n else if (path1.endsWith('/')) {\n path2 = path1 + path2;\n }\n else if (path2.startsWith('/')) {\n path2 = path1 + path2;\n }\n else {\n path2 = `${path1}/${path2}`;\n }\n return path2;\n}\n/**\n * The mount base path from an explicit `<base href>` element, or `''` when there is none.\n *\n * Apps served under a deep gateway mount carry `<base href=\"/tenants/.../app/\">`, injected at serve\n * time. The router otherwise resolves absolute routes against the origin, which collapses the URL\n * off the mount (and breaks in-app links). This returns the base pathname without a trailing slash\n * so {@link withMountBasename} can keep navigation under the mount and {@link stripMountBasename}\n * can match routes app-relative. The Studio UI has no `<base>` element, so this returns `''` and\n * every caller becomes a no-op there.\n */\nexport function getMountBasename() {\n if (typeof document === 'undefined')\n return '';\n const base = document.querySelector('base[href]');\n if (!base)\n return '';\n try {\n return new URL(base.href, document.URL).pathname.replace(/\\/+$/, '');\n }\n catch {\n return '';\n }\n}\n/** Prepend the mount basename to an absolute app path (no-op when no mount, path is relative, or already prefixed). */\nexport function withMountBasename(path) {\n const base = getMountBasename();\n if (!base || !path.startsWith('/'))\n return path;\n if (path === base || path.startsWith(`${base}/`))\n return path;\n return joinPath(base, path);\n}\n/** Strip the mount basename from a browser path so route patterns match app-relative (no-op when no mount). */\nexport function stripMountBasename(path) {\n const base = getMountBasename();\n if (!base)\n return path;\n if (path === base)\n return '/';\n if (path.startsWith(`${base}/`))\n return path.slice(base.length) || '/';\n return path;\n}\nexport function getPathSegments(path) {\n if (path === '') {\n return [];\n }\n if (path === '/') {\n return [''];\n }\n let s = 0, e = path.length;\n if (path.startsWith('./')) {\n s = 2;\n }\n else if (path.startsWith('/')) {\n s = 1;\n }\n if (path.endsWith('/')) {\n e = path.length - 1;\n }\n return (s > 0 || e < path.length ? path.substring(s, e) : path).split('/');\n}\nexport function toSegments(path) {\n if (typeof path === 'string') {\n return getPathSegments(path);\n }\n else if (Array.isArray(path)) {\n return path;\n }\n else {\n throw new Error(`Unsupported path object: ${path}`);\n }\n}\n// export class Path {\n// static parse(path: string, abs = false) {\n// if (abs !== undefined) {\n// abs = path.startsWith('/');\n// }\n// return new Path(getPathSegments(path), abs);\n// }\n// constructor(public segments: string[], public isAbsolute = false) {\n// }\n// getParameters() {\n// const out = [];\n// for (const segment of this.segments) {\n// if (segment[0] === ':') {\n// out.push(segment.substring(1));\n// }\n// }\n// if (this.segments[this.segments.length - 1] === '*') {\n// out.push('_');\n// }\n// return out;\n// }\n// resolveParameters(path: string) {\n// const params: PathMatchParams = {};\n// const resolvedSegments = getPathSegments(path);\n// if (resolvedSegments.length < this.segments.length) {\n// return null;\n// }\n// const segments = this.segments;\n// for (let i = 0, l = segments.length; i < l; i++) {\n// const seg = segments[i];\n// if (seg[0] === ':') {\n// params[seg.substring(1)] = resolvedSegments[i];\n// }\n// }\n// if (resolvedSegments.length - this.segments.length) {\n// params._ = resolvedSegments.slice(this.segments.length);\n// }\n// return params;\n// }\n// match(path: string | string[] | Path) {\n// const segments = toSegments(path);\n// if (segments.length < this.segments.length) {\n// return false;\n// }\n// let params: PathMatchParams | undefined;\n// const mySegments = this.segments;\n// for (let i = 0, l = mySegments.length; i < l; i++) {\n// const segment = mySegments[i];\n// if (segment === ':') {\n// if (!params) params = {};\n// params[segment.substring(1)] = segment;\n// } else if (segment !== segments[i]) {\n// if (i === l - 1 && segment === '*') {\n// if (!params) params = {};\n// params._ = segments.slice(i);\n// return params;\n// }\n// return false;\n// }\n// }\n// return params ? params : false;\n// }\n// join(path: Path | string | string[]) {\n// const segments = toSegments(path);\n// return new Path(this.segments.concat(segments), this.isAbsolute);\n// }\n// getRelativePath(path: Path | string | string[], asAbsolute: boolean = false) {\n// const segments = toSegments(path);\n// const extraSegmentsCount = segments.length - this.segments.length;\n// if (extraSegmentsCount <= 0) {\n// return null;\n// }\n// return new Path(segments.slice(this.segments.length), asAbsolute);\n// }\n// prependSegments(segments: string[]) {\n// this.segments = segments.concat(this.segments);\n// }\n// appendSegments(segments: string[]) {\n// this.segments = this.segments.concat(segments);\n// }\n// toAbsolutePath() {\n// return '/' + this.segments.join('/');\n// }\n// toRelativePath() {\n// return this.segments.join('/');\n// }\n// toString() {\n// const path = this.segments.join('/');\n// return this.isAbsolute ? '/' + path : path;\n// }\n// }\n//# sourceMappingURL=path.js.map","import { PathWithParams } from './PathWithParams';\nimport { joinPath, withMountBasename } from './path';\nconst BASE_PATH = Symbol('BASE_PATH');\nexport { BASE_PATH };\nexport class LocationChangeEvent {\n name;\n type;\n location;\n state;\n _canceled = false;\n constructor(name, type, location, state) {\n this.name = name;\n this.type = type;\n this.location = location;\n this.state = state;\n }\n get isPageLoad() {\n return this.type === 'initial';\n }\n get isBackForward() {\n return this.type === 'popState';\n }\n get isLinkClick() {\n return this.type === 'linkClick';\n }\n get isNavigation() {\n return this.type === 'navigate';\n }\n get isCancelable() {\n return this.name === 'beforeChange';\n }\n cancel() {\n if (this.name === 'afterChange') {\n throw new Error('Cannot cancel afterChange event');\n }\n this._canceled = true;\n }\n}\nexport class BeforeLocationChangeEvent extends LocationChangeEvent {\n constructor(type, location, state) {\n super('beforeChange', type, location, state);\n }\n}\nexport class AfterLocationChangeEvent extends LocationChangeEvent {\n constructor(type, location, state) {\n super('afterChange', type, location, state);\n }\n}\nfunction getElementHrefAsUrl(elem) {\n if (elem && elem.tagName.toLowerCase() === 'a') {\n const href = elem?.href.trim();\n if (typeof href === 'string' && href.length > 0) {\n return new URL(href);\n }\n }\n return null;\n}\nexport class HistoryNavigator {\n // params to preserve in the query string when navigating\n stickyParams;\n _popStateListener;\n _linkNavListener;\n _listeners = [];\n addListener(listener) {\n this._listeners.push(listener);\n }\n fireLocationChange(event) {\n for (const listener of this._listeners) {\n listener(event);\n }\n }\n /**\n * Should be called when the page is first loaded.\n * It will fire a location change event with type `initial` and the current window.location as the location\n */\n firePageLoad() {\n this.fireLocationChange(new AfterLocationChangeEvent('initial', new URL(window.location.href)));\n }\n addStickyParams(path) {\n if (this.stickyParams) {\n return new PathWithParams(path).add(this.stickyParams).toString();\n }\n return path;\n }\n /**\n * Rewrite the current browser URL in place so that the sticky params are present, without\n * navigating. Used on load / when the params first become known so the address bar reflects\n * the active account/project before the first navigation.\n *\n * Idempotent and side-effect-light: only calls replaceState when the URL would actually\n * change, preserves the existing history state, and never fires a location-change event\n * (so there is no route re-match or component remount).\n */\n normalizeCurrentUrl() {\n if (typeof window === 'undefined' || !this.stickyParams) {\n return;\n }\n const current = window.location.pathname + window.location.search + window.location.hash;\n const normalized = this.addStickyParams(current);\n if (normalized !== current) {\n const to = new URL(normalized, window.location.href);\n window.history.replaceState(window.history.state, '', to.href);\n }\n }\n navigate(to, options = {}) {\n if (options.stepsBack && options.stepsBack > 0) {\n this.stepBack(options.stepsBack, options);\n return;\n }\n if (options.basePath) {\n let basePath = options.basePath;\n if (!basePath.startsWith('/')) {\n basePath = `/${basePath}`;\n }\n to = joinPath(basePath, to);\n }\n to = this.addStickyParams(to);\n // Keep absolute app routes under the served `<base href>` mount instead of resolving them\n // against the bare origin (which collapses the URL off the mount). No-op when origin-served.\n to = withMountBasename(to);\n this._navigate(new URL(to, window.location.href), 'navigate', options);\n }\n stepBack(steps, options = {}) {\n const historyChain = window.history.state.historyChain || [];\n const to = historyChain.length >= steps\n ? new URL(historyChain[historyChain.length - steps].href, window.location.href)\n : new URL(window.location.origin, window.location.href);\n this._navigate(to, 'popState', options);\n const stateToStore = {\n from: window.location.href,\n historyChain: historyChain.slice(0, -steps),\n data: options.state || undefined,\n title: options.title || document.title,\n };\n window.history.replaceState(stateToStore, '', to.href);\n this.fireLocationChange(new AfterLocationChangeEvent('popState', to, options.state));\n }\n _navigate(to, type, options) {\n const beforeEvent = new BeforeLocationChangeEvent(type, to, options.state);\n this.fireLocationChange(beforeEvent);\n if (beforeEvent._canceled) {\n return;\n }\n // Build navigation chain by preserving previous history\n const currentState = window.history.state;\n const currentTitle = options.title || document.title;\n // Create new history chain entry\n const newChainEntry = {\n title: currentTitle,\n href: window.location.pathname + window.location.search + window.location.hash,\n };\n // Build the history chain - clear if using replace\n let historyChain = [];\n if (!options.replace && currentState?.historyChain) {\n historyChain = [...currentState.historyChain];\n }\n // Only add to chain if not replacing\n if (!options.replace) {\n historyChain.push(newChainEntry);\n // Limit chain length to prevent memory issues (keep last 10 entries)\n if (historyChain.length > 10) {\n historyChain = historyChain.slice(-10);\n }\n }\n const stateToStore = {\n from: window.location.href,\n historyChain: historyChain,\n data: options.state || undefined,\n title: options.title || document.title,\n };\n window.history[options.replace ? 'replaceState' : 'pushState'](stateToStore, '', to.href);\n this.fireLocationChange(new AfterLocationChangeEvent(type, to, options.state));\n }\n start() {\n if (typeof window === 'undefined') {\n return;\n }\n const _popStateListener = (ev) => {\n let type;\n const to = new URL(window.location.href);\n let state;\n if (ev.state) {\n type = 'popState';\n state = ev.state.data;\n }\n else {\n type = 'linkClick';\n }\n this.fireLocationChange(new AfterLocationChangeEvent(type, to, state));\n };\n const _linkNavListener = (ev) => {\n const target = ev.target;\n // Skip anchors with download attribute or blob: URLs - they are file downloads, not navigation\n if (target.tagName.toLowerCase() === 'a' &&\n (target.hasAttribute('download') ||\n target.href?.startsWith('blob:'))) {\n return;\n }\n const url = getElementHrefAsUrl(target);\n if (url && url.origin === window.location.origin) {\n ev.preventDefault();\n const to = new URL(this.addStickyParams(url.href));\n const basePath = ev[BASE_PATH] ||\n ev.target[BASE_PATH];\n if (basePath) {\n to.pathname = joinPath(basePath, to.pathname);\n }\n this._navigate(to, 'linkClick', {});\n }\n };\n this._popStateListener = _popStateListener;\n this._linkNavListener = _linkNavListener;\n window.addEventListener('popstate', _popStateListener);\n document.body.addEventListener('click', this._linkNavListener);\n }\n stop() {\n if (this._popStateListener)\n window.removeEventListener('popstate', this._popStateListener);\n if (this._linkNavListener)\n document.body.removeEventListener('click', this._linkNavListener);\n }\n}\n//# sourceMappingURL=HistoryNavigator.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useRef } from 'react';\nimport { BASE_PATH } from './HistoryNavigator';\nexport function FixLinks({ basePath, children }) {\n const ref = useRef(null);\n useEffect(() => {\n if (ref.current) {\n const divElem = ref.current;\n const listener = (ev) => {\n const elem = ev.target;\n if (elem.tagName.toLowerCase() === 'a') {\n ev[BASE_PATH] = basePath;\n }\n };\n divElem.addEventListener('click', listener);\n return () => {\n divElem.removeEventListener('click', listener);\n };\n }\n }, [basePath]);\n return (_jsx(\"div\", { ref: ref, className: \"h-full w-full\", children: children }));\n}\n//# sourceMappingURL=FixLinks.js.map","import { getPathSegments, toSegments } from './path';\n/**\n * Path matcher which support :param and *wildcard segments.\n * The wildcard segment is only supported as the last segment\n */\nexport class PathMatcher {\n tree = new RootSegmentNode();\n loadMapping(mapping) {\n for (const [key, value] of Object.entries(mapping)) {\n this.addSegments(getPathSegments(key), value);\n }\n }\n addPath(path, value) {\n this.addSegments(getPathSegments(path), value);\n }\n addSegments(segments, value) {\n let node = this.tree;\n for (let i = 0, l = segments.length; i < l; i++) {\n const segment = segments[i];\n if (segment[0] === ':') {\n let childNode = node.wildcard;\n if (!childNode) {\n childNode = new VariableSegmentNode(segment);\n node.wildcard = childNode;\n }\n else if (!(childNode instanceof VariableSegmentNode)) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard \":\" segment will overwrite an existing wildcard segment at path: ${`/${segments.slice(0, i).join('/')}`}`);\n }\n node = childNode;\n }\n else if (segment === '*') {\n if (node.wildcard) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard \"*\" segment already exists at path: ${`/${segments.slice(0, i).join('/')}`}`);\n }\n node.wildcard = new WildcardSegmentNode(segment, value);\n if (i < l - 1) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A wildcard segment must be the last segment`);\n }\n return;\n }\n else {\n let childNode = node.children[segment];\n if (!childNode) {\n childNode = new LiteralSegmentNode(segment);\n node.children[segment] = childNode;\n } // else // a literal segment already exists\n node = childNode;\n }\n }\n if (node.value !== undefined) {\n throw new Error(`Failed to index path segments: ${segments.join('/')}. A value already exists at path: ${`/${segments.join('/')}`}`);\n }\n node.value = value;\n }\n match(path) {\n const segments = toSegments(path);\n if (segments.length === 0) {\n return null;\n }\n const params = {};\n let node = this.tree;\n for (const segment of segments) {\n const match = node.match(segment, params);\n if (match) {\n node = match;\n }\n else {\n return null;\n }\n }\n if (!node.value) {\n // not a leaf node (partial match)\n if (node instanceof ParentSegmentNode) {\n if (node.wildcard instanceof WildcardSegmentNode) {\n node = node.wildcard.match('', params);\n if (!node.value) {\n throw new Error('Wildcard segment node `*` must have a value');\n }\n }\n }\n if (!node.value)\n return null; // not a leaf node, neither a trailing wildcard (partial match)\n }\n let matchedSegments, remainingSegments;\n if (params._ && params._.length > 0) {\n matchedSegments = segments.slice(0, -params._.length);\n remainingSegments = params._;\n }\n else {\n matchedSegments = segments;\n }\n return { params, matchedSegments, remainingSegments, value: node.value };\n }\n}\nclass ParentSegmentNode {\n name;\n value;\n children = {};\n wildcard;\n constructor(name, value) {\n this.name = name;\n this.value = value;\n }\n match(segment, params) {\n const node = this.children[segment];\n if (node) {\n return node;\n }\n else if (this.wildcard) {\n if (this.wildcard instanceof WildcardSegmentNode) {\n return this.wildcard.match(segment, params);\n }\n else if (this.wildcard instanceof VariableSegmentNode) {\n params[this.wildcard.paramName] = segment;\n return this.wildcard;\n }\n else {\n throw new Error(`Unknown wildcard segment node type: ${this.wildcard.constructor.name}`);\n }\n }\n else {\n return null;\n }\n }\n}\nclass RootSegmentNode extends ParentSegmentNode {\n constructor() {\n super('#root');\n }\n}\nclass LiteralSegmentNode extends ParentSegmentNode {\n}\nclass VariableSegmentNode extends ParentSegmentNode {\n paramName;\n constructor(name, value) {\n super(name, value);\n this.paramName = name.substring(1);\n }\n}\nclass WildcardSegmentNode {\n name;\n value;\n constructor(name, value) {\n this.name = name;\n this.value = value;\n }\n match(segment, params) {\n if (!params._) {\n params._ = segment ? [segment] : [];\n }\n else {\n if (segment)\n params._.push(segment);\n }\n return this;\n }\n}\n//# sourceMappingURL=PathMatcher.js.map","import { createContext, useContext, useEffect } from 'react';\nimport { HistoryNavigator } from './HistoryNavigator';\nimport { PathMatcher } from './PathMatcher';\nimport { isRootPath, joinPath, stripMountBasename } from './path';\nexport class BaseRouter {\n // the path to use when navigating to the root of the router\n index;\n matcher = new PathMatcher();\n constructor(routes, index) {\n this.index = index;\n for (const route of routes) {\n this.matcher.addPath(route.path, route);\n }\n }\n match(path) {\n const useIndex = isRootPath(path) && this.index;\n // biome-ignore lint/style/noNonNullAssertion: intentional non-null assertion; TS can't prove narrowing here\n return this.matcher.match(useIndex ? this.index : path);\n }\n}\nexport class Router extends BaseRouter {\n prompt;\n observer;\n navigator = new HistoryNavigator();\n constructor(routes, updateState) {\n super(routes);\n this.navigator.addListener((event) => {\n if (event.isCancelable && this.prompt?.when) {\n if (!window.confirm(this.prompt.message))\n return;\n }\n if (this.observer) {\n this.observer(event);\n }\n // only process afterChange events\n if (event.name === 'afterChange') {\n // Match app-relative: strip the served `<base href>` mount prefix (no-op when origin-served).\n const match = this.match(stripMountBasename(event.location.pathname));\n if (match?.value) {\n updateState({\n ...match,\n state: event.state,\n });\n }\n else {\n updateState(null);\n }\n }\n });\n }\n getTopRouter() {\n return this;\n }\n /**\n * Subsequent navigations will preserve the given params in the query string.\n * Use null to clear the sticky params.\n * @param params\n */\n setStickyParams(params) {\n this.navigator.stickyParams = params != null ? params : undefined;\n // Reflect the params in the current URL immediately, so the address bar is correct on\n // load (not only after the first navigation).\n this.navigator.normalizeCurrentUrl();\n }\n withObserver(observer) {\n this.observer = observer;\n return this;\n }\n start() {\n this.navigator.start();\n // initialize with the current location\n this.navigator.firePageLoad();\n }\n stop() {\n this.navigator.stop();\n }\n navigate(path, options) {\n this.navigator.navigate(path, options);\n }\n}\nexport class NestedRouter extends BaseRouter {\n parent;\n basePath;\n constructor(parent, basePath, routes) {\n super(routes);\n this.parent = parent;\n this.basePath = basePath;\n }\n getTopRouter() {\n if (this.parent instanceof Router) {\n return this.parent;\n }\n else {\n return this.parent.getTopRouter();\n }\n }\n navigate(path, options) {\n // base path is nested by default in a NestedRouter unless explicitly set to false by caller\n const isBasePathNested = options?.isBasePathNested ?? true;\n let basePath;\n if (isBasePathNested) {\n const childBasePath = options?.basePath;\n // e.g. \"/store\" + \"/objects/123\" => \"/store/objects/123\"\n basePath = childBasePath ? joinPath(this.basePath, childBasePath) : this.basePath;\n this.parent.navigate(path, {\n ...options,\n basePath,\n });\n }\n else {\n // isBasePathNested === false: navigate to an absolute path without adding this router's basePath\n // Pass through to parent without adding our basePath prefix\n this.parent.navigate(path, {\n ...options,\n basePath: options?.basePath,\n });\n }\n }\n}\nconst ReactRouterContext = createContext(undefined);\nexport { ReactRouterContext };\nexport function useRouterContext() {\n const ctx = useContext(ReactRouterContext);\n if (!ctx) {\n throw new Error('useRouter must be used within a RouterProvider');\n }\n return ctx;\n}\nexport function useNavigate() {\n const { navigate } = useRouterContext();\n return navigate;\n}\nexport function useRouterBasePath() {\n const { matchedRoutePath, router } = useRouterContext();\n return router instanceof NestedRouter ? router.basePath : matchedRoutePath;\n}\nexport function useParams(arg) {\n const { params } = useRouterContext();\n if (arg) {\n return params[arg];\n }\n else {\n return params;\n }\n}\nexport function useLocation() {\n const { location } = useRouterContext();\n return location;\n}\nexport function usePageTitle(title) {\n useEffect(() => {\n const prev = document.title;\n document.title = title;\n return () => {\n document.title = prev;\n };\n }, [title]);\n}\nexport function useNavigationPrompt(prompt) {\n const { router } = useRouterContext();\n const topRouter = router.getTopRouter();\n useEffect(() => {\n topRouter.prompt = prompt;\n return () => {\n topRouter.prompt = undefined;\n };\n }, [prompt, topRouter]);\n useEffect(() => {\n if (prompt.when) {\n const doBlock = prompt.when;\n const listener = (ev) => {\n if (doBlock) {\n ev.preventDefault();\n ev.returnValue = '';\n }\n };\n window.addEventListener('beforeunload', listener);\n return () => {\n window.removeEventListener('beforeunload', listener);\n };\n }\n }, [prompt.when]);\n}\n//# sourceMappingURL=Router.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { withMountBasename } from './path';\nimport { useNavigate, useRouterContext } from './Router';\nexport function Nav({ children, to, onClick, replace = true }) {\n const navigate = useNavigate();\n const _onClick = (ev) => {\n const link = ev.target.closest('a');\n const rawHref = link?.getAttribute('href');\n const target = to ?? rawHref;\n if (link && target) {\n ev.stopPropagation();\n ev.preventDefault();\n navigate(target, { replace });\n onClick?.(ev);\n }\n };\n return (_jsx(\"span\", { onClick: _onClick, children: children }));\n}\nexport function NavLink({ children, href, className, target, topLevelNav, clearBreadcrumbs = false, replace, skipStickyParams, }) {\n const { router } = useRouterContext();\n // In-app route = not an external URL, `_blank` target, or bare hash. Relative paths count too —\n // they must be routed, else the global link listener re-applies the module base path (wrong URL).\n const isAnchorOrEmpty = !href || href.startsWith('#');\n const isExternal = /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith('//') || (!!target && target !== '_self');\n const isInternal = !isAnchorOrEmpty && !isExternal;\n // Keep the rendered href under the served `<base href>` mount (correct middle-click / hover /\n // open-in-new-tab); the onClick navigates via the router which applies the same rule. No-op when\n // origin-served (Studio UI). Click handler below passes the raw `href` — navigate() re-bases it.\n const resolvedHref = isInternal\n ? withMountBasename(!skipStickyParams ? router.getTopRouter().navigator.addStickyParams(href) : href)\n : href;\n const _onClick = (ev) => {\n if (ev.defaultPrevented || !isInternal) {\n return;\n }\n ev.stopPropagation();\n ev.preventDefault();\n const actualRouter = topLevelNav ? router.getTopRouter() : router;\n actualRouter.navigate(href, { replace: replace ?? clearBreadcrumbs });\n };\n return (_jsx(\"a\", { href: resolvedHref, className: className, target: target, onClick: _onClick, children: children }));\n}\n//# sourceMappingURL=Nav.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useState } from 'react';\nimport { useRouterContext } from './Router';\nexport function RouteComponent({ spinner }) {\n const ctx = useRouterContext();\n const route = ctx.route;\n if (route.Component) {\n const Component = route.Component;\n return _jsx(Component, { ...ctx.params });\n }\n else if (route.LazyComponent) {\n return _jsx(LazyRouteComponent, { route: route, spinner: spinner });\n }\n else {\n throw new Error(`Invalid route for ${route.path}. Either Component or LazyCOmponent must be specified.`);\n }\n}\nfunction LazyRouteComponent({ route, spinner }) {\n const [Component, setComponent] = useState(null);\n useEffect(() => {\n void route.LazyComponent().then((module) => {\n if (!module.default) {\n throw new Error(`Lazy module for ${route.path} does not have a default export`);\n }\n // we need to wrap the component type in an arrow function\n // otherwise the setState function will execute the function as a state update function\n setComponent(() => module.default);\n });\n }, [route]);\n return Component ? _jsx(Component, {}) : spinner || null;\n}\n//# sourceMappingURL=RouteComponent.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { FixLinks } from './FixLinks';\nimport { joinPath } from './path';\nimport { RouteComponent } from './RouteComponent';\nimport { ReactRouterContext, useRouterContext } from './Router';\nexport function NestedNavigationContext({ basePath, fixLinks = false, children }) {\n const ctx = useRouterContext();\n const wrapWithFixLinks = fixLinks\n ? (elem) => _jsx(FixLinks, { basePath: ctx.matchedRoutePath, children: elem })\n : (elem) => elem;\n return (_jsx(ReactRouterContext.Provider, { value: {\n ...ctx,\n navigate: (to, options) => {\n if (options?.isBasePathNested === false) {\n // Navigate to an absolute path without adding this context's basePath\n return ctx.navigate(to, options);\n }\n const actualBasePath = options?.basePath ? joinPath(basePath, options.basePath) : basePath;\n return ctx.navigate(to, { ...options, basePath: actualBasePath });\n },\n }, children: wrapWithFixLinks(children ? children : _jsx(RouteComponent, {})) }));\n}\n//# sourceMappingURL=NestedNavigationContext.js.map","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport { useRouterContext } from './Router';\nexport function Route404Component() {\n const ctx = useRouterContext();\n return _jsxs(\"div\", { children: [\"Route not found for path \", ctx.matchedRoutePath] });\n}\nexport function createRoute404() {\n return {\n params: {},\n matchedSegments: [],\n state: null,\n value: {\n path: 'virtual:404',\n Component: () => _jsx(Route404Component, {}),\n },\n };\n}\n//# sourceMappingURL=Route404.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useMemo, useRef } from 'react';\nimport { FixLinks } from './FixLinks';\nimport { createRoute404 } from './Route404';\nimport { RouteComponent } from './RouteComponent';\nimport { NestedRouter, ReactRouterContext, useRouterContext } from './Router';\nexport function NestedRouterProvider({ routes, index, children, fixLinks = false }) {\n const ctx = useRouterContext();\n // Capture basePath once at mount. When the parent router switches to a different\n // top-level route (e.g. /store -> /studio), the lazy loader briefly keeps rendering\n // this (now-stale) module with a new ctx. Keeping basePath stable lets the\n // ctx.matchedRoutePath !== nestedRouter.basePath check below detect the mismatch and\n // skip rendering instead of running match() against the wrong route table.\n const basePathRef = useRef(ctx.matchedRoutePath);\n const nestedRouter = useMemo(() => {\n if (typeof window === 'undefined')\n return null;\n const nestedRouter = new NestedRouter(ctx.router, basePathRef.current, routes);\n nestedRouter.index = index;\n return nestedRouter;\n }, [ctx.router, index, routes]);\n const nestedRouteMatch = useMemo(() => {\n if (!nestedRouter) {\n return undefined;\n }\n if (ctx.matchedRoutePath !== nestedRouter.basePath) {\n // The change belongs to another router level and will be handled there.\n return undefined;\n }\n return nestedRouter.match(ctx.remainingPath || '/') || createRoute404();\n }, [ctx.matchedRoutePath, ctx.remainingPath, nestedRouter]);\n const wrapWithFixLinks = fixLinks\n ? (elem) => _jsx(FixLinks, { basePath: ctx.matchedRoutePath, children: elem })\n : (elem) => elem;\n return (nestedRouteMatch && (_jsx(ReactRouterContext.Provider, { value: {\n ...ctx,\n // biome-ignore lint/style/noNonNullAssertion: intentional non-null assertion; TS can't prove narrowing here\n router: nestedRouter,\n route: nestedRouteMatch.value,\n params: nestedRouteMatch.params,\n matchedRoutePath: `/${nestedRouteMatch.matchedSegments.join('/')}`,\n remainingPath: nestedRouteMatch.remainingSegments\n ? `/${nestedRouteMatch.remainingSegments.join('/')}`\n : undefined,\n navigate: (to, options) => {\n if (nestedRouter) {\n return nestedRouter.navigate(to, options);\n }\n },\n }, children: wrapWithFixLinks(children ? children : _jsx(RouteComponent, {})) })));\n}\n//# sourceMappingURL=NestedRouterProvider.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useSafeLayoutEffect } from '@vertesia/ui/core';\nimport { useMemo, useState } from 'react';\nimport { createRoute404 } from './Route404';\nimport { RouteComponent } from './RouteComponent';\nimport { ReactRouterContext, Router } from './Router';\nexport function RouterProvider({ routes, index, onChange, children }) {\n const [state, setState] = useState(undefined);\n const router = useMemo(() => {\n if (typeof window === 'undefined')\n return null;\n const router = new Router(routes, (match) => {\n if (match === null) {\n match = createRoute404();\n }\n setState({\n location: window.location,\n route: match.value,\n params: match.params,\n state: match.state,\n router: router,\n matchedRoutePath: `/${match.matchedSegments.join('/')}`,\n remainingPath: match.remainingSegments ? `/${match.remainingSegments.join('/')}` : undefined,\n navigate: (to, options) => {\n return router.navigate(to, options);\n },\n });\n }).withObserver(onChange);\n router.index = index;\n return router;\n }, [index, onChange, routes]);\n useSafeLayoutEffect(() => {\n router?.start();\n return () => {\n router?.stop();\n };\n }, [router]);\n return (state && (_jsx(ReactRouterContext.Provider, { value: state, children: children ? children : _jsx(RouteComponent, {}) })));\n}\n//# sourceMappingURL=RouterProvider.js.map"],"names":["PathWithParams","path","params","hash","constructor","i","lastIndexOf","this","substring","indexOf","URLSearchParams","add","key","value","Object","entries","set","toString","isRootPath","joinPath","path1","path2","endsWith","startsWith","getMountBasename","document","base","querySelector","URL","href","pathname","replace","withMountBasename","stripMountBasename","slice","length","getPathSegments","s","e","split","toSegments","Array","isArray","Error","BASE_PATH","Symbol","LocationChangeEvent","name","type","location","state","_canceled","isPageLoad","isBackForward","isLinkClick","isNavigation","isCancelable","cancel","BeforeLocationChangeEvent","super","AfterLocationChangeEvent","HistoryNavigator","stickyParams","_popStateListener","_linkNavListener","_listeners","addListener","listener","push","fireLocationChange","event","firePageLoad","window","addStickyParams","normalizeCurrentUrl","current","search","normalized","to","history","replaceState","navigate","options","stepsBack","stepBack","basePath","_navigate","steps","historyChain","origin","stateToStore","from","data","undefined","title","beforeEvent","currentState","newChainEntry","start","ev","target","tagName","toLowerCase","hasAttribute","url","elem","trim","getElementHrefAsUrl","preventDefault","addEventListener","body","stop","removeEventListener","FixLinks","children","ref","useRef","useEffect","divElem","_jsx","className","PathMatcher","tree","RootSegmentNode","loadMapping","mapping","addSegments","addPath","segments","node","l","segment","childNode","wildcard","VariableSegmentNode","join","WildcardSegmentNode","LiteralSegmentNode","match","matchedSegments","remainingSegments","ParentSegmentNode","_","paramName","BaseRouter","index","matcher","routes","route","useIndex","Router","prompt","observer","navigator","updateState","when","confirm","message","getTopRouter","setStickyParams","withObserver","NestedRouter","parent","isBasePathNested","childBasePath","ReactRouterContext","createContext","useRouterContext","ctx","useContext","useNavigate","useRouterBasePath","matchedRoutePath","router","useParams","arg","useLocation","usePageTitle","prev","useNavigationPrompt","topRouter","doBlock","returnValue","Nav","onClick","link","closest","rawHref","getAttribute","stopPropagation","NavLink","topLevelNav","clearBreadcrumbs","skipStickyParams","isAnchorOrEmpty","isExternal","test","isInternal","resolvedHref","defaultPrevented","RouteComponent","spinner","Component","LazyComponent","LazyRouteComponent","setComponent","useState","then","module","default","NestedNavigationContext","fixLinks","wrapWithFixLinks","Provider","actualBasePath","Route404Component","_jsxs","createRoute404","NestedRouterProvider","basePathRef","nestedRouter","useMemo","nestedRouteMatch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XrJ,OACP,OAAO,KACX,MAAMqG,EAAS,IAAIvB,EAAOH,EAAST,IACjB,OAAVA,IACAA,EAAQ+E,KAEZS,EAAS,CACLjL,SAAUuB,OAAOvB,SACjBmG,MAAOV,EAAM7H,MACbX,OAAQwI,EAAMxI,OACdgD,MAAOwF,EAAMxF,MACb2H,OAAQA,EACRD,iBAAkB,IAAIlC,EAAMC,gBAAgBJ,KAAK,OACjDwF,cAAerF,EAAME,kBAAoB,IAAIF,EAAME,kBAAkBL,KAAK,YAAS1C,EACnFZ,SAAU,CAACH,EAAII,IACJ2F,EAAO5F,SAASH,EAAII,OAGpC8E,aAAaiE,GAEhB,OADApD,EAAO5B,MAAQA,EACR4B,GACR,CAAC5B,EAAOgF,EAAU9E,IAOrB,OANAgF,EAAoB,KAChBtD,GAAQ3E,QACD,KACH2E,GAAQ9D,SAEb,CAAC8D,IACI3H,GAAUqE,EAAK8C,EAAmBgD,SAAU,CAAExM,MAAOqC,EAAOgE,SAAUA,GAAsBK,EAAKiF,EAAgB,CAAA,IAC7H"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/ui",
|
|
3
|
-
"version": "1.3.0-dev.20260620.
|
|
3
|
+
"version": "1.3.0-dev.20260620.091720Z",
|
|
4
4
|
"description": "Vertesia UI components and and hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -90,10 +90,10 @@
|
|
|
90
90
|
"vega": "^6.2.0",
|
|
91
91
|
"vega-embed": "^7.1.0",
|
|
92
92
|
"vega-lite": "^6.4.3",
|
|
93
|
-
"@vertesia/
|
|
94
|
-
"@vertesia/
|
|
95
|
-
"@vertesia/json": "1.3.0-dev.20260620.
|
|
96
|
-
"@vertesia/
|
|
93
|
+
"@vertesia/client": "1.3.0-dev.20260620.091720Z",
|
|
94
|
+
"@vertesia/common": "1.3.0-dev.20260620.091720Z",
|
|
95
|
+
"@vertesia/json": "1.3.0-dev.20260620.091720Z",
|
|
96
|
+
"@vertesia/fusion-ux": "1.3.0-dev.20260620.091720Z"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"url": "https://github.com/vertesia/composableai.git",
|
|
186
186
|
"directory": "packages/ui"
|
|
187
187
|
},
|
|
188
|
-
"gitHead": "
|
|
188
|
+
"gitHead": "1a76be81111643b66a7b11be9f328d159f1de4fc",
|
|
189
189
|
"scripts": {
|
|
190
190
|
"build": "rm -rf ./lib ./tsconfig.tsbuildinfo && tsc --build && pnpm exec rollup -c",
|
|
191
191
|
"lint": "biome lint src && pnpm run check:rtl-classes",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PathWithParams } from './PathWithParams';
|
|
2
|
-
import { joinPath } from './path';
|
|
2
|
+
import { joinPath, withMountBasename } from './path';
|
|
3
3
|
|
|
4
4
|
const BASE_PATH = Symbol('BASE_PATH');
|
|
5
5
|
|
|
@@ -149,6 +149,9 @@ export class HistoryNavigator {
|
|
|
149
149
|
to = joinPath(basePath, to);
|
|
150
150
|
}
|
|
151
151
|
to = this.addStickyParams(to);
|
|
152
|
+
// Keep absolute app routes under the served `<base href>` mount instead of resolving them
|
|
153
|
+
// against the bare origin (which collapses the URL off the mount). No-op when origin-served.
|
|
154
|
+
to = withMountBasename(to);
|
|
152
155
|
this._navigate(new URL(to, window.location.href), 'navigate', options);
|
|
153
156
|
}
|
|
154
157
|
|
package/src/router/Nav.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SyntheticEvent } from 'react';
|
|
2
|
+
import { withMountBasename } from './path';
|
|
2
3
|
import { useNavigate, useRouterContext } from './Router';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -75,7 +76,12 @@ export function NavLink({
|
|
|
75
76
|
const isAnchorOrEmpty = !href || href.startsWith('#');
|
|
76
77
|
const isExternal = /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith('//') || (!!target && target !== '_self');
|
|
77
78
|
const isInternal = !isAnchorOrEmpty && !isExternal;
|
|
78
|
-
|
|
79
|
+
// Keep the rendered href under the served `<base href>` mount (correct middle-click / hover /
|
|
80
|
+
// open-in-new-tab); the onClick navigates via the router which applies the same rule. No-op when
|
|
81
|
+
// origin-served (Studio UI). Click handler below passes the raw `href` — navigate() re-bases it.
|
|
82
|
+
const resolvedHref = isInternal
|
|
83
|
+
? withMountBasename(!skipStickyParams ? router.getTopRouter().navigator.addStickyParams(href) : href)
|
|
84
|
+
: href;
|
|
79
85
|
const _onClick = (ev: SyntheticEvent) => {
|
|
80
86
|
if (ev.defaultPrevented || !isInternal) {
|
|
81
87
|
return;
|
package/src/router/Router.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext, useContext, useEffect } from 'react';
|
|
2
2
|
import { HistoryNavigator, type LocationChangeEvent, type NavigateOptions } from './HistoryNavigator';
|
|
3
3
|
import { type PathMatch, PathMatcher } from './PathMatcher';
|
|
4
|
-
import { isRootPath, joinPath, type PathMatchParams } from './path';
|
|
4
|
+
import { isRootPath, joinPath, type PathMatchParams, stripMountBasename } from './path';
|
|
5
5
|
|
|
6
6
|
export type RouteComponentProps = PathMatchParams;
|
|
7
7
|
export type LazyRouteModule = { default: React.ComponentType<Record<string, never>> };
|
|
@@ -62,7 +62,8 @@ export class Router extends BaseRouter {
|
|
|
62
62
|
}
|
|
63
63
|
// only process afterChange events
|
|
64
64
|
if (event.name === 'afterChange') {
|
|
65
|
-
|
|
65
|
+
// Match app-relative: strip the served `<base href>` mount prefix (no-op when origin-served).
|
|
66
|
+
const match = this.match(stripMountBasename(event.location.pathname));
|
|
66
67
|
if (match?.value) {
|
|
67
68
|
updateState({
|
|
68
69
|
...match,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
2
|
+
import { getMountBasename, joinPath, stripMountBasename, withMountBasename } from './path';
|
|
3
|
+
|
|
4
|
+
// Simulate a served `<base href>` (or its absence) by stubbing document.querySelector + document.URL.
|
|
5
|
+
function setBaseHref(href: string | null, docUrl = 'https://gw.example.com/x') {
|
|
6
|
+
(globalThis as { document?: unknown }).document = {
|
|
7
|
+
URL: docUrl,
|
|
8
|
+
querySelector: (sel: string) =>
|
|
9
|
+
sel === 'base[href]' && href ? ({ href: new URL(href, docUrl).href } as unknown) : null,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const MOUNT = '/tenants/05948c_5ed5f4/apps/furniture-catalog/versions/20260620T064257113Z/app';
|
|
14
|
+
|
|
15
|
+
describe('mount basename helpers', () => {
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
delete (globalThis as { document?: unknown }).document;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe('getMountBasename', () => {
|
|
21
|
+
it('returns the base path (no trailing slash) when a deep <base href> is present', () => {
|
|
22
|
+
setBaseHref(`${MOUNT}/`);
|
|
23
|
+
expect(getMountBasename()).toBe(MOUNT);
|
|
24
|
+
});
|
|
25
|
+
it('returns "" for the Studio UI (no <base> element)', () => {
|
|
26
|
+
setBaseHref(null);
|
|
27
|
+
expect(getMountBasename()).toBe('');
|
|
28
|
+
});
|
|
29
|
+
it('returns "" for a root <base href="/">', () => {
|
|
30
|
+
setBaseHref('/');
|
|
31
|
+
expect(getMountBasename()).toBe('');
|
|
32
|
+
});
|
|
33
|
+
it('returns "" when there is no document (SSR)', () => {
|
|
34
|
+
delete (globalThis as { document?: unknown }).document;
|
|
35
|
+
expect(getMountBasename()).toBe('');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe('withMountBasename (navigate side)', () => {
|
|
40
|
+
it('prepends the mount to an absolute app route', () => {
|
|
41
|
+
setBaseHref(`${MOUNT}/`);
|
|
42
|
+
expect(withMountBasename('/assistant')).toBe(`${MOUNT}/assistant`);
|
|
43
|
+
expect(withMountBasename('/')).toBe(`${MOUNT}/`);
|
|
44
|
+
});
|
|
45
|
+
it('does not double-prepend a path already under the mount', () => {
|
|
46
|
+
setBaseHref(`${MOUNT}/`);
|
|
47
|
+
expect(withMountBasename(`${MOUNT}/items/5`)).toBe(`${MOUNT}/items/5`);
|
|
48
|
+
expect(withMountBasename(MOUNT)).toBe(MOUNT);
|
|
49
|
+
});
|
|
50
|
+
it('leaves relative paths untouched', () => {
|
|
51
|
+
setBaseHref(`${MOUNT}/`);
|
|
52
|
+
expect(withMountBasename('assistant')).toBe('assistant');
|
|
53
|
+
});
|
|
54
|
+
it('is a no-op for the Studio UI (no mount)', () => {
|
|
55
|
+
setBaseHref(null);
|
|
56
|
+
expect(withMountBasename('/assistant')).toBe('/assistant');
|
|
57
|
+
expect(withMountBasename('/')).toBe('/');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe('stripMountBasename (match side)', () => {
|
|
62
|
+
it('strips the mount so route patterns match app-relative', () => {
|
|
63
|
+
setBaseHref(`${MOUNT}/`);
|
|
64
|
+
expect(stripMountBasename(`${MOUNT}/assistant`)).toBe('/assistant');
|
|
65
|
+
expect(stripMountBasename(MOUNT)).toBe('/');
|
|
66
|
+
expect(stripMountBasename(`${MOUNT}/`)).toBe('/');
|
|
67
|
+
});
|
|
68
|
+
it('leaves a path not under the mount untouched', () => {
|
|
69
|
+
setBaseHref(`${MOUNT}/`);
|
|
70
|
+
expect(stripMountBasename('/somewhere-else')).toBe('/somewhere-else');
|
|
71
|
+
});
|
|
72
|
+
it('is a no-op for the Studio UI (no mount)', () => {
|
|
73
|
+
setBaseHref(null);
|
|
74
|
+
expect(stripMountBasename('/agents/123')).toBe('/agents/123');
|
|
75
|
+
expect(stripMountBasename('/')).toBe('/');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('round-trips: strip(with(route)) === route under a mount', () => {
|
|
80
|
+
setBaseHref(`${MOUNT}/`);
|
|
81
|
+
for (const route of ['/', '/assistant', '/items/5']) {
|
|
82
|
+
expect(stripMountBasename(withMountBasename(route))).toBe(route === '/' ? '/' : route);
|
|
83
|
+
}
|
|
84
|
+
// sanity: joinPath stays available/correct
|
|
85
|
+
expect(joinPath(MOUNT, '/assistant')).toBe(`${MOUNT}/assistant`);
|
|
86
|
+
});
|
|
87
|
+
});
|
package/src/router/path.ts
CHANGED
|
@@ -19,6 +19,44 @@ export function joinPath(path1: string, path2: string) {
|
|
|
19
19
|
return path2;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* The mount base path from an explicit `<base href>` element, or `''` when there is none.
|
|
24
|
+
*
|
|
25
|
+
* Apps served under a deep gateway mount carry `<base href="/tenants/.../app/">`, injected at serve
|
|
26
|
+
* time. The router otherwise resolves absolute routes against the origin, which collapses the URL
|
|
27
|
+
* off the mount (and breaks in-app links). This returns the base pathname without a trailing slash
|
|
28
|
+
* so {@link withMountBasename} can keep navigation under the mount and {@link stripMountBasename}
|
|
29
|
+
* can match routes app-relative. The Studio UI has no `<base>` element, so this returns `''` and
|
|
30
|
+
* every caller becomes a no-op there.
|
|
31
|
+
*/
|
|
32
|
+
export function getMountBasename(): string {
|
|
33
|
+
if (typeof document === 'undefined') return '';
|
|
34
|
+
const base = document.querySelector('base[href]') as HTMLBaseElement | null;
|
|
35
|
+
if (!base) return '';
|
|
36
|
+
try {
|
|
37
|
+
return new URL(base.href, document.URL).pathname.replace(/\/+$/, '');
|
|
38
|
+
} catch {
|
|
39
|
+
return '';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Prepend the mount basename to an absolute app path (no-op when no mount, path is relative, or already prefixed). */
|
|
44
|
+
export function withMountBasename(path: string): string {
|
|
45
|
+
const base = getMountBasename();
|
|
46
|
+
if (!base || !path.startsWith('/')) return path;
|
|
47
|
+
if (path === base || path.startsWith(`${base}/`)) return path;
|
|
48
|
+
return joinPath(base, path);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Strip the mount basename from a browser path so route patterns match app-relative (no-op when no mount). */
|
|
52
|
+
export function stripMountBasename(path: string): string {
|
|
53
|
+
const base = getMountBasename();
|
|
54
|
+
if (!base) return path;
|
|
55
|
+
if (path === base) return '/';
|
|
56
|
+
if (path.startsWith(`${base}/`)) return path.slice(base.length) || '/';
|
|
57
|
+
return path;
|
|
58
|
+
}
|
|
59
|
+
|
|
22
60
|
export function getPathSegments(path: string) {
|
|
23
61
|
if (path === '') {
|
|
24
62
|
return [];
|