@esportsplus/routing 0.6.1 → 0.6.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.
- package/build/client/index.d.ts +1 -1
- package/build/client/index.js +10 -10
- package/package.json +1 -1
- package/src/client/index.ts +1 -1
package/build/client/index.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ declare const router: <const Factories extends readonly RouteFactory<any>[]>(...
|
|
|
14
14
|
uri: <RouteName extends keyof AccumulateRoutes<Factories>>(name: RouteName, ...values: ExtractRequiredParams<RoutePath<AccumulateRoutes<Factories>, RouteName>> extends never ? ExtractOptionalParams<RoutePath<AccumulateRoutes<Factories>, RouteName>> extends never ? [] : [params?: PathParamsObject<RoutePath<AccumulateRoutes<Factories>, RouteName>>] : [params: PathParamsObject<RoutePath<AccumulateRoutes<Factories>, RouteName>>]) => string;
|
|
15
15
|
};
|
|
16
16
|
export { router };
|
|
17
|
-
export type { Middleware, Next, Request, Route, RouteFactory } from './types.js';
|
|
17
|
+
export type { Middleware, Next, Request, Route, Router, RouteFactory } from './types.js';
|
package/build/client/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as reactivity_14d67e3b96364d0fa5456fd677e2fba30 from '@esportsplus/reactivity';
|
|
2
2
|
import { effect, root } from '@esportsplus/reactivity';
|
|
3
3
|
import { Router } from './router/index.js';
|
|
4
4
|
import pipeline from '@esportsplus/pipeline';
|
|
5
5
|
import { PACKAGE_NAME } from './constants.js';
|
|
6
|
-
class
|
|
6
|
+
class ReactiveObject_14d67e3b96364d0fa5456fd677e2fba31 extends reactivity_14d67e3b96364d0fa5456fd677e2fba30.ReactiveObject {
|
|
7
7
|
#parameters;
|
|
8
8
|
#route;
|
|
9
9
|
constructor(_p0, _p1) {
|
|
10
10
|
super(null);
|
|
11
|
-
this.#parameters = this[
|
|
12
|
-
this.#route = this[
|
|
11
|
+
this.#parameters = this[reactivity_14d67e3b96364d0fa5456fd677e2fba30.SIGNAL](_p0);
|
|
12
|
+
this.#route = this[reactivity_14d67e3b96364d0fa5456fd677e2fba30.SIGNAL](_p1);
|
|
13
13
|
}
|
|
14
14
|
get parameters() {
|
|
15
|
-
return
|
|
15
|
+
return reactivity_14d67e3b96364d0fa5456fd677e2fba30.read(this.#parameters);
|
|
16
16
|
}
|
|
17
17
|
set parameters(_v0) {
|
|
18
|
-
|
|
18
|
+
reactivity_14d67e3b96364d0fa5456fd677e2fba30.write(this.#parameters, _v0);
|
|
19
19
|
}
|
|
20
20
|
get route() {
|
|
21
|
-
return
|
|
21
|
+
return reactivity_14d67e3b96364d0fa5456fd677e2fba30.read(this.#route);
|
|
22
22
|
}
|
|
23
23
|
set route(_v1) {
|
|
24
|
-
|
|
24
|
+
reactivity_14d67e3b96364d0fa5456fd677e2fba30.write(this.#route, _v1);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
let cache = [], location = window.location;
|
|
@@ -80,7 +80,7 @@ function middleware(request, router) {
|
|
|
80
80
|
return route.pipeline.dispatch(request);
|
|
81
81
|
};
|
|
82
82
|
host.match = (fallback) => {
|
|
83
|
-
let state = new
|
|
83
|
+
let state = new ReactiveObject_14d67e3b96364d0fa5456fd677e2fba31(undefined, undefined);
|
|
84
84
|
if (fallback === undefined) {
|
|
85
85
|
throw new Error(`${PACKAGE_NAME}: fallback route does not exist`);
|
|
86
86
|
}
|
|
@@ -120,7 +120,7 @@ function onpopstate() {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
const router = (...factories) => {
|
|
123
|
-
let instance = factories.reduce((r, factory) => factory(r), new Router()), request =
|
|
123
|
+
let instance = factories.reduce((r, factory) => factory(r), new Router()), request = reactivity_14d67e3b96364d0fa5456fd677e2fba30.reactive(Object.assign(href(), { data: {} }));
|
|
124
124
|
if (cache.push(request) === 1) {
|
|
125
125
|
window.addEventListener('hashchange', onpopstate);
|
|
126
126
|
}
|
package/package.json
CHANGED
package/src/client/index.ts
CHANGED