loly 0.1.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.
@@ -0,0 +1,16 @@
1
+ interface ClientRouteLoaded {
2
+ path: string;
3
+ component: () => Promise<any>;
4
+ }
5
+ interface BootstrapOptions {
6
+ routes: ClientRouteLoaded[];
7
+ notFoundRoute?: ClientRouteLoaded | null;
8
+ errorRoute?: ClientRouteLoaded | null;
9
+ }
10
+
11
+ /**
12
+ * Bootstrap client application
13
+ */
14
+ declare function bootstrapClient(options: BootstrapOptions): void;
15
+
16
+ export { type BootstrapOptions as B, type ClientRouteLoaded as C, bootstrapClient as b };
@@ -0,0 +1,101 @@
1
+ import { C as ClientRouteLoaded } from './bootstrap-DgWagZ79.js';
2
+ export { B as BootstrapOptions, b as bootstrapClient } from './bootstrap-DgWagZ79.js';
3
+
4
+ /**
5
+ * Get global router instance
6
+ */
7
+ declare function getGlobalRouter(): FrameworkRouter | null;
8
+ /**
9
+ * Navigate function that uses framework router if available
10
+ * This can be used by Link components or programmatically
11
+ */
12
+ declare function navigate(to: string, options?: {
13
+ replace?: boolean;
14
+ }): void;
15
+ /**
16
+ * Framework-specific router for SPA navigation with RSC
17
+ */
18
+ declare class FrameworkRouter {
19
+ private routes;
20
+ private currentLocation;
21
+ private appContainer;
22
+ private componentCache;
23
+ private loadedScripts;
24
+ private routeStyles;
25
+ private rscPayloadCache;
26
+ private prefetchPromises;
27
+ private prefetchObserver;
28
+ private readonly MAX_CACHE_SIZE;
29
+ private invalidatedPaths;
30
+ private prefetchedLinks;
31
+ constructor(routes: ClientRouteLoaded[], appContainer: HTMLElement);
32
+ /**
33
+ * Check if pre-fetch should be performed based on connection
34
+ */
35
+ private shouldPrefetch;
36
+ /**
37
+ * Generate cache key from pathname and search
38
+ */
39
+ private getCacheKey;
40
+ /**
41
+ * Check if href is an internal link
42
+ */
43
+ private isInternalLink;
44
+ /**
45
+ * Pre-fetch route data (RSC payload and JS component)
46
+ */
47
+ private prefetchRoute;
48
+ /**
49
+ * Navigate to a new path
50
+ */
51
+ navigate(to: string, options?: {
52
+ replace?: boolean;
53
+ }): void;
54
+ /**
55
+ * Update app content based on current location
56
+ */
57
+ private updateContent;
58
+ /**
59
+ * Inject styles for a route with deduplication
60
+ */
61
+ private injectStyles;
62
+ /**
63
+ * Inject scripts with deduplication
64
+ */
65
+ private injectScripts;
66
+ /**
67
+ * Find matching route for pathname
68
+ */
69
+ private findRoute;
70
+ /**
71
+ * Load component with caching
72
+ */
73
+ private loadComponentCached;
74
+ /**
75
+ * Setup navigation interception
76
+ */
77
+ private setupNavigation;
78
+ /**
79
+ * Setup popstate handler for browser back/forward
80
+ */
81
+ private setupPopState;
82
+ /**
83
+ * Observe new links in container (called after DOM updates)
84
+ */
85
+ private observeNewLinks;
86
+ /**
87
+ * Setup pre-fetch with Intersection Observer and hover
88
+ */
89
+ private setupPrefetch;
90
+ /**
91
+ * Initialize router (call after initial page load)
92
+ */
93
+ init(): void;
94
+ /**
95
+ * Invalidate cache for a specific path (prepared for future revalidatePath implementation)
96
+ * TODO: Implementar invalidación completa cuando se implemente revalidatePath
97
+ */
98
+ revalidatePath(pathname: string, search?: string): void;
99
+ }
100
+
101
+ export { ClientRouteLoaded, FrameworkRouter, getGlobalRouter, navigate };