@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.
@@ -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,5 +0,0 @@
1
- /**
2
- * Example route component that renders a simple greeting.
3
- * Registered at the root `/` path in the example application.
4
- */
5
- export default function HelloWorld(): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +0,0 @@
1
- /**
2
- * Example route component for the `/other` path. Demonstrates
3
- * a route with prefetch configuration and scroll behavior
4
- * in the example application.
5
- */
6
- export default function Other(): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +0,0 @@
1
- /**
2
- * Example route component for the `/user/:id` path.
3
- * Demonstrates reading dynamic route parameters via the
4
- * `useParams` hook and rendering them in the UI.
5
- */
6
- export default function User(): import("react/jsx-runtime").JSX.Element;
@@ -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>;