@svadmin/core 0.23.3 → 0.23.4

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": "@svadmin/core",
3
- "version": "0.23.3",
3
+ "version": "0.23.4",
4
4
  "author": "zuohuadong",
5
5
  "repository": {
6
6
  "type": "git",
package/src/router.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  // Router — path matching + navigation (supports hash & history via RouterProvider)
2
2
 
3
3
  import type { RouterProvider } from './router-provider';
4
- import { syncGlobalPath } from './useParsed.svelte';
5
4
 
5
+ let _syncGlobalPath: () => void = () => {};
6
+ export function registerRouterSync(fn: () => void) {
7
+ _syncGlobalPath = fn;
8
+ }
6
9
  interface RouteMatch {
7
10
  route: string;
8
11
  params: Record<string, string>;
@@ -75,7 +78,7 @@ export async function navigate(path: string, options?: { replaceState?: boolean
75
78
  } else if (typeof window !== 'undefined') {
76
79
  window.location.hash = '#' + path.replace(/^#/, '');
77
80
  }
78
- syncGlobalPath();
81
+ _syncGlobalPath();
79
82
  for (const guard of _afterGuards) {
80
83
  guard(path, from);
81
84
  }
@@ -1,6 +1,6 @@
1
1
  // useParsed — parse current URL hash into structured route info
2
2
 
3
- import { currentPath } from './router';
3
+ import { currentPath, registerRouterSync } from './router';
4
4
  import { getResources } from './context.svelte';
5
5
 
6
6
  interface ParsedRoute {
@@ -19,6 +19,8 @@ export function resetGlobalPath(): void {
19
19
  export function syncGlobalPath(): void {
20
20
  if (typeof window !== 'undefined') globalPath = currentPath();
21
21
  }
22
+ registerRouterSync(syncGlobalPath);
23
+
22
24
  if (typeof window !== 'undefined') {
23
25
  globalPath = currentPath();
24
26
  if (!(window as any).__svadminParsedInit) {