@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.
@@ -0,0 +1,107 @@
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 solid_js from 'solid-js';
4
+ import { JSX, Accessor } from 'solid-js';
5
+
6
+ /**
7
+ * SolidJS Link Component
8
+ *
9
+ * Provides client-side navigation with prefetching support for SolidJS.
10
+ * Uses functional component pattern without JSX to avoid type conflicts.
11
+ */
12
+
13
+ interface LinkProps {
14
+ href: string;
15
+ prefetch?: boolean | PrefetchStrategy;
16
+ replace?: boolean;
17
+ scroll?: boolean;
18
+ class?: string;
19
+ target?: string;
20
+ rel?: string;
21
+ 'aria-label'?: string;
22
+ onClick?: (e: MouseEvent) => void;
23
+ children?: JSX.Element;
24
+ }
25
+ /**
26
+ * Create props for a Link anchor element
27
+ * Use this with spread operator on an <a> element
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * const linkProps = createLinkProps({ href: '/docs', prefetch: 'intent' });
32
+ * <a {...linkProps}>Docs</a>
33
+ * ```
34
+ */
35
+ declare function createLinkProps(props: LinkProps): {
36
+ href: string;
37
+ class: string | undefined;
38
+ target: string | undefined;
39
+ rel: string | undefined;
40
+ 'aria-label': string | undefined;
41
+ onClick: (e: MouseEvent) => void;
42
+ };
43
+ /**
44
+ * Solid Link action for use with ref
45
+ */
46
+ declare function linkAction(node: HTMLAnchorElement, props: Accessor<{
47
+ href: string;
48
+ prefetch?: boolean | PrefetchStrategy;
49
+ }>): void;
50
+ /**
51
+ * Link component for SolidJS
52
+ * Re-export createLinkProps for component-like usage
53
+ */
54
+ declare const Link: {
55
+ createProps: typeof createLinkProps;
56
+ action: typeof linkAction;
57
+ };
58
+
59
+ /**
60
+ * SolidJS Context for router
61
+ */
62
+ declare const RouterContext: solid_js.Context<Accessor<RouterContextValue>>;
63
+ /**
64
+ * Hook to access router context
65
+ */
66
+ declare function useRouter(): RouterContextValue;
67
+ /**
68
+ * Hook to get current pathname as a signal accessor
69
+ */
70
+ declare function usePathname(): Accessor<string>;
71
+ /**
72
+ * Hook to get current search params
73
+ */
74
+ declare function useSearchParams(): Accessor<URLSearchParams>;
75
+ /**
76
+ * Hook to get route params
77
+ */
78
+ declare function useParams(): Accessor<Record<string, string>>;
79
+ /**
80
+ * Create a router provider for SolidJS
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * import { createRouterProvider } from '@flightdev/router/solid';
85
+ *
86
+ * const { Provider, useRouter } = createRouterProvider();
87
+ *
88
+ * function App() {
89
+ * return (
90
+ * <Provider>
91
+ * <YourApp />
92
+ * </Provider>
93
+ * );
94
+ * }
95
+ * ```
96
+ */
97
+ declare function createRouterProvider(options?: Partial<RouterProviderProps>): {
98
+ Context: solid_js.Context<Accessor<RouterContextValue>>;
99
+ getContext: () => RouterContextValue;
100
+ };
101
+ /**
102
+ * RouterProvider for Solid - use with JSX
103
+ * This is a simplified version that works with Solid's context
104
+ */
105
+ declare const RouterProvider: typeof createRouterProvider;
106
+
107
+ export { Link, PrefetchStrategy, RouterContext, RouterContextValue, RouterProvider, RouterProviderProps, createLinkProps, createRouterProvider, linkAction, useParams, usePathname, useRouter, useSearchParams };