@lolyjs/core 0.2.0-alpha.2 → 0.2.0-alpha.21
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/LICENCE.md +9 -0
- package/README.md +1074 -761
- package/dist/{bootstrap-BiCQmSkx.d.mts → bootstrap-BfGTMUkj.d.mts} +19 -0
- package/dist/{bootstrap-BiCQmSkx.d.ts → bootstrap-BfGTMUkj.d.ts} +19 -0
- package/dist/cli.cjs +16997 -4416
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +17007 -4416
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +14731 -1652
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +295 -57
- package/dist/index.d.ts +295 -57
- package/dist/index.js +17190 -4102
- package/dist/index.js.map +1 -1
- package/dist/index.types-DMOO-uvF.d.mts +221 -0
- package/dist/index.types-DMOO-uvF.d.ts +221 -0
- package/dist/react/cache.cjs +107 -32
- package/dist/react/cache.cjs.map +1 -1
- package/dist/react/cache.d.mts +27 -21
- package/dist/react/cache.d.ts +27 -21
- package/dist/react/cache.js +107 -32
- package/dist/react/cache.js.map +1 -1
- package/dist/react/components.cjs +10 -8
- package/dist/react/components.cjs.map +1 -1
- package/dist/react/components.js +10 -8
- package/dist/react/components.js.map +1 -1
- package/dist/react/hooks.cjs +208 -26
- package/dist/react/hooks.cjs.map +1 -1
- package/dist/react/hooks.d.mts +75 -15
- package/dist/react/hooks.d.ts +75 -15
- package/dist/react/hooks.js +208 -26
- package/dist/react/hooks.js.map +1 -1
- package/dist/react/sockets.cjs +13 -6
- package/dist/react/sockets.cjs.map +1 -1
- package/dist/react/sockets.js +13 -6
- package/dist/react/sockets.js.map +1 -1
- package/dist/react/themes.cjs +61 -18
- package/dist/react/themes.cjs.map +1 -1
- package/dist/react/themes.js +63 -20
- package/dist/react/themes.js.map +1 -1
- package/dist/runtime.cjs +544 -111
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +540 -107
- package/dist/runtime.js.map +1 -1
- package/package.json +49 -4
package/dist/react/hooks.d.mts
CHANGED
|
@@ -3,27 +3,87 @@ declare const useBroadcastChannel: (channelName: string) => {
|
|
|
3
3
|
sendMessage: (msg: unknown) => void;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
+
interface Router {
|
|
7
|
+
/**
|
|
8
|
+
* Navigate to a new route.
|
|
9
|
+
* @param url - The URL to navigate to (e.g., "/about" or "/blog/[slug]" with params)
|
|
10
|
+
* @param options - Navigation options
|
|
11
|
+
*/
|
|
12
|
+
push: (url: string, options?: {
|
|
13
|
+
revalidate?: boolean;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Replace the current route without adding to history.
|
|
17
|
+
* @param url - The URL to navigate to
|
|
18
|
+
* @param options - Navigation options
|
|
19
|
+
*/
|
|
20
|
+
replace: (url: string, options?: {
|
|
21
|
+
revalidate?: boolean;
|
|
22
|
+
}) => Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Go back in the browser history.
|
|
25
|
+
*/
|
|
26
|
+
back: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Refresh the current route data by revalidating.
|
|
29
|
+
*/
|
|
30
|
+
refresh: () => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Current pathname (e.g., "/blog/my-post")
|
|
33
|
+
*/
|
|
34
|
+
pathname: string;
|
|
35
|
+
/**
|
|
36
|
+
* Query parameters from the URL (e.g., ?id=123&name=test)
|
|
37
|
+
* Alias for searchParams for backward compatibility
|
|
38
|
+
*/
|
|
39
|
+
query: Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Search parameters from the URL (e.g., ?id=123&name=test)
|
|
42
|
+
*/
|
|
43
|
+
searchParams: Record<string, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* Dynamic route parameters (e.g., { slug: "my-post" } for /blog/[slug])
|
|
46
|
+
*/
|
|
47
|
+
params: Record<string, string>;
|
|
48
|
+
}
|
|
6
49
|
/**
|
|
7
|
-
* Hook to access
|
|
50
|
+
* Hook to access router functionality and current route information.
|
|
8
51
|
*
|
|
9
|
-
*
|
|
10
|
-
* Automatically updates when `revalidate()` is called.
|
|
52
|
+
* Provides methods to navigate programmatically and access current route data.
|
|
11
53
|
*
|
|
12
|
-
* @
|
|
13
|
-
* @template T - Type for route params (default: any)
|
|
14
|
-
* @returns Object containing params and props
|
|
54
|
+
* @returns Router object with navigation methods and route information
|
|
15
55
|
*
|
|
16
56
|
* @example
|
|
17
|
-
*
|
|
18
|
-
*
|
|
57
|
+
* ```tsx
|
|
58
|
+
* function MyComponent() {
|
|
59
|
+
* const router = useRouter();
|
|
60
|
+
*
|
|
61
|
+
* const handleClick = () => {
|
|
62
|
+
* router.push("/about");
|
|
63
|
+
* };
|
|
64
|
+
*
|
|
65
|
+
* return (
|
|
66
|
+
* <div>
|
|
67
|
+
* <p>Current path: {router.pathname}</p>
|
|
68
|
+
* <p>Params: {JSON.stringify(router.params)}</p>
|
|
69
|
+
* <button onClick={handleClick}>Go to About</button>
|
|
70
|
+
* </div>
|
|
71
|
+
* );
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
19
74
|
*
|
|
20
75
|
* @example
|
|
21
|
-
*
|
|
22
|
-
*
|
|
76
|
+
* ```tsx
|
|
77
|
+
* // Navigate with dynamic params
|
|
78
|
+
* router.push("/blog/my-post");
|
|
79
|
+
*
|
|
80
|
+
* // Replace current route
|
|
81
|
+
* router.replace("/login");
|
|
82
|
+
*
|
|
83
|
+
* // Refresh current route data
|
|
84
|
+
* await router.refresh();
|
|
85
|
+
* ```
|
|
23
86
|
*/
|
|
24
|
-
declare function
|
|
25
|
-
params: T;
|
|
26
|
-
props: P;
|
|
27
|
-
};
|
|
87
|
+
declare function useRouter(): Router;
|
|
28
88
|
|
|
29
|
-
export { useBroadcastChannel,
|
|
89
|
+
export { type Router, useBroadcastChannel, useRouter };
|
package/dist/react/hooks.d.ts
CHANGED
|
@@ -3,27 +3,87 @@ declare const useBroadcastChannel: (channelName: string) => {
|
|
|
3
3
|
sendMessage: (msg: unknown) => void;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
+
interface Router {
|
|
7
|
+
/**
|
|
8
|
+
* Navigate to a new route.
|
|
9
|
+
* @param url - The URL to navigate to (e.g., "/about" or "/blog/[slug]" with params)
|
|
10
|
+
* @param options - Navigation options
|
|
11
|
+
*/
|
|
12
|
+
push: (url: string, options?: {
|
|
13
|
+
revalidate?: boolean;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Replace the current route without adding to history.
|
|
17
|
+
* @param url - The URL to navigate to
|
|
18
|
+
* @param options - Navigation options
|
|
19
|
+
*/
|
|
20
|
+
replace: (url: string, options?: {
|
|
21
|
+
revalidate?: boolean;
|
|
22
|
+
}) => Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Go back in the browser history.
|
|
25
|
+
*/
|
|
26
|
+
back: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Refresh the current route data by revalidating.
|
|
29
|
+
*/
|
|
30
|
+
refresh: () => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Current pathname (e.g., "/blog/my-post")
|
|
33
|
+
*/
|
|
34
|
+
pathname: string;
|
|
35
|
+
/**
|
|
36
|
+
* Query parameters from the URL (e.g., ?id=123&name=test)
|
|
37
|
+
* Alias for searchParams for backward compatibility
|
|
38
|
+
*/
|
|
39
|
+
query: Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Search parameters from the URL (e.g., ?id=123&name=test)
|
|
42
|
+
*/
|
|
43
|
+
searchParams: Record<string, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* Dynamic route parameters (e.g., { slug: "my-post" } for /blog/[slug])
|
|
46
|
+
*/
|
|
47
|
+
params: Record<string, string>;
|
|
48
|
+
}
|
|
6
49
|
/**
|
|
7
|
-
* Hook to access
|
|
50
|
+
* Hook to access router functionality and current route information.
|
|
8
51
|
*
|
|
9
|
-
*
|
|
10
|
-
* Automatically updates when `revalidate()` is called.
|
|
52
|
+
* Provides methods to navigate programmatically and access current route data.
|
|
11
53
|
*
|
|
12
|
-
* @
|
|
13
|
-
* @template T - Type for route params (default: any)
|
|
14
|
-
* @returns Object containing params and props
|
|
54
|
+
* @returns Router object with navigation methods and route information
|
|
15
55
|
*
|
|
16
56
|
* @example
|
|
17
|
-
*
|
|
18
|
-
*
|
|
57
|
+
* ```tsx
|
|
58
|
+
* function MyComponent() {
|
|
59
|
+
* const router = useRouter();
|
|
60
|
+
*
|
|
61
|
+
* const handleClick = () => {
|
|
62
|
+
* router.push("/about");
|
|
63
|
+
* };
|
|
64
|
+
*
|
|
65
|
+
* return (
|
|
66
|
+
* <div>
|
|
67
|
+
* <p>Current path: {router.pathname}</p>
|
|
68
|
+
* <p>Params: {JSON.stringify(router.params)}</p>
|
|
69
|
+
* <button onClick={handleClick}>Go to About</button>
|
|
70
|
+
* </div>
|
|
71
|
+
* );
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
19
74
|
*
|
|
20
75
|
* @example
|
|
21
|
-
*
|
|
22
|
-
*
|
|
76
|
+
* ```tsx
|
|
77
|
+
* // Navigate with dynamic params
|
|
78
|
+
* router.push("/blog/my-post");
|
|
79
|
+
*
|
|
80
|
+
* // Replace current route
|
|
81
|
+
* router.replace("/login");
|
|
82
|
+
*
|
|
83
|
+
* // Refresh current route data
|
|
84
|
+
* await router.refresh();
|
|
85
|
+
* ```
|
|
23
86
|
*/
|
|
24
|
-
declare function
|
|
25
|
-
params: T;
|
|
26
|
-
props: P;
|
|
27
|
-
};
|
|
87
|
+
declare function useRouter(): Router;
|
|
28
88
|
|
|
29
|
-
export { useBroadcastChannel,
|
|
89
|
+
export { type Router, useBroadcastChannel, useRouter };
|
package/dist/react/hooks.js
CHANGED
|
@@ -1,58 +1,240 @@
|
|
|
1
1
|
// modules/react/hooks/useBroadcastChannel/index.tsx
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
2
|
+
import { useEffect, useState, useRef, useCallback } from "react";
|
|
3
3
|
var useBroadcastChannel = (channelName) => {
|
|
4
4
|
const [message, setMessage] = useState(null);
|
|
5
|
-
const
|
|
5
|
+
const channelRef = useRef(null);
|
|
6
6
|
useEffect(() => {
|
|
7
|
+
if (!channelRef.current && typeof window !== "undefined") {
|
|
8
|
+
channelRef.current = new BroadcastChannel(channelName);
|
|
9
|
+
}
|
|
10
|
+
const channel = channelRef.current;
|
|
11
|
+
if (!channel) return;
|
|
7
12
|
const handleMessage = (event) => {
|
|
8
13
|
setMessage(event.data);
|
|
9
14
|
};
|
|
10
15
|
channel.onmessage = handleMessage;
|
|
11
16
|
return () => {
|
|
12
|
-
|
|
17
|
+
if (channelRef.current) {
|
|
18
|
+
channelRef.current.close();
|
|
19
|
+
channelRef.current = null;
|
|
20
|
+
}
|
|
13
21
|
};
|
|
14
|
-
}, [
|
|
15
|
-
const sendMessage = (msg) => {
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
}, [channelName]);
|
|
23
|
+
const sendMessage = useCallback((msg) => {
|
|
24
|
+
if (channelRef.current) {
|
|
25
|
+
channelRef.current.postMessage(msg);
|
|
26
|
+
}
|
|
27
|
+
}, []);
|
|
18
28
|
return { message, sendMessage };
|
|
19
29
|
};
|
|
20
30
|
|
|
21
|
-
// modules/react/hooks/
|
|
22
|
-
import { useEffect as useEffect2,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
// modules/react/hooks/useRouter/index.ts
|
|
32
|
+
import { useState as useState2, useEffect as useEffect2, useCallback as useCallback2, useContext as useContext2, useRef as useRef2 } from "react";
|
|
33
|
+
|
|
34
|
+
// modules/runtime/client/RouterContext.tsx
|
|
35
|
+
import { createContext, useContext } from "react";
|
|
36
|
+
var RouterContext = createContext(null);
|
|
37
|
+
|
|
38
|
+
// modules/runtime/client/constants.ts
|
|
39
|
+
var WINDOW_DATA_KEY = "__FW_DATA__";
|
|
40
|
+
var ROUTER_DATA_KEY = "__LOLY_ROUTER_DATA__";
|
|
41
|
+
var ROUTER_NAVIGATE_KEY = "__LOLY_ROUTER_NAVIGATE__";
|
|
42
|
+
|
|
43
|
+
// modules/runtime/client/window-data.ts
|
|
44
|
+
function getWindowData() {
|
|
45
|
+
if (typeof window === "undefined") {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return window[WINDOW_DATA_KEY] ?? null;
|
|
49
|
+
}
|
|
50
|
+
function getRouterData() {
|
|
51
|
+
if (typeof window === "undefined") {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return window[ROUTER_DATA_KEY] ?? null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// modules/react/hooks/useRouter/index.ts
|
|
58
|
+
function useRouter() {
|
|
59
|
+
const context = useContext2(RouterContext);
|
|
60
|
+
const navigate = context?.navigate;
|
|
61
|
+
const navigateRef = useRef2(navigate);
|
|
62
|
+
useEffect2(() => {
|
|
63
|
+
navigateRef.current = navigate;
|
|
64
|
+
}, [navigate]);
|
|
65
|
+
const [routeData, setRouteData] = useState2(() => {
|
|
66
|
+
if (typeof window === "undefined") {
|
|
27
67
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
68
|
+
pathname: "",
|
|
69
|
+
query: {},
|
|
70
|
+
searchParams: {},
|
|
71
|
+
params: {}
|
|
30
72
|
};
|
|
31
73
|
}
|
|
74
|
+
const data = getWindowData();
|
|
75
|
+
const routerData = getRouterData();
|
|
76
|
+
const searchParams = routerData?.searchParams || parseQueryString(window.location.search);
|
|
32
77
|
return {
|
|
33
|
-
|
|
34
|
-
|
|
78
|
+
pathname: routerData?.pathname || data?.pathname || window.location.pathname,
|
|
79
|
+
query: searchParams,
|
|
80
|
+
// For backward compatibility
|
|
81
|
+
searchParams,
|
|
82
|
+
params: routerData?.params || data?.params || {}
|
|
35
83
|
};
|
|
36
84
|
});
|
|
37
85
|
useEffect2(() => {
|
|
86
|
+
if (typeof window === "undefined") return;
|
|
38
87
|
const handleDataRefresh = () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
88
|
+
const data = getWindowData();
|
|
89
|
+
const routerData = getRouterData();
|
|
90
|
+
const currentPathname = window.location.pathname;
|
|
91
|
+
const currentSearch = window.location.search;
|
|
92
|
+
const searchParams = routerData?.searchParams || parseQueryString(currentSearch);
|
|
93
|
+
setRouteData({
|
|
94
|
+
pathname: routerData?.pathname || data?.pathname || currentPathname,
|
|
95
|
+
query: searchParams,
|
|
96
|
+
// For backward compatibility
|
|
97
|
+
searchParams,
|
|
98
|
+
params: routerData?.params || data?.params || {}
|
|
99
|
+
});
|
|
46
100
|
};
|
|
47
101
|
window.addEventListener("fw-data-refresh", handleDataRefresh);
|
|
102
|
+
window.addEventListener("fw-router-data-refresh", handleDataRefresh);
|
|
103
|
+
const handlePopState = () => {
|
|
104
|
+
handleDataRefresh();
|
|
105
|
+
};
|
|
106
|
+
window.addEventListener("popstate", handlePopState);
|
|
48
107
|
return () => {
|
|
49
108
|
window.removeEventListener("fw-data-refresh", handleDataRefresh);
|
|
109
|
+
window.removeEventListener("fw-router-data-refresh", handleDataRefresh);
|
|
110
|
+
window.removeEventListener("popstate", handlePopState);
|
|
50
111
|
};
|
|
51
112
|
}, []);
|
|
52
|
-
|
|
113
|
+
const push = useCallback2(
|
|
114
|
+
async (url, options) => {
|
|
115
|
+
const fullUrl = url.startsWith("/") ? url : `/${url}`;
|
|
116
|
+
const getCurrentNavigate = () => {
|
|
117
|
+
if (navigateRef.current) return navigateRef.current;
|
|
118
|
+
if (navigate) return navigate;
|
|
119
|
+
if (typeof window !== "undefined" && window[ROUTER_NAVIGATE_KEY]) {
|
|
120
|
+
return window[ROUTER_NAVIGATE_KEY];
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
};
|
|
124
|
+
let currentNavigate = getCurrentNavigate();
|
|
125
|
+
if (typeof window === "undefined") {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (!currentNavigate) {
|
|
129
|
+
for (let i = 0; i < 10; i++) {
|
|
130
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
131
|
+
currentNavigate = getCurrentNavigate();
|
|
132
|
+
if (currentNavigate) break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (!currentNavigate) {
|
|
136
|
+
window.location.href = fullUrl;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const currentUrl = window.location.pathname + window.location.search;
|
|
140
|
+
if (fullUrl === currentUrl) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
window.history.pushState({}, "", fullUrl);
|
|
144
|
+
await currentNavigate(fullUrl, options);
|
|
145
|
+
},
|
|
146
|
+
[navigate]
|
|
147
|
+
// Include navigate in dependencies so it updates when context becomes available
|
|
148
|
+
);
|
|
149
|
+
const replace = useCallback2(
|
|
150
|
+
async (url, options) => {
|
|
151
|
+
const fullUrl = url.startsWith("/") ? url : `/${url}`;
|
|
152
|
+
const getCurrentNavigate = () => {
|
|
153
|
+
if (navigateRef.current) return navigateRef.current;
|
|
154
|
+
if (navigate) return navigate;
|
|
155
|
+
if (typeof window !== "undefined" && window[ROUTER_NAVIGATE_KEY]) {
|
|
156
|
+
return window[ROUTER_NAVIGATE_KEY];
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
};
|
|
160
|
+
let currentNavigate = getCurrentNavigate();
|
|
161
|
+
if (typeof window === "undefined") {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (!currentNavigate) {
|
|
165
|
+
for (let i = 0; i < 10; i++) {
|
|
166
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
167
|
+
currentNavigate = getCurrentNavigate();
|
|
168
|
+
if (currentNavigate) break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (!currentNavigate) {
|
|
172
|
+
window.location.replace(fullUrl);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
window.history.replaceState({}, "", fullUrl);
|
|
176
|
+
await currentNavigate(fullUrl, options);
|
|
177
|
+
},
|
|
178
|
+
[navigate]
|
|
179
|
+
);
|
|
180
|
+
const back = useCallback2(() => {
|
|
181
|
+
if (typeof window !== "undefined") {
|
|
182
|
+
window.history.back();
|
|
183
|
+
}
|
|
184
|
+
}, []);
|
|
185
|
+
const refresh = useCallback2(async () => {
|
|
186
|
+
const currentUrl = typeof window !== "undefined" ? window.location.pathname + window.location.search : routeData.pathname;
|
|
187
|
+
const getCurrentNavigate = () => {
|
|
188
|
+
if (navigateRef.current) return navigateRef.current;
|
|
189
|
+
if (navigate) return navigate;
|
|
190
|
+
if (typeof window !== "undefined" && window[ROUTER_NAVIGATE_KEY]) {
|
|
191
|
+
return window[ROUTER_NAVIGATE_KEY];
|
|
192
|
+
}
|
|
193
|
+
return null;
|
|
194
|
+
};
|
|
195
|
+
let currentNavigate = getCurrentNavigate();
|
|
196
|
+
if (typeof window === "undefined") {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (!currentNavigate) {
|
|
200
|
+
for (let i = 0; i < 10; i++) {
|
|
201
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
202
|
+
currentNavigate = getCurrentNavigate();
|
|
203
|
+
if (currentNavigate) break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (!currentNavigate) {
|
|
207
|
+
window.location.reload();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
await currentNavigate(currentUrl, { revalidate: true });
|
|
211
|
+
}, [navigate, routeData.pathname]);
|
|
212
|
+
return {
|
|
213
|
+
push,
|
|
214
|
+
replace,
|
|
215
|
+
back,
|
|
216
|
+
refresh,
|
|
217
|
+
pathname: routeData.pathname,
|
|
218
|
+
query: routeData.query,
|
|
219
|
+
searchParams: routeData.searchParams,
|
|
220
|
+
params: routeData.params
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function parseQueryString(search) {
|
|
224
|
+
const params = {};
|
|
225
|
+
if (!search || search.length === 0) return params;
|
|
226
|
+
const queryString = search.startsWith("?") ? search.slice(1) : search;
|
|
227
|
+
const pairs = queryString.split("&");
|
|
228
|
+
for (const pair of pairs) {
|
|
229
|
+
const [key, value] = pair.split("=");
|
|
230
|
+
if (key) {
|
|
231
|
+
params[decodeURIComponent(key)] = value ? decodeURIComponent(value) : "";
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return params;
|
|
53
235
|
}
|
|
54
236
|
export {
|
|
55
237
|
useBroadcastChannel,
|
|
56
|
-
|
|
238
|
+
useRouter
|
|
57
239
|
};
|
|
58
240
|
//# sourceMappingURL=hooks.js.map
|
package/dist/react/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../modules/react/hooks/useBroadcastChannel/index.tsx","../../modules/react/hooks/usePageProps/index.ts"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\r\n\r\nexport const useBroadcastChannel = (channelName: string) => {\r\n const [message, setMessage] = useState(null);\r\n const channel = new BroadcastChannel(channelName);\r\n\r\n useEffect(() => {\r\n const handleMessage = (event: MessageEvent) => {\r\n setMessage(event.data);\r\n };\r\n\r\n channel.onmessage = handleMessage;\r\n\r\n // Clean up the channel when the component unmounts\r\n return () => {\r\n channel.close();\r\n };\r\n }, [channel]);\r\n\r\n const sendMessage = (msg: unknown) => {\r\n channel.postMessage(msg);\r\n };\r\n\r\n return { message, sendMessage };\r\n};\r\n","import React, { useEffect, useState } from \"react\";\r\n\r\n/**\r\n * Hook to access page props and route parameters.\r\n *\r\n * Reads initial data from window.__FW_DATA__ set during SSR.\r\n * Automatically updates when `revalidate()` is called.\r\n *\r\n * @template P - Type for page props (default: any)\r\n * @template T - Type for route params (default: any)\r\n * @returns Object containing params and props\r\n *\r\n * @example\r\n * // With props type only\r\n * const { props } = usePageProps<{ title: string }>();\r\n *\r\n * @example\r\n * // With both props and params types\r\n * const { props, params } = usePageProps<{ title: string }, { id: string }>();\r\n */\r\nexport function usePageProps<P = any, T = any>(): { params: T, props: P } {\r\n const [state, setState] = useState<{ params: T, props: P }>(() => {\r\n // Initialize with current data if available\r\n if (typeof window !== \"undefined\" && (window as any)?.__FW_DATA__) {\r\n const data = (window as any).__FW_DATA__;\r\n return {\r\n params: data.params || {} as T,\r\n props: data.props || {} as P,\r\n };\r\n }\r\n return {\r\n params: {} as T,\r\n props: {} as P,\r\n };\r\n });\r\n\r\n useEffect(() => {\r\n // Listen for data refresh events (from revalidate() or navigation)\r\n const handleDataRefresh = () => {\r\n if ((window as any)?.__FW_DATA__) {\r\n const data = (window as any).__FW_DATA__;\r\n setState({\r\n params: data.params || {} as T,\r\n props: data.props || {} as P,\r\n });\r\n }\r\n };\r\n\r\n window.addEventListener(\"fw-data-refresh\", handleDataRefresh);\r\n\r\n return () => {\r\n window.removeEventListener(\"fw-data-refresh\", handleDataRefresh);\r\n };\r\n }, []);\r\n\r\n return { params: state.params as T, props: state.props as P };\r\n};\r\n"],"mappings":";AAAA,SAAgB,WAAW,gBAAgB;AAEpC,IAAM,sBAAsB,CAAC,gBAAwB;AAC1D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,IAAI;AAC3C,QAAM,UAAU,IAAI,iBAAiB,WAAW;AAEhD,YAAU,MAAM;AACd,UAAM,gBAAgB,CAAC,UAAwB;AAC7C,iBAAW,MAAM,IAAI;AAAA,IACvB;AAEA,YAAQ,YAAY;AAGpB,WAAO,MAAM;AACX,cAAQ,MAAM;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,cAAc,CAAC,QAAiB;AACpC,YAAQ,YAAY,GAAG;AAAA,EACzB;AAEA,SAAO,EAAE,SAAS,YAAY;AAChC;;;ACxBA,SAAgB,aAAAA,YAAW,YAAAC,iBAAgB;AAoBpC,SAAS,eAA0D;AACxE,QAAM,CAAC,OAAO,QAAQ,IAAIA,UAAkC,MAAM;AAEhE,QAAI,OAAO,WAAW,eAAgB,QAAgB,aAAa;AACjE,YAAM,OAAQ,OAAe;AAC7B,aAAO;AAAA,QACL,QAAQ,KAAK,UAAU,CAAC;AAAA,QACxB,OAAO,KAAK,SAAS,CAAC;AAAA,MACxB;AAAA,IACF;AACA,WAAO;AAAA,MACL,QAAQ,CAAC;AAAA,MACT,OAAO,CAAC;AAAA,IACV;AAAA,EACF,CAAC;AAED,EAAAD,WAAU,MAAM;AAEd,UAAM,oBAAoB,MAAM;AAC9B,UAAK,QAAgB,aAAa;AAChC,cAAM,OAAQ,OAAe;AAC7B,iBAAS;AAAA,UACP,QAAQ,KAAK,UAAU,CAAC;AAAA,UACxB,OAAO,KAAK,SAAS,CAAC;AAAA,QACxB,CAAC;AAAA,MACH;AAAA,IACF;AAEA,WAAO,iBAAiB,mBAAmB,iBAAiB;AAE5D,WAAO,MAAM;AACX,aAAO,oBAAoB,mBAAmB,iBAAiB;AAAA,IACjE;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO,EAAE,QAAQ,MAAM,QAAa,OAAO,MAAM,MAAW;AAC9D;","names":["useEffect","useState"]}
|
|
1
|
+
{"version":3,"sources":["../../modules/react/hooks/useBroadcastChannel/index.tsx","../../modules/react/hooks/useRouter/index.ts","../../modules/runtime/client/RouterContext.tsx","../../modules/runtime/client/constants.ts","../../modules/runtime/client/window-data.ts"],"sourcesContent":["import React, { useEffect, useState, useRef, useCallback } from \"react\";\r\n\r\nexport const useBroadcastChannel = (channelName: string) => {\r\n const [message, setMessage] = useState(null);\r\n const channelRef = useRef<BroadcastChannel | null>(null);\r\n\r\n useEffect(() => {\r\n // Create channel only once, inside useEffect\r\n if (!channelRef.current && typeof window !== \"undefined\") {\r\n channelRef.current = new BroadcastChannel(channelName);\r\n }\r\n\r\n const channel = channelRef.current;\r\n if (!channel) return;\r\n\r\n const handleMessage = (event: MessageEvent) => {\r\n setMessage(event.data);\r\n };\r\n\r\n channel.onmessage = handleMessage;\r\n\r\n // Clean up the channel when the component unmounts\r\n return () => {\r\n if (channelRef.current) {\r\n channelRef.current.close();\r\n channelRef.current = null;\r\n }\r\n };\r\n }, [channelName]);\r\n\r\n const sendMessage = useCallback((msg: unknown) => {\r\n if (channelRef.current) {\r\n channelRef.current.postMessage(msg);\r\n }\r\n }, []);\r\n\r\n return { message, sendMessage };\r\n};\r\n","import { useState, useEffect, useCallback, useContext, useRef } from \"react\";\r\nimport { RouterContext } from \"../../../runtime/client/RouterContext\";\r\nimport { getWindowData, getRouterData } from \"../../../runtime/client/window-data\";\r\nimport { ROUTER_NAVIGATE_KEY } from \"../../../runtime/client/constants\";\r\n\r\nexport interface Router {\r\n /**\r\n * Navigate to a new route.\r\n * @param url - The URL to navigate to (e.g., \"/about\" or \"/blog/[slug]\" with params)\r\n * @param options - Navigation options\r\n */\r\n push: (url: string, options?: { revalidate?: boolean }) => Promise<void>;\r\n \r\n /**\r\n * Replace the current route without adding to history.\r\n * @param url - The URL to navigate to\r\n * @param options - Navigation options\r\n */\r\n replace: (url: string, options?: { revalidate?: boolean }) => Promise<void>;\r\n \r\n /**\r\n * Go back in the browser history.\r\n */\r\n back: () => void;\r\n \r\n /**\r\n * Refresh the current route data by revalidating.\r\n */\r\n refresh: () => Promise<void>;\r\n \r\n /**\r\n * Current pathname (e.g., \"/blog/my-post\")\r\n */\r\n pathname: string;\r\n \r\n /**\r\n * Query parameters from the URL (e.g., ?id=123&name=test)\r\n * Alias for searchParams for backward compatibility\r\n */\r\n query: Record<string, string>;\r\n \r\n /**\r\n * Search parameters from the URL (e.g., ?id=123&name=test)\r\n */\r\n searchParams: Record<string, unknown>;\r\n \r\n /**\r\n * Dynamic route parameters (e.g., { slug: \"my-post\" } for /blog/[slug])\r\n */\r\n params: Record<string, string>;\r\n}\r\n\r\n/**\r\n * Hook to access router functionality and current route information.\r\n * \r\n * Provides methods to navigate programmatically and access current route data.\r\n * \r\n * @returns Router object with navigation methods and route information\r\n * \r\n * @example\r\n * ```tsx\r\n * function MyComponent() {\r\n * const router = useRouter();\r\n * \r\n * const handleClick = () => {\r\n * router.push(\"/about\");\r\n * };\r\n * \r\n * return (\r\n * <div>\r\n * <p>Current path: {router.pathname}</p>\r\n * <p>Params: {JSON.stringify(router.params)}</p>\r\n * <button onClick={handleClick}>Go to About</button>\r\n * </div>\r\n * );\r\n * }\r\n * ```\r\n * \r\n * @example\r\n * ```tsx\r\n * // Navigate with dynamic params\r\n * router.push(\"/blog/my-post\");\r\n * \r\n * // Replace current route\r\n * router.replace(\"/login\");\r\n * \r\n * // Refresh current route data\r\n * await router.refresh();\r\n * ```\r\n */\r\nexport function useRouter(): Router {\r\n // Try to get context, but don't throw if it's not available (SSR)\r\n const context = useContext(RouterContext);\r\n const navigate = context?.navigate;\r\n \r\n // Use a ref to store navigate so we can access it in callbacks even if context updates\r\n // Initialize with current navigate value\r\n const navigateRef = useRef(navigate);\r\n \r\n // Update ref when navigate changes (this ensures we always have the latest value)\r\n useEffect(() => {\r\n navigateRef.current = navigate;\r\n }, [navigate]);\r\n \r\n const [routeData, setRouteData] = useState(() => {\r\n // During SSR, return empty/default values\r\n if (typeof window === \"undefined\") {\r\n return {\r\n pathname: \"\",\r\n query: {},\r\n searchParams: {},\r\n params: {},\r\n };\r\n }\r\n \r\n // On client, get data from window\r\n const data = getWindowData();\r\n const routerData = getRouterData();\r\n \r\n // Parse search params from URL if routerData is not available\r\n const searchParams = routerData?.searchParams || parseQueryString(window.location.search);\r\n \r\n return {\r\n pathname: routerData?.pathname || data?.pathname || window.location.pathname,\r\n query: searchParams as Record<string, string>, // For backward compatibility\r\n searchParams: searchParams,\r\n params: routerData?.params || data?.params || {},\r\n };\r\n });\r\n\r\n // Listen for route changes (only on client)\r\n useEffect(() => {\r\n if (typeof window === \"undefined\") return;\r\n \r\n const handleDataRefresh = () => {\r\n const data = getWindowData();\r\n const routerData = getRouterData();\r\n const currentPathname = window.location.pathname;\r\n const currentSearch = window.location.search;\r\n \r\n const searchParams = routerData?.searchParams || parseQueryString(currentSearch);\r\n \r\n setRouteData({\r\n pathname: routerData?.pathname || data?.pathname || currentPathname,\r\n query: searchParams as Record<string, string>, // For backward compatibility\r\n searchParams: searchParams,\r\n params: routerData?.params || data?.params || {},\r\n });\r\n };\r\n\r\n // Listen for navigation events\r\n window.addEventListener(\"fw-data-refresh\", handleDataRefresh);\r\n window.addEventListener(\"fw-router-data-refresh\", handleDataRefresh);\r\n \r\n // Also listen for popstate (browser back/forward)\r\n const handlePopState = () => {\r\n handleDataRefresh();\r\n };\r\n window.addEventListener(\"popstate\", handlePopState);\r\n\r\n return () => {\r\n window.removeEventListener(\"fw-data-refresh\", handleDataRefresh);\r\n window.removeEventListener(\"fw-router-data-refresh\", handleDataRefresh);\r\n window.removeEventListener(\"popstate\", handlePopState);\r\n };\r\n }, []);\r\n\r\n const push = useCallback(\r\n async (url: string, options?: { revalidate?: boolean }) => {\r\n const fullUrl = url.startsWith(\"/\") ? url : `/${url}`;\r\n \r\n /**\r\n * SOLUTION: Multi-source navigate function resolution\r\n * \r\n * During React hydration, RouterContext may not be available immediately.\r\n * We try three sources in order:\r\n * 1. navigateRef.current - Most up-to-date, updated via useEffect\r\n * 2. navigate from context - Direct context access\r\n * 3. window.__LOLY_ROUTER_NAVIGATE__ - Global fallback exposed by AppShell\r\n * \r\n * This ensures SPA navigation works even during hydration timing issues.\r\n */\r\n const getCurrentNavigate = () => {\r\n if (navigateRef.current) return navigateRef.current;\r\n if (navigate) return navigate;\r\n if (typeof window !== \"undefined\" && (window as any)[ROUTER_NAVIGATE_KEY]) {\r\n return (window as any)[ROUTER_NAVIGATE_KEY];\r\n }\r\n return null;\r\n };\r\n \r\n let currentNavigate = getCurrentNavigate();\r\n \r\n if (typeof window === \"undefined\") {\r\n return; // SSR\r\n }\r\n \r\n // Wait for context during hydration (up to 100ms)\r\n if (!currentNavigate) {\r\n for (let i = 0; i < 10; i++) {\r\n await new Promise(resolve => setTimeout(resolve, 10));\r\n currentNavigate = getCurrentNavigate();\r\n if (currentNavigate) break;\r\n }\r\n }\r\n \r\n // Final fallback: full page reload if navigate is still unavailable\r\n if (!currentNavigate) {\r\n window.location.href = fullUrl;\r\n return;\r\n }\r\n \r\n // Check if we're already on this URL (same as link handler)\r\n const currentUrl = window.location.pathname + window.location.search;\r\n if (fullUrl === currentUrl) {\r\n return; // Already on this route, no need to navigate\r\n }\r\n \r\n // Update URL in browser history (same as link handler does)\r\n // This is done BEFORE navigation to match link behavior\r\n window.history.pushState({}, \"\", fullUrl);\r\n \r\n // Navigate using SPA navigation (same as link handler)\r\n // If navigation fails, navigate() will handle the reload internally\r\n await currentNavigate(fullUrl, options);\r\n },\r\n [navigate] // Include navigate in dependencies so it updates when context becomes available\r\n );\r\n\r\n const replace = useCallback(\r\n async (url: string, options?: { revalidate?: boolean }) => {\r\n const fullUrl = url.startsWith(\"/\") ? url : `/${url}`;\r\n \r\n const getCurrentNavigate = () => {\r\n if (navigateRef.current) return navigateRef.current;\r\n if (navigate) return navigate;\r\n if (typeof window !== \"undefined\" && (window as any)[ROUTER_NAVIGATE_KEY]) {\r\n return (window as any)[ROUTER_NAVIGATE_KEY];\r\n }\r\n return null;\r\n };\r\n \r\n let currentNavigate = getCurrentNavigate();\r\n \r\n if (typeof window === \"undefined\") {\r\n return;\r\n }\r\n \r\n if (!currentNavigate) {\r\n for (let i = 0; i < 10; i++) {\r\n await new Promise(resolve => setTimeout(resolve, 10));\r\n currentNavigate = getCurrentNavigate();\r\n if (currentNavigate) break;\r\n }\r\n }\r\n \r\n if (!currentNavigate) {\r\n window.location.replace(fullUrl);\r\n return;\r\n }\r\n \r\n // Update URL in browser history using replace (doesn't add to history)\r\n window.history.replaceState({}, \"\", fullUrl);\r\n \r\n // Navigate using SPA navigation\r\n await currentNavigate(fullUrl, options);\r\n },\r\n [navigate]\r\n );\r\n\r\n const back = useCallback(() => {\r\n if (typeof window !== \"undefined\") {\r\n window.history.back();\r\n }\r\n }, []);\r\n\r\n const refresh = useCallback(async () => {\r\n const currentUrl = typeof window !== \"undefined\" \r\n ? window.location.pathname + window.location.search \r\n : routeData.pathname;\r\n \r\n const getCurrentNavigate = () => {\r\n if (navigateRef.current) return navigateRef.current;\r\n if (navigate) return navigate;\r\n if (typeof window !== \"undefined\" && (window as any)[ROUTER_NAVIGATE_KEY]) {\r\n return (window as any)[ROUTER_NAVIGATE_KEY];\r\n }\r\n return null;\r\n };\r\n \r\n let currentNavigate = getCurrentNavigate();\r\n \r\n if (typeof window === \"undefined\") {\r\n return;\r\n }\r\n \r\n if (!currentNavigate) {\r\n for (let i = 0; i < 10; i++) {\r\n await new Promise(resolve => setTimeout(resolve, 10));\r\n currentNavigate = getCurrentNavigate();\r\n if (currentNavigate) break;\r\n }\r\n }\r\n \r\n if (!currentNavigate) {\r\n window.location.reload();\r\n return;\r\n }\r\n \r\n await currentNavigate(currentUrl, { revalidate: true });\r\n }, [navigate, routeData.pathname]);\r\n\r\n return {\r\n push,\r\n replace,\r\n back,\r\n refresh,\r\n pathname: routeData.pathname,\r\n query: routeData.query,\r\n searchParams: routeData.searchParams,\r\n params: routeData.params,\r\n };\r\n}\r\n\r\n/**\r\n * Parse query string into an object.\r\n * @param search - Query string (e.g., \"?id=123&name=test\")\r\n * @returns Object with query parameters\r\n */\r\nfunction parseQueryString(search: string): Record<string, string> {\r\n const params: Record<string, string> = {};\r\n if (!search || search.length === 0) return params;\r\n \r\n const queryString = search.startsWith(\"?\") ? search.slice(1) : search;\r\n const pairs = queryString.split(\"&\");\r\n \r\n for (const pair of pairs) {\r\n const [key, value] = pair.split(\"=\");\r\n if (key) {\r\n params[decodeURIComponent(key)] = value ? decodeURIComponent(value) : \"\";\r\n }\r\n }\r\n \r\n return params;\r\n}\r\n","import { createContext, useContext } from \"react\";\r\n\r\nexport type NavigateFunction = (\r\n url: string,\r\n options?: { revalidate?: boolean; replace?: boolean }\r\n) => Promise<void>;\r\n\r\nexport interface RouterContextValue {\r\n navigate: NavigateFunction;\r\n}\r\n\r\nexport const RouterContext = createContext<RouterContextValue | null>(null);\r\n\r\nexport function useRouterContext(): RouterContextValue {\r\n const context = useContext(RouterContext);\r\n if (!context) {\r\n throw new Error(\r\n \"useRouter must be used within a RouterProvider. Make sure you're using it inside a Loly app.\"\r\n );\r\n }\r\n return context;\r\n}\r\n","// Client-side constants (hardcoded to avoid alias resolution issues in Rspack)\r\nexport const WINDOW_DATA_KEY = \"__FW_DATA__\";\r\nexport const ROUTER_DATA_KEY = \"__LOLY_ROUTER_DATA__\";\r\nexport const APP_CONTAINER_ID = \"__app\";\r\n// Global key for navigate function fallback (exposed by AppShell for hydration timing issues)\r\nexport const ROUTER_NAVIGATE_KEY = \"__LOLY_ROUTER_NAVIGATE__\";\r\n\r\n","import { WINDOW_DATA_KEY, ROUTER_DATA_KEY } from \"./constants\";\r\nimport type { InitialData, RouterData } from \"./types\";\r\n\r\nconst LAYOUT_PROPS_KEY = \"__FW_LAYOUT_PROPS__\";\r\n\r\nexport function getWindowData(): InitialData | null {\r\n if (typeof window === \"undefined\") {\r\n return null;\r\n }\r\n return (window[WINDOW_DATA_KEY] as InitialData | undefined) ?? null;\r\n}\r\n\r\n/**\r\n * Gets preserved layout props from window storage.\r\n * Layout props are preserved across SPA navigations when layout hooks are skipped.\r\n */\r\nexport function getPreservedLayoutProps(): Record<string, any> | null {\r\n if (typeof window === \"undefined\") {\r\n return null;\r\n }\r\n return ((window as any)[LAYOUT_PROPS_KEY] as Record<string, any> | undefined) ?? null;\r\n}\r\n\r\n/**\r\n * Sets preserved layout props in window storage.\r\n * These props are used when layout hooks are skipped in SPA navigation.\r\n */\r\nexport function setPreservedLayoutProps(props: Record<string, any> | null): void {\r\n if (typeof window === \"undefined\") {\r\n return;\r\n }\r\n if (props === null) {\r\n delete (window as any)[LAYOUT_PROPS_KEY];\r\n } else {\r\n (window as any)[LAYOUT_PROPS_KEY] = props;\r\n }\r\n}\r\n\r\nexport function getRouterData(): RouterData | null {\r\n if (typeof window === \"undefined\") {\r\n return null;\r\n }\r\n return (window[ROUTER_DATA_KEY] as RouterData | undefined) ?? null;\r\n}\r\n\r\nexport function setWindowData(data: InitialData): void {\r\n window[WINDOW_DATA_KEY] = data;\r\n \r\n // Dispatch event for components to listen to (e.g. ThemeProvider)\r\n // This ensures components update when navigating in SPA mode\r\n if (typeof window !== \"undefined\") {\r\n window.dispatchEvent(\r\n new CustomEvent(\"fw-data-refresh\", {\r\n detail: { data },\r\n })\r\n );\r\n }\r\n}\r\n\r\nexport function setRouterData(data: RouterData): void {\r\n window[ROUTER_DATA_KEY] = data;\r\n \r\n // Dispatch event for router data updates\r\n if (typeof window !== \"undefined\") {\r\n window.dispatchEvent(\r\n new CustomEvent(\"fw-router-data-refresh\", {\r\n detail: { data },\r\n })\r\n );\r\n }\r\n}\r\n\r\nexport function getCurrentTheme(): string | null {\r\n return getWindowData()?.theme ?? null;\r\n}\r\n\r\n"],"mappings":";AAAA,SAAgB,WAAW,UAAU,QAAQ,mBAAmB;AAEzD,IAAM,sBAAsB,CAAC,gBAAwB;AAC1D,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,IAAI;AAC3C,QAAM,aAAa,OAAgC,IAAI;AAEvD,YAAU,MAAM;AAEd,QAAI,CAAC,WAAW,WAAW,OAAO,WAAW,aAAa;AACxD,iBAAW,UAAU,IAAI,iBAAiB,WAAW;AAAA,IACvD;AAEA,UAAM,UAAU,WAAW;AAC3B,QAAI,CAAC,QAAS;AAEd,UAAM,gBAAgB,CAAC,UAAwB;AAC7C,iBAAW,MAAM,IAAI;AAAA,IACvB;AAEA,YAAQ,YAAY;AAGpB,WAAO,MAAM;AACX,UAAI,WAAW,SAAS;AACtB,mBAAW,QAAQ,MAAM;AACzB,mBAAW,UAAU;AAAA,MACvB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,QAAM,cAAc,YAAY,CAAC,QAAiB;AAChD,QAAI,WAAW,SAAS;AACtB,iBAAW,QAA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,KAAK,IAAI,KAAK,MAAM,GAAG;AACnC,QAAI,KAAK;AACP,aAAO,mBAAmB,GAAG,CAAC,IAAI,QAAQ,mBAAmB,KAAK,IAAI;AAAA,IACxE;AAAA,EACF;AAEA,SAAO;AACT;","names":["useState","useEffect","useCallback","useContext","useRef","useContext","useRef","useEffect","useState","useCallback"]}
|
package/dist/react/sockets.cjs
CHANGED
|
@@ -25,19 +25,26 @@ __export(sockets_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(sockets_exports);
|
|
26
26
|
var import_socket = require("socket.io-client");
|
|
27
27
|
var lolySocket = (namespace, opts) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
if (typeof window === "undefined") {
|
|
29
|
+
throw new Error(
|
|
30
|
+
"[loly:socket] lolySocket can only be called on the client side."
|
|
31
|
+
);
|
|
32
32
|
}
|
|
33
33
|
const normalizedNamespace = namespace.startsWith("/") ? namespace : `/${namespace}`;
|
|
34
|
-
|
|
35
|
-
const socket = (0, import_socket.io)(
|
|
34
|
+
console.log("[loly:socket] Connecting to namespace:", normalizedNamespace, "path:", "/wss");
|
|
35
|
+
const socket = (0, import_socket.io)(normalizedNamespace, {
|
|
36
36
|
path: "/wss",
|
|
37
37
|
transports: ["websocket", "polling"],
|
|
38
38
|
autoConnect: true,
|
|
39
39
|
...opts
|
|
40
40
|
});
|
|
41
|
+
socket.on("connect_error", (error) => {
|
|
42
|
+
console.error("[loly:socket] Connection error:", error.message);
|
|
43
|
+
console.error("[loly:socket] Namespace:", normalizedNamespace);
|
|
44
|
+
});
|
|
45
|
+
socket.on("connect", () => {
|
|
46
|
+
console.log("[loly:socket] \u2705 Connected to namespace:", normalizedNamespace);
|
|
47
|
+
});
|
|
41
48
|
return socket;
|
|
42
49
|
};
|
|
43
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../modules/react/sockets/index.ts"],"sourcesContent":["import { io, ManagerOptions, Socket, SocketOptions } from \"socket.io-client\";\r\n\r\n/**\r\n * Creates a Socket.IO client connection to a specific namespace.\r\n * \r\n * This helper function simplifies Socket.IO client setup by handling:\r\n * - Namespace normalization (ensures leading slash)\r\n * - Base URL resolution (from environment or current origin)\r\n * - Default Socket.IO configuration (path: '/wss', transports: ['websocket', 'polling'])\r\n * \r\n * @param namespace - The namespace to connect to (e.g., '/chat' or 'chat').\r\n * The namespace will be normalized to always start with '/'.\r\n * Must match the namespace pattern defined in your server's WSS routes.\r\n * @param opts - Optional Socket.IO client options that will override the defaults.\r\n * \r\n * @returns A Socket.IO client instance connected to the specified namespace.\r\n * \r\n * @example\r\n * ```ts\r\n * const socket = lolySocket('/chat');\r\n * socket.on('message', (data) => {\r\n * console.log('Received:', data);\r\n * });\r\n * socket.emit('message', { text: 'Hello' });\r\n * ```\r\n */\r\nexport const lolySocket = (\r\n namespace: string,\r\n opts?: Partial<ManagerOptions & SocketOptions>\r\n): Socket => {\r\n //
|
|
1
|
+
{"version":3,"sources":["../../modules/react/sockets/index.ts"],"sourcesContent":["import { io, ManagerOptions, Socket, SocketOptions } from \"socket.io-client\";\r\n\r\n/**\r\n * Creates a Socket.IO client connection to a specific namespace.\r\n * \r\n * This helper function simplifies Socket.IO client setup by handling:\r\n * - Namespace normalization (ensures leading slash)\r\n * - Base URL resolution (from environment or current origin)\r\n * - Default Socket.IO configuration (path: '/wss', transports: ['websocket', 'polling'])\r\n * \r\n * @param namespace - The namespace to connect to (e.g., '/chat' or 'chat').\r\n * The namespace will be normalized to always start with '/'.\r\n * Must match the namespace pattern defined in your server's WSS routes.\r\n * @param opts - Optional Socket.IO client options that will override the defaults.\r\n * \r\n * @returns A Socket.IO client instance connected to the specified namespace.\r\n * \r\n * @example\r\n * ```ts\r\n * const socket = lolySocket('/chat');\r\n * socket.on('message', (data) => {\r\n * console.log('Received:', data);\r\n * });\r\n * socket.emit('message', { text: 'Hello' });\r\n * ```\r\n */\r\nexport const lolySocket = (\r\n namespace: string,\r\n opts?: Partial<ManagerOptions & SocketOptions>\r\n): Socket => {\r\n // SIMPLIFICADO: Siempre usar el origin actual en el navegador\r\n // Socket.IO maneja el namespace automáticamente\r\n if (typeof window === \"undefined\") {\r\n throw new Error(\r\n \"[loly:socket] lolySocket can only be called on the client side.\"\r\n );\r\n }\r\n\r\n const normalizedNamespace = namespace.startsWith(\"/\") ? namespace : `/${namespace}`;\r\n \r\n // Socket.IO: io(namespace, { path: '/wss' })\r\n // Socket.IO usa window.location.origin automáticamente\r\n // El path '/wss' es el endpoint del engine de Socket.IO\r\n // El namespace se maneja en el handshake\r\n \r\n console.log(\"[loly:socket] Connecting to namespace:\", normalizedNamespace, \"path:\", \"/wss\");\r\n\r\n const socket = io(normalizedNamespace, {\r\n path: \"/wss\",\r\n transports: [\"websocket\", \"polling\"],\r\n autoConnect: true,\r\n ...opts,\r\n });\r\n\r\n // Add connection error logging\r\n socket.on(\"connect_error\", (error) => {\r\n console.error(\"[loly:socket] Connection error:\", error.message);\r\n console.error(\"[loly:socket] Namespace:\", normalizedNamespace);\r\n });\r\n \r\n socket.on(\"connect\", () => {\r\n console.log(\"[loly:socket] ✅ Connected to namespace:\", normalizedNamespace);\r\n });\r\n\r\n return socket;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0D;AA0BnD,IAAM,aAAa,CACxB,WACA,SACW;AAGX,MAAI,OAAO,WAAW,aAAa;AACjC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,sBAAsB,UAAU,WAAW,GAAG,IAAI,YAAY,IAAI,SAAS;AAOjF,UAAQ,IAAI,0CAA0C,qBAAqB,SAAS,MAAM;AAE1F,QAAM,aAAS,kBAAG,qBAAqB;AAAA,IACrC,MAAM;AAAA,IACN,YAAY,CAAC,aAAa,SAAS;AAAA,IACnC,aAAa;AAAA,IACb,GAAG;AAAA,EACL,CAAC;AAGD,SAAO,GAAG,iBAAiB,CAAC,UAAU;AACpC,YAAQ,MAAM,mCAAmC,MAAM,OAAO;AAC9D,YAAQ,MAAM,4BAA4B,mBAAmB;AAAA,EAC/D,CAAC;AAED,SAAO,GAAG,WAAW,MAAM;AACzB,YAAQ,IAAI,gDAA2C,mBAAmB;AAAA,EAC5E,CAAC;AAED,SAAO;AACT;","names":[]}
|
package/dist/react/sockets.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
// modules/react/sockets/index.ts
|
|
2
2
|
import { io } from "socket.io-client";
|
|
3
3
|
var lolySocket = (namespace, opts) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
if (typeof window === "undefined") {
|
|
5
|
+
throw new Error(
|
|
6
|
+
"[loly:socket] lolySocket can only be called on the client side."
|
|
7
|
+
);
|
|
8
8
|
}
|
|
9
9
|
const normalizedNamespace = namespace.startsWith("/") ? namespace : `/${namespace}`;
|
|
10
|
-
|
|
11
|
-
const socket = io(
|
|
10
|
+
console.log("[loly:socket] Connecting to namespace:", normalizedNamespace, "path:", "/wss");
|
|
11
|
+
const socket = io(normalizedNamespace, {
|
|
12
12
|
path: "/wss",
|
|
13
13
|
transports: ["websocket", "polling"],
|
|
14
14
|
autoConnect: true,
|
|
15
15
|
...opts
|
|
16
16
|
});
|
|
17
|
+
socket.on("connect_error", (error) => {
|
|
18
|
+
console.error("[loly:socket] Connection error:", error.message);
|
|
19
|
+
console.error("[loly:socket] Namespace:", normalizedNamespace);
|
|
20
|
+
});
|
|
21
|
+
socket.on("connect", () => {
|
|
22
|
+
console.log("[loly:socket] \u2705 Connected to namespace:", normalizedNamespace);
|
|
23
|
+
});
|
|
17
24
|
return socket;
|
|
18
25
|
};
|
|
19
26
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../modules/react/sockets/index.ts"],"sourcesContent":["import { io, ManagerOptions, Socket, SocketOptions } from \"socket.io-client\";\r\n\r\n/**\r\n * Creates a Socket.IO client connection to a specific namespace.\r\n * \r\n * This helper function simplifies Socket.IO client setup by handling:\r\n * - Namespace normalization (ensures leading slash)\r\n * - Base URL resolution (from environment or current origin)\r\n * - Default Socket.IO configuration (path: '/wss', transports: ['websocket', 'polling'])\r\n * \r\n * @param namespace - The namespace to connect to (e.g., '/chat' or 'chat').\r\n * The namespace will be normalized to always start with '/'.\r\n * Must match the namespace pattern defined in your server's WSS routes.\r\n * @param opts - Optional Socket.IO client options that will override the defaults.\r\n * \r\n * @returns A Socket.IO client instance connected to the specified namespace.\r\n * \r\n * @example\r\n * ```ts\r\n * const socket = lolySocket('/chat');\r\n * socket.on('message', (data) => {\r\n * console.log('Received:', data);\r\n * });\r\n * socket.emit('message', { text: 'Hello' });\r\n * ```\r\n */\r\nexport const lolySocket = (\r\n namespace: string,\r\n opts?: Partial<ManagerOptions & SocketOptions>\r\n): Socket => {\r\n //
|
|
1
|
+
{"version":3,"sources":["../../modules/react/sockets/index.ts"],"sourcesContent":["import { io, ManagerOptions, Socket, SocketOptions } from \"socket.io-client\";\r\n\r\n/**\r\n * Creates a Socket.IO client connection to a specific namespace.\r\n * \r\n * This helper function simplifies Socket.IO client setup by handling:\r\n * - Namespace normalization (ensures leading slash)\r\n * - Base URL resolution (from environment or current origin)\r\n * - Default Socket.IO configuration (path: '/wss', transports: ['websocket', 'polling'])\r\n * \r\n * @param namespace - The namespace to connect to (e.g., '/chat' or 'chat').\r\n * The namespace will be normalized to always start with '/'.\r\n * Must match the namespace pattern defined in your server's WSS routes.\r\n * @param opts - Optional Socket.IO client options that will override the defaults.\r\n * \r\n * @returns A Socket.IO client instance connected to the specified namespace.\r\n * \r\n * @example\r\n * ```ts\r\n * const socket = lolySocket('/chat');\r\n * socket.on('message', (data) => {\r\n * console.log('Received:', data);\r\n * });\r\n * socket.emit('message', { text: 'Hello' });\r\n * ```\r\n */\r\nexport const lolySocket = (\r\n namespace: string,\r\n opts?: Partial<ManagerOptions & SocketOptions>\r\n): Socket => {\r\n // SIMPLIFICADO: Siempre usar el origin actual en el navegador\r\n // Socket.IO maneja el namespace automáticamente\r\n if (typeof window === \"undefined\") {\r\n throw new Error(\r\n \"[loly:socket] lolySocket can only be called on the client side.\"\r\n );\r\n }\r\n\r\n const normalizedNamespace = namespace.startsWith(\"/\") ? namespace : `/${namespace}`;\r\n \r\n // Socket.IO: io(namespace, { path: '/wss' })\r\n // Socket.IO usa window.location.origin automáticamente\r\n // El path '/wss' es el endpoint del engine de Socket.IO\r\n // El namespace se maneja en el handshake\r\n \r\n console.log(\"[loly:socket] Connecting to namespace:\", normalizedNamespace, \"path:\", \"/wss\");\r\n\r\n const socket = io(normalizedNamespace, {\r\n path: \"/wss\",\r\n transports: [\"websocket\", \"polling\"],\r\n autoConnect: true,\r\n ...opts,\r\n });\r\n\r\n // Add connection error logging\r\n socket.on(\"connect_error\", (error) => {\r\n console.error(\"[loly:socket] Connection error:\", error.message);\r\n console.error(\"[loly:socket] Namespace:\", normalizedNamespace);\r\n });\r\n \r\n socket.on(\"connect\", () => {\r\n console.log(\"[loly:socket] ✅ Connected to namespace:\", normalizedNamespace);\r\n });\r\n\r\n return socket;\r\n};\r\n"],"mappings":";AAAA,SAAS,UAAiD;AA0BnD,IAAM,aAAa,CACxB,WACA,SACW;AAGX,MAAI,OAAO,WAAW,aAAa;AACjC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,sBAAsB,UAAU,WAAW,GAAG,IAAI,YAAY,IAAI,SAAS;AAOjF,UAAQ,IAAI,0CAA0C,qBAAqB,SAAS,MAAM;AAE1F,QAAM,SAAS,GAAG,qBAAqB;AAAA,IACrC,MAAM;AAAA,IACN,YAAY,CAAC,aAAa,SAAS;AAAA,IACnC,aAAa;AAAA,IACb,GAAG;AAAA,EACL,CAAC;AAGD,SAAO,GAAG,iBAAiB,CAAC,UAAU;AACpC,YAAQ,MAAM,mCAAmC,MAAM,OAAO;AAC9D,YAAQ,MAAM,4BAA4B,mBAAmB;AAAA,EAC/D,CAAC;AAED,SAAO,GAAG,WAAW,MAAM;AACzB,YAAQ,IAAI,gDAA2C,mBAAmB;AAAA,EAC5E,CAAC;AAED,SAAO;AACT;","names":[]}
|