@aerogel/plugin-routing 0.1.1 → 0.1.2-next.32f939e7d49fc700848bfc8d6d8e7377371e954b

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Noel De Martin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -4,9 +4,11 @@ import { ComputedRef } from 'vue';
4
4
  import { DefineComponent } from 'vue';
5
5
  import { Facade } from '@noeldemartin/utils';
6
6
  import { HTMLAttributes } from 'vue';
7
+ import { ModelConstructor } from 'soukai-bis';
7
8
  import { Plugin as Plugin_2 } from '@aerogel/core';
8
9
  import { PublicProps } from 'vue';
9
10
  import { Ref } from 'vue';
11
+ import { RouteLocationNormalized } from 'vue-router';
10
12
  import { RouteLocationNormalizedLoaded } from 'vue-router';
11
13
  import { RouteLocationRaw } from 'vue-router';
12
14
  import { RouteParams } from 'vue-router';
@@ -18,8 +20,16 @@ import { WatchStopHandle } from 'vue';
18
20
 
19
21
  declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLElement>;
20
22
 
23
+ declare const __VLS_component_2: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLHeadingElement>;
24
+
21
25
  declare type __VLS_Props = {
22
26
  class?: HTMLAttributes['class'];
27
+ title?: string;
28
+ fullbleed?: boolean;
29
+ };
30
+
31
+ declare type __VLS_Props_2 = {
32
+ class?: HTMLAttributes['class'];
23
33
  };
24
34
 
25
35
  declare function __VLS_template(): {
@@ -31,14 +41,31 @@ declare function __VLS_template(): {
31
41
  rootEl: HTMLElement;
32
42
  };
33
43
 
44
+ declare function __VLS_template_2(): {
45
+ attrs: Partial<{}>;
46
+ slots: {
47
+ default?(_: {}): any;
48
+ };
49
+ refs: {};
50
+ rootEl: HTMLHeadingElement;
51
+ };
52
+
34
53
  declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
35
54
 
55
+ declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
56
+
36
57
  declare type __VLS_WithTemplateSlots<T, S> = T & {
37
58
  new (): {
38
59
  $slots: S;
39
60
  };
40
61
  };
41
62
 
63
+ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
64
+ new (): {
65
+ $slots: S;
66
+ };
67
+ };
68
+
42
69
  export declare type AerogelRoute = RouteRecordRaw & {
43
70
  title?: string | ((params: Record<string, unknown>) => string | undefined | null);
44
71
  };
@@ -48,6 +75,8 @@ export declare class BindingNotFound {
48
75
  constructor(value: string);
49
76
  }
50
77
 
78
+ export declare function bindingNotFound(slug: string): BindingNotFound;
79
+
51
80
  declare const _default: ServiceWithState< {
52
81
  flashRoute: RouteLocationRaw | null;
53
82
  }, {}, Partial<{
@@ -73,7 +102,9 @@ export declare interface Options {
73
102
 
74
103
  export declare const Page: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
75
104
 
76
- export declare type RouteBinding = (slug: string, params: Record<string, unknown>) => unknown | Promise<unknown>;
105
+ export declare const PageTitle: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
106
+
107
+ export declare type RouteBinding = ModelConstructor | ((slug: string, params: Record<string, unknown>) => unknown);
77
108
 
78
109
  export declare type RouteBindings = Record<string, RouteBinding>;
79
110
 
@@ -92,16 +123,18 @@ export declare class RouterService extends _default {
92
123
  }): void;
93
124
  protected boot(): Promise<void>;
94
125
  protected __get(property: string): unknown;
95
- protected onEnterRoute(path: string, params: RouteParams): Promise<void>;
126
+ protected onEnterRoute(route: RouteLocationNormalized): Promise<void>;
96
127
  protected handleStatic404Redirect(): void;
97
128
  protected storeFlashRoute(): void;
98
129
  protected restoreFlashRoute(): Promise<void>;
99
- protected resolveBinding(path: string, name: string, value: RouteParamValue | RouteParamValue[]): Promise<Ref<unknown>>;
130
+ protected resolveBinding(route: RouteLocationNormalized, name: string, value: RouteParamValue | RouteParamValue[]): Promise<Ref<unknown>>;
100
131
  }
101
132
 
