@real-router/types 0.24.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.
- package/dist/cjs/index.d.ts +7 -21
- package/dist/cjs/metafile-cjs.json +1 -1
- package/dist/esm/index.d.mts +7 -21
- package/dist/esm/metafile-esm.json +1 -1
- package/package.json +3 -2
- package/src/api.ts +4 -7
- package/src/base.ts +2 -13
- package/src/index.ts +0 -1
- package/src/router.ts +4 -12
package/dist/cjs/index.d.ts
CHANGED
|
@@ -59,22 +59,15 @@ interface TransitionMeta {
|
|
|
59
59
|
intersection: string;
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
interface State<P 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
|
|
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.
|
|
@@ -415,13 +408,6 @@ interface Options {
|
|
|
415
408
|
* @default DEFAULT_LIMITS (from LimitsNamespace)
|
|
416
409
|
*/
|
|
417
410
|
limits?: Partial<LimitsConfig>;
|
|
418
|
-
/**
|
|
419
|
-
* Disables argument validation in public router methods.
|
|
420
|
-
* Use in production for performance. Keep false in development for early error detection.
|
|
421
|
-
*
|
|
422
|
-
* @default false
|
|
423
|
-
*/
|
|
424
|
-
noValidate?: boolean;
|
|
425
411
|
}
|
|
426
412
|
type GuardFn = (toState: State, fromState: State | undefined, signal?: AbortSignal) => boolean | Promise<boolean>;
|
|
427
413
|
type DefaultDependencies = object;
|
|
@@ -481,7 +467,7 @@ interface Router<D extends DefaultDependencies = DefaultDependencies> {
|
|
|
481
467
|
[key: string]: unknown;
|
|
482
468
|
isActiveRoute: (name: string, params?: Params, strictEquality?: boolean, ignoreQueryParams?: boolean) => boolean;
|
|
483
469
|
buildPath: (route: string, params?: Params) => string;
|
|
484
|
-
getState: <P extends Params = Params
|
|
470
|
+
getState: <P extends Params = Params>() => State<P> | undefined;
|
|
485
471
|
getPreviousState: () => State | undefined;
|
|
486
472
|
areStatesEqual: (state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean) => boolean;
|
|
487
473
|
shouldUpdateNode: (nodeName: string) => (toState: State, fromState?: State) => boolean;
|
|
@@ -490,7 +476,7 @@ interface Router<D extends DefaultDependencies = DefaultDependencies> {
|
|
|
490
476
|
stop: () => this;
|
|
491
477
|
dispose: () => void;
|
|
492
478
|
canNavigateTo: (name: string, params?: Params) => boolean;
|
|
493
|
-
usePlugin: (...plugins: PluginFactory<D>[]) => Unsubscribe;
|
|
479
|
+
usePlugin: (...plugins: (PluginFactory<D> | false | null | undefined)[]) => Unsubscribe;
|
|
494
480
|
subscribe: (listener: SubscribeFn) => Unsubscribe;
|
|
495
481
|
navigate: (routeName: string, routeParams?: Params, options?: NavigationOptions) => Promise<State>;
|
|
496
482
|
navigateToDefault: (options?: NavigationOptions) => Promise<State>;
|
|
@@ -656,10 +642,10 @@ type InterceptorFn<M extends keyof InterceptableMethodMap> = (next: Interceptabl
|
|
|
656
642
|
* Hides plugin-internal methods from public autocomplete.
|
|
657
643
|
*/
|
|
658
644
|
interface PluginApi {
|
|
659
|
-
makeState: <P extends Params = Params
|
|
645
|
+
makeState: <P extends Params = Params>(name: string, params?: P, path?: string, meta?: StateMetaInput) => State<P>;
|
|
660
646
|
buildState: (routeName: string, routeParams: Params) => RouteTreeState | undefined;
|
|
661
647
|
forwardState: <P extends Params = Params>(routeName: string, routeParams: P) => SimpleState<P>;
|
|
662
|
-
matchPath: <P extends Params = Params
|
|
648
|
+
matchPath: <P extends Params = Params>(path: string) => State<P> | undefined;
|
|
663
649
|
setRootPath: (rootPath: string) => void;
|
|
664
650
|
getRootPath: () => string;
|
|
665
651
|
addEventListener: <E extends EventName>(eventName: E, cb: Plugin[EventMethodMap[E]]) => Unsubscribe;
|
|
@@ -706,4 +692,4 @@ interface LifecycleApi<Dependencies extends DefaultDependencies = DefaultDepende
|
|
|
706
692
|
removeDeactivateGuard: (name: string) => void;
|
|
707
693
|
}
|
|
708
694
|
|
|
709
|
-
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,
|
|
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.
|
|
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}}}
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -59,22 +59,15 @@ interface TransitionMeta {
|
|
|
59
59
|
intersection: string;
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
interface State<P 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
|
|
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.
|
|
@@ -415,13 +408,6 @@ interface Options {
|
|
|
415
408
|
* @default DEFAULT_LIMITS (from LimitsNamespace)
|
|
416
409
|
*/
|
|
417
410
|
limits?: Partial<LimitsConfig>;
|
|
418
|
-
/**
|
|
419
|
-
* Disables argument validation in public router methods.
|
|
420
|
-
* Use in production for performance. Keep false in development for early error detection.
|
|
421
|
-
*
|
|
422
|
-
* @default false
|
|
423
|
-
*/
|
|
424
|
-
noValidate?: boolean;
|
|
425
411
|
}
|
|
426
412
|
type GuardFn = (toState: State, fromState: State | undefined, signal?: AbortSignal) => boolean | Promise<boolean>;
|
|
427
413
|
type DefaultDependencies = object;
|
|
@@ -481,7 +467,7 @@ interface Router<D extends DefaultDependencies = DefaultDependencies> {
|
|
|
481
467
|
[key: string]: unknown;
|
|
482
468
|
isActiveRoute: (name: string, params?: Params, strictEquality?: boolean, ignoreQueryParams?: boolean) => boolean;
|
|
483
469
|
buildPath: (route: string, params?: Params) => string;
|
|
484
|
-
getState: <P extends Params = Params
|
|
470
|
+
getState: <P extends Params = Params>() => State<P> | undefined;
|
|
485
471
|
getPreviousState: () => State | undefined;
|
|
486
472
|
areStatesEqual: (state1: State | undefined, state2: State | undefined, ignoreQueryParams?: boolean) => boolean;
|
|
487
473
|
shouldUpdateNode: (nodeName: string) => (toState: State, fromState?: State) => boolean;
|
|
@@ -490,7 +476,7 @@ interface Router<D extends DefaultDependencies = DefaultDependencies> {
|
|
|
490
476
|
stop: () => this;
|
|
491
477
|
dispose: () => void;
|
|
492
478
|
canNavigateTo: (name: string, params?: Params) => boolean;
|
|
493
|
-
usePlugin: (...plugins: PluginFactory<D>[]) => Unsubscribe;
|
|
479
|
+
usePlugin: (...plugins: (PluginFactory<D> | false | null | undefined)[]) => Unsubscribe;
|
|
494
480
|
subscribe: (listener: SubscribeFn) => Unsubscribe;
|
|
495
481
|
navigate: (routeName: string, routeParams?: Params, options?: NavigationOptions) => Promise<State>;
|
|
496
482
|
navigateToDefault: (options?: NavigationOptions) => Promise<State>;
|
|
@@ -656,10 +642,10 @@ type InterceptorFn<M extends keyof InterceptableMethodMap> = (next: Interceptabl
|
|
|
656
642
|
* Hides plugin-internal methods from public autocomplete.
|
|
657
643
|
*/
|
|
658
644
|
interface PluginApi {
|
|
659
|
-
makeState: <P extends Params = Params
|
|
645
|
+
makeState: <P extends Params = Params>(name: string, params?: P, path?: string, meta?: StateMetaInput) => State<P>;
|
|
660
646
|
buildState: (routeName: string, routeParams: Params) => RouteTreeState | undefined;
|
|
661
647
|
forwardState: <P extends Params = Params>(routeName: string, routeParams: P) => SimpleState<P>;
|
|
662
|
-
matchPath: <P extends Params = Params
|
|
648
|
+
matchPath: <P extends Params = Params>(path: string) => State<P> | undefined;
|
|
663
649
|
setRootPath: (rootPath: string) => void;
|
|
664
650
|
getRootPath: () => string;
|
|
665
651
|
addEventListener: <E extends EventName>(eventName: E, cb: Plugin[EventMethodMap[E]]) => Unsubscribe;
|
|
@@ -706,4 +692,4 @@ interface LifecycleApi<Dependencies extends DefaultDependencies = DefaultDepende
|
|
|
706
692
|
removeDeactivateGuard: (name: string) => void;
|
|
707
693
|
}
|
|
708
694
|
|
|
709
|
-
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,
|
|
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":
|
|
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.
|
|
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
|
|
54
|
+
makeState: <P extends Params = Params>(
|
|
55
55
|
name: string,
|
|
56
56
|
params?: P,
|
|
57
57
|
path?: string,
|
|
58
|
-
meta?: StateMetaInput
|
|
59
|
-
|
|
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
|
|
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
|
|
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
|
|
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
package/src/router.ts
CHANGED
|
@@ -145,14 +145,6 @@ export interface Options {
|
|
|
145
145
|
* @default DEFAULT_LIMITS (from LimitsNamespace)
|
|
146
146
|
*/
|
|
147
147
|
limits?: Partial<LimitsConfig>;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Disables argument validation in public router methods.
|
|
151
|
-
* Use in production for performance. Keep false in development for early error detection.
|
|
152
|
-
*
|
|
153
|
-
* @default false
|
|
154
|
-
*/
|
|
155
|
-
noValidate?: boolean;
|
|
156
148
|
}
|
|
157
149
|
|
|
158
150
|
export type GuardFn = (
|
|
@@ -253,9 +245,7 @@ export interface Router<D extends DefaultDependencies = DefaultDependencies> {
|
|
|
253
245
|
|
|
254
246
|
buildPath: (route: string, params?: Params) => string;
|
|
255
247
|
|
|
256
|
-
getState: <P extends Params = Params
|
|
257
|
-
| State<P, MP>
|
|
258
|
-
| undefined;
|
|
248
|
+
getState: <P extends Params = Params>() => State<P> | undefined;
|
|
259
249
|
|
|
260
250
|
getPreviousState: () => State | undefined;
|
|
261
251
|
|
|
@@ -279,7 +269,9 @@ export interface Router<D extends DefaultDependencies = DefaultDependencies> {
|
|
|
279
269
|
|
|
280
270
|
canNavigateTo: (name: string, params?: Params) => boolean;
|
|
281
271
|
|
|
282
|
-
usePlugin: (
|
|
272
|
+
usePlugin: (
|
|
273
|
+
...plugins: (PluginFactory<D> | false | null | undefined)[]
|
|
274
|
+
) => Unsubscribe;
|
|
283
275
|
|
|
284
276
|
subscribe: (listener: SubscribeFn) => Unsubscribe;
|
|
285
277
|
|