@mindees/router 0.12.0 โ†’ 0.14.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/README.md CHANGED
@@ -6,15 +6,17 @@ Zod / Valibot / ArkType schema), and **fine-grained reactive route state** with
6
6
  selector-based re-render isolation. A modern, type-safe alternative to Expo
7
7
  Router and React Router for TypeScript cross-platform apps.
8
8
 
9
- > **Status: ๐Ÿงช Experimental (Phase 6 โ€” Router I + Phase 7 โ€” Router II).** The
9
+ > **Status: ๐Ÿงช Experimental (pre-1.0).** The
10
10
  > typed routing core (typed params, Standard Schema search validation, the
11
11
  > signals-native router, typed + relative navigation, dynamic reconfiguration,
12
12
  > memory + browser history), **render integration** (`createRouterView` โ€”
13
- > fine-grained, layout-preserving nested rendering; typed `createLink`), and
14
- > **data/guards/transitions** (SWR loaders + `preload`/`invalidate`, navigation
15
- > guards, web view transitions) are implemented and tested. The global typed
16
- > route registry and file-based route scanning are a later phase โ€” see
17
- > [ROADMAP](../../ROADMAP.md).
13
+ > fine-grained, layout-preserving nested rendering; typed `createLink`; bound
14
+ > `Link` + `useRouter`/`useParams`/`useSearch`/`usePathname` hooks),
15
+ > **data/guards/transitions** (SWR loaders + `preload`/`invalidate`,
16
+ > auto-prefetch links, navigation guards, web view transitions), and
17
+ > **file-based routing** (`createFileRouter` / `routesFromModules` โ€” Expo-style
18
+ > conventions, no hand-written route config) are implemented and tested. The
19
+ > global typed route registry is a later phase โ€” see [ROADMAP](../../ROADMAP.md).
18
20
 
19
21
  ## Install
20
22
 
@@ -30,6 +32,8 @@ pnpm add @mindees/router
30
32
  | Typed **search** params | โœ… via Standard Schema | โŒ not typed | โŒ raw `URLSearchParams` |
31
33
  | Validation lock-in | โœ… none โ€” any Standard Schema (Zod/Valibot/ArkType) | โ€” | โ€” |
32
34
  | Reactivity | โœ… fine-grained signals; select a slice, re-run on *that* change | โš ๏ธ global-vs-local re-render footgun | React renders |
35
+ | File-based routing | โœ… `createFileRouter` (Expo-style conventions) **or** explicit config | โœ… filesystem-only | โš ๏ธ optional plugin |
36
+ | Auto-prefetch links | โœ… `<Link>` warms loaders on intent (hover / press-in / focus) | โŒ manual `router.prefetch` only | โš ๏ธ manual |
33
37
  | Build/dev-server required for types | โŒ pure TypeScript inference | โœ… dev server | โœ… typegen step |
34
38
 
35
39
  Relative navigation (`navigate('./edit')`, `'../'`) and `#fragment` targets are
@@ -132,6 +136,45 @@ type D = PathParams<'/about'> // {}
132
136
 
133
137
  No generated `.d.ts`, no dev server, no stale type files โ€” just TypeScript.
134
138
 
