@zenithbuild/router 0.7.7 → 0.7.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenithbuild/router",
3
- "version": "0.7.7",
3
+ "version": "0.7.10",
4
4
  "description": "File-based SPA router for Zenith framework with deterministic, compile-time route resolution",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,6 +13,7 @@
13
13
  "template-form.js",
14
14
  "template-lifecycle.js",
15
15
  "template-navigation.js",
16
+ "template-refresh.js",
16
17
  "index.d.ts",
17
18
  "README.md",
18
19
  "dist/**",
@@ -0,0 +1,14 @@
1
+ export function renderRouterRefreshSource() {
2
+ return `const __ZENITH_REFRESH_CURRENT_ROUTE_KEY = "__zenith_refresh_current_route";
3
+
4
+ async function refreshCurrentRouteInternal() {
5
+ const targetUrl = new URL(window.location.href);
6
+ const resolved = resolveRoute(targetUrl.pathname);
7
+ if (!resolved) {
8
+ throw new Error("[Zenith Router] refreshCurrentRoute() requires a current matched Zenith page route");
9
+ }
10
+ await performNavigation(targetUrl, "refresh", null);
11
+ }
12
+
13
+ zenithScope()[__ZENITH_REFRESH_CURRENT_ROUTE_KEY] = refreshCurrentRouteInternal;`;
14
+ }