@real-router/types 0.26.0 → 0.27.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.
@@ -59,22 +59,15 @@ interface TransitionMeta {
59
59
  intersection: string;
60
60
  };
61
61
  }
62
- interface State<P extends Params = Params, MP extends Params = Params> {
62
+ interface State<P extends Params = Params> {
63
63
  name: string;
64
64
  params: P;
65
65
  path: string;
66
- meta?: StateMeta<MP> | undefined;
67
66
  transition?: TransitionMeta | undefined;
68
67
  }
69
- interface StateMeta<P extends Params = Params> {
70
- id: number;
68
+ interface StateMetaInput<P extends Params = Params> {
71
69
  params: P;
72
70
  }
73
- /**
74
- * Input type for makeState meta parameter.
75
- * Omits `id` since it's auto-generated by makeState.
76
- */
77
- type StateMetaInput<P extends Params = Params> = Omit<StateMeta<P>, "id">;
78
71
  /**
79
72
  * RouterError interface describing the public API of the RouterError class.
80
73
  * The actual class implementation is in the real-router package.
@@ -474,7 +467,7 @@ interface Router<D extends DefaultDependencies = DefaultDependencies> {
474
467
  [key: string]: unknown;
475
468
  isActiveRoute: (name: string, params?: Params, strictEquality?: boolean, ignoreQueryParams?: boolean) => boolean;
476
469
  buildPath: (route: string, params?: Params) => string;
477
- getState: <P extends Params = Params, MP extends Params = Params>() => State<P, MP> | undefined;
470
+ getState: <P extends Params = Params>() => State<P> | undefined;
478
471
  getPreviousState: () => State | undefined;
479
472
  areStatesEqual: (state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean) => boolean;
480
473
  shouldUpdateNode: (nodeName: string) => (toState: State, fromState?: State) => boolean;
@@ -649,10 +642,10 @@ type InterceptorFn<M extends keyof InterceptableMethodMap> = (next: Interceptabl
649
642
  * Hides plugin-internal methods from public autocomplete.
650
643
  */
651
644
  interface PluginApi {
652
- makeState: <P extends Params = Params, MP extends Params = Params>(name: string, params?: P, path?: string, meta?: StateMetaInput<MP>, forceId?: number) => State<P, MP>;
645
+ makeState: <P extends Params = Params>(name: string, params?: P, path?: string, meta?: StateMetaInput) => State<P>;
653
646
  buildState: (routeName: string, routeParams: Params) => RouteTreeState | undefined;
654
647
  forwardState: <P extends Params = Params>(routeName: string, routeParams: P) => SimpleState<P>;
655
- matchPath: <P extends Params = Params, MP extends Params = Params>(path: string) => State<P, MP> | undefined;
648
+ matchPath: <P extends Params = Params>(path: string) => State<P> | undefined;
656
649
  setRootPath: (rootPath: string) => void;
657
650
  getRootPath: () => string;
658
651
  addEventListener: <E extends EventName>(eventName: E, cb: Plugin[EventMethodMap[E]]) => Unsubscribe;
@@ -699,4 +692,4 @@ interface LifecycleApi<Dependencies extends DefaultDependencies = DefaultDepende
699
692
  removeDeactivateGuard: (name: string) => void;
700
693
  }
701
694
 
702
- export type { Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DependenciesApi, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, GuardFn, GuardFnFactory, InterceptableMethodMap, InterceptorFn, LifecycleApi, LimitsConfig, Listener, NavigationOptions, Navigator, Options, Params, Plugin, PluginApi, PluginFactory, PluginMethod, QueryParamsMode, QueryParamsOptions, Route, RouteConfigUpdate, RouteParams, RouteTreeState, Router, RouterError, RoutesApi, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe };
695
+ export type { Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DependenciesApi, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, GuardFn, GuardFnFactory, InterceptableMethodMap, InterceptorFn, LifecycleApi, LimitsConfig, Listener, NavigationOptions, Navigator, Options, Params, Plugin, PluginApi, PluginFactory, PluginMethod, QueryParamsMode, QueryParamsOptions, Route, RouteConfigUpdate, RouteParams, RouteTreeState, Router, RouterError, RoutesApi, SimpleState, State, StateMetaInput, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe };
@@ -1 +1 @@
1
- {"inputs":{"../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1392,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/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.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js":{"bytes":569,"imports":[],"format":"esm"},"src/index.ts":{"bytes":1379,"imports":[{"path":"/home/runner/work/real-router/real-router/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@6.0.2_yaml@2.8.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}}}
@@ -59,22 +59,15 @@ interface TransitionMeta {
59
59
  intersection: string;
60
60
  };
61
61
  }
62
- interface State<P extends Params = Params, MP extends Params = Params> {
62
+ interface State<P extends Params = Params> {
63
63
  name: string;
64
64
  params: P;
65
65
  path: string;
66
- meta?: StateMeta<MP> | undefined;
67
66
  transition?: TransitionMeta | undefined;
68
67
  }
69
- interface StateMeta<P extends Params = Params> {
70
- id: number;
68
+ interface StateMetaInput<P extends Params = Params> {
71
69
  params: P;
72
70
  }
73
- /**
74
- * Input type for makeState meta parameter.
75
- * Omits `id` since it's auto-generated by makeState.
76
- */
77
- type StateMetaInput<P extends Params = Params> = Omit<StateMeta<P>, "id">;
78
71
  /**
79
72
  * RouterError interface describing the public API of the RouterError class.
80
73
  * The actual class implementation is in the real-router package.
@@ -474,7 +467,7 @@ interface Router<D extends DefaultDependencies = DefaultDependencies> {
474
467
  [key: string]: unknown;
475
468
  isActiveRoute: (name: string, params?: Params, strictEquality?: boolean, ignoreQueryParams?: boolean) => boolean;
476
469
  buildPath: (route: string, params?: Params) => string;
477
- getState: <P extends Params = Params, MP extends Params = Params>() => State<P, MP> | undefined;
470
+ getState: <P extends Params = Params>() => State<P> | undefined;
478
471
  getPreviousState: () => State | undefined;
479
472
  areStatesEqual: (state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean) => boolean;
480
473
  shouldUpdateNode: (nodeName: string) => (toState: State, fromState?: State) => boolean;
@@ -649,10 +642,10 @@ type InterceptorFn<M extends keyof InterceptableMethodMap> = (next: Interceptabl
649
642
  * Hides plugin-internal methods from public autocomplete.
650
643
  */
651
644
  interface PluginApi {
652
- makeState: <P extends Params = Params, MP extends Params = Params>(name: string, params?: P, path?: string, meta?: StateMetaInput<MP>, forceId?: number) => State<P, MP>;
645
+ makeState: <P extends Params = Params>(name: string, params?: P, path?: string, meta?: StateMetaInput) => State<P>;
653
646
  buildState: (routeName: string, routeParams: Params) => RouteTreeState | undefined;
654
647
  forwardState: <P extends Params = Params>(routeName: string, routeParams: P) => SimpleState<P>;
655
- matchPath: <P extends Params = Params, MP extends Params = Params>(path: string) => State<P, MP> | undefined;
648
+ matchPath: <P extends Params = Params>(path: string) => State<P> | undefined;
656
649
  setRootPath: (rootPath: string) => void;
657
650
  getRootPath: () => string;
658
651
  addEventListener: <E extends EventName>(eventName: E, cb: Plugin[EventMethodMap[E]]) => Unsubscribe;
@@ -699,4 +692,4 @@ interface LifecycleApi<Dependencies extends DefaultDependencies = DefaultDepende
699
692
  removeDeactivateGuard: (name: string) => void;
700
693
  }
701
694
 
702
- export type { Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DependenciesApi, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, GuardFn, GuardFnFactory, InterceptableMethodMap, InterceptorFn, LifecycleApi, LimitsConfig, Listener, NavigationOptions, Navigator, Options, Params, Plugin, PluginApi, PluginFactory, PluginMethod, QueryParamsMode, QueryParamsOptions, Route, RouteConfigUpdate, RouteParams, RouteTreeState, Router, RouterError, RoutesApi, SimpleState, State, StateMeta, StateMetaInput, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe };
695
+ export type { Config, DefaultDependencies, DefaultParamsCallback, DefaultRouteCallback, DependenciesApi, ErrorCodeKeys, ErrorCodeToValueMap, ErrorCodeValues, EventMethodMap, EventName, EventToNameMap, EventToPluginMap, EventsKeys, ForwardToCallback, GuardFn, GuardFnFactory, InterceptableMethodMap, InterceptorFn, LifecycleApi, LimitsConfig, Listener, NavigationOptions, Navigator, Options, Params, Plugin, PluginApi, PluginFactory, PluginMethod, QueryParamsMode, QueryParamsOptions, Route, RouteConfigUpdate, RouteParams, RouteTreeState, Router, RouterError, RoutesApi, SimpleState, State, StateMetaInput, SubscribeFn, SubscribeState, Subscription, TransitionMeta, TransitionPhase, TransitionReason, Unsubscribe };
@@ -1 +1 @@
1
- {"inputs":{"src/index.ts":{"bytes":1392,"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":1379,"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.26.0",
3
+ "version": "0.27.0",
4
4
  "type": "commonjs",
5
5
  "description": "Shared TypeScript types for Real Router ecosystem",
6
6
  "types": "./dist/esm/index.d.mts",
@@ -40,6 +40,7 @@
40
40
  "scripts": {
41
41
  "build": "tsup",
42
42
  "type-check": "tsc --noEmit",
43
- "lint": "eslint --cache --ext .ts src/ --fix --max-warnings 0"
43
+ "lint": "eslint --cache --ext .ts src/ --fix --max-warnings 0",
44
+ "build:dist-only": "tsup"
44
45
  }
45
46
  }
package/src/api.ts CHANGED
@@ -51,13 +51,12 @@ export type InterceptorFn<M extends keyof InterceptableMethodMap> = (
51
51
  * Hides plugin-internal methods from public autocomplete.
52
52
  */
53
53
  export interface PluginApi {
54
- makeState: <P extends Params = Params, MP extends Params = Params>(
54
+ makeState: <P extends Params = Params>(
55
55
  name: string,
56
56
  params?: P,
57
57
  path?: string,
58
- meta?: StateMetaInput<MP>,
59
- forceId?: number,
60
- ) => State<P, MP>;
58
+ meta?: StateMetaInput,
59
+ ) => State<P>;
61
60
 
62
61
  buildState: (
63
62
  routeName: string,
@@ -69,9 +68,7 @@ export interface PluginApi {
69
68
  routeParams: P,
70
69
  ) => SimpleState<P>;
71
70
 
72
- matchPath: <P extends Params = Params, MP extends Params = Params>(
73
- path: string,
74
- ) => State<P, MP> | undefined;
71
+ matchPath: <P extends Params = Params>(path: string) => State<P> | undefined;
75
72
 
76
73
  setRootPath: (rootPath: string) => void;
77
74
  getRootPath: () => string;
package/src/base.ts CHANGED
@@ -29,28 +29,17 @@ export interface TransitionMeta {
29
29
  };
30
30
  }
31
31
 
32
- export interface State<P extends Params = Params, MP extends Params = Params> {
32
+ export interface State<P extends Params = Params> {
33
33
  name: string;
34
34
  params: P;
35
35
  path: string;
36
- meta?: StateMeta<MP> | undefined;
37
36
  transition?: TransitionMeta | undefined;
38
37
  }
39
38
 
40
- export interface StateMeta<P extends Params = Params> {
41
- id: number;
39
+ export interface StateMetaInput<P extends Params = Params> {
42
40
  params: P;
43
41
  }
44
42
 
45
- /**
46
- * Input type for makeState meta parameter.
47
- * Omits `id` since it's auto-generated by makeState.
48
- */
49
- export type StateMetaInput<P extends Params = Params> = Omit<
50
- StateMeta<P>,
51
- "id"
52
- >;
53
-
54
43
  /**
55
44
  * RouterError interface describing the public API of the RouterError class.
56
45
  * The actual class implementation is in the real-router package.
package/src/index.ts CHANGED
@@ -12,7 +12,6 @@ export type {
12
12
  export type {
13
13
  Params,
14
14
  State,
15
- StateMeta,
16
15
  StateMetaInput,
17
16
  SimpleState,
18
17
  NavigationOptions,
package/src/router.ts CHANGED
@@ -245,9 +245,7 @@ export interface Router<D extends DefaultDependencies = DefaultDependencies> {
245
245
 
246
246
  buildPath: (route: string, params?: Params) => string;
247
247
 
248
- getState: <P extends Params = Params, MP extends Params = Params>() =>
249
- | State<P, MP>
250
- | undefined;
248
+ getState: <P extends Params = Params>() => State<P> | undefined;
251
249
 
252
250
  getPreviousState: () => State | undefined;
253
251