@mhmo91/schmancy 0.5.1 → 0.5.3
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/area.cjs +1 -1
- package/dist/{area.component-Oe5ARA8j.js → area.component-3yEm0Ikj.js} +106 -98
- package/dist/area.component-3yEm0Ikj.js.map +1 -0
- package/dist/area.component-XtxnlVW-.cjs +12 -0
- package/dist/area.component-XtxnlVW-.cjs.map +1 -0
- package/dist/area.js +1 -1
- package/dist/{avatar-KoZsr-CS.js → avatar-BUaTIoft.js} +3 -3
- package/dist/{avatar-KoZsr-CS.js.map → avatar-BUaTIoft.js.map} +1 -1
- package/dist/{avatar-8S9Tq43j.cjs → avatar-C-7vIiiN.cjs} +2 -2
- package/dist/{avatar-8S9Tq43j.cjs.map → avatar-C-7vIiiN.cjs.map} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/chips.cjs +1 -1
- package/dist/chips.js +2 -3
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +166 -167
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/{chips-BWSXmedd.cjs → suggestion-chip-CNa4Qp8J.cjs} +100 -100
- package/dist/suggestion-chip-CNa4Qp8J.cjs.map +1 -0
- package/dist/{chips-DIoIf1ND.js → suggestion-chip-DlMySKjR.js} +206 -207
- package/dist/suggestion-chip-DlMySKjR.js.map +1 -0
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/types/src/chips/index.d.ts +5 -11
- package/dist/area.component-Oe5ARA8j.js.map +0 -1
- package/dist/area.component-VxW9QIje.cjs +0 -12
- package/dist/area.component-VxW9QIje.cjs.map +0 -1
- package/dist/chips-BWSXmedd.cjs.map +0 -1
- package/dist/chips-DIoIf1ND.js.map +0 -1
package/dist/area.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./area.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./area.component-XtxnlVW-.cjs"),e=require("./utils-C38P63L6.cjs");exports.FINDING_MORTIES=t.FINDING_MORTIES,exports.HERE_RICKY=t.HERE_RICKY,exports.HISTORY_STRATEGY=t.HISTORY_STRATEGY,Object.defineProperty(exports,"SchmancyArea",{enumerable:!0,get:()=>t.SchmancyArea}),Object.defineProperty(exports,"SchmancyRoute",{enumerable:!0,get:()=>t.SchmancyRoute}),exports.area=t.area,exports.routerHistory=t.routerHistory,exports.buildQueryString=e.buildQueryString,exports.compareActiveRoutes=e.compareActiveRoutes,exports.compareCustomElementConstructors=e.compareCustomElementConstructors,exports.compareRouteActions=e.compareRouteActions,exports.createRouteCacheKey=e.createRouteCacheKey,exports.debounce=e.debounce,exports.decodeData=e.decodeData,exports.decodeRouteState=e.decodeRouteState,exports.deepMerge=e.deepMerge,exports.encodeData=e.encodeData,exports.encodeRouteState=e.encodeRouteState,exports.extractQueryParams=e.extractQueryParams,exports.getTagName=e.getTagName,exports.isObject=e.isObject,exports.lazy=e.lazy,exports.normalizeTagName=e.normalizeTagName,exports.sanitizeRouteState=e.sanitizeRouteState;
|
|
2
2
|
//# sourceMappingURL=area.cjs.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Subject as
|
|
1
|
+
import { Subject as B, ReplaySubject as $, fromEvent as P, distinctUntilChanged as y, shareReplay as L, skip as x, map as i, filter as m, catchError as d, EMPTY as l, zip as F, of as v, bufferTime as T, tap as U, timeout as _, merge as W, take as z, switchMap as N, takeUntil as D } from "rxjs";
|
|
2
2
|
import "lit/directives/class-map.js";
|
|
3
3
|
import "lit/directives/style-map.js";
|
|
4
|
-
import { property as
|
|
4
|
+
import { property as S, customElement as M, queryAssignedElements as Q } from "lit/decorators.js";
|
|
5
5
|
import "./tailwind.mixin-DRrIaNCZ.js";
|
|
6
|
-
import { $ as
|
|
7
|
-
import { css as
|
|
8
|
-
const
|
|
9
|
-
class
|
|
6
|
+
import { $ as H } from "./litElement.mixin-CAQ8pH9g.js";
|
|
7
|
+
import { css as J, html as I } from "lit";
|
|
8
|
+
const q = new B(), Y = "FINDING_MORTIES", G = "HERE_RICKY", k = /* @__PURE__ */ new WeakMap();
|
|
9
|
+
class O {
|
|
10
10
|
constructor() {
|
|
11
|
-
this.prettyURL = !1, this.mode = "HISTORY", this.request = new
|
|
11
|
+
this.prettyURL = !1, this.mode = "HISTORY", this.request = new $(1), this.current = /* @__PURE__ */ new Map(), this.$current = new $(1), this.enableHistoryMode = !0, this.findingMortiesEvent = new CustomEvent(Y), this.disposed = !1, this.isProcessingPopstate = !1, this.$current.next(this.current), this.$current.subscribe((e) => {
|
|
12
12
|
this.disposed || e.forEach((t, r) => {
|
|
13
13
|
this.getOrCreateAreaSubject(r).next(t);
|
|
14
14
|
});
|
|
@@ -32,7 +32,7 @@ class E {
|
|
|
32
32
|
getOrCreateAreaSubject(e) {
|
|
33
33
|
let t = this.areaSubjects.get(e);
|
|
34
34
|
if (!t || t.closed) {
|
|
35
|
-
t = new
|
|
35
|
+
t = new $(1), this.areaSubjects.set(e, t);
|
|
36
36
|
const r = this.current.get(e);
|
|
37
37
|
r && t.next({ ...r, state: r.state || {}, params: r.params || {}, props: r.props || {} });
|
|
38
38
|
}
|
|
@@ -40,41 +40,41 @@ class E {
|
|
|
40
40
|
}
|
|
41
41
|
on(e, t = !1) {
|
|
42
42
|
if (!e) throw new Error("Area name is required");
|
|
43
|
-
const r = this.getOrCreateAreaSubject(e).asObservable().pipe(y((n, a) => n.component === a.component && JSON.stringify(n.state) === JSON.stringify(a.state) && JSON.stringify(n.params) === JSON.stringify(a.params)),
|
|
44
|
-
return t ? r.pipe(
|
|
43
|
+
const r = this.getOrCreateAreaSubject(e).asObservable().pipe(y((n, a) => n.component === a.component && JSON.stringify(n.state) === JSON.stringify(a.state) && JSON.stringify(n.params) === JSON.stringify(a.params)), L(1));
|
|
44
|
+
return t ? r.pipe(x(1)) : r;
|
|
45
45
|
}
|
|
46
46
|
all(e = !1) {
|
|
47
|
-
const t = this.$current.asObservable().pipe(
|
|
48
|
-
return e ? t.pipe(
|
|
47
|
+
const t = this.$current.asObservable().pipe(L(1));
|
|
48
|
+
return e ? t.pipe(x(1)) : t;
|
|
49
49
|
}
|
|
50
50
|
getState(e) {
|
|
51
51
|
if (!e) throw new Error("Area name is required");
|
|
52
|
-
return this.on(e).pipe(
|
|
52
|
+
return this.on(e).pipe(i((t) => t.state), m((t) => t != null), y((t, r) => JSON.stringify(t) === JSON.stringify(r)), i((t) => t), d((t) => l));
|
|
53
53
|
}
|
|
54
54
|
params(e) {
|
|
55
55
|
if (!e) throw new Error("Area name is required");
|
|
56
|
-
return this.on(e).pipe(
|
|
56
|
+
return this.on(e).pipe(i((t) => t.params), m((t) => t != null), y((t, r) => JSON.stringify(t) === JSON.stringify(r)), i((t) => t), d((t) => l));
|
|
57
57
|
}
|
|
58
58
|
param(e, t) {
|
|
59
59
|
if (!e || !t) throw new Error("Area name and key are required");
|
|
60
|
-
return this.params(e).pipe(
|
|
60
|
+
return this.params(e).pipe(i((r) => r[t]), m((r) => r !== void 0), y(), i((r) => r), d((r) => l));
|
|
61
61
|
}
|
|
62
62
|
props(e) {
|
|
63
63
|
if (!e) throw new Error("Area name is required");
|
|
64
|
-
return this.on(e).pipe(
|
|
64
|
+
return this.on(e).pipe(i((t) => t.props), m((t) => t != null), y((t, r) => JSON.stringify(t) === JSON.stringify(r)), i((t) => t), d((t) => l));
|
|
65
65
|
}
|
|
66
66
|
prop(e, t) {
|
|
67
67
|
if (!e || !t) throw new Error("Area name and key are required");
|
|
68
|
-
return this.props(e).pipe(
|
|
68
|
+
return this.props(e).pipe(i((r) => r[t]), m((r) => r !== void 0), y(), i((r) => r), d((r) => l));
|
|
69
69
|
}
|
|
70
70
|
find() {
|
|
71
|
-
return
|
|
71
|
+
return F([P(window, G).pipe(i((e) => e.detail), T(0)), v(1).pipe(U(() => window.dispatchEvent(this.findingMortiesEvent)))]).pipe(i(([e]) => e), _(1), d(() => l));
|
|
72
72
|
}
|
|
73
73
|
push(e) {
|
|
74
74
|
if (!e.area) throw new Error("Area is required for route action");
|
|
75
75
|
if (this.isProcessingPopstate) return;
|
|
76
76
|
const t = { ...e, state: e.state || {}, params: e.params || {}, props: e.props || {}, _source: "programmatic" };
|
|
77
|
-
this.enableHistoryMode &&
|
|
77
|
+
this.enableHistoryMode && q.next(t), this.request.next(t), this.dispatchAreaEvent(t.area, t);
|
|
78
78
|
}
|
|
79
79
|
_updateFromBrowser(e) {
|
|
80
80
|
const t = { ...e, state: e.state || {}, params: e.params || {}, props: e.props || {}, _source: "browser" };
|
|
@@ -84,8 +84,8 @@ class E {
|
|
|
84
84
|
if (this.enableHistoryMode) try {
|
|
85
85
|
const a = history.state || {}, o = a.schmancyAreas || {}, p = { component: t.component, area: t.area };
|
|
86
86
|
t.state && Object.keys(t.state).length > 0 && (p.state = t.state), t.params && Object.keys(t.params).length > 0 && (p.params = t.params), t.props && Object.keys(t.props).length > 0 && (p.props = t.props), o[e] = p;
|
|
87
|
-
const
|
|
88
|
-
r === "replace" || r === "pop" ? history.replaceState(
|
|
87
|
+
const c = { ...a, schmancyAreas: o }, u = this.createCleanURL(o, n);
|
|
88
|
+
r === "replace" || r === "pop" ? history.replaceState(c, "", u) : r !== "push" && r || history.pushState(c, "", u);
|
|
89
89
|
} catch {
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -96,29 +96,29 @@ class E {
|
|
|
96
96
|
o && (o.includes("{") || o.includes("%7B")) ? (n.pop(), a = n.join("/") || "/") : a = r, a === "/" || a.endsWith("/") || (a += "/");
|
|
97
97
|
let p = "";
|
|
98
98
|
if (t !== !0) {
|
|
99
|
-
const
|
|
100
|
-
Array.isArray(t) && t.forEach((u) =>
|
|
99
|
+
const c = new URLSearchParams(location.search);
|
|
100
|
+
Array.isArray(t) && t.forEach((u) => c.delete(u)), p = c.toString(), p = p ? `?${p}` : "";
|
|
101
101
|
}
|
|
102
102
|
if (this.prettyURL) {
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
let u = a === "/" ? `/${
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
typeof
|
|
103
|
+
const c = e.main;
|
|
104
|
+
if (c) {
|
|
105
|
+
let u = a === "/" ? `/${c.component}` : `${a}${c.component}`;
|
|
106
|
+
const j = new URLSearchParams(p);
|
|
107
|
+
c.params && Object.entries(c.params).forEach(([g, R]) => {
|
|
108
|
+
typeof R != "string" && typeof R != "number" || j.set(g, String(R));
|
|
109
109
|
});
|
|
110
|
-
const h =
|
|
110
|
+
const h = j.toString();
|
|
111
111
|
return u + (h ? `?${h}` : "");
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
try {
|
|
115
|
-
const
|
|
116
|
-
if (Object.entries(e).forEach(([
|
|
117
|
-
const
|
|
118
|
-
h.state && Object.keys(h.state).length > 0 && (
|
|
119
|
-
}), Object.keys(
|
|
115
|
+
const c = {};
|
|
116
|
+
if (Object.entries(e).forEach(([j, h]) => {
|
|
117
|
+
const g = { component: h.component };
|
|
118
|
+
h.state && Object.keys(h.state).length > 0 && (g.state = h.state), h.params && Object.keys(h.params).length > 0 && (g.params = h.params), h.props && Object.keys(h.props).length > 0 && (g.props = h.props), c[j] = g;
|
|
119
|
+
}), Object.keys(c).length === 0)
|
|
120
120
|
return `${a === "/" ? "" : a.replace(/\/$/, "")}${p}`;
|
|
121
|
-
const u = encodeURIComponent(JSON.stringify(
|
|
121
|
+
const u = encodeURIComponent(JSON.stringify(c));
|
|
122
122
|
return `${a === "/" ? "" : a.replace(/\/$/, "")}/${u}${p}`;
|
|
123
123
|
} catch {
|
|
124
124
|
return location.pathname;
|
|
@@ -163,10 +163,10 @@ class E {
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
dispose() {
|
|
166
|
-
this.disposed || (this.disposed = !0, this.unloadSubscription && (this.unloadSubscription.unsubscribe(), this.unloadSubscription = void 0), this.areaSubjects.forEach((e) => e.complete()), this.areaSubjects.clear(), this.request.complete(), this.$current.complete(),
|
|
166
|
+
this.disposed || (this.disposed = !0, this.unloadSubscription && (this.unloadSubscription.unsubscribe(), this.unloadSubscription = void 0), this.areaSubjects.forEach((e) => e.complete()), this.areaSubjects.clear(), this.request.complete(), this.$current.complete(), q.complete(), this.current.clear(), k.delete(this));
|
|
167
167
|
}
|
|
168
168
|
static getInstance() {
|
|
169
|
-
return
|
|
169
|
+
return O.instance || (O.instance = new O()), O.instance;
|
|
170
170
|
}
|
|
171
171
|
get state() {
|
|
172
172
|
try {
|
|
@@ -186,12 +186,12 @@ class E {
|
|
|
186
186
|
return this.current.get(e);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
var K = Object.defineProperty, V = Object.getOwnPropertyDescriptor,
|
|
189
|
+
const w = O.getInstance();
|
|
190
|
+
var K = Object.defineProperty, V = Object.getOwnPropertyDescriptor, E = (s, e, t, r) => {
|
|
191
191
|
for (var n, a = r > 1 ? void 0 : r ? V(e, t) : e, o = s.length - 1; o >= 0; o--) (n = s[o]) && (a = (r ? n(e, t, a) : n(a)) || a);
|
|
192
192
|
return r && a && K(e, t, a), a;
|
|
193
193
|
};
|
|
194
|
-
let
|
|
194
|
+
let f = class extends H(J`
|
|
195
195
|
:host {
|
|
196
196
|
display: none;
|
|
197
197
|
}
|
|
@@ -206,12 +206,12 @@ let g = class extends M(H`
|
|
|
206
206
|
return I``;
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
|
-
|
|
210
|
-
var
|
|
209
|
+
E([S({ type: String })], f.prototype, "when", 2), E([S({ type: Object })], f.prototype, "component", 2), E([S({ type: Boolean })], f.prototype, "exact", 2), E([S({ type: Object })], f.prototype, "guard", 2), f = E([M("schmancy-route")], f);
|
|
210
|
+
var b = ((s) => (s.push = "push", s.replace = "replace", s.pop = "pop", s.silent = "silent", s))(b || {}), X = Object.defineProperty, Z = Object.getOwnPropertyDescriptor, C = (s, e, t, r) => {
|
|
211
211
|
for (var n, a = r > 1 ? void 0 : r ? Z(e, t) : e, o = s.length - 1; o >= 0; o--) (n = s[o]) && (a = (r ? n(e, t, a) : n(a)) || a);
|
|
212
212
|
return r && a && X(e, t, a), a;
|
|
213
213
|
};
|
|
214
|
-
let
|
|
214
|
+
let A = class extends H(J`
|
|
215
215
|
:host {
|
|
216
216
|
position: relative;
|
|
217
217
|
display: block;
|
|
@@ -220,78 +220,86 @@ let j = class extends M(H`
|
|
|
220
220
|
`) {
|
|
221
221
|
firstUpdated() {
|
|
222
222
|
if (!this.name) throw new Error("Area name is required");
|
|
223
|
-
|
|
224
|
-
if (typeof s.component == "string") {
|
|
225
|
-
const e = this.routes?.find((t) => t.when === s.component);
|
|
226
|
-
if (e) return { ...s, component: e.component, originalWhen: e.when };
|
|
227
|
-
}
|
|
228
|
-
return s;
|
|
229
|
-
})), f(location.pathname).pipe(z(1), $(() => {
|
|
223
|
+
W(w.request.pipe(m(({ area: s }) => s === this.name)), v(location.pathname).pipe(z(1), i(() => {
|
|
230
224
|
const s = location.pathname, e = s.split("/").pop() || "";
|
|
231
|
-
let t, r;
|
|
232
225
|
if (e && (e.includes("{") || e.includes("%7B"))) try {
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
235
|
-
const o = a[this.name];
|
|
236
|
-
return t = this.routes?.find((p) => p.when === o.component), r = t?.when || o.component, f(t ? { area: this.name, component: t.component, state: a[this.name].state || {}, params: a[this.name].params || {}, historyStrategy: w.replace, originalWhen: r } : { area: this.name, component: a[this.name].component, state: a[this.name].state || {}, params: a[this.name].params || {}, historyStrategy: w.replace, originalWhen: o.component });
|
|
237
|
-
}
|
|
226
|
+
const r = JSON.parse(decodeURIComponent(e));
|
|
227
|
+
if (r[this.name]) return { area: this.name, component: r[this.name].component, state: r[this.name].state || {}, params: r[this.name].params || {}, historyStrategy: b.replace };
|
|
238
228
|
} catch {
|
|
239
229
|
}
|
|
240
|
-
const
|
|
241
|
-
return t
|
|
242
|
-
})), P(window, "popstate").pipe(
|
|
230
|
+
const t = s.split("/").filter(Boolean).find((r) => this.routes?.some((n) => n.when === r));
|
|
231
|
+
return t ? { area: this.name, component: t, state: {}, params: {}, historyStrategy: b.silent } : this.default ? { area: this.name, component: this.default, state: {}, params: {}, historyStrategy: b.silent } : null;
|
|
232
|
+
}), m((s) => s !== null)), P(window, "popstate").pipe(i((s) => {
|
|
243
233
|
if (s.state?.schmancyAreas?.[this.name]) {
|
|
244
|
-
const e = s.state.schmancyAreas[this.name]
|
|
245
|
-
return { area: this.name, component:
|
|
234
|
+
const e = s.state.schmancyAreas[this.name];
|
|
235
|
+
return { area: this.name, component: e.component, state: e.state || {}, params: e.params || {}, historyStrategy: b.pop };
|
|
246
236
|
}
|
|
247
237
|
return null;
|
|
248
|
-
}),
|
|
238
|
+
}), m((s) => s !== null))).pipe(m((s) => s?.component !== void 0), i((s) => {
|
|
239
|
+
let e, t, r = s.component;
|
|
240
|
+
if (typeof r == "string" && this.routes) e = this.routes.find((n) => n.when === r), e ? (r = e.component, t = e.when) : t = r;
|
|
241
|
+
else if (typeof r == "function" && this.routes) e = this.routes.find((n) => n.component === r), e && (t = e.when);
|
|
242
|
+
else if (r instanceof HTMLElement && this.routes) {
|
|
243
|
+
const n = r.tagName.toLowerCase();
|
|
244
|
+
e = this.routes.find((a) => a.when === n), e && (t = e.when);
|
|
245
|
+
}
|
|
246
|
+
return { ...s, component: r, matchedRoute: e, originalWhen: t };
|
|
247
|
+
}), N((s) => {
|
|
248
|
+
const e = s.matchedRoute || (s.originalWhen ? this.routes?.find((n) => n.when === s.originalWhen) : void 0);
|
|
249
|
+
if (e?.guard) return e.guard.pipe(U((n) => {
|
|
250
|
+
}), N((n) => {
|
|
251
|
+
if (n === !0) {
|
|
252
|
+
const { matchedRoute: o, ...p } = s;
|
|
253
|
+
return v(p);
|
|
254
|
+
}
|
|
255
|
+
const a = new CustomEvent("redirect", { detail: { blockedRoute: s.originalWhen || "unknown", area: this.name, params: s.params || {}, state: s.state || {}, redirectTarget: typeof n == "object" ? n : void 0 }, bubbles: !0, composed: !0 });
|
|
256
|
+
return e.dispatchEvent(a), l;
|
|
257
|
+
}));
|
|
258
|
+
const { matchedRoute: t, ...r } = s;
|
|
259
|
+
return v(r);
|
|
260
|
+
}), N(async (s) => {
|
|
249
261
|
let e = s.component;
|
|
250
262
|
if (typeof e == "function" && ("preload" in e || "_promise" in e || "_module" in e)) try {
|
|
251
263
|
e = (await e()).default;
|
|
252
264
|
} catch {
|
|
253
|
-
return { component: null
|
|
265
|
+
return { ...s, component: null };
|
|
254
266
|
}
|
|
255
|
-
return {
|
|
256
|
-
}),
|
|
257
|
-
let
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
return
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
let t = null;
|
|
269
|
-
if (s && s !== "") {
|
|
270
|
-
if (typeof s == "string") try {
|
|
271
|
-
t = document.createElement(s);
|
|
267
|
+
return { ...s, component: e };
|
|
268
|
+
}), i((s) => {
|
|
269
|
+
let e = "";
|
|
270
|
+
const t = s.component;
|
|
271
|
+
t && t !== "" ? typeof t == "string" ? e = t : t instanceof HTMLElement ? e = t.tagName.toLowerCase() : typeof t == "function" && (e = t.name || "CustomElement") : e = "null";
|
|
272
|
+
const r = `${e}${JSON.stringify(s.params)}${JSON.stringify(s.state)}`;
|
|
273
|
+
return { ...s, key: r, tagName: e };
|
|
274
|
+
}), y((s, e) => s.key === e.key), i((s) => {
|
|
275
|
+
let e = null;
|
|
276
|
+
const t = s.component;
|
|
277
|
+
if (t && t !== "") {
|
|
278
|
+
if (typeof t == "string") try {
|
|
279
|
+
e = document.createElement(t);
|
|
272
280
|
} catch {
|
|
273
281
|
}
|
|
274
|
-
else if (
|
|
275
|
-
else if (typeof
|
|
276
|
-
|
|
282
|
+
else if (t instanceof HTMLElement) e = t;
|
|
283
|
+
else if (typeof t == "function") try {
|
|
284
|
+
e = new t();
|
|
277
285
|
} catch {
|
|
278
286
|
}
|
|
279
|
-
} else
|
|
280
|
-
return
|
|
281
|
-
}),
|
|
287
|
+
} else e = null;
|
|
288
|
+
return e && (s.params && Object.assign(e, s.params), s.props && Object.assign(e, s.props), s.state && (e.state = s.state)), { element: e, route: s };
|
|
289
|
+
}), L(1), U(({ element: s, route: e }) => this.swapComponents(s, e)), d((s) => l), D(this.disconnecting)).subscribe();
|
|
282
290
|
}
|
|
283
291
|
swapComponents(s, e) {
|
|
284
|
-
const t = Array.from(this.children).find((r) => !(r instanceof
|
|
292
|
+
const t = Array.from(this.children).find((r) => !(r instanceof f));
|
|
285
293
|
if (s) {
|
|
286
294
|
if (t ? t.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 150, easing: "ease-out" }).onfinish = () => {
|
|
287
295
|
t.remove(), this.appendChild(s), s.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 150, easing: "ease-in" });
|
|
288
296
|
} : (this.appendChild(s), s.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 100, easing: "ease-in" })), s) {
|
|
289
297
|
const r = { component: s.tagName.toLowerCase(), state: e.state || {}, area: this.name, params: e.params || {} };
|
|
290
|
-
|
|
298
|
+
w.current.set(this.name, r), w.$current.next(w.current);
|
|
291
299
|
}
|
|
292
|
-
if (
|
|
300
|
+
if (w.enableHistoryMode && s) {
|
|
293
301
|
const r = { component: s.tagName.toLowerCase(), state: e.state || {}, area: this.name, params: e.params || {} };
|
|
294
|
-
|
|
302
|
+
w._updateBrowserHistory(this.name, r, e.historyStrategy || b.push, e.clearQueryParams);
|
|
295
303
|
}
|
|
296
304
|
} else t && t.remove();
|
|
297
305
|
}
|
|
@@ -319,14 +327,14 @@ let j = class extends M(H`
|
|
|
319
327
|
return I`<slot></slot>`;
|
|
320
328
|
}
|
|
321
329
|
};
|
|
322
|
-
C([
|
|
330
|
+
C([S()], A.prototype, "name", 2), C([S()], A.prototype, "default", 2), C([Q({ selector: "schmancy-route", flatten: !0 })], A.prototype, "routes", 2), A = C([M("schmancy-area")], A);
|
|
323
331
|
export {
|
|
324
332
|
Y as F,
|
|
325
333
|
G as H,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
334
|
+
A as S,
|
|
335
|
+
w as a,
|
|
336
|
+
f as b,
|
|
337
|
+
b as c,
|
|
338
|
+
q as r
|
|
331
339
|
};
|
|
332
|
-
//# sourceMappingURL=area.component-
|
|
340
|
+
//# sourceMappingURL=area.component-3yEm0Ikj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area.component-3yEm0Ikj.js","sources":["../src/area/area.service.ts","../src/area/route.component.ts","../src/area/router.types.ts","../src/area/area.component.ts"],"sourcesContent":["import {\n\tbufferTime,\n\tcatchError,\n\tdistinctUntilChanged,\n\tEMPTY,\n\tfilter,\n\tfromEvent,\n\tmap,\n\tObservable,\n\tof,\n\tReplaySubject,\n\tshareReplay,\n\tskip,\n\tSubject,\n\tSubscription,\n\ttap,\n\ttimeout,\n\tzip\n} from 'rxjs'\nimport { SchmancyTeleportation } from '../teleport'\nimport { ActiveRoute, AreaSubscription, RouteAction } from './router.types'\n\nexport const routerHistory = new Subject<RouteAction>()\n\nexport const FINDING_MORTIES = 'FINDING_MORTIES'\nexport const HERE_RICKY = 'HERE_RICKY'\nexport type HERE_RICKY_EVENT = CustomEvent<{\n\tcomponent: SchmancyTeleportation\n}>\nexport type FINDING_MORTIES_EVENT = CustomEvent<{\n\tcomponent: SchmancyTeleportation\n}>\n\n// WeakMap for better memory management of area subjects\nconst areaSubjectsCache = new WeakMap<AreaService, Map<string, ReplaySubject<ActiveRoute>>>()\n\n// Track navigation source to prevent history conflicts\ntype NavigationSource = 'programmatic' | 'browser' | 'initial'\n\nclass AreaService implements AreaSubscription {\n\tprivate static instance: AreaService\n\tpublic prettyURL = false\n\tpublic mode: 'SILENT' | 'HISTORY' = 'HISTORY'\n\tpublic request = new ReplaySubject<RouteAction>(1)\n\tpublic current = new Map<string, ActiveRoute>()\n\tpublic $current = new ReplaySubject<Map<string, ActiveRoute>>(1)\n\t\n\t// Create a dictionary of ReplaySubjects for area-specific subscriptions\n\tprivate get areaSubjects(): Map<string, ReplaySubject<ActiveRoute>> {\n\t\tlet subjects = areaSubjectsCache.get(this)\n\t\tif (!subjects) {\n\t\t\tsubjects = new Map()\n\t\t\tareaSubjectsCache.set(this, subjects)\n\t\t}\n\t\treturn subjects\n\t}\n\t\n\tpublic enableHistoryMode = true\n\tprivate findingMortiesEvent = new CustomEvent<FINDING_MORTIES_EVENT['detail']>(FINDING_MORTIES)\n\tprivate disposed = false\n\tpublic isProcessingPopstate = false\n\tprivate unloadSubscription?: Subscription\n\n\tconstructor() {\n\t\tthis.$current.next(this.current)\n\t\t\n\t\t// Subscribe to current changes to update area-specific subjects\n\t\tthis.$current.subscribe(currentAreas => {\n\t\t\tif (this.disposed) return\n\t\t\t\n\t\t\t// For each area in the current map\n\t\t\tcurrentAreas.forEach((route, areaName) => {\n\t\t\t\t// Get or create a subject for this area\n\t\t\t\tconst areaSubject = this.getOrCreateAreaSubject(areaName)\n\t\t\t\t// Emit the updated route to area-specific subscribers\n\t\t\t\tareaSubject.next(route)\n\t\t\t})\n\t\t})\n\n\t\t// Initialize from browser state if available\n\t\tthis.initializeFromBrowserState()\n\n\t\t// Setup unload subscription using RxJS\n\t\tif (typeof window !== 'undefined') {\n\t\t\tthis.unloadSubscription = fromEvent(window, 'unload').subscribe(() => {\n\t\t\t\tthis.dispose()\n\t\t\t})\n\t\t}\n\t}\n\n\t/**\n\t * Initialize router state from browser history state\n\t */\n\tprivate initializeFromBrowserState() {\n\t\ttry {\n\t\t\tconst browserState = history.state\n\t\t\tif (browserState && browserState.schmancyAreas) {\n\t\t\t\tObject.entries(browserState.schmancyAreas).forEach(([areaName, route]) => {\n\t\t\t\t\tthis.current.set(areaName, route as ActiveRoute)\n\t\t\t\t})\n\t\t\t\tthis.$current.next(this.current)\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.warn('Failed to initialize from browser state:', error)\n\t\t}\n\t}\n\n\t/**\n\t * Get or create a ReplaySubject for a specific area with proper cleanup\n\t */\n\tprivate getOrCreateAreaSubject(areaName: string): ReplaySubject<ActiveRoute> {\n\t\tlet subject = this.areaSubjects.get(areaName)\n\t\t\n\t\tif (!subject || subject.closed) {\n\t\t\tsubject = new ReplaySubject<ActiveRoute>(1)\n\t\t\tthis.areaSubjects.set(areaName, subject)\n\t\t\t\n\t\t\t// If the area already exists in current, emit it immediately\n\t\t\tconst currentRoute = this.current.get(areaName)\n\t\t\tif (currentRoute) {\n\t\t\t\tsubject.next({\n\t\t\t\t\t...currentRoute,\n\t\t\t\t\t// Ensure state, params and props are initialized if undefined\n\t\t\t\t\tstate: currentRoute.state || {},\n\t\t\t\t\tparams: currentRoute.params || {},\n\t\t\t\t\tprops: currentRoute.props || {}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn subject\n\t}\n\n\t/**\n\t * Subscribe to a specific area with caching\n\t */\n\ton(areaName: string, skipCurrent = false): Observable<ActiveRoute> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\tconst areaSubject = this.getOrCreateAreaSubject(areaName)\n\t\tconst observable = areaSubject.asObservable().pipe(\n\t\t\t// Add distinct to prevent duplicate emissions - now includes state\n\t\t\tdistinctUntilChanged((a, b) => \n\t\t\t\ta.component === b.component &&\n\t\t\t\tJSON.stringify(a.state) === JSON.stringify(b.state) &&\n\t\t\t\tJSON.stringify(a.params) === JSON.stringify(b.params)\n\t\t\t),\n\t\t\t// Share the subscription\n\t\t\tshareReplay(1)\n\t\t)\n\t\t\n\t\treturn skipCurrent ? observable.pipe(skip(1)) : observable\n\t}\n\t\n\t/**\n\t * Subscribe to all areas\n\t */\n\tall(skipCurrent = false): Observable<Map<string, ActiveRoute>> {\n\t\tconst observable = this.$current.asObservable().pipe(\n\t\t\tshareReplay(1)\n\t\t)\n\t\treturn skipCurrent ? observable.pipe(skip(1)) : observable\n\t}\n\t\n\t/**\n\t * Get state from an area with type safety\n\t */\n\tgetState<T = unknown>(areaName: string): Observable<T> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\treturn this.on(areaName).pipe(\n\t\t\tmap(route => route.state),\n\t\t\tfilter((state): state is NonNullable<Record<string, unknown>> => \n\t\t\t\tstate !== undefined && state !== null\n\t\t\t),\n\t\t\tdistinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n\t\t\tmap(state => state as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting state for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get params from an area with type safety\n\t */\n\tparams<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): Observable<T> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\treturn this.on(areaName).pipe(\n\t\t\tmap(route => route.params),\n\t\t\tfilter((params): params is NonNullable<Record<string, unknown>> => \n\t\t\t\tparams !== undefined && params !== null\n\t\t\t),\n\t\t\tdistinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n\t\t\tmap(params => params as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting params for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get a specific param from an area with null safety\n\t */\n\tparam<T = unknown>(areaName: string, key: string): Observable<T> {\n\t\tif (!areaName || !key) {\n\t\t\tthrow new Error('Area name and key are required')\n\t\t}\n\t\t\n\t\treturn this.params<Record<string, unknown>>(areaName).pipe(\n\t\t\tmap(params => params[key]),\n\t\t\tfilter((value): value is NonNullable<unknown> => value !== undefined),\n\t\t\tdistinctUntilChanged(),\n\t\t\tmap(value => value as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting param \"${key}\" for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get props from an area with type safety\n\t */\n\tprops<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): Observable<T> {\n\t\tif (!areaName) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\t\t\n\t\treturn this.on(areaName).pipe(\n\t\t\tmap(route => route.props),\n\t\t\tfilter((props): props is NonNullable<Record<string, unknown>> => \n\t\t\t\tprops !== undefined && props !== null\n\t\t\t),\n\t\t\tdistinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)),\n\t\t\tmap(props => props as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting props for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\t\n\t/**\n\t * Get a specific prop from an area with null safety\n\t */\n\tprop<T = unknown>(areaName: string, key: string): Observable<T> {\n\t\tif (!areaName || !key) {\n\t\t\tthrow new Error('Area name and key are required')\n\t\t}\n\t\t\n\t\treturn this.props<Record<string, unknown>>(areaName).pipe(\n\t\t\tmap(props => props[key]),\n\t\t\tfilter((value): value is NonNullable<unknown> => value !== undefined),\n\t\t\tdistinctUntilChanged(),\n\t\t\tmap(value => value as T),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(`Error getting prop \"${key}\" for area \"${areaName}\":`, err)\n\t\t\t\treturn EMPTY\n\t\t\t})\n\t\t)\n\t}\n\n\t/**\n\t * Find teleportation components\n\t */\n\tfind() {\n\t\treturn zip([\n\t\t\tfromEvent<HERE_RICKY_EVENT>(window, HERE_RICKY).pipe(\n\t\t\t\tmap(e => e.detail),\n\t\t\t\tbufferTime(0),\n\t\t\t),\n\t\t\tof(1).pipe(tap(() => window.dispatchEvent(this.findingMortiesEvent))),\n\t\t]).pipe(\n\t\t\tmap(([component]) => component),\n\t\t\ttimeout(1),\n\t\t\tcatchError(() => EMPTY)\n\t\t)\n\t}\n\n\t/**\n\t * Push a new route action with validation\n\t */\n\tpush(r: RouteAction) {\n\t\tif (!r.area) {\n\t\t\tthrow new Error('Area is required for route action')\n\t\t}\n\t\t\n\t\t// Prevent processing during popstate handling\n\t\tif (this.isProcessingPopstate) {\n\t\t\treturn\n\t\t}\n\t\t\n\t\t// Ensure state, params and props are initialized\n\t\tconst routeAction: RouteAction = {\n\t\t\t...r,\n\t\t\tstate: r.state || {},\n\t\t\tparams: r.params || {},\n\t\t\tprops: r.props || {},\n\t\t\t_source: 'programmatic' as NavigationSource\n\t\t}\n\t\t\n\t\t// Add to history if enabled\n\t\tif (this.enableHistoryMode) {\n\t\t\trouterHistory.next(routeAction)\n\t\t}\n\t\t\n\t\tthis.request.next(routeAction)\n\t\t// Emit an area-specific event for those who want to listen directly to DOM events\n\t\tthis.dispatchAreaEvent(routeAction.area, routeAction)\n\t}\n\n\t/**\n\t * Internal method to update route from browser navigation\n\t * This should only be called by area components during popstate handling\n\t */\n\t_updateFromBrowser(routeAction: RouteAction) {\n\t\tconst enhancedRoute: RouteAction = {\n\t\t\t...routeAction,\n\t\t\tstate: routeAction.state || {},\n\t\t\tparams: routeAction.params || {},\n\t\t\tprops: routeAction.props || {},\n\t\t\t_source: 'browser' as NavigationSource\n\t\t}\n\t\t\n\t\tthis.isProcessingPopstate = true\n\t\tthis.request.next(enhancedRoute)\n\t\tthis.isProcessingPopstate = false\n\t}\n\n\t/**\n\t * Update browser history state (called by area components)\n\t */\n\t_updateBrowserHistory(areaName: string, route: ActiveRoute, historyStrategy?: string, clearQueryParams?: string[] | boolean | null) {\n\t\tif (!this.enableHistoryMode) return\n\t\t\n\t\ttry {\n\t\t\t// Get current browser state or create new one\n\t\t\tconst currentState = history.state || {}\n\t\t\tconst schmancyAreas = currentState.schmancyAreas || {}\n\t\t\t\n\t\t\t// Update the specific area - only include non-empty state/params/props\n\t\t\tconst areaData: any = {\n\t\t\t\tcomponent: route.component,\n\t\t\t\tarea: route.area\n\t\t\t}\n\t\t\t\n\t\t\t// Only include state if it has content\n\t\t\tif (route.state && Object.keys(route.state).length > 0) {\n\t\t\t\tareaData.state = route.state\n\t\t\t}\n\t\t\t\n\t\t\t// Only include params if it has content\n\t\t\tif (route.params && Object.keys(route.params).length > 0) {\n\t\t\t\tareaData.params = route.params\n\t\t\t}\n\t\t\t\n\t\t\t// Only include props if it has content\n\t\t\tif (route.props && Object.keys(route.props).length > 0) {\n\t\t\t\tareaData.props = route.props\n\t\t\t}\n\t\t\t\n\t\t\tschmancyAreas[areaName] = areaData\n\t\t\t\n\t\t\tconst newState = {\n\t\t\t\t...currentState,\n\t\t\t\tschmancyAreas\n\t\t\t}\n\t\t\t\n\t\t\t// Create clean URL\n\t\t\tconst url = this.createCleanURL(schmancyAreas, clearQueryParams)\n\t\t\t\n\t\t\t// Update browser history\n\t\t\tif (historyStrategy === 'replace' || historyStrategy === 'pop') {\n\t\t\t\thistory.replaceState(newState, '', url)\n\t\t\t} else if (historyStrategy === 'push' || !historyStrategy) {\n\t\t\t\thistory.pushState(newState, '', url)\n\t\t\t}\n\t\t\t// 'silent' strategy doesn't update browser history\n\t\t\t\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to update browser history:', error)\n\t\t}\n\t}\n\n\t/**\n\t * Create a clean URL from area states\n\t */\n\tprivate createCleanURL(areas: Record<string, ActiveRoute>, clearQueryParams?: string[] | boolean | null): string {\n\t\t// Get the current base path (everything except the last segment which might be encoded state)\n\t\tconst currentPath = location.pathname\n\t\tconst pathSegments = currentPath.split('/')\n\t\tlet basePath = '/'\n\n\t\t// Check if the last segment is encoded state (contains { or %7B)\n\t\tconst lastSegment = pathSegments[pathSegments.length - 1]\n\t\tif (lastSegment && (lastSegment.includes('{') || lastSegment.includes('%7B'))) {\n\t\t\t// Remove the encoded state segment to get the base path\n\t\t\tpathSegments.pop()\n\t\t\tbasePath = pathSegments.join('/') || '/'\n\t\t} else {\n\t\t\t// Keep the current path as base path\n\t\t\tbasePath = currentPath\n\t\t}\n\n\t\t// Ensure base path ends properly\n\t\tif (basePath !== '/' && !basePath.endsWith('/')) {\n\t\t\tbasePath += '/'\n\t\t}\n\n\t\t// Handle query parameters\n\t\tlet queryString = ''\n\n\t\tif (clearQueryParams !== true) {\n\t\t\t// Get current query params\n\t\t\tconst urlParams = new URLSearchParams(location.search)\n\n\t\t\t// Clear specific params if provided\n\t\t\tif (Array.isArray(clearQueryParams)) {\n\t\t\t\tclearQueryParams.forEach(param => urlParams.delete(param))\n\t\t\t}\n\n\t\t\t// Convert back to string\n\t\t\tqueryString = urlParams.toString()\n\t\t\tqueryString = queryString ? `?${queryString}` : ''\n\t\t}\n\t\t// If clearQueryParams === true, queryString remains empty (all params cleared)\n\n\t\tif (this.prettyURL) {\n\t\t\t// Create pretty URLs - customize this based on your routing needs\n\t\t\tconst mainArea = areas.main\n\t\t\tif (mainArea) {\n\t\t\t\tlet path = basePath === '/' ? `/${mainArea.component}` : `${basePath}${mainArea.component}`\n\n\t\t\t\t// Add simple params to URL\n\t\t\t\tconst searchParams = new URLSearchParams(queryString)\n\t\t\t\tif (mainArea.params) {\n\t\t\t\t\tObject.entries(mainArea.params).forEach(([key, value]) => {\n\t\t\t\t\t\tif (typeof value === 'string' || typeof value === 'number') {\n\t\t\t\t\t\t\tsearchParams.set(key, String(value))\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tconst query = searchParams.toString()\n\t\t\t\treturn path + (query ? `?${query}` : '')\n\t\t\t}\n\t\t}\n\n\t\t// Fallback to encoded state in URL (original behavior)\n\t\ttry {\n\t\t\t// Clean up empty objects before encoding\n\t\t\tconst cleanedAreas: Record<string, any> = {}\n\t\t\tObject.entries(areas).forEach(([areaName, route]) => {\n\t\t\t\tconst cleanRoute: any = { component: route.component }\n\n\t\t\t\t// Only include state if it has content\n\t\t\t\tif (route.state && Object.keys(route.state).length > 0) {\n\t\t\t\t\tcleanRoute.state = route.state\n\t\t\t\t}\n\n\t\t\t\t// Only include params if it has content\n\t\t\t\tif (route.params && Object.keys(route.params).length > 0) {\n\t\t\t\t\tcleanRoute.params = route.params\n\t\t\t\t}\n\n\t\t\t\t// Only include props if it has content\n\t\t\t\tif (route.props && Object.keys(route.props).length > 0) {\n\t\t\t\t\tcleanRoute.props = route.props\n\t\t\t\t}\n\n\t\t\t\tcleanedAreas[areaName] = cleanRoute\n\t\t\t})\n\n\t\t\t// If cleanedAreas is empty, preserve the base path\n\t\t\tif (Object.keys(cleanedAreas).length === 0) {\n\t\t\t\tconst cleanBasePath = basePath === '/' ? '' : basePath.replace(/\\/$/, '')\n\t\t\t\treturn `${cleanBasePath}${queryString}`\n\t\t\t}\n\n\t\t\tconst encoded = encodeURIComponent(JSON.stringify(cleanedAreas))\n\t\t\tconst cleanBasePath = basePath === '/' ? '' : basePath.replace(/\\/$/, '')\n\t\t\treturn `${cleanBasePath}/${encoded}${queryString}`\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to encode URL state:', error)\n\t\t\treturn location.pathname\n\t\t}\n\t}\n\n\t/**\n\t * Restore state from browser history state\n\t */\n\trestoreFromBrowserState(browserState: any): Record<string, ActiveRoute> {\n\t\ttry {\n\t\t\tif (browserState && browserState.schmancyAreas) {\n\t\t\t\treturn browserState.schmancyAreas\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to restore from browser state:', error)\n\t\t}\n\t\t\n\t\t// Fallback to URL parsing (original behavior)\n\t\treturn this.parseStateFromURL()\n\t}\n\n\t/**\n\t * Parse state from URL (fallback method)\n\t */\n\tprivate parseStateFromURL(): Record<string, ActiveRoute> {\n\t\tconst pathname = location.pathname.split('/').pop()\n\t\tif (!pathname) return {}\n\t\t\n\t\ttry {\n\t\t\tconst decoded = decodeURIComponent(pathname)\n\t\t\tconst parsed = JSON.parse(decoded)\n\t\t\t\n\t\t\tif (typeof parsed === 'object' && parsed !== null) {\n\t\t\t\treturn parsed\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore parse errors\n\t\t}\n\t\t\n\t\treturn {}\n\t}\n\t\n\t/**\n\t * Dispatch a DOM event for a specific area change\n\t */\n\tprivate dispatchAreaEvent(areaName: string, routeAction: RouteAction) {\n\t\tconst eventName = `schmancy-area-${areaName}-changed`\n\t\tconst event = new CustomEvent(eventName, { \n\t\t\tdetail: { \n\t\t\t\tarea: areaName,\n\t\t\t\tcomponent: routeAction.component,\n\t\t\t\tstate: routeAction.state,\n\t\t\t\tparams: routeAction.params,\n\t\t\t\tprops: routeAction.props,\n\t\t\t\thistoryStrategy: routeAction.historyStrategy\n\t\t\t},\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t})\n\t\twindow.dispatchEvent(event)\n\t}\n\n\t/**\n\t * Remove an area from the current state\n\t */\n\tpop(name: string) {\n\t\tif (!name) {\n\t\t\tthrow new Error('Area name is required')\n\t\t}\n\n\t\t// Before removing from current map, emit a clearing signal to the area's subject\n\t\t// This notifies the area component to clear itself\n\t\tconst areaSubject = this.areaSubjects.get(name)\n\t\tif (areaSubject && !areaSubject.closed) {\n\t\t\t// Send a route with null component to signal clearing\n\t\t\tareaSubject.next({\n\t\t\t\tcomponent: null as any,\n\t\t\t\tstate: {},\n\t\t\t\tarea: name,\n\t\t\t\tparams: {},\n\t\t\t\tprops: {}\n\t\t\t})\n\t\t}\n\n\t\t// Send a clearing signal through the request pipeline\n\t\t// This ensures the area component receives the signal to clear\n\t\tthis.request.next({\n\t\t\tarea: name,\n\t\t\tcomponent: null as any,\n\t\t\tstate: {},\n\t\t\tparams: {},\n\t\t\tprops: {},\n\t\t\thistoryStrategy: 'silent' as any,\n\t\t\t_source: 'programmatic' as NavigationSource\n\t\t})\n\n\t\t// Remove from current map\n\t\tthis.current.delete(name)\n\t\tthis.$current.next(this.current)\n\n\t\t// Update browser history\n\t\tif (this.enableHistoryMode) {\n\t\t\ttry {\n\t\t\t\tconst currentState = history.state || {}\n\t\t\t\tconst schmancyAreas = { ...(currentState.schmancyAreas || {}) }\n\t\t\t\tdelete schmancyAreas[name]\n\n\t\t\t\tconst newState = {\n\t\t\t\t\t...currentState,\n\t\t\t\t\tschmancyAreas\n\t\t\t\t}\n\n\t\t\t\tconst url = this.createCleanURL(schmancyAreas)\n\t\t\t\thistory.replaceState(newState, '', url)\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Failed to update history after pop:', error)\n\t\t\t}\n\t\t}\n\t}\n\t\n\t/**\n\t * Clear all areas\n\t */\n\tclear() {\n\t\t// Complete all area subjects\n\t\tthis.areaSubjects.forEach(subject => subject.complete())\n\t\tthis.areaSubjects.clear()\n\n\t\t// Clear current state\n\t\tthis.current.clear()\n\t\tthis.$current.next(this.current)\n\n\t\t// Update URL\n\t\tif (this.enableHistoryMode) {\n\t\t\tconst url = this.createCleanURL({})\n\t\t\thistory.replaceState({ schmancyAreas: {} }, '', url)\n\t\t}\n\t}\n\t\n\t/**\n\t * Dispose of the service and clean up resources\n\t */\n\tdispose() {\n\t\tif (this.disposed) return\n\n\t\tthis.disposed = true\n\n\t\t// Unsubscribe from unload event\n\t\tif (this.unloadSubscription) {\n\t\t\tthis.unloadSubscription.unsubscribe()\n\t\t\tthis.unloadSubscription = undefined\n\t\t}\n\n\t\t// Complete all subjects\n\t\tthis.areaSubjects.forEach(subject => subject.complete())\n\t\tthis.areaSubjects.clear()\n\n\t\tthis.request.complete()\n\t\tthis.$current.complete()\n\t\trouterHistory.complete()\n\n\t\t// Clear references\n\t\tthis.current.clear()\n\t\tareaSubjectsCache.delete(this)\n\t}\n\t\n\t/**\n\t * Get singleton instance\n\t */\n\tstatic getInstance() {\n\t\tif (!AreaService.instance) {\n\t\t\tAreaService.instance = new AreaService()\n\t\t}\n\t\treturn AreaService.instance\n\t}\n\n\t/**\n\t * Get current state from URL (deprecated - use browser state instead)\n\t */\n\tget state(): Record<string, unknown> {\n\t\t// Try browser state first\n\t\ttry {\n\t\t\tconst browserState = history.state\n\t\t\tif (browserState && browserState.schmancyAreas) {\n\t\t\t\treturn browserState.schmancyAreas\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fallback to URL parsing\n\t\t}\n\t\t\n\t\t// Fallback to URL parsing (original behavior)\n\t\treturn this.parseStateFromURL()\n\t}\n\t\n\t/**\n\t * Check if an area exists in current state\n\t */\n\thasArea(areaName: string): boolean {\n\t\treturn this.current.has(areaName)\n\t}\n\t\n\t/**\n\t * Get all active area names\n\t */\n\tgetActiveAreas(): string[] {\n\t\treturn Array.from(this.current.keys())\n\t}\n\t\n\t/**\n\t * Get route for a specific area synchronously\n\t */\n\tgetRoute(areaName: string): ActiveRoute | undefined {\n\t\treturn this.current.get(areaName)\n\t}\n}\n\nexport const area = AreaService.getInstance()\nexport default area","import { $LitElement } from '@mixins/index';\nimport { css, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { Observable } from 'rxjs';\nimport { LazyComponent } from './lazy';\n\nexport type ObservableGuardResult = Observable<boolean>;\n\n// Component types that can be passed to routes\nexport type RouteComponent =\n | string // Tag name\n | CustomElementConstructor // Constructor function\n | HTMLElement // Existing element\n | LazyComponent<any> \n\nexport interface RouteConfig {\n when: string;\n component: RouteComponent;\n exact?: boolean;\n guard?: ObservableGuardResult;\n}\n\n/**\n * A marker component that holds route configuration.\n * This component doesn't render anything - it's used by schmancy-area\n * to configure routing via slot change detection.\n *\n * @example\n * ```html\n * <schmancy-area>\n * <schmancy-route\n * when=\"users\"\n * .component=${UserComponent}\n * exact\n * ></schmancy-route>\n * </schmancy-area>\n * ```\n */\n@customElement('schmancy-route')\nexport class SchmancyRoute extends $LitElement(css`\n :host {\n display: none;\n }\n`) {\n @property({ type: String })\n when!: string;\n\n @property({ type: Object })\n component!: RouteComponent;\n\n @property({ type: Boolean })\n exact?: boolean = false;\n\n @property({ type: Object })\n guard?:ObservableGuardResult ;\n\n /**\n * Returns the route configuration object\n */\n getConfig(): RouteConfig {\n return {\n when: this.when,\n component: this.component,\n exact: this.exact,\n guard: this.guard\n };\n }\n\n render() {\n // This is a marker component - no visual output\n return html``;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'schmancy-route': SchmancyRoute;\n }\n}","import { LazyComponent } from './lazy'\n\nexport type RouteAction = {\n\tcomponent: CustomElementConstructor | string | HTMLElement | LazyComponent<any>\n\tarea: string\n\tstate?: Record<string, unknown>\n\tparams?: Record<string, unknown>\n\tprops?: Record<string, unknown> // Alias for params\n\thistoryStrategy?: THistoryStrategy\n\tclearQueryParams?: string[] | boolean | null\n\t_source?: 'programmatic' | 'browser' | 'initial' // Internal use only\n}\n\nexport type ActiveRoute = {\n\tcomponent: string\n\tarea: string\n\tstate?: Record<string, unknown>\n\tparams?: Record<string, unknown>\n\tprops?: Record<string, unknown>\n}\n\n/**\n * Interface for subscribing to area changes\n */\nexport interface AreaSubscription {\n\t/**\n\t * Subscribe to a specific area\n\t * @param areaName Name of the area to subscribe to\n\t * @param skipCurrent Whether to skip the current value\n\t * @returns Observable of the active route for the specified area\n\t */\n\ton(areaName: string, skipCurrent?: boolean): import('rxjs').Observable<ActiveRoute>\n\t\n\t/**\n\t * Subscribe to all areas\n\t * @param skipCurrent Whether to skip the current value\n\t * @returns Observable of all active routes\n\t */\n\tall(skipCurrent?: boolean): import('rxjs').Observable<Map<string, ActiveRoute>>\n\t\n\t/**\n\t * Get state from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @returns Observable of the area's state\n\t */\n\tgetState<T = unknown>(areaName: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get params from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @returns Observable of the area's params\n\t */\n\tparams<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get a specific param from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @param key Key of the param to select\n\t * @returns Observable of the param value\n\t */\n\tparam<T = unknown>(areaName: string, key: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get props from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @returns Observable of the area's props\n\t */\n\tprops<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): import('rxjs').Observable<T>\n\t\n\t/**\n\t * Get a specific prop from an area\n\t * @param areaName Name of the area to subscribe to\n\t * @param key Key of the prop to select\n\t * @returns Observable of the prop value\n\t */\n\tprop<T = unknown>(areaName: string, key: string): import('rxjs').Observable<T>\n}\n\nexport type THistoryStrategy = 'push' | 'replace' | 'pop' | 'silent'\n\nexport enum HISTORY_STRATEGY {\n\tpush = 'push',\n\treplace = 'replace',\n\tpop = 'pop',\n\tsilent = 'silent',\n}\n\n/**\n * Browser history state structure used by Schmancy Area\n */\nexport interface SchmancyHistoryState {\n\tschmancyAreas: Record<string, ActiveRoute>\n\t[key: string]: any // Allow other apps to store additional state\n}","import { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js'\nimport {\n\tEMPTY,\n\tcatchError,\n\tdistinctUntilChanged,\n\tfilter,\n\tfromEvent,\n\tmap,\n\tmerge,\n\tof,\n\tshareReplay,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n} from 'rxjs'\nimport area from './area.service'\nimport { RouteComponent, SchmancyRoute } from './route.component'\nimport { ActiveRoute, HISTORY_STRATEGY, RouteAction } from './router.types'\n\n// Extended RouteAction type with originalWhen for tracking route identity\ntype RouteActionWithTracking = RouteAction & {\n\toriginalWhen?: string\n}\n\n@customElement('schmancy-area')\nexport class SchmancyArea extends $LitElement(css`\n\t:host {\n\t\tposition: relative;\n\t\tdisplay: block;\n\t\tinset: 0;\n\t}\n`) {\n\t/**\n\t * The name of the router outlet\n\t * @attr\n\t * @type {string}\n\t * @public\n\t * @required\n\t */\n\t@property() name!: string\n\n\t@property() default!: RouteComponent\n\n\t/**\n\t * Query for assigned route elements in the slot\n\t * This will automatically update when slot content changes\n\t */\n\t@queryAssignedElements({ selector: 'schmancy-route', flatten: true })\n\tprivate routes!: SchmancyRoute[]\n\n\tprotected firstUpdated(): void {\n\t\tif (!this.name) throw new Error('Area name is required')\n\n\t\t// Single unified routing pipeline\n\t\tmerge(\n\t\t\t// Programmatic navigation\n\t\t\tarea.request.pipe(\n\t\t\t\tfilter(({ area }) => area === this.name)\n\t\t\t),\n\n\t\t\t// Initial load - parse URL and determine route\n\t\t\tof(location.pathname).pipe(\n\t\t\t\ttake(1),\n\t\t\t\tmap(() => {\n\t\t\t\t\tconst path = location.pathname\n\t\t\t\t\tconst lastSegment = path.split('/').pop() || ''\n\n\t\t\t\t\t// Check for JSON encoded route in URL\n\t\t\t\t\tif (lastSegment && (lastSegment.includes('{') || lastSegment.includes('%7B'))) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst parsed = JSON.parse(decodeURIComponent(lastSegment)) as Record<string, ActiveRoute>\n\t\t\t\t\t\t\tif (parsed[this.name]) {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\tcomponent: parsed[this.name].component, // Keep as string initially\n\t\t\t\t\t\t\t\t\tstate: parsed[this.name].state || {},\n\t\t\t\t\t\t\t\t\tparams: parsed[this.name].params || {},\n\t\t\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.replace,\n\t\t\t\t\t\t\t\t} as RouteAction\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Segment-based routing - find route by URL segment\n\t\t\t\t\tconst segments = path.split('/').filter(Boolean)\n\t\t\t\t\tconst matchingSegment = segments.find(seg =>\n\t\t\t\t\t\tthis.routes?.some(r => r.when === seg)\n\t\t\t\t\t)\n\n\t\t\t\t\tif (matchingSegment) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\tcomponent: matchingSegment, // Keep as string initially\n\t\t\t\t\t\t\tstate: {},\n\t\t\t\t\t\t\tparams: {},\n\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.silent,\n\t\t\t\t\t\t} as RouteAction\n\t\t\t\t\t}\n\n\t\t\t\t\t// Use default if no route matches\n\t\t\t\t\treturn this.default\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\tcomponent: this.default,\n\t\t\t\t\t\t\t\tstate: {},\n\t\t\t\t\t\t\t\tparams: {},\n\t\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.silent,\n\t\t\t\t\t\t\t} as RouteAction\n\t\t\t\t\t\t: null\n\t\t\t\t}),\n\t\t\t\tfilter(route => route !== null)\n\t\t\t),\n\n\t\t\t// Browser back/forward navigation\n\t\t\tfromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\tmap(event => {\n\t\t\t\t\tif (event.state?.schmancyAreas?.[this.name]) {\n\t\t\t\t\t\tconst stateData = event.state.schmancyAreas[this.name]\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\tcomponent: stateData.component, // Keep as string initially\n\t\t\t\t\t\t\tstate: stateData.state || {},\n\t\t\t\t\t\t\tparams: stateData.params || {},\n\t\t\t\t\t\t\thistoryStrategy: HISTORY_STRATEGY.pop,\n\t\t\t\t\t\t} as RouteAction\n\t\t\t\t\t}\n\t\t\t\t\treturn null\n\t\t\t\t}),\n\t\t\t\tfilter(route => route !== null)\n\t\t\t),\n\t\t)\n\t\t\t.pipe(\n\t\t\t\tfilter(route => route?.component !== undefined),\n\n\t\t\t\t// Step 1: Match route and resolve component (SINGLE place for matching logic)\n\t\t\t\tmap(action => {\n\t\t\t\t\tlet matchedRoute: SchmancyRoute | undefined\n\t\t\t\t\tlet component = action.component\n\t\t\t\t\tlet originalWhen: string | undefined\n\n\t\t\t\t\t// If component is a string, find the matching route\n\t\t\t\t\tif (typeof component === 'string' && this.routes) {\n\t\t\t\t\t\tmatchedRoute = this.routes.find(r => r.when === component)\n\t\t\t\t\t\tif (matchedRoute) {\n\t\t\t\t\t\t\tcomponent = matchedRoute.component\n\t\t\t\t\t\t\toriginalWhen = matchedRoute.when\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Matched route '${originalWhen}' with component:`, component)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No matching route, keep string component as-is\n\t\t\t\t\t\t\toriginalWhen = component\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// If component is already a constructor/element, find matching route by reference\n\t\t\t\t\telse if (typeof component === 'function' && this.routes) {\n\t\t\t\t\t\tmatchedRoute = this.routes.find(r => r.component === component)\n\t\t\t\t\t\tif (matchedRoute) {\n\t\t\t\t\t\t\toriginalWhen = matchedRoute.when\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Found route '${originalWhen}' for constructor`)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Component is HTMLElement\n\t\t\t\t\telse if (component instanceof HTMLElement && this.routes) {\n\t\t\t\t\t\tconst tagName = component.tagName.toLowerCase()\n\t\t\t\t\t\tmatchedRoute = this.routes.find(r => r.when === tagName)\n\t\t\t\t\t\tif (matchedRoute) {\n\t\t\t\t\t\t\toriginalWhen = matchedRoute.when\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...action,\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\tmatchedRoute,\n\t\t\t\t\t\toriginalWhen\n\t\t\t\t\t} as RouteActionWithTracking & { matchedRoute?: SchmancyRoute }\n\t\t\t\t}),\n\n\t\t\t\t// Step 2: Check guards (moved from Step 5 - check BEFORE lazy loading)\n\t\t\t\tswitchMap((route) => {\n\t\t\t\t\t// Use the matched route for guard check\n\t\t\t\t\tconst routeDef = route.matchedRoute ||\n\t\t\t\t\t\t(route.originalWhen ? this.routes?.find(r => r.when === route.originalWhen) : undefined)\n\n\t\t\t\t\tconsole.log(`[${this.name}] Guard check for route '${route.originalWhen}'`)\n\n\t\t\t\t\t// If route has a guard, evaluate it\n\t\t\t\t\tif (routeDef?.guard) {\n\t\t\t\t\t\treturn routeDef.guard.pipe(\n\t\t\t\t\t\t\ttap(guardResult => {\n\t\t\t\t\t\t\t\tconsole.log(`[${this.name}] Guard evaluation result:`, guardResult)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tswitchMap(guardResult => {\n\t\t\t\t\t\t\t\tif (guardResult === true) {\n\t\t\t\t\t\t\t\t\t// Guard passed, continue with the route (remove matchedRoute as it's no longer needed)\n\t\t\t\t\t\t\t\t\tconst { matchedRoute, ...routeWithoutMatch } = route\n\t\t\t\t\t\t\t\t\treturn of(routeWithoutMatch)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Guard failed, dispatch redirect event\n\t\t\t\t\t\t\t\tconst redirectEvent = new CustomEvent('redirect', {\n\t\t\t\t\t\t\t\t\tdetail: {\n\t\t\t\t\t\t\t\t\t\tblockedRoute: route.originalWhen || 'unknown',\n\t\t\t\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\t\t\t\tparams: route.params || {},\n\t\t\t\t\t\t\t\t\t\tstate: route.state || {},\n\t\t\t\t\t\t\t\t\t\tredirectTarget: typeof guardResult === 'object' ? guardResult : undefined,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\trouteDef.dispatchEvent(redirectEvent)\n\n\t\t\t\t\t\t\t\treturn EMPTY\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\n\t\t\t\t\t// No guard, allow navigation (remove matchedRoute as it's no longer needed)\n\t\t\t\t\tconst { matchedRoute, ...routeWithoutMatch } = route\n\t\t\t\t\treturn of(routeWithoutMatch)\n\t\t\t\t}),\n\n\t\t\t\t// Step 3: Resolve lazy components (was Step 2)\n\t\t\t\tswitchMap(async (route) => {\n\t\t\t\t\tlet component = route.component\n\n\t\t\t\t\t// Check if component is a lazy-loadable function\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof component === 'function' &&\n\t\t\t\t\t\t('preload' in component || '_promise' in component || '_module' in component)\n\t\t\t\t\t) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Lazy loading component for route '${route.originalWhen}'...`)\n\t\t\t\t\t\t\tconst module = await (component as () => Promise<{ default: CustomElementConstructor }>)()\n\t\t\t\t\t\t\tcomponent = module.default\n\t\t\t\t\t\t\tconsole.log(`[${this.name}] Lazy load succeeded`)\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tconsole.error(`[${this.name}] Lazy load failed:`, e)\n\t\t\t\t\t\t\treturn { ...route, component: null }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { ...route, component }\n\t\t\t\t}),\n\n\t\t\t\t// Step 4: Extract component identifier for deduplication (was Step 3)\n\t\t\t\tmap((route) => {\n\t\t\t\t\tlet identifier = ''\n\t\t\t\t\tconst component = route.component\n\n\t\t\t\t\tif (!component || component === '') {\n\t\t\t\t\t\tidentifier = 'null'\n\t\t\t\t\t} else if (typeof component === 'string') {\n\t\t\t\t\t\tidentifier = component\n\t\t\t\t\t} else if (component instanceof HTMLElement) {\n\t\t\t\t\t\tidentifier = component.tagName.toLowerCase()\n\t\t\t\t\t} else if (typeof component === 'function') {\n\t\t\t\t\t\tidentifier = component.name || 'CustomElement'\n\t\t\t\t\t}\n\n\t\t\t\t\tconst key = `${identifier}${JSON.stringify(route.params)}${JSON.stringify(route.state)}`\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...route,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\ttagName: identifier\n\t\t\t\t\t}\n\t\t\t\t}),\n\n\t\t\t\t// Step 5: Deduplicate navigation requests (was Step 4)\n\t\t\t\tdistinctUntilChanged((a, b) => a.key === b.key),\n\n\t\t\t\t// Step 6: Create HTML element\n\t\t\t\tmap((route) => {\n\t\t\t\t\tlet element: HTMLElement | null = null\n\t\t\t\t\tconst component = route.component\n\n\t\t\t\t\tconsole.log(`[${this.name}] Creating element for:`, component)\n\n\t\t\t\t\tif (!component || component === '') {\n\t\t\t\t\t\telement = null\n\t\t\t\t\t} else if (typeof component === 'string') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\telement = document.createElement(component)\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\tconsole.error(`[${this.name}] Failed to create element:`, component)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (component instanceof HTMLElement) {\n\t\t\t\t\t\telement = component\n\t\t\t\t\t} else if (typeof component === 'function') {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\telement = new (component as CustomElementConstructor)()\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tconsole.error(`[${this.name}] Failed to instantiate:`, e)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Apply properties\n\t\t\t\t\tif (element) {\n\t\t\t\t\t\tif (route.params) Object.assign(element, route.params)\n\t\t\t\t\t\tif (route.props) Object.assign(element, route.props)\n\t\t\t\t\t\tif (route.state) (element as any).state = route.state\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { element, route }\n\t\t\t\t}),\n\n\t\t\t\tshareReplay(1),\n\n\t\t\t\t// Step 7: Swap components in DOM\n\t\t\t\ttap(({ element, route }) => this.swapComponents(element, route)),\n\n\t\t\t\tcatchError(error => {\n\t\t\t\t\tconsole.error(`[${this.name}] Navigation error:`, error)\n\t\t\t\t\treturn EMPTY\n\t\t\t\t}),\n\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\t/**\n\t * Swap components with animation following the original pattern\n\t */\n\tprivate swapComponents(newComponent: HTMLElement | null, routeAction: RouteActionWithTracking) {\n\t\t// Important: We need to work with the light DOM, not shadow DOM\n\t\t// The slot should remain in shadow DOM, and we append content to light DOM\n\n\t\t// Find the current routed component (not the route definitions)\n\t\t// Route definitions have display:none, actual components don't\n\t\tconst oldComponent = Array.from(this.children).find(\n\t\t\tchild => !(child instanceof SchmancyRoute)\n\t\t) as HTMLElement | undefined\n\n\t\t// If no new component, just clear\n\t\tif (!newComponent) {\n\t\t\tif (oldComponent) {\n\t\t\t\toldComponent.remove()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Animate transition\n\t\tif (oldComponent) {\n\t\t\t// Fade out old component\n\t\t\tconst fadeOut = oldComponent.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 150, easing: 'ease-out' })\n\n\t\t\tfadeOut.onfinish = () => {\n\t\t\t\toldComponent.remove()\n\t\t\t\t// Add new component to light DOM (not shadow DOM!)\n\t\t\t\tthis.appendChild(newComponent)\n\t\t\t\tnewComponent.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 150, easing: 'ease-in' })\n\t\t\t}\n\t\t} else {\n\t\t\t// No old component, just add and fade in to light DOM\n\t\t\tthis.appendChild(newComponent)\n\t\t\tnewComponent.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 100, easing: 'ease-in' })\n\t\t}\n\n\t\t// Update internal state\n\t\tif (newComponent) {\n\t\t\tconst activeRoute: ActiveRoute = {\n\t\t\t\tcomponent: newComponent.tagName.toLowerCase(),\n\t\t\t\tstate: routeAction.state || {},\n\t\t\t\tarea: this.name,\n\t\t\t\tparams: routeAction.params || {},\n\t\t\t}\n\n\t\t\tarea.current.set(this.name, activeRoute)\n\t\t\tarea.$current.next(area.current)\n\t\t}\n\n\t\t// Update browser history\n\t\tif (area.enableHistoryMode && newComponent) {\n\t\t\tconst activeRoute: ActiveRoute = {\n\t\t\t\tcomponent: newComponent.tagName.toLowerCase(),\n\t\t\t\tstate: routeAction.state || {},\n\t\t\t\tarea: this.name,\n\t\t\t\tparams: routeAction.params || {},\n\t\t\t}\n\n\t\t\tarea._updateBrowserHistory(\n\t\t\t\tthis.name,\n\t\t\t\tactiveRoute,\n\t\t\t\trouteAction.historyStrategy || HISTORY_STRATEGY.push,\n\t\t\t\trouteAction.clearQueryParams,\n\t\t\t)\n\t\t}\n\t}\n\n\t/**\n\t * Create URL path for the route (legacy method, now handled by service)\n\t */\n\tnewPath(tag: string, route: RouteAction) {\n\t\tconst oldPathname = location.pathname.split('/').pop()\n\t\tlet oldAreaState = {}\n\t\ttry {\n\t\t\toldAreaState = oldPathname ? JSON.parse(decodeURIComponent(oldPathname)) : {}\n\t\t} catch {\n\t\t\toldAreaState = {}\n\t\t}\n\t\troute.state = route.state ?? {}\n\t\tconst queryParams = route.clearQueryParams ? this.queryParamClear(route.clearQueryParams) : document.location.search\n\n\t\treturn encodeURIComponent(\n\t\t\tJSON.stringify({\n\t\t\t\t...oldAreaState,\n\t\t\t\t[this.name]: { component: tag.toLowerCase(), state: route.state, params: route.params },\n\t\t\t}),\n\t\t).concat(`${queryParams}`)\n\t}\n\n\t/**\n\t * Clear query parameters\n\t */\n\tqueryParamClear(params?: string[] | boolean) {\n\t\tif (!params) {\n\t\t\treturn ''\n\t\t}\n\t\t// get query params from url\n\t\tconst urlParams = new URLSearchParams(location.search)\n\n\t\tif (params === true) {\n\t\t\t// Clear all query params\n\t\t\treturn ''\n\t\t} else {\n\t\t\t// Clear specific query params\n\t\t\tparams.forEach(param => urlParams.delete(param))\n\t\t\t// update url\n\t\t\tif (urlParams.toString() === '') return ''\n\t\t\treturn `?${urlParams.toString()}`\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t}\n\n\trender() {\n\t\treturn html`<slot></slot>`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-area': SchmancyArea\n\t}\n}\n"],"names":["routerHistory","Subject","FINDING_MORTIES","HERE_RICKY","areaSubjectsCache","WeakMap","AreaService","constructor","this","prettyURL","mode","request","ReplaySubject","current","Map","$current","enableHistoryMode","findingMortiesEvent","CustomEvent","disposed","isProcessingPopstate","next","subscribe","currentAreas","forEach","route","areaName","getOrCreateAreaSubject","initializeFromBrowserState","window","unloadSubscription","fromEvent","dispose","areaSubjects","subjects","get","set","browserState","history","state","schmancyAreas","Object","entries","error","subject","closed","currentRoute","params","props","skipCurrent","Error","observable","asObservable","pipe","distinctUntilChanged","a","b","component","JSON","stringify","shareReplay","skip","on","map","filter","catchError","err","EMPTY","key","value","find","zip","e","detail","bufferTime","of","tap","dispatchEvent","timeout","r","area","routeAction","_source","dispatchAreaEvent","enhancedRoute","historyStrategy","clearQueryParams","currentState","areaData","keys","length","newState","url","createCleanURL","replaceState","pushState","areas","currentPath","location","pathname","pathSegments","split","basePath","lastSegment","includes","pop","join","endsWith","queryString","urlParams","URLSearchParams","search","Array","isArray","param","delete","toString","mainArea","main","path","searchParams","String","query","cleanedAreas","cleanRoute","replace","encoded","encodeURIComponent","parseStateFromURL","decoded","decodeURIComponent","parsed","parse","event","bubbles","composed","name","areaSubject","clear","complete","unsubscribe","getInstance","instance","has","getActiveAreas","from","SchmancyRoute","$LitElement","css","super","arguments","exact","getConfig","when","guard","render","html","__decorateClass","property","type","prototype","Boolean","customElement","HISTORY_STRATEGY","SchmancyArea","firstUpdated","merge","take","matchingSegment","routes","some","seg","silent","default","stateData","action","matchedRoute","originalWhen","HTMLElement","tagName","toLowerCase","switchMap","routeDef","guardResult","routeWithoutMatch","redirectEvent","blockedRoute","redirectTarget","async","module","identifier","element","document","createElement","assign","swapComponents","takeUntil","disconnecting","newComponent","oldComponent","children","child","animate","opacity","duration","easing","onfinish","remove","appendChild","activeRoute","_updateBrowserHistory","push","tag","oldPathname","oldAreaState","queryParams","queryParamClear","concat","disconnectedCallback","queryAssignedElements","selector","flatten"],"mappings":";;;;;;;AAsBO,MAAMA,IAAgB,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CC,MAAAA,IAAe,CAAA;AAAA,IAAC;AAEjB7L,MAAMc,QAAQd,EAAMc,SAAS,CAAA;AAC7B,UAAMgL,IAAc9L,EAAM6D,mBAAmB9E,KAAKgN,gBAAgB/L,EAAM6D,gBAAAA,IAAoB0G,SAAS9F,SAASa;AAE9G,WAAOgB,mBACNrE,KAAKC,UAAU,KACX2J,GACH,CAAC9M,KAAKgI,IAAAA,GAAO,EAAE/E,WAAW2J,EAAIhC,YAAAA,GAAe7I,OAAOd,EAAMc,OAAOQ,QAAQtB,EAAMsB,OAAAA,EAAAA,CAAAA,CAAAA,EAE/E0K,OAAO,GAAGF,CAAAA,EAAAA;AAAAA,EAAa;AAAA,EAM1B,gBAAgBxK,GAAAA;AACf,QAAA,CAAKA,EACJ,QAAO;AAGR,UAAM8D,IAAY,IAAIC,gBAAgBZ,SAASa,MAAAA;AAE/C,WAAIhE,MAAJ,KAEQ,MAGPA,EAAOvB,QAAQ0F,OAASL,EAAUM,OAAOD,CAAAA,CAAAA,GAErCL,EAAUO,SAAAA,MAAe,KAAW,KACjC,IAAIP,EAAUO,SAAAA,CAAAA;AAAAA,EACtB;AAAA,EAGD,uBAAAsG;AACCrE,UAAMqE;EAAqB;AAAA,EAG5B,SAAA/D;AACC,WAAOC;AAAAA,EAAA;;AAjZIC,EAAA,CAAXC,MAdWM,EAcAJ,WAAA,QAAA,CAAA,GAEAH,EAAA,CAAXC,EAAAA,CAAAA,GAhBWM,EAgBAJ,WAAA,WAAA,CAAA,GAOJH,EAAA,CADP8D,EAAsB,EAAEC,UAAU,kBAAkBC,SAAAA,GAAS,CAAA,CAAA,GAtBlDzD,EAuBJJ,WAAA,UAAA,IAvBII,IAANP,EAAA,CADNK,EAAc,eAAA,CAAA,GACFE,CAAAA;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";const s=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const m=require("lit/decorators.js");require("./tailwind.mixin-DvXzFSLc.cjs");const A=require("./litElement.mixin-BnXm63YO.cjs"),b=require("lit"),R=new s.Subject,C="FINDING_MORTIES",j="HERE_RICKY",O=new WeakMap;class f{constructor(){this.prettyURL=!1,this.mode="HISTORY",this.request=new s.ReplaySubject(1),this.current=new Map,this.$current=new s.ReplaySubject(1),this.enableHistoryMode=!0,this.findingMortiesEvent=new CustomEvent(C),this.disposed=!1,this.isProcessingPopstate=!1,this.$current.next(this.current),this.$current.subscribe(e=>{this.disposed||e.forEach((t,r)=>{this.getOrCreateAreaSubject(r).next(t)})}),this.initializeFromBrowserState(),typeof window<"u"&&(this.unloadSubscription=s.fromEvent(window,"unload").subscribe(()=>{this.dispose()}))}get areaSubjects(){let e=O.get(this);return e||(e=new Map,O.set(this,e)),e}initializeFromBrowserState(){try{const e=history.state;e&&e.schmancyAreas&&(Object.entries(e.schmancyAreas).forEach(([t,r])=>{this.current.set(t,r)}),this.$current.next(this.current))}catch{}}getOrCreateAreaSubject(e){let t=this.areaSubjects.get(e);if(!t||t.closed){t=new s.ReplaySubject(1),this.areaSubjects.set(e,t);const r=this.current.get(e);r&&t.next({...r,state:r.state||{},params:r.params||{},props:r.props||{}})}return t}on(e,t=!1){if(!e)throw new Error("Area name is required");const r=this.getOrCreateAreaSubject(e).asObservable().pipe(s.distinctUntilChanged((o,n)=>o.component===n.component&&JSON.stringify(o.state)===JSON.stringify(n.state)&&JSON.stringify(o.params)===JSON.stringify(n.params)),s.shareReplay(1));return t?r.pipe(s.skip(1)):r}all(e=!1){const t=this.$current.asObservable().pipe(s.shareReplay(1));return e?t.pipe(s.skip(1)):t}getState(e){if(!e)throw new Error("Area name is required");return this.on(e).pipe(s.map(t=>t.state),s.filter(t=>t!=null),s.distinctUntilChanged((t,r)=>JSON.stringify(t)===JSON.stringify(r)),s.map(t=>t),s.catchError(t=>s.EMPTY))}params(e){if(!e)throw new Error("Area name is required");return this.on(e).pipe(s.map(t=>t.params),s.filter(t=>t!=null),s.distinctUntilChanged((t,r)=>JSON.stringify(t)===JSON.stringify(r)),s.map(t=>t),s.catchError(t=>s.EMPTY))}param(e,t){if(!e||!t)throw new Error("Area name and key are required");return this.params(e).pipe(s.map(r=>r[t]),s.filter(r=>r!==void 0),s.distinctUntilChanged(),s.map(r=>r),s.catchError(r=>s.EMPTY))}props(e){if(!e)throw new Error("Area name is required");return this.on(e).pipe(s.map(t=>t.props),s.filter(t=>t!=null),s.distinctUntilChanged((t,r)=>JSON.stringify(t)===JSON.stringify(r)),s.map(t=>t),s.catchError(t=>s.EMPTY))}prop(e,t){if(!e||!t)throw new Error("Area name and key are required");return this.props(e).pipe(s.map(r=>r[t]),s.filter(r=>r!==void 0),s.distinctUntilChanged(),s.map(r=>r),s.catchError(r=>s.EMPTY))}find(){return s.zip([s.fromEvent(window,j).pipe(s.map(e=>e.detail),s.bufferTime(0)),s.of(1).pipe(s.tap(()=>window.dispatchEvent(this.findingMortiesEvent)))]).pipe(s.map(([e])=>e),s.timeout(1),s.catchError(()=>s.EMPTY))}push(e){if(!e.area)throw new Error("Area is required for route action");if(this.isProcessingPopstate)return;const t={...e,state:e.state||{},params:e.params||{},props:e.props||{},_source:"programmatic"};this.enableHistoryMode&&R.next(t),this.request.next(t),this.dispatchAreaEvent(t.area,t)}_updateFromBrowser(e){const t={...e,state:e.state||{},params:e.params||{},props:e.props||{},_source:"browser"};this.isProcessingPopstate=!0,this.request.next(t),this.isProcessingPopstate=!1}_updateBrowserHistory(e,t,r,o){if(this.enableHistoryMode)try{const n=history.state||{},i=n.schmancyAreas||{},p={component:t.component,area:t.area};t.state&&Object.keys(t.state).length>0&&(p.state=t.state),t.params&&Object.keys(t.params).length>0&&(p.params=t.params),t.props&&Object.keys(t.props).length>0&&(p.props=t.props),i[e]=p;const c={...n,schmancyAreas:i},u=this.createCleanURL(i,o);r==="replace"||r==="pop"?history.replaceState(c,"",u):r!=="push"&&r||history.pushState(c,"",u)}catch{}}createCleanURL(e,t){const r=location.pathname,o=r.split("/");let n="/";const i=o[o.length-1];i&&(i.includes("{")||i.includes("%7B"))?(o.pop(),n=o.join("/")||"/"):n=r,n==="/"||n.endsWith("/")||(n+="/");let p="";if(t!==!0){const c=new URLSearchParams(location.search);Array.isArray(t)&&t.forEach(u=>c.delete(u)),p=c.toString(),p=p?`?${p}`:""}if(this.prettyURL){const c=e.main;if(c){let u=n==="/"?`/${c.component}`:`${n}${c.component}`;const S=new URLSearchParams(p);c.params&&Object.entries(c.params).forEach(([d,E])=>{typeof E!="string"&&typeof E!="number"||S.set(d,String(E))});const h=S.toString();return u+(h?`?${h}`:"")}}try{const c={};if(Object.entries(e).forEach(([S,h])=>{const d={component:h.component};h.state&&Object.keys(h.state).length>0&&(d.state=h.state),h.params&&Object.keys(h.params).length>0&&(d.params=h.params),h.props&&Object.keys(h.props).length>0&&(d.props=h.props),c[S]=d}),Object.keys(c).length===0)return`${n==="/"?"":n.replace(/\/$/,"")}${p}`;const u=encodeURIComponent(JSON.stringify(c));return`${n==="/"?"":n.replace(/\/$/,"")}/${u}${p}`}catch{return location.pathname}}restoreFromBrowserState(e){try{if(e&&e.schmancyAreas)return e.schmancyAreas}catch{}return this.parseStateFromURL()}parseStateFromURL(){const e=location.pathname.split("/").pop();if(!e)return{};try{const t=decodeURIComponent(e),r=JSON.parse(t);if(typeof r=="object"&&r!==null)return r}catch{}return{}}dispatchAreaEvent(e,t){const r=new CustomEvent(`schmancy-area-${e}-changed`,{detail:{area:e,component:t.component,state:t.state,params:t.params,props:t.props,historyStrategy:t.historyStrategy},bubbles:!0,composed:!0});window.dispatchEvent(r)}pop(e){if(!e)throw new Error("Area name is required");const t=this.areaSubjects.get(e);if(t&&!t.closed&&t.next({component:null,state:{},area:e,params:{},props:{}}),this.request.next({area:e,component:null,state:{},params:{},props:{},historyStrategy:"silent",_source:"programmatic"}),this.current.delete(e),this.$current.next(this.current),this.enableHistoryMode)try{const r=history.state||{},o={...r.schmancyAreas||{}};delete o[e];const n={...r,schmancyAreas:o},i=this.createCleanURL(o);history.replaceState(n,"",i)}catch{}}clear(){if(this.areaSubjects.forEach(e=>e.complete()),this.areaSubjects.clear(),this.current.clear(),this.$current.next(this.current),this.enableHistoryMode){const e=this.createCleanURL({});history.replaceState({schmancyAreas:{}},"",e)}}dispose(){this.disposed||(this.disposed=!0,this.unloadSubscription&&(this.unloadSubscription.unsubscribe(),this.unloadSubscription=void 0),this.areaSubjects.forEach(e=>e.complete()),this.areaSubjects.clear(),this.request.complete(),this.$current.complete(),R.complete(),this.current.clear(),O.delete(this))}static getInstance(){return f.instance||(f.instance=new f),f.instance}get state(){try{const e=history.state;if(e&&e.schmancyAreas)return e.schmancyAreas}catch{}return this.parseStateFromURL()}hasArea(e){return this.current.has(e)}getActiveAreas(){return Array.from(this.current.keys())}getRoute(e){return this.current.get(e)}}const l=f.getInstance();var v=Object.defineProperty,P=Object.getOwnPropertyDescriptor,g=(a,e,t,r)=>{for(var o,n=r>1?void 0:r?P(e,t):e,i=a.length-1;i>=0;i--)(o=a[i])&&(n=(r?o(e,t,n):o(n))||n);return r&&n&&v(e,t,n),n};exports.SchmancyRoute=class extends A.$LitElement(b.css`
|
|
2
|
+
:host {
|
|
3
|
+
display: none;
|
|
4
|
+
}
|
|
5
|
+
`){constructor(){super(...arguments),this.exact=!1}getConfig(){return{when:this.when,component:this.component,exact:this.exact,guard:this.guard}}render(){return b.html``}},g([m.property({type:String})],exports.SchmancyRoute.prototype,"when",2),g([m.property({type:Object})],exports.SchmancyRoute.prototype,"component",2),g([m.property({type:Boolean})],exports.SchmancyRoute.prototype,"exact",2),g([m.property({type:Object})],exports.SchmancyRoute.prototype,"guard",2),exports.SchmancyRoute=g([m.customElement("schmancy-route")],exports.SchmancyRoute);var y=(a=>(a.push="push",a.replace="replace",a.pop="pop",a.silent="silent",a))(y||{}),$=Object.defineProperty,M=Object.getOwnPropertyDescriptor,w=(a,e,t,r)=>{for(var o,n=r>1?void 0:r?M(e,t):e,i=a.length-1;i>=0;i--)(o=a[i])&&(n=(r?o(e,t,n):o(n))||n);return r&&n&&$(e,t,n),n};exports.SchmancyArea=class extends A.$LitElement(b.css`
|
|
6
|
+
:host {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: block;
|
|
9
|
+
inset: 0;
|
|
10
|
+
}
|
|
11
|
+
`){firstUpdated(){if(!this.name)throw new Error("Area name is required");s.merge(l.request.pipe(s.filter(({area:a})=>a===this.name)),s.of(location.pathname).pipe(s.take(1),s.map(()=>{const a=location.pathname,e=a.split("/").pop()||"";if(e&&(e.includes("{")||e.includes("%7B")))try{const r=JSON.parse(decodeURIComponent(e));if(r[this.name])return{area:this.name,component:r[this.name].component,state:r[this.name].state||{},params:r[this.name].params||{},historyStrategy:y.replace}}catch{}const t=a.split("/").filter(Boolean).find(r=>this.routes?.some(o=>o.when===r));return t?{area:this.name,component:t,state:{},params:{},historyStrategy:y.silent}:this.default?{area:this.name,component:this.default,state:{},params:{},historyStrategy:y.silent}:null}),s.filter(a=>a!==null)),s.fromEvent(window,"popstate").pipe(s.map(a=>{if(a.state?.schmancyAreas?.[this.name]){const e=a.state.schmancyAreas[this.name];return{area:this.name,component:e.component,state:e.state||{},params:e.params||{},historyStrategy:y.pop}}return null}),s.filter(a=>a!==null))).pipe(s.filter(a=>a?.component!==void 0),s.map(a=>{let e,t,r=a.component;if(typeof r=="string"&&this.routes)e=this.routes.find(o=>o.when===r),e?(r=e.component,t=e.when):t=r;else if(typeof r=="function"&&this.routes)e=this.routes.find(o=>o.component===r),e&&(t=e.when);else if(r instanceof HTMLElement&&this.routes){const o=r.tagName.toLowerCase();e=this.routes.find(n=>n.when===o),e&&(t=e.when)}return{...a,component:r,matchedRoute:e,originalWhen:t}}),s.switchMap(a=>{const e=a.matchedRoute||(a.originalWhen?this.routes?.find(o=>o.when===a.originalWhen):void 0);if(e?.guard)return e.guard.pipe(s.tap(o=>{}),s.switchMap(o=>{if(o===!0){const{matchedRoute:i,...p}=a;return s.of(p)}const n=new CustomEvent("redirect",{detail:{blockedRoute:a.originalWhen||"unknown",area:this.name,params:a.params||{},state:a.state||{},redirectTarget:typeof o=="object"?o:void 0},bubbles:!0,composed:!0});return e.dispatchEvent(n),s.EMPTY}));const{matchedRoute:t,...r}=a;return s.of(r)}),s.switchMap(async a=>{let e=a.component;if(typeof e=="function"&&("preload"in e||"_promise"in e||"_module"in e))try{e=(await e()).default}catch{return{...a,component:null}}return{...a,component:e}}),s.map(a=>{let e="";const t=a.component;t&&t!==""?typeof t=="string"?e=t:t instanceof HTMLElement?e=t.tagName.toLowerCase():typeof t=="function"&&(e=t.name||"CustomElement"):e="null";const r=`${e}${JSON.stringify(a.params)}${JSON.stringify(a.state)}`;return{...a,key:r,tagName:e}}),s.distinctUntilChanged((a,e)=>a.key===e.key),s.map(a=>{let e=null;const t=a.component;if(t&&t!==""){if(typeof t=="string")try{e=document.createElement(t)}catch{}else if(t instanceof HTMLElement)e=t;else if(typeof t=="function")try{e=new t}catch{}}else e=null;return e&&(a.params&&Object.assign(e,a.params),a.props&&Object.assign(e,a.props),a.state&&(e.state=a.state)),{element:e,route:a}}),s.shareReplay(1),s.tap(({element:a,route:e})=>this.swapComponents(a,e)),s.catchError(a=>s.EMPTY),s.takeUntil(this.disconnecting)).subscribe()}swapComponents(a,e){const t=Array.from(this.children).find(r=>!(r instanceof exports.SchmancyRoute));if(a){if(t?t.animate([{opacity:1},{opacity:0}],{duration:150,easing:"ease-out"}).onfinish=()=>{t.remove(),this.appendChild(a),a.animate([{opacity:0},{opacity:1}],{duration:150,easing:"ease-in"})}:(this.appendChild(a),a.animate([{opacity:0},{opacity:1}],{duration:100,easing:"ease-in"})),a){const r={component:a.tagName.toLowerCase(),state:e.state||{},area:this.name,params:e.params||{}};l.current.set(this.name,r),l.$current.next(l.current)}if(l.enableHistoryMode&&a){const r={component:a.tagName.toLowerCase(),state:e.state||{},area:this.name,params:e.params||{}};l._updateBrowserHistory(this.name,r,e.historyStrategy||y.push,e.clearQueryParams)}}else t&&t.remove()}newPath(a,e){const t=location.pathname.split("/").pop();let r={};try{r=t?JSON.parse(decodeURIComponent(t)):{}}catch{r={}}e.state=e.state??{};const o=e.clearQueryParams?this.queryParamClear(e.clearQueryParams):document.location.search;return encodeURIComponent(JSON.stringify({...r,[this.name]:{component:a.toLowerCase(),state:e.state,params:e.params}})).concat(`${o}`)}queryParamClear(a){if(!a)return"";const e=new URLSearchParams(location.search);return a===!0?"":(a.forEach(t=>e.delete(t)),e.toString()===""?"":`?${e.toString()}`)}disconnectedCallback(){super.disconnectedCallback()}render(){return b.html`<slot></slot>`}},w([m.property()],exports.SchmancyArea.prototype,"name",2),w([m.property()],exports.SchmancyArea.prototype,"default",2),w([m.queryAssignedElements({selector:"schmancy-route",flatten:!0})],exports.SchmancyArea.prototype,"routes",2),exports.SchmancyArea=w([m.customElement("schmancy-area")],exports.SchmancyArea),exports.FINDING_MORTIES=C,exports.HERE_RICKY=j,exports.HISTORY_STRATEGY=y,exports.area=l,exports.routerHistory=R;
|
|
12
|
+
//# sourceMappingURL=area.component-XtxnlVW-.cjs.map
|