fibrae 0.3.0 → 0.3.2

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.
Files changed (97) hide show
  1. package/dist/atom-utils.d.ts +52 -0
  2. package/dist/atom-utils.js +64 -0
  3. package/dist/atom-utils.js.map +1 -0
  4. package/dist/cli/build.js +2 -2
  5. package/dist/cli/build.js.map +1 -1
  6. package/dist/cli/html.d.ts +6 -0
  7. package/dist/cli/html.js +20 -26
  8. package/dist/cli/html.js.map +1 -1
  9. package/dist/cli/vite-plugin.js +41 -2
  10. package/dist/cli/vite-plugin.js.map +1 -1
  11. package/dist/components.d.ts +3 -3
  12. package/dist/components.js +3 -1
  13. package/dist/components.js.map +1 -1
  14. package/dist/core.js +37 -10
  15. package/dist/core.js.map +1 -1
  16. package/dist/dom.d.ts +22 -3
  17. package/dist/dom.js +100 -5
  18. package/dist/dom.js.map +1 -1
  19. package/dist/fiber-commit.d.ts +2 -0
  20. package/dist/fiber-commit.js +179 -40
  21. package/dist/fiber-commit.js.map +1 -1
  22. package/dist/fiber-render.js +13 -27
  23. package/dist/fiber-render.js.map +1 -1
  24. package/dist/fiber-update.d.ts +1 -1
  25. package/dist/fiber-update.js +33 -12
  26. package/dist/fiber-update.js.map +1 -1
  27. package/dist/h.d.ts +65 -10
  28. package/dist/h.js +98 -22
  29. package/dist/h.js.map +1 -1
  30. package/dist/head.d.ts +64 -0
  31. package/dist/head.js +257 -0
  32. package/dist/head.js.map +1 -0
  33. package/dist/hydration-dev.d.ts +24 -0
  34. package/dist/hydration-dev.js +138 -0
  35. package/dist/hydration-dev.js.map +1 -0
  36. package/dist/index.d.ts +6 -2
  37. package/dist/index.js +5 -2
  38. package/dist/index.js.map +1 -1
  39. package/dist/jsx-runtime/index.d.ts +288 -8
  40. package/dist/jsx-runtime/index.js +2 -0
  41. package/dist/jsx-runtime/index.js.map +1 -1
  42. package/dist/live/client.js +4 -4
  43. package/dist/live/client.js.map +1 -1
  44. package/dist/live/server.js.map +1 -1
  45. package/dist/live/sse-stream.js +2 -2
  46. package/dist/live/sse-stream.js.map +1 -1
  47. package/dist/mdx/index.d.ts +125 -0
  48. package/dist/mdx/index.js +137 -0
  49. package/dist/mdx/index.js.map +1 -0
  50. package/dist/mdx/parse.d.ts +42 -0
  51. package/dist/mdx/parse.js +147 -0
  52. package/dist/mdx/parse.js.map +1 -0
  53. package/dist/mdx/render.d.ts +24 -0
  54. package/dist/mdx/render.js +261 -0
  55. package/dist/mdx/render.js.map +1 -0
  56. package/dist/router/Form.d.ts +90 -0
  57. package/dist/router/Form.js +166 -0
  58. package/dist/router/Form.js.map +1 -0
  59. package/dist/router/History.d.ts +2 -2
  60. package/dist/router/History.js.map +1 -1
  61. package/dist/router/Link.d.ts +27 -32
  62. package/dist/router/Link.js +56 -98
  63. package/dist/router/Link.js.map +1 -1
  64. package/dist/router/Navigator.d.ts +49 -44
  65. package/dist/router/Navigator.js +57 -104
  66. package/dist/router/Navigator.js.map +1 -1
  67. package/dist/router/Route.d.ts +8 -4
  68. package/dist/router/Route.js +10 -2
  69. package/dist/router/Route.js.map +1 -1
  70. package/dist/router/Router.d.ts +10 -10
  71. package/dist/router/Router.js +38 -23
  72. package/dist/router/Router.js.map +1 -1
  73. package/dist/router/RouterBuilder.d.ts +69 -6
  74. package/dist/router/RouterBuilder.js +23 -0
  75. package/dist/router/RouterBuilder.js.map +1 -1
  76. package/dist/router/RouterOutlet.js +63 -45
  77. package/dist/router/RouterOutlet.js.map +1 -1
  78. package/dist/router/index.d.ts +10 -3
  79. package/dist/router/index.js +5 -2
  80. package/dist/router/index.js.map +1 -1
  81. package/dist/router/register.d.ts +37 -0
  82. package/dist/router/register.js +18 -0
  83. package/dist/router/register.js.map +1 -0
  84. package/dist/router/utils.d.ts +2 -2
  85. package/dist/runtime.d.ts +1 -1
  86. package/dist/server.js +7 -3
  87. package/dist/server.js.map +1 -1
  88. package/dist/shared.d.ts +36 -6
  89. package/dist/shared.js +12 -2
  90. package/dist/shared.js.map +1 -1
  91. package/dist/tracking.d.ts +3 -2
  92. package/dist/tracking.js +4 -1
  93. package/dist/tracking.js.map +1 -1
  94. package/dist/transition.d.ts +51 -0
  95. package/dist/transition.js +46 -0
  96. package/dist/transition.js.map +1 -0
  97. package/package.json +16 -3
