@surgijs/router 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +41 -2
- package/dist/angular.d.ts +45 -0
- package/dist/angular.js +52 -0
- package/dist/angular.js.map +1 -0
- package/dist/chunk-FRJIJ3K7.js +104 -0
- package/dist/chunk-FRJIJ3K7.js.map +1 -0
- package/dist/chunk-LY6JNBHA.js +20 -0
- package/dist/chunk-LY6JNBHA.js.map +1 -0
- package/dist/chunk-OQUB6NVM.js +53 -0
- package/dist/chunk-OQUB6NVM.js.map +1 -0
- package/dist/chunk-W2SIXU6O.js +44 -0
- package/dist/chunk-W2SIXU6O.js.map +1 -0
- package/dist/core.d.ts +73 -0
- package/dist/core.js +4 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +1123 -0
- package/dist/index.js.map +1 -0
- package/dist/react.d.ts +80 -0
- package/dist/react.js +120 -0
- package/dist/react.js.map +1 -0
- package/dist/router-ClmQESkC.d.ts +497 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.js +25 -0
- package/dist/server.js.map +1 -0
- package/dist/svelte.d.ts +50 -0
- package/dist/svelte.js +60 -0
- package/dist/svelte.js.map +1 -0
- package/dist/vue.d.ts +80 -0
- package/dist/vue.js +115 -0
- package/dist/vue.js.map +1 -0
- package/package.json +112 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/svelte.ts"],"names":[],"mappings":";;;;AAcO,SAAS,UAAA,CAAc,MAAA,EAAgB,QAAA,EAAqC,MAAA,GAAkC,SAAA,EAA8B;AACjJ,EAAA,OAAO;AAAA,IACL,UAAU,GAAA,EAAK;AACb,MAAA,MAAM,IAAA,GAAO,MAAA,CAAO,SAAA,CAAU,QAAA,EAAU,CAAC,KAAA,KAAU,GAAA,CAAI,KAAK,CAAA,EAAG,EAAE,MAAA,EAAQ,CAAA;AACz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CAAM,CAAC,GAAA,KAAQ,OAAA,CAAQ,KAAA,CAAM,mBAAA,EAAqB,GAAG,CAAC,CAAA;AAAA,EACnF,CAAA;AACA,EAAA,IAAA,CAAK,gBAAA,CAAiB,SAAS,OAAO,CAAA;AACtC,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,CAAC,IAAA,KAAS,MAAM,OAAA,GAAU,IAAA,CAAA;AAAA,IAClC,OAAA,EAAS,MAAM,IAAA,CAAK,mBAAA,CAAoB,SAAS,OAAO;AAAA,GAC1D;AACF","file":"svelte.js","sourcesContent":["import { isNativeAnchor, isPlainClick } from './links';\nimport type { NavigateOptions, Router, RouterState } from './router';\nimport type { AnyRoute, RouteParams, RouteQuery } from './routes';\nimport { deepEqual } from './util';\n\n/**\n * The Svelte store contract: `subscribe(run)` calls `run` with the current value and returns an\n * unsubscribe function. Compatible with `svelte/store`'s `Readable`, so `$value` and `derived()` work.\n */\nexport interface RouterReadable<T> {\n subscribe(run: (value: T) => void, invalidate?: () => void): () => void;\n}\n\n/** A router selector as a Svelte store. Each subscriber opens its own router subscription. */\nexport function fromRouter<T>(router: Router, selector: (state: RouterState) => T, equals: (a: T, b: T) => boolean = deepEqual): RouterReadable<T> {\n return {\n subscribe(run) {\n const stop = router.subscribe(selector, (value) => run(value), { equals });\n try {\n run(router.get(selector));\n } catch (error) {\n stop();\n throw error;\n }\n return stop;\n },\n };\n}\n\nexport const fromLocation = (router: Router) => fromRouter(router, (s) => ({ url: s.url, path: s.path, search: s.search, hash: s.hash }));\nexport const fromParams = <R extends AnyRoute = AnyRoute>(router: Router, _route?: R) => fromRouter(router, (s) => s.params as RouteParams<R>);\nexport const fromQuery = <R extends AnyRoute = AnyRoute>(router: Router, _route?: R) => fromRouter(router, (s) => s.query as RouteQuery<R>);\nexport const fromPending = (router: Router) => fromRouter(router, (s) => s.isPending);\n\n/** What `load` returned for the route at `level` (the leaf when omitted). */\nexport const fromLoaderData = <T = unknown>(router: Router, level?: number) =>\n fromRouter(router, (s) => s.data[level ?? s.data.length - 1] as T | undefined);\n\nexport interface OutletView {\n /** The component to render: the route's, or its `errorComponent` after a failure. */\n component: unknown;\n /** Props for it: `{ error }` for an error component. */\n props: Record<string, unknown>;\n /** The depth for the outlet inside it. */\n next: number;\n /** The failure this outlet shows; `component` is `null` when the route has no error component. */\n error?: unknown;\n}\n\n/**\n * What the outlet at `level` renders: the component of the route at that depth, or its error component.\n * On a failure without an error component `component` is `null` and `error` is set. `null` when no route matches there.\n */\nexport function fromOutlet(router: Router, level = 0): RouterReadable<OutletView | null> {\n return fromRouter(\n router,\n (s): OutletView | null => {\n const rec = s.matches[level]?.route;\n if (!rec) return null;\n const err = s.error && s.error.at === level ? s.error : null;\n return {\n component: (err ? rec.errorComponent : rec.component) ?? null,\n props: err ? { error: err.error } : {},\n next: level + 1,\n ...(err && { error: err.error }),\n };\n },\n (a, b) => (a === null || b === null ? a === b : a.component === b.component && a.next === b.next && a.props.error === b.props.error),\n );\n}\n\nexport interface LinkActionOptions extends NavigateOptions {\n router: Router;\n}\n\n/**\n * `use:link={{ router }}` on an `<a href>`: a plain click navigates through the router. Not needed\n * while the router intercepts clicks itself (the default for browser histories).\n */\nexport function link(node: HTMLAnchorElement, options: LinkActionOptions): { update(next: LinkActionOptions): void; destroy(): void } {\n let current = options;\n const onClick = (e: MouseEvent) => {\n if (e.defaultPrevented || !isPlainClick(e) || isNativeAnchor(node)) return;\n const url = current.router.history.fromHref(new URL(node.href, location.href));\n if (url === null) return;\n e.preventDefault();\n const { router, ...rest } = current;\n router.navigate(url, rest).catch((err) => console.error('[@surgijs/router]', err));\n };\n node.addEventListener('click', onClick);\n return {\n update: (next) => void (current = next),\n destroy: () => node.removeEventListener('click', onClick),\n };\n}\n"]}
|
package/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { PropType, VNode, EffectScope, App, ShallowRef, InjectionKey } from 'vue';
|
|
3
|
+
import { A as AnyRoute, R as Router, a as RouterState, L as LeaveGuard, M as Match, b as RouteParams, c as RouteQuery } from './router-ClmQESkC.js';
|
|
4
|
+
|
|
5
|
+
interface RouterRefOptions<T> {
|
|
6
|
+
/** Defaults to structural `deepEqual`. */
|
|
7
|
+
equals?: (a: T, b: T) => boolean;
|
|
8
|
+
/** Ends the subscription when it stops. Defaults to the active effect scope (a component's setup). */
|
|
9
|
+
scope?: EffectScope;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A router selector as a Vue ref. The subscription ends with the effect scope, so the call runs in a
|
|
13
|
+
* component's setup or `effectScope().run()`, unless `scope` is passed.
|
|
14
|
+
*/
|
|
15
|
+
declare function fromRouter<T>(router: Router, selector: (state: RouterState) => T, options?: RouterRefOptions<T>): Readonly<ShallowRef<T>>;
|
|
16
|
+
/** Provides the router to `RouterView`, `RouterLink` and the composables, and registers both components. */
|
|
17
|
+
declare function createRouterPlugin(router: Router): {
|
|
18
|
+
install(app: App): void;
|
|
19
|
+
};
|
|
20
|
+
declare function useRouter(): Router;
|
|
21
|
+
/** For `app.provide(routerKey, router)` when the plugin is not used. */
|
|
22
|
+
declare const routerKey: InjectionKey<Router>;
|
|
23
|
+
/**
|
|
24
|
+
* Renders the route at this depth below the layouts of its parents. A failed `load` or `lazy` renders the
|
|
25
|
+
* `errorComponent` of the nearest route that has one, with an `error` prop; without any, the error is thrown
|
|
26
|
+
* to the nearest `onErrorCaptured`. The default slot is shown when no route matches at this depth.
|
|
27
|
+
*/
|
|
28
|
+
declare const RouterView: vue.DefineComponent<{}, () => VNode | VNode[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
29
|
+
/** An `<a>` that navigates through the router and keeps a real `href`. */
|
|
30
|
+
declare const RouterLink: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
31
|
+
to: {
|
|
32
|
+
type: PropType<string | AnyRoute>;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
params: PropType<Record<string, unknown>>;
|
|
36
|
+
query: PropType<Record<string, unknown>>;
|
|
37
|
+
hash: StringConstructor;
|
|
38
|
+
replace: BooleanConstructor;
|
|
39
|
+
state: PropType<unknown>;
|
|
40
|
+
activeClass: StringConstructor;
|
|
41
|
+
exact: BooleanConstructor;
|
|
42
|
+
}>, () => VNode<vue.RendererNode, vue.RendererElement, {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
45
|
+
to: {
|
|
46
|
+
type: PropType<string | AnyRoute>;
|
|
47
|
+
required: true;
|
|
48
|
+
};
|
|
49
|
+
params: PropType<Record<string, unknown>>;
|
|
50
|
+
query: PropType<Record<string, unknown>>;
|
|
51
|
+
hash: StringConstructor;
|
|
52
|
+
replace: BooleanConstructor;
|
|
53
|
+
state: PropType<unknown>;
|
|
54
|
+
activeClass: StringConstructor;
|
|
55
|
+
exact: BooleanConstructor;
|
|
56
|
+
}>> & Readonly<{}>, {
|
|
57
|
+
replace: boolean;
|
|
58
|
+
exact: boolean;
|
|
59
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
60
|
+
declare function useLocation(): Readonly<ShallowRef<{
|
|
61
|
+
url: string;
|
|
62
|
+
path: string;
|
|
63
|
+
search: string;
|
|
64
|
+
hash: string;
|
|
65
|
+
}>>;
|
|
66
|
+
declare function useParams<R extends AnyRoute = AnyRoute>(_route?: R): Readonly<ShallowRef<RouteParams<R>>>;
|
|
67
|
+
declare function useQuery<R extends AnyRoute = AnyRoute>(_route?: R): Readonly<ShallowRef<RouteQuery<R>>>;
|
|
68
|
+
/** The match at the depth of the component that calls it (the leaf outside routed components). */
|
|
69
|
+
declare function useMatch(): Readonly<ShallowRef<Match | undefined>>;
|
|
70
|
+
/** What `load` returned for the route of the component that calls it. */
|
|
71
|
+
declare function useLoaderData<T = unknown>(): Readonly<ShallowRef<T | undefined>>;
|
|
72
|
+
declare function useIsPending(): Readonly<ShallowRef<boolean>>;
|
|
73
|
+
declare function useIsActive(to: string | AnyRoute, options?: {
|
|
74
|
+
exact?: boolean;
|
|
75
|
+
params?: Record<string, unknown>;
|
|
76
|
+
}): Readonly<ShallowRef<boolean>>;
|
|
77
|
+
/** Registers a leave guard for the lifetime of the component's scope. */
|
|
78
|
+
declare function useBeforeLeave(guard: LeaveGuard): void;
|
|
79
|
+
|
|
80
|
+
export { RouterLink, type RouterRefOptions, RouterView, createRouterPlugin, fromRouter, routerKey, useBeforeLeave, useIsActive, useIsPending, useLoaderData, useLocation, useMatch, useParams, useQuery, useRouter };
|
package/dist/vue.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { isPlainClick, isNativeAnchor } from './chunk-OQUB6NVM.js';
|
|
2
|
+
import { deepEqual } from './chunk-W2SIXU6O.js';
|
|
3
|
+
import { defineComponent, provide, inject, h, getCurrentScope, shallowRef, onScopeDispose } from 'vue';
|
|
4
|
+
|
|
5
|
+
var ROUTER = /* @__PURE__ */ Symbol("surgijs-router");
|
|
6
|
+
var LEVEL = /* @__PURE__ */ Symbol("surgijs-router-level");
|
|
7
|
+
function fromRouter(router, selector, options = {}) {
|
|
8
|
+
const scope = options.scope ?? getCurrentScope();
|
|
9
|
+
if (!scope) throw new Error("@surgijs/router: fromRouter needs an active effect scope (component setup or effectScope().run) or a `scope` option");
|
|
10
|
+
const value = shallowRef(router.get(selector));
|
|
11
|
+
if (!scope.active) return value;
|
|
12
|
+
const stop = router.subscribe(selector, (next) => void (value.value = next), { equals: options.equals ?? deepEqual });
|
|
13
|
+
scope.run(() => onScopeDispose(stop));
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
function createRouterPlugin(router) {
|
|
17
|
+
return {
|
|
18
|
+
install(app) {
|
|
19
|
+
app.provide(ROUTER, router);
|
|
20
|
+
app.component("RouterView", RouterView);
|
|
21
|
+
app.component("RouterLink", RouterLink);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function useRouter() {
|
|
26
|
+
const router = inject(ROUTER, null);
|
|
27
|
+
if (!router) throw new Error("@surgijs/router: no router; install createRouterPlugin(router) or provide it");
|
|
28
|
+
return router;
|
|
29
|
+
}
|
|
30
|
+
var routerKey = ROUTER;
|
|
31
|
+
var LevelScope = defineComponent({
|
|
32
|
+
props: { level: { type: Number, required: true } },
|
|
33
|
+
setup(props, { slots }) {
|
|
34
|
+
provide(LEVEL, props.level);
|
|
35
|
+
return () => slots.default?.();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
var RouterView = defineComponent({
|
|
39
|
+
name: "RouterView",
|
|
40
|
+
setup(_, { slots }) {
|
|
41
|
+
const router = useRouter();
|
|
42
|
+
const level = inject(LEVEL, 0);
|
|
43
|
+
const route = fromRouter(router, (s) => s.matches[level]?.route ?? null, { equals: Object.is });
|
|
44
|
+
const failure = fromRouter(router, (s) => s.error && s.error.at === level ? s.error : null, { equals: Object.is });
|
|
45
|
+
return () => {
|
|
46
|
+
const rec = route.value;
|
|
47
|
+
if (!rec) return slots.default?.();
|
|
48
|
+
const err = failure.value;
|
|
49
|
+
if (err && !rec.errorComponent) throw err.error;
|
|
50
|
+
const component = err ? rec.errorComponent : rec.component;
|
|
51
|
+
return h(LevelScope, { level: level + 1 }, { default: () => component ? h(component, err ? { error: err.error } : null) : h(RouterView) });
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
var RouterLink = defineComponent({
|
|
56
|
+
name: "RouterLink",
|
|
57
|
+
props: {
|
|
58
|
+
to: { type: [String, Object], required: true },
|
|
59
|
+
params: Object,
|
|
60
|
+
query: Object,
|
|
61
|
+
hash: String,
|
|
62
|
+
replace: Boolean,
|
|
63
|
+
state: null,
|
|
64
|
+
activeClass: String,
|
|
65
|
+
exact: Boolean
|
|
66
|
+
},
|
|
67
|
+
setup(props, { slots, attrs }) {
|
|
68
|
+
const router = useRouter();
|
|
69
|
+
const target = () => ({ params: props.params, query: props.query, hash: props.hash });
|
|
70
|
+
const href = fromRouter(router, () => router.href(props.to, target()), { equals: Object.is });
|
|
71
|
+
const active = fromRouter(router, () => props.activeClass ? router.isActive(props.to, { exact: props.exact, params: props.params }) : false, { equals: Object.is });
|
|
72
|
+
const click = (e) => {
|
|
73
|
+
if (e.defaultPrevented || !isPlainClick(e) || isNativeAnchor(e.currentTarget)) return;
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
router.navigate(props.to, { replace: props.replace, state: props.state, ...target() }).catch((err) => console.error("[@surgijs/router]", err));
|
|
76
|
+
};
|
|
77
|
+
return () => h("a", { ...attrs, href: href.value, class: [attrs.class, active.value ? props.activeClass : null], onClick: click }, slots.default?.());
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
function useLocation() {
|
|
81
|
+
return fromRouter(useRouter(), (s) => ({ url: s.url, path: s.path, search: s.search, hash: s.hash }));
|
|
82
|
+
}
|
|
83
|
+
function useParams(_route) {
|
|
84
|
+
return fromRouter(useRouter(), (s) => s.params);
|
|
85
|
+
}
|
|
86
|
+
function useQuery(_route) {
|
|
87
|
+
return fromRouter(useRouter(), (s) => s.query);
|
|
88
|
+
}
|
|
89
|
+
function useMatch() {
|
|
90
|
+
const level = inject(LEVEL, 0) - 1;
|
|
91
|
+
return fromRouter(
|
|
92
|
+
useRouter(),
|
|
93
|
+
(s) => s.matches[level < 0 ? s.matches.length - 1 : level],
|
|
94
|
+
{ equals: (a, b) => a?.route === b?.route && a?.params === b?.params }
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function useLoaderData() {
|
|
98
|
+
const level = inject(LEVEL, 0) - 1;
|
|
99
|
+
return fromRouter(useRouter(), (s) => s.data[level < 0 ? s.data.length - 1 : level]);
|
|
100
|
+
}
|
|
101
|
+
function useIsPending() {
|
|
102
|
+
return fromRouter(useRouter(), (s) => s.isPending);
|
|
103
|
+
}
|
|
104
|
+
function useIsActive(to, options) {
|
|
105
|
+
const router = useRouter();
|
|
106
|
+
return fromRouter(router, () => router.isActive(to, options));
|
|
107
|
+
}
|
|
108
|
+
function useBeforeLeave(guard) {
|
|
109
|
+
const stop = useRouter().beforeLeave(guard);
|
|
110
|
+
if (getCurrentScope()) onScopeDispose(stop);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { RouterLink, RouterView, createRouterPlugin, fromRouter, routerKey, useBeforeLeave, useIsActive, useIsPending, useLoaderData, useLocation, useMatch, useParams, useQuery, useRouter };
|
|
114
|
+
//# sourceMappingURL=vue.js.map
|
|
115
|
+
//# sourceMappingURL=vue.js.map
|
package/dist/vue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vue.ts"],"names":[],"mappings":";;;;AAoBA,IAAM,MAAA,0BAAsC,gBAAgB,CAAA;AAC5D,IAAM,KAAA,0BAAqC,sBAAsB,CAAA;AAa1D,SAAS,UAAA,CAAc,MAAA,EAAgB,QAAA,EAAqC,OAAA,GAA+B,EAAC,EAA4B;AAC7I,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,IAAS,eAAA,EAAgB;AAC/C,EAAA,IAAI,CAAC,KAAA,EAAO,MAAM,IAAI,MAAM,qHAAqH,CAAA;AACjJ,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAc,MAAA,CAAO,GAAA,CAAI,QAAQ,CAAC,CAAA;AAChD,EAAA,IAAI,CAAC,KAAA,CAAM,MAAA,EAAQ,OAAO,KAAA;AAC1B,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,SAAA,CAAU,QAAA,EAAU,CAAC,IAAA,KAAS,MAAM,KAAA,CAAM,KAAA,GAAQ,OAAO,EAAE,MAAA,EAAQ,OAAA,CAAQ,MAAA,IAAU,WAAW,CAAA;AACpH,EAAA,KAAA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,MAAM,KAAA,GAAQ,MAAA,CAAO,KAAA,EAAO,CAAC,CAAA,GAAI,CAAA;AACjC,EAAA,OAAO,UAAA,CAAW,SAAA,EAAU,EAAG,CAAC,MAAM,CAAA,CAAE,IAAA,CAAK,KAAA,GAAQ,CAAA,GAAI,CAAA,CAAE,IAAA,CAAK,MAAA,GAAS,CAAA,GAAI,KAAK,CAAkB,CAAA;AACtG;AAEO,SAAS,YAAA,GAA8C;AAC5D,EAAA,OAAO,WAAW,SAAA,EAAU,EAAG,CAAC,CAAA,KAAM,EAAE,SAAS,CAAA;AACnD;AAEO,SAAS,WAAA,CAAY,IAAuB,OAAA,EAAgG;AACjJ,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,OAAO,WAAW,MAAA,EAAQ,MAAM,OAAO,QAAA,CAAS,EAAA,EAAI,OAAO,CAAC,CAAA;AAC9D;AAGO,SAAS,eAAe,KAAA,EAAyB;AACtD,EAAA,MAAM,IAAA,GAAO,SAAA,EAAU,CAAE,WAAA,CAAY,KAAK,CAAA;AAC1C,EAAA,IAAI,eAAA,EAAgB,EAAG,cAAA,CAAe,IAAI,CAAA;AAC5C","file":"vue.js","sourcesContent":["import {\n defineComponent,\n getCurrentScope,\n h,\n inject,\n onScopeDispose,\n provide,\n shallowRef,\n type App,\n type EffectScope,\n type InjectionKey,\n type PropType,\n type ShallowRef,\n type VNode,\n} from 'vue';\nimport { isNativeAnchor, isPlainClick } from './links';\nimport type { LeaveGuard, Router, RouterState } from './router';\nimport type { AnyRoute, Match, RouteParams, RouteQuery } from './routes';\nimport { deepEqual } from './util';\n\nconst ROUTER: InjectionKey<Router> = Symbol('surgijs-router');\nconst LEVEL: InjectionKey<number> = Symbol('surgijs-router-level');\n\nexport interface RouterRefOptions<T> {\n /** Defaults to structural `deepEqual`. */\n equals?: (a: T, b: T) => boolean;\n /** Ends the subscription when it stops. Defaults to the active effect scope (a component's setup). */\n scope?: EffectScope;\n}\n\n/**\n * A router selector as a Vue ref. The subscription ends with the effect scope, so the call runs in a\n * component's setup or `effectScope().run()`, unless `scope` is passed.\n */\nexport function fromRouter<T>(router: Router, selector: (state: RouterState) => T, options: RouterRefOptions<T> = {}): Readonly<ShallowRef<T>> {\n const scope = options.scope ?? getCurrentScope();\n if (!scope) throw new Error('@surgijs/router: fromRouter needs an active effect scope (component setup or effectScope().run) or a `scope` option');\n const value = shallowRef<T>(router.get(selector));\n if (!scope.active) return value;\n const stop = router.subscribe(selector, (next) => void (value.value = next), { equals: options.equals ?? deepEqual });\n scope.run(() => onScopeDispose(stop));\n return value;\n}\n\n/** Provides the router to `RouterView`, `RouterLink` and the composables, and registers both components. */\nexport function createRouterPlugin(router: Router): { install(app: App): void } {\n return {\n install(app) {\n app.provide(ROUTER, router);\n app.component('RouterView', RouterView);\n app.component('RouterLink', RouterLink);\n },\n };\n}\n\nexport function useRouter(): Router {\n const router = inject(ROUTER, null);\n if (!router) throw new Error('@surgijs/router: no router; install createRouterPlugin(router) or provide it');\n return router;\n}\n\n/** For `app.provide(routerKey, router)` when the plugin is not used. */\nexport const routerKey = ROUTER;\n\nconst LevelScope = defineComponent({\n props: { level: { type: Number, required: true } },\n setup(props, { slots }) {\n provide(LEVEL, props.level);\n return () => slots.default?.();\n },\n});\n\n/**\n * Renders the route at this depth below the layouts of its parents. A failed `load` or `lazy` renders the\n * `errorComponent` of the nearest route that has one, with an `error` prop; without any, the error is thrown\n * to the nearest `onErrorCaptured`. The default slot is shown when no route matches at this depth.\n */\nexport const RouterView = defineComponent({\n name: 'RouterView',\n setup(_, { slots }) {\n const router = useRouter();\n const level = inject(LEVEL, 0);\n const route = fromRouter(router, (s) => s.matches[level]?.route ?? null, { equals: Object.is });\n const failure = fromRouter(router, (s) => (s.error && s.error.at === level ? s.error : null), { equals: Object.is });\n return (): VNode | VNode[] | undefined => {\n const rec = route.value;\n if (!rec) return slots.default?.();\n const err = failure.value;\n if (err && !rec.errorComponent) throw err.error;\n const component = err ? rec.errorComponent : rec.component;\n return h(LevelScope, { level: level + 1 }, { default: () => (component ? h(component as never, err ? { error: err.error } : null) : h(RouterView)) });\n };\n },\n});\n\n/** An `<a>` that navigates through the router and keeps a real `href`. */\nexport const RouterLink = defineComponent({\n name: 'RouterLink',\n props: {\n to: { type: [String, Object] as PropType<string | AnyRoute>, required: true },\n params: Object as PropType<Record<string, unknown>>,\n query: Object as PropType<Record<string, unknown>>,\n hash: String,\n replace: Boolean,\n state: null as unknown as PropType<unknown>,\n activeClass: String,\n exact: Boolean,\n },\n setup(props, { slots, attrs }) {\n const router = useRouter();\n const target = () => ({ params: props.params, query: props.query, hash: props.hash });\n const href = fromRouter(router, () => router.href(props.to as never, target() as never), { equals: Object.is });\n const active = fromRouter(router, () => (props.activeClass ? router.isActive(props.to, { exact: props.exact, params: props.params }) : false), { equals: Object.is });\n const click = (e: MouseEvent) => {\n if (e.defaultPrevented || !isPlainClick(e) || isNativeAnchor(e.currentTarget as Element)) return;\n e.preventDefault();\n router\n .navigate(props.to as never, { replace: props.replace, state: props.state, ...target() } as never)\n .catch((err) => console.error('[@surgijs/router]', err));\n };\n return () =>\n h('a', { ...attrs, href: href.value, class: [attrs.class, active.value ? props.activeClass : null], onClick: click }, slots.default?.());\n },\n});\n\nexport function useLocation(): Readonly<ShallowRef<{ url: string; path: string; search: string; hash: string }>> {\n return fromRouter(useRouter(), (s) => ({ url: s.url, path: s.path, search: s.search, hash: s.hash }));\n}\n\nexport function useParams<R extends AnyRoute = AnyRoute>(_route?: R): Readonly<ShallowRef<RouteParams<R>>> {\n return fromRouter(useRouter(), (s) => s.params as RouteParams<R>);\n}\n\nexport function useQuery<R extends AnyRoute = AnyRoute>(_route?: R): Readonly<ShallowRef<RouteQuery<R>>> {\n return fromRouter(useRouter(), (s) => s.query as RouteQuery<R>);\n}\n\n/** The match at the depth of the component that calls it (the leaf outside routed components). */\nexport function useMatch(): Readonly<ShallowRef<Match | undefined>> {\n const level = inject(LEVEL, 0) - 1;\n return fromRouter(\n useRouter(),\n (s) => s.matches[level < 0 ? s.matches.length - 1 : level],\n { equals: (a, b) => a?.route === b?.route && a?.params === b?.params },\n );\n}\n\n/** What `load` returned for the route of the component that calls it. */\nexport function useLoaderData<T = unknown>(): Readonly<ShallowRef<T | undefined>> {\n const level = inject(LEVEL, 0) - 1;\n return fromRouter(useRouter(), (s) => s.data[level < 0 ? s.data.length - 1 : level] as T | undefined);\n}\n\nexport function useIsPending(): Readonly<ShallowRef<boolean>> {\n return fromRouter(useRouter(), (s) => s.isPending);\n}\n\nexport function useIsActive(to: string | AnyRoute, options?: { exact?: boolean; params?: Record<string, unknown> }): Readonly<ShallowRef<boolean>> {\n const router = useRouter();\n return fromRouter(router, () => router.isActive(to, options));\n}\n\n/** Registers a leave guard for the lifetime of the component's scope. */\nexport function useBeforeLeave(guard: LeaveGuard): void {\n const stop = useRouter().beforeLeave(guard);\n if (getCurrentScope()) onScopeDispose(stop);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,115 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surgijs/router",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Small framework-agnostic router: typed params and query, loaders, guards, slash/hash/memory history, SSR with hydration and first-class @surgijs/store integration. Adapters for React, Vue, Svelte, Angular and SurgiJS.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"keywords": [
|
|
12
|
+
"router",
|
|
13
|
+
"routing",
|
|
14
|
+
"ssr",
|
|
15
|
+
"hydration",
|
|
16
|
+
"surgijs",
|
|
17
|
+
"react",
|
|
18
|
+
"vue",
|
|
19
|
+
"svelte",
|
|
20
|
+
"angular"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/SurgiJS/surgijs.git",
|
|
25
|
+
"directory": "packages/router"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://surgijs.github.io/surgijs/",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"bugs": "https://github.com/SurgiJS/surgijs/issues",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"@surgijs/source": "./src/index.ts",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./core": {
|
|
39
|
+
"@surgijs/source": "./src/core.ts",
|
|
40
|
+
"types": "./dist/core.d.ts",
|
|
41
|
+
"import": "./dist/core.js"
|
|
42
|
+
},
|
|
43
|
+
"./server": {
|
|
44
|
+
"@surgijs/source": "./src/server.ts",
|
|
45
|
+
"types": "./dist/server.d.ts",
|
|
46
|
+
"import": "./dist/server.js"
|
|
47
|
+
},
|
|
48
|
+
"./react": {
|
|
49
|
+
"@surgijs/source": "./src/react.ts",
|
|
50
|
+
"types": "./dist/react.d.ts",
|
|
51
|
+
"import": "./dist/react.js"
|
|
52
|
+
},
|
|
53
|
+
"./vue": {
|
|
54
|
+
"@surgijs/source": "./src/vue.ts",
|
|
55
|
+
"types": "./dist/vue.d.ts",
|
|
56
|
+
"import": "./dist/vue.js"
|
|
57
|
+
},
|
|
58
|
+
"./svelte": {
|
|
59
|
+
"@surgijs/source": "./src/svelte.ts",
|
|
60
|
+
"types": "./dist/svelte.d.ts",
|
|
61
|
+
"import": "./dist/svelte.js"
|
|
62
|
+
},
|
|
63
|
+
"./angular": {
|
|
64
|
+
"@surgijs/source": "./src/angular.ts",
|
|
65
|
+
"types": "./dist/angular.d.ts",
|
|
66
|
+
"import": "./dist/angular.js"
|
|
67
|
+
},
|
|
68
|
+
"./package.json": "./package.json"
|
|
69
|
+
},
|
|
70
|
+
"main": "./dist/index.js",
|
|
71
|
+
"module": "./dist/index.js",
|
|
72
|
+
"types": "./dist/index.d.ts",
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"@angular/core": ">=19.0.0",
|
|
75
|
+
"@surgijs/core": ">=0.8.0 <1.0.0",
|
|
76
|
+
"@surgijs/store": ">=0.5.0 <1.0.0",
|
|
77
|
+
"react": ">=18",
|
|
78
|
+
"vue": ">=3.2.0"
|
|
79
|
+
},
|
|
80
|
+
"peerDependenciesMeta": {
|
|
81
|
+
"@angular/core": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"@surgijs/core": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"@surgijs/store": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
90
|
+
"react": {
|
|
91
|
+
"optional": true
|
|
92
|
+
},
|
|
93
|
+
"vue": {
|
|
94
|
+
"optional": true
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"@angular/core": "^22.3.0",
|
|
99
|
+
"@types/react": "^19.2.2",
|
|
100
|
+
"@types/react-dom": "^19.3.0",
|
|
101
|
+
"happy-dom": "^20.0.10",
|
|
102
|
+
"react": "^19.2.0",
|
|
103
|
+
"react-dom": "^19.3.1",
|
|
104
|
+
"vue": "^3.5.45",
|
|
105
|
+
"zod": "^4.6.7",
|
|
106
|
+
"@surgijs/core": "0.9.0",
|
|
107
|
+
"@surgijs/store": "0.5.0",
|
|
108
|
+
"@surgijs/compiler": "0.9.0",
|
|
109
|
+
"@surgijs/testing": "0.1.0"
|
|
110
|
+
},
|
|
111
|
+
"scripts": {
|
|
112
|
+
"build": "tsup",
|
|
113
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
114
|
+
}
|
|
6
115
|
}
|