epic-modals 1.0.2 → 1.0.4
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/backdrop.js +1 -0
- package/dist/core.d.ts +2 -1172
- package/dist/core.js +1 -1
- package/dist/react.js +1 -1
- package/dist/resolution.js +1 -0
- package/dist/styles/all.css +1 -0
- package/dist/styles/basic.css +1 -1
- package/dist/styles/dock.css +1 -0
- package/dist/styles/wizard.css +1 -0
- package/dist/svelte.d.ts +14 -165
- package/dist/svelte.js +1 -1
- package/dist/vanilla.d.ts +0 -24
- package/dist/vanilla.js +1 -1
- package/package.json +5 -2
package/dist/svelte.d.ts
CHANGED
|
@@ -1,178 +1,47 @@
|
|
|
1
|
-
import { AnimationDurations } from './core/config';
|
|
2
|
-
import { AnimationDurations as AnimationDurations_2 } from '../../core/config';
|
|
3
|
-
import { AppearanceConfig } from '../../core/config';
|
|
4
|
-
import { bringToFront } from './core/state';
|
|
5
|
-
import { closeAllModals } from './core/state';
|
|
6
1
|
import { closeModal } from './core/state';
|
|
7
|
-
import {
|
|
2
|
+
import { DockLabelMode } from './core/types';
|
|
3
|
+
import { DockPosition } from './core/types';
|
|
8
4
|
import { getConfig } from './core/config';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { getStateVersion } from './core/state';
|
|
13
|
-
import { isModalAnimating } from './core/state';
|
|
14
|
-
import { isModalOpen } from './core/state';
|
|
15
|
-
import { isModalRegistered } from './core/state';
|
|
16
|
-
import { linkModals } from './core/state';
|
|
17
|
-
import { minimizeModal } from './core/state';
|
|
18
|
-
import { ModalConfigOverrides } from '../../core/types';
|
|
19
|
-
import { ModalFeatures } from '../../core/config';
|
|
20
|
-
import { ModalId } from '../../core/types';
|
|
21
|
-
import { ModalLibraryConfig } from './core/config';
|
|
22
|
-
import { ModalLibraryConfig as ModalLibraryConfig_2 } from '../../core/config';
|
|
23
|
-
import { ModalState } from '../../core/types';
|
|
5
|
+
import { HeaderLayout } from './core/types';
|
|
6
|
+
import { ModalId } from './core/types';
|
|
7
|
+
import { ModalId as ModalId_2 } from '../../core/types';
|
|
24
8
|
import { openChildModal } from './core/state';
|
|
25
9
|
import { openModal } from './core/state';
|
|
26
|
-
import { ParentChildConfig } from './core/config';
|
|
27
|
-
import { ParentChildConfig as ParentChildConfig_2 } from '../../core/config';
|
|
28
|
-
import { PartialModalLibraryConfig } from '../../core/config';
|
|
29
|
-
import { PositioningConfig } from './core/config';
|
|
30
|
-
import { PositioningConfig as PositioningConfig_2 } from '../../core/config';
|
|
31
|
-
import { registerModal } from './core/state';
|
|
32
|
-
import { reorderDock } from './core/state';
|
|
33
|
-
import { resetConfig } from './core/config';
|
|
34
|
-
import { restoreAllMinimizedModals } from './core/state';
|
|
35
|
-
import { restoreModal } from './core/state';
|
|
36
|
-
import { screenCenter } from './core/utils/helpers';
|
|
37
10
|
import { setConfig } from './core/config';
|
|
38
|
-
import { setModalAnimating } from './core/state';
|
|
39
|
-
import { setRegistryFunctions } from './core/state';
|
|
40
|
-
import { setURLStateCallbacks } from './core/state';
|
|
41
|
-
import { shakeElement } from './core/state';
|
|
42
|
-
import { storeOpenSourcePosition } from './core/state';
|
|
43
11
|
import { SvelteComponent } from 'svelte';
|
|
44
|
-
import { toggleModalTransparency } from './core/state';
|
|
45
12
|
import { triggerAttention } from './core/state';
|
|
46
|
-
import { updateModalPosition } from './core/state';
|
|
47
|
-
|
|
48
|
-
export { AnimationDurations }
|
|
49
|
-
|
|
50
|
-
export { bringToFront }
|
|
51
|
-
|
|
52
|
-
export { closeAllModals }
|
|
53
13
|
|
|
54
14
|
export { closeModal }
|
|
55
15
|
|
|
56
|
-
export {
|
|
16
|
+
export { DockLabelMode }
|
|
57
17
|
|
|
58
|
-
export
|
|
18
|
+
export { DockPosition }
|
|
59
19
|
|
|
60
20
|
export { getConfig }
|
|
61
21
|
|
|
62
|
-
export {
|
|
63
|
-
|
|
64
|
-
export { getModalsStore }
|
|
65
|
-
|
|
66
|
-
export { getModalsToClose }
|
|
67
|
-
|
|
68
|
-
export declare function getReactiveConfigVersion(): number;
|
|
69
|
-
|
|
70
|
-
export declare function getReactiveStateVersion(): number;
|
|
71
|
-
|
|
72
|
-
export { getStateVersion }
|
|
73
|
-
|
|
74
|
-
export { isModalAnimating }
|
|
75
|
-
|
|
76
|
-
export { isModalOpen }
|
|
77
|
-
|
|
78
|
-
export { isModalRegistered }
|
|
79
|
-
|
|
80
|
-
export { linkModals }
|
|
81
|
-
|
|
82
|
-
export { minimizeModal }
|
|
83
|
-
|
|
84
|
-
export declare const MODAL_ID_CONTEXT: unique symbol;
|
|
22
|
+
export { HeaderLayout }
|
|
85
23
|
|
|
86
|
-
export {
|
|
24
|
+
export { ModalId }
|
|
87
25
|
|
|
88
26
|
export { openChildModal }
|
|
89
27
|
|
|
90
28
|
export { openModal }
|
|
91
29
|
|
|
92
|
-
export { ParentChildConfig }
|
|
93
|
-
|
|
94
|
-
declare type PortalTarget = string | HTMLElement | null;
|
|
95
|
-
|
|
96
|
-
export { PositioningConfig }
|
|
97
|
-
|
|
98
|
-
export { registerModal }
|
|
99
|
-
|
|
100
|
-
export declare const RENDER_ICON_CONTEXT: unique symbol;
|
|
101
|
-
|
|
102
|
-
export { reorderDock }
|
|
103
|
-
|
|
104
|
-
export { resetConfig }
|
|
105
|
-
|
|
106
|
-
export { restoreAllMinimizedModals }
|
|
107
|
-
|
|
108
|
-
export { restoreModal }
|
|
109
|
-
|
|
110
|
-
export { screenCenter }
|
|
111
|
-
|
|
112
30
|
export { setConfig }
|
|
113
31
|
|
|
114
|
-
export { setModalAnimating }
|
|
115
|
-
|
|
116
|
-
export { setRegistryFunctions }
|
|
117
|
-
|
|
118
|
-
export { setURLStateCallbacks }
|
|
119
|
-
|
|
120
|
-
export { shakeElement }
|
|
121
|
-
|
|
122
|
-
export { storeOpenSourcePosition }
|
|
123
|
-
|
|
124
32
|
export { SvelteComponent as Backdrop }
|
|
125
33
|
export { SvelteComponent as Dock }
|
|
126
34
|
export { SvelteComponent as Modal }
|
|
127
|
-
export { SvelteComponent as ModalHeader }
|
|
128
35
|
export { SvelteComponent as ModalProvider }
|
|
129
36
|
export { SvelteComponent as Portal }
|
|
130
|
-
export { SvelteComponent as ResizeHandles }
|
|
131
37
|
export { SvelteComponent as WizardModal }
|
|
132
38
|
export { SvelteComponent as WizardStep }
|
|
133
39
|
|
|
134
|
-
export { toggleModalTransparency }
|
|
135
|
-
|
|
136
|
-
export declare function trapFocus(event: KeyboardEvent, container: HTMLElement): void;
|
|
137
|
-
|
|
138
40
|
export { triggerAttention }
|
|
139
41
|
|
|
140
|
-
export
|
|
141
|
-
|
|
142
|
-
export declare function useFocusTrap(): {
|
|
143
|
-
trapFocus: typeof trapFocus;
|
|
144
|
-
focusFirstElement: typeof focusFirstElement;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
export declare function useModal(id: ModalId): UseModalReturn;
|
|
148
|
-
|
|
149
|
-
export declare function useModalConfig(options?: UseModalConfigOptions): UseModalConfigReturn;
|
|
150
|
-
|
|
151
|
-
export declare interface UseModalConfigOptions {
|
|
152
|
-
|
|
153
|
-
getModalConfig?: () => ModalConfigOverrides | undefined;
|
|
154
|
-
|
|
155
|
-
getProviderConfig?: () => PartialModalLibraryConfig | undefined;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export declare interface UseModalConfigReturn {
|
|
159
|
-
|
|
160
|
-
getEffectiveConfig: () => ModalLibraryConfig_2;
|
|
161
|
-
|
|
162
|
-
isFeatureEnabled: (feature: keyof ModalFeatures) => boolean;
|
|
163
|
-
|
|
164
|
-
getAppearance: <K extends keyof AppearanceConfig>(key: K) => AppearanceConfig[K];
|
|
42
|
+
export declare function useModal(id: ModalId_2): UseModalReturn;
|
|
165
43
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
getPositioning: <K extends keyof PositioningConfig_2>(key: K) => PositioningConfig_2[K];
|
|
169
|
-
|
|
170
|
-
getParentChild: <K extends keyof ParentChildConfig_2>(key: K) => ParentChildConfig_2[K];
|
|
171
|
-
|
|
172
|
-
getProviderConfig: () => PartialModalLibraryConfig | undefined;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export declare interface UseModalReturn {
|
|
44
|
+
declare interface UseModalReturn {
|
|
176
45
|
|
|
177
46
|
shake: () => void;
|
|
178
47
|
|
|
@@ -192,36 +61,16 @@ export declare interface UseModalReturn {
|
|
|
192
61
|
|
|
193
62
|
restore: () => void;
|
|
194
63
|
|
|
195
|
-
openChild: (childId:
|
|
64
|
+
openChild: (childId: ModalId_2, sourceElement?: HTMLElement) => void;
|
|
196
65
|
}
|
|
197
66
|
|
|
198
|
-
export declare function
|
|
199
|
-
|
|
200
|
-
export declare interface UseModalsReturn {
|
|
201
|
-
|
|
202
|
-
getModals: () => Map<ModalId, ModalState>;
|
|
67
|
+
export declare function useModalZIndex(modalId?: ModalId_2): UseModalZIndexReturn;
|
|
203
68
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
getOpenCount: () => number;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export declare function useModalZIndex(modalId?: ModalId): UseModalZIndexReturn;
|
|
210
|
-
|
|
211
|
-
export declare interface UseModalZIndexReturn {
|
|
69
|
+
declare interface UseModalZIndexReturn {
|
|
212
70
|
|
|
213
71
|
zIndex: number;
|
|
214
72
|
|
|
215
73
|
portalTarget: string | HTMLElement;
|
|
216
74
|
}
|
|
217
75
|
|
|
218
|
-
export declare function usePortal(): {
|
|
219
|
-
mount: (element: HTMLElement, target?: PortalTarget) => () => void;
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export declare function useWindowEvent(): {
|
|
223
|
-
addListener: <K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => unknown, options?: AddEventListenerOptions) => () => void;
|
|
224
|
-
addListenerEffect: <K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => unknown, options?: AddEventListenerOptions) => void;
|
|
225
|
-
};
|
|
226
|
-
|
|
227
76
|
export { }
|
package/dist/svelte.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=e=>{throw TypeError(e)},t=(t,i,n)=>(((t,i)=>{i.has(t)||e("Cannot read from private field")})(t,i),n?n.call(t):i.get(t)),i=(t,i,n)=>i.has(t)?e("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,n);import"svelte/internal/disclose-version";import*as n from"svelte/internal/client";import{getContext as r,onMount as o,setContext as a,onDestroy as s,untrack as l}from"svelte";import{subscribe as d,getStateVersion as c,openChildModal as p,restoreModal as g,minimizeModal as u,closeModal as f,openModal as m,isModalRegistered as h,getModalState as v,isModalOpen as _,bringToFront as b,triggerAttention as S,getModalsStore as w,registerModal as C,createModalRegistration as y,unregisterModal as M,hasPendingOpen as k,hasPendingClose as x,hasPendingMinimize as E,isModalAnimating as z,shakeElement as T}from"./core.js";import{bringToFront as I,closeAllModals as P,closeModal as A,getModalsStore as O,getModalsToClose as L,getStateVersion as R,isModalAnimating as D,isModalOpen as $,isModalRegistered as W,linkModals as F,minimizeModal as j,openChildModal as H,openModal as B,registerModal as N,reorderDock as V,restoreAllMinimizedModals as q,restoreModal as U,setModalAnimating as Z,setRegistryFunctions as G,setURLStateCallbacks as X,shakeElement as K,storeOpenSourcePosition as Y,toggleModalTransparency as J,triggerAttention as Q,updateModalPosition as ee}from"./core.js";import{subscribeToConfig as te,getConfigVersion as ie,getConfig as ne,setConfig as re}from"./core.js";import{getConfig as oe,getConfigVersion as ae,resetConfig as se,setConfig as le}from"./core.js";import{ModalController as de}from"./core.js";import{toDataId as ce}from"./core.js";import{FOCUSABLE_SELECTORS as pe,CSS_CLASSES as ge,RESIZE_DIRECTIONS as ue,RESIZE_DIRECTION_LABELS as fe,DATA_ATTRIBUTES as me}from"./core.js";import{createConfigResolver as he}from"./core.js";import{getModalDialogElement as ve}from"./core.js";import{screenCenter as _e}from"./core.js";import{scale as be,fly as Se,fade as we}from"svelte/transition";import{cubicOut as Ce,backOut as ye}from"svelte/easing";import{getLayerZIndex as Me,initializeStacking as ke,resetStacking as xe}from"./core.js";import{getMinimizedModals as Ee,constrainDockPosition as ze,calculateDockDragPosition as Te}from"./core.js";import{getBackdropConfig as Ie,isBackdropEnabled as Pe,hasOpenModals as Ae}from"./core.js";import{initializeResizeListener as Oe,cleanupResizeListener as Le}from"./core.js";let Re=n.state(0),De=n.state(0);function $e(){return n.get(Re)}function We(){return n.get(De)}d(()=>{n.set(Re,c(),!0)}),te(()=>{n.set(De,ie(),!0)});const Fe=Symbol("modal-render-icon"),je=Symbol("modal-id"),He=Symbol("modal-provider-config");function Be(e,t){if(!h(e))throw new Error(`Cannot call ${t}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}function Ne(e){return{shake:()=>{Be(e,"shake"),S(e)},bringToFront:()=>{Be(e,"bringToFront"),b(e)},isOpen:()=>_(e),isMinimized:()=>{$e();const t=v(e);return(null==t?void 0:t.isMinimized)??!1},isRegistered:()=>h(e),open:t=>{Be(e,"open"),m(e,t)},close:()=>{Be(e,"close"),f(e)},minimize:()=>{Be(e,"minimize"),u(e)},restore:()=>{Be(e,"restore"),g(e)},openChild:(t,i)=>{Be(e,"openChild"),p(t,e,i??document.body)}}}function Ve(){return{getModals:()=>($e(),w()),getMinimizedCount:()=>($e(),Array.from(w().values()).filter(e=>e.isMinimized).length),getOpenCount:()=>($e(),Array.from(w().values()).filter(e=>!e.isMinimized&&e.isOpen).length)}}function qe(e){return Array.from(e.querySelectorAll(pe)).filter(e=>null!==e.offsetParent||"A"===e.tagName)}function Ue(e,t){if("Tab"!==e.key)return;const i=qe(t);if(0===i.length)return void e.preventDefault();const n=i[0],r=i[i.length-1],o=document.activeElement;e.shiftKey?o===n&&(r.focus(),e.preventDefault()):o===r&&(n.focus(),e.preventDefault())}function Ze(e){const t=qe(e);return t.length>0&&(t[0].focus(),!0)}function Ge(){return{trapFocus:Ue,focusFirstElement:Ze}}const Xe="modal-portal";function Ke(){return{mount:function(e,t=null){const i=function(e){if(typeof window>"u")return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),i=document.createElement("div");return i.id=t,document.body.appendChild(i),i}}let t=document.getElementById(Xe);return t||(t=document.createElement("div"),t.id=Xe,document.body.appendChild(t)),t}(t);return i?(i.appendChild(e),()=>{e.parentNode===i&&i.removeChild(e),i.id!==Xe&&0===i.children.length&&i.parentNode&&i.parentNode.removeChild(i)}):()=>{}}}}function Ye(e){const t=r(je),i=e??t;if(!i)throw new Error("useModalZIndex: No modal ID provided and no modal context found. Either pass a modal ID or use this hook inside a Modal component.");return{get zIndex(){const e=v(i);return((null==e?void 0:e.zIndex)??ne().zIndex.base)+1},get portalTarget(){return ne().portalTarget}}}function Je(){function e(e,t,i){return typeof window>"u"?()=>{}:(window.addEventListener(e,t,i),()=>{window.removeEventListener(e,t,i)})}return{addListener:e,addListenerEffect:function(t,i,r){n.user_effect(()=>typeof window>"u"?void 0:e(t,i,r))}}}function Qe(e={}){const{getModalConfig:t,getProviderConfig:i}=e;let n;if(void 0===i)try{n=r(He)}catch{n=void 0}function o(){return void 0!==i?i():null==n?void 0:n()}const a=he({getModalConfig:t??(()=>{}),getProviderConfig:o});function s(e){return(...t)=>(We(),e(...t))}return{getEffectiveConfig:s(a.getEffectiveConfig),isFeatureEnabled:s(a.isFeatureEnabled),getAppearance:s(a.getAppearance),getAnimation:s(a.getAnimation),getPositioning:s(a.getPositioning),getParentChild:s(a.getParentChild),getProviderConfig:o}}var et=n.from_html('<div style="display: contents;"><!></div>');function tt(e,t){n.push(t,!0);let i=n.prop(t,"target",3,"body"),r=null,a=null;const{mount:s}=Ke();o(()=>(r&&(a=s(r,i())),()=>{null==a||a()}));var l=et(),d=n.child(l);n.snippet(d,()=>t.children),n.reset(l),n.bind_this(l,e=>r=e,()=>r),n.append(e,l),n.pop()}var it=n.from_html('<button type="button" aria-label="Minimize"></button>'),nt=n.from_html('<button type="button" aria-label="Toggle style"></button>'),rt=n.from_html("<div><!></div>"),ot=n.from_html("<div></div>"),at=n.from_html("<div><!></div>"),st=n.from_html("<h2> </h2>"),lt=n.from_html("<h2> </h2>"),dt=n.from_html('<div><button type="button" aria-label="Close"></button> <!> <!></div> <div><!> <div><!></div></div> <div></div>',1),ct=n.from_html("<div><!></div>"),pt=n.from_html("<div></div>"),gt=n.from_html("<div><!></div>"),ut=n.from_html("<h2> </h2>"),ft=n.from_html("<h2> </h2>"),mt=n.from_html('<button type="button" aria-label="Toggle style">◇</button>'),ht=n.from_html('<button type="button" aria-label="Minimize">–</button>'),vt=n.from_html('<div><!> <!></div> <div><!> <!> <button type="button" aria-label="Close">×</button></div>',1),_t=n.from_html("<header><!></header>");function bt(e,t){n.push(t,!0);let i=n.prop(t,"isTransparent",3,!1),o=n.prop(t,"headerLayout",3,"macos"),a=n.prop(t,"minimizable",3,!0),s=n.prop(t,"minimizeDisabled",3,!1),l=n.prop(t,"transparencyEnabled",3,!0);function d(e){return t.iconElement&&e.appendChild(t.iconElement),{destroy(){t.iconElement&&e.contains(t.iconElement)&&e.removeChild(t.iconElement)}}}const c=r(Fe),p=n.derived(()=>null==c?void 0:c()),g=n.derived(()=>"macos"===o());var u=_t();let f;u.__pointerdown=function(e){var i;e.target.closest("button")||null==(i=t.onStartDrag)||i.call(t,e)};var m=n.child(u),h=e=>{var i=dt(),r=n.first_child(i),o=n.child(r);o.__click=function(...e){var i;null==(i=t.onClose)||i.apply(this,e)};var c=n.sibling(o,2),g=e=>{var i=it();let r;i.__click=function(...e){var i;null==(i=s()?void 0:t.onMinimize)||i.apply(this,e)},n.template_effect(()=>{r=n.set_class(i,1,`${ge.headerLight??""} ${ge.headerLightMinimize??""}`,null,r,{"modal-header-light-disabled":s()}),i.disabled=s(),n.set_attribute(i,"title",s()?"Enable dock to minimize":void 0)}),n.append(e,i)};n.if(c,e=>{a()&&e(g)});var u=n.sibling(c,2),f=e=>{var i=nt();i.__click=function(...e){var i;null==(i=t.onToggleStyle)||i.apply(this,e)},n.template_effect(()=>n.set_class(i,1,`${ge.headerLight??""} ${ge.headerLightStyle??""}`)),n.append(e,i)};n.if(u,e=>{l()&&e(f)}),n.reset(r);var m=n.sibling(r,2),h=n.child(m),v=e=>{var i=rt(),r=n.child(i);n.snippet(r,()=>t.customIcon),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(ge.headerIcon))),n.append(e,i)},_=e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var t=ot();n.action(t,e=>null==d?void 0:d(e)),n.template_effect(()=>n.set_class(t,1,n.clsx(ge.headerIcon))),n.append(e,t)},a=e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var i=at(),r=n.child(i);n.snippet(r,()=>n.get(p),()=>t.icon),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(ge.headerIcon))),n.append(e,i)};n.if(r,e=>{t.icon&&n.get(p)&&e(o)},!0),n.append(e,i)};n.if(r,e=>{t.iconElement?e(o):e(a,!1)},!0),n.append(e,i)};n.if(h,e=>{t.customIcon?e(v):e(_,!1)});var b=n.sibling(h,2),S=n.child(b),w=e=>{var i=st(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_attribute(i,"id",t.titleId),n.set_class(i,1,n.clsx(ge.headerTitle)),n.set_text(r,t.title)}),n.append(e,i)},C=e=>{var i=lt(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_class(i,1,n.clsx(ge.headerTitle)),n.set_text(r,t.title)}),n.append(e,i)};n.if(S,e=>{t.titleId?e(w):e(C,!1)}),n.reset(b),n.reset(m);var y=n.sibling(m,2);n.template_effect(()=>{n.set_class(r,1,n.clsx(ge.headerTrafficLights)),n.set_class(o,1,`${ge.headerLight??""} ${ge.headerLightClose??""}`),n.set_class(m,1,n.clsx(ge.headerMacCenter)),n.set_class(b,1,n.clsx(ge.headerTitleGroup)),n.set_class(y,1,n.clsx(ge.headerMacSpacer))}),n.append(e,i)},v=e=>{var i=vt(),r=n.first_child(i),o=n.child(r),c=e=>{var i=ct(),r=n.child(i);n.snippet(r,()=>t.customIcon),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(ge.headerIcon))),n.append(e,i)},g=e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var t=pt();n.action(t,e=>null==d?void 0:d(e)),n.template_effect(()=>n.set_class(t,1,n.clsx(ge.headerIcon))),n.append(e,t)},a=e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var i=gt(),r=n.child(i);n.snippet(r,()=>n.get(p),()=>t.icon),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(ge.headerIcon))),n.append(e,i)};n.if(r,e=>{t.icon&&n.get(p)&&e(o)},!0),n.append(e,i)};n.if(r,e=>{t.iconElement?e(o):e(a,!1)},!0),n.append(e,i)};n.if(o,e=>{t.customIcon?e(c):e(g,!1)});var u=n.sibling(o,2),f=e=>{var i=ut(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_attribute(i,"id",t.titleId),n.set_class(i,1,n.clsx(ge.headerTitle)),n.set_text(r,t.title)}),n.append(e,i)},m=e=>{var i=ft(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_class(i,1,n.clsx(ge.headerTitle)),n.set_text(r,t.title)}),n.append(e,i)};n.if(u,e=>{t.titleId?e(f):e(m,!1)}),n.reset(r);var h=n.sibling(r,2),v=n.child(h),_=e=>{var i=mt();i.__click=function(...e){var i;null==(i=t.onToggleStyle)||i.apply(this,e)},n.template_effect(()=>n.set_class(i,1,`${ge.headerBtnWindows??""} ${ge.headerBtnWindowsStyle??""}`)),n.append(e,i)};n.if(v,e=>{l()&&e(_)});var b=n.sibling(v,2),S=e=>{var i=ht();let r;i.__click=function(...e){var i;null==(i=s()?void 0:t.onMinimize)||i.apply(this,e)},n.template_effect(()=>{r=n.set_class(i,1,n.clsx(ge.headerBtnWindows),null,r,{"modal-header-btn-windows-disabled":s()}),i.disabled=s(),n.set_attribute(i,"title",s()?"Enable dock to minimize":void 0)}),n.append(e,i)};n.if(b,e=>{a()&&e(S)});var w=n.sibling(b,2);w.__click=function(...e){var i;null==(i=t.onClose)||i.apply(this,e)},n.reset(h),n.template_effect(()=>{n.set_class(r,1,n.clsx(ge.headerTitleGroup)),n.set_class(h,1,n.clsx(ge.headerActions)),n.set_class(w,1,`${ge.headerBtnWindows??""} ${ge.headerBtnWindowsClose??""}`)}),n.append(e,i)};n.if(m,e=>{n.get(g)?e(h):e(v,!1)}),n.reset(u),n.template_effect(()=>f=n.set_class(u,1,n.clsx(ge.header),null,f,{"modal-header-draggable":!!t.onStartDrag,transparent:i()})),n.append(e,u),n.pop()}n.delegate(["pointerdown","click"]);var St=n.from_html('<div role="separator" tabindex="0"></div>'),wt=n.from_html('<div role="group" aria-label="Resize handles"></div>');function Ct(e,t){n.push(t,!0);var i=n.comment(),r=n.first_child(i),o=e=>{var i=wt();n.each(i,21,()=>ue,n.index,(e,i)=>{var r=St();r.__pointerdown=e=>function(e,i){var n;null==(n=t.onStartResize)||n.call(t,e,i)}(e,n.get(i)),n.template_effect(()=>{n.set_class(r,1,`${ge.resizeHandle??""} ${ge.resizePrefix??""}${n.get(i)??""}`),n.set_attribute(r,"aria-label",fe[n.get(i)]),n.set_attribute(r,"aria-orientation","n"===n.get(i)||"s"===n.get(i)?"horizontal":"vertical")}),n.append(e,r)}),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(ge.resizeHandles))),n.append(e,i)};n.if(r,e=>{t.onStartResize&&e(o)}),n.append(e,i),n.pop()}function yt(e,t){return t&&e.appendChild(t),{update(t){e.innerHTML="",t&&e.appendChild(t)},destroy(){e.innerHTML=""}}}n.delegate(["pointerdown"]);var Mt,kt,xt,Et,zt,Tt,It=n.from_html('<span class="sr-only"> </span>'),Pt=n.from_html("<div><!></div>"),At=n.from_html("<div></div>"),Ot=n.from_html("<div><!> <!> <div><!></div> <!> <!> <!></div>");function Lt(e,t){n.push(t,!0);let i=n.prop(t,"maxWidth",3,"600px"),r=n.prop(t,"autoOpen",3,!1),s=n.prop(t,"closeOnEscape",3,!0),l=n.prop(t,"skipRegistration",3,!1);a(je,()=>t.id);const d=Qe({getModalConfig:()=>t.config,getProviderConfig:()=>t.providerConfig}),c=n.derived(()=>d.getEffectiveConfig().portalTarget);let p=n.state(null),g=n.state(null),u=n.state(null);o(()=>{n.set(p,new de({id:t.id,title:t.title,icon:t.icon,config:t.config,providerConfig:t.providerConfig,maxWidth:i(),preferredHeight:t.preferredHeight,glow:t.glow,closeOnEscape:s(),autoOpen:r(),openSourcePosition:t.openSourcePosition,onClose:t.onClose,skipRegistration:l(),configHelper:d}),!0);const e=n.get(p).subscribe(e=>{n.set(g,e,!0)});return n.set(g,n.get(p).getState(),!0),()=>{var t;e(),null==(t=n.get(p))||t.destroy(),n.set(p,null)}}),n.user_effect(()=>{n.get(u)&&n.get(p)&&n.get(p).mount(n.get(u))}),n.user_effect(()=>{n.get(p)&&void 0!==t.openSourcePosition&&n.get(p).setOpenSourcePosition(t.openSourcePosition)}),n.user_effect(()=>{n.get(p)&&n.get(p).updateGlow(t.glow)});const f=n.derived(()=>ce(t.id)),m=n.derived(()=>`modal-title-${n.get(f)}`),h=n.derived(()=>t.description?`modal-desc-${n.get(f)}`:void 0),v=n.derived(()=>{var e;return(null==(e=n.get(g))?void 0:e.draggable)??!1}),_=n.derived(()=>{var e;return(null==(e=n.get(g))?void 0:e.resizable)??!1}),S=n.derived(()=>{var e;return(null==(e=n.get(g))?void 0:e.minimizable)??!1}),w=n.derived(()=>(We(),!d.isFeatureEnabled("dock"))),C=n.derived(()=>(We(),d.isFeatureEnabled("transparency"))),y=n.derived(()=>(We(),d.getAppearance("headerLayout"))),M=n.derived(()=>{var e;return(null==(e=n.get(g))?void 0:e.isVisible)??!1}),k=n.derived(()=>{var e;return(null==(e=n.get(g))?void 0:e.showOverlay)??!1}),x=n.derived(()=>{var e;return(null==(e=n.get(g))?void 0:e.overlayClosing)??!1}),E=n.derived(()=>{var e;return(null==(e=n.get(g))?void 0:e.isTransparent)??!1}),z=n.derived(()=>{const e=n.get(g);return e?Object.entries(e.style).map(([e,t])=>`${e}: ${t};`).join(" "):""});function T(e){var t;null==(t=n.get(p))||t.startDrag(e)}function I(e){var t;null==(t=n.get(p))||t.handlePointerMove(e)}function P(e){var t;null==(t=n.get(p))||t.handlePointerUp(e)}function A(e){var t;null==(t=n.get(p))||t.handleKeyDown(e)}function O(){var e;null==(e=n.get(p))||e.minimize()}function L(){var e;null==(e=n.get(p))||e.close()}function R(){var e;null==(e=n.get(p))||e.toggleTransparency()}function D(e,t){var i;null==(i=n.get(p))||i.startResize(e,t)}var $=n.comment(),W=n.first_child($),F=e=>{tt(e,{get target(){return n.get(c)},children:(e,i)=>{var r=Ot(),o=()=>b(t.id);n.attribute_effect(r,e=>({class:e,[me.modalId]:n.get(f),"data-state":n.get(g).dataState,"data-animation-phase":n.get(g).dataAnimationPhase,style:n.get(z),role:"dialog","aria-modal":"true","aria-labelledby":n.get(m),"aria-describedby":n.get(h),tabindex:"-1",onkeydown:A,onpointermove:I,onpointerup:P,onpointerdowncapture:o}),[()=>n.get(g).cssClasses.join(" ")]);var a=n.child(r),s=e=>{var i=It(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_attribute(i,"id",n.get(h)),n.set_text(r,t.description)}),n.append(e,i)};n.if(a,e=>{t.description&&e(s)});var l=n.sibling(a,2);{let e=n.derived(()=>n.get(v)?T:void 0);bt(l,{get title(){return t.title},get customIcon(){return t.customIcon},get icon(){return t.icon},get iconElement(){return t.iconElement},get isTransparent(){return n.get(E)},get titleId(){return n.get(m)},get headerLayout(){return n.get(y)},get onStartDrag(){return n.get(e)},onToggleStyle:R,onMinimize:O,onClose:L,get minimizable(){return n.get(S)},get minimizeDisabled(){return n.get(w)},get transparencyEnabled(){return n.get(C)}})}var d=n.sibling(l,2),c=n.child(d);n.snippet(c,()=>t.children??n.noop),n.reset(d),n.action(d,(e,t)=>null==yt?void 0:yt(e,t),()=>t.bodyElement);var p=n.sibling(d,2),M=e=>{var i=Pt(),r=n.child(i),o=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>t.footer),n.append(e,i)};n.if(r,e=>{t.footer&&e(o)}),n.reset(i),n.action(i,(e,t)=>null==yt?void 0:yt(e,t),()=>t.footerElement),n.template_effect(()=>n.set_class(i,1,n.clsx(ge.footer))),n.append(e,i)};n.if(p,e=>{(t.footer||t.footerElement)&&e(M)});var $=n.sibling(p,2);{let e=n.derived(()=>n.get(_)&&!n.get(g).hasChild?D:void 0);Ct($,{get onStartResize(){return n.get(e)}})}var W=n.sibling($,2),F=e=>{var t=At();let i;n.template_effect(()=>i=n.set_class(t,1,n.clsx(ge.childOverlay),null,i,{"modal-overlay-closing":n.get(x)})),n.append(e,t)};n.if(W,e=>{n.get(k)&&e(F)}),n.reset(r),n.bind_this(r,e=>n.set(u,e),()=>n.get(u)),n.template_effect(()=>n.set_class(d,1,n.clsx(ge.body))),n.append(e,r)},$$slots:{default:!0}})};n.if(W,e=>{n.get(M)&&n.get(g)&&e(F)}),n.append(e,$),n.pop()}function Rt(e,t){n.push(t,!0);let i=n.prop(t,"maxWidth",3,"600px"),r=n.prop(t,"autoOpen",3,!1),a=n.prop(t,"closeOnEscape",3,!0),l=n.state(!1);o(()=>{C(y({id:t.id,title:t.title,icon:t.icon,autoOpen:r(),glow:t.glow})),n.set(l,!0)}),s(()=>{M(t.id)});const d=n.derived(()=>{if(!n.get(l))return!1;$e();const e=v(t.id);return!!e&&(e.isOpen||e.isMinimized||k(t.id)||x(t.id)||E(t.id))});var c=n.comment(),p=n.first_child(c),g=e=>{Lt(e,{get id(){return t.id},get title(){return t.title},get icon(){return t.icon},get customIcon(){return t.customIcon},get iconElement(){return t.iconElement},get maxWidth(){return i()},get preferredHeight(){return t.preferredHeight},get autoOpen(){return r()},get openSourcePosition(){return t.openSourcePosition},get glow(){return t.glow},get config(){return t.config},get closeOnEscape(){return a()},get onClose(){return t.onClose},get children(){return t.children},get footer(){return t.footer},get bodyElement(){return t.bodyElement},get footerElement(){return t.footerElement},skipRegistration:!0})};n.if(p,e=>{n.get(d)&&e(g)}),n.append(e,c),n.pop()}class Dt{constructor(){i(this,Mt,n.state(0)),i(this,kt,n.state(-1)),i(this,xt,n.state("forward")),i(this,Et,n.state(!1)),i(this,zt,n.state(n.proxy([]))),i(this,Tt,n.state("fade-slide"))}get currentStep(){return n.get(t(this,Mt))}set currentStep(e){n.set(t(this,Mt),e,!0)}get previousStep(){return n.get(t(this,kt))}set previousStep(e){n.set(t(this,kt),e,!0)}get direction(){return n.get(t(this,xt))}set direction(e){n.set(t(this,xt),e,!0)}get isAnimating(){return n.get(t(this,Et))}set isAnimating(e){n.set(t(this,Et),e,!0)}get steps(){return n.get(t(this,zt))}set steps(e){n.set(t(this,zt),e,!0)}get transitionStyle(){return n.get(t(this,Tt))}set transitionStyle(e){n.set(t(this,Tt),e,!0)}registerStep(e){const t=this.steps.length;return this.steps=[...this.steps,e],t}unregisterStep(e){}updateStep(e,t){e>=0&&e<this.steps.length&&(this.steps=this.steps.map((i,n)=>n===e?{...i,...t}:i))}reset(){this.currentStep=0,this.previousStep=-1,this.direction="forward",this.isAnimating=!1,this.steps=[]}setTransitionStyle(e){this.transitionStyle=e}}Mt=new WeakMap,kt=new WeakMap,xt=new WeakMap,Et=new WeakMap,zt=new WeakMap,Tt=new WeakMap;var $t=n.from_html("<div><div><!></div></div>");function Wt(e,t){n.push(t,!0);let i=n.prop(t,"maxWidth",3,"500px"),r=n.prop(t,"autoOpen",3,!1),l=n.prop(t,"closeOnEscape",3,!0),d=n.prop(t,"transitionStyle",3,"fade-slide");const c=new Dt;n.user_effect(()=>{c.setTransitionStyle(d())});const p=700;function g(e){if("slide-through"!==d())return;const i=ve(t.id);if(!i)return;const n="forward"===e?"wizard-modal-slide-forward":"wizard-modal-slide-backward";i.classList.add(n),setTimeout(()=>{i.classList.remove(n)},p)}function u(){var e,i;const n=c.steps[c.currentStep];n&&!n.getCanProceed()||(c.currentStep>=c.steps.length-1?null==(e=t.onComplete)||e.call(t):(c.direction="forward",c.isAnimating=!0,c.previousStep=c.currentStep,g("forward"),"slide-through"===d()?setTimeout(()=>{var e;c.currentStep++,null==(e=t.onStepChange)||e.call(t,c.currentStep,"forward")},350):(c.currentStep++,null==(i=t.onStepChange)||i.call(t,c.currentStep,"forward")),setTimeout(()=>{c.isAnimating=!1,c.previousStep=-1},p)))}function f(){var e;c.currentStep>0&&(c.direction="backward",c.isAnimating=!0,c.previousStep=c.currentStep,g("backward"),"slide-through"===d()?setTimeout(()=>{var e;c.currentStep--,null==(e=t.onStepChange)||e.call(t,c.currentStep,"backward")},350):(c.currentStep--,null==(e=t.onStepChange)||e.call(t,c.currentStep,"backward")),setTimeout(()=>{c.isAnimating=!1,c.previousStep=-1},p))}function m(e){var i;e<c.currentStep&&e>=0&&(c.direction="backward",c.isAnimating=!0,c.previousStep=c.currentStep,g("backward"),"slide-through"===d()?setTimeout(()=>{var i;c.currentStep=e,null==(i=t.onStepChange)||i.call(t,c.currentStep,"backward")},350):(c.currentStep=e,null==(i=t.onStepChange)||i.call(t,c.currentStep,"backward")),setTimeout(()=>{c.isAnimating=!1,c.previousStep=-1},p))}a("wizard",c);const h=n.derived(()=>0===c.currentStep),_=n.derived(()=>c.steps.length>0&&c.currentStep===c.steps.length-1),b=n.derived(()=>c.steps.length>0?(c.currentStep+1)/c.steps.length*100:0),S=n.derived(()=>{var e;return(null==(e=c.steps[c.currentStep])?void 0:e.getCanProceed())??!0}),w=n.derived(()=>c.steps.length),y=n.derived(()=>({currentStep:c.currentStep,totalSteps:n.get(w),isFirstStep:n.get(h),isLastStep:n.get(_),canProceed:n.get(S),progress:n.get(b),steps:c.steps.map(e=>({title:e.title})),next:u,back:f,goToStep:m}));let z=n.state(!1),T=n.state(!1);o(()=>{C({id:t.id,title:t.title,icon:t.icon??"",isOpen:r(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:t.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),n.set(z,!0)}),s(()=>{M(t.id)});const I=n.derived(()=>{if(!n.get(z))return!1;$e();const e=v(t.id);return!!e&&(e.isOpen||e.isMinimized||k(t.id)||x(t.id)||E(t.id))});n.user_pre_effect(()=>{const e=n.get(I);e&&!n.get(T)&&c.reset(),n.set(T,e,!0)});var P=n.comment(),A=n.first_child(P),O=e=>{Lt(e,{get id(){return t.id},get title(){return t.title},get icon(){return t.icon},get customIcon(){return t.customIcon},get maxWidth(){return i()},get preferredHeight(){return t.preferredHeight},get autoOpen(){return r()},get openSourcePosition(){return t.openSourcePosition},get glow(){return t.glow},get config(){return t.config},get closeOnEscape(){return l()},get onClose(){return t.onClose},skipRegistration:!0,children:e=>{var i=$t();let r;var o=n.child(i);let a;var s=n.child(o),l=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>t.children),n.append(e,i)};n.if(s,e=>{t.children&&e(l)}),n.reset(o),n.reset(i),n.template_effect(()=>{r=n.set_class(i,1,"wizard-viewport svelte-cx8fqi",null,r,{"wizard-viewport-carousel":"slide-through"===d()}),a=n.set_class(o,1,"wizard-container svelte-cx8fqi",null,a,{"wizard-slide-forward":c.isAnimating&&"forward"===c.direction&&"slide-through"===d(),"wizard-slide-backward":c.isAnimating&&"backward"===c.direction&&"slide-through"===d()})}),n.append(e,i)},footer:e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>t.footer,()=>n.get(y)),n.append(e,i)};n.if(r,e=>{t.footer&&e(o)}),n.append(e,i)},$$slots:{default:!0,footer:!0}})};n.if(A,e=>{n.get(I)&&e(O)}),n.append(e,P),n.pop()}var Ft=n.from_html("<div><!></div>");function jt(e,t){n.push(t,!0);let i=n.prop(t,"title",3,""),a=n.prop(t,"canProceed",3,!0);const s=r("wizard");let d,c=n.state(-1);o(()=>{n.set(c,s.registerStep({title:i(),getCanProceed:()=>a()}),!0),d=a()}),n.user_effect(()=>{const e=a(),t=l(()=>n.get(c)),i=l(()=>d);t>=0&&e!==i&&(d=e,l(()=>{s.updateStep(t,{getCanProceed:()=>e})}))});const p=n.derived(()=>n.get(c)>=0&&s.currentStep===n.get(c)),g=n.derived(()=>s.direction),u=n.derived(()=>s.isAnimating),f=n.derived(()=>s.transitionStyle),m=n.derived(()=>n.get(p));var h=n.comment(),v=n.first_child(h),_=e=>{var i=Ft();let r;var o=n.child(i),a=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>t.children),n.append(e,i)};n.if(o,e=>{t.children&&e(a)}),n.reset(i),n.template_effect(()=>r=n.set_class(i,1,"wizard-step-wrapper svelte-sp1x21",null,r,{"wizard-fade-slide-left":n.get(u)&&n.get(p)&&"forward"===n.get(g)&&"fade-slide"===n.get(f),"wizard-fade-slide-right":n.get(u)&&n.get(p)&&"backward"===n.get(g)&&"fade-slide"===n.get(f)})),n.append(e,i)};n.if(v,e=>{n.get(m)&&e(_)}),n.append(e,h),n.pop()}var Ht=n.from_html('<button type="button" aria-label="Drag dock"></button>'),Bt=n.from_html("<span> </span>"),Nt=n.from_html("<span> </span>"),Vt=n.from_html("<span>+</span>"),qt=n.from_html("<span><!></span>"),Ut=n.from_html("<button><span><!></span> <!> <span></span> <!></button>"),Zt=n.from_html('<div data-dock-container="true"><div><!> <!></div></div>');function Gt(e,t){n.push(t,!0);const i=r(Fe),o=n.derived(()=>t.renderIcon??(null==i?void 0:i())),a=w(),s=n.derived(()=>(We(),ne())),l=n.derived(()=>Me("DOCK")),d=n.derived(()=>n.get(s).dock.position),c=n.derived(()=>n.get(s).dock.labelMode);let p=n.state("horizontal"),u=n.state(n.proxy({x:100,y:100})),f=n.state(null),m=n.state(!1),h={x:0,y:0},v=null;const _=n.derived(()=>($e(),Ee())),b=n.derived(()=>{switch(n.get(d)){case"left":return{x:-20,duration:250,easing:Ce};case"right":return{x:20,duration:250,easing:Ce};default:return{y:20,duration:250,easing:Ce}}});function S(e){var t;"free"===n.get(d)&&(n.set(m,!0),v=e.pointerId,h={x:e.clientX-n.get(u).x,y:e.clientY-n.get(u).y},null==(t=e.currentTarget)||t.setPointerCapture(e.pointerId),window.addEventListener("pointermove",C),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y))}function C(e){if(e.pointerId!==v||!n.get(f))return;const t=n.get(f).getBoundingClientRect();n.set(u,Te(e.clientX,e.clientY,h,t.width,t.height),!0)}function y(e){e.pointerId===v&&(n.set(m,!1),v=null,window.removeEventListener("pointermove",C),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y))}const{addListener:M}=Je();function k(){if("free"!==n.get(d)||!n.get(f))return;const e=n.get(f).getBoundingClientRect(),t=ze(n.get(u),e.width,e.height);(t.x!==n.get(u).x||t.y!==n.get(u).y)&&n.set(u,t,!0)}n.user_effect(()=>{typeof window>"u"||M("resize",k)});var x={setDockOrientation:function(e){n.set(p,e,!0)},setDockFreePosition:function(e){n.set(u,e,!0)},getDockState:function(){return{dockPosition:n.get(d),dockOrientation:n.get(p),dockFreePosition:n.get(u),dockLabelMode:n.get(c)}}},E=n.comment(),I=n.first_child(E),P=e=>{tt(e,{get target(){return n.get(s).portalTarget},children:(e,t)=>{var i=Zt();let r,s;var h=n.child(i);let v;var w=n.child(h),C=e=>{var t=Ht();let i;t.__pointerdown=S,n.template_effect(()=>i=n.set_class(t,1,n.clsx(ge.dockHandle),null,i,{"modal-dock-handle-dragging":n.get(m)})),n.append(e,t)};n.if(w,e=>{"free"===n.get(d)&&e(C)});var y=n.sibling(w,2);n.each(y,19,()=>n.get(_),e=>e.id,(e,t,i)=>{const r=n.derived(()=>n.get(t).lastChildId?a.get(n.get(t).lastChildId):null);var s=Ut(),l=e=>{z(n.get(t).id)?T(e.currentTarget):g(n.get(t).id)};n.attribute_effect(s,e=>({class:ge.dockItem,...e,"aria-label":`Restore ${n.get(t).title??""}`,onclick:l,style:n.get(t).glow?`--modal-dock-glow-color: ${n.get(t).glow.color};`:"",[n.CLASS]:{"modal-dock-item-has-glow":!!n.get(t).glow,"modal-dock-item-has-child":!!n.get(t).lastChildId,"modal-dock-item-label-beside":"beside"===n.get(c),"modal-dock-item-label-below":"below"===n.get(c)}}),[()=>({[me.modalId]:ce(n.get(t).id)})]);var d=n.child(s),p=n.child(d),u=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>n.get(o),()=>n.get(t).icon),n.append(e,i)},f=e=>{var i=Bt(),r=n.child(i,!0);n.reset(i),n.template_effect(e=>{n.set_class(i,1,n.clsx(ge.dockItemIconPlaceholder)),n.set_text(r,e)},[()=>n.get(t).title.charAt(0)]),n.append(e,i)};n.if(p,e=>{n.get(t).icon&&n.get(o)?e(u):e(f,!1)}),n.reset(d);var m=n.sibling(d,2),h=e=>{var i=Nt(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_class(i,1,n.clsx(ge.dockItemLabel)),n.set_text(r,n.get(t).title)}),n.append(e,i)};n.if(m,e=>{"hidden"!==n.get(c)&&e(h)});var v=n.sibling(m,2),_=n.sibling(v,2),b=e=>{var t=qt(),i=n.child(t),a=e=>{var t=n.comment(),i=n.first_child(t);n.snippet(i,()=>n.get(o),()=>n.get(r).icon),n.append(e,t)},s=e=>{var t=Vt();n.append(e,t)};n.if(i,e=>{n.get(r).icon&&n.get(o)?e(a):e(s,!1)}),n.reset(t),n.template_effect(()=>n.set_class(t,1,n.clsx(ge.dockChildIndicator))),n.append(e,t)};n.if(_,e=>{n.get(t).lastChildId&&n.get(r)&&e(b)}),n.reset(s),n.template_effect(()=>{n.set_class(d,1,n.clsx(ge.dockItemIcon)),n.set_class(v,1,n.clsx(ge.dockItemGlow))}),n.transition(3,s,()=>be,()=>({duration:300,delay:50*n.get(i),easing:ye,start:.5})),n.append(e,s)}),n.reset(h),n.reset(i),n.bind_this(i,e=>n.set(f,e),()=>n.get(f)),n.template_effect(()=>{r=n.set_class(i,1,n.clsx(ge.dockContainer),null,r,{"modal-dock-left":"left"===n.get(d),"modal-dock-right":"right"===n.get(d),"modal-dock-bottom":"bottom"===n.get(d),"modal-dock-free":"free"===n.get(d),"modal-dock-empty":0===n.get(_).length}),s=n.set_style(i,"free"===n.get(d)?`left: ${n.get(u).x}px; top: ${n.get(u).y}px;`:"",s,{"z-index":n.get(l)}),v=n.set_class(h,1,n.clsx(ge.dock),null,v,{"modal-dock-free-horizontal":"free"===n.get(d)&&"horizontal"===n.get(p),"modal-dock-free-vertical":"free"===n.get(d)&&"vertical"===n.get(p)})}),n.transition(3,i,()=>Se,()=>n.get(_).length>0?n.get(b):{duration:0}),n.append(e,i)},$$slots:{default:!0}})};return n.if(I,e=>{n.get(s).features.dock&&e(P)}),n.append(e,E),n.pop(x)}n.delegate(["pointerdown"]);var Xt=n.from_html('<div aria-hidden="true"></div>');function Kt(e,t){n.push(t,!0);const i=n.derived(()=>(We(),ne())),r=n.derived(()=>(We(),Ie())),o=n.derived(()=>(We(),Pe())),a=n.derived(()=>($e(),Ae())),s=n.derived(()=>Me("MODAL")-1);tt(e,{get target(){return n.get(i).portalTarget},children:(e,t)=>{var i=n.comment(),l=n.first_child(i),d=e=>{var t=Xt();let i,o;n.template_effect(()=>{i=n.set_class(t,1,n.clsx(ge.backdrop),null,i,{"backdrop-visible":n.get(r).visible,"backdrop-blocking":n.get(r).blockClicks}),o=n.set_style(t,"",o,{"z-index":n.get(s)})}),n.transition(3,t,()=>we,()=>({duration:200})),n.append(e,t)};n.if(l,e=>{n.get(a)&&n.get(o)&&e(d)}),n.append(e,i)},$$slots:{default:!0}}),n.pop()}var Yt=n.from_html("<!> <!>",1);function Jt(e,t){n.push(t,!0),l(()=>{t.config&&re(t.config)}),a(Fe,()=>t.renderIcon),a(He,()=>t.config),n.user_effect(()=>(l(()=>{ke(),Oe()}),()=>{xe(),Le()})),n.user_effect(()=>{var e;if(typeof document>"u")return;const i=ne(),n=(null==(e=t.config)?void 0:e.portalTarget)??i.portalTarget;if("string"==typeof n&&!document.querySelector(n)){const e=document.createElement("div");return e.id=n.replace("#",""),document.body.appendChild(e),()=>{e.remove()}}});var i=Yt(),r=n.first_child(i);Kt(r,{});var o=n.sibling(r,2);n.snippet(o,()=>t.children??n.noop),n.append(e,i),n.pop()}export{Kt as Backdrop,Gt as Dock,je as MODAL_ID_CONTEXT,Rt as Modal,bt as ModalHeader,Jt as ModalProvider,tt as Portal,Fe as RENDER_ICON_CONTEXT,Ct as ResizeHandles,Wt as WizardModal,jt as WizardStep,I as bringToFront,P as closeAllModals,A as closeModal,Ze as focusFirstElement,oe as getConfig,ae as getConfigVersion,O as getModalsStore,L as getModalsToClose,We as getReactiveConfigVersion,$e as getReactiveStateVersion,R as getStateVersion,D as isModalAnimating,$ as isModalOpen,W as isModalRegistered,F as linkModals,j as minimizeModal,H as openChildModal,B as openModal,N as registerModal,V as reorderDock,se as resetConfig,q as restoreAllMinimizedModals,U as restoreModal,_e as screenCenter,le as setConfig,Z as setModalAnimating,G as setRegistryFunctions,X as setURLStateCallbacks,K as shakeElement,Y as storeOpenSourcePosition,J as toggleModalTransparency,Ue as trapFocus,Q as triggerAttention,ee as updateModalPosition,Ge as useFocusTrap,Ne as useModal,Qe as useModalConfig,Ye as useModalZIndex,Ve as useModals,Ke as usePortal,Je as useWindowEvent};
|
|
1
|
+
var e=e=>{throw TypeError(e)},t=(t,i,n)=>(((t,i)=>{i.has(t)||e("Cannot read from private field")})(t,i),n?n.call(t):i.get(t)),i=(t,i,n)=>i.has(t)?e("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(t):i.set(t,n);import"svelte/internal/disclose-version";import*as n from"svelte/internal/client";import{getContext as r,onMount as o,setContext as a,onDestroy as s,untrack as l}from"svelte";import{s as d,g as c,a as p,b as g,o as u,r as f,m,c as v,d as h,i as _,e as b,f as w,h as S,t as y,j as k,C as x,R as C,k as z,M as E,l as I,D as M,n as T,p as P,u as L,q as $,v as O,w as A,x as W,y as D,z as H,A as R,B,E as F,F as j,G as q,H as G,I as N,J as K,K as X,L as Y,N as Z,O as J,P as U}from"./backdrop.js";import{c as V}from"./resolution.js";import{fade as Q,scale as ee,fly as te}from"svelte/transition";import{cubicOut as ie,backOut as ne}from"svelte/easing";let re=n.state(0),oe=n.state(0);function ae(){return n.get(re)}function se(){return n.get(oe)}d(()=>{n.set(re,c(),!0)}),p(()=>{n.set(oe,g(),!0)});const le=Symbol("modal-render-icon"),de=Symbol("modal-id"),ce=Symbol("modal-provider-config");function pe(e,t){if(!_(e))throw new Error(`Cannot call ${t}() on unregistered modal "${String(e)}". Ensure the Modal component is rendered.`)}function ge(e){return{shake:()=>{pe(e,"shake"),y(e)},bringToFront:()=>{pe(e,"bringToFront"),S(e)},isOpen:()=>w(e),isMinimized:()=>{ae();const t=b(e);return(null==t?void 0:t.isMinimized)??!1},isRegistered:()=>_(e),open:t=>{pe(e,"open"),h(e,t)},close:()=>{pe(e,"close"),v(e)},minimize:()=>{pe(e,"minimize"),m(e)},restore:()=>{pe(e,"restore"),f(e)},openChild:(t,i)=>{pe(e,"openChild"),u(t,e,i??document.body)}}}const ue="modal-portal";function fe(e){const t=r(de),i=e??t;if(!i)throw new Error("useModalZIndex: No modal ID provided and no modal context found. Either pass a modal ID or use this hook inside a Modal component.");return{get zIndex(){const e=b(i);return((null==e?void 0:e.zIndex)??k().zIndex.base)+1},get portalTarget(){return k().portalTarget}}}var me=n.from_html('<div style="display: contents;"><!></div>');function ve(e,t){n.push(t,!0);let i=n.prop(t,"target",3,"body"),r=null,a=null;const{mount:s}={mount:function(e,t=null){const i=function(e){if(typeof window>"u")return null;if(e instanceof HTMLElement)return e;if("string"==typeof e){const t=document.querySelector(e);if(t)return t;if(e.startsWith("#")){const t=e.slice(1),i=document.createElement("div");return i.id=t,document.body.appendChild(i),i}}let t=document.getElementById(ue);return t||(t=document.createElement("div"),t.id=ue,document.body.appendChild(t)),t}(t);return i?(i.appendChild(e),()=>{e.parentNode===i&&i.removeChild(e),i.id!==ue&&0===i.children.length&&i.parentNode&&i.parentNode.removeChild(i)}):()=>{}}};o(()=>(r&&(a=s(r,i())),()=>{null==a||a()}));var l=me(),d=n.child(l);n.snippet(d,()=>t.children),n.reset(l),n.bind_this(l,e=>r=e,()=>r),n.append(e,l),n.pop()}var he=n.from_html('<button type="button" aria-label="Minimize"></button>'),_e=n.from_html('<button type="button" aria-label="Toggle style"></button>'),be=n.from_html("<div><!></div>"),we=n.from_html("<div></div>"),Se=n.from_html("<div><!></div>"),ye=n.from_html("<h2> </h2>"),ke=n.from_html("<h2> </h2>"),xe=n.from_html('<div><button type="button" aria-label="Close"></button> <!> <!></div> <div><!> <div><!></div></div> <div></div>',1),Ce=n.from_html("<div><!></div>"),ze=n.from_html("<div></div>"),Ee=n.from_html("<div><!></div>"),Ie=n.from_html("<h2> </h2>"),Me=n.from_html("<h2> </h2>"),Te=n.from_html('<button type="button" aria-label="Toggle style">◇</button>'),Pe=n.from_html('<button type="button" aria-label="Minimize">–</button>'),Le=n.from_html('<div><!> <!></div> <div><!> <!> <button type="button" aria-label="Close">×</button></div>',1),$e=n.from_html("<header><!></header>");n.delegate(["pointerdown","click"]);var Oe=n.from_html('<div role="separator" tabindex="0"></div>'),Ae=n.from_html('<div role="group" aria-label="Resize handles"></div>');function We(e,t){return t&&e.appendChild(t),{update(t){e.innerHTML="",t&&e.appendChild(t)},destroy(){e.innerHTML=""}}}n.delegate(["pointerdown"]);var De=n.from_html('<span class="sr-only"> </span>'),He=n.from_html("<div><!></div>"),Re=n.from_html("<div></div>"),Be=n.from_html("<div><!> <!> <div><!></div> <!> <!> <!></div>");function Fe(e,t){n.push(t,!0);let i=n.prop(t,"maxWidth",3,"600px"),s=n.prop(t,"autoOpen",3,!1),l=n.prop(t,"closeOnEscape",3,!0),d=n.prop(t,"skipRegistration",3,!1);a(de,()=>t.id);const c=function(e={}){const{getModalConfig:t,getProviderConfig:i}=e;let n;if(void 0===i)try{n=r(ce)}catch{n=void 0}function o(){return void 0!==i?i():null==n?void 0:n()}const a=V({getModalConfig:t??(()=>{}),getProviderConfig:o});function s(e){return(...t)=>(se(),e(...t))}return{getEffectiveConfig:s(a.getEffectiveConfig),isFeatureEnabled:s(a.isFeatureEnabled),getAppearance:s(a.getAppearance),getAnimation:s(a.getAnimation),getPositioning:s(a.getPositioning),getParentChild:s(a.getParentChild),getProviderConfig:o}}({getModalConfig:()=>t.config,getProviderConfig:()=>t.providerConfig}),p=n.derived(()=>c.getEffectiveConfig().portalTarget);let g=n.state(null),u=n.state(null),f=n.state(null);o(()=>{n.set(g,new E({id:t.id,title:t.title,icon:t.icon,config:t.config,providerConfig:t.providerConfig,maxWidth:i(),preferredHeight:t.preferredHeight,glow:t.glow,closeOnEscape:l(),autoOpen:s(),openSourcePosition:t.openSourcePosition,onClose:t.onClose,skipRegistration:d(),configHelper:c}),!0);const e=n.get(g).subscribe(e=>{n.set(u,e,!0)});return n.set(u,n.get(g).getState(),!0),()=>{var t;e(),null==(t=n.get(g))||t.destroy(),n.set(g,null)}}),n.user_effect(()=>{n.get(f)&&n.get(g)&&n.get(g).mount(n.get(f))}),n.user_effect(()=>{n.get(g)&&void 0!==t.openSourcePosition&&n.get(g).setOpenSourcePosition(t.openSourcePosition)}),n.user_effect(()=>{n.get(g)&&n.get(g).updateGlow(t.glow)});const m=n.derived(()=>I(t.id)),v=n.derived(()=>`modal-title-${n.get(m)}`),h=n.derived(()=>t.description?`modal-desc-${n.get(m)}`:void 0),_=n.derived(()=>{var e;return(null==(e=n.get(u))?void 0:e.draggable)??!1}),b=n.derived(()=>{var e;return(null==(e=n.get(u))?void 0:e.resizable)??!1}),w=n.derived(()=>{var e;return(null==(e=n.get(u))?void 0:e.minimizable)??!1}),y=n.derived(()=>(se(),!c.isFeatureEnabled("dock"))),k=n.derived(()=>(se(),c.isFeatureEnabled("transparency"))),T=n.derived(()=>(se(),c.getAppearance("headerLayout"))),P=n.derived(()=>{var e;return(null==(e=n.get(u))?void 0:e.isVisible)??!1}),L=n.derived(()=>{var e;return(null==(e=n.get(u))?void 0:e.showOverlay)??!1}),$=n.derived(()=>{var e;return(null==(e=n.get(u))?void 0:e.overlayClosing)??!1}),O=n.derived(()=>{var e;return(null==(e=n.get(u))?void 0:e.isTransparent)??!1}),A=n.derived(()=>{const e=n.get(u);return e?Object.entries(e.style).map(([e,t])=>`${e}: ${t};`).join(" "):""});function W(e){var t;null==(t=n.get(g))||t.startDrag(e)}function D(e){var t;null==(t=n.get(g))||t.handlePointerMove(e)}function H(e){var t;null==(t=n.get(g))||t.handlePointerUp(e)}function R(e){var t;null==(t=n.get(g))||t.handleKeyDown(e)}function B(){var e;null==(e=n.get(g))||e.minimize()}function F(){var e;null==(e=n.get(g))||e.close()}function j(){var e;null==(e=n.get(g))||e.toggleTransparency()}function q(e,t){var i;null==(i=n.get(g))||i.startResize(e,t)}var G=n.comment(),N=n.first_child(G),K=e=>{ve(e,{get target(){return n.get(p)},children:(e,i)=>{var o=Be(),a=()=>S(t.id);n.attribute_effect(o,e=>({class:e,[M.modalId]:n.get(m),"data-state":n.get(u).dataState,"data-animation-phase":n.get(u).dataAnimationPhase,style:n.get(A),role:"dialog","aria-modal":"true","aria-labelledby":n.get(v),"aria-describedby":n.get(h),tabindex:"-1",onkeydown:R,onpointermove:D,onpointerup:H,onpointerdowncapture:a}),[()=>n.get(u).cssClasses.join(" ")]);var s=n.child(o),l=e=>{var i=De(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_attribute(i,"id",n.get(h)),n.set_text(r,t.description)}),n.append(e,i)};n.if(s,e=>{t.description&&e(l)});var d=n.sibling(s,2);{let e=n.derived(()=>n.get(_)?W:void 0);!function(e,t){n.push(t,!0);let i=n.prop(t,"isTransparent",3,!1),o=n.prop(t,"headerLayout",3,"macos"),a=n.prop(t,"minimizable",3,!0),s=n.prop(t,"minimizeDisabled",3,!1),l=n.prop(t,"transparencyEnabled",3,!0);function d(e){return t.iconElement&&e.appendChild(t.iconElement),{destroy(){t.iconElement&&e.contains(t.iconElement)&&e.removeChild(t.iconElement)}}}const c=r(le),p=n.derived(()=>null==c?void 0:c()),g=n.derived(()=>"macos"===o());var u=$e();let f;u.__pointerdown=function(e){var i;e.target.closest("button")||null==(i=t.onStartDrag)||i.call(t,e)};var m=n.child(u),v=e=>{var i=xe(),r=n.first_child(i),o=n.child(r);o.__click=function(...e){var i;null==(i=t.onClose)||i.apply(this,e)};var c=n.sibling(o,2),g=e=>{var i=he();let r;i.__click=function(...e){var i;null==(i=s()?void 0:t.onMinimize)||i.apply(this,e)},n.template_effect(()=>{r=n.set_class(i,1,`${x.headerLight} ${x.headerLightMinimize}`,null,r,{"modal-header-light-disabled":s()}),i.disabled=s(),n.set_attribute(i,"title",s()?"Enable dock to minimize":void 0)}),n.append(e,i)};n.if(c,e=>{a()&&e(g)});var u=n.sibling(c,2),f=e=>{var i=_e();i.__click=function(...e){var i;null==(i=t.onToggleStyle)||i.apply(this,e)},n.template_effect(()=>n.set_class(i,1,`${x.headerLight} ${x.headerLightStyle}`)),n.append(e,i)};n.if(u,e=>{l()&&e(f)}),n.reset(r);var m=n.sibling(r,2),v=n.child(m),h=e=>{var i=be(),r=n.child(i);n.snippet(r,()=>t.customIcon),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(x.headerIcon))),n.append(e,i)},_=e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var t=we();n.action(t,e=>null==d?void 0:d(e)),n.template_effect(()=>n.set_class(t,1,n.clsx(x.headerIcon))),n.append(e,t)},a=e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var i=Se(),r=n.child(i);n.snippet(r,()=>n.get(p),()=>t.icon),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(x.headerIcon))),n.append(e,i)};n.if(r,e=>{t.icon&&n.get(p)&&e(o)},!0),n.append(e,i)};n.if(r,e=>{t.iconElement?e(o):e(a,!1)},!0),n.append(e,i)};n.if(v,e=>{t.customIcon?e(h):e(_,!1)});var b=n.sibling(v,2),w=n.child(b),S=e=>{var i=ye(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_attribute(i,"id",t.titleId),n.set_class(i,1,n.clsx(x.headerTitle)),n.set_text(r,t.title)}),n.append(e,i)},y=e=>{var i=ke(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_class(i,1,n.clsx(x.headerTitle)),n.set_text(r,t.title)}),n.append(e,i)};n.if(w,e=>{t.titleId?e(S):e(y,!1)}),n.reset(b),n.reset(m);var k=n.sibling(m,2);n.template_effect(()=>{n.set_class(r,1,n.clsx(x.headerTrafficLights)),n.set_class(o,1,`${x.headerLight} ${x.headerLightClose}`),n.set_class(m,1,n.clsx(x.headerMacCenter)),n.set_class(b,1,n.clsx(x.headerTitleGroup)),n.set_class(k,1,n.clsx(x.headerMacSpacer))}),n.append(e,i)},h=e=>{var i=Le(),r=n.first_child(i),o=n.child(r),c=e=>{var i=Ce(),r=n.child(i);n.snippet(r,()=>t.customIcon),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(x.headerIcon))),n.append(e,i)},g=e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var t=ze();n.action(t,e=>null==d?void 0:d(e)),n.template_effect(()=>n.set_class(t,1,n.clsx(x.headerIcon))),n.append(e,t)},a=e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var i=Ee(),r=n.child(i);n.snippet(r,()=>n.get(p),()=>t.icon),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(x.headerIcon))),n.append(e,i)};n.if(r,e=>{t.icon&&n.get(p)&&e(o)},!0),n.append(e,i)};n.if(r,e=>{t.iconElement?e(o):e(a,!1)},!0),n.append(e,i)};n.if(o,e=>{t.customIcon?e(c):e(g,!1)});var u=n.sibling(o,2),f=e=>{var i=Ie(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_attribute(i,"id",t.titleId),n.set_class(i,1,n.clsx(x.headerTitle)),n.set_text(r,t.title)}),n.append(e,i)},m=e=>{var i=Me(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_class(i,1,n.clsx(x.headerTitle)),n.set_text(r,t.title)}),n.append(e,i)};n.if(u,e=>{t.titleId?e(f):e(m,!1)}),n.reset(r);var v=n.sibling(r,2),h=n.child(v),_=e=>{var i=Te();i.__click=function(...e){var i;null==(i=t.onToggleStyle)||i.apply(this,e)},n.template_effect(()=>n.set_class(i,1,`${x.headerBtnWindows} ${x.headerBtnWindowsStyle}`)),n.append(e,i)};n.if(h,e=>{l()&&e(_)});var b=n.sibling(h,2),w=e=>{var i=Pe();let r;i.__click=function(...e){var i;null==(i=s()?void 0:t.onMinimize)||i.apply(this,e)},n.template_effect(()=>{r=n.set_class(i,1,n.clsx(x.headerBtnWindows),null,r,{"modal-header-btn-windows-disabled":s()}),i.disabled=s(),n.set_attribute(i,"title",s()?"Enable dock to minimize":void 0)}),n.append(e,i)};n.if(b,e=>{a()&&e(w)});var S=n.sibling(b,2);S.__click=function(...e){var i;null==(i=t.onClose)||i.apply(this,e)},n.reset(v),n.template_effect(()=>{n.set_class(r,1,n.clsx(x.headerTitleGroup)),n.set_class(v,1,n.clsx(x.headerActions)),n.set_class(S,1,`${x.headerBtnWindows} ${x.headerBtnWindowsClose}`)}),n.append(e,i)};n.if(m,e=>{n.get(g)?e(v):e(h,!1)}),n.reset(u),n.template_effect(()=>f=n.set_class(u,1,n.clsx(x.header),null,f,{"modal-header-draggable":!!t.onStartDrag,transparent:i()})),n.append(e,u),n.pop()}(d,{get title(){return t.title},get customIcon(){return t.customIcon},get icon(){return t.icon},get iconElement(){return t.iconElement},get isTransparent(){return n.get(O)},get titleId(){return n.get(v)},get headerLayout(){return n.get(T)},get onStartDrag(){return n.get(e)},onToggleStyle:j,onMinimize:B,onClose:F,get minimizable(){return n.get(w)},get minimizeDisabled(){return n.get(y)},get transparencyEnabled(){return n.get(k)}})}var c=n.sibling(d,2),p=n.child(c);n.snippet(p,()=>t.children??n.noop),n.reset(c),n.action(c,(e,t)=>null==We?void 0:We(e,t),()=>t.bodyElement);var g=n.sibling(c,2),E=e=>{var i=He(),r=n.child(i),o=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>t.footer),n.append(e,i)};n.if(r,e=>{t.footer&&e(o)}),n.reset(i),n.action(i,(e,t)=>null==We?void 0:We(e,t),()=>t.footerElement),n.template_effect(()=>n.set_class(i,1,n.clsx(x.footer))),n.append(e,i)};n.if(g,e=>{(t.footer||t.footerElement)&&e(E)});var I=n.sibling(g,2);{let e=n.derived(()=>n.get(b)&&!n.get(u).hasChild?q:void 0);!function(e,t){n.push(t,!0);var i=n.comment(),r=n.first_child(i),o=e=>{var i=Ae();n.each(i,21,()=>C,n.index,(e,i)=>{var r=Oe();r.__pointerdown=e=>function(e,i){var n;null==(n=t.onStartResize)||n.call(t,e,i)}(e,n.get(i)),n.template_effect(()=>{n.set_class(r,1,`${x.resizeHandle} ${x.resizePrefix}${n.get(i)??""}`),n.set_attribute(r,"aria-label",z[n.get(i)]),n.set_attribute(r,"aria-orientation","n"===n.get(i)||"s"===n.get(i)?"horizontal":"vertical")}),n.append(e,r)}),n.reset(i),n.template_effect(()=>n.set_class(i,1,n.clsx(x.resizeHandles))),n.append(e,i)};n.if(r,e=>{t.onStartResize&&e(o)}),n.append(e,i),n.pop()}(I,{get onStartResize(){return n.get(e)}})}var P=n.sibling(I,2),G=e=>{var t=Re();let i;n.template_effect(()=>i=n.set_class(t,1,n.clsx(x.childOverlay),null,i,{"modal-overlay-closing":n.get($)})),n.append(e,t)};n.if(P,e=>{n.get(L)&&e(G)}),n.reset(o),n.bind_this(o,e=>n.set(f,e),()=>n.get(f)),n.template_effect(()=>n.set_class(c,1,n.clsx(x.body))),n.append(e,o)},$$slots:{default:!0}})};n.if(N,e=>{n.get(P)&&n.get(u)&&e(K)}),n.append(e,G),n.pop()}function je(e,t){n.push(t,!0);let i=n.prop(t,"maxWidth",3,"600px"),r=n.prop(t,"autoOpen",3,!1),a=n.prop(t,"closeOnEscape",3,!0),l=n.state(!1);o(()=>{T(P({id:t.id,title:t.title,icon:t.icon,autoOpen:r(),glow:t.glow})),n.set(l,!0)}),s(()=>{L(t.id)});const d=n.derived(()=>{if(!n.get(l))return!1;ae();const e=b(t.id);return!!e&&(e.isOpen||e.isMinimized||$(t.id)||O(t.id)||A(t.id))});var c=n.comment(),p=n.first_child(c),g=e=>{Fe(e,{get id(){return t.id},get title(){return t.title},get icon(){return t.icon},get customIcon(){return t.customIcon},get iconElement(){return t.iconElement},get maxWidth(){return i()},get preferredHeight(){return t.preferredHeight},get autoOpen(){return r()},get openSourcePosition(){return t.openSourcePosition},get glow(){return t.glow},get config(){return t.config},get closeOnEscape(){return a()},get onClose(){return t.onClose},get children(){return t.children},get footer(){return t.footer},get bodyElement(){return t.bodyElement},get footerElement(){return t.footerElement},skipRegistration:!0})};n.if(p,e=>{n.get(d)&&e(g)}),n.append(e,c),n.pop()}var qe=n.from_html('<div aria-hidden="true"></div>');function Ge(e,t){n.push(t,!0);const i=n.derived(()=>(se(),k())),r=n.derived(()=>(se(),W())),o=n.derived(()=>(se(),D())),a=n.derived(()=>(ae(),H())),s=n.derived(()=>R("MODAL")-1);ve(e,{get target(){return n.get(i).portalTarget},children:(e,t)=>{var i=n.comment(),l=n.first_child(i),d=e=>{var t=qe();let i,o;n.template_effect(()=>{i=n.set_class(t,1,n.clsx(x.backdrop),null,i,{"backdrop-visible":n.get(r).visible,"backdrop-blocking":n.get(r).blockClicks}),o=n.set_style(t,"",o,{"z-index":n.get(s)})}),n.transition(3,t,()=>Q,()=>({duration:200})),n.append(e,t)};n.if(l,e=>{n.get(a)&&n.get(o)&&e(d)}),n.append(e,i)},$$slots:{default:!0}}),n.pop()}var Ne=n.from_html("<!> <!>",1);function Ke(e,t){n.push(t,!0),l(()=>{t.config&&B(t.config)}),a(le,()=>t.renderIcon),a(ce,()=>t.config),n.user_effect(()=>(l(()=>{F(),j()}),()=>{q(),G()})),n.user_effect(()=>{var e;if(typeof document>"u")return;const i=k(),n=(null==(e=t.config)?void 0:e.portalTarget)??i.portalTarget;if("string"==typeof n&&!document.querySelector(n)){const e=document.createElement("div");return e.id=n.replace("#",""),document.body.appendChild(e),()=>{e.remove()}}});var i=Ne(),r=n.first_child(i);Ge(r,{});var o=n.sibling(r,2);n.snippet(o,()=>t.children??n.noop),n.append(e,i),n.pop()}var Xe,Ye,Ze,Je,Ue,Ve,Qe=n.from_html('<button type="button" aria-label="Drag dock"></button>'),et=n.from_html("<span> </span>"),tt=n.from_html("<span> </span>"),it=n.from_html("<span>+</span>"),nt=n.from_html("<span><!></span>"),rt=n.from_html("<button><span><!></span> <!> <span></span> <!></button>"),ot=n.from_html('<div data-dock-container="true"><div><!> <!></div></div>');function at(e,t){n.push(t,!0);const i=r(le),o=n.derived(()=>t.renderIcon??(null==i?void 0:i())),a=Z(),s=n.derived(()=>(se(),k())),l=n.derived(()=>R("DOCK")),d=n.derived(()=>n.get(s).dock.position),c=n.derived(()=>n.get(s).dock.labelMode);let p=n.state("horizontal"),g=n.state(n.proxy({x:100,y:100})),u=n.state(null),m=n.state(!1),v={x:0,y:0},h=null;const _=n.derived(()=>(ae(),N())),b=n.derived(()=>{switch(n.get(d)){case"left":return{x:-20,duration:250,easing:ie};case"right":return{x:20,duration:250,easing:ie};default:return{y:20,duration:250,easing:ie}}});function w(e){var t;"free"===n.get(d)&&(n.set(m,!0),h=e.pointerId,v={x:e.clientX-n.get(g).x,y:e.clientY-n.get(g).y},null==(t=e.currentTarget)||t.setPointerCapture(e.pointerId),window.addEventListener("pointermove",S),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y))}function S(e){if(e.pointerId!==h||!n.get(u))return;const t=n.get(u).getBoundingClientRect();n.set(g,J(e.clientX,e.clientY,v,t.width,t.height),!0)}function y(e){e.pointerId===h&&(n.set(m,!1),h=null,window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y))}const{addListener:C}=function(){function e(e,t,i){return typeof window>"u"?()=>{}:(window.addEventListener(e,t,i),()=>{window.removeEventListener(e,t,i)})}return{addListener:e,addListenerEffect:function(t,i,r){n.user_effect(()=>typeof window>"u"?void 0:e(t,i,r))}}}();function z(){if("free"!==n.get(d)||!n.get(u))return;const e=n.get(u).getBoundingClientRect(),t=K(n.get(g),e.width,e.height);(t.x!==n.get(g).x||t.y!==n.get(g).y)&&n.set(g,t,!0)}n.user_effect(()=>{typeof window>"u"||C("resize",z)});var E={setDockOrientation:function(e){n.set(p,e,!0)},setDockFreePosition:function(e){n.set(g,e,!0)},getDockState:function(){return{dockPosition:n.get(d),dockOrientation:n.get(p),dockFreePosition:n.get(g),dockLabelMode:n.get(c)}}},T=n.comment(),P=n.first_child(T),L=e=>{ve(e,{get target(){return n.get(s).portalTarget},children:(e,t)=>{var i=ot();let r,s;var v=n.child(i);let h;var S=n.child(v),y=e=>{var t=Qe();let i;t.__pointerdown=w,n.template_effect(()=>i=n.set_class(t,1,n.clsx(x.dockHandle),null,i,{"modal-dock-handle-dragging":n.get(m)})),n.append(e,t)};n.if(S,e=>{"free"===n.get(d)&&e(y)});var k=n.sibling(S,2);n.each(k,19,()=>n.get(_),e=>e.id,(e,t,i)=>{const r=n.derived(()=>n.get(t).lastChildId?a.get(n.get(t).lastChildId):null);var s=rt(),l=e=>{X(n.get(t).id)?Y(e.currentTarget):f(n.get(t).id)};n.attribute_effect(s,e=>({class:x.dockItem,...e,"aria-label":`Restore ${n.get(t).title??""}`,onclick:l,style:n.get(t).glow?`--modal-dock-glow-color: ${n.get(t).glow.color};`:"",[n.CLASS]:{"modal-dock-item-has-glow":!!n.get(t).glow,"modal-dock-item-has-child":!!n.get(t).lastChildId,"modal-dock-item-label-beside":"beside"===n.get(c),"modal-dock-item-label-below":"below"===n.get(c)}}),[()=>({[M.modalId]:I(n.get(t).id)})]);var d=n.child(s),p=n.child(d),g=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>n.get(o),()=>n.get(t).icon),n.append(e,i)},u=e=>{var i=et(),r=n.child(i,!0);n.reset(i),n.template_effect(e=>{n.set_class(i,1,n.clsx(x.dockItemIconPlaceholder)),n.set_text(r,e)},[()=>n.get(t).title.charAt(0)]),n.append(e,i)};n.if(p,e=>{n.get(t).icon&&n.get(o)?e(g):e(u,!1)}),n.reset(d);var m=n.sibling(d,2),v=e=>{var i=tt(),r=n.child(i,!0);n.reset(i),n.template_effect(()=>{n.set_class(i,1,n.clsx(x.dockItemLabel)),n.set_text(r,n.get(t).title)}),n.append(e,i)};n.if(m,e=>{"hidden"!==n.get(c)&&e(v)});var h=n.sibling(m,2),_=n.sibling(h,2),b=e=>{var t=nt(),i=n.child(t),a=e=>{var t=n.comment(),i=n.first_child(t);n.snippet(i,()=>n.get(o),()=>n.get(r).icon),n.append(e,t)},s=e=>{var t=it();n.append(e,t)};n.if(i,e=>{n.get(r).icon&&n.get(o)?e(a):e(s,!1)}),n.reset(t),n.template_effect(()=>n.set_class(t,1,n.clsx(x.dockChildIndicator))),n.append(e,t)};n.if(_,e=>{n.get(t).lastChildId&&n.get(r)&&e(b)}),n.reset(s),n.template_effect(()=>{n.set_class(d,1,n.clsx(x.dockItemIcon)),n.set_class(h,1,n.clsx(x.dockItemGlow))}),n.transition(3,s,()=>ee,()=>({duration:300,delay:50*n.get(i),easing:ne,start:.5})),n.append(e,s)}),n.reset(v),n.reset(i),n.bind_this(i,e=>n.set(u,e),()=>n.get(u)),n.template_effect(()=>{r=n.set_class(i,1,n.clsx(x.dockContainer),null,r,{"modal-dock-left":"left"===n.get(d),"modal-dock-right":"right"===n.get(d),"modal-dock-bottom":"bottom"===n.get(d),"modal-dock-free":"free"===n.get(d),"modal-dock-empty":0===n.get(_).length}),s=n.set_style(i,"free"===n.get(d)?`left: ${n.get(g).x}px; top: ${n.get(g).y}px;`:"",s,{"z-index":n.get(l)}),h=n.set_class(v,1,n.clsx(x.dock),null,h,{"modal-dock-free-horizontal":"free"===n.get(d)&&"horizontal"===n.get(p),"modal-dock-free-vertical":"free"===n.get(d)&&"vertical"===n.get(p)})}),n.transition(3,i,()=>te,()=>n.get(_).length>0?n.get(b):{duration:0}),n.append(e,i)},$$slots:{default:!0}})};return n.if(P,e=>{n.get(s).features.dock&&e(L)}),n.append(e,T),n.pop(E)}n.delegate(["pointerdown"]);class st{constructor(){i(this,Xe,n.state(0)),i(this,Ye,n.state(-1)),i(this,Ze,n.state("forward")),i(this,Je,n.state(!1)),i(this,Ue,n.state(n.proxy([]))),i(this,Ve,n.state("fade-slide"))}get currentStep(){return n.get(t(this,Xe))}set currentStep(e){n.set(t(this,Xe),e,!0)}get previousStep(){return n.get(t(this,Ye))}set previousStep(e){n.set(t(this,Ye),e,!0)}get direction(){return n.get(t(this,Ze))}set direction(e){n.set(t(this,Ze),e,!0)}get isAnimating(){return n.get(t(this,Je))}set isAnimating(e){n.set(t(this,Je),e,!0)}get steps(){return n.get(t(this,Ue))}set steps(e){n.set(t(this,Ue),e,!0)}get transitionStyle(){return n.get(t(this,Ve))}set transitionStyle(e){n.set(t(this,Ve),e,!0)}registerStep(e){const t=this.steps.length;return this.steps=[...this.steps,e],t}unregisterStep(e){}updateStep(e,t){e>=0&&e<this.steps.length&&(this.steps=this.steps.map((i,n)=>n===e?{...i,...t}:i))}reset(){this.currentStep=0,this.previousStep=-1,this.direction="forward",this.isAnimating=!1,this.steps=[]}setTransitionStyle(e){this.transitionStyle=e}}Xe=new WeakMap,Ye=new WeakMap,Ze=new WeakMap,Je=new WeakMap,Ue=new WeakMap,Ve=new WeakMap;var lt=n.from_html("<div><div><!></div></div>");function dt(e,t){n.push(t,!0);let i=n.prop(t,"maxWidth",3,"500px"),r=n.prop(t,"autoOpen",3,!1),l=n.prop(t,"closeOnEscape",3,!0),d=n.prop(t,"transitionStyle",3,"fade-slide");const c=new st;n.user_effect(()=>{c.setTransitionStyle(d())});const p=700;function g(e){if("slide-through"!==d())return;const i=U(t.id);if(!i)return;const n="forward"===e?"wizard-modal-slide-forward":"wizard-modal-slide-backward";i.classList.add(n),setTimeout(()=>{i.classList.remove(n)},p)}function u(){var e,i;const n=c.steps[c.currentStep];n&&!n.getCanProceed()||(c.currentStep>=c.steps.length-1?null==(e=t.onComplete)||e.call(t):(c.direction="forward",c.isAnimating=!0,c.previousStep=c.currentStep,g("forward"),"slide-through"===d()?setTimeout(()=>{var e;c.currentStep++,null==(e=t.onStepChange)||e.call(t,c.currentStep,"forward")},350):(c.currentStep++,null==(i=t.onStepChange)||i.call(t,c.currentStep,"forward")),setTimeout(()=>{c.isAnimating=!1,c.previousStep=-1},p)))}function f(){var e;c.currentStep>0&&(c.direction="backward",c.isAnimating=!0,c.previousStep=c.currentStep,g("backward"),"slide-through"===d()?setTimeout(()=>{var e;c.currentStep--,null==(e=t.onStepChange)||e.call(t,c.currentStep,"backward")},350):(c.currentStep--,null==(e=t.onStepChange)||e.call(t,c.currentStep,"backward")),setTimeout(()=>{c.isAnimating=!1,c.previousStep=-1},p))}function m(e){var i;e<c.currentStep&&e>=0&&(c.direction="backward",c.isAnimating=!0,c.previousStep=c.currentStep,g("backward"),"slide-through"===d()?setTimeout(()=>{var i;c.currentStep=e,null==(i=t.onStepChange)||i.call(t,c.currentStep,"backward")},350):(c.currentStep=e,null==(i=t.onStepChange)||i.call(t,c.currentStep,"backward")),setTimeout(()=>{c.isAnimating=!1,c.previousStep=-1},p))}a("wizard",c);const v=n.derived(()=>0===c.currentStep),h=n.derived(()=>c.steps.length>0&&c.currentStep===c.steps.length-1),_=n.derived(()=>c.steps.length>0?(c.currentStep+1)/c.steps.length*100:0),w=n.derived(()=>{var e;return(null==(e=c.steps[c.currentStep])?void 0:e.getCanProceed())??!0}),S=n.derived(()=>c.steps.length),y=n.derived(()=>({currentStep:c.currentStep,totalSteps:n.get(S),isFirstStep:n.get(v),isLastStep:n.get(h),canProceed:n.get(w),progress:n.get(_),steps:c.steps.map(e=>({title:e.title})),next:u,back:f,goToStep:m}));let k=n.state(!1),x=n.state(!1);o(()=>{T({id:t.id,title:t.title,icon:t.icon??"",isOpen:r(),isMinimized:!1,isHiddenWithParent:!1,isTransparent:!1,isRejected:!1,position:null,size:null,hasBeenDragged:!1,dockPosition:0,glow:t.glow??null,parentId:void 0,childId:void 0,offsetFromParent:void 0}),n.set(k,!0)}),s(()=>{L(t.id)});const C=n.derived(()=>{if(!n.get(k))return!1;ae();const e=b(t.id);return!!e&&(e.isOpen||e.isMinimized||$(t.id)||O(t.id)||A(t.id))});n.user_pre_effect(()=>{const e=n.get(C);e&&!n.get(x)&&c.reset(),n.set(x,e,!0)});var z=n.comment(),E=n.first_child(z),I=e=>{Fe(e,{get id(){return t.id},get title(){return t.title},get icon(){return t.icon},get customIcon(){return t.customIcon},get maxWidth(){return i()},get preferredHeight(){return t.preferredHeight},get autoOpen(){return r()},get openSourcePosition(){return t.openSourcePosition},get glow(){return t.glow},get config(){return t.config},get closeOnEscape(){return l()},get onClose(){return t.onClose},skipRegistration:!0,children:e=>{var i=lt();let r;var o=n.child(i);let a;var s=n.child(o),l=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>t.children),n.append(e,i)};n.if(s,e=>{t.children&&e(l)}),n.reset(o),n.reset(i),n.template_effect(()=>{r=n.set_class(i,1,"wizard-viewport svelte-cx8fqi",null,r,{"wizard-viewport-carousel":"slide-through"===d()}),a=n.set_class(o,1,"wizard-container svelte-cx8fqi",null,a,{"wizard-slide-forward":c.isAnimating&&"forward"===c.direction&&"slide-through"===d(),"wizard-slide-backward":c.isAnimating&&"backward"===c.direction&&"slide-through"===d()})}),n.append(e,i)},footer:e=>{var i=n.comment(),r=n.first_child(i),o=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>t.footer,()=>n.get(y)),n.append(e,i)};n.if(r,e=>{t.footer&&e(o)}),n.append(e,i)},$$slots:{default:!0,footer:!0}})};n.if(E,e=>{n.get(C)&&e(I)}),n.append(e,z),n.pop()}var ct=n.from_html("<div><!></div>");function pt(e,t){n.push(t,!0);let i=n.prop(t,"title",3,""),a=n.prop(t,"canProceed",3,!0);const s=r("wizard");let d,c=n.state(-1);o(()=>{n.set(c,s.registerStep({title:i(),getCanProceed:()=>a()}),!0),d=a()}),n.user_effect(()=>{const e=a(),t=l(()=>n.get(c)),i=l(()=>d);t>=0&&e!==i&&(d=e,l(()=>{s.updateStep(t,{getCanProceed:()=>e})}))});const p=n.derived(()=>n.get(c)>=0&&s.currentStep===n.get(c)),g=n.derived(()=>s.direction),u=n.derived(()=>s.isAnimating),f=n.derived(()=>s.transitionStyle),m=n.derived(()=>n.get(p));var v=n.comment(),h=n.first_child(v),_=e=>{var i=ct();let r;var o=n.child(i),a=e=>{var i=n.comment(),r=n.first_child(i);n.snippet(r,()=>t.children),n.append(e,i)};n.if(o,e=>{t.children&&e(a)}),n.reset(i),n.template_effect(()=>r=n.set_class(i,1,"wizard-step-wrapper svelte-sp1x21",null,r,{"wizard-fade-slide-left":n.get(u)&&n.get(p)&&"forward"===n.get(g)&&"fade-slide"===n.get(f),"wizard-fade-slide-right":n.get(u)&&n.get(p)&&"backward"===n.get(g)&&"fade-slide"===n.get(f)})),n.append(e,i)};n.if(h,e=>{n.get(m)&&e(_)}),n.append(e,v),n.pop()}export{Ge as Backdrop,at as Dock,je as Modal,Ke as ModalProvider,ve as Portal,dt as WizardModal,pt as WizardStep,v as closeModal,k as getConfig,u as openChildModal,h as openModal,B as setConfig,y as triggerAttention,ge as useModal,fe as useModalZIndex};
|
package/dist/vanilla.d.ts
CHANGED
|
@@ -2,24 +2,16 @@ import { bringToFront } from '../core/state';
|
|
|
2
2
|
import { closeAllModals } from '../core/state';
|
|
3
3
|
import { closeModal } from '../core/state';
|
|
4
4
|
import { getConfig } from '../core/config';
|
|
5
|
-
import { getDockOrder } from '../core/state';
|
|
6
|
-
import { getModalsStore } from '../core/state';
|
|
7
|
-
import { getModalState } from '../core/state';
|
|
8
5
|
import { isModalOpen } from '../core/state';
|
|
9
|
-
import { isModalRegistered } from '../core/state';
|
|
10
6
|
import { minimizeModal } from '../core/state';
|
|
11
7
|
import { ModalConfigOverrides } from '../core/types';
|
|
12
8
|
import { ModalGlow } from '../core/types';
|
|
13
9
|
import { ModalId } from '../core/types';
|
|
14
10
|
import { ModalLibraryConfig } from '../core/config';
|
|
15
|
-
import { openChildModal } from '../core/state';
|
|
16
11
|
import { openModal } from '../core/state';
|
|
17
12
|
import { Position } from '../core/types';
|
|
18
|
-
import { reorderDock } from '../core/state';
|
|
19
|
-
import { restoreAllMinimizedModals } from '../core/state';
|
|
20
13
|
import { restoreModal } from '../core/state';
|
|
21
14
|
import { setConfig } from '../core/config';
|
|
22
|
-
import { toggleModalTransparency } from '../core/state';
|
|
23
15
|
|
|
24
16
|
export declare interface BackdropControl {
|
|
25
17
|
destroy: () => void;
|
|
@@ -43,12 +35,6 @@ export declare interface DockControl {
|
|
|
43
35
|
|
|
44
36
|
export { getConfig }
|
|
45
37
|
|
|
46
|
-
export { getDockOrder }
|
|
47
|
-
|
|
48
|
-
export { getModalsStore }
|
|
49
|
-
|
|
50
|
-
export { getModalState }
|
|
51
|
-
|
|
52
38
|
export declare function init(options?: InitOptions): InitControl;
|
|
53
39
|
|
|
54
40
|
export declare interface InitControl {
|
|
@@ -67,8 +53,6 @@ export declare interface InitOptions {
|
|
|
67
53
|
|
|
68
54
|
export { isModalOpen }
|
|
69
55
|
|
|
70
|
-
export { isModalRegistered }
|
|
71
|
-
|
|
72
56
|
export { minimizeModal }
|
|
73
57
|
|
|
74
58
|
export declare interface ModalControl {
|
|
@@ -86,20 +70,12 @@ export declare interface ModalOptions extends Omit<VanillaModalOptions, 'contain
|
|
|
86
70
|
customIcon?: string | HTMLElement;
|
|
87
71
|
}
|
|
88
72
|
|
|
89
|
-
export { openChildModal }
|
|
90
|
-
|
|
91
73
|
export { openModal }
|
|
92
74
|
|
|
93
|
-
export { reorderDock }
|
|
94
|
-
|
|
95
|
-
export { restoreAllMinimizedModals }
|
|
96
|
-
|
|
97
75
|
export { restoreModal }
|
|
98
76
|
|
|
99
77
|
export { setConfig }
|
|
100
78
|
|
|
101
|
-
export { toggleModalTransparency }
|
|
102
|
-
|
|
103
79
|
export declare interface VanillaBackdropOptions {
|
|
104
80
|
container: HTMLElement;
|
|
105
81
|
}
|
package/dist/vanilla.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,o,i)=>((t,o,i)=>o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[o]=i)(t,"symbol"!=typeof o?o+"":o,i);import{CSS_CLASSES as o,DATA_ATTRIBUTES as i,RESIZE_DIRECTIONS as s}from"./core.js";import{ModalController as n}from"./core.js";import{registerModal as a,createModalRegistration as r,bringToFront as l,unregisterModal as d,subscribe as c,getModalsStore as h,isModalAnimating as m,shakeElement as p,restoreModal as u,closeAllModals as b}from"./core.js";import{bringToFront as g,closeAllModals as E,closeModal as C,getDockOrder as f,getModalState as y,getModalsStore as k,isModalOpen as A,isModalRegistered as M,minimizeModal as v,openChildModal as H,openModal as I,reorderDock as z,restoreAllMinimizedModals as N,restoreModal as w,toggleModalTransparency as L}from"./core.js";import{createConfigHelper as D,getConfig as S,setConfig as $}from"./core.js";import{getConfig as T,setConfig as O}from"./core.js";import{getMinimizedModals as j,getDockContainerClasses as B,getDockClasses as R}from"./core.js";import{getLayerZIndex as x,initializeStacking as F}from"./core.js";import{toDataId as P}from"./core.js";import{getBackdropConfig as W,hasOpenModals as G}from"./core.js";import{initializeResizeListener as _,cleanupResizeListener as K}from"./core.js";class U{constructor(e){t(this,"controller"),t(this,"dialogEl"),t(this,"headerEl"),t(this,"bodyEl"),t(this,"footerEl",null),t(this,"resizeHandlesContainer",null),t(this,"container"),t(this,"options"),t(this,"configHelper"),t(this,"unsubscribe",null),t(this,"abortController",new AbortController),this.options=e,this.container=e.container,this.configHelper=D(e.config),a(r({id:e.id,title:e.title,icon:e.icon,autoOpen:e.autoOpen??!0,glow:e.glow})),(e.autoOpen??!0)&&l(e.id),this.dialogEl=this.createDialogElement(),this.headerEl=this.createHeaderElement(),this.bodyEl=this.createBodyElement(),e.footer&&(this.footerEl=this.createFooterElement(),this.footerEl.appendChild(e.footer)),this.configHelper.isFeatureEnabled("resize")&&(this.resizeHandlesContainer=this.createResizeHandles()),this.dialogEl.appendChild(this.headerEl),this.dialogEl.appendChild(this.bodyEl),this.footerEl&&this.dialogEl.appendChild(this.footerEl),this.resizeHandlesContainer&&this.dialogEl.appendChild(this.resizeHandlesContainer),e.content&&this.bodyEl.appendChild(e.content);const o={id:e.id,title:e.title,icon:e.icon,config:e.config,maxWidth:e.maxWidth,preferredHeight:e.preferredHeight,glow:e.glow,closeOnEscape:e.closeOnEscape??!0,autoOpen:e.autoOpen??!0,openSourcePosition:e.openSourcePosition,onClose:e.onClose,skipRegistration:!0,configHelper:this.configHelper};this.controller=new n(o),this.container.appendChild(this.dialogEl),this.controller.mount(this.dialogEl),this.unsubscribe=this.controller.subscribe(e=>{this.updateFromState(e)}),this.updateFromState(this.controller.getState()),this.setupEventHandlers()}destroy(){var e;this.abortController.abort(),null==(e=this.unsubscribe)||e.call(this),this.controller.destroy(),d(this.options.id),this.dialogEl.remove()}createDialogElement(){const e=document.createElement("div");return e.className=o.dialog,e.setAttribute(i.modalId,String(this.options.id)),e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-labelledby",`${this.options.id}-title`),e.setAttribute("tabindex","-1"),e}createHeaderElement(){const e=document.createElement("header"),t=this.configHelper.isFeatureEnabled("drag"),i=this.configHelper.getAppearance("headerLayout"),s=this.configHelper.isFeatureEnabled("minimize"),n=!this.configHelper.isFeatureEnabled("dock"),a=this.configHelper.isFeatureEnabled("transparency");e.className=t?`${o.header} ${o.headerDraggable}`:o.header;const r=this.getIconElement();return"macos"===i?this.createMacOSHeader(e,r,s,n,a):this.createWindowsHeader(e,r,s,n,a),e}getIconElement(){return this.options.iconElement?this.options.iconElement:this.options.icon&&this.options.renderIcon?this.options.renderIcon(this.options.icon):null}createMacOSHeader(e,t,i,s,n){const a=document.createElement("div");a.className=o.headerTrafficLights;const r=document.createElement("button");if(r.type="button",r.className=`${o.headerLight} ${o.headerLightClose}`,r.setAttribute("aria-label","Close"),r.setAttribute("data-control","close"),a.appendChild(r),i){const e=document.createElement("button");e.type="button",e.className=`${o.headerLight} ${o.headerLightMinimize}${s?` ${o.headerLightDisabled}`:""}`,e.setAttribute("aria-label","Minimize"),e.setAttribute("data-control","minimize"),s&&(e.disabled=!0,e.title="Enable dock to minimize"),a.appendChild(e)}if(n){const e=document.createElement("button");e.type="button",e.className=`${o.headerLight} ${o.headerLightStyle}`,e.setAttribute("aria-label","Toggle style"),e.setAttribute("data-control","style"),a.appendChild(e)}e.appendChild(a);const l=document.createElement("div");if(l.className=o.headerMacCenter,t){const e=document.createElement("div");e.className=o.headerIcon,e.appendChild(t),l.appendChild(e)}const d=document.createElement("div");d.className=o.headerTitleGroup;const c=document.createElement("h2");c.className=o.headerTitle,c.id=`${this.options.id}-title`,c.textContent=this.options.title,d.appendChild(c),l.appendChild(d),e.appendChild(l);const h=document.createElement("div");h.className=o.headerMacSpacer,e.appendChild(h)}createWindowsHeader(e,t,i,s,n){const a=document.createElement("div");if(a.className=o.headerTitleGroup,t){const e=document.createElement("div");e.className=o.headerIcon,e.appendChild(t),a.appendChild(e)}const r=document.createElement("h2");r.className=o.headerTitle,r.id=`${this.options.id}-title`,r.textContent=this.options.title,a.appendChild(r),e.appendChild(a);const l=document.createElement("div");if(l.className=o.headerActions,n){const e=document.createElement("button");e.type="button",e.className=`${o.headerBtnWindows} ${o.headerBtnWindowsStyle}`,e.setAttribute("aria-label","Toggle style"),e.setAttribute("data-control","style"),e.innerHTML="◇",l.appendChild(e)}if(i){const e=document.createElement("button");e.type="button",e.className=`${o.headerBtnWindows}${s?` ${o.headerBtnWindowsDisabled}`:""}`,e.setAttribute("aria-label","Minimize"),e.setAttribute("data-control","minimize"),e.innerHTML="–",s&&(e.disabled=!0,e.title="Enable dock to minimize"),l.appendChild(e)}const d=document.createElement("button");d.type="button",d.className=`${o.headerBtnWindows} ${o.headerBtnWindowsClose}`,d.setAttribute("aria-label","Close"),d.setAttribute("data-control","close"),d.innerHTML="×",l.appendChild(d),e.appendChild(l)}createBodyElement(){const e=document.createElement("div");return e.className=o.body,e}createFooterElement(){const e=document.createElement("div");return e.className=o.footer,e}createResizeHandles(){const e=document.createElement("div");e.className=o.resizeHandles,e.setAttribute("role","group"),e.setAttribute("aria-label","Resize handles");for(const t of s){const s=document.createElement("div");s.className=`${o.resizeHandle} ${o.resizePrefix}${t}`,s.setAttribute("role","separator"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label",`Resize ${t}`),s.setAttribute("aria-orientation","n"===t||"s"===t?"horizontal":"vertical"),s.setAttribute(i.resizeDirection,t),e.appendChild(s)}return e}updateFromState(e){this.dialogEl.className=e.cssClasses.join(" "),this.updateStyles(e.style),this.dialogEl.setAttribute("data-state",e.dataState),this.dialogEl.setAttribute("data-animation-phase",e.dataAnimationPhase)}updateStyles(e){for(const[t,o]of Object.entries(e))t.startsWith("--")?this.dialogEl.style.setProperty(t,String(o)):this.dialogEl.style.setProperty(t,"number"==typeof o?String(o):o)}setupEventHandlers(){const e=this.abortController.signal,t="macos"===this.configHelper.getAppearance("headerLayout")?`.${o.headerLight}`:`.${o.headerBtnWindows}`;this.headerEl.addEventListener("pointerdown",e=>{e.target.closest(t)||this.controller.startDrag(e)},{signal:e}),this.dialogEl.addEventListener("pointermove",e=>{this.controller.handlePointerMove(e)},{signal:e}),this.dialogEl.addEventListener("pointerup",e=>{this.controller.handlePointerUp(e)},{signal:e}),this.headerEl.addEventListener("click",e=>{const t=e.target.closest("button");if(!t)return;const o=t.getAttribute("data-control");"close"===o?this.controller.close():"minimize"===o?this.controller.minimize():"style"===o&&this.controller.toggleTransparency()},{signal:e}),this.resizeHandlesContainer&&this.resizeHandlesContainer.addEventListener("pointerdown",e=>{const t=e.target.closest(`.${o.resizeHandle}`);if(!t)return;const s=t.getAttribute(i.resizeDirection);s&&this.controller.startResize(e,s)},{signal:e}),this.dialogEl.addEventListener("keydown",e=>{this.controller.handleKeyDown(e)},{signal:e}),this.dialogEl.addEventListener("pointerdown",()=>{this.controller.bringToFront()},{signal:e})}}class V{constructor(e){t(this,"containerEl"),t(this,"dockEl"),t(this,"parentContainer"),t(this,"unsubscribe"),t(this,"abortController",new AbortController),t(this,"isAttached",!1),t(this,"options"),this.options=e,this.parentContainer=e.container,this.containerEl=this.createContainerDOM(),this.dockEl=this.createDockDOM(),this.containerEl.appendChild(this.dockEl),this.unsubscribe=c(()=>{this.render()}),this.render()}createContainerDOM(){const e=document.createElement("div");return e.setAttribute("data-dock-container","true"),e}createDockDOM(){const e=document.createElement("div");return e.className=o.dock,e}render(){const e=S();if(!e.features.dock)return void(this.isAttached&&(this.containerEl.remove(),this.isAttached=!1));const t=j();if(0===t.length)return void(this.isAttached&&(this.containerEl.remove(),this.isAttached=!1));this.isAttached||(this.parentContainer.appendChild(this.containerEl),this.isAttached=!0);const o=e.dock.position;if(this.containerEl.className=B(o,0===t.length),this.containerEl.style.zIndex=String(x("DOCK")),this.dockEl.className=R(o,"horizontal"),this.dockEl.innerHTML="","free"===o){const e=this.createDockHandle();this.dockEl.appendChild(e)}const i=h(),s=e.dock.labelMode;for(const e of t){const t=e.lastChildId?i.get(e.lastChildId):null,o=this.createDockItem(e,t??null,s);this.dockEl.appendChild(o)}}createDockHandle(){const e=document.createElement("button");return e.type="button",e.className=o.dockHandle,e.setAttribute("aria-label","Drag dock"),e}createDockItem(e,t,s){const n=document.createElement("button"),a=[o.dockItem,e.glow&&o.dockItemHasGlow,e.lastChildId&&o.dockItemHasChild,"beside"===s&&o.dockItemLabelBeside,"below"===s&&o.dockItemLabelBelow].filter(Boolean).join(" ");n.className=a,n.setAttribute(i.modalId,P(e.id)),n.setAttribute("aria-label",`Restore ${e.title}`),e.glow&&n.style.setProperty("--modal-dock-glow-color",e.glow.color);const r=document.createElement("span");if(r.className=o.dockItemIcon,e.icon&&this.options.renderIcon){const t=this.options.renderIcon(e.icon);t?r.appendChild(t):r.appendChild(this.createIconPlaceholder(e.title))}else r.appendChild(this.createIconPlaceholder(e.title));if(n.appendChild(r),"hidden"!==s){const t=document.createElement("span");t.className=o.dockItemLabel,t.textContent=e.title,n.appendChild(t)}const l=document.createElement("span");if(l.className=o.dockItemGlow,n.appendChild(l),e.lastChildId&&t){const e=document.createElement("span");if(e.className=o.dockChildIndicator,t.icon&&this.options.renderIcon){const o=this.options.renderIcon(t.icon);o?e.appendChild(o):e.textContent="+"}else e.textContent="+";n.appendChild(e)}return n.addEventListener("click",t=>{m(e.id)?p(t.currentTarget):u(e.id)},{signal:this.abortController.signal}),n}createIconPlaceholder(e){const t=document.createElement("span");return t.className=o.dockItemIconPlaceholder,t.textContent=e.charAt(0),t}destroy(){this.abortController.abort(),this.unsubscribe(),this.isAttached&&(this.containerEl.remove(),this.isAttached=!1)}}class Z{constructor(e){t(this,"element"),t(this,"unsubscribe"),t(this,"abortController",new AbortController),this.element=this.createDOM(),e.container.appendChild(this.element),this.unsubscribe=c(()=>{this.render()}),this.render()}createDOM(){const e=document.createElement("div");return e.className=o.backdrop,e.addEventListener("click",()=>{W().blockClicks&&b()},{signal:this.abortController.signal}),e}render(){W().visible?G()?(this.element.classList.add(o.backdropVisible),this.element.style.display=""):(this.element.classList.remove(o.backdropVisible),this.element.style.display="none"):this.element.style.display="none"}destroy(){this.abortController.abort(),this.unsubscribe(),this.element.remove()}}function q(e){if("string"==typeof e){const t=document.createElement("div");return t.innerHTML=e,t}return e}function J(e){const{content:t,footer:o,customIcon:i,...s}=e,n=t?q(t):void 0,a=o?q(o):void 0,r=new U({...s,container:document.body,content:n,footer:a});return{destroy:()=>r.destroy(),update:e=>{}}}function Q(){const e=new V({container:document.body});return{destroy:()=>e.destroy()}}function X(){const e=new Z({container:document.body});return{destroy:()=>e.destroy()}}function Y(e={}){const{config:t}=e;t&&$(t),F(),_();const o=S(),i=e.backdrop??o.features.backdrop?X():null,s=e.dock??o.features.dock?Q():null;return{backdrop:i,dock:s,destroy:()=>{null==i||i.destroy(),null==s||s.destroy(),K()}}}export{g as bringToFront,E as closeAllModals,C as closeModal,X as createBackdrop,Q as createDock,J as createModal,T as getConfig,f as getDockOrder,y as getModalState,k as getModalsStore,Y as init,A as isModalOpen,M as isModalRegistered,v as minimizeModal,H as openChildModal,I as openModal,z as reorderDock,N as restoreAllMinimizedModals,w as restoreModal,O as setConfig,L as toggleModalTransparency};
|
|
1
|
+
var e=Object.defineProperty,t=(t,n,i)=>((t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i)(t,"symbol"!=typeof n?n+"":n,i);import{X as n,n as i,p as s,h as o,M as a,u as r,C as l,D as d,R as c,s as h,I as p,T as m,A as u,U as b,l as E,K as g,L as C,r as f,j as y,N as k,x as A,Y as v,z as H,B as I,E as N,F as w,H as z}from"./backdrop.js";import{c as L,f as M,m as $,d as D}from"./backdrop.js";class O{constructor(e){t(this,"controller"),t(this,"dialogEl"),t(this,"headerEl"),t(this,"bodyEl"),t(this,"footerEl",null),t(this,"resizeHandlesContainer",null),t(this,"container"),t(this,"options"),t(this,"configHelper"),t(this,"unsubscribe",null),t(this,"abortController",new AbortController),this.options=e,this.container=e.container,this.configHelper=n(e.config),i(s({id:e.id,title:e.title,icon:e.icon,autoOpen:e.autoOpen??!0,glow:e.glow})),(e.autoOpen??!0)&&o(e.id),this.dialogEl=this.createDialogElement(),this.headerEl=this.createHeaderElement(),this.bodyEl=this.createBodyElement(),e.footer&&(this.footerEl=this.createFooterElement(),this.footerEl.appendChild(e.footer)),this.configHelper.isFeatureEnabled("resize")&&(this.resizeHandlesContainer=this.createResizeHandles()),this.dialogEl.appendChild(this.headerEl),this.dialogEl.appendChild(this.bodyEl),this.footerEl&&this.dialogEl.appendChild(this.footerEl),this.resizeHandlesContainer&&this.dialogEl.appendChild(this.resizeHandlesContainer),e.content&&this.bodyEl.appendChild(e.content);const r={id:e.id,title:e.title,icon:e.icon,config:e.config,maxWidth:e.maxWidth,preferredHeight:e.preferredHeight,glow:e.glow,closeOnEscape:e.closeOnEscape??!0,autoOpen:e.autoOpen??!0,openSourcePosition:e.openSourcePosition,onClose:e.onClose,skipRegistration:!0,configHelper:this.configHelper};this.controller=new a(r),this.container.appendChild(this.dialogEl),this.controller.mount(this.dialogEl),this.unsubscribe=this.controller.subscribe(e=>{this.updateFromState(e)}),this.updateFromState(this.controller.getState()),this.setupEventHandlers()}destroy(){var e;this.abortController.abort(),null==(e=this.unsubscribe)||e.call(this),this.controller.destroy(),r(this.options.id),this.dialogEl.remove()}createDialogElement(){const e=document.createElement("div");return e.className=l.dialog,e.setAttribute(d.modalId,String(this.options.id)),e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-labelledby",`${this.options.id}-title`),e.setAttribute("tabindex","-1"),e}createHeaderElement(){const e=document.createElement("header"),t=this.configHelper.isFeatureEnabled("drag"),n=this.configHelper.getAppearance("headerLayout"),i=this.configHelper.isFeatureEnabled("minimize"),s=!this.configHelper.isFeatureEnabled("dock"),o=this.configHelper.isFeatureEnabled("transparency");e.className=t?`${l.header} ${l.headerDraggable}`:l.header;const a=this.getIconElement();return"macos"===n?this.createMacOSHeader(e,a,i,s,o):this.createWindowsHeader(e,a,i,s,o),e}getIconElement(){return this.options.iconElement?this.options.iconElement:this.options.icon&&this.options.renderIcon?this.options.renderIcon(this.options.icon):null}createMacOSHeader(e,t,n,i,s){const o=document.createElement("div");o.className=l.headerTrafficLights;const a=document.createElement("button");if(a.type="button",a.className=`${l.headerLight} ${l.headerLightClose}`,a.setAttribute("aria-label","Close"),a.setAttribute("data-control","close"),o.appendChild(a),n){const e=document.createElement("button");e.type="button",e.className=`${l.headerLight} ${l.headerLightMinimize}${i?` ${l.headerLightDisabled}`:""}`,e.setAttribute("aria-label","Minimize"),e.setAttribute("data-control","minimize"),i&&(e.disabled=!0,e.title="Enable dock to minimize"),o.appendChild(e)}if(s){const e=document.createElement("button");e.type="button",e.className=`${l.headerLight} ${l.headerLightStyle}`,e.setAttribute("aria-label","Toggle style"),e.setAttribute("data-control","style"),o.appendChild(e)}e.appendChild(o);const r=document.createElement("div");if(r.className=l.headerMacCenter,t){const e=document.createElement("div");e.className=l.headerIcon,e.appendChild(t),r.appendChild(e)}const d=document.createElement("div");d.className=l.headerTitleGroup;const c=document.createElement("h2");c.className=l.headerTitle,c.id=`${this.options.id}-title`,c.textContent=this.options.title,d.appendChild(c),r.appendChild(d),e.appendChild(r);const h=document.createElement("div");h.className=l.headerMacSpacer,e.appendChild(h)}createWindowsHeader(e,t,n,i,s){const o=document.createElement("div");if(o.className=l.headerTitleGroup,t){const e=document.createElement("div");e.className=l.headerIcon,e.appendChild(t),o.appendChild(e)}const a=document.createElement("h2");a.className=l.headerTitle,a.id=`${this.options.id}-title`,a.textContent=this.options.title,o.appendChild(a),e.appendChild(o);const r=document.createElement("div");if(r.className=l.headerActions,s){const e=document.createElement("button");e.type="button",e.className=`${l.headerBtnWindows} ${l.headerBtnWindowsStyle}`,e.setAttribute("aria-label","Toggle style"),e.setAttribute("data-control","style"),e.innerHTML="◇",r.appendChild(e)}if(n){const e=document.createElement("button");e.type="button",e.className=`${l.headerBtnWindows}${i?` ${l.headerBtnWindowsDisabled}`:""}`,e.setAttribute("aria-label","Minimize"),e.setAttribute("data-control","minimize"),e.innerHTML="–",i&&(e.disabled=!0,e.title="Enable dock to minimize"),r.appendChild(e)}const d=document.createElement("button");d.type="button",d.className=`${l.headerBtnWindows} ${l.headerBtnWindowsClose}`,d.setAttribute("aria-label","Close"),d.setAttribute("data-control","close"),d.innerHTML="×",r.appendChild(d),e.appendChild(r)}createBodyElement(){const e=document.createElement("div");return e.className=l.body,e}createFooterElement(){const e=document.createElement("div");return e.className=l.footer,e}createResizeHandles(){const e=document.createElement("div");e.className=l.resizeHandles,e.setAttribute("role","group"),e.setAttribute("aria-label","Resize handles");for(const t of c){const n=document.createElement("div");n.className=`${l.resizeHandle} ${l.resizePrefix}${t}`,n.setAttribute("role","separator"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label",`Resize ${t}`),n.setAttribute("aria-orientation","n"===t||"s"===t?"horizontal":"vertical"),n.setAttribute(d.resizeDirection,t),e.appendChild(n)}return e}updateFromState(e){this.dialogEl.className=e.cssClasses.join(" "),this.updateStyles(e.style),this.dialogEl.setAttribute("data-state",e.dataState),this.dialogEl.setAttribute("data-animation-phase",e.dataAnimationPhase)}updateStyles(e){for(const[t,n]of Object.entries(e))t.startsWith("--")?this.dialogEl.style.setProperty(t,String(n)):this.dialogEl.style.setProperty(t,"number"==typeof n?String(n):n)}setupEventHandlers(){const e=this.abortController.signal,t="macos"===this.configHelper.getAppearance("headerLayout")?`.${l.headerLight}`:`.${l.headerBtnWindows}`;this.headerEl.addEventListener("pointerdown",e=>{e.target.closest(t)||this.controller.startDrag(e)},{signal:e}),this.dialogEl.addEventListener("pointermove",e=>{this.controller.handlePointerMove(e)},{signal:e}),this.dialogEl.addEventListener("pointerup",e=>{this.controller.handlePointerUp(e)},{signal:e}),this.headerEl.addEventListener("click",e=>{const t=e.target.closest("button");if(!t)return;const n=t.getAttribute("data-control");"close"===n?this.controller.close():"minimize"===n?this.controller.minimize():"style"===n&&this.controller.toggleTransparency()},{signal:e}),this.resizeHandlesContainer&&this.resizeHandlesContainer.addEventListener("pointerdown",e=>{const t=e.target.closest(`.${l.resizeHandle}`);if(!t)return;const n=t.getAttribute(d.resizeDirection);n&&this.controller.startResize(e,n)},{signal:e}),this.dialogEl.addEventListener("keydown",e=>{this.controller.handleKeyDown(e)},{signal:e}),this.dialogEl.addEventListener("pointerdown",()=>{this.controller.bringToFront()},{signal:e})}}class S{constructor(e){t(this,"containerEl"),t(this,"dockEl"),t(this,"parentContainer"),t(this,"unsubscribe"),t(this,"abortController",new AbortController),t(this,"isAttached",!1),t(this,"options"),this.options=e,this.parentContainer=e.container,this.containerEl=this.createContainerDOM(),this.dockEl=this.createDockDOM(),this.containerEl.appendChild(this.dockEl),this.unsubscribe=h(()=>{this.render()}),this.render()}createContainerDOM(){const e=document.createElement("div");return e.setAttribute("data-dock-container","true"),e}createDockDOM(){const e=document.createElement("div");return e.className=l.dock,e}render(){const e=y();if(!e.features.dock)return void(this.isAttached&&(this.containerEl.remove(),this.isAttached=!1));const t=p();if(0===t.length)return void(this.isAttached&&(this.containerEl.remove(),this.isAttached=!1));this.isAttached||(this.parentContainer.appendChild(this.containerEl),this.isAttached=!0);const n=e.dock.position;if(this.containerEl.className=m(n,0===t.length),this.containerEl.style.zIndex=String(u("DOCK")),this.dockEl.className=b(n,"horizontal"),this.dockEl.innerHTML="","free"===n){const e=this.createDockHandle();this.dockEl.appendChild(e)}const i=k(),s=e.dock.labelMode;for(const e of t){const t=e.lastChildId?i.get(e.lastChildId):null,n=this.createDockItem(e,t??null,s);this.dockEl.appendChild(n)}}createDockHandle(){const e=document.createElement("button");return e.type="button",e.className=l.dockHandle,e.setAttribute("aria-label","Drag dock"),e}createDockItem(e,t,n){const i=document.createElement("button"),s=[l.dockItem,e.glow&&l.dockItemHasGlow,e.lastChildId&&l.dockItemHasChild,"beside"===n&&l.dockItemLabelBeside,"below"===n&&l.dockItemLabelBelow].filter(Boolean).join(" ");i.className=s,i.setAttribute(d.modalId,E(e.id)),i.setAttribute("aria-label",`Restore ${e.title}`),e.glow&&i.style.setProperty("--modal-dock-glow-color",e.glow.color);const o=document.createElement("span");if(o.className=l.dockItemIcon,e.icon&&this.options.renderIcon){const t=this.options.renderIcon(e.icon);t?o.appendChild(t):o.appendChild(this.createIconPlaceholder(e.title))}else o.appendChild(this.createIconPlaceholder(e.title));if(i.appendChild(o),"hidden"!==n){const t=document.createElement("span");t.className=l.dockItemLabel,t.textContent=e.title,i.appendChild(t)}const a=document.createElement("span");if(a.className=l.dockItemGlow,i.appendChild(a),e.lastChildId&&t){const e=document.createElement("span");if(e.className=l.dockChildIndicator,t.icon&&this.options.renderIcon){const n=this.options.renderIcon(t.icon);n?e.appendChild(n):e.textContent="+"}else e.textContent="+";i.appendChild(e)}return i.addEventListener("click",t=>{g(e.id)?C(t.currentTarget):f(e.id)},{signal:this.abortController.signal}),i}createIconPlaceholder(e){const t=document.createElement("span");return t.className=l.dockItemIconPlaceholder,t.textContent=e.charAt(0),t}destroy(){this.abortController.abort(),this.unsubscribe(),this.isAttached&&(this.containerEl.remove(),this.isAttached=!1)}}class T{constructor(e){t(this,"element"),t(this,"unsubscribe"),t(this,"abortController",new AbortController),this.element=this.createDOM(),e.container.appendChild(this.element),this.unsubscribe=h(()=>{this.render()}),this.render()}createDOM(){const e=document.createElement("div");return e.className=l.backdrop,e.addEventListener("click",()=>{A().blockClicks&&v()},{signal:this.abortController.signal}),e}render(){A().visible?H()?(this.element.classList.add(l.backdropVisible),this.element.style.display=""):(this.element.classList.remove(l.backdropVisible),this.element.style.display="none"):this.element.style.display="none"}destroy(){this.abortController.abort(),this.unsubscribe(),this.element.remove()}}function x(e){if("string"==typeof e){const t=document.createElement("div");return t.innerHTML=e,t}return e}function B(e){const{content:t,footer:n,customIcon:i,...s}=e,o=t?x(t):void 0,a=n?x(n):void 0,r=new O({...s,container:document.body,content:o,footer:a});return{destroy:()=>r.destroy(),update:e=>{}}}function P(){const e=new S({container:document.body});return{destroy:()=>e.destroy()}}function F(){const e=new T({container:document.body});return{destroy:()=>e.destroy()}}function W(e={}){const{config:t}=e;t&&I(t),N(),w();const n=y(),i=e.backdrop??n.features.backdrop?F():null,s=e.dock??n.features.dock?P():null;return{backdrop:i,dock:s,destroy:()=>{null==i||i.destroy(),null==s||s.destroy(),z()}}}export{o as bringToFront,v as closeAllModals,L as closeModal,F as createBackdrop,P as createDock,B as createModal,y as getConfig,W as init,M as isModalOpen,$ as minimizeModal,D as openModal,f as restoreModal,I as setConfig};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epic-modals",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A stunning modal library with macOS-style animations, drag, resize, and dock. Supports Svelte 5, React, and vanilla JS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"modal",
|
|
@@ -35,7 +35,10 @@
|
|
|
35
35
|
"types": "./dist/vanilla.d.ts",
|
|
36
36
|
"default": "./dist/vanilla.js"
|
|
37
37
|
},
|
|
38
|
-
"./styles
|
|
38
|
+
"./styles": "./dist/styles/basic.css",
|
|
39
|
+
"./styles/dock": "./dist/styles/dock.css",
|
|
40
|
+
"./styles/wizard": "./dist/styles/wizard.css",
|
|
41
|
+
"./styles/all": "./dist/styles/all.css",
|
|
39
42
|
"./styles/showcase": "./dist/styles/showcase.css"
|
|
40
43
|
},
|
|
41
44
|
"files": [
|