@mhmo91/schmancy 0.4.45 → 0.4.47
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/{avatar-DAPIovPH.js → avatar-BL7WB4iO.js} +6 -6
- package/dist/{avatar-DAPIovPH.js.map → avatar-BL7WB4iO.js.map} +1 -1
- package/dist/{avatar-DDjdOEu0.cjs → avatar-BiT2LzbV.cjs} +2 -2
- package/dist/{avatar-DDjdOEu0.cjs.map → avatar-BiT2LzbV.cjs.map} +1 -1
- 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/{date-range-IyDqhNLw.cjs → date-range-Cf9ldt-N.cjs} +2 -2
- package/dist/{date-range-IyDqhNLw.cjs.map → date-range-Cf9ldt-N.cjs.map} +1 -1
- package/dist/{date-range-BJNoGX45.js → date-range-DPZXGoEA.js} +2 -2
- package/dist/{date-range-BJNoGX45.js.map → date-range-DPZXGoEA.js.map} +1 -1
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/{dialog-content-CmOEqKOr.js → dialog-content-CT6Y3ZLb.js} +2 -2
- package/dist/{dialog-content-CmOEqKOr.js.map → dialog-content-CT6Y3ZLb.js.map} +1 -1
- package/dist/{dialog-content-Biz4uVPD.cjs → dialog-content-tiwbeegi.cjs} +2 -2
- package/dist/{dialog-content-Biz4uVPD.cjs.map → dialog-content-tiwbeegi.cjs.map} +1 -1
- package/dist/dialog-service-DUDhcx9X.cjs +2 -0
- package/dist/dialog-service-DUDhcx9X.cjs.map +1 -0
- package/dist/{dialog-service-AdqbEHnW.js → dialog-service-Dm7HJGjx.js} +7 -5
- package/dist/dialog-service-Dm7HJGjx.js.map +1 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +176 -176
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/sheet-Cw2qLdzN.js +228 -0
- package/dist/sheet-Cw2qLdzN.js.map +1 -0
- package/dist/sheet-eCDoMdHF.cjs +52 -0
- package/dist/sheet-eCDoMdHF.cjs.map +1 -0
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +5 -6
- package/dist/sheet.js.map +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/theme.component-ColRTbY5.js +738 -0
- package/dist/theme.component-ColRTbY5.js.map +1 -0
- package/dist/theme.component-RtV3l-Ns.cjs +3 -0
- package/dist/theme.component-RtV3l-Ns.cjs.map +1 -0
- package/dist/theme.js +1 -1
- package/package.json +1 -1
- package/types/src/sheet/sheet.d.ts +0 -1
- package/types/src/sheet/sheet.service.d.ts +32 -118
- package/dist/dialog-service-AdqbEHnW.js.map +0 -1
- package/dist/dialog-service-B4gxdlr-.cjs +0 -2
- package/dist/dialog-service-B4gxdlr-.cjs.map +0 -1
- package/dist/sheet-BXNBQt5O.js +0 -149
- package/dist/sheet-BXNBQt5O.js.map +0 -1
- package/dist/sheet-QLZcRUG6.cjs +0 -54
- package/dist/sheet-QLZcRUG6.cjs.map +0 -1
- package/dist/theme.component-B3Z6xZ33.cjs +0 -3
- package/dist/theme.component-B3Z6xZ33.cjs.map +0 -1
- package/dist/theme.component-DbZODTAR.js +0 -844
- package/dist/theme.component-DbZODTAR.js.map +0 -1
|
@@ -1,159 +1,73 @@
|
|
|
1
|
+
import { Subject } from 'rxjs';
|
|
1
2
|
import SchmancySheet from './sheet';
|
|
2
3
|
export declare enum SchmancySheetPosition {
|
|
3
4
|
Side = "side",
|
|
4
5
|
Bottom = "bottom"
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
export interface SheetConfig<T extends HTMLElement = HTMLElement> {
|
|
10
|
-
/** The component to display in the sheet. Can be an instance or a factory function */
|
|
11
|
-
component: T | (() => T);
|
|
12
|
-
/** Unique identifier for the sheet. Defaults to component's tagName */
|
|
7
|
+
export type SheetConfig = {
|
|
8
|
+
component: HTMLElement;
|
|
13
9
|
uid?: string;
|
|
14
|
-
/** Position of the sheet. Defaults to responsive (side on desktop, bottom on mobile) */
|
|
15
10
|
position?: SchmancySheetPosition;
|
|
16
|
-
/** Whether to keep the sheet in DOM after closing. Defaults to false */
|
|
17
11
|
persist?: boolean;
|
|
18
|
-
/** @deprecated Use onBeforeOpen to add close handlers */
|
|
19
12
|
close?: () => void;
|
|
20
|
-
/** Prevents dismissal via ESC or overlay click. Defaults to false */
|
|
21
13
|
lock?: boolean;
|
|
22
|
-
/** Whether to integrate with browser history. Defaults to true */
|
|
23
14
|
handleHistory?: boolean;
|
|
24
|
-
/** Title displayed in the sheet header */
|
|
25
15
|
title?: string;
|
|
26
|
-
/** Header visibility. Defaults to 'visible' */
|
|
27
16
|
header?: 'hidden' | 'visible';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
interface SheetDiscoveryDetail {
|
|
17
|
+
onBeforeOpen?: (component: HTMLElement) => void;
|
|
18
|
+
onAfterOpen?: (component: HTMLElement) => void;
|
|
19
|
+
};
|
|
20
|
+
type BottomSheeetTarget = SheetConfig;
|
|
21
|
+
export type SheetWhereAreYouRickyEvent = CustomEvent<{
|
|
34
22
|
uid: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
23
|
+
}>;
|
|
24
|
+
export declare const SheetWhereAreYouRicky = "are-you-there-sheet";
|
|
25
|
+
export type SheetHereMortyEvent = CustomEvent<{
|
|
37
26
|
sheet?: SchmancySheet;
|
|
38
27
|
theme?: HTMLElement;
|
|
39
|
-
}
|
|
40
|
-
export type SheetWhereAreYouRickyEvent = CustomEvent<SheetDiscoveryDetail>;
|
|
41
|
-
export declare const SheetWhereAreYouRicky = "are-you-there-sheet";
|
|
42
|
-
export type SheetHereMortyEvent = CustomEvent<SheetResponseDetail>;
|
|
28
|
+
}>;
|
|
43
29
|
export declare const SheetHereMorty = "yes-here";
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* ```typescript
|
|
50
|
-
* // Simple usage
|
|
51
|
-
* sheet.open({
|
|
52
|
-
* component: document.createElement('my-form'),
|
|
53
|
-
* title: 'My Form'
|
|
54
|
-
* });
|
|
55
|
-
*
|
|
56
|
-
* // With callbacks
|
|
57
|
-
* sheet.open({
|
|
58
|
-
* component: () => {
|
|
59
|
-
* const form = document.createElement('employee-form');
|
|
60
|
-
* form.addEventListener('save', () => sheet.dismiss('employee-form'));
|
|
61
|
-
* return form;
|
|
62
|
-
* },
|
|
63
|
-
* uid: 'employee-form',
|
|
64
|
-
* onBeforeOpen: (form) => {
|
|
65
|
-
* form.data = employeeData;
|
|
66
|
-
* }
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
declare class SheetService {
|
|
71
|
-
private readonly openSheet$;
|
|
72
|
-
private readonly dismissSheet$;
|
|
73
|
-
private readonly activeSheets;
|
|
74
|
-
private readonly sheetComponents;
|
|
75
|
-
private readonly sheetElements;
|
|
30
|
+
declare class BottomSheetService {
|
|
31
|
+
bottomSheet: Subject<SheetConfig>;
|
|
32
|
+
$dismiss: Subject<string>;
|
|
33
|
+
private activeSheets;
|
|
34
|
+
private sheetComponents;
|
|
76
35
|
private popStateListenerActive;
|
|
77
36
|
constructor();
|
|
78
37
|
/**
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
|
-
private initializeEventStreams;
|
|
82
|
-
/**
|
|
83
|
-
* Creates or retrieves a component instance from the configuration
|
|
38
|
+
* Sets up the main sheet opening logic
|
|
84
39
|
*/
|
|
85
|
-
private
|
|
40
|
+
private setupSheetOpeningLogic;
|
|
86
41
|
/**
|
|
87
|
-
*
|
|
42
|
+
* Sets up the sheet closing/dismissal logic
|
|
88
43
|
*/
|
|
89
|
-
private
|
|
44
|
+
private setupSheetDismissLogic;
|
|
90
45
|
/**
|
|
91
|
-
*
|
|
46
|
+
* Sets up the popstate listener to handle browser back button
|
|
92
47
|
*/
|
|
93
|
-
private
|
|
48
|
+
private setupPopStateListener;
|
|
94
49
|
/**
|
|
95
|
-
*
|
|
96
|
-
*/
|
|
97
|
-
private configureSheet;
|
|
98
|
-
/**
|
|
99
|
-
* Handles the sheet opening logic
|
|
100
|
-
*/
|
|
101
|
-
private setupOpenStream;
|
|
102
|
-
/**
|
|
103
|
-
* Sets up the close event listener for a sheet
|
|
104
|
-
*/
|
|
105
|
-
private setupCloseListener;
|
|
106
|
-
/**
|
|
107
|
-
* Sets up the sheet dismissal logic
|
|
108
|
-
*/
|
|
109
|
-
private setupDismissStream;
|
|
110
|
-
/**
|
|
111
|
-
* Sets up browser history integration for back button support
|
|
112
|
-
*/
|
|
113
|
-
private setupHistoryManagement;
|
|
114
|
-
/**
|
|
115
|
-
* Opens a sheet with the specified configuration
|
|
116
|
-
* @param config - Configuration options for the sheet
|
|
117
|
-
* @example
|
|
118
|
-
* ```typescript
|
|
119
|
-
* sheet.open({
|
|
120
|
-
* component: document.createElement('my-form'),
|
|
121
|
-
* uid: 'my-form-sheet',
|
|
122
|
-
* title: 'Edit Form',
|
|
123
|
-
* onBeforeOpen: (component) => {
|
|
124
|
-
* component.data = formData;
|
|
125
|
-
* }
|
|
126
|
-
* });
|
|
127
|
-
* ```
|
|
128
|
-
*/
|
|
129
|
-
open<T extends HTMLElement = HTMLElement>(config: SheetConfig<T>): void;
|
|
130
|
-
/**
|
|
131
|
-
* Dismisses a sheet by its unique identifier
|
|
132
|
-
* @param uid - The unique identifier of the sheet to dismiss. If not provided, dismisses the most recent sheet.
|
|
50
|
+
* Dismiss a sheet by uid, or dismiss the most recently opened sheet if no uid provided
|
|
133
51
|
*/
|
|
134
52
|
dismiss(uid?: string): void;
|
|
135
53
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @param uid - The unique identifier of the sheet
|
|
138
|
-
* @returns The component instance, or undefined if not found
|
|
54
|
+
* Open a sheet with the given target configuration
|
|
139
55
|
*/
|
|
140
|
-
|
|
56
|
+
open(target: BottomSheeetTarget): void;
|
|
141
57
|
/**
|
|
142
|
-
*
|
|
143
|
-
* @param uid - The unique identifier of the sheet
|
|
144
|
-
* @returns True if the sheet is open, false otherwise
|
|
58
|
+
* Check if a sheet is currently open by uid
|
|
145
59
|
*/
|
|
146
60
|
isOpen(uid: string): boolean;
|
|
147
61
|
/**
|
|
148
|
-
*
|
|
62
|
+
* Close all open sheets
|
|
149
63
|
*/
|
|
150
64
|
closeAll(): void;
|
|
151
65
|
/**
|
|
152
|
-
* Gets the
|
|
66
|
+
* Gets the component instance for a given sheet
|
|
153
67
|
* @param uid - The unique identifier of the sheet
|
|
154
|
-
* @returns The
|
|
68
|
+
* @returns The component instance, or undefined if not found
|
|
155
69
|
*/
|
|
156
|
-
|
|
70
|
+
getComponent<T extends HTMLElement = HTMLElement>(uid: string): T | undefined;
|
|
157
71
|
}
|
|
158
|
-
export declare const sheet:
|
|
72
|
+
export declare const sheet: BottomSheetService;
|
|
159
73
|
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-service-AdqbEHnW.js","sources":["../src/dialog/dialog-service.ts"],"sourcesContent":["import { render, TemplateResult } from 'lit'\nimport { defaultIfEmpty, forkJoin, fromEvent, map, of, Subject, switchMap, takeUntil, tap, timer, take } from 'rxjs'\nimport { ConfirmDialog } from './dailog'\nimport { DialogHereMorty, DialogHereMortyEvent, DialogWhereAreYouRicky } from './dialog-events'\nimport { ThemeWhereAreYou, ThemeHereIAm, ThemeHereIAmEvent } from '../theme/theme.component'\n\n/**\n * Dialog service options interface with component support\n */\nexport interface DialogOptions {\n\ttitle?: string\n\tsubtitle?: string\n\tmessage?: string\n\tconfirmText?: string\n\tcancelText?: string\n\tvariant?: 'default' | 'danger'\n\tconfirmColor?: 'primary' | 'error' | 'warning' | 'success' // Button color for confirm action\n\tposition?: { x: number; y: number } | MouseEvent | TouchEvent\n\n\t// New options for component rendering\n\tcontent?: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult)\n\twidth?: string\n\tonConfirm?: () => void\n\tonCancel?: () => void\n\thideActions?: boolean // Set to true to hide all buttons and title\n\ttargetContainer?: HTMLElement // Container to append dialog to (defaults to document.body)\n}\n\ninterface DialogTarget {\n\toptions: DialogOptions\n\ttype: 'confirm' | 'component'\n\tcontent?: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult)\n\tresolve?: (value: boolean) => void\n\treject?: (reason?: any) => void\n}\n\n/**\n * Dialog service for centralized dialog management.\n * Provides a simple API for showing dialogs with optional custom components.\n */\nexport class DialogService {\n\tprivate static instance: DialogService\n\n\t// Default dialog options\n\tprivate static DEFAULT_OPTIONS: Partial<DialogOptions> = {\n\t\ttitle: undefined,\n\t\tsubtitle: undefined,\n\t\tconfirmText: undefined,\n\t\tcancelText: undefined,\n\t\tvariant: 'default',\n\t\twidth: '360px',\n\t}\n\n\t// Track active dialogs to handle dismissing the most recent one\n\tprivate activeDialogs: ConfirmDialog[] = []\n\t\n\t// Track component dialogs (schmancy-dialog instances)\n\tprivate activeRawDialogs: any[] = []\n\t\n\t// Subject for dialog opening requests\n\tprivate dialogSubject = new Subject<DialogTarget>()\n\t\n\t// Subject for dialog dismissal requests\n\tprivate dismissSubject = new Subject<string>()\n\n\t// Private constructor for singleton pattern\n\tprivate constructor() {\n\t\tthis.setupDialogOpeningLogic()\n\t\tthis.setupDialogDismissLogic()\n\t}\n\n\t/**\n\t * Get the singleton instance\n\t */\n\tpublic static getInstance(): DialogService {\n\t\tif (!DialogService.instance) {\n\t\t\tDialogService.instance = new DialogService()\n\t\t}\n\t\treturn DialogService.instance\n\t}\n\t\n\t/**\n\t * Sets up the main dialog opening logic using RxJS pipes\n\t */\n\tprivate setupDialogOpeningLogic() {\n\t\tthis.dialogSubject\n\t\t\t.pipe(\n\t\t\t\tswitchMap(target =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<DialogHereMortyEvent>(window, DialogHereMorty).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(target).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\tconst uid = target.type === 'confirm' \n\t\t\t\t\t\t\t\t\t? `confirm-dialog-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`\n\t\t\t\t\t\t\t\t\t: `dialog-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(DialogWhereAreYouRicky, {\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\n\t\t\t\t\t\t\t\t// Store uid in target for later use\n\t\t\t\t\t\t\t\t;(target as any).uid = 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\tswitchMap(([response, target]) => {\n\t\t\t\t\tlet dialog: ConfirmDialog | any\n\t\t\t\t\tlet targetContainer: HTMLElement\n\t\t\t\t\t\n\t\t\t\t\tif (response?.dialog) {\n\t\t\t\t\t\t// Use existing dialog\n\t\t\t\t\t\tdialog = response.dialog\n\t\t\t\t\t\ttargetContainer = dialog.parentElement as HTMLElement\n\t\t\t\t\t\treturn of({ dialog, target, targetContainer })\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Determine container - use responding theme or fallback\n\t\t\t\t\t\tif (response?.theme) {\n\t\t\t\t\t\t\ttargetContainer = response.theme as HTMLElement\n\t\t\t\t\t\t\treturn of({ dialog: null, target, targetContainer })\n\t\t\t\t\t\t} else if (target.options.targetContainer) {\n\t\t\t\t\t\t\ttargetContainer = target.options.targetContainer\n\t\t\t\t\t\t\treturn of({ dialog: null, target, targetContainer })\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Use the same theme discovery pattern as sheet service\n\t\t\t\t\t\t\twindow.dispatchEvent(new CustomEvent(ThemeWhereAreYou))\n\t\t\t\t\t\t\treturn fromEvent<ThemeHereIAmEvent>(window, ThemeHereIAm).pipe(\n\t\t\t\t\t\t\t\ttakeUntil(timer(100)),\n\t\t\t\t\t\t\t\tmap(e => e.detail.theme),\n\t\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t\t\ttake(1),\n\t\t\t\t\t\t\t\tmap(theme => ({\n\t\t\t\t\t\t\t\t\tdialog: null,\n\t\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\t\ttargetContainer: theme || document.body\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\t\t\t\ttap(({ dialog, target, targetContainer }) => {\n\t\t\t\t\tif (!dialog) {\n\t\t\t\t\t\t// Create appropriate dialog type\n\t\t\t\t\t\tif (target.type === 'confirm') {\n\t\t\t\t\t\t\tdialog = document.createElement('confirm-dialog') as ConfirmDialog\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdialog = document.createElement('schmancy-dialog')\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tdialog.setAttribute('uid', (target as any).uid)\n\t\t\t\t\t\ttargetContainer.appendChild(dialog)\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tmap(({ dialog, target, targetContainer }) => {\n\t\t\t\t\t// Return the actual dialog element that was created\n\t\t\t\t\tif (!dialog) {\n\t\t\t\t\t\tdialog = targetContainer.querySelector(`[uid=\"${(target as any).uid}\"]`)\n\t\t\t\t\t}\n\t\t\t\t\treturn { dialog, target, targetContainer }\n\t\t\t\t}),\n\t\t\t\ttap(({ dialog, target }) => {\n\t\t\t\t\tif (target.type === 'confirm') {\n\t\t\t\t\t\t// Configure confirm dialog\n\t\t\t\t\t\tconst confirmDialog = dialog as ConfirmDialog\n\t\t\t\t\t\tconst options = target.options\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (options.title) confirmDialog.title = options.title\n\t\t\t\t\t\tif (options.subtitle) confirmDialog.subtitle = options.subtitle\n\t\t\t\t\t\tif (options.message) confirmDialog.message = options.message\n\t\t\t\t\t\tif (options.confirmText) confirmDialog.confirmText = options.confirmText\n\t\t\t\t\t\tif (options.cancelText) confirmDialog.cancelText = options.cancelText\n\t\t\t\t\t\tif (options.variant) confirmDialog.variant = options.variant\n\t\t\t\t\t\tif (options.confirmColor) confirmDialog.confirmColor = options.confirmColor\n\t\t\t\t\t\tif (options.width) confirmDialog.style.setProperty('--dialog-width', options.width)\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Handle custom content if provided\n\t\t\t\t\t\tif (options.content) {\n\t\t\t\t\t\t\tconst contentContainer = document.createElement('div')\n\t\t\t\t\t\t\tcontentContainer.slot = 'content'\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (typeof options.content === 'function') {\n\t\t\t\t\t\t\t\tconst result = options.content()\n\t\t\t\t\t\t\t\tif (result instanceof HTMLElement) {\n\t\t\t\t\t\t\t\t\tcontentContainer.appendChild(result)\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\trender(result, contentContainer)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (options.content instanceof HTMLElement) {\n\t\t\t\t\t\t\t\tcontentContainer.appendChild(options.content)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trender(options.content, contentContainer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tconfirmDialog.appendChild(contentContainer)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Add to active dialogs\n\t\t\t\t\t\tthis.activeDialogs.push(confirmDialog)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Configure component dialog\n\t\t\t\t\t\tif (target.content) {\n\t\t\t\t\t\t\tconst directContentContainer = document.createElement('div')\n\t\t\t\t\t\t\tdirectContentContainer.style.height = '100%'\n\t\t\t\t\t\t\tdirectContentContainer.style.width = '100%'\n\t\t\t\t\t\t\tdirectContentContainer.classList.add('schmancy-dialog-content-container')\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Render the content directly\n\t\t\t\t\t\t\tif (typeof target.content === 'function') {\n\t\t\t\t\t\t\t\tconst result = target.content()\n\t\t\t\t\t\t\t\tif (result instanceof HTMLElement) {\n\t\t\t\t\t\t\t\t\tdirectContentContainer.appendChild(result)\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\trender(result, directContentContainer)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (target.content instanceof HTMLElement) {\n\t\t\t\t\t\t\t\tdirectContentContainer.appendChild(target.content)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trender(target.content, directContentContainer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tdialog.appendChild(directContentContainer)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Set width from options\n\t\t\t\t\t\tif (target.options.width) {\n\t\t\t\t\t\t\tdialog.style.setProperty('--dialog-width', target.options.width)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Add to active raw dialogs\n\t\t\t\t\t\tthis.activeRawDialogs.push(dialog)\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\ttap(({ dialog, target }) => {\n\t\t\t\t\t// Show dialog and handle promise resolution\n\t\t\t\t\tconst position = target.options.position || this.getCenteredPosition()\n\t\t\t\t\t\n\t\t\t\t\tdialog.show(position).then((result: boolean) => {\n\t\t\t\t\t\tif (target.resolve) {\n\t\t\t\t\t\t\ttarget.resolve(result)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Cleanup\n\t\t\t\t\t\tif (target.type === 'confirm') {\n\t\t\t\t\t\t\tconst index = this.activeDialogs.indexOf(dialog)\n\t\t\t\t\t\t\tif (index !== -1) {\n\t\t\t\t\t\t\t\tthis.activeDialogs.splice(index, 1)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Clean up content\n\t\t\t\t\t\t\tconst contentEl = dialog.querySelector('[slot=\"content\"]')\n\t\t\t\t\t\t\tif (contentEl) {\n\t\t\t\t\t\t\t\tdialog.removeChild(contentEl)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst index = this.activeRawDialogs.indexOf(dialog)\n\t\t\t\t\t\t\tif (index !== -1) {\n\t\t\t\t\t\t\t\tthis.activeRawDialogs.splice(index, 1)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Clean up content\n\t\t\t\t\t\t\tconst contentContainer = dialog.querySelector('.schmancy-dialog-content-container')\n\t\t\t\t\t\t\tif (contentContainer && contentContainer.parentNode) {\n\t\t\t\t\t\t\t\tcontentContainer.parentNode.removeChild(contentContainer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Remove dialog from DOM\n\t\t\t\t\t\tif (dialog.parentElement) {\n\t\t\t\t\t\t\tdialog.parentElement.removeChild(dialog)\n\t\t\t\t\t\t}\n\t\t\t\t\t}).catch((error: any) => {\n\t\t\t\t\t\tif (target.reject) {\n\t\t\t\t\t\t\ttarget.reject(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t\n\t\t\t\t\t// Set up event listeners for callbacks\n\t\t\t\t\tif (target.options.onConfirm) {\n\t\t\t\t\t\tconst onConfirm = (_e: Event) => {\n\t\t\t\t\t\t\ttarget.options.onConfirm!()\n\t\t\t\t\t\t\tdialog.removeEventListener('confirm', onConfirm)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdialog.addEventListener('confirm', onConfirm)\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (target.options.onCancel) {\n\t\t\t\t\t\tconst onCancel = (_e: Event) => {\n\t\t\t\t\t\t\ttarget.options.onCancel!()\n\t\t\t\t\t\t\tdialog.removeEventListener('cancel', onCancel)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdialog.addEventListener('cancel', onCancel)\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\t\n\t/**\n\t * Sets up the dialog dismissal logic\n\t */\n\tprivate setupDialogDismissLogic() {\n\t\tthis.dismissSubject\n\t\t\t.pipe(\n\t\t\t\tswitchMap(uid =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<DialogHereMortyEvent>(window, DialogHereMorty).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(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(DialogWhereAreYouRicky, { \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}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\ttap(([response]) => {\n\t\t\t\t\tif (response?.dialog) {\n\t\t\t\t\t\t// Hide the dialog\n\t\t\t\t\t\tresponse.dialog.hide(false)\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Remove from tracking arrays\n\t\t\t\t\t\tconst confirmIndex = this.activeDialogs.indexOf(response.dialog)\n\t\t\t\t\t\tif (confirmIndex !== -1) {\n\t\t\t\t\t\t\tthis.activeDialogs.splice(confirmIndex, 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tconst rawIndex = this.activeRawDialogs.indexOf(response.dialog)\n\t\t\t\t\t\tif (rawIndex !== -1) {\n\t\t\t\t\t\t\tthis.activeRawDialogs.splice(rawIndex, 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Remove dialog from DOM immediately\n\t\t\t\t\t\tif (response.dialog.parentElement) {\n\t\t\t\t\t\t\tresponse.dialog.parentElement.removeChild(response.dialog)\n\t\t\t\t\t\t}\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 * Show a confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic confirm(options: DialogOptions): Promise<boolean> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\t// Apply default options\n\t\t\tconst completeOptions = {\n\t\t\t\t...DialogService.DEFAULT_OPTIONS,\n\t\t\t\t...options,\n\t\t\t}\n\n\t\t\t// If no position is provided, center the dialog\n\t\t\tif (!completeOptions.position) {\n\t\t\t\tcompleteOptions.position = this.getCenteredPosition()\n\t\t\t}\n\n\t\t\t// Create dialog target and emit to subject\n\t\t\tconst target: DialogTarget = {\n\t\t\t\toptions: completeOptions,\n\t\t\t\ttype: 'confirm',\n\t\t\t\tcontent: completeOptions.content,\n\t\t\t\tresolve,\n\t\t\t\treject,\n\t\t\t}\n\n\t\t\tthis.dialogSubject.next(target)\n\t\t})\n\t}\n\n\t/**\n\t * Show a dialog with custom component content\n\t * Always renders content directly without any headers or action buttons\n\t * @returns Promise that resolves when dialog is closed\n\t */\n\tpublic component(\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions: Omit<DialogOptions, 'content' | 'message'> = {},\n\t): Promise<boolean> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\t// If no position is provided, center the dialog\n\t\t\tif (!options.position) {\n\t\t\t\toptions.position = this.getCenteredPosition()\n\t\t\t}\n\n\t\t\t// Create dialog target and emit to subject\n\t\t\tconst target: DialogTarget = {\n\t\t\t\toptions: options as DialogOptions,\n\t\t\t\ttype: 'component',\n\t\t\t\tcontent,\n\t\t\t\tresolve,\n\t\t\t\treject,\n\t\t\t}\n\n\t\t\tthis.dialogSubject.next(target)\n\t\t})\n\t}\n\n\t/**\n\t * Dismiss the most recently opened dialog (either confirm or component type)\n\t * @returns true if a dialog was dismissed, false if no dialogs were open\n\t */\n\tpublic dismiss(): boolean {\n\t\t// Try component dialog first (they're more likely to be on top)\n\t\tif (this.activeRawDialogs.length > 0) {\n\t\t\t// Get the most recently opened raw dialog (last in the array)\n\t\t\tconst dialog = this.activeRawDialogs[this.activeRawDialogs.length - 1]\n\t\t\tconst uid = dialog.getAttribute('uid')\n\t\t\t\n\t\t\tif (uid) {\n\t\t\t\tthis.dismissSubject.next(uid)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Fall back to confirm dialogs\n\t\tif (this.activeDialogs.length > 0) {\n\t\t\t// Get the most recently opened dialog (last in the array)\n\t\t\tconst dialog = this.activeDialogs[this.activeDialogs.length - 1]\n\t\t\tconst uid = dialog.getAttribute('uid')\n\t\t\t\n\t\t\tif (uid) {\n\t\t\t\tthis.dismissSubject.next(uid)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\n\t/**\n\t * Show a simple confirmation dialog with just a message\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic ask(message: string, event?: MouseEvent | TouchEvent): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\tmessage,\n\t\t\tposition: event,\n\t\t})\n\t}\n\n\t/**\n\t * Show a danger confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic danger(options: Omit<DialogOptions, 'variant'>): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\t...options,\n\t\t\tvariant: 'danger',\n\t\t})\n\t}\n\n\t/**\n\t * Get a centered position for the dialog\n\t */\n\tprivate getCenteredPosition(): { x: number; y: number } {\n\t\treturn {\n\t\t\tx: window.innerWidth / 2,\n\t\t\ty: window.innerHeight / 2,\n\t\t}\n\t}\n\n}\n\n/**\n * Global dialog utility - provides a quick way to show dialogs\n */\nexport const $dialog = {\n\t/**\n\t * Show a confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tconfirm: (options: DialogOptions): Promise<boolean> => {\n\t\treturn DialogService.getInstance().confirm(options)\n\t},\n\n\t/**\n\t * Show a simple confirmation dialog with just a message\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\task: (message: string, event?: MouseEvent | TouchEvent): Promise<boolean> => {\n\t\treturn DialogService.getInstance().ask(message, event)\n\t},\n\n\t/**\n\t * Show a danger confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tdanger: (options: Omit<DialogOptions, 'variant'>): Promise<boolean> => {\n\t\treturn DialogService.getInstance().danger(options)\n\t},\n\n\t/**\n\t * Show a dialog with custom component content\n\t * @returns Promise that resolves when dialog is closed\n\t */\n\tcomponent: (\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions?: Omit<DialogOptions, 'content' | 'message'>,\n\t): Promise<boolean> => {\n\t\treturn DialogService.getInstance().component(content, options)\n\t},\n\n\t/**\n\t * Show a simple dialog without title or actions, just content\n\t * This is an alias for component() since all component dialogs are now simple by design\n\t * @returns Promise that resolves when dialog is closed\n\t */\n\tsimple: (\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions?: Omit<DialogOptions, 'content' | 'message' | 'title' | 'confirmText' | 'cancelText'>,\n\t): Promise<boolean> => {\n\t\treturn DialogService.getInstance().component(content, options)\n\t},\n\n\t/**\n\t * Dismiss the most recently opened dialog\n\t * @returns true if a dialog was dismissed, false if no dialogs were open\n\t */\n\tdismiss: (): boolean => {\n\t\treturn DialogService.getInstance().dismiss()\n\t},\n}\n\nexport default DialogService"],"names":["DialogService","constructor","this","activeDialogs","activeRawDialogs","dialogSubject","Subject","dismissSubject","setupDialogOpeningLogic","setupDialogDismissLogic","instance","pipe","switchMap","forkJoin","fromEvent","window","DialogHereMorty","takeUntil","timer","map","e","detail","defaultIfEmpty","of","target","tap","uid","type","Date","now","Math","random","toString","substring","dispatchEvent","CustomEvent","DialogWhereAreYouRicky","bubbles","composed","response","dialog","targetContainer","parentElement","theme","options","ThemeWhereAreYou","ThemeHereIAm","take","document","body","createElement","setAttribute","appendChild","querySelector","confirmDialog","title","subtitle","message","confirmText","cancelText","variant","confirmColor","width","style","setProperty","content","contentContainer","slot","result","HTMLElement","render","push","directContentContainer","height","classList","add","position","getCenteredPosition","show","then","resolve","index","indexOf","splice","contentEl","removeChild","parentNode","catch","error","reject","onConfirm","_e","removeEventListener","addEventListener","onCancel","subscribe","hide","confirmIndex","rawIndex","Promise","completeOptions","DEFAULT_OPTIONS","next","dismiss","length","getAttribute","event","confirm","x","innerWidth","y","innerHeight","_w","$dialog","getInstance","ask","danger","component","simple"],"mappings":";;;AAwCO,MAAMA,IAAN,MAAMA,EAAAA;AAAAA,EA0BJ,cAAAC;AAZRC,SAAQC,gBAAiC,CAAA,GAGzCD,KAAQE,mBAA0B,CAAA,GAGlCF,KAAQG,gBAAgB,IAAIC,KAG5BJ,KAAQK,iBAAiB,IAAID,KAI5BJ,KAAKM,wBAAAA,GACLN,KAAKO,wBAAAA;AAAAA,EACN;AAAA,EAKA,OAAA;AAIC,WAHKT,EAAcU,aAClBV,EAAcU,WAAW,IAA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,EAKtBN,SAAU/D,CAAAA,MACF5C,EAAckH,YAAAA,EAAcP,QAAQ/D,CAAAA,GAO5CuE,KAAK,CAAC1D,GAAiBiD,MACf1G,EAAckH,cAAcC,IAAI1D,GAASiD,CAAAA,GAOjDU,QAASxE,CAAAA,MACD5C,EAAckH,cAAcE,OAAOxE,CAAAA,GAO3CyE,WAAW,CACVpD,GACArB,MAEO5C,EAAckH,YAAAA,EAAcG,UAAUpD,GAASrB,CAAAA,GAQvD0E,QAAQ,CACPrD,GACArB,MAEO5C,EAAckH,YAAAA,EAAcG,UAAUpD,GAASrB,CAAAA,GAOvD2D,SAAS,MACDvG,EAAckH,YAAAA,EAAcX,QAAAA,EAAAA;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const g=require("lit"),o=require("rxjs"),d=require("./theme.component-B3Z6xZ33.cjs"),l=class l{constructor(){this.activeDialogs=[],this.activeRawDialogs=[],this.dialogSubject=new o.Subject,this.dismissSubject=new o.Subject,this.setupDialogOpeningLogic(),this.setupDialogDismissLogic()}static getInstance(){return l.instance||(l.instance=new l),l.instance}setupDialogOpeningLogic(){this.dialogSubject.pipe(o.switchMap(e=>o.forkJoin([o.fromEvent(window,d.DialogHereMorty).pipe(o.takeUntil(o.timer(100)),o.map(t=>t.detail),o.defaultIfEmpty(void 0)),o.of(e).pipe(o.tap(()=>{const t=e.type==="confirm"?`confirm-dialog-${Date.now()}-${Math.random().toString(36).substring(2,9)}`:`dialog-${Date.now()}-${Math.random().toString(36).substring(2,9)}`;window.dispatchEvent(new CustomEvent(d.DialogWhereAreYouRicky,{detail:{uid:t},bubbles:!0,composed:!0})),e.uid=t}))])),o.switchMap(([e,t])=>{let n,i;return e?.dialog?(n=e.dialog,i=n.parentElement,o.of({dialog:n,target:t,targetContainer:i})):e?.theme?(i=e.theme,o.of({dialog:null,target:t,targetContainer:i})):t.options.targetContainer?(i=t.options.targetContainer,o.of({dialog:null,target:t,targetContainer:i})):(window.dispatchEvent(new CustomEvent(d.ThemeWhereAreYou)),o.fromEvent(window,d.ThemeHereIAm).pipe(o.takeUntil(o.timer(100)),o.map(s=>s.detail.theme),o.defaultIfEmpty(void 0),o.take(1),o.map(s=>({dialog:null,target:t,targetContainer:s||document.body}))))}),o.tap(({dialog:e,target:t,targetContainer:n})=>{e||((e=t.type==="confirm"?document.createElement("confirm-dialog"):document.createElement("schmancy-dialog")).setAttribute("uid",t.uid),n.appendChild(e))}),o.map(({dialog:e,target:t,targetContainer:n})=>(e||(e=n.querySelector(`[uid="${t.uid}"]`)),{dialog:e,target:t,targetContainer:n})),o.tap(({dialog:e,target:t})=>{if(t.type==="confirm"){const n=e,i=t.options;if(i.title&&(n.title=i.title),i.subtitle&&(n.subtitle=i.subtitle),i.message&&(n.message=i.message),i.confirmText&&(n.confirmText=i.confirmText),i.cancelText&&(n.cancelText=i.cancelText),i.variant&&(n.variant=i.variant),i.confirmColor&&(n.confirmColor=i.confirmColor),i.width&&n.style.setProperty("--dialog-width",i.width),i.content){const s=document.createElement("div");if(s.slot="content",typeof i.content=="function"){const a=i.content();a instanceof HTMLElement?s.appendChild(a):g.render(a,s)}else i.content instanceof HTMLElement?s.appendChild(i.content):g.render(i.content,s);n.appendChild(s)}this.activeDialogs.push(n)}else{if(t.content){const n=document.createElement("div");if(n.style.height="100%",n.style.width="100%",n.classList.add("schmancy-dialog-content-container"),typeof t.content=="function"){const i=t.content();i instanceof HTMLElement?n.appendChild(i):g.render(i,n)}else t.content instanceof HTMLElement?n.appendChild(t.content):g.render(t.content,n);e.appendChild(n)}t.options.width&&e.style.setProperty("--dialog-width",t.options.width),this.activeRawDialogs.push(e)}}),o.tap(({dialog:e,target:t})=>{const n=t.options.position||this.getCenteredPosition();if(e.show(n).then(i=>{if(t.resolve&&t.resolve(i),t.type==="confirm"){const s=this.activeDialogs.indexOf(e);s!==-1&&this.activeDialogs.splice(s,1);const a=e.querySelector('[slot="content"]');a&&e.removeChild(a)}else{const s=this.activeRawDialogs.indexOf(e);s!==-1&&this.activeRawDialogs.splice(s,1);const a=e.querySelector(".schmancy-dialog-content-container");a&&a.parentNode&&a.parentNode.removeChild(a)}e.parentElement&&e.parentElement.removeChild(e)}).catch(i=>{t.reject&&t.reject(i)}),t.options.onConfirm){const i=s=>{t.options.onConfirm(),e.removeEventListener("confirm",i)};e.addEventListener("confirm",i)}if(t.options.onCancel){const i=s=>{t.options.onCancel(),e.removeEventListener("cancel",i)};e.addEventListener("cancel",i)}})).subscribe()}setupDialogDismissLogic(){this.dismissSubject.pipe(o.switchMap(e=>o.forkJoin([o.fromEvent(window,d.DialogHereMorty).pipe(o.takeUntil(o.timer(100)),o.map(t=>t.detail),o.defaultIfEmpty(void 0)),o.of(e).pipe(o.tap(()=>{window.dispatchEvent(new CustomEvent(d.DialogWhereAreYouRicky,{detail:{uid:e},bubbles:!0,composed:!0}))}))])),o.tap(([e])=>{if(e?.dialog){e.dialog.hide(!1);const t=this.activeDialogs.indexOf(e.dialog);t!==-1&&this.activeDialogs.splice(t,1);const n=this.activeRawDialogs.indexOf(e.dialog);n!==-1&&this.activeRawDialogs.splice(n,1),e.dialog.parentElement&&e.dialog.parentElement.removeChild(e.dialog)}})).subscribe()}confirm(e){return new Promise((t,n)=>{const i={...l.DEFAULT_OPTIONS,...e};i.position||(i.position=this.getCenteredPosition());const s={options:i,type:"confirm",content:i.content,resolve:t,reject:n};this.dialogSubject.next(s)})}component(e,t={}){return new Promise((n,i)=>{t.position||(t.position=this.getCenteredPosition());const s={options:t,type:"component",content:e,resolve:n,reject:i};this.dialogSubject.next(s)})}dismiss(){if(this.activeRawDialogs.length>0){const e=this.activeRawDialogs[this.activeRawDialogs.length-1].getAttribute("uid");if(e)return this.dismissSubject.next(e),!0}if(this.activeDialogs.length>0){const e=this.activeDialogs[this.activeDialogs.length-1].getAttribute("uid");if(e)return this.dismissSubject.next(e),!0}return!1}ask(e,t){return this.confirm({message:e,position:t})}danger(e){return this.confirm({...e,variant:"danger"})}getCenteredPosition(){return{x:window.innerWidth/2,y:window.innerHeight/2}}};l.DEFAULT_OPTIONS={title:void 0,subtitle:void 0,confirmText:void 0,cancelText:void 0,variant:"default",width:"360px"};let r=l;const p={confirm:c=>r.getInstance().confirm(c),ask:(c,e)=>r.getInstance().ask(c,e),danger:c=>r.getInstance().danger(c),component:(c,e)=>r.getInstance().component(c,e),simple:(c,e)=>r.getInstance().component(c,e),dismiss:()=>r.getInstance().dismiss()};exports.$dialog=p,exports.DialogService=r;
|
|
2
|
-
//# sourceMappingURL=dialog-service-B4gxdlr-.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-service-B4gxdlr-.cjs","sources":["../src/dialog/dialog-service.ts"],"sourcesContent":["import { render, TemplateResult } from 'lit'\nimport { defaultIfEmpty, forkJoin, fromEvent, map, of, Subject, switchMap, takeUntil, tap, timer, take } from 'rxjs'\nimport { ConfirmDialog } from './dailog'\nimport { DialogHereMorty, DialogHereMortyEvent, DialogWhereAreYouRicky } from './dialog-events'\nimport { ThemeWhereAreYou, ThemeHereIAm, ThemeHereIAmEvent } from '../theme/theme.component'\n\n/**\n * Dialog service options interface with component support\n */\nexport interface DialogOptions {\n\ttitle?: string\n\tsubtitle?: string\n\tmessage?: string\n\tconfirmText?: string\n\tcancelText?: string\n\tvariant?: 'default' | 'danger'\n\tconfirmColor?: 'primary' | 'error' | 'warning' | 'success' // Button color for confirm action\n\tposition?: { x: number; y: number } | MouseEvent | TouchEvent\n\n\t// New options for component rendering\n\tcontent?: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult)\n\twidth?: string\n\tonConfirm?: () => void\n\tonCancel?: () => void\n\thideActions?: boolean // Set to true to hide all buttons and title\n\ttargetContainer?: HTMLElement // Container to append dialog to (defaults to document.body)\n}\n\ninterface DialogTarget {\n\toptions: DialogOptions\n\ttype: 'confirm' | 'component'\n\tcontent?: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult)\n\tresolve?: (value: boolean) => void\n\treject?: (reason?: any) => void\n}\n\n/**\n * Dialog service for centralized dialog management.\n * Provides a simple API for showing dialogs with optional custom components.\n */\nexport class DialogService {\n\tprivate static instance: DialogService\n\n\t// Default dialog options\n\tprivate static DEFAULT_OPTIONS: Partial<DialogOptions> = {\n\t\ttitle: undefined,\n\t\tsubtitle: undefined,\n\t\tconfirmText: undefined,\n\t\tcancelText: undefined,\n\t\tvariant: 'default',\n\t\twidth: '360px',\n\t}\n\n\t// Track active dialogs to handle dismissing the most recent one\n\tprivate activeDialogs: ConfirmDialog[] = []\n\t\n\t// Track component dialogs (schmancy-dialog instances)\n\tprivate activeRawDialogs: any[] = []\n\t\n\t// Subject for dialog opening requests\n\tprivate dialogSubject = new Subject<DialogTarget>()\n\t\n\t// Subject for dialog dismissal requests\n\tprivate dismissSubject = new Subject<string>()\n\n\t// Private constructor for singleton pattern\n\tprivate constructor() {\n\t\tthis.setupDialogOpeningLogic()\n\t\tthis.setupDialogDismissLogic()\n\t}\n\n\t/**\n\t * Get the singleton instance\n\t */\n\tpublic static getInstance(): DialogService {\n\t\tif (!DialogService.instance) {\n\t\t\tDialogService.instance = new DialogService()\n\t\t}\n\t\treturn DialogService.instance\n\t}\n\t\n\t/**\n\t * Sets up the main dialog opening logic using RxJS pipes\n\t */\n\tprivate setupDialogOpeningLogic() {\n\t\tthis.dialogSubject\n\t\t\t.pipe(\n\t\t\t\tswitchMap(target =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<DialogHereMortyEvent>(window, DialogHereMorty).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(target).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\tconst uid = target.type === 'confirm' \n\t\t\t\t\t\t\t\t\t? `confirm-dialog-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`\n\t\t\t\t\t\t\t\t\t: `dialog-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(DialogWhereAreYouRicky, {\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\n\t\t\t\t\t\t\t\t// Store uid in target for later use\n\t\t\t\t\t\t\t\t;(target as any).uid = 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\tswitchMap(([response, target]) => {\n\t\t\t\t\tlet dialog: ConfirmDialog | any\n\t\t\t\t\tlet targetContainer: HTMLElement\n\t\t\t\t\t\n\t\t\t\t\tif (response?.dialog) {\n\t\t\t\t\t\t// Use existing dialog\n\t\t\t\t\t\tdialog = response.dialog\n\t\t\t\t\t\ttargetContainer = dialog.parentElement as HTMLElement\n\t\t\t\t\t\treturn of({ dialog, target, targetContainer })\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Determine container - use responding theme or fallback\n\t\t\t\t\t\tif (response?.theme) {\n\t\t\t\t\t\t\ttargetContainer = response.theme as HTMLElement\n\t\t\t\t\t\t\treturn of({ dialog: null, target, targetContainer })\n\t\t\t\t\t\t} else if (target.options.targetContainer) {\n\t\t\t\t\t\t\ttargetContainer = target.options.targetContainer\n\t\t\t\t\t\t\treturn of({ dialog: null, target, targetContainer })\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Use the same theme discovery pattern as sheet service\n\t\t\t\t\t\t\twindow.dispatchEvent(new CustomEvent(ThemeWhereAreYou))\n\t\t\t\t\t\t\treturn fromEvent<ThemeHereIAmEvent>(window, ThemeHereIAm).pipe(\n\t\t\t\t\t\t\t\ttakeUntil(timer(100)),\n\t\t\t\t\t\t\t\tmap(e => e.detail.theme),\n\t\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t\t\ttake(1),\n\t\t\t\t\t\t\t\tmap(theme => ({\n\t\t\t\t\t\t\t\t\tdialog: null,\n\t\t\t\t\t\t\t\t\ttarget,\n\t\t\t\t\t\t\t\t\ttargetContainer: theme || document.body\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\t\t\t\ttap(({ dialog, target, targetContainer }) => {\n\t\t\t\t\tif (!dialog) {\n\t\t\t\t\t\t// Create appropriate dialog type\n\t\t\t\t\t\tif (target.type === 'confirm') {\n\t\t\t\t\t\t\tdialog = document.createElement('confirm-dialog') as ConfirmDialog\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdialog = document.createElement('schmancy-dialog')\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tdialog.setAttribute('uid', (target as any).uid)\n\t\t\t\t\t\ttargetContainer.appendChild(dialog)\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tmap(({ dialog, target, targetContainer }) => {\n\t\t\t\t\t// Return the actual dialog element that was created\n\t\t\t\t\tif (!dialog) {\n\t\t\t\t\t\tdialog = targetContainer.querySelector(`[uid=\"${(target as any).uid}\"]`)\n\t\t\t\t\t}\n\t\t\t\t\treturn { dialog, target, targetContainer }\n\t\t\t\t}),\n\t\t\t\ttap(({ dialog, target }) => {\n\t\t\t\t\tif (target.type === 'confirm') {\n\t\t\t\t\t\t// Configure confirm dialog\n\t\t\t\t\t\tconst confirmDialog = dialog as ConfirmDialog\n\t\t\t\t\t\tconst options = target.options\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (options.title) confirmDialog.title = options.title\n\t\t\t\t\t\tif (options.subtitle) confirmDialog.subtitle = options.subtitle\n\t\t\t\t\t\tif (options.message) confirmDialog.message = options.message\n\t\t\t\t\t\tif (options.confirmText) confirmDialog.confirmText = options.confirmText\n\t\t\t\t\t\tif (options.cancelText) confirmDialog.cancelText = options.cancelText\n\t\t\t\t\t\tif (options.variant) confirmDialog.variant = options.variant\n\t\t\t\t\t\tif (options.confirmColor) confirmDialog.confirmColor = options.confirmColor\n\t\t\t\t\t\tif (options.width) confirmDialog.style.setProperty('--dialog-width', options.width)\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Handle custom content if provided\n\t\t\t\t\t\tif (options.content) {\n\t\t\t\t\t\t\tconst contentContainer = document.createElement('div')\n\t\t\t\t\t\t\tcontentContainer.slot = 'content'\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (typeof options.content === 'function') {\n\t\t\t\t\t\t\t\tconst result = options.content()\n\t\t\t\t\t\t\t\tif (result instanceof HTMLElement) {\n\t\t\t\t\t\t\t\t\tcontentContainer.appendChild(result)\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\trender(result, contentContainer)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (options.content instanceof HTMLElement) {\n\t\t\t\t\t\t\t\tcontentContainer.appendChild(options.content)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trender(options.content, contentContainer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tconfirmDialog.appendChild(contentContainer)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Add to active dialogs\n\t\t\t\t\t\tthis.activeDialogs.push(confirmDialog)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Configure component dialog\n\t\t\t\t\t\tif (target.content) {\n\t\t\t\t\t\t\tconst directContentContainer = document.createElement('div')\n\t\t\t\t\t\t\tdirectContentContainer.style.height = '100%'\n\t\t\t\t\t\t\tdirectContentContainer.style.width = '100%'\n\t\t\t\t\t\t\tdirectContentContainer.classList.add('schmancy-dialog-content-container')\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Render the content directly\n\t\t\t\t\t\t\tif (typeof target.content === 'function') {\n\t\t\t\t\t\t\t\tconst result = target.content()\n\t\t\t\t\t\t\t\tif (result instanceof HTMLElement) {\n\t\t\t\t\t\t\t\t\tdirectContentContainer.appendChild(result)\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\trender(result, directContentContainer)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (target.content instanceof HTMLElement) {\n\t\t\t\t\t\t\t\tdirectContentContainer.appendChild(target.content)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trender(target.content, directContentContainer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tdialog.appendChild(directContentContainer)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Set width from options\n\t\t\t\t\t\tif (target.options.width) {\n\t\t\t\t\t\t\tdialog.style.setProperty('--dialog-width', target.options.width)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Add to active raw dialogs\n\t\t\t\t\t\tthis.activeRawDialogs.push(dialog)\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\ttap(({ dialog, target }) => {\n\t\t\t\t\t// Show dialog and handle promise resolution\n\t\t\t\t\tconst position = target.options.position || this.getCenteredPosition()\n\t\t\t\t\t\n\t\t\t\t\tdialog.show(position).then((result: boolean) => {\n\t\t\t\t\t\tif (target.resolve) {\n\t\t\t\t\t\t\ttarget.resolve(result)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Cleanup\n\t\t\t\t\t\tif (target.type === 'confirm') {\n\t\t\t\t\t\t\tconst index = this.activeDialogs.indexOf(dialog)\n\t\t\t\t\t\t\tif (index !== -1) {\n\t\t\t\t\t\t\t\tthis.activeDialogs.splice(index, 1)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Clean up content\n\t\t\t\t\t\t\tconst contentEl = dialog.querySelector('[slot=\"content\"]')\n\t\t\t\t\t\t\tif (contentEl) {\n\t\t\t\t\t\t\t\tdialog.removeChild(contentEl)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst index = this.activeRawDialogs.indexOf(dialog)\n\t\t\t\t\t\t\tif (index !== -1) {\n\t\t\t\t\t\t\t\tthis.activeRawDialogs.splice(index, 1)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Clean up content\n\t\t\t\t\t\t\tconst contentContainer = dialog.querySelector('.schmancy-dialog-content-container')\n\t\t\t\t\t\t\tif (contentContainer && contentContainer.parentNode) {\n\t\t\t\t\t\t\t\tcontentContainer.parentNode.removeChild(contentContainer)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Remove dialog from DOM\n\t\t\t\t\t\tif (dialog.parentElement) {\n\t\t\t\t\t\t\tdialog.parentElement.removeChild(dialog)\n\t\t\t\t\t\t}\n\t\t\t\t\t}).catch((error: any) => {\n\t\t\t\t\t\tif (target.reject) {\n\t\t\t\t\t\t\ttarget.reject(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t\n\t\t\t\t\t// Set up event listeners for callbacks\n\t\t\t\t\tif (target.options.onConfirm) {\n\t\t\t\t\t\tconst onConfirm = (_e: Event) => {\n\t\t\t\t\t\t\ttarget.options.onConfirm!()\n\t\t\t\t\t\t\tdialog.removeEventListener('confirm', onConfirm)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdialog.addEventListener('confirm', onConfirm)\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (target.options.onCancel) {\n\t\t\t\t\t\tconst onCancel = (_e: Event) => {\n\t\t\t\t\t\t\ttarget.options.onCancel!()\n\t\t\t\t\t\t\tdialog.removeEventListener('cancel', onCancel)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdialog.addEventListener('cancel', onCancel)\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\t\n\t/**\n\t * Sets up the dialog dismissal logic\n\t */\n\tprivate setupDialogDismissLogic() {\n\t\tthis.dismissSubject\n\t\t\t.pipe(\n\t\t\t\tswitchMap(uid =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<DialogHereMortyEvent>(window, DialogHereMorty).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(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(DialogWhereAreYouRicky, { \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}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\ttap(([response]) => {\n\t\t\t\t\tif (response?.dialog) {\n\t\t\t\t\t\t// Hide the dialog\n\t\t\t\t\t\tresponse.dialog.hide(false)\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Remove from tracking arrays\n\t\t\t\t\t\tconst confirmIndex = this.activeDialogs.indexOf(response.dialog)\n\t\t\t\t\t\tif (confirmIndex !== -1) {\n\t\t\t\t\t\t\tthis.activeDialogs.splice(confirmIndex, 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tconst rawIndex = this.activeRawDialogs.indexOf(response.dialog)\n\t\t\t\t\t\tif (rawIndex !== -1) {\n\t\t\t\t\t\t\tthis.activeRawDialogs.splice(rawIndex, 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Remove dialog from DOM immediately\n\t\t\t\t\t\tif (response.dialog.parentElement) {\n\t\t\t\t\t\t\tresponse.dialog.parentElement.removeChild(response.dialog)\n\t\t\t\t\t\t}\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 * Show a confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic confirm(options: DialogOptions): Promise<boolean> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\t// Apply default options\n\t\t\tconst completeOptions = {\n\t\t\t\t...DialogService.DEFAULT_OPTIONS,\n\t\t\t\t...options,\n\t\t\t}\n\n\t\t\t// If no position is provided, center the dialog\n\t\t\tif (!completeOptions.position) {\n\t\t\t\tcompleteOptions.position = this.getCenteredPosition()\n\t\t\t}\n\n\t\t\t// Create dialog target and emit to subject\n\t\t\tconst target: DialogTarget = {\n\t\t\t\toptions: completeOptions,\n\t\t\t\ttype: 'confirm',\n\t\t\t\tcontent: completeOptions.content,\n\t\t\t\tresolve,\n\t\t\t\treject,\n\t\t\t}\n\n\t\t\tthis.dialogSubject.next(target)\n\t\t})\n\t}\n\n\t/**\n\t * Show a dialog with custom component content\n\t * Always renders content directly without any headers or action buttons\n\t * @returns Promise that resolves when dialog is closed\n\t */\n\tpublic component(\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions: Omit<DialogOptions, 'content' | 'message'> = {},\n\t): Promise<boolean> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\t// If no position is provided, center the dialog\n\t\t\tif (!options.position) {\n\t\t\t\toptions.position = this.getCenteredPosition()\n\t\t\t}\n\n\t\t\t// Create dialog target and emit to subject\n\t\t\tconst target: DialogTarget = {\n\t\t\t\toptions: options as DialogOptions,\n\t\t\t\ttype: 'component',\n\t\t\t\tcontent,\n\t\t\t\tresolve,\n\t\t\t\treject,\n\t\t\t}\n\n\t\t\tthis.dialogSubject.next(target)\n\t\t})\n\t}\n\n\t/**\n\t * Dismiss the most recently opened dialog (either confirm or component type)\n\t * @returns true if a dialog was dismissed, false if no dialogs were open\n\t */\n\tpublic dismiss(): boolean {\n\t\t// Try component dialog first (they're more likely to be on top)\n\t\tif (this.activeRawDialogs.length > 0) {\n\t\t\t// Get the most recently opened raw dialog (last in the array)\n\t\t\tconst dialog = this.activeRawDialogs[this.activeRawDialogs.length - 1]\n\t\t\tconst uid = dialog.getAttribute('uid')\n\t\t\t\n\t\t\tif (uid) {\n\t\t\t\tthis.dismissSubject.next(uid)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Fall back to confirm dialogs\n\t\tif (this.activeDialogs.length > 0) {\n\t\t\t// Get the most recently opened dialog (last in the array)\n\t\t\tconst dialog = this.activeDialogs[this.activeDialogs.length - 1]\n\t\t\tconst uid = dialog.getAttribute('uid')\n\t\t\t\n\t\t\tif (uid) {\n\t\t\t\tthis.dismissSubject.next(uid)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\n\t/**\n\t * Show a simple confirmation dialog with just a message\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic ask(message: string, event?: MouseEvent | TouchEvent): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\tmessage,\n\t\t\tposition: event,\n\t\t})\n\t}\n\n\t/**\n\t * Show a danger confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tpublic danger(options: Omit<DialogOptions, 'variant'>): Promise<boolean> {\n\t\treturn this.confirm({\n\t\t\t...options,\n\t\t\tvariant: 'danger',\n\t\t})\n\t}\n\n\t/**\n\t * Get a centered position for the dialog\n\t */\n\tprivate getCenteredPosition(): { x: number; y: number } {\n\t\treturn {\n\t\t\tx: window.innerWidth / 2,\n\t\t\ty: window.innerHeight / 2,\n\t\t}\n\t}\n\n}\n\n/**\n * Global dialog utility - provides a quick way to show dialogs\n */\nexport const $dialog = {\n\t/**\n\t * Show a confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tconfirm: (options: DialogOptions): Promise<boolean> => {\n\t\treturn DialogService.getInstance().confirm(options)\n\t},\n\n\t/**\n\t * Show a simple confirmation dialog with just a message\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\task: (message: string, event?: MouseEvent | TouchEvent): Promise<boolean> => {\n\t\treturn DialogService.getInstance().ask(message, event)\n\t},\n\n\t/**\n\t * Show a danger confirmation dialog\n\t * @returns Promise that resolves to true (confirm) or false (cancel)\n\t */\n\tdanger: (options: Omit<DialogOptions, 'variant'>): Promise<boolean> => {\n\t\treturn DialogService.getInstance().danger(options)\n\t},\n\n\t/**\n\t * Show a dialog with custom component content\n\t * @returns Promise that resolves when dialog is closed\n\t */\n\tcomponent: (\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions?: Omit<DialogOptions, 'content' | 'message'>,\n\t): Promise<boolean> => {\n\t\treturn DialogService.getInstance().component(content, options)\n\t},\n\n\t/**\n\t * Show a simple dialog without title or actions, just content\n\t * This is an alias for component() since all component dialogs are now simple by design\n\t * @returns Promise that resolves when dialog is closed\n\t */\n\tsimple: (\n\t\tcontent: TemplateResult | HTMLElement | (() => HTMLElement | TemplateResult),\n\t\toptions?: Omit<DialogOptions, 'content' | 'message' | 'title' | 'confirmText' | 'cancelText'>,\n\t): Promise<boolean> => {\n\t\treturn DialogService.getInstance().component(content, options)\n\t},\n\n\t/**\n\t * Dismiss the most recently opened dialog\n\t * @returns true if a dialog was dismissed, false if no dialogs were open\n\t */\n\tdismiss: (): boolean => {\n\t\treturn DialogService.getInstance().dismiss()\n\t},\n}\n\nexport default DialogService"],"names":["DialogService","constructor","this","activeDialogs","activeRawDialogs","dialogSubject","Subject","dismissSubject","setupDialogOpeningLogic","setupDialogDismissLogic","getInstance","instance","pipe","switchMap","forkJoin","fromEvent","window","DialogHereMorty","takeUntil","timer","map","e","detail","defaultIfEmpty","of","target","tap","uid","type","Date","now","Math","random","toString","substring","dispatchEvent","CustomEvent","DialogWhereAreYouRicky","bubbles","composed","response","dialog","targetContainer","parentElement","theme","options","ThemeWhereAreYou","ThemeHereIAm","take","document","body","createElement","setAttribute","appendChild","querySelector","confirmDialog","title","subtitle","message","confirmText","cancelText","variant","confirmColor","width","style","setProperty","content","contentContainer","slot","result","HTMLElement","render","push","directContentContainer","height","classList","add","position","getCenteredPosition","show","then","resolve","index","indexOf","splice","contentEl","removeChild","parentNode","catch","error","reject","onConfirm","_e","removeEventListener","addEventListener","onCancel","subscribe","hide","confirmIndex","rawIndex","Promise","completeOptions","DEFAULT_OPTIONS","next","dismiss","length","getAttribute","event","confirm","x","innerWidth","y","innerHeight","$dialog","ask","danger","component","simple"],"mappings":"kGAwCaA,EAAN,MAAMA,CAAAA,CA0BJ,aAAAC,CAZRC,KAAQC,cAAiC,CAAA,EAGzCD,KAAQE,iBAA0B,GAGlCF,KAAQG,cAAgB,IAAIC,UAG5BJ,KAAQK,eAAiB,IAAID,UAI5BJ,KAAKM,wBAAAA,EACLN,KAAKO,yBACN,CAKA,OAAA,aAAcC,CAIb,OAHKV,EAAcW,WAClBX,EAAcW,SAAW,IAAIX,GAEvBA,EAAcW,QACtB,CAKQ,yBAAAH,CACPN,KAAKG,cACHO,KACAC,EAAAA,aACCC,EAAAA,SAAS,CACRC,YAAgCC,OAAQC,EAAAA,eAAAA,EAAiBL,KACxDM,YAAUC,EAAAA,MAAM,GAAA,CAAA,EAChBC,EAAAA,IAAIC,GAAKA,EAAEC,MAAAA,EACXC,EAAAA,eAAAA,MAAe,CAAA,EAEhBC,EAAAA,GAAGC,CAAAA,EAAQb,KACVc,EAAAA,IAAI,IAAA,CACH,MAAMC,EAAMF,EAAOG,OAAS,UACzB,kBAAkBC,KAAKC,IAAAA,CAAAA,IAASC,KAAKC,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CAAAA"}
|
package/dist/sheet-BXNBQt5O.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { fromEvent as d, tap as p, of as w, take as k, merge as E, takeUntil as x } from "rxjs";
|
|
2
|
-
import { classMap as y } from "lit/directives/class-map.js";
|
|
3
|
-
import "lit/directives/style-map.js";
|
|
4
|
-
import { T as $ } from "./tailwind.mixin-CaIkmP6j.js";
|
|
5
|
-
import { customElement as g, property as c, queryAssignedElements as S } from "lit/decorators.js";
|
|
6
|
-
import { css as C, html as f } from "lit";
|
|
7
|
-
import { $ as A } from "./litElement.mixin-BH9PTyUD.js";
|
|
8
|
-
import { cache as O } from "lit/directives/cache.js";
|
|
9
|
-
import { ifDefined as v } from "lit/directives/if-defined.js";
|
|
10
|
-
import { createRef as B, ref as F } from "lit/directives/ref.js";
|
|
11
|
-
import { S as P, s as m, a as U, b as j } from "./theme.component-DbZODTAR.js";
|
|
12
|
-
var D = Object.getOwnPropertyDescriptor;
|
|
13
|
-
let b = class extends $(C``) {
|
|
14
|
-
render() {
|
|
15
|
-
return f`
|
|
16
|
-
<sch-flex class="absolute top-0 left-0 md:left-[unset] md:right-0">
|
|
17
|
-
<div class="block md:hidden flex-1 justify-start items-start">
|
|
18
|
-
<slot name="back">
|
|
19
|
-
<schmancy-button
|
|
20
|
-
@click=${() => {
|
|
21
|
-
this.dispatchEvent(new CustomEvent("dismiss", { bubbles: !0, composed: !0 }));
|
|
22
|
-
}}
|
|
23
|
-
>
|
|
24
|
-
<span class="text-[24px]">← </span>
|
|
25
|
-
</schmancy-button>
|
|
26
|
-
</slot>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<div class="hidden md:block flex-1 justify-end items-end">
|
|
30
|
-
<slot name="actions">
|
|
31
|
-
<schmancy-icon-button
|
|
32
|
-
@click=${() => {
|
|
33
|
-
this.dispatchEvent(new CustomEvent("dismiss", { bubbles: !0, composed: !0 }));
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
close
|
|
37
|
-
</schmancy-icon-button>
|
|
38
|
-
</slot>
|
|
39
|
-
</div>
|
|
40
|
-
</sch-flex>
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
b = ((t, e, s, i) => {
|
|
45
|
-
for (var r, o = i > 1 ? void 0 : i ? D(e, s) : e, h = t.length - 1; h >= 0; h--) (r = t[h]) && (o = r(o) || o);
|
|
46
|
-
return o;
|
|
47
|
-
})([g("schmancy-sheet-header")], b);
|
|
48
|
-
var H = Object.defineProperty, R = Object.getOwnPropertyDescriptor, a = (t, e, s, i) => {
|
|
49
|
-
for (var r, o = i > 1 ? void 0 : i ? R(e, s) : e, h = t.length - 1; h >= 0; h--) (r = t[h]) && (o = (i ? r(e, s, o) : r(o)) || o);
|
|
50
|
-
return i && o && H(e, s, o), o;
|
|
51
|
-
};
|
|
52
|
-
let n = class extends A(":host{--overlay-color: var(--schmancy-sys-color-surface-dim);--transition-timing: cubic-bezier(.16, 1, .3, 1);--transition-duration: .25s;--sheet-radius: 0;--max-height: 100vh}.sheet{position:fixed;inset:0;z-index:999;display:flex;visibility:visible;transition:visibility var(--transition-duration) var(--transition-timing)}.sheet[aria-hidden=true]{visibility:hidden;pointer-events:none}.sheet[aria-hidden=true] .content{transform:translateY(100%)}.sheet[aria-hidden=true] .content[data-position=side]{transform:translate(100%)}.sheet[aria-hidden=true] .overlay{opacity:0}.overlay{position:absolute;inset:0;background:var(--overlay-color);opacity:.8;transition:opacity var(--transition-duration) var(--transition-timing)}.content{z-index:1;transition:transform var(--transition-duration) var(--transition-timing);overflow:hidden}.content[data-position=side]{height:100vh;height:100%;min-width:320px;max-width:90vw;width:fit-content;margin-left:auto}.content[data-position=side] #body{max-height:100vh}.content[data-position=bottom]{width:100%;margin-top:auto;border-radius:16px 16px 0 0;max-height:90vh}.content[data-position=bottom] #body{max-height:90vh}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}") {
|
|
53
|
-
constructor() {
|
|
54
|
-
super(...arguments), this.open = !1, this.header = "visible", this.position = P.Side, this.persist = !1, this.lock = !1, this.handleHistory = !0, this.title = "", this.sheetRef = B(), this.focusAttribute = "autofocus", this.lastFocusedElement = null, this.handleOverlayClick = (t) => {
|
|
55
|
-
t.stopPropagation(), this.lock || m.dismiss(this.uid);
|
|
56
|
-
}, this.handleHeaderDismiss = (t) => {
|
|
57
|
-
t.stopPropagation(), m.dismiss(this.uid);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
onOpenChange(t, e) {
|
|
61
|
-
e ? (this.lastFocusedElement = document.activeElement, this.setBackgroundInert(!0), this.focus()) : (this.setBackgroundInert(!1), this.lastFocusedElement?.focus(), this.lastFocusedElement = null);
|
|
62
|
-
}
|
|
63
|
-
connectedCallback() {
|
|
64
|
-
super.connectedCallback(), this.setupEventListeners();
|
|
65
|
-
}
|
|
66
|
-
disconnectedCallback() {
|
|
67
|
-
super.disconnectedCallback(), this.disconnecting.next(!0);
|
|
68
|
-
}
|
|
69
|
-
setupEventListeners() {
|
|
70
|
-
const t = this.handleHistory ? d(window, "popstate").pipe(p((i) => {
|
|
71
|
-
i.preventDefault(), this.closeSheet();
|
|
72
|
-
})) : w(null).pipe(k(0)), e = d(this, "keydown").pipe(p((i) => {
|
|
73
|
-
i.key === "Escape" && !this.lock && this.open && (i.preventDefault(), i.stopPropagation(), m.dismiss(this.uid));
|
|
74
|
-
})), s = d(window, U).pipe(p((i) => {
|
|
75
|
-
i.detail.uid === this.uid && this.announcePresence();
|
|
76
|
-
}));
|
|
77
|
-
E(t, e, s).pipe(x(this.disconnecting)).subscribe();
|
|
78
|
-
}
|
|
79
|
-
announcePresence() {
|
|
80
|
-
this.dispatchEvent(new CustomEvent(j, { detail: { sheet: this }, bubbles: !0, composed: !0 }));
|
|
81
|
-
}
|
|
82
|
-
setBackgroundInert(t) {
|
|
83
|
-
const e = this.parentElement;
|
|
84
|
-
e && Array.from(e.children).forEach((s) => {
|
|
85
|
-
s !== this && s instanceof HTMLElement && (t ? s.setAttribute("inert", "") : s.removeAttribute("inert"));
|
|
86
|
-
}), this.parentElement === document.body && Array.from(document.body.children).forEach((s) => {
|
|
87
|
-
s !== this && s !== e && s instanceof HTMLElement && (t ? s.setAttribute("inert", "") : s.removeAttribute("inert"));
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
setIsSheetShown(t) {
|
|
91
|
-
this.sheetRef.value?.setAttribute("aria-hidden", String(!t)), this.sheetRef.value?.setAttribute("aria-modal", String(t));
|
|
92
|
-
}
|
|
93
|
-
closeSheet() {
|
|
94
|
-
this.open = !1, this.dispatchEvent(new CustomEvent("close"));
|
|
95
|
-
}
|
|
96
|
-
getFocusElement() {
|
|
97
|
-
const t = `[${this.focusAttribute}]`;
|
|
98
|
-
return this.assignedElements.find((e) => e.matches(t) || e.querySelector(t)) ?? null;
|
|
99
|
-
}
|
|
100
|
-
focus() {
|
|
101
|
-
const t = this.querySelector("[autofocus]");
|
|
102
|
-
t ? t.focus() : this.getFocusElement()?.focus();
|
|
103
|
-
}
|
|
104
|
-
render() {
|
|
105
|
-
const t = { sheet: !0, "sheet--open": this.open, "sheet--locked": this.lock }, e = { overlay: !0, "overlay--interactive": !this.lock };
|
|
106
|
-
return f`
|
|
107
|
-
<div
|
|
108
|
-
class=${y(t)}
|
|
109
|
-
role="dialog"
|
|
110
|
-
aria-labelledby=${v(this.header !== "hidden" ? "sheet-title" : void 0)}
|
|
111
|
-
aria-hidden=${!this.open}
|
|
112
|
-
aria-modal=${this.open}
|
|
113
|
-
tabindex="0"
|
|
114
|
-
${F(this.sheetRef)}>
|
|
115
|
-
<div
|
|
116
|
-
class=${y(e)}
|
|
117
|
-
@click=${this.lock ? void 0 : this.handleOverlayClick}
|
|
118
|
-
></div>
|
|
119
|
-
<schmancy-grid
|
|
120
|
-
rows=${this.header === "hidden" ? "1fr" : "auto 1fr"}
|
|
121
|
-
class="content w-full"
|
|
122
|
-
data-position=${this.position}
|
|
123
|
-
>
|
|
124
|
-
${O(this.header !== "hidden" ? f`<schmancy-sheet-header
|
|
125
|
-
class="sticky top-0 z-50 w-full"
|
|
126
|
-
@dismiss=${this.handleHeaderDismiss}
|
|
127
|
-
id="sheet-title"
|
|
128
|
-
title=${v(this.title || void 0)}
|
|
129
|
-
></schmancy-sheet-header>` : "")}
|
|
130
|
-
|
|
131
|
-
<schmancy-surface rounded="left" fill="all" id="body" class="overflow-auto" type="surface">
|
|
132
|
-
<schmancy-scroll> <slot></slot></schmancy-scroll>
|
|
133
|
-
</schmancy-surface>
|
|
134
|
-
</schmancy-grid>
|
|
135
|
-
</div>
|
|
136
|
-
`;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
var l, u;
|
|
140
|
-
a([c({ type: String, reflect: !0 })], n.prototype, "uid", 2), a([c({ type: Boolean, reflect: !0 })], n.prototype, "open", 2), a([c({ type: String, reflect: !0 })], n.prototype, "header", 2), a([c({ type: String, reflect: !0 })], n.prototype, "position", 2), a([c({ type: Boolean, reflect: !0 })], n.prototype, "persist", 2), a([c({ type: Boolean, reflect: !0 })], n.prototype, "lock", 2), a([c({ type: Boolean, reflect: !0 })], n.prototype, "handleHistory", 2), a([c({ type: String, reflect: !0 })], n.prototype, "title", 2), a([S({ flatten: !0 })], n.prototype, "assignedElements", 2), a([c()], n.prototype, "focusAttribute", 2), a([(l = "open", (t, e) => {
|
|
141
|
-
const { willUpdate: s } = t;
|
|
142
|
-
u = Object.assign({ waitUntilFirstUpdate: !1 }, u), t.willUpdate = function(i) {
|
|
143
|
-
if (s.call(this, i), i.has(l)) {
|
|
144
|
-
const r = i.get(l), o = this[l];
|
|
145
|
-
r !== o && (u?.waitUntilFirstUpdate && !this.hasUpdated || this[e].call(this, r, o));
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
})], n.prototype, "onOpenChange", 1), n = a([g("schmancy-sheet")], n);
|
|
149
|
-
//# sourceMappingURL=sheet-BXNBQt5O.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sheet-BXNBQt5O.js","sources":["../src/sheet/header.ts","../src/sheet/sheet.ts","../src/sheet/hook.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\n@customElement('schmancy-sheet-header')\nexport default class SchmancySheetHeader extends TailwindElement(css``) {\n\trender() {\n\t\treturn html`\n\t\t\t<sch-flex class=\"absolute top-0 left-0 md:left-[unset] md:right-0\">\n\t\t\t\t<div class=\"block md:hidden flex-1 justify-start items-start\">\n\t\t\t\t\t<slot name=\"back\">\n\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\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\t\t<span class=\"text-[24px]\">← </span>\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"hidden md:block flex-1 justify-end items-end\">\n\t\t\t\t\t<slot name=\"actions\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\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\t\tclose\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\t\t\t</sch-flex>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet-header': SchmancySheetHeader\n\t}\n}\n","import { $LitElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, queryAssignedElements } from 'lit/decorators.js'\nimport { cache } from 'lit/directives/cache.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { createRef, ref } from 'lit/directives/ref.js'\nimport { fromEvent, merge, of, take, takeUntil, tap } from 'rxjs'\nimport { on } from './hook'\nimport style from './sheet.scss?inline'\nimport {\n\tSchmancySheetPosition,\n\tSheetHereMorty,\n\tSheetWhereAreYouRicky,\n\tSheetWhereAreYouRickyEvent,\n\tsheet,\n} from './sheet.service'\n\n@customElement('schmancy-sheet')\nexport default class SchmancySheet extends $LitElement(style) {\n\t@property({ type: String, reflect: true }) uid!: string\n\t@property({ type: Boolean, reflect: true }) open = false\n\t@property({ type: String, reflect: true }) header: 'hidden' | 'visible' = 'visible'\n\t@property({ type: String, reflect: true }) position: SchmancySheetPosition = SchmancySheetPosition.Side\n\t@property({ type: Boolean, reflect: true }) persist = false\n\t@property({ type: Boolean, reflect: true }) lock = false\n\t@property({ type: Boolean, reflect: true }) handleHistory = true\n\t@property({ type: String, reflect: true }) title = ''\n\n\t// Use ref directive instead of @query\n\tprivate sheetRef = createRef<HTMLDivElement>()\n\t@queryAssignedElements({ flatten: true }) private assignedElements!: HTMLElement[]\n\n\t@property() focusAttribute = 'autofocus'\n\tprivate lastFocusedElement: HTMLElement | null = null\n\n\t@on('open')\n\tonOpenChange(_oldValue: boolean, newValue: boolean) {\n\t\tif (newValue) {\n\t\t\tthis.lastFocusedElement = document.activeElement as HTMLElement\n\t\t\t// Use native inert attribute to prevent focus outside sheet\n\t\t\tthis.setBackgroundInert(true)\n\t\t\tthis.focus()\n\t\t} else {\n\t\t\tthis.setBackgroundInert(false)\n\t\t\tthis.lastFocusedElement?.focus()\n\t\t\tthis.lastFocusedElement = null\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setupEventListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\n\t}\n\n\tprivate setupEventListeners() {\n\t\t// Handle browser back button - only if handleHistory is true\n\t\tconst popState$ = this.handleHistory\n\t\t\t? fromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\t\ttap(e => {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tthis.closeSheet()\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: of(null).pipe(take(0)) // Empty observable if handleHistory is false\n\n\t\t// Handle ESC key - listen on the sheet element for better event capture\n\t\tconst keyUp$ = fromEvent<KeyboardEvent>(this, 'keydown').pipe(\n\t\t\ttap(event => {\n\t\t\t\tif (event.key === 'Escape' && !this.lock && this.open) {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\n\t\t// Handle inter-component communication\n\t\tconst rickyComm$ = fromEvent<SheetWhereAreYouRickyEvent>(window, SheetWhereAreYouRicky).pipe(\n\t\t\ttap(e => {\n\t\t\t\tif (e.detail.uid === this.uid) this.announcePresence()\n\t\t\t}),\n\t\t)\n\n\t\tmerge(popState$, keyUp$, rickyComm$).pipe(takeUntil(this.disconnecting)).subscribe()\n\t}\n\n\n\tprivate announcePresence() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(SheetHereMorty, {\n\t\t\t\tdetail: { sheet: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate setBackgroundInert(inert: boolean) {\n\t\t// Get all sibling elements and make them inert\n\t\tconst parent = this.parentElement\n\t\tif (parent) {\n\t\t\tArray.from(parent.children).forEach(child => {\n\t\t\t\tif (child !== this && child instanceof HTMLElement) {\n\t\t\t\t\tif (inert) {\n\t\t\t\t\t\tchild.setAttribute('inert', '')\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchild.removeAttribute('inert')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t\t\n\t\t// Also handle body's direct children if sheet is attached to body\n\t\tif (this.parentElement === document.body) {\n\t\t\tArray.from(document.body.children).forEach(child => {\n\t\t\t\tif (child !== this && child !== parent && child instanceof HTMLElement) {\n\t\t\t\t\tif (inert) {\n\t\t\t\t\t\tchild.setAttribute('inert', '')\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchild.removeAttribute('inert')\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n\n\tsetIsSheetShown(isShown: boolean) {\n\t\tthis.sheetRef.value?.setAttribute('aria-hidden', String(!isShown))\n\t\tthis.sheetRef.value?.setAttribute('aria-modal', String(isShown))\n\t}\n\n\tcloseSheet() {\n\t\tthis.open = false\n\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t}\n\n\tprivate getFocusElement(): HTMLElement | null {\n\t\tconst selector = `[${this.focusAttribute}]`\n\t\treturn (this.assignedElements.find(el => el.matches(selector) || el.querySelector(selector)) as HTMLElement) ?? null\n\t}\n\n\toverride focus() {\n\t\t// First try native autofocus attribute\n\t\tconst autofocusElement = this.querySelector('[autofocus]') as HTMLElement\n\t\tif (autofocusElement) {\n\t\t\tautofocusElement.focus()\n\t\t\treturn\n\t\t}\n\t\t\n\t\t// Fallback to custom focus attribute\n\t\tthis.getFocusElement()?.focus()\n\t}\n\n\tprivate handleOverlayClick = (e: Event) => {\n\t\te.stopPropagation()\n\t\tif (!this.lock) {\n\t\t\tsheet.dismiss(this.uid)\n\t\t}\n\t}\n\n\tprivate handleHeaderDismiss = (e: CustomEvent) => {\n\t\te.stopPropagation()\n\t\tsheet.dismiss(this.uid)\n\t}\n\n\trender() {\n\t\tconst sheetClasses = {\n\t\t\t'sheet': true,\n\t\t\t'sheet--open': this.open,\n\t\t\t'sheet--locked': this.lock,\n\t\t}\n\n\t\tconst overlayClasses = {\n\t\t\t'overlay': true,\n\t\t\t'overlay--interactive': !this.lock,\n\t\t}\n\n\t\treturn html`\n\t\t\t<div \n\t\t\t\tclass=${classMap(sheetClasses)}\n\t\t\t\trole=\"dialog\" \n\t\t\t\taria-labelledby=${ifDefined(this.header !== 'hidden' ? 'sheet-title' : undefined)}\n\t\t\t\taria-hidden=${!this.open} \n\t\t\t\taria-modal=${this.open}\n\t\t\t\ttabindex=\"0\"\n\t\t\t\t${ref(this.sheetRef)}>\n\t\t\t\t<div\n\t\t\t\t\tclass=${classMap(overlayClasses)}\n\t\t\t\t\t@click=${this.lock ? undefined : this.handleOverlayClick}\n\t\t\t\t></div>\n\t\t\t\t<schmancy-grid\n\t\t\t\t\trows=${this.header === 'hidden' ? '1fr' : 'auto 1fr'}\n\t\t\t\t\tclass=\"content w-full\"\n\t\t\t\t\tdata-position=${this.position}\n\t\t\t\t>\n\t\t\t\t\t${cache(\n\t\t\t\t\t\tthis.header !== 'hidden'\n\t\t\t\t\t\t\t? html`<schmancy-sheet-header\n\t\t\t\t\t\t\t\tclass=\"sticky top-0 z-50 w-full\"\n\t\t\t\t\t\t\t\t@dismiss=${this.handleHeaderDismiss}\n\t\t\t\t\t\t\t\tid=\"sheet-title\"\n\t\t\t\t\t\t\t\ttitle=${ifDefined(this.title || undefined)}\n\t\t\t\t\t\t\t></schmancy-sheet-header>`\n\t\t\t\t\t\t\t: ''\n\t\t\t\t\t)}\n\n\t\t\t\t\t<schmancy-surface rounded=\"left\" fill=\"all\" id=\"body\" class=\"overflow-auto\" type=\"surface\">\n\t\t\t\t\t\t<schmancy-scroll> <slot></slot></schmancy-scroll>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</schmancy-grid>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet': SchmancySheet\n\t}\n}\n","// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n\twaitUntilFirstUpdate?: boolean\n}\n\nexport function on(propName: string, options?: WatchOptions) {\n\treturn (protoOrDescriptor: any, name: string): any => {\n\t\tconst { willUpdate } = protoOrDescriptor\n\n\t\toptions = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions\n\n\t\tprotoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n\t\t\twillUpdate.call(this, changedProps)\n\n\t\t\tif (changedProps.has(propName)) {\n\t\t\t\tconst oldValue = changedProps.get(propName)\n\t\t\t\tconst newValue = this[propName]\n\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\tif (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n\t\t\t\t\t\tthis[name].call(this, oldValue, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["SchmancySheetHeader","TailwindElement","css","render","html","this","dispatchEvent","CustomEvent","bubbles","composed","customElement","SchmancySheet","$LitElement","constructor","super","arguments","open","header","position","SchmancySheetPosition","Side","persist","lock","handleHistory","title","sheetRef","createRef","focusAttribute","lastFocusedElement","handleOverlayClick","e","stopPropagation","sheet","dismiss","uid","handleHeaderDismiss","_oldValue","newValue","document","activeElement","setBackgroundInert","focus","connectedCallback","setupEventListeners","disconnectedCallback","disconnecting","next","popState$","fromEvent","window","pipe","tap","preventDefault","closeSheet","of","take","keyUp$","event","key","rickyComm$","SheetWhereAreYouRicky","detail","announcePresence","merge","takeUntil","subscribe","SheetHereMorty","inert","parent","parentElement","Array","from","children","forEach","child","HTMLElement","setAttribute","removeAttribute","body","isShown","value","String","getFocusElement","selector","assignedElements","find","el","matches","querySelector","autofocusElement","sheetClasses","overlayClasses","overlay","classMap","ifDefined","ref","cache","propName","options","__decorateClass","property","type","reflect","prototype","Boolean","queryAssignedElements","flatten","protoOrDescriptor","name","willUpdate","Object","assign","waitUntilFirstUpdate","changedProps","call","has","oldValue","get","hasUpdated"],"mappings":";;;;;;;;;;;;AAKA,IAAqBA,IAArB,cAAiDC,EAAgBC,GAAA,EAAA;AAAA,EAChE,SAAAC;AACC,WAAOC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,gBAKO,MAAA;AACRC,WAAKC,cACJ,IAAIC,YAAY,WAAW,EAC1BC,SAAAA,IACAC,UAAAA,GAAU,CAAA,CAAA;AAAA,IAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAaJ,MAAA;AACRJ,WAAKC,cACJ,IAAIC,YAAY,WAAW,EAC1BC,SAAAA,IACAC,UAAAA,GAAU,CAAA,CAAA;AAAA,IAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWnB;AAAA;AAvCoBT;;;GAArB,CADCU,EAAc,2BACMV,CAAAA;;;;;ACcrB,IAAqBW,IAArB,cAA2CC;EAA3C,cAAAC;AAAAC,UAAAA,GAAAC,SAAAA,GAE6CV,KAAAW,OAAAA,IACDX,KAAAY,SAA+B,WAC/BZ,KAAAa,WAAkCC,EAAsBC,MACvDf,KAAAgB,UAAAA,IACAhB,KAAAiB,OAAAA,IACAjB,KAAAkB,gBAAAA,IACDlB,KAAAmB,QAAQ,IAGnDnB,KAAQoB,WAAWC,EAAAA,GAGPrB,KAAAsB,iBAAiB,aAC7BtB,KAAQuB,qBAAyC,MA6HjDvB,KAAQwB,qBAAsBC,OAAAA;AAC7BA,QAAEC,gBAAAA,GACG1B,KAAKiB,QACTU,EAAMC,QA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DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("rxjs"),y=require("lit/directives/class-map.js");require("lit/directives/style-map.js");const g=require("./tailwind.mixin-DVKI3qb9.cjs"),a=require("lit/decorators.js"),u=require("lit"),E=require("./litElement.mixin-B01R2oT7.cjs"),w=require("lit/directives/cache.js"),f=require("lit/directives/if-defined.js"),v=require("lit/directives/ref.js"),d=require("./theme.component-B3Z6xZ33.cjs");var k=Object.getOwnPropertyDescriptor;let b=class extends g.TailwindElement(u.css``){render(){return u.html`
|
|
2
|
-
<sch-flex class="absolute top-0 left-0 md:left-[unset] md:right-0">
|
|
3
|
-
<div class="block md:hidden flex-1 justify-start items-start">
|
|
4
|
-
<slot name="back">
|
|
5
|
-
<schmancy-button
|
|
6
|
-
@click=${()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))}}
|
|
7
|
-
>
|
|
8
|
-
<span class="text-[24px]">← </span>
|
|
9
|
-
</schmancy-button>
|
|
10
|
-
</slot>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<div class="hidden md:block flex-1 justify-end items-end">
|
|
14
|
-
<slot name="actions">
|
|
15
|
-
<schmancy-icon-button
|
|
16
|
-
@click=${()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0}))}}
|
|
17
|
-
>
|
|
18
|
-
close
|
|
19
|
-
</schmancy-icon-button>
|
|
20
|
-
</slot>
|
|
21
|
-
</div>
|
|
22
|
-
</sch-flex>
|
|
23
|
-
`}};b=((t,e,i,s)=>{for(var h,n=s>1?void 0:s?k(e,i):e,l=t.length-1;l>=0;l--)(h=t[l])&&(n=h(n)||n);return n})([a.customElement("schmancy-sheet-header")],b);var x=Object.defineProperty,S=Object.getOwnPropertyDescriptor,r=(t,e,i,s)=>{for(var h,n=s>1?void 0:s?S(e,i):e,l=t.length-1;l>=0;l--)(h=t[l])&&(n=(s?h(e,i,n):h(n))||n);return s&&n&&x(e,i,n),n};let o=class extends E.$LitElement(":host{--overlay-color: var(--schmancy-sys-color-surface-dim);--transition-timing: cubic-bezier(.16, 1, .3, 1);--transition-duration: .25s;--sheet-radius: 0;--max-height: 100vh}.sheet{position:fixed;inset:0;z-index:999;display:flex;visibility:visible;transition:visibility var(--transition-duration) var(--transition-timing)}.sheet[aria-hidden=true]{visibility:hidden;pointer-events:none}.sheet[aria-hidden=true] .content{transform:translateY(100%)}.sheet[aria-hidden=true] .content[data-position=side]{transform:translate(100%)}.sheet[aria-hidden=true] .overlay{opacity:0}.overlay{position:absolute;inset:0;background:var(--overlay-color);opacity:.8;transition:opacity var(--transition-duration) var(--transition-timing)}.content{z-index:1;transition:transform var(--transition-duration) var(--transition-timing);overflow:hidden}.content[data-position=side]{height:100vh;height:100%;min-width:320px;max-width:90vw;width:fit-content;margin-left:auto}.content[data-position=side] #body{max-height:100vh}.content[data-position=bottom]{width:100%;margin-top:auto;border-radius:16px 16px 0 0;max-height:90vh}.content[data-position=bottom] #body{max-height:90vh}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}"){constructor(){super(...arguments),this.open=!1,this.header="visible",this.position=d.SchmancySheetPosition.Side,this.persist=!1,this.lock=!1,this.handleHistory=!0,this.title="",this.sheetRef=v.createRef(),this.focusAttribute="autofocus",this.lastFocusedElement=null,this.handleOverlayClick=t=>{t.stopPropagation(),this.lock||d.sheet.dismiss(this.uid)},this.handleHeaderDismiss=t=>{t.stopPropagation(),d.sheet.dismiss(this.uid)}}onOpenChange(t,e){e?(this.lastFocusedElement=document.activeElement,this.setBackgroundInert(!0),this.focus()):(this.setBackgroundInert(!1),this.lastFocusedElement?.focus(),this.lastFocusedElement=null)}connectedCallback(){super.connectedCallback(),this.setupEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this.disconnecting.next(!0)}setupEventListeners(){const t=this.handleHistory?c.fromEvent(window,"popstate").pipe(c.tap(s=>{s.preventDefault(),this.closeSheet()})):c.of(null).pipe(c.take(0)),e=c.fromEvent(this,"keydown").pipe(c.tap(s=>{s.key==="Escape"&&!this.lock&&this.open&&(s.preventDefault(),s.stopPropagation(),d.sheet.dismiss(this.uid))})),i=c.fromEvent(window,d.SheetWhereAreYouRicky).pipe(c.tap(s=>{s.detail.uid===this.uid&&this.announcePresence()}));c.merge(t,e,i).pipe(c.takeUntil(this.disconnecting)).subscribe()}announcePresence(){this.dispatchEvent(new CustomEvent(d.SheetHereMorty,{detail:{sheet:this},bubbles:!0,composed:!0}))}setBackgroundInert(t){const e=this.parentElement;e&&Array.from(e.children).forEach(i=>{i!==this&&i instanceof HTMLElement&&(t?i.setAttribute("inert",""):i.removeAttribute("inert"))}),this.parentElement===document.body&&Array.from(document.body.children).forEach(i=>{i!==this&&i!==e&&i instanceof HTMLElement&&(t?i.setAttribute("inert",""):i.removeAttribute("inert"))})}setIsSheetShown(t){this.sheetRef.value?.setAttribute("aria-hidden",String(!t)),this.sheetRef.value?.setAttribute("aria-modal",String(t))}closeSheet(){this.open=!1,this.dispatchEvent(new CustomEvent("close"))}getFocusElement(){const t=`[${this.focusAttribute}]`;return this.assignedElements.find(e=>e.matches(t)||e.querySelector(t))??null}focus(){const t=this.querySelector("[autofocus]");t?t.focus():this.getFocusElement()?.focus()}render(){const t={sheet:!0,"sheet--open":this.open,"sheet--locked":this.lock},e={overlay:!0,"overlay--interactive":!this.lock};return u.html`
|
|
24
|
-
<div
|
|
25
|
-
class=${y.classMap(t)}
|
|
26
|
-
role="dialog"
|
|
27
|
-
aria-labelledby=${f.ifDefined(this.header!=="hidden"?"sheet-title":void 0)}
|
|
28
|
-
aria-hidden=${!this.open}
|
|
29
|
-
aria-modal=${this.open}
|
|
30
|
-
tabindex="0"
|
|
31
|
-
${v.ref(this.sheetRef)}>
|
|
32
|
-
<div
|
|
33
|
-
class=${y.classMap(e)}
|
|
34
|
-
@click=${this.lock?void 0:this.handleOverlayClick}
|
|
35
|
-
></div>
|
|
36
|
-
<schmancy-grid
|
|
37
|
-
rows=${this.header==="hidden"?"1fr":"auto 1fr"}
|
|
38
|
-
class="content w-full"
|
|
39
|
-
data-position=${this.position}
|
|
40
|
-
>
|
|
41
|
-
${w.cache(this.header!=="hidden"?u.html`<schmancy-sheet-header
|
|
42
|
-
class="sticky top-0 z-50 w-full"
|
|
43
|
-
@dismiss=${this.handleHeaderDismiss}
|
|
44
|
-
id="sheet-title"
|
|
45
|
-
title=${f.ifDefined(this.title||void 0)}
|
|
46
|
-
></schmancy-sheet-header>`:"")}
|
|
47
|
-
|
|
48
|
-
<schmancy-surface rounded="left" fill="all" id="body" class="overflow-auto" type="surface">
|
|
49
|
-
<schmancy-scroll> <slot></slot></schmancy-scroll>
|
|
50
|
-
</schmancy-surface>
|
|
51
|
-
</schmancy-grid>
|
|
52
|
-
</div>
|
|
53
|
-
`}};var p,m;r([a.property({type:String,reflect:!0})],o.prototype,"uid",2),r([a.property({type:Boolean,reflect:!0})],o.prototype,"open",2),r([a.property({type:String,reflect:!0})],o.prototype,"header",2),r([a.property({type:String,reflect:!0})],o.prototype,"position",2),r([a.property({type:Boolean,reflect:!0})],o.prototype,"persist",2),r([a.property({type:Boolean,reflect:!0})],o.prototype,"lock",2),r([a.property({type:Boolean,reflect:!0})],o.prototype,"handleHistory",2),r([a.property({type:String,reflect:!0})],o.prototype,"title",2),r([a.queryAssignedElements({flatten:!0})],o.prototype,"assignedElements",2),r([a.property()],o.prototype,"focusAttribute",2),r([(p="open",(t,e)=>{const{willUpdate:i}=t;m=Object.assign({waitUntilFirstUpdate:!1},m),t.willUpdate=function(s){if(i.call(this,s),s.has(p)){const h=s.get(p),n=this[p];h!==n&&(m?.waitUntilFirstUpdate&&!this.hasUpdated||this[e].call(this,h,n))}}})],o.prototype,"onOpenChange",1),o=r([a.customElement("schmancy-sheet")],o);
|
|
54
|
-
//# sourceMappingURL=sheet-QLZcRUG6.cjs.map
|