@plitzi/sdk-navigation 0.33.1 → 0.34.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @plitzi/sdk-navigation
2
2
 
3
+ ## 0.34.0
4
+
5
+ ### Minor Changes
6
+
7
+ - v0.34.0
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [5aceda0]
12
+ - Updated dependencies
13
+ - Updated dependencies [5aceda0]
14
+ - @plitzi/sdk-shared@0.34.0
15
+
16
+ ## 0.33.2
17
+
18
+ ### Patch Changes
19
+
20
+ - v0.33.2
21
+ - Updated dependencies
22
+ - @plitzi/sdk-shared@0.33.2
23
+
3
24
  ## 0.33.1
4
25
 
5
26
  ### Patch Changes
@@ -1,10 +1,23 @@
1
1
  import { QueryParams, Server } from '@plitzi/sdk-shared';
2
2
  export type UseNavigationProps = {
3
3
  server: Server;
4
+ /**
5
+ * Where the ROUTER thinks it is, when there is one.
6
+ *
7
+ * `window.location` is not the answer, and was: a space embedded in an application that has a router of its own
8
+ * routes in memory, so the window's address never changes and every internal link looked like it did nothing.
9
+ * The window is still where the HOSTNAME comes from — a router has no idea what host it is on, and a space's
10
+ * per-environment variables are keyed on exactly that.
11
+ */
12
+ routerLocation?: {
13
+ pathname: string;
14
+ search: string;
15
+ };
4
16
  };
5
- declare const useNavigation: ({ server }: UseNavigationProps) => {
17
+ declare const useNavigation: ({ server, routerLocation }: UseNavigationProps) => {
6
18
  queryParams: QueryParams;
7
19
  hostname: string;
20
+ origin: string;
8
21
  location: Location;
9
22
  };
10
23
  export default useNavigation;
@@ -2,16 +2,31 @@ import { get as e } from "@plitzi/plitzi-ui/helpers";
2
2
  import { useMemo as t } from "react";
3
3
  import { ParamsFromURL as n } from "@plitzi/sdk-shared/helpers/utils";
4
4
  //#region src/hooks/useNavigation.ts
5
- var r = ({ server: r }) => {
6
- let i = t(() => typeof window < "u" ? window.location : e(r, "location", { pathname: "/" }), [r]), a = t(() => n(i.search), [i.search]), o = t(() => i.hostname ? i.hostname : "localhost", [i.hostname]);
5
+ var r = ({ server: r, routerLocation: i }) => {
6
+ let a = t(() => typeof window < "u" ? window.location : e(r, "location", { pathname: "/" }), [r]), o = t(() => {
7
+ if (!i) return a;
8
+ let { origin: e, host: t, hostname: n, protocol: r, href: o } = a, { pathname: s, search: c } = i;
9
+ return {
10
+ origin: e,
11
+ host: t,
12
+ hostname: n,
13
+ protocol: r,
14
+ pathname: s,
15
+ search: c,
16
+ hash: "",
17
+ href: e ? `${e}${s}${c}` : o
18
+ };
19
+ }, [a, i]), s = t(() => n(o.search), [o.search]), c = t(() => o.hostname ? o.hostname : "localhost", [o.hostname]), l = o.origin || "";
7
20
  return t(() => ({
8
- queryParams: a,
9
- hostname: o,
10
- location: i
21
+ queryParams: s,
22
+ hostname: c,
23
+ origin: l,
24
+ location: o
11
25
  }), [
12
- a,
13
- o,
14
- i
26
+ s,
27
+ c,
28
+ l,
29
+ o
15
30
  ]);
16
31
  };
17
32
  //#endregion
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import e from "./hooks/useNavigation.mjs";
2
- import { getPageFullPath as t, getPaths as n, getRouteParams as r, isPageAuthored as i, matchPath as a, matchRoutePath as o } from "./NavigationHelper.mjs";
3
- export { t as getPageFullPath, n as getPaths, r as getRouteParams, i as isPageAuthored, a as matchPath, o as matchRoutePath, e as useNavigation };
1
+ import { getPageFullPath as e, getPaths as t, getRouteParams as n, isPageAuthored as r, matchPath as i, matchRoutePath as a } from "./NavigationHelper.mjs";
2
+ import o from "./hooks/useNavigation.mjs";
3
+ export { e as getPageFullPath, t as getPaths, n as getRouteParams, r as isPageAuthored, i as matchPath, a as matchRoutePath, o as useNavigation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-navigation",
3
- "version": "0.33.1",
3
+ "version": "0.34.0",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
@@ -38,19 +38,19 @@
38
38
  "sideEffects": false,
39
39
  "devDependencies": {
40
40
  "eslint": "^9.39.5",
41
- "react": "^19.2.8",
42
- "react-dom": "^19.2.8",
43
- "react-router-dom": "^7.18.2",
41
+ "react": "^19.3.0",
42
+ "react-dom": "^19.3.0",
43
+ "react-router-dom": "^7.18.3",
44
44
  "typescript": "^6.0.3",
45
- "vite": "^8.2.1",
46
- "vitest": "^4.1.10"
45
+ "vite": "^8.3.0",
46
+ "vitest": "^5.0.0"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": "^19",
50
50
  "react-dom": "^19"
51
51
  },
52
52
  "dependencies": {
53
- "@plitzi/plitzi-ui": "^1.6.19",
54
- "@plitzi/sdk-shared": "0.33.1"
53
+ "@plitzi/plitzi-ui": "^1.6.21",
54
+ "@plitzi/sdk-shared": "0.34.0"
55
55
  }
56
56
  }