102
133
  export declare interface RouterService extends Omit<Router_2, 'currentRoute'> {
103
134
  }
104
135
 
136
+ export declare function routeUrl(route: RouteLocationRaw): URL;
137
+
105
138
  declare function routing(options: Options): Plugin_2;
106
139
  export default routing;
107
140
 
@@ -1,244 +1,260 @@
1
- var k = Object.defineProperty;
2
- var A = (e, s, t) => s in e ? k(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
- var u = (e, s, t) => A(e, typeof s != "symbol" ? s + "" : s, t);
4
- import W from "virtual:aerogel";
5
- import { defineServiceState as $, Events as f, App as l, computedAsync as j, classes as T, Link as V, UI as O, setMarkdownRouter as C, bootServices as G } from "@aerogel/core";
6
- import { useRoute as z, createRouter as L, createWebHistory as M, RouterLink as q } from "vue-router";
7
- import { customRef as D, watch as E, shallowRef as R, computed as h, unref as N, ref as H, defineComponent as p, createElementBlock as I, openBlock as x, normalizeClass as U, renderSlot as J, createBlock as K, withCtx as y, createElementVNode as Q, createVNode as X, toDisplayString as g, createTextVNode as Y, watchEffect as Z, h as b } from "vue";
8
- import { computedModel as ee } from "@aerogel/plugin-soukai";
9
- import { objectWithout as P, tap as te, facade as se, once as re, objectOnly as d, Storage as oe } from "@noeldemartin/utils";
10
- function ne(e, s) {
11
- return D((t, r) => {
12
- let o = P(c.routesParams.value[e] ?? {}, s);
13
- return E(c.routesParams, () => {
14
- const n = P(c.routesParams.value[e] ?? {}, s);
15
- for (const [i, a] of Object.entries(n))
16
- if (a === o[i]) {
17
- o = n, r();
18
- return;
19
- }
20
- }), {
21
- get: () => te(o, () => t()),
22
- // eslint-disable-next-line no-console
23
- set: () => console.warn("Computed models ref was not set (it is immutable).")
24
- };
25
- });
1
+ import { App as e, Events as t, Link as n, UI as r, bootServices as i, classes as a, computedAsync as o, defineServiceState as s, setMarkdownRouter as c } from "@aerogel/core";
2
+ import l from "virtual:aerogel";
3
+ import { RouterLink as u, createRouter as ee, createWebHistory as te, useRoute as d } from "vue-router";
4
+ import { Storage as f, facade as p, memo as ne, objectOnly as m, objectWithout as h, once as g, tap as re } from "@noeldemartin/utils";
5
+ import { computed as _, createBlock as v, createCommentVNode as y, createElementBlock as b, createElementVNode as ie, createTextVNode as x, createVNode as ae, customRef as S, defineComponent as C, h as w, normalizeClass as T, openBlock as E, ref as oe, renderSlot as D, resolveComponent as se, shallowRef as O, toDisplayString as k, unref as A, watch as j, watchEffect as M, withCtx as N } from "vue";
6
+ import { computedModel as P, findTrackedModel as F, getTrackedModels as I, loadTrackedModels as L } from "@aerogel/plugin-solid";
7
+ import { isModelClass as R } from "soukai-bis";
8
+ //#region src/utils/internal.ts
9
+ function z(e, t) {
10
+ return S((n, r) => {
11
+ let i = h($.routesParams.value[e] ?? {}, t);
12
+ return j($.routesParams, () => {
13
+ let n = h($.routesParams.value[e] ?? {}, t);
14
+ for (let [e, t] of Object.entries(n)) if (t === i[e]) {
15
+ i = n, r();
16
+ return;
17
+ }
18
+ }), {
19
+ get: () => re(i, () => n()),
20
+ set: () => console.warn("Computed models ref was not set (it is immutable).")
21
+ };
22
+ });
26
23
  }
27
- const ae = $({
28
- name: "router",
29
- initialState: {
30
- flashRoute: null
31
- },
32
- persist: ["flashRoute"]
33
- });
34
- class ue extends ae {
35
- constructor() {
36
- super();
37
- u(this, "currentRoute");
38
- u(this, "routesParams");
39
- u(this, "router");
40
- u(this, "bindings");
41
- u(this, "history");
42
- u(this, "routesStopWatchers");
43
- this.router = R(null), this.bindings = {}, this.history = [], this.routesStopWatchers = {}, this.routesParams = R({}), this.currentRoute = h(() => {
44
- const t = this.router.value, r = this.routesParams.value;
45
- if (!t)
46
- return null;
47
- const o = N(t.currentRoute);
48
- return {
49
- ...o,
50
- params: r == null ? void 0 : r[o.path],
51
- rawParams: o.params
52
- };
53
- });
54
- }
55
- use(t, r = {}) {
56
- this.router.value = t, this.bindings = r.bindings ?? {}, t.beforeEach(re(() => this.handleStatic404Redirect())), t.beforeEach((o) => this.onEnterRoute(o.path, o.params));
57
- }
58
- async boot() {
59
- f.on("auth:before-login", () => this.storeFlashRoute()), f.on("auth:login", () => this.restoreFlashRoute()), f.on("purge-storage", () => this.push({ name: "home" }));
60
- }
61
- __get(t) {
62
- return this.router.value ? super.__get(t) ?? Reflect.get(this.router.value, t) : super.__get(t);
63
- }
64
- async onEnterRoute(t, r) {
65
- var i;
66
- if (t in this.routesParams.value)
67
- return;
68
- const o = { ...r };
69
- for (const [a, m] of Object.entries(r)) {
70
- const v = await this.resolveBinding(t, a, m);
71
- E(v, (B) => {
72
- this.routesParams.value = {
73
- ...this.routesParams.value,
74
- [t]: {
75
- ...this.routesParams.value[t],
76
- [a]: B
77
- }
78
- };
79
- }), o[a] = v.value;
80
- }
81
- this.history = this.history.slice(0, 3), this.history.unshift(t);
82
- const n = {
83
- ...this.routesParams.value,
84
- [t]: {
85
- ...o,
86
- ...this.routesParams.value[t] ?? {}
87
- }
88
- };
89
- for (const a in n)
90
- this.history.includes(a) || (i = this.routesStopWatchers[a]) == null || i.forEach((m) => m());
91
- this.routesParams.value = d(n, this.history), this.routesStopWatchers = d(this.routesStopWatchers, this.history);
92
- }
93
- handleStatic404Redirect() {
94
- const t = oe.pull("static-404-redirect");
95
- t && this.replace(t);
96
- }
97
- storeFlashRoute() {
98
- this.flashRoute = d(this.currentRoute.value, [
99
- "path",
100
- "query",
101
- "hash"
102
- ]);
103
- }
104
- async restoreFlashRoute() {
105
- if (!this.flashRoute)
106
- return;
107
- const t = this.flashRoute;
108
- l.whenReady(() => this.replace(t)), this.flashRoute = null;
109
- }
110
- async resolveBinding(t, r, o) {
111
- const n = this.bindings[r];
112
- if (Array.isArray(o) || !n)
113
- return H(o);
114
- await l.ready;
115
- const i = ne(t, r), a = j(() => Promise.resolve(n(o, i.value)));
116
- return ee(() => a.value);
117
- }
24
+ //#endregion
25
+ //#region src/components/Page.vue
26
+ var B = /* @__PURE__ */ C({
27
+ __name: "Page",
28
+ props: {
29
+ class: { type: [
30
+ Boolean,
31
+ null,
32
+ String,
33
+ Object,
34
+ Array
35
+ ] },
36
+ title: {},
37
+ fullbleed: { type: Boolean }
38
+ },
39
+ setup(e) {
40
+ let t = _(() => a("mx-auto flex w-full grow flex-col px-edge py-8", e.fullbleed || "max-w-screen-content", e.class));
41
+ return (n, r) => {
42
+ let i = se("PageTitle");
43
+ return E(), b("main", { class: T(t.value) }, [e.title ? (E(), v(i, { key: 0 }, {
44
+ default: N(() => [x(k(e.title), 1)]),
45
+ _: 1
46
+ })) : y("", !0), D(n.$slots, "default")], 2);
47
+ };
48
+ }
49
+ }), V = { class: "text-2xl font-bold" }, H = /* @__PURE__ */ C({
50
+ __name: "NotFound",
51
+ setup(e) {
52
+ return (e, t) => (E(), v(B, { class: "items-center justify-center" }, {
53
+ default: N(() => [ie("h2", V, k(e.$td("notFound.title", "404: Not Found")), 1), ae(A(n), { route: "home" }, {
54
+ default: N(() => [x(k(e.$td("notFound.home", "Go home")), 1)]),
55
+ _: 1
56
+ })]),
57
+ _: 1
58
+ }));
59
+ }
60
+ }), U = class {
61
+ value;
62
+ constructor(e) {
63
+ this.value = e;
64
+ }
65
+ };
66
+ //#endregion
67
+ //#region src/utils/routes.ts
68
+ function W(e, t) {
69
+ let n = d(), r = _(() => $.routesParams?.value[n.path]), i = _(() => !t?.title || !r.value ? null : typeof t.title == "string" ? t.title : t.title(r.value));
70
+ return M(() => ue(i.value)), () => Object.values(r.value ?? {}).some((e) => e instanceof U) ? w(H) : w(e, r.value);
118
71
  }
119
- const c = se(ue);
120
- class ie {
121
- constructor(s) {
122
- this.value = s;
123
- }
72
+ function G(e, t) {
73
+ return C({ setup: () => W(e, t) });
124
74
  }
125
- const ce = /* @__PURE__ */ p({
126
- __name: "Page",
127
- props: {
128
- class: {}
129
- },
130
- setup(e) {
131
- const s = h(() => T("mx-auto flex w-full max-w-screen-content grow flex-col px-edge py-8", e.class));
132
- return (t, r) => (x(), I("main", {
133
- class: U(s.value)
134
- }, [
135
- J(t.$slots, "default")
136
- ], 2));
137
- }
138
- }), le = { class: "text-2xl font-bold" }, F = /* @__PURE__ */ p({
139
- __name: "NotFound",
140
- setup(e) {
141
- return (s, t) => (x(), K(ce, { class: "items-center justify-center" }, {
142
- default: y(() => [
143
- Q("h2", le, g(s.$td("notFound.title", "404: Not Found")), 1),
144
- X(N(V), { route: "home" }, {
145
- default: y(() => [
146
- Y(g(s.$td("notFound.home", "Go home")), 1)
147
- ]),
148
- _: 1
149
- })
150
- ]),
151
- _: 1
152
- }));
153
- }
154
- });
155
- function he(e, s) {
156
- const t = z(), r = h(() => {
157
- var n;
158
- return (n = c.routesParams) == null ? void 0 : n.value[t.path];
159
- }), o = h(() => !(s != null && s.title) || !r.value ? null : typeof s.title == "string" ? s.title : s.title(r.value));
160
- return Z(() => de(o.value)), () => Object.values(r.value ?? {}).some((n) => n instanceof ie) ? b(F) : b(e, r.value);
75
+ function ce(e) {
76
+ if (e.component) {
77
+ if (typeof e.component == "function") {
78
+ let t = e.component;
79
+ e.component = async () => {
80
+ let { default: n } = await t();
81
+ return G(n, e);
82
+ };
83
+ return;
84
+ }
85
+ e.component = G(e.component, e);
86
+ }
161
87
  }
162
- function _(e, s) {
163
- return p({
164
- setup: () => he(e, s)
165
- });
88
+ function K(t) {
89
+ return async function(...n) {
90
+ return await e.ready, t.call(this, ...n);
91
+ };
166
92
  }
167
- function me(e) {
168
- if (e.component) {
169
- if (typeof e.component == "function") {
170
- const s = e.component;
171
- e.component = async () => {
172
- const { default: t } = await s();
173
- return _(t, e);
174
- };
175
- return;
176
- }
177
- e.component = _(e.component, e);
178
- }
93
+ function le(e) {
94
+ if (e.beforeEnter) {
95
+ if (Array.isArray(e.beforeEnter)) {
96
+ e.beforeEnter = e.beforeEnter.map(K);
97
+ return;
98
+ }
99
+ e.beforeEnter = K(e.beforeEnter);
100
+ }
179
101
  }
180
- function w(e) {
181
- return async function(...s) {
182
- return await l.ready, e.call(this, ...s);
183
- };
102
+ function ue(t) {
103
+ if (globalThis.document) {
104
+ if (!t) {
105
+ globalThis.document.title = e.name;
106
+ return;
107
+ }
108
+ globalThis.document.title = `${t} | ${e.name}`;
109
+ }
184
110
  }
185
- function fe(e) {
186
- if (e.beforeEnter) {
187
- if (Array.isArray(e.beforeEnter)) {
188
- e.beforeEnter = e.beforeEnter.map(w);
189
- return;
190
- }
191
- e.beforeEnter = w(e.beforeEnter);
192
- }
111
+ function q(e) {
112
+ return ce(e), le(e), e;
193
113
  }
194
114
  function de(e) {
195
- if (globalThis.document) {
196
- if (!e) {
197
- globalThis.document.title = l.name;
198
- return;
199
- }
200
- globalThis.document.title = `${e} | ${l.name}`;
201
- }
115
+ return e;
202
116
  }
203
- function S(e) {
204
- return me(e), fe(e), e;
117
+ function J(e) {
118
+ let t = e.map(q);
119
+ return t.some((e) => e.name === "not-found" || e.name === "404") || t.push(q({
120
+ name: "not-found",
121
+ path: "/:path(.*)*",
122
+ component: H
123
+ })), t;
205
124
  }
206
- function we(e) {
207
- return e;
125
+ function Y(e) {
126
+ return ne(`binding-not-found-${e}`, () => new U(e));
208
127
  }
209
- function Se(e) {
210
- const s = e.map(S);
211
- return s.some((t) => t.name === "not-found" || t.name === "404") || s.push(
212
- S({
213
- name: "not-found",
214
- path: "/:path(.*)*",
215
- component: F
216
- })
217
- ), s;
128
+ //#endregion
129
+ //#region src/utils/soukai.ts
130
+ function X(e, t, n) {
131
+ return I(e).find((e) => n && e.url === n || e.getSlug() === t);
218
132
  }
219
- const pe = { $router: c };
220
- function Ee(e) {
221
- return {
222
- async install(s) {
223
- const t = L({
224
- routes: e.routes,
225
- history: M(e.basePath ?? W.basePath)
226
- });
227
- O.registerComponent("router-link", q), c.use(t, e), s.use(t), C({
228
- resolve: (r) => t.resolve({ name: r }).href,
229
- visit: async (r) => void await t.push({ name: r })
230
- }), await G(s, pe);
231
- }
232
- };
133
+ async function Z(e, t, n) {
134
+ let r = typeof n?.query?.url == "string" ? n.query.url : null, i = X(e, t, r);
135
+ if (i) return i;
136
+ let a = await F(e, r ?? e.urlFromSlug(t));
137
+ return a && (r || a.getSlug() === t) ? a : (await L(e), X(e, t, r) ?? Y(t));
233
138
  }
234
- export {
235
- ie as BindingNotFound,
236
- ce as Page,
237
- c as Router,
238
- ue as RouterService,
239
- Ee as default,
240
- S as defineRoute,
241
- we as defineRouteBindings,
242
- Se as defineRoutes
243
- };
244
- //# sourceMappingURL=aerogel-plugin-routing.js.map
139
+ //#endregion
140
+ //#region src/services/Router.state.ts
141
+ var fe = s({
142
+ name: "router",
143
+ initialState: { flashRoute: null },
144
+ persist: ["flashRoute"]
145
+ }), Q = class extends fe {
146
+ currentRoute;
147
+ routesParams;
148
+ router;
149
+ bindings;
150
+ history;
151
+ routesStopWatchers;
152
+ constructor() {
153
+ super(), this.router = O(null), this.bindings = {}, this.history = [], this.routesStopWatchers = {}, this.routesParams = O({}), this.currentRoute = _(() => {
154
+ let e = this.router.value, t = this.routesParams.value;
155
+ if (!e) return null;
156
+ let n = A(e.currentRoute);
157
+ return {
158
+ ...n,
159
+ params: t?.[n.path],
160
+ rawParams: n.params
161
+ };
162
+ });
163
+ }
164
+ use(e, t = {}) {
165
+ this.router.value = e, this.bindings = t.bindings ?? {}, e.beforeEach(g(() => this.handleStatic404Redirect())), e.beforeEach((e) => this.onEnterRoute(e));
166
+ }
167
+ async boot() {
168
+ t.on("auth:before-login", () => this.storeFlashRoute()), t.on("auth:login", () => this.restoreFlashRoute()), t.on("purge-storage", () => this.push({ name: "home" }));
169
+ }
170
+ __get(e) {
171
+ return this.router.value ? super.__get(e) ?? Reflect.get(this.router.value, e) : super.__get(e);
172
+ }
173
+ async onEnterRoute(e) {
174
+ let { path: t, params: n } = e;
175
+ if (t in this.routesParams.value) return;
176
+ let r = { ...n }, i = [];
177
+ for (let [a, o] of Object.entries(n)) {
178
+ let n = await this.resolveBinding(e, a, o), s = j(n, (e) => {
179
+ this.routesParams.value = {
180
+ ...this.routesParams.value,
181
+ [t]: {
182
+ ...this.routesParams.value[t],
183
+ [a]: e
184
+ }
185
+ };
186
+ });
187
+ i.push(s), r[a] = n.value;
188
+ }
189
+ this.history = this.history.slice(0, 3), this.history.unshift(t);
190
+ let a = {
191
+ ...this.routesParams.value,
192
+ [t]: {
193
+ ...r,
194
+ ...this.routesParams.value[t]
195
+ }
196
+ };
197
+ for (let e in a) this.history.includes(e) || this.routesStopWatchers[e]?.forEach((e) => e());
198
+ this.routesParams.value = m(a, this.history), this.routesStopWatchers = m(this.routesStopWatchers, this.history);
199
+ }
200
+ handleStatic404Redirect() {
201
+ let e = f.pull("static-404-redirect");
202
+ e && this.replace(e);
203
+ }
204
+ storeFlashRoute() {
205
+ this.flashRoute = m(this.currentRoute.value, [
206
+ "path",
207
+ "query",
208
+ "hash"
209
+ ]);
210
+ }
211
+ async restoreFlashRoute() {
212
+ if (!this.flashRoute) return;
213
+ let t = this.flashRoute;
214
+ e.whenReady(() => this.replace(t)), this.flashRoute = null;
215
+ }
216
+ async resolveBinding(t, n, r) {
217
+ let i = this.bindings[n];
218
+ if (Array.isArray(r) || !i) return oe(r);
219
+ await e.ready;
220
+ let a = z(t.path, n), s = R(i) ? await Z(i, r, t) : void 0, c = R(i) ? o(() => Z(i, r, t)) : o(() => Promise.resolve(i(r, a.value)));
221
+ return P(() => c.value ?? s);
222
+ }
223
+ }, $ = p(Q);
224
+ //#endregion
225
+ //#region src/utils/urls.ts
226
+ function pe(e) {
227
+ return new URL($.resolve(e).href, location.origin);
228
+ }
229
+ //#endregion
230
+ //#region src/components/PageTitle.vue
231
+ var me = /* @__PURE__ */ C({
232
+ __name: "PageTitle",
233
+ props: { class: { type: [
234
+ Boolean,
235
+ null,
236
+ String,
237
+ Object,
238
+ Array
239
+ ] } },
240
+ setup(e) {
241
+ let t = _(() => a("text-page-title text-slate-900", e.class));
242
+ return (e, n) => (E(), b("h1", { class: T(t.value) }, [D(e.$slots, "default")], 2));
243
+ }
244
+ }), he = { $router: $ };
245
+ function ge(e) {
246
+ return { async install(t) {
247
+ let n = ee({
248
+ routes: e.routes,
249
+ history: te(e.basePath ?? l.basePath)
250
+ });
251
+ r.registerComponent("router-link", u), $.use(n, e), t.use(n), c({
252
+ resolve: (e) => n.resolve({ name: e }).href,
253
+ visit: async (e) => void await n.push({ name: e })
254
+ }), await i(t, he);
255
+ } };
256
+ }
257
+ //#endregion
258
+ export { U as BindingNotFound, B as Page, me as PageTitle, $ as Router, Q as RouterService, Y as bindingNotFound, ge as default, q as defineRoute, de as defineRouteBindings, J as defineRoutes, pe as routeUrl };
259
+
260
+ //# sourceMappingURL=aerogel-plugin-routing.js.map