@pyreon/router 0.11.5 → 0.11.6

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.
@@ -1,3 +1,3 @@
1
- import { GlobalRegistrator } from "@happy-dom/global-registrator"
1
+ import { GlobalRegistrator } from '@happy-dom/global-registrator'
2
2
 
3
3
  GlobalRegistrator.register()
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ComponentFn } from "@pyreon/core"
1
+ import type { ComponentFn } from '@pyreon/core'
2
2
 
3
3
  export type { ComponentFn }
4
4
 
@@ -51,7 +51,7 @@ export interface RouteMeta {
51
51
  /** If true, guards can redirect to login */
52
52
  requiresAuth?: boolean
53
53
  /** Scroll behavior for this route */
54
- scrollBehavior?: "top" | "restore" | "none"
54
+ scrollBehavior?: 'top' | 'restore' | 'none'
55
55
  }
56
56
 
57
57
  // ─── Resolved route ───────────────────────────────────────────────────────────
@@ -71,7 +71,7 @@ export interface ResolvedRoute<
71
71
 
72
72
  // ─── Lazy component ───────────────────────────────────────────────────────────
73
73
 
74
- export const LAZY_SYMBOL = Symbol("pyreon.lazy")
74
+ export const LAZY_SYMBOL = Symbol('pyreon.lazy')
75
75
 
76
76
  export interface LazyComponent {
77
77
  readonly [LAZY_SYMBOL]: true
@@ -95,7 +95,7 @@ export function lazy(
95
95
  }
96
96
 
97
97
  export function isLazy(c: RouteComponent): c is LazyComponent {
98
- return typeof c === "object" && c !== null && (c as LazyComponent)[LAZY_SYMBOL] === true
98
+ return typeof c === 'object' && c !== null && (c as LazyComponent)[LAZY_SYMBOL] === true
99
99
  }
100
100
 
101
101
  export type RouteComponent = ComponentFn | LazyComponent
@@ -186,12 +186,12 @@ export type ScrollBehaviorFn = (
186
186
  to: ResolvedRoute,
187
187
  from: ResolvedRoute,
188
188
  savedPosition: number | null,
189
- ) => "top" | "restore" | "none" | number
189
+ ) => 'top' | 'restore' | 'none' | number
190
190
 
191
191
  export interface RouterOptions {
192
192
  routes: RouteRecord[]
193
193
  /** "hash" (default) uses location.hash; "history" uses pushState */
194
- mode?: "hash" | "history"
194
+ mode?: 'hash' | 'history'
195
195
  /**
196
196
  * Base path for the application. Used when deploying to a sub-path
197
197
  * (e.g. `"/app"` for `https://example.com/app/`).
@@ -203,7 +203,7 @@ export interface RouterOptions {
203
203
  * Global scroll behavior. Per-route meta.scrollBehavior takes precedence.
204
204
  * Default: "top"
205
205
  */
206
- scrollBehavior?: ScrollBehaviorFn | "top" | "restore" | "none"
206
+ scrollBehavior?: ScrollBehaviorFn | 'top' | 'restore' | 'none'
207
207
  /**
208
208
  * Initial URL for SSR. On the server, window.location is unavailable;
209
209
  * pass the request URL here so the router resolves the correct route.
@@ -231,7 +231,7 @@ export interface RouterOptions {
231
231
  * - `"add"` — ensures paths always end with `/`
232
232
  * - `"ignore"` — no normalization
233
233
  */
234
- trailingSlash?: "strip" | "add" | "ignore"
234
+ trailingSlash?: 'strip' | 'add' | 'ignore'
235
235
  }
236
236
 
237
237
  // ─── Router interface ─────────────────────────────────────────────────────────
@@ -278,11 +278,11 @@ export interface Router {
278
278
 
279
279
  // ─── Internal router instance ─────────────────────────────────────────────────
280
280
 
281
- import type { Computed, Signal } from "@pyreon/reactivity"
281
+ import type { Computed, Signal } from '@pyreon/reactivity'
282
282
 
283
283
  export interface RouterInstance extends Router {
284
284
  routes: RouteRecord[]
285
- mode: "hash" | "history"
285
+ mode: 'hash' | 'history'
286
286
  /** Normalized base path (e.g. "/app"), empty string if none */
287
287
  _base: string
288
288
  _currentPath: Signal<string>
@@ -291,8 +291,8 @@ export interface RouterInstance extends Router {
291
291
  _loadingSignal: Signal<number>
292
292
  _resolve(rawPath: string): ResolvedRoute
293
293
  _scrollPositions: Map<string, number>
294
- _scrollBehavior: RouterOptions["scrollBehavior"]
295
- _onError: RouterOptions["onError"]
294
+ _scrollBehavior: RouterOptions['scrollBehavior']
295
+ _onError: RouterOptions['onError']
296
296
  _maxCacheSize: number
297
297
  /**
298
298
  * Current RouterView nesting depth. Incremented by each RouterView as it