139
+ ## File-based routing (Expo-style conventions)
140
+
141
+ Prefer filesystem conventions to an explicit config? `createFileRouter` turns a
142
+ module map into a router using the same conventions Expo Router uses โ€” feeding
143
+ Quantum's better core (validated/typed params, loaders, re-render isolation):
144
+
145
+ ```ts
146
+ import { createFileRouter, createBrowserHistory } from '@mindees/router'
147
+
148
+ // web (Vite): a glob; native: a generated table โ€” either way, no hand-written config
149
+ const modules = import.meta.glob('./app/**/*.tsx', { eager: true })
150
+ const router = createFileRouter(modules, { history: createBrowserHistory() })
151
+ ```
152
+
153
+ Conventions (file path โ†’ route): `index` โ†’ the directory's path ยท `[param]` โ†’
154
+ `:param` ยท `[...rest]` โ†’ catch-all (`:rest*`) ยท `(group)` โ†’ a layout group that
155
+ doesn't affect the URL ยท `_layout` โ†’ a layout that wraps the directory (renders
156
+ its outlet) ยท `+not-found` โ†’ the fallback route. Each module's `default` export is
157
+ the screen; named exports (`loader`, `loaderDeps`, `searchSchema`, `staleTime`,
158
+ `meta`) configure the route. `routesFromModules` returns the route table directly
159
+ if you'd rather build the router yourself.
160
+
161
+ ## Hooks + a bound `<Link>`
162
+
163
+ Resolve the active router without prop-drilling โ€” the familiar Expo Router surface
164
+ on Quantum's fine-grained, validated core. The hooks return reactive **accessors**
165
+ (call them inside JSX/effects), so reads stay fine-grained:
166
+
167
+ ```ts
168
+ import { Link, useRouter, useParams, useSearch, usePathname } from '@mindees/router'
169
+
170
+ const router = useRouter() // throws if no router has been created
171
+ const params = useParams() // () => Record<string, string>
172
+ const search = useSearch() // () => validated search params
173
+ const pathname = usePathname() // () => string, re-render isolated
174
+
175
+ Link({ to: '/posts/:id', params: { id: '42' }, children: 'Open' })
176
+ ```
177
+
135
178
  ## Data, guards & transitions
136
179
 
137
180
  ```ts
@@ -168,10 +211,12 @@ transparent no-op outside a DOM (SSR / native).
168
211
  ## API surface
169
212
 
170
213
  - **Render (Router II)** โ€” `createRouterView`, `createLink`, `RouterViewOptions`,
171
- `LinkProps`, `LinkComponent`, `LinkOptions`, `RouteComponentProps`.
214
+ `LinkProps`, `LinkComponent`, `LinkOptions`, `PrefetchMode`, `RouteComponentProps`.
215
+ - **File-based routing** โ€” `createFileRouter`, `routesFromModules`, `RouteModule`.
216
+ - **Hooks** โ€” `useRouter`, `useParams`, `useSearch`, `usePathname`, bound `Link`.
172
217
  - **Data / guards / transitions** โ€” route `loader` / `loaderDeps` / `staleTime`,
173
218
  `router.loaderData` / `invalidate` / `preload`, `LoaderContext`, `LoaderData`,
174
- `LoaderFn`, `LoaderStatus`; `BeforeNavigate`, `NavigateOptions` (`force`,
219
+ `LoaderDepsFn`, `LoaderFn`, `LoaderStatus`; `BeforeNavigate`, `NavigateOptions` (`force`,
175
220
  `viewTransition`), `CreateRouterOptions` (`beforeNavigate`, `viewTransitions`).
176
221
  - **Router** โ€” `createRouter`, `Router`, `RouteRecord` (with `children` for
177
222
  nesting), `RouteMatch`, `RouterState` (with `matches` chain), `NavTarget`,
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ import { Maturity, NotImplementedError, PackageInfo, notImplemented } from "@min
14
14
  /** The npm package name. */
15
15
  declare const name = "@mindees/router";
16
16
  /** The package version. All `@mindees/*` packages share one locked version line. */
17
- declare const VERSION = "0.12.0";
17
+ declare const VERSION = "0.14.0";
18
18
  /**
19
19
  * Current maturity. Router I (typed params, Standard-Schema search, history, the
20
20
  * signals-native router, selector-isolated state, typed + relative navigation)
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { NotImplementedError, notImplemented } from "@mindees/core";
11
11
  /** The npm package name. */
12
12
  const name = "@mindees/router";
13
13
  /** The package version. All `@mindees/*` packages share one locked version line. */
