@mhmo91/schmancy 0.5.46 → 0.6.1
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/ai/content-drawer.md +22 -11
- package/ai/sheet.md +32 -47
- package/dist/ai/content-drawer.md +22 -11
- package/dist/ai/sheet.md +32 -47
- package/dist/area.component-DAPQYHtN.cjs.map +1 -1
- package/dist/area.component-DUGxsL2-.js.map +1 -1
- package/dist/{avatar-CcHlQTbR.js → avatar-Bp8OELqy.js} +29 -46
- package/dist/avatar-Bp8OELqy.js.map +1 -0
- package/dist/{avatar-D93Sjal-.cjs → avatar-gH9_xHZs.cjs} +9 -14
- package/dist/avatar-gH9_xHZs.cjs.map +1 -0
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{email-recipients-C-5ER5TU.js → email-recipients-DPpv0qRr.js} +4 -4
- package/dist/email-recipients-DPpv0qRr.js.map +1 -0
- package/dist/{email-recipients-DRxGI7gT.cjs → email-recipients-Uogc-X_3.cjs} +3 -3
- package/dist/email-recipients-Uogc-X_3.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/mailbox.cjs +1 -1
- package/dist/mailbox.js +1 -1
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/navigation-bar.cjs +1 -1
- package/dist/navigation-bar.js +1 -1
- package/dist/{sheet-vJ5lJw8A.cjs → sheet-CcVGEdfr.cjs} +10 -6
- package/dist/sheet-CcVGEdfr.cjs.map +1 -0
- package/dist/{sheet-PXddkPIR.js → sheet-D5-XmZs5.js} +36 -28
- package/dist/sheet-D5-XmZs5.js.map +1 -0
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +2 -2
- package/dist/sheet.service-C66WNur0.js +80 -0
- package/dist/sheet.service-C66WNur0.js.map +1 -0
- package/dist/sheet.service-iUShtJp1.cjs +2 -0
- package/dist/sheet.service-iUShtJp1.cjs.map +1 -0
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/readme.md +269 -56
- package/types/src/area/router.types.d.ts +5 -1
- package/types/src/content-drawer/drawer.service.d.ts +2 -6
- package/types/src/mailbox/email-editor.d.ts +1 -1
- package/types/src/navigation-bar/navigation-bar.d.ts +16 -2
- package/types/src/sheet/sheet.service.d.ts +2 -11
- package/dist/avatar-CcHlQTbR.js.map +0 -1
- package/dist/avatar-D93Sjal-.cjs.map +0 -1
- package/dist/email-recipients-C-5ER5TU.js.map +0 -1
- package/dist/email-recipients-DRxGI7gT.cjs.map +0 -1
- package/dist/sheet-PXddkPIR.js.map +0 -1
- package/dist/sheet-vJ5lJw8A.cjs.map +0 -1
- package/dist/sheet.service-BxvWBGsJ.cjs +0 -2
- package/dist/sheet.service-BxvWBGsJ.cjs.map +0 -1
- package/dist/sheet.service-lXqUf6n5.js +0 -87
- package/dist/sheet.service-lXqUf6n5.js.map +0 -1
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { Subject as l, switchMap as v, forkJoin as w, fromEvent as a, of as S, takeUntil as c, timer as d, map as r, defaultIfEmpty as m, tap as h, delay as u, take as y, mergeMap as g } from "rxjs";
|
|
2
|
-
import { a as A, T as E } from "./theme.events-CPSLaOlR.js";
|
|
3
|
-
var C = ((e) => (e.Side = "side", e.Bottom = "bottom", e))(C || {});
|
|
4
|
-
const b = "are-you-there-sheet", f = "yes-here", k = new class {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.bottomSheet = new l(), this.$dismiss = new l(), this.activeSheets = /* @__PURE__ */ new Set(), this.sheetComponents = /* @__PURE__ */ new Map(), this.popStateListenerActive = !1, this.setupSheetOpeningLogic(), this.setupSheetDismissLogic(), this.setupPopStateListener();
|
|
7
|
-
}
|
|
8
|
-
setupSheetOpeningLogic() {
|
|
9
|
-
this.bottomSheet.pipe(v((e) => w([a(window, f).pipe(c(d(50)), r((t) => t.detail), m(void 0)), a(window, A).pipe(c(d(50)), r((t) => t.detail.theme), m(void 0)), S(e).pipe(h(() => {
|
|
10
|
-
const t = e.uid ?? e.component.tagName;
|
|
11
|
-
window.dispatchEvent(new CustomEvent(b, { detail: { uid: t }, bubbles: !0, composed: !0 })), window.dispatchEvent(new CustomEvent(E, { bubbles: !0, composed: !0 }));
|
|
12
|
-
}))])), r(([e, t, s]) => {
|
|
13
|
-
let o, i = e?.sheet;
|
|
14
|
-
if (i) o = i.parentElement;
|
|
15
|
-
else {
|
|
16
|
-
o = t || document.querySelector("schmancy-theme") || document.body;
|
|
17
|
-
const p = s.uid ?? s.component.tagName;
|
|
18
|
-
i = document.createElement("schmancy-sheet"), i.setAttribute("uid", p), o.appendChild(i);
|
|
19
|
-
}
|
|
20
|
-
s.lock && i.setAttribute("lock", "true");
|
|
21
|
-
const n = s.position || (window.innerWidth >= 768 ? "side" : "bottom");
|
|
22
|
-
return i.setAttribute("position", n), s.title && i.setAttribute("title", s.title), s.persist && i.setAttribute("persist", String(s.persist)), s.header && i.setAttribute("header", s.header), s.handleHistory !== void 0 && i.setAttribute("handleHistory", String(s.handleHistory)), document.body.style.overflow = "hidden", { target: s, sheet: i };
|
|
23
|
-
}), u(20), h(({ target: e, sheet: t }) => {
|
|
24
|
-
e.onBeforeOpen && e.onBeforeOpen(e.component), (t?.shadowRoot?.querySelector("slot")?.assignedElements() || []).find((s) => s.tagName === e.component.tagName) || t?.appendChild(e.component);
|
|
25
|
-
}), u(1), h(({ target: e, sheet: t }) => {
|
|
26
|
-
t?.setAttribute("open", "true");
|
|
27
|
-
const s = e.uid ?? (e.component instanceof HTMLElement ? e.component.tagName : `sheet-${Date.now()}`);
|
|
28
|
-
if (this.activeSheets.add(s), this.sheetComponents.set(s, e.component), e.handleHistory !== !1) {
|
|
29
|
-
const o = { schmancySheet: !0, uid: s, timestamp: Date.now() };
|
|
30
|
-
history.pushState(o, "", window.location.href);
|
|
31
|
-
}
|
|
32
|
-
e.onAfterOpen && e.onAfterOpen(e.component), a(t, "close").pipe(y(1)).pipe(u(300)).subscribe((o) => {
|
|
33
|
-
const i = t;
|
|
34
|
-
if (i) {
|
|
35
|
-
const n = i.getAttribute("uid");
|
|
36
|
-
n && (this.activeSheets.delete(n), this.sheetComponents.delete(n));
|
|
37
|
-
const p = i.getAttribute("persist");
|
|
38
|
-
(!p || p === "false") && i.remove();
|
|
39
|
-
}
|
|
40
|
-
document.body.style.overflow = "auto";
|
|
41
|
-
});
|
|
42
|
-
})).subscribe();
|
|
43
|
-
}
|
|
44
|
-
setupSheetDismissLogic() {
|
|
45
|
-
this.$dismiss.pipe(g((e) => w([a(window, f).pipe(c(d(100)), r((t) => t.detail), m(void 0)), S(e).pipe(h(() => {
|
|
46
|
-
window.dispatchEvent(new CustomEvent(b, { detail: { uid: e } }));
|
|
47
|
-
}))])), h(([e, t]) => {
|
|
48
|
-
e?.sheet && (e.sheet.closeSheet(), this.activeSheets.delete(t));
|
|
49
|
-
})).subscribe();
|
|
50
|
-
}
|
|
51
|
-
setupPopStateListener() {
|
|
52
|
-
this.popStateListenerActive || (a(window, "popstate").subscribe((e) => {
|
|
53
|
-
if (this.activeSheets.size > 0) {
|
|
54
|
-
const t = Array.from(this.activeSheets).pop();
|
|
55
|
-
t && (this.dismiss(t), e.state && e.state.schmancySheet && history.pushState({}, "", window.location.href));
|
|
56
|
-
}
|
|
57
|
-
}), this.popStateListenerActive = !0);
|
|
58
|
-
}
|
|
59
|
-
dismiss(e) {
|
|
60
|
-
if (!e && this.activeSheets.size > 0) {
|
|
61
|
-
const t = Array.from(this.activeSheets);
|
|
62
|
-
e = t[t.length - 1];
|
|
63
|
-
}
|
|
64
|
-
e && this.$dismiss.next(e);
|
|
65
|
-
}
|
|
66
|
-
open(e) {
|
|
67
|
-
this.bottomSheet.next(e);
|
|
68
|
-
}
|
|
69
|
-
isOpen(e) {
|
|
70
|
-
return this.activeSheets.has(e);
|
|
71
|
-
}
|
|
72
|
-
closeAll() {
|
|
73
|
-
Array.from(this.activeSheets).forEach((e) => {
|
|
74
|
-
this.dismiss(e);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
getComponent(e) {
|
|
78
|
-
return this.sheetComponents.get(e);
|
|
79
|
-
}
|
|
80
|
-
}();
|
|
81
|
-
export {
|
|
82
|
-
C as S,
|
|
83
|
-
b as a,
|
|
84
|
-
f as b,
|
|
85
|
-
k as s
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=sheet.service-lXqUf6n5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sheet.service-lXqUf6n5.js","sources":["../src/sheet/sheet.service.ts"],"sourcesContent":["import {\n\tdefaultIfEmpty,\n\tdelay,\n\tforkJoin,\n\tfromEvent,\n\tmap,\n\tmergeMap,\n\tof,\n\tSubject,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n\ttimer,\n} from 'rxjs'\nimport { ThemeHereIAm, ThemeHereIAmEvent, ThemeWhereAreYou } from '../theme/theme.events'\nimport SchmancySheet from './sheet'\n\nexport enum SchmancySheetPosition {\n\tSide = 'side',\n\tBottom = 'bottom',\n}\n\nexport type SheetConfig = {\n\tcomponent: HTMLElement\n\tuid?: string\n\tposition?: SchmancySheetPosition\n\tpersist?: boolean\n\tclose?: () => void\n\tlock?: boolean // Controls both ESC and overlay click dismissal\n\thandleHistory?: boolean // Controls browser back button behavior\n\ttitle?: string\n\theader?: 'hidden' | 'visible'\n\tonBeforeOpen?: (component: HTMLElement) => void\n\tonAfterOpen?: (component: HTMLElement) => void\n}\n\n// Keep old name for backward compatibility\ntype BottomSheeetTarget = SheetConfig\n\n// Events for communication between bottom-sheet component and bottom-sheet.service\nexport type SheetWhereAreYouRickyEvent = CustomEvent<{\n\tuid: string\n}>\nexport const SheetWhereAreYouRicky = 'are-you-there-sheet'\n\nexport type SheetHereMortyEvent = CustomEvent<{\n\tsheet?: SchmancySheet\n\ttheme?: HTMLElement\n}>\nexport const SheetHereMorty = 'yes-here'\n\n// Function to determine the position based on screen size\nconst getPosition = (): SchmancySheetPosition => {\n\treturn window.innerWidth >= 768 ? SchmancySheetPosition.Side : SchmancySheetPosition.Bottom // Adjust 768 as needed for your breakpoint\n}\n\nclass BottomSheetService {\n\tbottomSheet = new Subject<BottomSheeetTarget>()\n\t$dismiss = new Subject<string>()\n\t// Track currently open sheets\n\tprivate activeSheets = new Set<string>()\n\t// Track sheet components for retrieval\n\tprivate sheetComponents = new Map<string, HTMLElement>()\n\t// To track if we've set up the popstate listener\n\tprivate popStateListenerActive = false\n\n\tconstructor() {\n\t\tthis.setupSheetOpeningLogic()\n\t\tthis.setupSheetDismissLogic()\n\t\tthis.setupPopStateListener()\n\t}\n\n\t/**\n\t * Sets up the main sheet opening logic\n\t */\n\tprivate setupSheetOpeningLogic() {\n\t\tthis.bottomSheet\n\t\t\t.pipe(\n\t\t\t\tswitchMap(target =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\t// First check for existing sheet\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(50)),\n\t\t\t\t\t\t\tmap(e => e.detail),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\t// Then find theme container\n\t\t\t\t\t\tfromEvent<ThemeHereIAmEvent>(window, ThemeHereIAm).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(50)),\n\t\t\t\t\t\t\tmap(e => e.detail.theme),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(target).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\t// Determine uid - use provided uid or component tagName\n\t\t\t\t\t\t\t\tconst uid = target.uid ?? target.component.tagName\n\n\t\t\t\t\t\t\t\t// First ask for existing sheet\n\t\t\t\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(SheetWhereAreYouRicky, {\n\t\t\t\t\t\t\t\t\t\tdetail: { uid },\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t// Then ask for theme container\n\t\t\t\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(ThemeWhereAreYou, {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\n\t\t\t\tmap(([existingSheet, theme, target]) => {\n\t\t\t\t\tlet sheet = existingSheet?.sheet\n\t\t\t\t\tlet targetContainer: HTMLElement\n\n\t\t\t\t\tif (sheet) {\n\t\t\t\t\t\t// Use existing sheet\n\t\t\t\t\t\ttargetContainer = sheet.parentElement as HTMLElement\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Determine container - use theme from discovery or fallback\n\t\t\t\t\t\ttargetContainer = theme || (document.querySelector('schmancy-theme') as HTMLElement) || document.body\n\n\t\t\t\t\t\t// Create new sheet\n\t\t\t\t\t\tconst uid = target.uid ?? target.component.tagName\n\t\t\t\t\t\tsheet = document.createElement('schmancy-sheet')\n\t\t\t\t\t\tsheet.setAttribute('uid', uid)\n\t\t\t\t\t\ttargetContainer.appendChild(sheet)\n\t\t\t\t\t}\n\n\t\t\t\t\ttarget.lock && sheet.setAttribute('lock', 'true')\n\n\t\t\t\t\t// Use the dynamic position function here\n\t\t\t\t\tconst position = target.position || getPosition()\n\t\t\t\t\tsheet.setAttribute('position', position)\n\n\t\t\t\t\ttarget.title && sheet.setAttribute('title', target.title)\n\t\t\t\t\ttarget.persist && sheet.setAttribute('persist', String(target.persist))\n\t\t\t\t\ttarget.header && sheet.setAttribute('header', target.header)\n\n\t\t\t\t\t// Handle history logic if the property exists\n\t\t\t\t\tif (target.handleHistory !== undefined) {\n\t\t\t\t\t\tsheet.setAttribute('handleHistory', String(target.handleHistory))\n\t\t\t\t\t}\n\n\t\t\t\t\tdocument.body.style.overflow = 'hidden' // lock the scroll of the host\n\t\t\t\t\treturn { target, sheet: sheet as SchmancySheet }\n\t\t\t\t}),\n\t\t\t\tdelay(20),\n\t\t\t\ttap(({ target, sheet }) => {\n\t\t\t\t\t// Call onBeforeOpen callback if provided\n\t\t\t\t\tif (target.onBeforeOpen) {\n\t\t\t\t\t\ttarget.onBeforeOpen(target.component)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Handle HTMLElement components\n\t\t\t\t\tconst assignedElements = sheet?.shadowRoot?.querySelector('slot')?.assignedElements() || []\n\n\t\t\t\t\tconst existingComponent = assignedElements.find(e => (e as HTMLElement).tagName === target.component.tagName)\n\n\t\t\t\t\tif (!existingComponent) {\n\t\t\t\t\t\t// Need to append the component\n\t\t\t\t\t\tsheet?.appendChild(target.component)\n\t\t\t\t\t} else {\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tdelay(1),\n\t\t\t\ttap(({ target, sheet }) => {\n\t\t\t\t\tsheet?.setAttribute('open', 'true')\n\n\t\t\t\t\t// Add to active sheets tracking\n\t\t\t\t\tconst uid =\n\t\t\t\t\t\ttarget.uid ?? (target.component instanceof HTMLElement ? target.component.tagName : `sheet-${Date.now()}`)\n\t\t\t\t\tthis.activeSheets.add(uid)\n\t\t\t\t\tthis.sheetComponents.set(uid, target.component)\n\n\t\t\t\t\t// Handle history integration - default to true if not specified\n\t\t\t\t\tconst shouldHandleHistory = target.handleHistory !== false\n\n\t\t\t\t\tif (shouldHandleHistory) {\n\t\t\t\t\t\t// Use history state to track this specific sheet\n\t\t\t\t\t\tconst historyState = {\n\t\t\t\t\t\t\tschmancySheet: true,\n\t\t\t\t\t\t\tuid: uid,\n\t\t\t\t\t\t\ttimestamp: Date.now(),\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Push a new history state\n\t\t\t\t\t\thistory.pushState(historyState, '', window.location.href)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call onAfterOpen callback if provided\n\t\t\t\t\tif (target.onAfterOpen) {\n\t\t\t\t\t\ttarget.onAfterOpen(target.component)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set up close event listener (always, not just for new sheets)\n\t\t\t\t\tfromEvent<CustomEvent>(sheet, 'close')\n\t\t\t\t\t\t.pipe(take(1))\n\t\t\t\t\t\t.pipe(delay(300))\n\t\t\t\t\t\t.subscribe(_ => {\n\t\t\t\t\t\t\t// Use the sheet reference directly, not e.target\n\t\t\t\t\t\t\tconst sheetElement = sheet as SchmancySheet\n\n\t\t\t\t\t\t\t// Remove from active sheets tracking\n\t\t\t\t\t\t\tif (sheetElement) {\n\t\t\t\t\t\t\t\tconst uid = sheetElement.getAttribute('uid')\n\t\t\t\t\t\t\t\tif (uid) {\n\t\t\t\t\t\t\t\t\tthis.activeSheets.delete(uid)\n\t\t\t\t\t\t\t\t\tthis.sheetComponents.delete(uid)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Only keep sheet if persist is explicitly set to a truthy value\n\t\t\t\t\t\t\t\tconst persistAttr = sheetElement.getAttribute('persist')\n\t\t\t\t\t\t\t\tconst shouldRemove = !persistAttr || persistAttr === 'false'\n\n\t\t\t\t\t\t\t\tif (shouldRemove) {\n\t\t\t\t\t\t\t\t\tsheetElement.remove()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tdocument.body.style.overflow = 'auto' // unlock the scroll of the host\n\t\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\t/**\n\t * Sets up the sheet closing/dismissal logic\n\t */\n\tprivate setupSheetDismissLogic() {\n\t\tthis.$dismiss\n\t\t\t.pipe(\n\t\t\t\tmergeMap(uid =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(100)),\n\t\t\t\t\t\t\tmap(e => e.detail),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(uid).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\twindow.dispatchEvent(new CustomEvent(SheetWhereAreYouRicky, { detail: { uid } }))\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\ttap(([response, uid]) => {\n\t\t\t\t\tif (response?.sheet) {\n\t\t\t\t\t\tresponse.sheet.closeSheet()\n\t\t\t\t\t\tthis.activeSheets.delete(uid)\n\t\t\t\t\t} else {\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\t/**\n\t * Sets up the popstate listener to handle browser back button\n\t */\n\tprivate setupPopStateListener() {\n\t\tif (this.popStateListenerActive) return\n\n\t\tfromEvent<PopStateEvent>(window, 'popstate').subscribe(event => {\n\t\t\t// If we have active sheets, close the most recently opened one\n\t\t\tif (this.activeSheets.size > 0) {\n\t\t\t\t// Get the last sheet (Set maintains insertion order)\n\t\t\t\tconst lastSheet = Array.from(this.activeSheets).pop()\n\t\t\t\tif (lastSheet) {\n\t\t\t\t\tthis.dismiss(lastSheet)\n\n\t\t\t\t\t// Prevent default navigation behavior by pushing a new state\n\t\t\t\t\t// This effectively cancels out the back navigation\n\t\t\t\t\tif (event.state && event.state.schmancySheet) {\n\t\t\t\t\t\thistory.pushState({}, '', window.location.href)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\tthis.popStateListenerActive = true\n\t}\n\n\t/**\n\t * Dismiss a sheet by uid, or dismiss the most recently opened sheet if no uid provided\n\t */\n\tdismiss(uid?: string) {\n\t\tif (!uid && this.activeSheets.size > 0) {\n\t\t\t// Get the last sheet opened (Set maintains insertion order)\n\t\t\tconst sheetsArray = Array.from(this.activeSheets)\n\t\t\tuid = sheetsArray[sheetsArray.length - 1]\n\t\t}\n\n\t\tif (uid) {\n\t\t\tthis.$dismiss.next(uid)\n\t\t}\n\t}\n\n\t/**\n\t * Open a sheet with the given target configuration\n\t */\n\topen(target: BottomSheeetTarget) {\n\t\tthis.bottomSheet.next(target)\n\t}\n\n\t/**\n\t * Check if a sheet is currently open by uid\n\t */\n\tisOpen(uid: string): boolean {\n\t\treturn this.activeSheets.has(uid)\n\t}\n\n\t/**\n\t * Close all open sheets\n\t */\n\tcloseAll() {\n\t\t// Copy the set to avoid modification during iteration\n\t\tArray.from(this.activeSheets).forEach(uid => {\n\t\t\tthis.dismiss(uid)\n\t\t})\n\t}\n\n\t/**\n\t * Gets the component instance for a given sheet\n\t * @param uid - The unique identifier of the sheet\n\t * @returns The component instance, or undefined if not found\n\t */\n\tgetComponent<T extends HTMLElement = HTMLElement>(uid: string): T | undefined {\n\t\treturn this.sheetComponents.get(uid) as T | undefined\n\t}\n}\nexport const sheet = new BottomSheetService()\n"],"names":["SchmancySheetPosition","SheetWhereAreYouRicky","SheetHereMorty","sheet","constructor","this","bottomSheet","Subject","$dismiss","activeSheets","Set","sheetComponents","Map","popStateListenerActive","setupSheetOpeningLogic","setupSheetDismissLogic","setupPopStateListener","pipe","switchMap","forkJoin","fromEvent","window","takeUntil","timer","map","e","detail","defaultIfEmpty","ThemeHereIAm","theme","of","target","tap","uid","component","tagName","dispatchEvent","CustomEvent","bubbles","composed","ThemeWhereAreYou","existingSheet","targetContainer","parentElement","document","querySelector","body","createElement","setAttribute","appendChild","lock","position","innerWidth","title","persist","String","header","handleHistory","style","overflow","delay","onBeforeOpen","shadowRoot","assignedElements","find","HTMLElement","Date","now","add","set","historyState","schmancySheet","timestamp","history","pushState","location","href","onAfterOpen","take","subscribe","_","sheetElement","getAttribute","delete","persistAttr","remove","mergeMap","response","closeSheet","event","size","lastSheet","Array","from","pop","dismiss","state","sheetsArray","length","next","has","closeAll","forEach","get"],"mappings":";;AAkBO,IAAKA,KAAAA,CAAAA,OACXA,EAAA,OAAO,QACPA,EAAA,SAAS,UAFEA,IAAAA,KAAA,CAAA,CAAA;AA0BL,MAAMC,IAAwB,uBAMxBC,IAAiB,YAiSjBC,IAAQ,IA1RrB,MAAA;AAAA,EAUC,cAAAC;AATAC,SAAAC,cAAc,IAAIC,KAClBF,KAAAG,WAAW,IAAID,KAEfF,KAAQI,mCAAmBC,OAE3BL,KAAQM,sCAAsBC,OAE9BP,KAAQQ,yBAAAA,IAGPR,KAAKS,uBAAAA,GACLT,KAAKU,uBAAAA,GACLV,KAAKW,sBAAAA;AAAAA,EACN;AAAA,EAKQ,yBAAAF;AACPT,SAAKC,YACHW,KACAC,SACCC,EAAS,CAERC,EAA+BC,QAAQnB,CAAAA,EAAgBe,KACtDK,EAAUC,EAAM,EAAA,CAAA,GAChBC,EAAIC,OAAKA,EAAEC,MAAAA,GACXC,EAAAA,MAAe,CAAA,GAGhBP,EAA6BC,QAAQO,CAAAA,EAAcX,KAClDK,EAAUC,EAAM,EAAA,CAAA,GAChBC,EAAIC,OAAKA,EAAEC,OAAOG,KAAAA,GAClBF,EAAAA,MAAe,CAAA,GAEhBG,EAAGC,CAAAA,EAAQd,KACVe,EAAI,MAAA;AAEH,YAAMC,IAAMF,EAAOE,OAAOF,EAAOG,UAAUC;AAG3Cd,aAAOe,cACN,IAAIC,YAAYpC,GAAuB,EACtCyB,QAAQ,EAAEO,KAAAA,EAAAA,GACVK,SAAAA,IACAC,UAAAA,GAAU,CAAA,CAAA,GAIZlB,OAAOe,cACN,IAAIC,YAAYG,GAAkB,EACjCF,SAAAA,IACAC,UAAAA,GAAU,CAAA,CAAA;AAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAQhBf,EAAI,CAAA,CAA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