@real-router/types 0.9.0 → 0.11.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.
@@ -40,7 +40,6 @@ interface RouteTreeState<P extends Record<string, unknown> = RouteParams> {
40
40
  }
41
41
 
42
42
  type Unsubscribe = () => void;
43
- type CancelFn = () => void;
44
43
  interface SimpleState<P extends Params = Params> {
45
44
  name: string;
46
45
  params: P;
@@ -82,7 +81,6 @@ interface RouterError extends Error {
82
81
  getField: (key: string) => unknown;
83
82
  toJSON: () => Record<string, unknown>;
84
83
  }
85
- type DoneFn = (error?: RouterError, state?: State) => void;
86
84
  /**
87
85
  * Configuration options that control navigation transition behavior.
88
86
  *
@@ -415,7 +413,7 @@ interface Options {
415
413
  */
416
414
  noValidate?: boolean;
417
415
  }
418
- type ActivationFn = (toState: State, fromState: State | undefined, done: DoneFn) => boolean | Promise<boolean | object | void> | State | void;
416
+ type ActivationFn = (toState: State, fromState: State | undefined) => boolean | Promise<boolean | State | void> | State | void;
419
417
  type DefaultDependencies = object;
420
418
  interface Config {
421
419
  decoders: Record<string, (params: Params) => Params>;
@@ -457,7 +455,7 @@ interface Subscription {
457
455
  * For full router access, use the Router interface directly or the useRouter() hook.
458
456
  */
459
457
  interface Navigator {
460
- navigate: (routeName: string, routeParamsOrDone?: Params | DoneFn, optionsOrDone?: NavigationOptions | DoneFn, done?: DoneFn) => CancelFn;
458
+ navigate: (routeName: string, routeParams?: Params, options?: NavigationOptions) => Promise<State>;
461
459
  getState: () => State | undefined;
462
460
  isActiveRoute: (name: string, params?: Params, strictEquality?: boolean, ignoreQueryParams?: boolean) => boolean;
463
461
  canNavigateTo: (name: string, params?: Params) => boolean;
@@ -513,15 +511,6 @@ interface Router {
513
511
  * @returns true if navigation is allowed, false otherwise
514
512
  */
515
513
  canNavigateTo: (name: string, params?: Params) => boolean;
516
- /**
517
- * Get a minimal, safe Navigator interface for passing to components.
518
- *
519
- * The returned Navigator object is frozen and includes only essential methods:
520
- * navigate, getState, isActiveRoute, canNavigateTo, subscribe.
521
- *
522
- * @returns Frozen Navigator object
523
- */
524
- getNavigator: () => Navigator;
525
514
  }
526
515
 
527
516
  /**
@@ -581,4 +570,4 @@ interface ErrorCodeToValueMap {
581
570
  TRANSITION_CANCELLED: "CANCELLED";
582
571
  }
583
572
 
584
- export type { ActivationFn, CancelFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DoneFn, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteTreeState, Router, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, Unsubscribe };
573
+ export type { ActivationFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteTreeState, Router, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, Unsubscribe };
@@ -1 +1 @@
1
- {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1248,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/cjs/index.js":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":0}}}
1
+ {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1226,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/cjs/index.js":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":0}}}
@@ -40,7 +40,6 @@ interface RouteTreeState<P extends Record<string, unknown> = RouteParams> {
40
40
  }
41
41
 
42
42
  type Unsubscribe = () => void;
43
- type CancelFn = () => void;
44
43
  interface SimpleState<P extends Params = Params> {
45
44
  name: string;
46
45
  params: P;
@@ -82,7 +81,6 @@ interface RouterError extends Error {
82
81
  getField: (key: string) => unknown;
83
82
  toJSON: () => Record<string, unknown>;
84
83
  }
85
- type DoneFn = (error?: RouterError, state?: State) => void;
86
84
  /**
87
85
  * Configuration options that control navigation transition behavior.
88
86
  *
@@ -415,7 +413,7 @@ interface Options {
415
413
  */
416
414
  noValidate?: boolean;
417
415
  }
418
- type ActivationFn = (toState: State, fromState: State | undefined, done: DoneFn) => boolean | Promise<boolean | object | void> | State | void;
416
+ type ActivationFn = (toState: State, fromState: State | undefined) => boolean | Promise<boolean | State | void> | State | void;
419
417
  type DefaultDependencies = object;
420
418
  interface Config {
421
419
  decoders: Record<string, (params: Params) => Params>;
@@ -457,7 +455,7 @@ interface Subscription {
457
455
  * For full router access, use the Router interface directly or the useRouter() hook.
458
456
  */
459
457
  interface Navigator {
460
- navigate: (routeName: string, routeParamsOrDone?: Params | DoneFn, optionsOrDone?: NavigationOptions | DoneFn, done?: DoneFn) => CancelFn;
458
+ navigate: (routeName: string, routeParams?: Params, options?: NavigationOptions) => Promise<State>;
461
459
  getState: () => State | undefined;
462
460
  isActiveRoute: (name: string, params?: Params, strictEquality?: boolean, ignoreQueryParams?: boolean) => boolean;
463
461
  canNavigateTo: (name: string, params?: Params) => boolean;
@@ -513,15 +511,6 @@ interface Router {
513
511
  * @returns true if navigation is allowed, false otherwise
514
512
  */
515
513
  canNavigateTo: (name: string, params?: Params) => boolean;
516
- /**
517
- * Get a minimal, safe Navigator interface for passing to components.
518
- *
519
- * The returned Navigator object is frozen and includes only essential methods:
520
- * navigate, getState, isActiveRoute, canNavigateTo, subscribe.
521
- *
522
- * @returns Frozen Navigator object
523
- */
524
- getNavigator: () => Navigator;
525
514
  }
526
515
 
527
516
  /**
@@ -581,4 +570,4 @@ interface ErrorCodeToValueMap {
581
570
  TRANSITION_CANCELLED: "CANCELLED";
582
571
  }
583
572
 
584
- export type { ActivationFn, CancelFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DoneFn, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteTreeState, Router, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, Unsubscribe };
573
+ export type { ActivationFn, Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, LimitsConfig, Listener, Middleware, NavigationOptions, Navigator, Options, Params, Plugin, PluginMethod, QueryParamsMode, QueryParamsOptions, RouteTreeState, Router, RouterError, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, Unsubscribe };
@@ -1 +1 @@
1
- {"inputs":{"src/index.ts":{"bytes":1248,"imports":[],"format":"esm"}},"outputs":{"dist/esm/index.mjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":0}}}
1
+ {"inputs":{"src/index.ts":{"bytes":1226,"imports":[],"format":"esm"}},"outputs":{"dist/esm/index.mjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":0}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/types",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "type": "commonjs",
5
5
  "description": "Shared TypeScript types for Real Router ecosystem",
6
6
  "types": "./dist/esm/index.d.mts",