14
- const VERSION = "0.12.0";
14
+ const VERSION = "0.14.0";
15
15
  /**
16
16
  * Current maturity. Router I (typed params, Standard-Schema search, history, the
17
17
  * signals-native router, selector-isolated state, typed + relative navigation)
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@mindees/router` โ€” **Quantum**, the typed router for MindeesNative.\n *\n * Router I (Phase 6): codegen-free typed path params ({@link PathParams}),\n * Standard-Schema validated search params, a signals-native router with typed +\n * relative navigation and selector-isolated state, and an injectable history\n * (memory + browser). See ADR-0003.\n *\n * Router II (Phase 7): render integration โ€” {@link createRouterView} (nested,\n * fine-grained, layout-preserving) and typed {@link createLink} โ€” plus SWR data\n * loaders (with `AbortSignal`, {@link Router.invalidate}/{@link Router.preload}),\n * navigation guards ({@link BeforeNavigate} cancel/redirect + idempotent\n * navigation), and web view transitions. See ADR-0004 and ADR-0005.\n *\n * Still a later phase (not exported): the global typed route registry and\n * file-based route scanning + bundler plugin. See `STATUS.md`.\n *\n * @module\n */\n\nimport type { Maturity, PackageInfo } from '@mindees/core'\nimport { NotImplementedError, notImplemented } from '@mindees/core'\n\n/** Render integration: nested view + typed links (Router II). */\nexport {\n createLink,\n createRouterView,\n type LinkComponent,\n type LinkOptions,\n type LinkProps,\n type PrefetchMode,\n type RouterViewOptions,\n} from './components'\n/** Loaders + data (SWR). */\nexport type {\n LoaderContext,\n LoaderData,\n LoaderDepsFn,\n LoaderFn,\n LoaderStatus,\n} from './data'\n/** Errors. */\nexport { RouterError, type RouterErrorCode } from './errors'\n/** File-based routing: a module map โ†’ a router (Expo-style conventions). */\nexport { createFileRouter, type RouteModule, routesFromModules } from './file-routes'\n/** History capability. */\nexport {\n createBrowserHistory,\n createHref,\n createMemoryHistory,\n type HistoryListener,\n type MemoryHistoryOptions,\n parseHref,\n type RouterHistory,\n type RouterLocation,\n} from './history'\n/** Ergonomic hooks + a bound Link that resolve the active router. */\nexport { Link, useParams, usePathname, useRouter, useSearch } from './hooks'\n/** Route patterns + codegen-free typed params. */\nexport {\n buildPath,\n compareSpecificity,\n type HasPathParams,\n matchPattern,\n type PathParams,\n parsePattern,\n} from './pattern'\n/** Router. */\nexport {\n type BeforeNavigate,\n type CreateRouterOptions,\n createRouter,\n type NavigateOptions,\n type NavTarget,\n type RouteComponentProps,\n type RouteMatch,\n type RouteRecord,\n type Router,\n type RouterState,\n resolvePath,\n} from './router'\n/** Search (query) params. */\nexport {\n parseQuery,\n type QueryValue,\n safeValidateSearch,\n stringifyQuery,\n type ValidationResult,\n validateSearch,\n} from './search'\n/** Standard Schema โ€” the validator-agnostic interface (vendored, types only). */\nexport type { StandardSchemaV1 } from './standard-schema'\n\n/** The npm package name. */\nexport const name = '@mindees/router'\n\n/** The package version. All `@mindees/*` packages share one locked version line. */\nexport const VERSION = '0.12.0'\n\n/**\n * Current maturity. Router I (typed params, Standard-Schema search, history, the\n * signals-native router, selector-isolated state, typed + relative navigation)\n * and Router II (nested rendering, typed links, SWR loaders, navigation guards,\n * view transitions) are implemented and tested. The global typed route registry\n * and file-based route scanning are a later phase โ€” see `STATUS.md`.\n */\nexport const maturity: Maturity = 'experimental'\n\n/** Static identity + maturity metadata for this package. */\nexport const info: PackageInfo = { name, version: VERSION, maturity }\n\nexport type { Maturity, PackageInfo }\nexport { NotImplementedError, notImplemented }\n"],"mappings":";;;;;;;;;;;AA8FA,MAAa,OAAO;;AAGpB,MAAa,UAAU;;;;;;;;AASvB,MAAa,WAAqB;;AAGlC,MAAa,OAAoB;CAAE;CAAM,SAAS;CAAS;AAAS"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@mindees/router` โ€” **Quantum**, the typed router for MindeesNative.\n *\n * Router I (Phase 6): codegen-free typed path params ({@link PathParams}),\n * Standard-Schema validated search params, a signals-native router with typed +\n * relative navigation and selector-isolated state, and an injectable history\n * (memory + browser). See ADR-0003.\n *\n * Router II (Phase 7): render integration โ€” {@link createRouterView} (nested,\n * fine-grained, layout-preserving) and typed {@link createLink} โ€” plus SWR data\n * loaders (with `AbortSignal`, {@link Router.invalidate}/{@link Router.preload}),\n * navigation guards ({@link BeforeNavigate} cancel/redirect + idempotent\n * navigation), and web view transitions. See ADR-0004 and ADR-0005.\n *\n * Still a later phase (not exported): the global typed route registry and\n * file-based route scanning + bundler plugin. See `STATUS.md`.\n *\n * @module\n */\n\nimport type { Maturity, PackageInfo } from '@mindees/core'\nimport { NotImplementedError, notImplemented } from '@mindees/core'\n\n/** Render integration: nested view + typed links (Router II). */\nexport {\n createLink,\n createRouterView,\n type LinkComponent,\n type LinkOptions,\n type LinkProps,\n type PrefetchMode,\n type RouterViewOptions,\n} from './components'\n/** Loaders + data (SWR). */\nexport type {\n LoaderContext,\n LoaderData,\n LoaderDepsFn,\n LoaderFn,\n LoaderStatus,\n} from './data'\n/** Errors. */\nexport { RouterError, type RouterErrorCode } from './errors'\n/** File-based routing: a module map โ†’ a router (Expo-style conventions). */\nexport { createFileRouter, type RouteModule, routesFromModules } from './file-routes'\n/** History capability. */\nexport {\n createBrowserHistory,\n createHref,\n createMemoryHistory,\n type HistoryListener,\n type MemoryHistoryOptions,\n parseHref,\n type RouterHistory,\n type RouterLocation,\n} from './history'\n/** Ergonomic hooks + a bound Link that resolve the active router. */\nexport { Link, useParams, usePathname, useRouter, useSearch } from './hooks'\n/** Route patterns + codegen-free typed params. */\nexport {\n buildPath,\n compareSpecificity,\n type HasPathParams,\n matchPattern,\n type PathParams,\n parsePattern,\n} from './pattern'\n/** Router. */\nexport {\n type BeforeNavigate,\n type CreateRouterOptions,\n createRouter,\n type NavigateOptions,\n type NavTarget,\n type RouteComponentProps,\n type RouteMatch,\n type RouteRecord,\n type Router,\n type RouterState,\n resolvePath,\n} from './router'\n/** Search (query) params. */\nexport {\n parseQuery,\n type QueryValue,\n safeValidateSearch,\n stringifyQuery,\n type ValidationResult,\n validateSearch,\n} from './search'\n/** Standard Schema โ€” the validator-agnostic interface (vendored, types only). */\nexport type { StandardSchemaV1 } from './standard-schema'\n\n/** The npm package name. */\nexport const name = '@mindees/router'\n\n/** The package version. All `@mindees/*` packages share one locked version line. */\nexport const VERSION = '0.14.0'\n\n/**\n * Current maturity. Router I (typed params, Standard-Schema search, history, the\n * signals-native router, selector-isolated state, typed + relative navigation)\n * and Router II (nested rendering, typed links, SWR loaders, navigation guards,\n * view transitions) are implemented and tested. The global typed route registry\n * and file-based route scanning are a later phase โ€” see `STATUS.md`.\n */\nexport const maturity: Maturity = 'experimental'\n\n/** Static identity + maturity metadata for this package. */\nexport const info: PackageInfo = { name, version: VERSION, maturity }\n\nexport type { Maturity, PackageInfo }\nexport { NotImplementedError, notImplemented }\n"],"mappings":";;;;;;;;;;;AA8FA,MAAa,OAAO;;AAGpB,MAAa,UAAU;;;;;;;;AASvB,MAAa,WAAqB;;AAGlC,MAAa,OAAoB;CAAE;CAAM,SAAS;CAAS;AAAS"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindees/router",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Quantum โ€” the typed, signals-native router for MindeesNative: codegen-free typed path params, Standard Schema validated search params, and selector-isolated reactive route state.",
5
5
  "keywords": [
6
6
  "router",
@@ -35,13 +35,13 @@
35
35
  "directory": "packages/router"
36
36
  },
37
37
  "dependencies": {
38
- "@mindees/core": "0.12.0"
38
+ "@mindees/core": "0.14.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "happy-dom": "20.9.0",
42
42
  "valibot": "1.4.1",
43
43
  "zod": "4.4.3",
44
- "@mindees/renderer": "0.12.0"
44
+ "@mindees/renderer": "0.14.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsdown",