@mhmo91/schmancy 0.2.193 → 0.2.194

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.
Files changed (93) hide show
  1. package/ai/area.md +125 -0
  2. package/ai/autocomplete.md +135 -0
  3. package/ai/avatar.md +178 -0
  4. package/ai/badge.md +100 -0
  5. package/ai/busy.md +195 -0
  6. package/ai/button.md +112 -0
  7. package/ai/card.md +155 -0
  8. package/ai/checkbox.md +108 -0
  9. package/ai/chips.md +180 -0
  10. package/ai/component-relationships.md +93 -0
  11. package/ai/dialog.md +109 -0
  12. package/ai/dropdown.md +238 -0
  13. package/ai/form.md +148 -0
  14. package/ai/icons.md +147 -0
  15. package/ai/index.md +71 -0
  16. package/ai/input.md +167 -0
  17. package/ai/layout.md +166 -0
  18. package/ai/list.md +145 -0
  19. package/ai/menu.md +217 -0
  20. package/ai/notification.md +93 -0
  21. package/ai/radio-group.md +176 -0
  22. package/ai/select.md +174 -0
  23. package/ai/sheet.md +122 -0
  24. package/ai/store.md +235 -0
  25. package/ai/surface.md +221 -0
  26. package/ai/table.md +236 -0
  27. package/ai/tabs.md +71 -0
  28. package/ai/template.md +144 -0
  29. package/ai/textarea.md +147 -0
  30. package/ai/tooltip.md +149 -0
  31. package/ai/tree.md +279 -0
  32. package/ai/typography.md +170 -0
  33. package/dist/ai/area.md +125 -0
  34. package/dist/ai/autocomplete.md +135 -0
  35. package/dist/ai/avatar.md +178 -0
  36. package/dist/ai/badge.md +100 -0
  37. package/dist/ai/busy.md +195 -0
  38. package/dist/ai/button.md +112 -0
  39. package/dist/ai/card.md +155 -0
  40. package/dist/ai/checkbox.md +108 -0
  41. package/dist/ai/chips.md +180 -0
  42. package/dist/ai/component-relationships.md +93 -0
  43. package/dist/ai/dialog.md +109 -0
  44. package/dist/ai/dropdown.md +238 -0
  45. package/dist/ai/form.md +148 -0
  46. package/dist/ai/icons.md +147 -0
  47. package/dist/ai/index.md +71 -0
  48. package/dist/ai/input.md +167 -0
  49. package/dist/ai/layout.md +166 -0
  50. package/dist/ai/list.md +145 -0
  51. package/dist/ai/menu.md +217 -0
  52. package/dist/ai/notification.md +93 -0
  53. package/dist/ai/radio-group.md +176 -0
  54. package/dist/ai/select.md +174 -0
  55. package/dist/ai/sheet.md +122 -0
  56. package/dist/ai/store.md +235 -0
  57. package/dist/ai/surface.md +221 -0
  58. package/dist/ai/table.md +236 -0
  59. package/dist/ai/tabs.md +71 -0
  60. package/dist/ai/template.md +144 -0
  61. package/dist/ai/textarea.md +147 -0
  62. package/dist/ai/tooltip.md +149 -0
  63. package/dist/ai/tree.md +279 -0
  64. package/dist/ai/typography.md +170 -0
  65. package/dist/area.cjs +1 -1
  66. package/dist/area.component-CzFJM7Y4.js +143 -0
  67. package/dist/area.component-CzFJM7Y4.js.map +1 -0
  68. package/dist/area.component-WxccFh1z.cjs +8 -0
  69. package/dist/area.component-WxccFh1z.cjs.map +1 -0
  70. package/dist/area.js +1 -1
  71. package/dist/{avatar-s-2jSsaH.cjs → avatar-Bmg5TXj9.cjs} +2 -2
  72. package/dist/{avatar-s-2jSsaH.cjs.map → avatar-Bmg5TXj9.cjs.map} +1 -1
  73. package/dist/{avatar-WAIlaNJg.js → avatar-CgP1tBZq.js} +2 -2
  74. package/dist/{avatar-WAIlaNJg.js.map → avatar-CgP1tBZq.js.map} +1 -1
  75. package/dist/badge.cjs +1 -1
  76. package/dist/badge.js +1 -1
  77. package/dist/card.cjs +1 -1
  78. package/dist/card.js +1 -1
  79. package/dist/content-drawer.cjs +1 -1
  80. package/dist/content-drawer.js +1 -1
  81. package/dist/index.cjs +1 -1
  82. package/dist/index.js +2 -2
  83. package/dist/nav-drawer.cjs +1 -1
  84. package/dist/nav-drawer.js +1 -1
  85. package/dist/teleport.cjs +1 -1
  86. package/dist/teleport.js +1 -1
  87. package/package.json +2 -1
  88. package/types/src/area/area.service.d.ts +53 -4
  89. package/types/src/area/router.types.d.ts +41 -2
  90. package/dist/area.component-CZELEuMj.js +0 -107
  91. package/dist/area.component-CZELEuMj.js.map +0 -1
  92. package/dist/area.component-grRkXEse.cjs +0 -8
  93. package/dist/area.component-grRkXEse.cjs.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./avatar-s-2jSsaH.cjs");exports.$drawer=e.$drawer,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>e.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=e.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=e.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>e.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerSidebar}),exports.schmancyNavDrawer=e.schmancyNavDrawer;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./avatar-Bmg5TXj9.cjs");exports.$drawer=e.$drawer,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>e.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=e.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=e.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>e.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerSidebar}),exports.schmancyNavDrawer=e.schmancyNavDrawer;
2
2
  //# sourceMappingURL=nav-drawer.cjs.map
@@ -1,4 +1,4 @@
1
- import { $ as c, j as e, l as n, m, n as s, k as i, o, i as t } from "./avatar-WAIlaNJg.js";
1
+ import { $ as c, j as e, l as n, m, n as s, k as i, o, i as t } from "./avatar-CgP1tBZq.js";
2
2
  export {
3
3
  c as $drawer,
4
4
  e as SchmancyDrawerAppbar,
package/dist/teleport.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./avatar-s-2jSsaH.cjs");exports.HereMorty=e.HereMorty,Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>e.SchmancyTeleportation}),exports.WhereAreYouRicky=e.WhereAreYouRicky,exports.teleport=e.teleport;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./avatar-Bmg5TXj9.cjs");exports.HereMorty=e.HereMorty,Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>e.SchmancyTeleportation}),exports.WhereAreYouRicky=e.WhereAreYouRicky,exports.teleport=e.teleport;
2
2
  //# sourceMappingURL=teleport.cjs.map
package/dist/teleport.js CHANGED
@@ -1,4 +1,4 @@
1
- import { H as o, p as t, W as a, t as p } from "./avatar-WAIlaNJg.js";
1
+ import { H as o, p as t, W as a, t as p } from "./avatar-CgP1tBZq.js";
2
2
  export {
3
3
  o as HereMorty,
4
4
  t as SchmancyTeleportation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhmo91/schmancy",
3
- "version": "0.2.193",
3
+ "version": "0.2.194",
4
4
  "description": "UI library build with web components",
5
5
  "main": "./dist/index.js",
6
6
  "packageManager": "yarn@4.6.0",
@@ -22,6 +22,7 @@
22
22
  "files": [
23
23
  "dist",
24
24
  "types",
25
+ "ai",
25
26
  "README.md"
26
27
  ],
27
28
  "publishConfig": {
@@ -1,6 +1,6 @@
1
- import { ReplaySubject, Subject } from 'rxjs';
1
+ import { Observable, ReplaySubject, Subject } from 'rxjs';
2
2
  import { SchmancyTeleportation } from '../teleport';
3
- import { ActiveRoute, RouteAction } from './router.types';
3
+ import { ActiveRoute, AreaSubscription, RouteAction } from './router.types';
4
4
  export declare const routerHistory: Subject<RouteAction>;
5
5
  export declare const FINDING_MORTIES = "FINDING_MORTIES";
6
6
  export declare const HERE_RICKY = "HERE_RICKY";
@@ -10,18 +10,67 @@ export type HERE_RICKY_EVENT = CustomEvent<{
10
10
  export type FINDING_MORTIES_EVENT = CustomEvent<{
11
11
  component: SchmancyTeleportation;
12
12
  }>;
13
- declare class AreaService {
13
+ declare class AreaService implements AreaSubscription {
14
14
  private static instance;
15
15
  prettyURL: boolean;
16
16
  mode: 'SILENT' | 'HISTORY';
17
17
  request: ReplaySubject<RouteAction>;
18
18
  current: Map<string, ActiveRoute>;
19
19
  $current: ReplaySubject<Map<string, ActiveRoute>>;
20
+ private areaSubjects;
20
21
  enableHistoryMode: boolean;
21
22
  private findingMortiesEvent;
22
23
  constructor();
23
- find(): import("rxjs").Observable<any>;
24
+ /**
25
+ * Get or create a ReplaySubject for a specific area
26
+ * @param areaName The name of the area
27
+ * @returns ReplaySubject for the specified area
28
+ */
29
+ private getOrCreateAreaSubject;
30
+ /**
31
+ * Subscribe to a specific area
32
+ * @param areaName Name of the area to subscribe to
33
+ * @param skipCurrent Whether to skip the current value
34
+ * @returns Observable of the active route for the specified area
35
+ */
36
+ on(areaName: string, skipCurrent?: boolean): Observable<ActiveRoute>;
37
+ /**
38
+ * Subscribe to all areas
39
+ * @param skipCurrent Whether to skip the current value
40
+ * @returns Observable of all active routes
41
+ */
42
+ all(skipCurrent?: boolean): Observable<Map<string, ActiveRoute>>;
43
+ /**
44
+ * Get state from an area
45
+ * @param areaName Name of the area to subscribe to
46
+ * @returns Observable of the area's state
47
+ */
48
+ getState<T = unknown>(areaName: string): Observable<T>;
49
+ /**
50
+ * Get params from an area
51
+ * @param areaName Name of the area to subscribe to
52
+ * @returns Observable of the area's params
53
+ */
54
+ params<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): Observable<T>;
55
+ /**
56
+ * Get a specific param from an area
57
+ * @param areaName Name of the area to subscribe to
58
+ * @param key Key of the param to select
59
+ * @returns Observable of the param value
60
+ */
61
+ param<T = unknown>(areaName: string, key: string): Observable<T>;
62
+ find(): Observable<any>;
63
+ /**
64
+ * Push a new route action
65
+ * @param r Route action to push
66
+ */
24
67
  push(r: RouteAction): void;
68
+ /**
69
+ * Dispatch a DOM event for a specific area change
70
+ * @param areaName Name of the area that changed
71
+ * @param routeAction The route action that was pushed
72
+ */
73
+ private dispatchAreaEvent;
25
74
  pop(name: string): void;
26
75
  static getInstance(): AreaService;
27
76
  get state(): {};
@@ -1,15 +1,54 @@
1
1
  export type RouteAction = {
2
2
  component: CustomElementConstructor | string | HTMLElement;
3
3
  area: string;
4
- state?: object;
4
+ state?: Record<string, unknown>;
5
+ params?: Record<string, unknown>;
5
6
  historyStrategy?: THistoryStrategy;
6
7
  clearQueryParams?: string[] | null;
7
8
  };
8
9
  export type ActiveRoute = {
9
10
  component: string;
10
11
  area: string;
11
- state?: object;
12
+ state?: Record<string, unknown>;
13
+ params?: Record<string, unknown>;
12
14
  };
15
+ /**
16
+ * Interface for subscribing to area changes
17
+ */
18
+ export interface AreaSubscription {
19
+ /**
20
+ * Subscribe to a specific area
21
+ * @param areaName Name of the area to subscribe to
22
+ * @param skipCurrent Whether to skip the current value
23
+ * @returns Observable of the active route for the specified area
24
+ */
25
+ on(areaName: string, skipCurrent?: boolean): import('rxjs').Observable<ActiveRoute>;
26
+ /**
27
+ * Subscribe to all areas
28
+ * @param skipCurrent Whether to skip the current value
29
+ * @returns Observable of all active routes
30
+ */
31
+ all(skipCurrent?: boolean): import('rxjs').Observable<Map<string, ActiveRoute>>;
32
+ /**
33
+ * Get state from an area
34
+ * @param areaName Name of the area to subscribe to
35
+ * @returns Observable of the area's state
36
+ */
37
+ getState<T = unknown>(areaName: string): import('rxjs').Observable<T>;
38
+ /**
39
+ * Get params from an area
40
+ * @param areaName Name of the area to subscribe to
41
+ * @returns Observable of the area's params
42
+ */
43
+ params<T extends Record<string, unknown> = Record<string, unknown>>(areaName: string): import('rxjs').Observable<T>;
44
+ /**
45
+ * Get a specific param from an area
46
+ * @param areaName Name of the area to subscribe to
47
+ * @param key Key of the param to select
48
+ * @returns Observable of the param value
49
+ */
50
+ param<T = unknown>(areaName: string, key: string): import('rxjs').Observable<T>;
51
+ }
13
52
  export type THistoryStrategy = 'push' | 'replace' | 'pop' | 'silent';
14
53
  export declare enum HISTORY_STRATEGY {
15
54
  push = "push",
@@ -1,107 +0,0 @@
1
- import { Subject as b, ReplaySubject as S, zip as I, fromEvent as g, of as i, map as o, bufferTime as R, tap as h, timeout as v, filter as u, catchError as E, EMPTY as O, merge as U, switchMap as d, take as N, takeUntil as f, distinctUntilChanged as C, from as T } from "rxjs";
2
- import "lit/directives/class-map.js";
3
- import "lit/directives/style-map.js";
4
- import { $ as L } from "./litElement.mixin-B9Qdq5S_.js";
5
- import "./tailwind.mixin-Di7KWye7.js";
6
- import { css as x, html as F } from "lit";
7
- import { property as P, customElement as J } from "lit/decorators.js";
8
- import { l as M } from "./index-CuY8m6ta.js";
9
- const B = new b(), k = "FINDING_MORTIES", q = "HERE_RICKY";
10
- class p {
11
- constructor() {
12
- this.prettyURL = !1, this.mode = "HISTORY", this.request = new S(1), this.current = /* @__PURE__ */ new Map(), this.$current = new S(1), this.enableHistoryMode = !0, this.findingMortiesEvent = new CustomEvent(k), this.$current.next(this.current);
13
- }
14
- find() {
15
- return I([g(window, q).pipe(o((e) => e.detail), R(0), h(console.log)), i(1).pipe(h(() => window.dispatchEvent(this.findingMortiesEvent)))]).pipe(o(([e]) => e), v(1));
16
- }
17
- push(e) {
18
- this.request.next(e);
19
- }
20
- pop(e) {
21
- const n = JSON.parse(JSON.stringify(c.state));
22
- delete n[e], history.replaceState(null, "", encodeURIComponent(JSON.stringify(n)));
23
- }
24
- static getInstance() {
25
- return p.instance || (p.instance = new p()), p.instance;
26
- }
27
- get state() {
28
- const e = location.pathname.split("/").pop();
29
- let n = {};
30
- try {
31
- n = e ? JSON.parse(decodeURIComponent(e)) : {};
32
- } catch {
33
- n = {};
34
- }
35
- return n;
36
- }
37
- }
38
- const c = p.getInstance();
39
- var w = ((t) => (t.push = "push", t.replace = "replace", t.pop = "pop", t.silent = "silent", t))(w || {}), $ = Object.defineProperty, j = Object.getOwnPropertyDescriptor, y = (t, e, n, a) => {
40
- for (var r, s = a > 1 ? void 0 : a ? j(e, n) : e, l = t.length - 1; l >= 0; l--) (r = t[l]) && (s = (a ? r(e, n, s) : r(s)) || s);
41
- return a && s && $(e, n, s), s;
42
- };
43
- let m = class extends L(x`
44
- :host {
45
- position: relative;
46
- display: block;
47
- inset: 0;
48
- }
49
- `) {
50
- getComponentFromPathname(t, e) {
51
- return i(t).pipe(o((n) => n.split("/").pop() ?? ""), o((n) => decodeURIComponent(n)), o((n) => JSON.parse(n)), o((n) => n[this.name]), o((n) => !n && this.default ? { component: this.default, state: void 0 } : n), u((n) => M.isPresent(n)), o((n) => ({ area: this.name, component: n.component ?? this.default, state: n.state, historyStrategy: e })), o((n) => n), E(() => this.default ? i({ area: this.name, component: this.default, historyStrategy: e }) : O));
52
- }
53
- firstUpdated() {
54
- if (!this.name) throw new Error("Area name or default component not set");
55
- U(i(location.pathname).pipe(d((t) => this.getComponentFromPathname(t, w.silent)), o((t) => t), N(1)), c.request.pipe(u(({ area: t }) => t === this.name)), g(window, "popstate").pipe(o((t) => t.target.location.pathname), d((t) => this.getComponentFromPathname(t, w.silent)), o((t) => t))).pipe(u((t) => !!t.component), f(this.disconnecting), C((t, e) => {
56
- let n, a;
57
- return typeof t.component != "function" && (typeof t.component == "string" && (n = t.component), typeof e.component != "function" && (typeof e.component == "string" && (a = e.component), (a == null ? void 0 : a.replaceAll("-", "").toLowerCase()) === (n == null ? void 0 : n.replaceAll("-", "").toLowerCase())));
58
- })).pipe(d((t) => {
59
- const e = t.component;
60
- return e instanceof Promise ? T(e).pipe(o((n) => ({ component: n.exports.default, route: t }))) : i({ component: e, route: t });
61
- }), o(({ component: t, route: e }) => typeof t == "string" ? { component: document.createElement(t), route: e } : t instanceof HTMLElement ? { component: t, route: e } : typeof t == "function" ? { component: new t(), route: e } : void 0), C((t, e) => t.component.tagName === e.component.tagName), o(({ component: t, route: e }) => {
62
- var r, s;
63
- const n = (r = this.shadowRoot) == null ? void 0 : r.children[0], a = !!n;
64
- return n.remove(), t.classList.add("opacity-0"), (s = this.shadowRoot) == null || s.append(t), t.animate([{ opacity: 0 }, { opacity: 1 }], { duration: a ? 150 : 100, easing: "cubic-bezier(0.25, 0.8, 0.25, 1)", fill: "forwards" }), { component: t, route: e };
65
- }), h(({ component: t, route: e }) => {
66
- e.historyStrategy === void 0 || e.historyStrategy === "push" ? history.pushState(e.state, "", this.newPath(t.tagName, e)) : e.historyStrategy && ["replace", "pop"].includes(e.historyStrategy) && history.replaceState(e.state, "", this.newPath(t.tagName, e)), c.current.set(this.name, { component: t.tagName, state: e.state, area: this.name }), c.$current.next(c.current);
67
- }), f(this.disconnecting)).subscribe();
68
- }
69
- newPath(t, e) {
70
- const n = location.pathname.split("/").pop();
71
- let a = {};
72
- try {
73
- a = n ? JSON.parse(decodeURIComponent(n)) : {};
74
- } catch {
75
- a = {};
76
- }
77
- e.state = e.state ?? {};
78
- const r = e.clearQueryParams ? this.queryParamClear(e.clearQueryParams) : document.location.search;
79
- return encodeURIComponent(JSON.stringify({ ...a, [this.name]: { component: t.toLowerCase(), state: e.state } })).concat(`${r}`);
80
- }
81
- queryParamClear(t) {
82
- if (!t) return "";
83
- const e = new URLSearchParams(location.search);
84
- return t.forEach((n) => e.delete(n)), e.toString() === "" ? "" : `?${e.toString()}`;
85
- }
86
- checkForTeleportationRequests() {
87
- return g(window, "FLIP_REQUEST").pipe(o((t) => t.detail), R(0), h(() => {
88
- this.dispatchEvent(new CustomEvent("FLIP_STARTED"));
89
- }), f(this.disconnecting), v(0), E(() => i(null)));
90
- }
91
- disconnectedCallback() {
92
- super.disconnectedCallback(), this.disconnecting.next(!0);
93
- }
94
- render() {
95
- return F` <slot> </slot> `;
96
- }
97
- };
98
- y([P()], m.prototype, "name", 2), y([P()], m.prototype, "default", 2), m = y([J("schmancy-area")], m);
99
- export {
100
- k as F,
101
- q as H,
102
- m as S,
103
- c as a,
104
- w as b,
105
- B as r
106
- };
107
- //# sourceMappingURL=area.component-CZELEuMj.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"area.component-CZELEuMj.js","sources":["../src/area/area.service.ts","../src/area/router.types.ts","../src/area/area.component.ts"],"sourcesContent":["import { ReplaySubject, Subject, bufferTime, fromEvent, map, of, tap, timeout, zip } from 'rxjs'\nimport { SchmancyTeleportation } from '../teleport'\nimport { ActiveRoute, 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\nclass AreaService {\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\tpublic enableHistoryMode = true\n\tprivate findingMortiesEvent = new CustomEvent<FINDING_MORTIES_EVENT['detail']>(FINDING_MORTIES)\n\n\tconstructor() {\n\t\tthis.$current.next(this.current)\n\t}\n\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\ttap(console.log),\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)\n\t}\n\n\tpush(r: RouteAction) {\n\t\tthis.request.next(r)\n\t}\n\n\tpop(name: string) {\n\t\tconst newState = JSON.parse(JSON.stringify(area.state))\n\t\tdelete newState[name]\n\t\tconsole.log(area.state, newState)\n\t\thistory.replaceState(null, '', encodeURIComponent(JSON.stringify(newState)))\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\tget state() {\n\t\tconst pathname = location.pathname.split('/').pop()\n\t\tlet areaState = {}\n\t\ttry {\n\t\t\tareaState = pathname ? JSON.parse(decodeURIComponent(pathname)) : {}\n\t\t} catch {\n\t\t\tareaState = {}\n\t\t}\n\t\treturn areaState\n\t}\n}\n\nexport const area = AreaService.getInstance()\nexport default area\n","export type RouteAction = {\n\tcomponent: CustomElementConstructor | string | HTMLElement\n\tarea: string\n\tstate?: object\n\thistoryStrategy?: THistoryStrategy\n\tclearQueryParams?: string[] | null\n}\n\nexport type ActiveRoute = {\n\tcomponent: string\n\tarea: string\n\tstate?: object\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","import { $LitElement } from '@mixins/index'\nimport { TemplateResult, css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport {\n\tEMPTY,\n\tbufferTime,\n\tcatchError,\n\tdistinctUntilChanged,\n\tfilter,\n\tfrom,\n\tfromEvent,\n\tmap,\n\tmerge,\n\tof,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n\ttimeout,\n} from 'rxjs'\nimport { isPresent } from 'ts-is-present'\nimport area from './area.service'\nimport { HISTORY_STRATEGY, RouteAction } from './router.types'\n\ntype TRouteArea = {\n\tcomponent: string\n\tstate: object | undefined\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!: string | Promise<NodeModule> | CustomElementConstructor | TemplateResult<1>\n\n\t/**\n\t *\n\t * @param pathname pathname from the browser location API\n\t * @param historyStrategy the history strategy to use for the route like PUSH, REPLACE, or SILENT\n\t * @returns rxjs pipes that will return the component to render and the history strategy to use\n\t */\n\tgetComponentFromPathname(pathname: string, historyStrategy: HISTORY_STRATEGY) {\n\t\treturn of(pathname).pipe(\n\t\t\tmap(path => path.split('/').pop() ?? ''),\n\t\t\tmap(path => decodeURIComponent(path)),\n\t\t\tmap(path => JSON.parse(path)),\n\t\t\tmap(routes => routes[this.name] as TRouteArea),\n\t\t\tmap(component =>\n\t\t\t\t!component && this.default\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcomponent: this.default,\n\t\t\t\t\t\t\tstate: undefined,\n\t\t\t\t\t\t}\n\t\t\t\t\t: component,\n\t\t\t),\n\t\t\tfilter(x => isPresent(x)),\n\t\t\tmap((component: TRouteArea) => ({\n\t\t\t\tarea: this.name,\n\t\t\t\tcomponent: component.component ?? this.default,\n\t\t\t\tstate: component.state,\n\t\t\t\thistoryStrategy,\n\t\t\t})),\n\t\t\tmap(x => x as RouteAction),\n\t\t\tcatchError(() => {\n\t\t\t\treturn this.default\n\t\t\t\t\t? of({\n\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\tcomponent: this.default,\n\t\t\t\t\t\t\thistoryStrategy,\n\t\t\t\t\t\t} as RouteAction)\n\t\t\t\t\t: EMPTY\n\t\t\t}),\n\t\t)\n\t}\n\n\tprotected firstUpdated(): void {\n\t\tif (!this.name) {\n\t\t\t// TOOD: maybe enforce this to be unique\n\t\t\tthrow new Error('Area name or default component not set')\n\t\t}\n\n\t\t// active outlet changes\n\t\tmerge(\n\t\t\t// 1) initial load from location.pathname\n\t\t\tof(location.pathname).pipe(\n\t\t\t\tswitchMap(pathname => this.getComponentFromPathname(pathname, HISTORY_STRATEGY.silent)),\n\t\t\t\tmap(route => route as RouteAction),\n\t\t\t\ttake(1),\n\t\t\t),\n\t\t\t// 2) requests to change the route for this area\n\t\t\tarea.request.pipe(filter(({ area }) => area === this.name)),\n\t\t\t// 3) popstate events (back, forward)\n\t\t\tfromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\tmap(e => (e.target as Window).location.pathname),\n\t\t\t\tswitchMap(pathname => this.getComponentFromPathname(pathname, HISTORY_STRATEGY.silent)),\n\t\t\t\tmap(route => route as RouteAction),\n\t\t\t),\n\t\t)\n\t\t\t.pipe(\n\t\t\t\tfilter(request => !!request.component),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t\tdistinctUntilChanged((a, b) => {\n\t\t\t\t\tlet aComponent, bComponent\n\t\t\t\t\tif (typeof a.component === 'function') return false\n\t\t\t\t\telse if (typeof a.component === 'string') aComponent = a.component\n\n\t\t\t\t\tif (typeof b.component === 'function') return false\n\t\t\t\t\telse if (typeof b.component === 'string') bComponent = b.component\n\n\t\t\t\t\treturn bComponent?.replaceAll('-', '').toLowerCase() === aComponent?.replaceAll('-', '').toLowerCase()\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.pipe(\n\t\t\t\tswitchMap(route => {\n\t\t\t\t\tconst c = route.component\n\t\t\t\t\tif (c instanceof Promise) {\n\t\t\t\t\t\t// Dynamic import module\n\t\t\t\t\t\treturn from(c).pipe(map(x => ({ component: x.exports.default as CustomElementConstructor, route })))\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Already a string, function, or element\n\t\t\t\t\t\treturn of({ component: c, route })\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tmap(({ component, route }) => {\n\t\t\t\t\tif (typeof component === 'string') {\n\t\t\t\t\t\t// Tag name\n\t\t\t\t\t\treturn { component: document.createElement(component), route }\n\t\t\t\t\t} else if (component instanceof HTMLElement) {\n\t\t\t\t\t\t// Already an element instance\n\t\t\t\t\t\treturn { component, route }\n\t\t\t\t\t} else if (typeof component === 'function') {\n\t\t\t\t\t\t// Custom element constructor\n\t\t\t\t\t\treturn { component: new component(), route }\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tdistinctUntilChanged((prev, curr) => prev.component.tagName === curr.component.tagName),\n\t\t\t\t// create the new view and add it to the DOM\n\t\t\t\tmap(({ component, route }) => {\n\t\t\t\t\tconst oldView = this.shadowRoot?.children[0]\n\t\t\t\t\tconst oldViewExists = !!oldView\n\n\t\t\t\t\t// Remove the old view (if any)\n\t\t\t\t\toldView.remove()\n\t\t\t\t\t// Native Web Animations API - fade in\n\t\t\t\t\t// \"ease: cubic-bezier(0.25, 0.8, 0.25, 1)\" was used in the old code\n\t\t\t\t\tcomponent.classList.add('opacity-0')\n\t\t\t\t\tthis.shadowRoot?.append(component)\n\t\t\t\t\tcomponent.animate([{ opacity: 0 }, { opacity: 1 }], {\n\t\t\t\t\t\tduration: oldViewExists ? 150 : 100,\n\t\t\t\t\t\teasing: 'cubic-bezier(0.25, 0.8, 0.25, 1)',\n\t\t\t\t\t\tfill: 'forwards',\n\t\t\t\t\t})\n\n\t\t\t\t\t// Insert the new view\n\n\t\t\t\t\treturn { component, route }\n\t\t\t\t}),\n\t\t\t\ttap(({ component, route }) => {\n\t\t\t\t\t// Handle history updates\n\t\t\t\t\tif (typeof route.historyStrategy === 'undefined' || route.historyStrategy === 'push') {\n\t\t\t\t\t\thistory.pushState(route.state, '', this.newPath(component.tagName, route))\n\t\t\t\t\t} else if (route.historyStrategy && ['replace', 'pop'].includes(route.historyStrategy)) {\n\t\t\t\t\t\thistory.replaceState(route.state, '', this.newPath(component.tagName, route))\n\t\t\t\t\t}\n\t\t\t\t\tarea.current.set(this.name, {\n\t\t\t\t\t\tcomponent: component.tagName,\n\t\t\t\t\t\tstate: route.state,\n\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t})\n\n\t\t\t\t\tarea.$current.next(area.current)\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\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 },\n\t\t\t}),\n\t\t).concat(`${queryParams}`)\n\t}\n\n\tqueryParamClear(params?: string[]) {\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\t\t// remove query params\n\t\tparams.forEach(param => urlParams.delete(param))\n\t\t// update url\n\t\tif (urlParams.toString() === '') return ''\n\t\treturn `?${urlParams.toString()}`\n\t}\n\n\tcheckForTeleportationRequests() {\n\t\treturn fromEvent<CustomEvent>(window, 'FLIP_REQUEST').pipe(\n\t\t\tmap(e => e.detail),\n\t\t\tbufferTime(0),\n\t\t\ttap(() => {\n\t\t\t\tthis.dispatchEvent(new CustomEvent('FLIP_STARTED'))\n\t\t\t}),\n\t\t\ttakeUntil(this.disconnecting),\n\t\t\ttimeout(0),\n\t\t\tcatchError(() => of(null)),\n\t\t)\n\t}\n\n\tdisconnectedCallback(): void {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\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","AreaService","constructor","this","prettyURL","mode","request","ReplaySubject","current","Map","$current","enableHistoryMode","findingMortiesEvent","CustomEvent","next","find","zip","fromEvent","window","pipe","map","e","detail","bufferTime","tap","console","log","of","dispatchEvent","component","timeout","r","name","newState","JSON","parse","stringify","area","state","history","replaceState","encodeURIComponent","instance","pathname","location","split","pop","areaState","decodeURIComponent","getInstance","HISTORY_STRATEGY","SchmancyArea","$LitElement","css","historyStrategy","path","routes","default","filter","x","isPresent","catchError","EMPTY","firstUpdated","Error","merge","switchMap","getComponentFromPathname","silent","route","take","target","takeUntil","disconnecting","distinctUntilChanged","a","b","aComponent","bComponent","replaceAll","toLowerCase","c","Promise","from","exports","document","createElement","HTMLElement","prev","curr","tagName","oldView","shadowRoot","children","oldViewExists","remove","classList","add","append","animate","opacity","duration","easing","fill","pushState","newPath","includes","set","subscribe","tag","oldPathname","oldAreaState","queryParams","clearQueryParams","queryParamClear","search","concat","params","urlParams","URLSearchParams","forEach","param","delete","toString","checkForTeleportationRequests","disconnectedCallback","super","html","__decorateClass","property","prototype","customElement"],"mappings":";;;;;;;;AAIa,MAAAA,IAAgB,IAAIC,KAEpBC,IAAkB,mBAClBC,IAAa;AAQ1B,MAAMC,EAAAA;AAAAA,EAUL,cAAAC;AARAC,SAAOC,YAAAA,IACPD,KAAOE,OAA6B,WAC7BF,KAAAG,UAAU,IAAIC,EAA2B,CAAA,GACzCJ,KAAAK,8BAAcC,OACdN,KAAAO,WAAW,IAAIH,EAAwC,IAC9DJ,KAAOQ,oBAAAA,IACCR,KAAAS,sBAAsB,IAAIC,YAA6Cd,CAAAA,GAGzEI,KAAAO,SAASI,KAAKX,KAAKK,OAAO;AAAA,EAAA;AAAA,EAGhC,OAAAO;AACC,WAAOC,EAAI,CACVC,EAA4BC,QAAQlB,CAAYmB,EAAAA,KAC/CC,EAASC,CAAAA,MAAAA,EAAEC,MAAAA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C;AAAAA,EAAA,CAAXC,EAAAA,CAAAA,GAdW9E,EAcA+E,WAAA,QAAA,CAAA,GAEAF,EAAA,CAAXC,EAhBW9E,CAAAA,GAAAA,EAgBA+E,WAAA,WAAA,CAhBA/E,GAAAA,IAAN6E,EAAA,CADNG,EAAc,eAAA,CAAA,GACFhF;"}
@@ -1,8 +0,0 @@
1
- "use strict";const n=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const f=require("./litElement.mixin-CHvyxfxf.cjs");require("./tailwind.mixin-Dm5QDZav.cjs");const u=require("lit"),h=require("lit/decorators.js"),g=require("./index-DyJ0oDpR.cjs"),S=new n.Subject,d="FINDING_MORTIES",y="HERE_RICKY";class p{constructor(){this.prettyURL=!1,this.mode="HISTORY",this.request=new n.ReplaySubject(1),this.current=new Map,this.$current=new n.ReplaySubject(1),this.enableHistoryMode=!0,this.findingMortiesEvent=new CustomEvent(d),this.$current.next(this.current)}find(){return n.zip([n.fromEvent(window,y).pipe(n.map(e=>e.detail),n.bufferTime(0),n.tap(console.log)),n.of(1).pipe(n.tap(()=>window.dispatchEvent(this.findingMortiesEvent)))]).pipe(n.map(([e])=>e),n.timeout(1))}push(e){this.request.next(e)}pop(e){const o=JSON.parse(JSON.stringify(s.state));delete o[e],history.replaceState(null,"",encodeURIComponent(JSON.stringify(o)))}static getInstance(){return p.instance||(p.instance=new p),p.instance}get state(){const e=location.pathname.split("/").pop();let o={};try{o=e?JSON.parse(decodeURIComponent(e)):{}}catch{o={}}return o}}const s=p.getInstance();var c=(t=>(t.push="push",t.replace="replace",t.pop="pop",t.silent="silent",t))(c||{}),w=Object.defineProperty,E=Object.getOwnPropertyDescriptor,l=(t,e,o,a)=>{for(var i,r=a>1?void 0:a?E(e,o):e,m=t.length-1;m>=0;m--)(i=t[m])&&(r=(a?i(e,o,r):i(r))||r);return a&&r&&w(e,o,r),r};exports.SchmancyArea=class extends f.$LitElement(u.css`
2
- :host {
3
- position: relative;
4
- display: block;
5
- inset: 0;
6
- }
7
- `){getComponentFromPathname(t,e){return n.of(t).pipe(n.map(o=>o.split("/").pop()??""),n.map(o=>decodeURIComponent(o)),n.map(o=>JSON.parse(o)),n.map(o=>o[this.name]),n.map(o=>!o&&this.default?{component:this.default,state:void 0}:o),n.filter(o=>g.libExports.isPresent(o)),n.map(o=>({area:this.name,component:o.component??this.default,state:o.state,historyStrategy:e})),n.map(o=>o),n.catchError(()=>this.default?n.of({area:this.name,component:this.default,historyStrategy:e}):n.EMPTY))}firstUpdated(){if(!this.name)throw new Error("Area name or default component not set");n.merge(n.of(location.pathname).pipe(n.switchMap(t=>this.getComponentFromPathname(t,c.silent)),n.map(t=>t),n.take(1)),s.request.pipe(n.filter(({area:t})=>t===this.name)),n.fromEvent(window,"popstate").pipe(n.map(t=>t.target.location.pathname),n.switchMap(t=>this.getComponentFromPathname(t,c.silent)),n.map(t=>t))).pipe(n.filter(t=>!!t.component),n.takeUntil(this.disconnecting),n.distinctUntilChanged((t,e)=>{let o,a;return typeof t.component!="function"&&(typeof t.component=="string"&&(o=t.component),typeof e.component!="function"&&(typeof e.component=="string"&&(a=e.component),(a==null?void 0:a.replaceAll("-","").toLowerCase())===(o==null?void 0:o.replaceAll("-","").toLowerCase())))})).pipe(n.switchMap(t=>{const e=t.component;return e instanceof Promise?n.from(e).pipe(n.map(o=>({component:o.exports.default,route:t}))):n.of({component:e,route:t})}),n.map(({component:t,route:e})=>typeof t=="string"?{component:document.createElement(t),route:e}:t instanceof HTMLElement?{component:t,route:e}:typeof t=="function"?{component:new t,route:e}:void 0),n.distinctUntilChanged((t,e)=>t.component.tagName===e.component.tagName),n.map(({component:t,route:e})=>{var i,r;const o=(i=this.shadowRoot)==null?void 0:i.children[0],a=!!o;return o.remove(),t.classList.add("opacity-0"),(r=this.shadowRoot)==null||r.append(t),t.animate([{opacity:0},{opacity:1}],{duration:a?150:100,easing:"cubic-bezier(0.25, 0.8, 0.25, 1)",fill:"forwards"}),{component:t,route:e}}),n.tap(({component:t,route:e})=>{e.historyStrategy===void 0||e.historyStrategy==="push"?history.pushState(e.state,"",this.newPath(t.tagName,e)):e.historyStrategy&&["replace","pop"].includes(e.historyStrategy)&&history.replaceState(e.state,"",this.newPath(t.tagName,e)),s.current.set(this.name,{component:t.tagName,state:e.state,area:this.name}),s.$current.next(s.current)}),n.takeUntil(this.disconnecting)).subscribe()}newPath(t,e){const o=location.pathname.split("/").pop();let a={};try{a=o?JSON.parse(decodeURIComponent(o)):{}}catch{a={}}e.state=e.state??{};const i=e.clearQueryParams?this.queryParamClear(e.clearQueryParams):document.location.search;return encodeURIComponent(JSON.stringify({...a,[this.name]:{component:t.toLowerCase(),state:e.state}})).concat(`${i}`)}queryParamClear(t){if(!t)return"";const e=new URLSearchParams(location.search);return t.forEach(o=>e.delete(o)),e.toString()===""?"":`?${e.toString()}`}checkForTeleportationRequests(){return n.fromEvent(window,"FLIP_REQUEST").pipe(n.map(t=>t.detail),n.bufferTime(0),n.tap(()=>{this.dispatchEvent(new CustomEvent("FLIP_STARTED"))}),n.takeUntil(this.disconnecting),n.timeout(0),n.catchError(()=>n.of(null)))}disconnectedCallback(){super.disconnectedCallback(),this.disconnecting.next(!0)}render(){return u.html` <slot> </slot> `}},l([h.property()],exports.SchmancyArea.prototype,"name",2),l([h.property()],exports.SchmancyArea.prototype,"default",2),exports.SchmancyArea=l([h.customElement("schmancy-area")],exports.SchmancyArea),exports.FINDING_MORTIES=d,exports.HERE_RICKY=y,exports.HISTORY_STRATEGY=c,exports.area=s,exports.routerHistory=S;
8
- //# sourceMappingURL=area.component-grRkXEse.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"area.component-grRkXEse.cjs","sources":["../src/area/area.service.ts","../src/area/router.types.ts","../src/area/area.component.ts"],"sourcesContent":["import { ReplaySubject, Subject, bufferTime, fromEvent, map, of, tap, timeout, zip } from 'rxjs'\nimport { SchmancyTeleportation } from '../teleport'\nimport { ActiveRoute, 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\nclass AreaService {\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\tpublic enableHistoryMode = true\n\tprivate findingMortiesEvent = new CustomEvent<FINDING_MORTIES_EVENT['detail']>(FINDING_MORTIES)\n\n\tconstructor() {\n\t\tthis.$current.next(this.current)\n\t}\n\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\ttap(console.log),\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)\n\t}\n\n\tpush(r: RouteAction) {\n\t\tthis.request.next(r)\n\t}\n\n\tpop(name: string) {\n\t\tconst newState = JSON.parse(JSON.stringify(area.state))\n\t\tdelete newState[name]\n\t\tconsole.log(area.state, newState)\n\t\thistory.replaceState(null, '', encodeURIComponent(JSON.stringify(newState)))\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\tget state() {\n\t\tconst pathname = location.pathname.split('/').pop()\n\t\tlet areaState = {}\n\t\ttry {\n\t\t\tareaState = pathname ? JSON.parse(decodeURIComponent(pathname)) : {}\n\t\t} catch {\n\t\t\tareaState = {}\n\t\t}\n\t\treturn areaState\n\t}\n}\n\nexport const area = AreaService.getInstance()\nexport default area\n","export type RouteAction = {\n\tcomponent: CustomElementConstructor | string | HTMLElement\n\tarea: string\n\tstate?: object\n\thistoryStrategy?: THistoryStrategy\n\tclearQueryParams?: string[] | null\n}\n\nexport type ActiveRoute = {\n\tcomponent: string\n\tarea: string\n\tstate?: object\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","import { $LitElement } from '@mixins/index'\nimport { TemplateResult, css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport {\n\tEMPTY,\n\tbufferTime,\n\tcatchError,\n\tdistinctUntilChanged,\n\tfilter,\n\tfrom,\n\tfromEvent,\n\tmap,\n\tmerge,\n\tof,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n\ttimeout,\n} from 'rxjs'\nimport { isPresent } from 'ts-is-present'\nimport area from './area.service'\nimport { HISTORY_STRATEGY, RouteAction } from './router.types'\n\ntype TRouteArea = {\n\tcomponent: string\n\tstate: object | undefined\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!: string | Promise<NodeModule> | CustomElementConstructor | TemplateResult<1>\n\n\t/**\n\t *\n\t * @param pathname pathname from the browser location API\n\t * @param historyStrategy the history strategy to use for the route like PUSH, REPLACE, or SILENT\n\t * @returns rxjs pipes that will return the component to render and the history strategy to use\n\t */\n\tgetComponentFromPathname(pathname: string, historyStrategy: HISTORY_STRATEGY) {\n\t\treturn of(pathname).pipe(\n\t\t\tmap(path => path.split('/').pop() ?? ''),\n\t\t\tmap(path => decodeURIComponent(path)),\n\t\t\tmap(path => JSON.parse(path)),\n\t\t\tmap(routes => routes[this.name] as TRouteArea),\n\t\t\tmap(component =>\n\t\t\t\t!component && this.default\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcomponent: this.default,\n\t\t\t\t\t\t\tstate: undefined,\n\t\t\t\t\t\t}\n\t\t\t\t\t: component,\n\t\t\t),\n\t\t\tfilter(x => isPresent(x)),\n\t\t\tmap((component: TRouteArea) => ({\n\t\t\t\tarea: this.name,\n\t\t\t\tcomponent: component.component ?? this.default,\n\t\t\t\tstate: component.state,\n\t\t\t\thistoryStrategy,\n\t\t\t})),\n\t\t\tmap(x => x as RouteAction),\n\t\t\tcatchError(() => {\n\t\t\t\treturn this.default\n\t\t\t\t\t? of({\n\t\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t\t\tcomponent: this.default,\n\t\t\t\t\t\t\thistoryStrategy,\n\t\t\t\t\t\t} as RouteAction)\n\t\t\t\t\t: EMPTY\n\t\t\t}),\n\t\t)\n\t}\n\n\tprotected firstUpdated(): void {\n\t\tif (!this.name) {\n\t\t\t// TOOD: maybe enforce this to be unique\n\t\t\tthrow new Error('Area name or default component not set')\n\t\t}\n\n\t\t// active outlet changes\n\t\tmerge(\n\t\t\t// 1) initial load from location.pathname\n\t\t\tof(location.pathname).pipe(\n\t\t\t\tswitchMap(pathname => this.getComponentFromPathname(pathname, HISTORY_STRATEGY.silent)),\n\t\t\t\tmap(route => route as RouteAction),\n\t\t\t\ttake(1),\n\t\t\t),\n\t\t\t// 2) requests to change the route for this area\n\t\t\tarea.request.pipe(filter(({ area }) => area === this.name)),\n\t\t\t// 3) popstate events (back, forward)\n\t\t\tfromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\tmap(e => (e.target as Window).location.pathname),\n\t\t\t\tswitchMap(pathname => this.getComponentFromPathname(pathname, HISTORY_STRATEGY.silent)),\n\t\t\t\tmap(route => route as RouteAction),\n\t\t\t),\n\t\t)\n\t\t\t.pipe(\n\t\t\t\tfilter(request => !!request.component),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t\tdistinctUntilChanged((a, b) => {\n\t\t\t\t\tlet aComponent, bComponent\n\t\t\t\t\tif (typeof a.component === 'function') return false\n\t\t\t\t\telse if (typeof a.component === 'string') aComponent = a.component\n\n\t\t\t\t\tif (typeof b.component === 'function') return false\n\t\t\t\t\telse if (typeof b.component === 'string') bComponent = b.component\n\n\t\t\t\t\treturn bComponent?.replaceAll('-', '').toLowerCase() === aComponent?.replaceAll('-', '').toLowerCase()\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.pipe(\n\t\t\t\tswitchMap(route => {\n\t\t\t\t\tconst c = route.component\n\t\t\t\t\tif (c instanceof Promise) {\n\t\t\t\t\t\t// Dynamic import module\n\t\t\t\t\t\treturn from(c).pipe(map(x => ({ component: x.exports.default as CustomElementConstructor, route })))\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Already a string, function, or element\n\t\t\t\t\t\treturn of({ component: c, route })\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tmap(({ component, route }) => {\n\t\t\t\t\tif (typeof component === 'string') {\n\t\t\t\t\t\t// Tag name\n\t\t\t\t\t\treturn { component: document.createElement(component), route }\n\t\t\t\t\t} else if (component instanceof HTMLElement) {\n\t\t\t\t\t\t// Already an element instance\n\t\t\t\t\t\treturn { component, route }\n\t\t\t\t\t} else if (typeof component === 'function') {\n\t\t\t\t\t\t// Custom element constructor\n\t\t\t\t\t\treturn { component: new component(), route }\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tdistinctUntilChanged((prev, curr) => prev.component.tagName === curr.component.tagName),\n\t\t\t\t// create the new view and add it to the DOM\n\t\t\t\tmap(({ component, route }) => {\n\t\t\t\t\tconst oldView = this.shadowRoot?.children[0]\n\t\t\t\t\tconst oldViewExists = !!oldView\n\n\t\t\t\t\t// Remove the old view (if any)\n\t\t\t\t\toldView.remove()\n\t\t\t\t\t// Native Web Animations API - fade in\n\t\t\t\t\t// \"ease: cubic-bezier(0.25, 0.8, 0.25, 1)\" was used in the old code\n\t\t\t\t\tcomponent.classList.add('opacity-0')\n\t\t\t\t\tthis.shadowRoot?.append(component)\n\t\t\t\t\tcomponent.animate([{ opacity: 0 }, { opacity: 1 }], {\n\t\t\t\t\t\tduration: oldViewExists ? 150 : 100,\n\t\t\t\t\t\teasing: 'cubic-bezier(0.25, 0.8, 0.25, 1)',\n\t\t\t\t\t\tfill: 'forwards',\n\t\t\t\t\t})\n\n\t\t\t\t\t// Insert the new view\n\n\t\t\t\t\treturn { component, route }\n\t\t\t\t}),\n\t\t\t\ttap(({ component, route }) => {\n\t\t\t\t\t// Handle history updates\n\t\t\t\t\tif (typeof route.historyStrategy === 'undefined' || route.historyStrategy === 'push') {\n\t\t\t\t\t\thistory.pushState(route.state, '', this.newPath(component.tagName, route))\n\t\t\t\t\t} else if (route.historyStrategy && ['replace', 'pop'].includes(route.historyStrategy)) {\n\t\t\t\t\t\thistory.replaceState(route.state, '', this.newPath(component.tagName, route))\n\t\t\t\t\t}\n\t\t\t\t\tarea.current.set(this.name, {\n\t\t\t\t\t\tcomponent: component.tagName,\n\t\t\t\t\t\tstate: route.state,\n\t\t\t\t\t\tarea: this.name,\n\t\t\t\t\t})\n\n\t\t\t\t\tarea.$current.next(area.current)\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\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 },\n\t\t\t}),\n\t\t).concat(`${queryParams}`)\n\t}\n\n\tqueryParamClear(params?: string[]) {\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\t\t// remove query params\n\t\tparams.forEach(param => urlParams.delete(param))\n\t\t// update url\n\t\tif (urlParams.toString() === '') return ''\n\t\treturn `?${urlParams.toString()}`\n\t}\n\n\tcheckForTeleportationRequests() {\n\t\treturn fromEvent<CustomEvent>(window, 'FLIP_REQUEST').pipe(\n\t\t\tmap(e => e.detail),\n\t\t\tbufferTime(0),\n\t\t\ttap(() => {\n\t\t\t\tthis.dispatchEvent(new CustomEvent('FLIP_STARTED'))\n\t\t\t}),\n\t\t\ttakeUntil(this.disconnecting),\n\t\t\ttimeout(0),\n\t\t\tcatchError(() => of(null)),\n\t\t)\n\t}\n\n\tdisconnectedCallback(): void {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\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","AreaService","constructor","this","prettyURL","mode","request","ReplaySubject","current","Map","$current","enableHistoryMode","findingMortiesEvent","CustomEvent","next","zip","fromEvent","window","pipe","map","e","detail","bufferTime","tap","console","log","of","dispatchEvent","component","timeout","r","name","newState","JSON","parse","stringify","area","state","history","replaceState","encodeURIComponent","getInstance","instance","pathname","location","split","pop","areaState","decodeURIComponent","HISTORY_STRATEGY","SchmancyArea","$LitElement","css","historyStrategy","path","routes","default","filter","x","isPresent","libExports","catchError","EMPTY","Error","merge","switchMap","getComponentFromPathname","silent","route","take","target","takeUntil","disconnecting","distinctUntilChanged","a","b","aComponent","bComponent","replaceAll","toLowerCase","c","Promise","from","exports","document","createElement","HTMLElement","prev","curr","tagName","oldView","shadowRoot","children","oldViewExists","remove","classList","add","append","animate","opacity","duration","easing","fill","pushState","newPath","includes","set","subscribe","tag","oldPathname","oldAreaState","queryParams","clearQueryParams","queryParamClear","search","concat","params","urlParams","URLSearchParams","forEach","param","delete","toString","super","disconnectedCallback","html","__decorateClass","property","prototype","customElement"],"mappings":"qSAIaA,EAAAA,EAAgB,IAAIC,EAAqBA,QAEzCC,EAAkB,kBAClBC,EAAa,aAQ1B,MAAMC,CAAAA,CAUL,aAAAC,CARAC,KAAOC,UAAAA,GACPD,KAAOE,KAA6B,UAC7BF,KAAAG,QAAU,IAAIC,EAAAA,cAA2B,CACzCJ,EAAAA,KAAAK,YAAcC,IACdN,KAAAO,SAAW,IAAIH,EAAAA,cAAwC,CAAA,EAC9DJ,KAAOQ,kBAAAA,GACCR,KAAAS,oBAAsB,IAAIC,YAA6Cd,CAGzEI,EAAAA,KAAAO,SAASI,KAAKX,KAAKK,OAAAA,CAAO,CAGhC,MACC,CAAA,OAAOO,MAAI,CACVC,YAA4BC,OAAQjB,GAAYkB,KAC/CC,EAAAA,IAASC,GAAAA,EAAEC,MAAAA,EACXC,EAAAA,WAAW,CACXC,EAAAA,EAAAA,IAAIC,QAAQC,GAEbC,CAAAA,EAAAA,KAAG,CAAA,EAAGR,KAAKK,EAAAA,IAAI,IAAMN,OAAOU,cAAcxB,KAAKS,mBAC7CM,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,KACFC,EAAAA,IAAI,CAAES,CAAAA,CAAAA,IAAeA,CACrBC,EAAAA,EAAAA,QAAQ,CAAA,CAAA,CACT,CAGD,KAAKC,EACC3B,CAAAA,KAAAG,QAAQQ,KAAKgB,CAAC,CAAA,CAGpB,IAAIC,EAAAA,CACH,MAAMC,EAAWC,KAAKC,MAAMD,KAAKE,UAAUC,EAAKC,KACzCL,CAAAA,EAAAA,OAAAA,EAASD,CAERO,EAAAA,QAAAC,aAAa,KAAM,GAAIC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