@jasonshimmy/custom-elements-runtime 0.0.6 → 0.0.7-beta.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.
- package/dist/custom-elements-runtime.cjs.js +9 -9
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +543 -529
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +9 -9
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/router.d.ts +12 -1
- package/package.json +1 -1
package/dist/router.d.ts
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export interface Route {
|
|
7
7
|
path: string;
|
|
8
|
-
component
|
|
8
|
+
component?: string;
|
|
9
|
+
load?: () => Promise<{
|
|
10
|
+
default: string | HTMLElement | Function;
|
|
11
|
+
}>;
|
|
9
12
|
}
|
|
10
13
|
export interface RouterConfig {
|
|
11
14
|
routes: Route[];
|
|
@@ -16,6 +19,12 @@ export interface RouteState {
|
|
|
16
19
|
params: Record<string, string>;
|
|
17
20
|
query: Record<string, string>;
|
|
18
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Loads a route's component, supporting both static and async.
|
|
24
|
+
* @param route Route object
|
|
25
|
+
* @returns Promise resolving to the component
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveRouteComponent(route: Route): Promise<any>;
|
|
19
28
|
export declare function useRouter(config: RouterConfig): {
|
|
20
29
|
store: {
|
|
21
30
|
subscribe: (listener: (state: object) => void) => void;
|
|
@@ -30,6 +39,7 @@ export declare function useRouter(config: RouterConfig): {
|
|
|
30
39
|
params: Record<string, string>;
|
|
31
40
|
};
|
|
32
41
|
getCurrent: () => object;
|
|
42
|
+
resolveRouteComponent: typeof resolveRouteComponent;
|
|
33
43
|
};
|
|
34
44
|
export declare function initRouter(config: RouterConfig): {
|
|
35
45
|
store: {
|
|
@@ -45,6 +55,7 @@ export declare function initRouter(config: RouterConfig): {
|
|
|
45
55
|
params: Record<string, string>;
|
|
46
56
|
};
|
|
47
57
|
getCurrent: () => object;
|
|
58
|
+
resolveRouteComponent: typeof resolveRouteComponent;
|
|
48
59
|
};
|
|
49
60
|
export declare function matchRouteSSR(routes: Route[], path: string): {
|
|
50
61
|
route: Route | null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jasonshimmy/custom-elements-runtime",
|
|
3
3
|
"description": "A powerful, modern, and lightweight runtime for creating reactive web components with TypeScript",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7-beta.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"web-components",
|