vanilla-drawers 1.0.8 → 1.0.10
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/drawers.es.js +202 -202
- package/dist/drawers.umd.js +2 -2
- package/package.json +1 -1
package/dist/drawers.es.js
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
var
|
2
|
-
if (!t.has(
|
1
|
+
var J = (n, t, e) => {
|
2
|
+
if (!t.has(n))
|
3
3
|
throw TypeError("Cannot " + e);
|
4
4
|
};
|
5
|
-
var
|
6
|
-
if (t.has(
|
5
|
+
var r = (n, t, e) => (J(n, t, "read from private field"), e ? e.call(n) : t.get(n)), y = (n, t, e) => {
|
6
|
+
if (t.has(n))
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
8
|
-
t instanceof WeakSet ? t.add(
|
9
|
-
}, b = (
|
10
|
-
function
|
11
|
-
return
|
8
|
+
t instanceof WeakSet ? t.add(n) : t.set(n, e);
|
9
|
+
}, b = (n, t, e, a) => (J(n, t, "write to private field"), a ? a.call(n, e) : t.set(n, e), e);
|
10
|
+
function te(n) {
|
11
|
+
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
12
12
|
}
|
13
|
-
var
|
14
|
-
(function(
|
13
|
+
var ne = { exports: {} };
|
14
|
+
(function(n) {
|
15
15
|
var t = Object.prototype.hasOwnProperty, e = "~";
|
16
16
|
function a() {
|
17
17
|
}
|
@@ -19,11 +19,11 @@ var re = { exports: {} };
|
|
19
19
|
function s(h, i, o) {
|
20
20
|
this.fn = h, this.context = i, this.once = o || !1;
|
21
21
|
}
|
22
|
-
function f(h, i, o, c,
|
22
|
+
function f(h, i, o, c, O) {
|
23
23
|
if (typeof o != "function")
|
24
24
|
throw new TypeError("The listener must be a function");
|
25
|
-
var g = new s(o, c || h,
|
26
|
-
return h._events[
|
25
|
+
var g = new s(o, c || h, O), m = e ? e + i : i;
|
26
|
+
return h._events[m] ? h._events[m].fn ? h._events[m] = [h._events[m], g] : h._events[m].push(g) : (h._events[m] = g, h._eventsCount++), h;
|
27
27
|
}
|
28
28
|
function d(h, i) {
|
29
29
|
--h._eventsCount === 0 ? h._events = new a() : delete h._events[i];
|
@@ -44,19 +44,19 @@ var re = { exports: {} };
|
|
44
44
|
return [];
|
45
45
|
if (c.fn)
|
46
46
|
return [c.fn];
|
47
|
-
for (var
|
48
|
-
|
49
|
-
return
|
47
|
+
for (var O = 0, g = c.length, m = new Array(g); O < g; O++)
|
48
|
+
m[O] = c[O].fn;
|
49
|
+
return m;
|
50
50
|
}, u.prototype.listenerCount = function(i) {
|
51
51
|
var o = e ? e + i : i, c = this._events[o];
|
52
52
|
return c ? c.fn ? 1 : c.length : 0;
|
53
|
-
}, u.prototype.emit = function(i, o, c,
|
54
|
-
var
|
55
|
-
if (!this._events[
|
53
|
+
}, u.prototype.emit = function(i, o, c, O, g, m) {
|
54
|
+
var _ = e ? e + i : i;
|
55
|
+
if (!this._events[_])
|
56
56
|
return !1;
|
57
|
-
var l = this._events[
|
57
|
+
var l = this._events[_], j = arguments.length, M, w;
|
58
58
|
if (l.fn) {
|
59
|
-
switch (l.once && this.removeListener(i, l.fn, void 0, !0),
|
59
|
+
switch (l.once && this.removeListener(i, l.fn, void 0, !0), j) {
|
60
60
|
case 1:
|
61
61
|
return l.fn.call(l.context), !0;
|
62
62
|
case 2:
|
@@ -64,36 +64,36 @@ var re = { exports: {} };
|
|
64
64
|
case 3:
|
65
65
|
return l.fn.call(l.context, o, c), !0;
|
66
66
|
case 4:
|
67
|
-
return l.fn.call(l.context, o, c,
|
67
|
+
return l.fn.call(l.context, o, c, O), !0;
|
68
68
|
case 5:
|
69
|
-
return l.fn.call(l.context, o, c,
|
69
|
+
return l.fn.call(l.context, o, c, O, g), !0;
|
70
70
|
case 6:
|
71
|
-
return l.fn.call(l.context, o, c,
|
71
|
+
return l.fn.call(l.context, o, c, O, g, m), !0;
|
72
72
|
}
|
73
|
-
for (
|
74
|
-
|
75
|
-
l.fn.apply(l.context,
|
73
|
+
for (w = 1, M = new Array(j - 1); w < j; w++)
|
74
|
+
M[w - 1] = arguments[w];
|
75
|
+
l.fn.apply(l.context, M);
|
76
76
|
} else {
|
77
|
-
var
|
78
|
-
for (
|
79
|
-
switch (l[
|
77
|
+
var se = l.length, N;
|
78
|
+
for (w = 0; w < se; w++)
|
79
|
+
switch (l[w].once && this.removeListener(i, l[w].fn, void 0, !0), j) {
|
80
80
|
case 1:
|
81
|
-
l[
|
81
|
+
l[w].fn.call(l[w].context);
|
82
82
|
break;
|
83
83
|
case 2:
|
84
|
-
l[
|
84
|
+
l[w].fn.call(l[w].context, o);
|
85
85
|
break;
|
86
86
|
case 3:
|
87
|
-
l[
|
87
|
+
l[w].fn.call(l[w].context, o, c);
|
88
88
|
break;
|
89
89
|
case 4:
|
90
|
-
l[
|
90
|
+
l[w].fn.call(l[w].context, o, c, O);
|
91
91
|
break;
|
92
92
|
default:
|
93
|
-
if (!
|
94
|
-
for (
|
95
|
-
|
96
|
-
l[
|
93
|
+
if (!M)
|
94
|
+
for (N = 1, M = new Array(j - 1); N < j; N++)
|
95
|
+
M[N - 1] = arguments[N];
|
96
|
+
l[w].fn.apply(l[w].context, M);
|
97
97
|
}
|
98
98
|
}
|
99
99
|
return !0;
|
@@ -101,119 +101,119 @@ var re = { exports: {} };
|
|
101
101
|
return f(this, i, o, c, !1);
|
102
102
|
}, u.prototype.once = function(i, o, c) {
|
103
103
|
return f(this, i, o, c, !0);
|
104
|
-
}, u.prototype.removeListener = function(i, o, c,
|
104
|
+
}, u.prototype.removeListener = function(i, o, c, O) {
|
105
105
|
var g = e ? e + i : i;
|
106
106
|
if (!this._events[g])
|
107
107
|
return this;
|
108
108
|
if (!o)
|
109
109
|
return d(this, g), this;
|
110
|
-
var
|
111
|
-
if (
|
112
|
-
|
110
|
+
var m = this._events[g];
|
111
|
+
if (m.fn)
|
112
|
+
m.fn === o && (!O || m.once) && (!c || m.context === c) && d(this, g);
|
113
113
|
else {
|
114
|
-
for (var
|
115
|
-
(
|
114
|
+
for (var _ = 0, l = [], j = m.length; _ < j; _++)
|
115
|
+
(m[_].fn !== o || O && !m[_].once || c && m[_].context !== c) && l.push(m[_]);
|
116
116
|
l.length ? this._events[g] = l.length === 1 ? l[0] : l : d(this, g);
|
117
117
|
}
|
118
118
|
return this;
|
119
119
|
}, u.prototype.removeAllListeners = function(i) {
|
120
120
|
var o;
|
121
121
|
return i ? (o = e ? e + i : i, this._events[o] && d(this, o)) : (this._events = new a(), this._eventsCount = 0), this;
|
122
|
-
}, u.prototype.off = u.prototype.removeListener, u.prototype.addListener = u.prototype.on, u.prefixed = e, u.EventEmitter = u,
|
123
|
-
})(
|
124
|
-
var
|
125
|
-
const
|
126
|
-
var
|
127
|
-
return
|
122
|
+
}, u.prototype.off = u.prototype.removeListener, u.prototype.addListener = u.prototype.on, u.prefixed = e, u.EventEmitter = u, n.exports = u;
|
123
|
+
})(ne);
|
124
|
+
var ie = ne.exports;
|
125
|
+
const oe = /* @__PURE__ */ te(ie);
|
126
|
+
var ae = function(t) {
|
127
|
+
return le(t) && !ce(t);
|
128
128
|
};
|
129
|
-
function
|
130
|
-
return !!
|
129
|
+
function le(n) {
|
130
|
+
return !!n && typeof n == "object";
|
131
131
|
}
|
132
|
-
function
|
133
|
-
var t = Object.prototype.toString.call(
|
134
|
-
return t === "[object RegExp]" || t === "[object Date]" ||
|
132
|
+
function ce(n) {
|
133
|
+
var t = Object.prototype.toString.call(n);
|
134
|
+
return t === "[object RegExp]" || t === "[object Date]" || fe(n);
|
135
135
|
}
|
136
|
-
var
|
137
|
-
function
|
138
|
-
return
|
136
|
+
var he = typeof Symbol == "function" && Symbol.for, ue = he ? Symbol.for("react.element") : 60103;
|
137
|
+
function fe(n) {
|
138
|
+
return n.$$typeof === ue;
|
139
139
|
}
|
140
|
-
function
|
141
|
-
return Array.isArray(
|
140
|
+
function de(n) {
|
141
|
+
return Array.isArray(n) ? [] : {};
|
142
142
|
}
|
143
|
-
function
|
144
|
-
return t.clone !== !1 && t.isMergeableObject(
|
143
|
+
function R(n, t) {
|
144
|
+
return t.clone !== !1 && t.isMergeableObject(n) ? U(de(n), n, t) : n;
|
145
145
|
}
|
146
|
-
function
|
147
|
-
return
|
148
|
-
return
|
146
|
+
function pe(n, t, e) {
|
147
|
+
return n.concat(t).map(function(a) {
|
148
|
+
return R(a, e);
|
149
149
|
});
|
150
150
|
}
|
151
|
-
function
|
151
|
+
function me(n, t) {
|
152
152
|
if (!t.customMerge)
|
153
|
-
return
|
154
|
-
var e = t.customMerge(
|
155
|
-
return typeof e == "function" ? e :
|
153
|
+
return U;
|
154
|
+
var e = t.customMerge(n);
|
155
|
+
return typeof e == "function" ? e : U;
|
156
156
|
}
|
157
|
-
function
|
158
|
-
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(
|
159
|
-
return Object.propertyIsEnumerable.call(
|
157
|
+
function we(n) {
|
158
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(n).filter(function(t) {
|
159
|
+
return Object.propertyIsEnumerable.call(n, t);
|
160
160
|
}) : [];
|
161
161
|
}
|
162
|
-
function
|
163
|
-
return Object.keys(
|
162
|
+
function Q(n) {
|
163
|
+
return Object.keys(n).concat(we(n));
|
164
164
|
}
|
165
|
-
function
|
165
|
+
function re(n, t) {
|
166
166
|
try {
|
167
|
-
return t in
|
167
|
+
return t in n;
|
168
168
|
} catch {
|
169
169
|
return !1;
|
170
170
|
}
|
171
171
|
}
|
172
|
-
function
|
173
|
-
return
|
172
|
+
function ye(n, t) {
|
173
|
+
return re(n, t) && !(Object.hasOwnProperty.call(n, t) && Object.propertyIsEnumerable.call(n, t));
|
174
174
|
}
|
175
|
-
function
|
175
|
+
function be(n, t, e) {
|
176
176
|
var a = {};
|
177
|
-
return e.isMergeableObject(
|
178
|
-
a[s] =
|
179
|
-
}),
|
180
|
-
|
177
|
+
return e.isMergeableObject(n) && Q(n).forEach(function(s) {
|
178
|
+
a[s] = R(n[s], e);
|
179
|
+
}), Q(t).forEach(function(s) {
|
180
|
+
ye(n, s) || (re(n, s) && e.isMergeableObject(t[s]) ? a[s] = me(s, e)(n[s], t[s], e) : a[s] = R(t[s], e));
|
181
181
|
}), a;
|
182
182
|
}
|
183
|
-
function
|
184
|
-
e = e || {}, e.arrayMerge = e.arrayMerge ||
|
185
|
-
var a = Array.isArray(t), s = Array.isArray(
|
186
|
-
return f ? a ? e.arrayMerge(
|
183
|
+
function U(n, t, e) {
|
184
|
+
e = e || {}, e.arrayMerge = e.arrayMerge || pe, e.isMergeableObject = e.isMergeableObject || ae, e.cloneUnlessOtherwiseSpecified = R;
|
185
|
+
var a = Array.isArray(t), s = Array.isArray(n), f = a === s;
|
186
|
+
return f ? a ? e.arrayMerge(n, t, e) : be(n, t, e) : R(t, e);
|
187
187
|
}
|
188
|
-
|
188
|
+
U.all = function(t, e) {
|
189
189
|
if (!Array.isArray(t))
|
190
190
|
throw new Error("first argument should be an array");
|
191
191
|
return t.reduce(function(a, s) {
|
192
|
-
return
|
192
|
+
return U(a, s, e);
|
193
193
|
}, {});
|
194
194
|
};
|
195
|
-
var
|
196
|
-
const
|
195
|
+
var ge = U, Oe = ge;
|
196
|
+
const ve = /* @__PURE__ */ te(Oe);
|
197
197
|
/*!
|
198
198
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
199
199
|
*
|
200
200
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
201
201
|
* Released under the MIT License.
|
202
202
|
*/
|
203
|
-
function
|
204
|
-
return Object.prototype.toString.call(
|
203
|
+
function W(n) {
|
204
|
+
return Object.prototype.toString.call(n) === "[object Object]";
|
205
205
|
}
|
206
|
-
function
|
206
|
+
function Ee(n) {
|
207
207
|
var t, e;
|
208
|
-
return
|
208
|
+
return W(n) === !1 ? !1 : (t = n.constructor, t === void 0 ? !0 : (e = t.prototype, !(W(e) === !1 || e.hasOwnProperty("isPrototypeOf") === !1)));
|
209
209
|
}
|
210
|
-
function
|
211
|
-
return
|
210
|
+
function Y(n) {
|
211
|
+
return n instanceof Element ? n : document.querySelector(n);
|
212
212
|
}
|
213
|
-
async function
|
214
|
-
return await new Promise((t) => setTimeout(t,
|
213
|
+
async function F(n) {
|
214
|
+
return await new Promise((t) => setTimeout(t, n));
|
215
215
|
}
|
216
|
-
const
|
216
|
+
const Ae = '[data-elem="drawer.panel"]', $ = "data-drawers-group", Ce = [
|
217
217
|
"a[href]",
|
218
218
|
"area[href]",
|
219
219
|
'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
|
@@ -225,7 +225,7 @@ const Ce = '[data-elem="drawer.panel"]', K = "data-drawers-group", _e = [
|
|
225
225
|
"embed",
|
226
226
|
"[contenteditable]",
|
227
227
|
'[tabindex]:not([tabindex^="-"])'
|
228
|
-
],
|
228
|
+
], X = {
|
229
229
|
modal: !0,
|
230
230
|
focusOnChild: !0,
|
231
231
|
closeOnEsc: !0,
|
@@ -243,203 +243,202 @@ const Ce = '[data-elem="drawer.panel"]', K = "data-drawers-group", _e = [
|
|
243
243
|
closeAnimationDuration: 0,
|
244
244
|
lockPageScroll: !0
|
245
245
|
};
|
246
|
-
function
|
247
|
-
return
|
248
|
-
isMergeableObject:
|
246
|
+
function Z(n) {
|
247
|
+
return ve.all(n, {
|
248
|
+
isMergeableObject: Ee
|
249
249
|
});
|
250
250
|
}
|
251
|
-
var
|
252
|
-
class
|
251
|
+
var E, v, P, B;
|
252
|
+
class H {
|
253
253
|
constructor({ target: t, type: e, owner: a }) {
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
const s =
|
254
|
+
y(this, E, void 0);
|
255
|
+
y(this, v, void 0);
|
256
|
+
y(this, P, void 0);
|
257
|
+
y(this, B, !1);
|
258
|
+
const s = Y(t);
|
259
259
|
if (!s)
|
260
260
|
throw new Error("Trigger element cannot be found");
|
261
|
-
b(this,
|
261
|
+
b(this, E, s), b(this, v, a), b(this, P, e), this.init();
|
262
262
|
}
|
263
263
|
// Accessors
|
264
264
|
get isActive() {
|
265
|
-
return
|
265
|
+
return r(this, B);
|
266
266
|
}
|
267
267
|
get owner() {
|
268
|
-
return
|
268
|
+
return r(this, v);
|
269
269
|
}
|
270
270
|
// Methods
|
271
271
|
init() {
|
272
|
-
|
272
|
+
r(this, E).addEventListener("click", (t) => this.clickHandler(t)), r(this, v).on("open", () => this.setActive(!0)), r(this, v).on("close", () => this.setActive(!1));
|
273
273
|
}
|
274
274
|
clickHandler(t) {
|
275
|
-
t.__drawerTrigger = this,
|
275
|
+
t.__drawerTrigger = this, r(this, P) === "open" ? r(this, v).isOpen || r(this, v).open(r(this, E)) : r(this, P) === "close" ? r(this, v).isOpen && r(this, v).close(r(this, E)) : r(this, v).isOpen ? r(this, v).close(r(this, E)) : r(this, v).open(r(this, E));
|
276
276
|
}
|
277
277
|
setActive(t) {
|
278
|
-
b(this,
|
278
|
+
b(this, B, t), t ? r(this, E).classList.add("drawer-trigger_active") : r(this, E).classList.remove("drawer-trigger_active");
|
279
279
|
}
|
280
280
|
}
|
281
|
-
|
282
|
-
var p,
|
283
|
-
class
|
281
|
+
E = new WeakMap(), v = new WeakMap(), P = new WeakMap(), B = new WeakMap();
|
282
|
+
var p, G, k, K, T;
|
283
|
+
class _e extends oe {
|
284
284
|
constructor({ target: e, options: a }) {
|
285
285
|
super();
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
m(this, D, void 0);
|
286
|
+
y(this, p, void 0);
|
287
|
+
y(this, G, void 0);
|
288
|
+
y(this, k, void 0);
|
289
|
+
y(this, K, void 0);
|
290
|
+
y(this, T, void 0);
|
292
291
|
this.handleDocumentClick = async (u) => {
|
293
292
|
var o;
|
294
293
|
if (((o = u.__drawerTrigger) == null ? void 0 : o.owner) === this)
|
295
294
|
return;
|
296
295
|
const h = u.target;
|
297
|
-
if (u.composedPath(),
|
296
|
+
if (u.composedPath(), this.dom.panel.contains(h))
|
298
297
|
return;
|
299
298
|
const i = h == null ? void 0 : h.closest("[data-drawer]");
|
300
|
-
i ? i.getAttribute("data-drawer") ===
|
299
|
+
i ? i.getAttribute("data-drawer") === r(this, T) ? this.handleUnderlayClick(u) : this.handleOtherDrawerClick(u) : this.handleOutsideClick(u);
|
301
300
|
}, this.handleKeydown = (u) => {
|
302
|
-
|
301
|
+
r(this, p).closeOnEsc && u.key === "Escape" && this.close();
|
303
302
|
};
|
304
|
-
const s =
|
303
|
+
const s = Z(a ? [X, a] : [X]), f = Y(e);
|
305
304
|
if (f === null)
|
306
305
|
throw new Error("Drawer's root cannot be found");
|
307
|
-
b(this,
|
308
|
-
const d = f.querySelector(
|
306
|
+
b(this, T, f.getAttribute("data-drawer"));
|
307
|
+
const d = f.querySelector(Ae);
|
309
308
|
if (d === null)
|
310
|
-
throw new Error(`Drawer's panel cannot be found. Alias: ${
|
311
|
-
|
309
|
+
throw new Error(`Drawer's panel cannot be found. Alias: ${r(this, T)}`);
|
310
|
+
this.dom = {
|
312
311
|
root: f,
|
313
312
|
panel: d
|
314
|
-
}
|
313
|
+
}, this.setOptions(s), this.dom.panel.setAttribute("tabindex", "-1"), this.dom.root.classList.add("drawer_initialized");
|
315
314
|
}
|
316
315
|
addEventListeners() {
|
317
|
-
|
316
|
+
this.dom.root.addEventListener("keydown", this.handleKeydown), document.addEventListener("click", this.handleDocumentClick);
|
318
317
|
}
|
319
318
|
removeEventListeners() {
|
320
|
-
|
319
|
+
this.dom.root.removeEventListener("keydown", this.handleKeydown), document.removeEventListener("click", this.handleDocumentClick);
|
321
320
|
}
|
322
321
|
// Accessors
|
323
322
|
get isOpen() {
|
324
|
-
return
|
323
|
+
return r(this, k);
|
325
324
|
}
|
326
325
|
get isModal() {
|
327
|
-
return
|
326
|
+
return r(this, p).modal;
|
328
327
|
}
|
329
328
|
set isModal(e) {
|
330
|
-
|
329
|
+
this.dom.root.classList[e ? "add" : "remove"]("drawer_modal");
|
331
330
|
}
|
332
331
|
set zIndex(e) {
|
333
|
-
|
332
|
+
this.dom.root.style.setProperty("--z-index", String(e)), b(this, G, e);
|
334
333
|
}
|
335
334
|
get zIndex() {
|
336
|
-
return
|
335
|
+
return r(this, G);
|
337
336
|
}
|
338
337
|
// Methods
|
339
338
|
async open(e) {
|
340
|
-
await
|
339
|
+
await F(0), !r(this, k) && (this.emit("beforeOpen", { drawer: this, trigger: e }), b(this, k, !0), this.dom.root.classList.add(r(this, p).openClass), this.emit("open", { drawer: this, trigger: e }), typeof r(this, p).openAnimationDuration == "number" && F(r(this, p).openAnimationDuration), this.emit("openAnimationEnd", { drawer: this, trigger: e }), this.focus(), this.addEventListeners());
|
341
340
|
}
|
342
341
|
async close(e) {
|
343
|
-
|
342
|
+
r(this, p).onCloseConfirm && !r(this, p).onCloseConfirm(this, e) || (this.emit("beforeClose", { drawer: this, trigger: e }), this.removeEventListeners(), b(this, k, !1), this.dom.root.classList.remove(r(this, p).openClass), this.emit("close", { drawer: this, trigger: e }), typeof r(this, p).closeAnimationDuration == "number" && F(r(this, p).closeAnimationDuration), this.emit("closeAnimationEnd", { drawer: this, trigger: e }));
|
344
343
|
}
|
345
344
|
handleOtherDrawerClick(e) {
|
346
345
|
}
|
347
346
|
handleOutsideClick(e) {
|
348
|
-
|
347
|
+
r(this, p).closeOnOutsideClick && (typeof r(this, p).closeOnOutsideClick == "object" && r(this, p).closeOnOutsideClick.hasOwnProperty("checkTarget") ? r(this, p).closeOnOutsideClick.checkTarget(e.target) && this.close() : this.close());
|
349
348
|
}
|
350
349
|
handleUnderlayClick(e) {
|
351
|
-
|
350
|
+
r(this, p).closeOnOutsideClick && this.close();
|
352
351
|
}
|
353
352
|
focus() {
|
354
|
-
|
353
|
+
r(this, p).focusOnChild && this.focusChild() || this.focusSelf();
|
355
354
|
}
|
356
355
|
focusSelf() {
|
357
|
-
|
356
|
+
this.dom.panel.focus();
|
358
357
|
}
|
359
358
|
focusChild() {
|
360
|
-
const e =
|
359
|
+
const e = this.dom.panel.querySelector(Ce.join(","));
|
361
360
|
return e ? (e.focus(), !0) : !1;
|
362
361
|
}
|
363
362
|
setOptions(e) {
|
364
363
|
var a;
|
365
|
-
e.hasOwnProperty("modal") && ((a =
|
364
|
+
e.hasOwnProperty("modal") && ((a = r(this, p)) == null ? void 0 : a.modal) !== e.modal && (this.isModal = e.modal), b(this, p, r(this, p) ? Z([r(this, p), e]) : e);
|
366
365
|
}
|
367
366
|
assignGroup(e) {
|
368
|
-
b(this,
|
367
|
+
b(this, K, e);
|
369
368
|
}
|
370
369
|
}
|
371
|
-
p = new WeakMap(),
|
372
|
-
var
|
373
|
-
class
|
370
|
+
p = new WeakMap(), G = new WeakMap(), k = new WeakMap(), K = new WeakMap(), T = new WeakMap();
|
371
|
+
var x, A, C, D, S, L;
|
372
|
+
class ee {
|
374
373
|
constructor(t) {
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
b(this,
|
382
|
-
s.isModal ? (
|
374
|
+
y(this, x, void 0);
|
375
|
+
y(this, A, void 0);
|
376
|
+
y(this, C, void 0);
|
377
|
+
y(this, D, void 0);
|
378
|
+
y(this, S, void 0);
|
379
|
+
y(this, L, void 0);
|
380
|
+
b(this, A, []), b(this, C, []), b(this, S, /* @__PURE__ */ new Set()), b(this, L, /* @__PURE__ */ new Map()), this.onBeforeOpen = ({ drawer: s, trigger: f }) => {
|
381
|
+
s.isModal ? (r(this, L).set(s, r(this, A).length), r(this, A).push(s), s.zIndex = r(this, C).length + r(this, A).length) : (r(this, L).set(s, r(this, C).length), r(this, C).push(s), s.zIndex = r(this, C).length, r(this, A).length > 0 && r(this, A).forEach((d, u) => d.zIndex = r(this, C).length + u + 1)), this.lockScroll(s);
|
383
382
|
}, this.onCloseAnimationEnd = ({ drawer: s, trigger: f }) => {
|
384
|
-
const d = s.isModal ?
|
385
|
-
for (delete d[
|
383
|
+
const d = s.isModal ? r(this, A) : r(this, C);
|
384
|
+
for (delete d[r(this, L).get(s)]; d.length && !d.at(-1); )
|
386
385
|
d.pop();
|
387
|
-
|
386
|
+
r(this, L).delete(s), this.unlockScroll(s);
|
388
387
|
};
|
389
|
-
const e =
|
388
|
+
const e = Y(t);
|
390
389
|
if (e === null)
|
391
390
|
throw new Error("Drawer's group root cannot be found");
|
392
|
-
b(this,
|
393
|
-
const a =
|
391
|
+
b(this, x, e);
|
392
|
+
const a = r(this, x).closest("[data-scrollable], html") || r(this, x).matches("[data-scrollable], html") && r(this, x);
|
394
393
|
if (a === null)
|
395
394
|
throw new Error("Scrollable container for group root cannot be found");
|
396
|
-
b(this,
|
395
|
+
b(this, D, a);
|
397
396
|
}
|
398
397
|
add(t) {
|
399
398
|
t.on("beforeOpen", this.onBeforeOpen), t.on("closeAnimationEnd", this.onCloseAnimationEnd), t.assignGroup(this);
|
400
399
|
}
|
401
400
|
lockScroll(t) {
|
402
|
-
|
401
|
+
r(this, S).size === 0 && r(this, D).classList.add("scroll-lock-by-drawer"), r(this, S).add(t);
|
403
402
|
}
|
404
403
|
unlockScroll(t) {
|
405
|
-
|
404
|
+
r(this, S).delete(t), r(this, S).size === 0 && r(this, D).classList.remove("scroll-lock-by-drawer");
|
406
405
|
}
|
407
406
|
}
|
408
|
-
|
409
|
-
var
|
410
|
-
const
|
407
|
+
x = new WeakMap(), A = new WeakMap(), C = new WeakMap(), D = new WeakMap(), S = new WeakMap(), L = new WeakMap();
|
408
|
+
var I, z;
|
409
|
+
const q = class q {
|
411
410
|
constructor() {
|
412
|
-
|
413
|
-
|
414
|
-
if (
|
415
|
-
return
|
416
|
-
|
411
|
+
y(this, I, /* @__PURE__ */ new Map());
|
412
|
+
y(this, z, /* @__PURE__ */ new Map());
|
413
|
+
if (q.instance)
|
414
|
+
return q.instance;
|
415
|
+
q.instance = this;
|
417
416
|
}
|
418
417
|
init(t) {
|
419
|
-
document.querySelectorAll(`[${
|
420
|
-
const d = f.getAttribute(
|
421
|
-
typeof d == "string" &&
|
422
|
-
}),
|
418
|
+
document.querySelectorAll(`[${$}]`).forEach((f) => {
|
419
|
+
const d = f.getAttribute($);
|
420
|
+
typeof d == "string" && r(this, z).set(d, new ee(f));
|
421
|
+
}), r(this, z).set("default", new ee(document.documentElement)), document.querySelectorAll("[data-drawer]").forEach((f) => {
|
423
422
|
var o;
|
424
423
|
const d = f.getAttribute("data-drawer");
|
425
424
|
if (typeof d != "string")
|
426
425
|
return;
|
427
|
-
const u = new
|
428
|
-
|
429
|
-
const h = f.closest(`[${
|
426
|
+
const u = new _e({ target: f, options: t });
|
427
|
+
r(this, I).set(d, u);
|
428
|
+
const h = f.closest(`[${$}]`), i = h ? h.getAttribute($) : "default";
|
430
429
|
if (typeof i != "string")
|
431
430
|
throw new Error("Group doesn't have alias set correctly");
|
432
|
-
(o =
|
431
|
+
(o = r(this, z).get(i)) == null || o.add(u);
|
433
432
|
}), document.querySelectorAll("[data-drawer-open], [data-drawer-close], [data-drawer-toggle]").forEach((f) => {
|
434
433
|
if (f.hasAttribute("data-drawer-open")) {
|
435
434
|
const d = f.getAttribute("data-drawer-open");
|
436
|
-
new
|
435
|
+
new H({ target: f, type: "open", owner: this.get(d) });
|
437
436
|
} else if (f.hasAttribute("data-drawer-close")) {
|
438
437
|
const d = f.getAttribute("data-drawer-close");
|
439
|
-
new
|
438
|
+
new H({ target: f, type: "close", owner: this.get(d) });
|
440
439
|
} else {
|
441
440
|
const d = f.getAttribute("data-drawer-toggle");
|
442
|
-
new
|
441
|
+
new H({ target: f, type: "toggle", owner: this.get(d) });
|
443
442
|
}
|
444
443
|
});
|
445
444
|
}
|
@@ -452,22 +451,23 @@ const R = class R {
|
|
452
451
|
(s = this.get(t)) == null || s.close(e);
|
453
452
|
}
|
454
453
|
get(t) {
|
455
|
-
return typeof t == "string" &&
|
454
|
+
return typeof t == "string" && r(this, I).get(t) || null;
|
456
455
|
}
|
457
456
|
on(t, e, a) {
|
458
457
|
var s;
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
458
|
+
if (t)
|
459
|
+
(s = this.get(t)) == null || s.on(e, a);
|
460
|
+
else
|
461
|
+
for (const [f, d] of r(this, I))
|
462
|
+
d.on(e, a);
|
463
463
|
}
|
464
464
|
};
|
465
|
-
|
466
|
-
let
|
467
|
-
typeof window < "u" && (window.hasOwnProperty("app") || (window.app = {}), window.app.drawers = new
|
465
|
+
I = new WeakMap(), z = new WeakMap();
|
466
|
+
let V = q;
|
467
|
+
typeof window < "u" && (window.hasOwnProperty("app") || (window.app = {}), window.app.drawers = new V());
|
468
468
|
export {
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
469
|
+
_e as Drawer,
|
470
|
+
ee as DrawersGroup,
|
471
|
+
H as Trigger,
|
472
|
+
V as default
|
473
473
|
};
|
package/dist/drawers.umd.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
(function(p,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(p=typeof globalThis<"u"?globalThis:p||self,b(p.Drawers={}))})(this,function(p){"use strict";var
|
1
|
+
(function(p,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(p=typeof globalThis<"u"?globalThis:p||self,b(p.Drawers={}))})(this,function(p){"use strict";var oe=(p,b,C)=>{if(!b.has(p))throw TypeError("Cannot "+C)};var t=(p,b,C)=>(oe(p,b,"read from private field"),C?C.call(p):b.get(p)),g=(p,b,C)=>{if(b.has(p))throw TypeError("Cannot add the same private member more than once");b instanceof WeakSet?b.add(p):b.set(p,C)},O=(p,b,C,H)=>(oe(p,b,"write to private field"),H?H.call(p,C):b.set(p,C),C);var _,E,z,B,m,$,T,Q,U,P,j,S,N,M,k,q,G;function b(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var C={exports:{}};(function(r){var n=Object.prototype.hasOwnProperty,e="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(e=!1));function s(u,i,o){this.fn=u,this.context=i,this.once=o||!1}function f(u,i,o,c,A){if(typeof o!="function")throw new TypeError("The listener must be a function");var v=new s(o,c||u,A),w=e?e+i:i;return u._events[w]?u._events[w].fn?u._events[w]=[u._events[w],v]:u._events[w].push(v):(u._events[w]=v,u._eventsCount++),u}function d(u,i){--u._eventsCount===0?u._events=new a:delete u._events[i]}function h(){this._events=new a,this._eventsCount=0}h.prototype.eventNames=function(){var i=[],o,c;if(this._eventsCount===0)return i;for(c in o=this._events)n.call(o,c)&&i.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(o)):i},h.prototype.listeners=function(i){var o=e?e+i:i,c=this._events[o];if(!c)return[];if(c.fn)return[c.fn];for(var A=0,v=c.length,w=new Array(v);A<v;A++)w[A]=c[A].fn;return w},h.prototype.listenerCount=function(i){var o=e?e+i:i,c=this._events[o];return c?c.fn?1:c.length:0},h.prototype.emit=function(i,o,c,A,v,w){var L=e?e+i:i;if(!this._events[L])return!1;var l=this._events[L],x=arguments.length,D,y;if(l.fn){switch(l.once&&this.removeListener(i,l.fn,void 0,!0),x){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,o),!0;case 3:return l.fn.call(l.context,o,c),!0;case 4:return l.fn.call(l.context,o,c,A),!0;case 5:return l.fn.call(l.context,o,c,A,v),!0;case 6:return l.fn.call(l.context,o,c,A,v,w),!0}for(y=1,D=new Array(x-1);y<x;y++)D[y-1]=arguments[y];l.fn.apply(l.context,D)}else{var je=l.length,F;for(y=0;y<je;y++)switch(l[y].once&&this.removeListener(i,l[y].fn,void 0,!0),x){case 1:l[y].fn.call(l[y].context);break;case 2:l[y].fn.call(l[y].context,o);break;case 3:l[y].fn.call(l[y].context,o,c);break;case 4:l[y].fn.call(l[y].context,o,c,A);break;default:if(!D)for(F=1,D=new Array(x-1);F<x;F++)D[F-1]=arguments[F];l[y].fn.apply(l[y].context,D)}}return!0},h.prototype.on=function(i,o,c){return f(this,i,o,c,!1)},h.prototype.once=function(i,o,c){return f(this,i,o,c,!0)},h.prototype.removeListener=function(i,o,c,A){var v=e?e+i:i;if(!this._events[v])return this;if(!o)return d(this,v),this;var w=this._events[v];if(w.fn)w.fn===o&&(!A||w.once)&&(!c||w.context===c)&&d(this,v);else{for(var L=0,l=[],x=w.length;L<x;L++)(w[L].fn!==o||A&&!w[L].once||c&&w[L].context!==c)&&l.push(w[L]);l.length?this._events[v]=l.length===1?l[0]:l:d(this,v)}return this},h.prototype.removeAllListeners=function(i){var o;return i?(o=e?e+i:i,this._events[o]&&d(this,o)):(this._events=new a,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=e,h.EventEmitter=h,r.exports=h})(C);var H=C.exports;const le=b(H);var ae=function(n){return ce(n)&&!ue(n)};function ce(r){return!!r&&typeof r=="object"}function ue(r){var n=Object.prototype.toString.call(r);return n==="[object RegExp]"||n==="[object Date]"||de(r)}var he=typeof Symbol=="function"&&Symbol.for,fe=he?Symbol.for("react.element"):60103;function de(r){return r.$$typeof===fe}function pe(r){return Array.isArray(r)?[]:{}}function R(r,n){return n.clone!==!1&&n.isMergeableObject(r)?I(pe(r),r,n):r}function me(r,n,e){return r.concat(n).map(function(a){return R(a,e)})}function we(r,n){if(!n.customMerge)return I;var e=n.customMerge(r);return typeof e=="function"?e:I}function ye(r){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r).filter(function(n){return Object.propertyIsEnumerable.call(r,n)}):[]}function ee(r){return Object.keys(r).concat(ye(r))}function te(r,n){try{return n in r}catch{return!1}}function be(r,n){return te(r,n)&&!(Object.hasOwnProperty.call(r,n)&&Object.propertyIsEnumerable.call(r,n))}function ge(r,n,e){var a={};return e.isMergeableObject(r)&&ee(r).forEach(function(s){a[s]=R(r[s],e)}),ee(n).forEach(function(s){be(r,s)||(te(r,s)&&e.isMergeableObject(n[s])?a[s]=we(s,e)(r[s],n[s],e):a[s]=R(n[s],e))}),a}function I(r,n,e){e=e||{},e.arrayMerge=e.arrayMerge||me,e.isMergeableObject=e.isMergeableObject||ae,e.cloneUnlessOtherwiseSpecified=R;var a=Array.isArray(n),s=Array.isArray(r),f=a===s;return f?a?e.arrayMerge(r,n,e):ge(r,n,e):R(n,e)}I.all=function(n,e){if(!Array.isArray(n))throw new Error("first argument should be an array");return n.reduce(function(a,s){return I(a,s,e)},{})};var Oe=I,ve=Oe;const Ee=b(ve);/*!
|
2
2
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
3
3
|
*
|
4
4
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
5
5
|
* Released under the MIT License.
|
6
|
-
*/function
|
6
|
+
*/function ne(r){return Object.prototype.toString.call(r)==="[object Object]"}function Ae(r){var n,e;return ne(r)===!1?!1:(n=r.constructor,n===void 0?!0:(e=n.prototype,!(ne(e)===!1||e.hasOwnProperty("isPrototypeOf")===!1)))}function W(r){return r instanceof Element?r:document.querySelector(r)}async function X(r){return await new Promise(n=>setTimeout(n,r))}const Ce='[data-elem="drawer.panel"]',V="data-drawers-group",_e=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],re={modal:!0,focusOnChild:!0,closeOnEsc:!0,closeOnOutsideClick:!0,closeOnUnderlayClick:!0,onCloseConfirm:()=>!0,onBeforeClose:null,onClose:null,onCloseAnimationEnd:null,onBeforeOpen:null,onOpen:null,onOpenAnimationEnd:null,openClass:"drawer_open",openAnimationDuration:0,closeAnimationDuration:0,lockPageScroll:!0};function se(r){return Ee.all(r,{isMergeableObject:Ae})}class Y{constructor({target:n,type:e,owner:a}){g(this,_,void 0);g(this,E,void 0);g(this,z,void 0);g(this,B,!1);const s=W(n);if(!s)throw new Error("Trigger element cannot be found");O(this,_,s),O(this,E,a),O(this,z,e),this.init()}get isActive(){return t(this,B)}get owner(){return t(this,E)}init(){t(this,_).addEventListener("click",n=>this.clickHandler(n)),t(this,E).on("open",()=>this.setActive(!0)),t(this,E).on("close",()=>this.setActive(!1))}clickHandler(n){n.__drawerTrigger=this,t(this,z)==="open"?t(this,E).isOpen||t(this,E).open(t(this,_)):t(this,z)==="close"?t(this,E).isOpen&&t(this,E).close(t(this,_)):t(this,E).isOpen?t(this,E).close(t(this,_)):t(this,E).open(t(this,_))}setActive(n){O(this,B,n),n?t(this,_).classList.add("drawer-trigger_active"):t(this,_).classList.remove("drawer-trigger_active")}}_=new WeakMap,E=new WeakMap,z=new WeakMap,B=new WeakMap;class ie extends le{constructor({target:e,options:a}){super();g(this,m,void 0);g(this,$,void 0);g(this,T,void 0);g(this,Q,void 0);g(this,U,void 0);this.handleDocumentClick=async h=>{var o;if(((o=h.__drawerTrigger)==null?void 0:o.owner)===this)return;const u=h.target;if(h.composedPath(),this.dom.panel.contains(u))return;const i=u==null?void 0:u.closest("[data-drawer]");i?i.getAttribute("data-drawer")===t(this,U)?this.handleUnderlayClick(h):this.handleOtherDrawerClick(h):this.handleOutsideClick(h)},this.handleKeydown=h=>{t(this,m).closeOnEsc&&h.key==="Escape"&&this.close()};const s=se(a?[re,a]:[re]),f=W(e);if(f===null)throw new Error("Drawer's root cannot be found");O(this,U,f.getAttribute("data-drawer"));const d=f.querySelector(Ce);if(d===null)throw new Error(`Drawer's panel cannot be found. Alias: ${t(this,U)}`);this.dom={root:f,panel:d},this.setOptions(s),this.dom.panel.setAttribute("tabindex","-1"),this.dom.root.classList.add("drawer_initialized")}addEventListeners(){this.dom.root.addEventListener("keydown",this.handleKeydown),document.addEventListener("click",this.handleDocumentClick)}removeEventListeners(){this.dom.root.removeEventListener("keydown",this.handleKeydown),document.removeEventListener("click",this.handleDocumentClick)}get isOpen(){return t(this,T)}get isModal(){return t(this,m).modal}set isModal(e){this.dom.root.classList[e?"add":"remove"]("drawer_modal")}set zIndex(e){this.dom.root.style.setProperty("--z-index",String(e)),O(this,$,e)}get zIndex(){return t(this,$)}async open(e){await X(0),!t(this,T)&&(this.emit("beforeOpen",{drawer:this,trigger:e}),O(this,T,!0),this.dom.root.classList.add(t(this,m).openClass),this.emit("open",{drawer:this,trigger:e}),typeof t(this,m).openAnimationDuration=="number"&&X(t(this,m).openAnimationDuration),this.emit("openAnimationEnd",{drawer:this,trigger:e}),this.focus(),this.addEventListeners())}async close(e){t(this,m).onCloseConfirm&&!t(this,m).onCloseConfirm(this,e)||(this.emit("beforeClose",{drawer:this,trigger:e}),this.removeEventListeners(),O(this,T,!1),this.dom.root.classList.remove(t(this,m).openClass),this.emit("close",{drawer:this,trigger:e}),typeof t(this,m).closeAnimationDuration=="number"&&X(t(this,m).closeAnimationDuration),this.emit("closeAnimationEnd",{drawer:this,trigger:e}))}handleOtherDrawerClick(e){}handleOutsideClick(e){t(this,m).closeOnOutsideClick&&(typeof t(this,m).closeOnOutsideClick=="object"&&t(this,m).closeOnOutsideClick.hasOwnProperty("checkTarget")?t(this,m).closeOnOutsideClick.checkTarget(e.target)&&this.close():this.close())}handleUnderlayClick(e){t(this,m).closeOnOutsideClick&&this.close()}focus(){t(this,m).focusOnChild&&this.focusChild()||this.focusSelf()}focusSelf(){this.dom.panel.focus()}focusChild(){const e=this.dom.panel.querySelector(_e.join(","));return e?(e.focus(),!0):!1}setOptions(e){var a;e.hasOwnProperty("modal")&&((a=t(this,m))==null?void 0:a.modal)!==e.modal&&(this.isModal=e.modal),O(this,m,t(this,m)?se([t(this,m),e]):e)}assignGroup(e){O(this,Q,e)}}m=new WeakMap,$=new WeakMap,T=new WeakMap,Q=new WeakMap,U=new WeakMap;class Z{constructor(n){g(this,P,void 0);g(this,j,void 0);g(this,S,void 0);g(this,N,void 0);g(this,M,void 0);g(this,k,void 0);O(this,j,[]),O(this,S,[]),O(this,M,new Set),O(this,k,new Map),this.onBeforeOpen=({drawer:s,trigger:f})=>{s.isModal?(t(this,k).set(s,t(this,j).length),t(this,j).push(s),s.zIndex=t(this,S).length+t(this,j).length):(t(this,k).set(s,t(this,S).length),t(this,S).push(s),s.zIndex=t(this,S).length,t(this,j).length>0&&t(this,j).forEach((d,h)=>d.zIndex=t(this,S).length+h+1)),this.lockScroll(s)},this.onCloseAnimationEnd=({drawer:s,trigger:f})=>{const d=s.isModal?t(this,j):t(this,S);for(delete d[t(this,k).get(s)];d.length&&!d.at(-1);)d.pop();t(this,k).delete(s),this.unlockScroll(s)};const e=W(n);if(e===null)throw new Error("Drawer's group root cannot be found");O(this,P,e);const a=t(this,P).closest("[data-scrollable], html")||t(this,P).matches("[data-scrollable], html")&&t(this,P);if(a===null)throw new Error("Scrollable container for group root cannot be found");O(this,N,a)}add(n){n.on("beforeOpen",this.onBeforeOpen),n.on("closeAnimationEnd",this.onCloseAnimationEnd),n.assignGroup(this)}lockScroll(n){t(this,M).size===0&&t(this,N).classList.add("scroll-lock-by-drawer"),t(this,M).add(n)}unlockScroll(n){t(this,M).delete(n),t(this,M).size===0&&t(this,N).classList.remove("scroll-lock-by-drawer")}}P=new WeakMap,j=new WeakMap,S=new WeakMap,N=new WeakMap,M=new WeakMap,k=new WeakMap;const K=class K{constructor(){g(this,q,new Map);g(this,G,new Map);if(K.instance)return K.instance;K.instance=this}init(n){document.querySelectorAll(`[${V}]`).forEach(f=>{const d=f.getAttribute(V);typeof d=="string"&&t(this,G).set(d,new Z(f))}),t(this,G).set("default",new Z(document.documentElement)),document.querySelectorAll("[data-drawer]").forEach(f=>{var o;const d=f.getAttribute("data-drawer");if(typeof d!="string")return;const h=new ie({target:f,options:n});t(this,q).set(d,h);const u=f.closest(`[${V}]`),i=u?u.getAttribute(V):"default";if(typeof i!="string")throw new Error("Group doesn't have alias set correctly");(o=t(this,G).get(i))==null||o.add(h)}),document.querySelectorAll("[data-drawer-open], [data-drawer-close], [data-drawer-toggle]").forEach(f=>{if(f.hasAttribute("data-drawer-open")){const d=f.getAttribute("data-drawer-open");new Y({target:f,type:"open",owner:this.get(d)})}else if(f.hasAttribute("data-drawer-close")){const d=f.getAttribute("data-drawer-close");new Y({target:f,type:"close",owner:this.get(d)})}else{const d=f.getAttribute("data-drawer-toggle");new Y({target:f,type:"toggle",owner:this.get(d)})}})}open(n,{trigger:e,options:a}={}){var s;(s=this.get(n))==null||s.open(e)}close(n,{trigger:e,options:a}={}){var s;(s=this.get(n))==null||s.close(e)}get(n){return typeof n=="string"&&t(this,q).get(n)||null}on(n,e,a){var s;if(n)(s=this.get(n))==null||s.on(e,a);else for(const[f,d]of t(this,q))d.on(e,a)}};q=new WeakMap,G=new WeakMap;let J=K;typeof window<"u"&&(window.hasOwnProperty("app")||(window.app={}),window.app.drawers=new J),p.Drawer=ie,p.DrawersGroup=Z,p.Trigger=Y,p.default=J,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|