@@ -1,22 +1,47 @@
1
1
  /**
2
- * Navigator service - type-safe route-aware navigation.
2
+ * Navigator service - path-based navigation.
3
3
  *
4
- * Provides route-aware navigation on top of History:
5
- * - nav.go("routeName", { path: {...}, searchParams: {...} })
4
+ * Provides navigation on top of History:
5
+ * - nav.go("/posts/42") push to history
6
+ * - nav.go("/posts/42", { replace: true, search: { sort: "date" } })
6
7
  * - nav.back, nav.forward
7
- * - nav.isActive("routeName", params) for active link detection
8
8
  * - currentRoute Atom reflects matched route info
9
+ * - currentPathname for active link detection
9
10
  *
10
- * Design: Navigator uses History internally but provides route-aware API.
11
- * It knows about routes and can build URLs from route names.
11
+ * Design: Navigator uses History internally but provides a higher-level API.
12
+ * Route matching is reactive via History location subscription.
12
13
  */
13
14
  import * as Effect from "effect/Effect";
14
15
  import * as Context from "effect/Context";
15
16
  import * as Layer from "effect/Layer";
16
17
  import * as Option from "effect/Option";
18
+ import * as Schema from "effect/Schema";
17
19
  import { Atom, Registry as AtomRegistry } from "@effect-atom/atom";
18
20
  import { History } from "./History.js";
19
21
  import type { Router } from "./Router.js";
22
+ declare const Redirect_base: Schema.TaggedErrorClass<Redirect, "Redirect", {
23
+ readonly _tag: Schema.tag<"Redirect">;
24
+ } & {
25
+ to: typeof Schema.String;
26
+ replace: Schema.optional<typeof Schema.Boolean>;
27
+ }>;
28
+ /**
29
+ * Tagged error for redirecting from loaders, actions, or middleware.
30
+ *
31
+ * Throw this from a loader to redirect before the component renders:
32
+ * ```typescript
33
+ * loader: () => Effect.gen(function* () {
34
+ * const session = yield* getSession()
35
+ * if (!session) return yield* new Redirect({ to: "/login" })
36
+ * return yield* fetchData()
37
+ * })
38
+ * ```
39
+ *
40
+ * The router catches Redirect before the error reaches ErrorBoundary
41
+ * and navigates to the target path.
42
+ */
43
+ export declare class Redirect extends Redirect_base {
44
+ }
20
45
  /**
21
46
  * Current route info - what route is currently matched.
22
47
  */
@@ -30,29 +55,38 @@ export interface CurrentRoute {
30
55
  /**
31
56
  * Navigation options for go().
32
57
  */
33
- export interface NavigateOptions<PathParams extends Record<string, unknown> = Record<string, unknown>, SearchParams extends Record<string, unknown> = Record<string, unknown>> {
34
- readonly path?: PathParams;
35
- readonly searchParams?: SearchParams;
58
+ export interface NavigateOptions {
59
+ readonly search?: Record<string, unknown>;
36
60
  readonly replace?: boolean;
61
+ /** Enable View Transitions API for this navigation (CSS-driven animations) */
62
+ readonly viewTransition?: boolean;
37
63
  }
38
64
  /**
39
65
  * Navigator service interface.
40
- * Provides type-safe navigation by route name.
66
+ * Provides path-based navigation.
41
67
  */
42
68
  export interface NavigatorService {
69
+ /**
70
+ * The router instance used for route matching.
71
+ */
72
+ readonly router: Router;
43
73
  /**
44
74
  * Base path prefix for all routes (e.g., "/ssr/router").
45
75
  * Used for apps mounted at non-root paths.
46
76
  */
47
77
  readonly basePath: string;
78
+ /**
79
+ * Current pathname (without basePath). Updated on navigation.
80
+ */
81
+ readonly currentPathname: string;
48
82
  /**
49
83
  * Current matched route info - updates on navigation.
50
84
  */
51
85
  readonly currentRoute: Atom.Writable<Option.Option<CurrentRoute>, Option.Option<CurrentRoute>>;
52
86
  /**
53
- * Navigate to a route by name with optional params.
87
+ * Navigate to a path.
54
88
  */
55
- readonly go: (routeName: string, options?: NavigateOptions) => Effect.Effect<void, never, AtomRegistry.AtomRegistry>;
89
+ readonly go: (href: string, options?: NavigateOptions) => Effect.Effect<void, never, AtomRegistry.AtomRegistry>;
56
90
  /**
57
91
  * Go back in history.
58
92
  */
@@ -62,10 +96,9 @@ export interface NavigatorService {
62
96
  */
63
97
  readonly forward: Effect.Effect<void, never, AtomRegistry.AtomRegistry>;
64
98
  /**
65
- * Check if a route is currently active.
66
- * Optionally match specific params.
99
+ * Check if a path is currently active.
67
100
  */
68
- readonly isActive: (routeName: string, params?: Record<string, unknown>) => Effect.Effect<boolean, never, AtomRegistry.AtomRegistry>;
101
+ readonly isActive: (href: string) => Effect.Effect<boolean, never, AtomRegistry.AtomRegistry>;
69
102
  }
70
103
  declare const Navigator_base: Context.TagClass<Navigator, "fibrae/Navigator", NavigatorService>;
71
104
  /**
@@ -84,38 +117,10 @@ export interface NavigatorOptions {
84
117
  * Create a Navigator layer for the given router.
85
118
  *
86
119
  * Features:
87
- * - Type-safe navigation by route name
88
- * - Automatic URL building via route.interpolate
120
+ * - Path-based navigation
89
121
  * - Tracks current matched route in an Atom
90
122
  * - Delegates to History for actual navigation
91
123
  * - Supports basePath for apps mounted at non-root paths
92
124
  */
93
125
  export declare function NavigatorLive(router: Router, navigatorOptions?: NavigatorOptions): Layer.Layer<Navigator, never, History | AtomRegistry.AtomRegistry>;
94
- /**
95
- * Create a typed go() function constrained to valid route names.
96
- *
97
- * Usage:
98
- * ```typescript
99
- * const go = createGo(AppRouter);
100
- * yield* go("posts"); // OK
101
- * yield* go("typo"); // compile-time error!
102
- * ```
103
- */
104
- export declare function createGo<RouteNames extends string>(_router: Router<string, RouteNames>): (routeName: RouteNames, options?: NavigateOptions) => Effect.Effect<void, never, Navigator | AtomRegistry.AtomRegistry>;
105
- /**
106
- * Navigate to a route by name.
107
- */
108
- export declare const go: (routeName: string, options?: NavigateOptions<Record<string, unknown>, Record<string, unknown>> | undefined) => Effect.Effect<void, never, AtomRegistry.AtomRegistry | Navigator>;
109
- /**
110
- * Go back in history.
111
- */
112
- export declare const back: Effect.Effect<void, never, Navigator | AtomRegistry.AtomRegistry>;
113
- /**
114
- * Go forward in history.
115
- */
116
- export declare const forward: Effect.Effect<void, never, Navigator | AtomRegistry.AtomRegistry>;
117
- /**
118
- * Get current route info.
119
- */
120
- export declare const getCurrentRoute: Effect.Effect<Option.Option<CurrentRoute>, never, Navigator | AtomRegistry.AtomRegistry>;
121
126
  export {};
@@ -1,22 +1,47 @@
1
1
  /**
2
- * Navigator service - type-safe route-aware navigation.
2
+ * Navigator service - path-based navigation.
3
3
  *
4
- * Provides route-aware navigation on top of History:
5
- * - nav.go("routeName", { path: {...}, searchParams: {...} })
4
+ * Provides navigation on top of History:
5
+ * - nav.go("/posts/42") push to history
6
+ * - nav.go("/posts/42", { replace: true, search: { sort: "date" } })
6
7
  * - nav.back, nav.forward
7
- * - nav.isActive("routeName", params) for active link detection
8
8
  * - currentRoute Atom reflects matched route info
9
+ * - currentPathname for active link detection
9
10
  *
10
- * Design: Navigator uses History internally but provides route-aware API.
11
- * It knows about routes and can build URLs from route names.
11
+ * Design: Navigator uses History internally but provides a higher-level API.
12
+ * Route matching is reactive via History location subscription.
12
13
  */
13
14
  import * as Effect from "effect/Effect";
14
15
  import * as Context from "effect/Context";
15
16
  import * as Layer from "effect/Layer";
16
17
  import * as Option from "effect/Option";
18
+ import * as Schema from "effect/Schema";
17
19
  import { Atom, Registry as AtomRegistry } from "@effect-atom/atom";
18
20
  import { History } from "./History.js";
19
- import { parseSearchParams, buildSearchString, stripBasePath, findRouteByName, groupBasePath, } from "./utils.js";
21
+ import { parseSearchParams, buildSearchString, stripBasePath } from "./utils.js";
22
+ // =============================================================================
23
+ // Redirect
24
+ // =============================================================================
25
+ /**
26
+ * Tagged error for redirecting from loaders, actions, or middleware.
27
+ *
28
+ * Throw this from a loader to redirect before the component renders:
29
+ * ```typescript
30
+ * loader: () => Effect.gen(function* () {
31
+ * const session = yield* getSession()
32
+ * if (!session) return yield* new Redirect({ to: "/login" })
33
+ * return yield* fetchData()
34
+ * })
35
+ * ```
36
+ *
37
+ * The router catches Redirect before the error reaches ErrorBoundary
38
+ * and navigates to the target path.
39
+ */
40
+ export class Redirect extends Schema.TaggedError()("Redirect", {
41
+ to: Schema.String,
42
+ replace: Schema.optional(Schema.Boolean),
43
+ }) {
44
+ }
20
45
  // =============================================================================
21
46
  // Service Tag
22
47
  // =============================================================================
@@ -28,10 +53,6 @@ export class Navigator extends Context.Tag("fibrae/Navigator")() {
28
53
  // =============================================================================
29
54
  // Helpers
30
55
  // =============================================================================
31
- /**
32
- * Parse search params from URL search string.
33
- */
34
- // parseSearchParams, buildSearchString, stripBasePath imported from ./utils.js
35
56
  /**
36
57
  * Match current location against router and return CurrentRoute.
37
58
  * Returns Effect since route matching uses Schema.decodeUnknown.
@@ -48,8 +69,7 @@ function matchLocation(router, location, basePath = "") {
48
69
  * Create a Navigator layer for the given router.
49
70
  *
50
71
  * Features:
51
- * - Type-safe navigation by route name
52
- * - Automatic URL building via route.interpolate
72
+ * - Path-based navigation
53
73
  * - Tracks current matched route in an Atom
54
74
  * - Delegates to History for actual navigation
55
75
  * - Supports basePath for apps mounted at non-root paths
@@ -63,117 +83,50 @@ export function NavigatorLive(router, navigatorOptions = {}) {
63
83
  const initialLocation = registry.get(history.location);
64
84
  const initialRoute = yield* matchLocation(router, initialLocation, basePath);
65
85
  const currentRouteAtom = Atom.make(initialRoute);
86
+ // Track current pathname (mutable for synchronous access from Link)
87
+ let currentPathname = stripBasePath(initialLocation.pathname, basePath);
66
88
  // Subscribe to location changes to update currentRoute.
67
- // This handles popstate events (browser back/forward) automatically.
68
89
  // Effect.runSync is safe here: matchPath is pure computation with no requirements.
69
90
  const unsubscribe = registry.subscribe(history.location, (location) => {
70
91
  const matched = Effect.runSync(matchLocation(router, location, basePath));
71
92
  registry.set(currentRouteAtom, matched);
93
+ currentPathname = stripBasePath(location.pathname, basePath);
72
94
  });
73
95
  // Cleanup subscription when scope closes
74
96
  yield* Effect.addFinalizer(() => Effect.sync(unsubscribe));
75
97
  const service = {
98
+ router,
76
99
  basePath,
100
+ get currentPathname() {
101
+ return currentPathname;
102
+ },
77
103
  currentRoute: currentRouteAtom,
78
- go: (routeName, navigateOptions = {}) => Effect.gen(function* () {
79
- const found = findRouteByName(router, routeName);
80
- if (Option.isNone(found)) {
81
- yield* Effect.logWarning(`Route not found: ${routeName}`);
82
- return;
104
+ go: (href, options = {}) => Effect.gen(function* () {
105
+ // Validate route exists before navigating
106
+ const matched = yield* router.matchRoute(href);
107
+ if (Option.isNone(matched)) {
108
+ yield* Effect.logWarning(`No route matches path: ${href}`);
83
109
  }
84
- const { route, group } = found.value;
85
- const routeBasePath = groupBasePath(group);
86
- // Build URL from route and params
87
- const pathParams = navigateOptions.path ?? {};
88
- const routePathname = yield* route.interpolate(pathParams);
89
- // Prepend navigator basePath AND route's layout basePath
90
- const pathname = basePath + routeBasePath + routePathname;
91
- const search = navigateOptions.searchParams
92
- ? buildSearchString(navigateOptions.searchParams)
93
- : "";
94
- const url = `${pathname}${search}`;
95
- // Navigate - currentRoute updates automatically via derived atom
96
- if (navigateOptions.replace) {
97
- yield* history.replace(url);
110
+ const searchString = options.search ? buildSearchString(options.search) : "";
111
+ const url = `${basePath}${href}${searchString}`;
112
+ const nav = options.replace ? history.replace(url) : history.push(url);
113
+ if (options.viewTransition && typeof document.startViewTransition === "function") {
114
+ yield* nav;
115
+ document.startViewTransition(async () => {
116
+ await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
117
+ });
98
118
  }
99
119
  else {
100
- yield* history.push(url);
120
+ yield* nav;
101
121
  }
102
- }).pipe(Effect.catchTag("RouteError", (e) => Effect.logWarning(`Navigation failed: ${e.message}`))),
122
+ }),
103
123
  // Back/forward - currentRoute updates automatically when history.location
104
- // changes (popstate handler updates locationAtom, derived atom recomputes)
124
+ // changes (popstate handler updates locationAtom, subscription recomputes)
105
125
  back: history.back,
106
126
  forward: history.forward,
107
- isActive: (routeName, params) => Effect.gen(function* () {
108
- const current = yield* Atom.get(currentRouteAtom);
109
- if (Option.isNone(current)) {
110
- return false;
111
- }
112
- if (current.value.routeName !== routeName) {
113
- return false;
114
- }
115
- // If params provided, check they match
116
- if (params) {
117
- for (const [key, value] of Object.entries(params)) {
118
- if (current.value.params[key] !== value) {
119
- return false;
120
- }
121
- }
122
- }
123
- return true;
124
- }),
127
+ isActive: (href) => Effect.succeed(currentPathname === href),
125
128
  };
126
129
  return service;
127
130
  }));
128
131
  }
129
- // =============================================================================
130
- // Convenience Accessors
131
- // =============================================================================
132
- /**
133
- * Create a typed go() function constrained to valid route names.
134
- *
135
- * Usage:
136
- * ```typescript
137
- * const go = createGo(AppRouter);
138
- * yield* go("posts"); // OK
139
- * yield* go("typo"); // compile-time error!
140
- * ```
141
- */
142
- export function createGo(_router) {
143
- return (routeName, options) => Effect.gen(function* () {
144
- const nav = yield* Navigator;
145
- yield* nav.go(routeName, options);
146
- });
147
- }
148
- /**
149
- * Navigate to a route by name.
150
- */
151
- export const go = (routeName, options) => Effect.gen(function* () {
152
- const nav = yield* Navigator;
153
- yield* nav.go(routeName, options);
154
- });
155
- /**
156
- * Go back in history.
157
- */
158
- /* is-tree-shakable-suppress */
159
- export const back = Effect.gen(function* () {
160
- const nav = yield* Navigator;
161
- yield* nav.back;
162
- });
163
- /**
164
- * Go forward in history.
165
- */
166
- /* is-tree-shakable-suppress */
167
- export const forward = Effect.gen(function* () {
168
- const nav = yield* Navigator;
169
- yield* nav.forward;
170
- });
171
- /**
172
- * Get current route info.
173
- */
174
- /* is-tree-shakable-suppress */
175
- export const getCurrentRoute = Effect.gen(function* () {
176
- const nav = yield* Navigator;
177
- return yield* Atom.get(nav.currentRoute);
178
- });
179
132
  //# sourceMappingURL=Navigator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/router/Navigator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAwB,MAAM,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A2E;YAC3E,IAAI,EAAE,OAAO,CAAC,IAAI;YAElB,OAAO,EAAE,OAAO,CAAC,OAAO;YAExB,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,KAAK,IAAI,CAAC;SAC7D,CAAC;QAEF,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -29,7 +29,7 @@ export declare class RouteError extends RouteError_base {
29
29
  * Represents a single route with path and optional search params validation.
30
30
  * This is immutable data that describes a route.
31
31
  */
32
- export interface Route<Name extends string = string, PathParams extends Record<string, unknown> = Record<string, unknown>, SearchParams extends Record<string, unknown> = Record<string, unknown>> {
32
+ export interface Route<Name extends string = string, Path extends string = never, PathParams extends Record<string, unknown> = Record<string, unknown>, SearchParams extends Record<string, unknown> = Record<string, unknown>> {
33
33
  readonly name: Name;
34
34
  readonly path: string;
35
35
  readonly pathSchema: Option.Option<Schema.Schema<PathParams>>;
@@ -48,15 +48,19 @@ export interface Route<Name extends string = string, PathParams extends Record<s
48
48
  /**
49
49
  * Set search parameter schema for this route.
50
50
  */
51
- readonly setSearchParams: <NewSearch extends Record<string, unknown>>(schema: Schema.Schema<NewSearch>) => Route<Name, PathParams, NewSearch>;
51
+ readonly setSearchParams: <NewSearch extends Record<string, unknown>>(schema: Schema.Schema<NewSearch>) => Route<Name, Path, PathParams, NewSearch>;
52
52
  }
53
53
  /**
54
54
  * Constructor for building routes with different method types.
55
55
  * Supports both static paths and template literal syntax.
56
56
  */
57
57
  export interface RouteConstructor {
58
- <const Name extends string>(name: Name, path: string): Route<Name, {}, {}>;
59
- <const Name extends string>(name: Name): <const T extends readonly any[]>(segments: TemplateStringsArray, ...params: T) => Route<Name, Record<string, unknown>, {}>;
58
+ /** Static path captures Path as literal type. */
59
+ <const Name extends string, const Path extends string>(name: Name, path: Path): Route<Name, Path, {}, {}>;
60
+ /** Static path with param schemas — captures Path + validates params. */
61
+ <const Name extends string, const Path extends string>(name: Name, path: Path, params: Record<string, Schema.Schema.Any>): Route<Name, Path, Record<string, unknown>, {}>;
62
+ /** Template literal syntax — Path is not tracked at the type level. */
63
+ <const Name extends string>(name: Name): <const T extends readonly any[]>(segments: TemplateStringsArray, ...params: T) => Route<Name, never, Record<string, unknown>, {}>;
60
64
  }
61
65
  /**
62
66
  * Route.get("name", "/path") creates a GET route
@@ -113,8 +113,16 @@ function makeRoute(_name, path, pathSchema = Option.none(), searchSchema = Optio
113
113
  * Create a route getter function supporting both static and template literal syntax.
114
114
  */
115
115
  function makeGetter() {
116
- return ((name, path) => {
117
- // Static path case
116
+ return ((name, path, params) => {
117
+ // Static path with param schemas
118
+ if (typeof path === "string" && params) {
119
+ const paramNames = Object.keys(params);
120
+ const pathSchema = paramNames.length > 0
121
+ ? Option.some(Schema.Struct(params))
122
+ : Option.none();
123
+ return makeRoute(name, path, pathSchema);
124
+ }
125
+ // Static path case (no params)
118
126
  if (typeof path === "string") {
119
127
  return makeRoute(name, path);
120
128
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Route.js","sourceRoot":"","sources":["../../src/router/Route.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkB,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAEzF;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,WAAW,EAAc,CAAC,YAAY,EAAE;IAC7E,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC;CAAG;AAqCL;;;;GAIG;AACH,SAAS,iBAAiB,CACxB,QAA8B,EAC9B,OAAyC;IAMzC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAA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e,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;KACpC,CAAC;IACF,OAAO,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AACzC,CAAC"}
@@ -38,28 +38,28 @@ export declare class RouterError extends RouterError_base {
38
38
  * Groups provide namespacing for handler implementation.
39
39
  * RouteNames accumulates route name literal types via .add() for type-safe navigation.
40
40
  */
41
- export interface RouteGroup<Name extends string = string, RouteNames extends string = never> {
41
+ export interface RouteGroup<Name extends string = string, RouteNames extends string = never, RoutePaths extends string = never> {
42
42
  readonly _tag: "RouteGroup";
43
43
  readonly name: Name;
44
44
  readonly routes: readonly Route[];
45
- readonly add: <RName extends string>(route: Route<RName>) => RouteGroup<Name, RouteNames | RName>;
45
+ readonly add: <RName extends string, RPath extends string>(route: Route<RName, RPath>) => RouteGroup<Name, RouteNames | RName, RoutePaths | RPath>;
46
46
  }
47
47
  /**
48
48
  * A layout group wraps routes with a layout component.
49
49
  * The layout component should render <RouterOutlet /> for children.
50
50
  * RouteNames accumulates route name literal types via .add() for type-safe navigation.
51
51
  */
52
- export interface LayoutGroup<Name extends string = string, RouteNames extends string = never> {
52
+ export interface LayoutGroup<Name extends string = string, RouteNames extends string = never, RoutePaths extends string = never> {
53
53
  readonly _tag: "LayoutGroup";
54
54
  readonly name: Name;
55
55
  readonly basePath: string;
56
56
  readonly routes: readonly Route[];
57
- readonly add: <RName extends string>(route: Route<RName>) => LayoutGroup<Name, RouteNames | RName>;
57
+ readonly add: <RName extends string, RPath extends string>(route: Route<RName, RPath>) => LayoutGroup<Name, RouteNames | RName, RoutePaths | RPath>;
58
58
  }
59
59
  /**
60
60
  * Union of group types that can be added to a router.
61
61
  */
62
- export type AnyGroup<Name extends string = string, RouteNames extends string = never> = RouteGroup<Name, RouteNames> | LayoutGroup<Name, RouteNames>;
62
+ export type AnyGroup<Name extends string = string, RouteNames extends string = never, RoutePaths extends string = never> = RouteGroup<Name, RouteNames, RoutePaths> | LayoutGroup<Name, RouteNames, RoutePaths>;
63
63
  /**
64
64
  * Result of matching a route, including any layout wrappers.
65
65
  */
@@ -74,10 +74,10 @@ export interface RouteMatch {
74
74
  * The complete router holding all route groups and enabling route matching.
75
75
  * RouteNames accumulates all route names from added groups for type-safe navigation.
76
76
  */
77
- export interface Router<Name extends string = string, RouteNames extends string = never> {
77
+ export interface Router<Name extends string = string, RouteNames extends string = never, RoutePaths extends string = never> {
78
78
  readonly name: Name;
79
79
  readonly groups: readonly AnyGroup[];
80
- readonly add: <GName extends string, GRouteNames extends string>(group: AnyGroup<GName, GRouteNames>) => Router<Name, RouteNames | GRouteNames>;
80
+ readonly add: <GName extends string, GRouteNames extends string, GRoutePaths extends string>(group: AnyGroup<GName, GRouteNames, GRoutePaths>) => Router<Name, RouteNames | GRouteNames, RoutePaths | GRoutePaths>;
81
81
  /**
82
82
  * Match a pathname against all routes in the router.
83
83
  * Returns the matched route, group name, decoded path parameters,
@@ -90,7 +90,7 @@ export interface Router<Name extends string = string, RouteNames extends string
90
90
  * Routes are added via group.add(route).
91
91
  * Route names accumulate as literal types through the builder chain.
92
92
  */
93
- export declare function group<const Name extends string>(name: Name): RouteGroup<Name, never>;
93
+ export declare function group<const Name extends string>(name: Name): RouteGroup<Name, never, never>;
94
94
  /**
95
95
  * Create a layout group with the given name, base path, and layout component.
96
96
  *
@@ -113,13 +113,13 @@ export declare function group<const Name extends string>(name: Name): RouteGroup
113
113
  * .add(Route.get("settings", "/settings")); // matches /dashboard/settings
114
114
  * ```
115
115
  */
116
- export declare function layout<const Name extends string>(name: Name, basePath: string): LayoutGroup<Name, never>;
116
+ export declare function layout<const Name extends string>(name: Name, basePath: string): LayoutGroup<Name, never, never>;
117
117
  /**
118
118
  * Create a router with the given name.
119
119
  * Groups are added via router.add(group).
120
120
  * Route names accumulate from groups for type-safe navigation.
121
121
  */
122
- export declare function make<const Name extends string>(name: Name): Router<Name, never>;
122
+ export declare function make<const Name extends string>(name: Name): Router<Name, never, never>;
123
123
  /**
124
124
  * Options for server-side rendering layer.
125
125
  */