@studiolambda/router 0.1.0 → 1.0.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/matcher-C4dv_pr6.cjs +2 -0
- package/dist/{matcher-CSJ3hjzA.cjs.map → matcher-C4dv_pr6.cjs.map} +1 -1
- package/dist/{matcher-XNPYU-tD.js → matcher-CQObVRFk.js} +22 -17
- package/dist/{matcher-XNPYU-tD.js.map → matcher-CQObVRFk.js.map} +1 -1
- package/dist/router.cjs +1 -1
- package/dist/router.js +1 -1
- package/dist/router_react.cjs +2 -2
- package/dist/router_react.cjs.map +1 -1
- package/dist/router_react.js +180 -135
- package/dist/router_react.js.map +1 -1
- package/dist/src/react/context/NavigationContext.d.ts +1 -1
- package/dist/src/react/context/UrlContext.d.ts +12 -0
- package/dist/src/react/createRouter.d.ts +5 -0
- package/dist/src/react/hooks/useBack.d.ts +7 -1
- package/dist/src/react/hooks/useForward.d.ts +8 -1
- package/dist/src/react/hooks/usePrefetch.d.ts +5 -0
- package/dist/src/react/hooks/useSearchParams.d.ts +9 -5
- package/dist/src/react/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/matcher-CSJ3hjzA.cjs +0 -2
- package/dist/src/react/ExampleMain.d.ts +0 -7
- package/dist/src/react/example.d.ts +0 -1
- package/dist/src/react/examples/Auth.d.ts +0 -11
- package/dist/src/react/examples/HelloWorld.d.ts +0 -5
- package/dist/src/react/examples/Other.d.ts +0 -6
- package/dist/src/react/examples/User.d.ts +0 -6
- package/dist/src/react/test-helpers.d.ts +0 -50
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e){let t=e?.root??{children:new Map};function n(e,n){let r=e.split(`/`).filter(Boolean),i=t;for(let e of r){if(e.startsWith(`*`)){let t=e.length>1?e.slice(1):`*`;i.wildcard||={children:new Map,name:t},i=i.wildcard;continue}if(e.startsWith(`:`)){let t=e.slice(1);i.child||={children:new Map,name:t},i=i.child;continue}let t=i.children.get(e);t||(t={children:new Map},i.children.set(e,t)),i=t}i.handler=n}function r(e){let n=e.split(`/`).filter(Boolean);function r(e,t,i){if(t===n.length)return e.handler?{handler:e.handler,params:i}:null;let a=n[t],o=e.children.get(a);if(o){let e=r(o,t+1,i);if(e)return e}if(e.child&&e.child.name){let n=r(e.child,t+1,{...i,[e.child.name]:a});if(n)return n}if(e.wildcard&&e.wildcard.name&&e.wildcard.handler){let r=n.slice(t).join(`/`);return{handler:e.wildcard.handler,params:{...i,[e.wildcard.name]:r}}}return null}return r(t,0,{})}return{register:n,match:r}}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|
|
2
|
-
//# sourceMappingURL=matcher-CSJ3hjzA.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example application demonstrating the router with lazy-loaded
|
|
3
|
-
* routes, viewport-based prefetching, transition state indicators,
|
|
4
|
-
* and authentication middleware. Uses the `createRouter` builder
|
|
5
|
-
* API for declarative route definition with middleware groups.
|
|
6
|
-
*/
|
|
7
|
-
export default function ExampleApp(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Example authentication middleware component that suspends
|
|
4
|
-
* while verifying credentials. Uses React's `use()` hook to
|
|
5
|
-
* suspend rendering until the auth promise resolves, causing
|
|
6
|
-
* the nearest Suspense boundary to show its fallback.
|
|
7
|
-
*
|
|
8
|
-
* In a real application, this would check session tokens or
|
|
9
|
-
* call an authentication API.
|
|
10
|
-
*/
|
|
11
|
-
export default function Auth({ children }: PropsWithChildren): import('react').ReactNode;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Result returned by `renderHook`. Provides access to the
|
|
4
|
-
* current hook return value and a cleanup function.
|
|
5
|
-
*
|
|
6
|
-
* @typeParam T - The return type of the hook under test.
|
|
7
|
-
*/
|
|
8
|
-
export interface RenderHookResult<T> {
|
|
9
|
-
/**
|
|
10
|
-
* The current return value of the hook. Updated after
|
|
11
|
-
* each render.
|
|
12
|
-
*/
|
|
13
|
-
readonly current: T;
|
|
14
|
-
/**
|
|
15
|
-
* Unmounts the test component and removes it from the
|
|
16
|
-
* DOM. Must be called after each test to avoid leaks.
|
|
17
|
-
*/
|
|
18
|
-
readonly unmount: () => void;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Options for `renderHook`.
|
|
22
|
-
*
|
|
23
|
-
* @typeParam T - The return type of the hook under test.
|
|
24
|
-
*/
|
|
25
|
-
export interface RenderHookOptions {
|
|
26
|
-
/**
|
|
27
|
-
* Optional wrapper component that provides context
|
|
28
|
-
* providers around the hook test component.
|
|
29
|
-
*/
|
|
30
|
-
wrapper?: (props: {
|
|
31
|
-
children: ReactNode;
|
|
32
|
-
}) => ReactNode;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Renders a React hook inside a minimal test component and
|
|
36
|
-
* returns the hook's current value. Mimics the API of
|
|
37
|
-
* `@testing-library/react`'s `renderHook` without requiring
|
|
38
|
-
* that dependency.
|
|
39
|
-
*
|
|
40
|
-
* The hook is rendered inside an `act()` boundary. The
|
|
41
|
-
* returned `current` property always reflects the latest
|
|
42
|
-
* hook return value.
|
|
43
|
-
*
|
|
44
|
-
* @typeParam T - The return type of the hook.
|
|
45
|
-
* @param hook - A function that calls the hook under test
|
|
46
|
-
* and returns its result.
|
|
47
|
-
* @param options - Optional wrapper for context providers.
|
|
48
|
-
* @returns The hook result and an unmount function.
|
|
49
|
-
*/
|
|
50
|
-
export declare function renderHook<T>(hook: () => T, options?: RenderHookOptions): RenderHookResult<T>;
|