@flightdev/router 0.4.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/LICENSE +21 -0
- package/README.md +488 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.js +765 -0
- package/dist/preact/index.d.ts +77 -0
- package/dist/preact/index.js +654 -0
- package/dist/prefetch-DRp54Q7z.d.ts +373 -0
- package/dist/react/index.d.ts +116 -0
- package/dist/react/index.js +696 -0
- package/dist/solid/index.d.ts +107 -0
- package/dist/solid/index.js +625 -0
- package/dist/svelte/index.d.ts +118 -0
- package/dist/svelte/index.js +595 -0
- package/dist/vue/index.d.ts +147 -0
- package/dist/vue/index.js +658 -0
- package/package.json +95 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { P as PrefetchStrategy, b as RouterProviderProps, a as RouterContextValue } from '../prefetch-DRp54Q7z.js';
|
|
2
|
+
export { L as LinkProps, N as NavigateOptions, d as PrefetchOptions, c as PrefetchPriority, R as RouteParams, S as SearchParams, w as clearPrefetchCache, l as findRoute, o as generatePath, B as getRouterContext, D as initRouter, q as isActive, v as isPrefetched, m as matchRoute, n as navigate, x as observeForPrefetch, p as parseParams, s as prefetch, t as prefetchAll, z as prefetchPages, A as prefetchWhenIdle, r as redirect, y as setupIntentPrefetch, C as subscribe } from '../prefetch-DRp54Q7z.js';
|
|
3
|
+
import * as preact$1 from 'preact';
|
|
4
|
+
import { FunctionComponent, ComponentChildren } from 'preact';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Preact Link Component
|
|
8
|
+
*
|
|
9
|
+
* Provides client-side navigation with prefetching support for Preact.
|
|
10
|
+
* API is nearly identical to React version.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface LinkProps {
|
|
14
|
+
href: string;
|
|
15
|
+
prefetch?: boolean | PrefetchStrategy;
|
|
16
|
+
replace?: boolean;
|
|
17
|
+
scroll?: boolean;
|
|
18
|
+
class?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
target?: string;
|
|
21
|
+
rel?: string;
|
|
22
|
+
'aria-label'?: string;
|
|
23
|
+
onClick?: (e: MouseEvent) => void;
|
|
24
|
+
children?: preact.ComponentChildren;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Preact Link Component
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Link href="/docs" prefetch="intent">Documentation</Link>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare const Link: FunctionComponent<LinkProps>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Preact Context for router
|
|
38
|
+
*/
|
|
39
|
+
declare const RouterContext: preact$1.Context<RouterContextValue>;
|
|
40
|
+
/**
|
|
41
|
+
* Hook to access router context
|
|
42
|
+
*/
|
|
43
|
+
declare function useRouter(): RouterContextValue;
|
|
44
|
+
/**
|
|
45
|
+
* Hook to get current pathname
|
|
46
|
+
*/
|
|
47
|
+
declare function usePathname(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Hook to get current search params
|
|
50
|
+
*/
|
|
51
|
+
declare function useSearchParams(): URLSearchParams;
|
|
52
|
+
/**
|
|
53
|
+
* Hook to get route params
|
|
54
|
+
*/
|
|
55
|
+
declare function useParams(): Record<string, string>;
|
|
56
|
+
interface RouterProviderComponentProps extends Partial<RouterProviderProps> {
|
|
57
|
+
children?: ComponentChildren;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Preact Router Provider
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* import { RouterProvider } from '@flightdev/router/preact';
|
|
65
|
+
*
|
|
66
|
+
* function App() {
|
|
67
|
+
* return (
|
|
68
|
+
* <RouterProvider initialPath="/">
|
|
69
|
+
* <YourApp />
|
|
70
|
+
* </RouterProvider>
|
|
71
|
+
* );
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
declare const RouterProvider: FunctionComponent<RouterProviderComponentProps>;
|
|
76
|
+
|
|
77
|
+
export { Link, PrefetchStrategy, RouterContext, RouterContextValue, RouterProvider, RouterProviderProps, useParams, usePathname, useRouter, useSearchParams };
|