@profitliga/ui 2.0.5 → 2.0.7
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/components/v2/AlertDialog/AlertDialog.css +1 -1
- package/dist/components/v2/AlertDialog/AlertDialog.vue.d.ts +2 -0
- package/dist/components/v2/AlertDialog/AlertDialog.vue.js +2 -2
- package/dist/components/v2/AlertDialog/AlertDialog.vue2.js +73 -70
- package/dist/components/v2/BottomSheet/BottomSheet.css +1 -1
- package/dist/components/v2/BottomSheet/BottomSheet.vue.d.ts +2 -0
- package/dist/components/v2/BottomSheet/BottomSheet.vue.js +1 -1
- package/dist/components/v2/BottomSheet/BottomSheet.vue2.js +75 -70
- package/dist/components/v2/Dialog/Dialog.css +1 -1
- package/dist/components/v2/Dialog/Dialog.vue.d.ts +2 -0
- package/dist/components/v2/Dialog/Dialog.vue.js +1 -1
- package/dist/components/v2/Dialog/Dialog.vue2.js +83 -78
- package/dist/components/v2/Drawer/Drawer.css +1 -1
- package/dist/components/v2/Drawer/Drawer.vue.d.ts +2 -0
- package/dist/components/v2/Drawer/Drawer.vue.js +2 -2
- package/dist/components/v2/Drawer/Drawer.vue2.js +94 -89
- package/dist/components/v2/shared/useLayerZIndex.util.d.ts +10 -0
- package/dist/components/v2/shared/useLayerZIndex.util.js +25 -13
- package/dist/utils/onClickOutside.util.js +27 -21
- package/package.json +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { X as
|
|
3
|
-
import { breakpoints as
|
|
4
|
-
import { onClickOutside as
|
|
5
|
-
import { useBodyScroll as
|
|
6
|
-
import { useFocusTrap as
|
|
1
|
+
import { defineComponent as Y, useModel as ee, useId as te, computed as g, useTemplateRef as E, ref as oe, watch as N, onBeforeUnmount as ie, unref as t, openBlock as s, createBlock as w, createSlots as se, withCtx as m, createElementVNode as d, createElementBlock as u, mergeProps as r, toDisplayString as x, createCommentVNode as c, renderSlot as f, normalizeProps as ae, guardReactiveProps as re, Fragment as ne, normalizeStyle as le, resolveDynamicComponent as K, createTextVNode as de, createVNode as ue, mergeModels as V } from "vue";
|
|
2
|
+
import { X as ce } from "@lucide/vue";
|
|
3
|
+
import { breakpoints as fe } from "../../../utils/breakpoints.util.js";
|
|
4
|
+
import { onClickOutside as ve } from "../../../utils/onClickOutside.util.js";
|
|
5
|
+
import { useBodyScroll as me } from "../../../utils/useBodyScroll.util.js";
|
|
6
|
+
import { useFocusTrap as ye } from "../../../utils/useFocusTrap.util.js";
|
|
7
7
|
import pe from "../BottomSheet/BottomSheet.vue.js";
|
|
8
|
-
import { ANIMATION_DURATION_MS as
|
|
9
|
-
import
|
|
10
|
-
import { useDelayedVisibility as
|
|
8
|
+
import { ANIMATION_DURATION_MS as q } from "../shared/animation.const.js";
|
|
9
|
+
import be from "../shared/Portal.vue.js";
|
|
10
|
+
import { useDelayedVisibility as ge } from "../shared/useDelayedVisibility.util.js";
|
|
11
11
|
import { useLayerZIndex as we } from "../shared/useLayerZIndex.util.js";
|
|
12
|
-
import { useTestId as
|
|
13
|
-
import { useTriggerAria as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
12
|
+
import { useTestId as ke } from "../shared/useTestId.util.js";
|
|
13
|
+
import { useTriggerAria as he } from "../shared/useTriggerAria.util.js";
|
|
14
|
+
import $e from "../shared/VisuallyHidden.vue.js";
|
|
15
|
+
const Ie = { class: "drawer-mobile" }, Ce = {
|
|
16
16
|
key: 1,
|
|
17
17
|
class: "drawer-mobile__divider"
|
|
18
|
-
},
|
|
18
|
+
}, Oe = ["data-state"], Pe = ["aria-describedby", "data-state"], De = { class: "drawer-content__header" }, Ee = ["aria-label"], Se = {
|
|
19
19
|
key: 0,
|
|
20
20
|
class: "drawer-content__divider"
|
|
21
|
-
},
|
|
21
|
+
}, Ze = /* @__PURE__ */ Y({
|
|
22
22
|
inheritAttrs: !1,
|
|
23
23
|
__name: "Drawer",
|
|
24
|
-
props: /* @__PURE__ */
|
|
24
|
+
props: /* @__PURE__ */ V({
|
|
25
25
|
position: { default: "right" },
|
|
26
26
|
title: { default: void 0 },
|
|
27
27
|
closeButton: { default: () => ({ enabled: !0 }) },
|
|
@@ -37,100 +37,103 @@ const $e = { class: "drawer-mobile" }, Ie = {
|
|
|
37
37
|
open: { type: Boolean, default: !1 },
|
|
38
38
|
openModifiers: {}
|
|
39
39
|
}),
|
|
40
|
-
emits: /* @__PURE__ */
|
|
41
|
-
setup(o, { expose:
|
|
42
|
-
const i = o,
|
|
40
|
+
emits: /* @__PURE__ */ V(["escapeKeyDown", "pointerDownOutside"], ["update:open"]),
|
|
41
|
+
setup(o, { expose: L, emit: F }) {
|
|
42
|
+
const i = o, k = F, n = ee(o, "open"), S = fe.smaller(i.breakpointMobile), h = te(), v = `drawer-title-${h}`, $ = `drawer-content-${h}`, B = `drawer-body-${h}`, a = ke(() => i.testId), U = g(() => ({
|
|
43
43
|
"aria-haspopup": "dialog",
|
|
44
|
-
"aria-expanded":
|
|
45
|
-
"aria-controls":
|
|
46
|
-
})),
|
|
44
|
+
"aria-expanded": n.value,
|
|
45
|
+
"aria-controls": n.value ? $ : void 0
|
|
46
|
+
})), R = g(() => i.title?.as ?? "h2"), Z = g(
|
|
47
47
|
() => i.position === "left" || i.position === "right" ? { width: `${i.width}px` } : { height: `${i.height}px` }
|
|
48
|
-
), z =
|
|
49
|
-
|
|
48
|
+
), z = E("triggerRef"), I = E("contentRef"), M = E("layerRef");
|
|
49
|
+
he({
|
|
50
50
|
host: () => z.value,
|
|
51
|
-
isOpen: () =>
|
|
52
|
-
contentId: () =>
|
|
51
|
+
isOpen: () => n.value,
|
|
52
|
+
contentId: () => $,
|
|
53
53
|
hasPopup: () => "dialog"
|
|
54
54
|
});
|
|
55
|
-
const { lockScroll:
|
|
56
|
-
() => i.zIndex === "auto" ?
|
|
57
|
-
), O =
|
|
55
|
+
const { lockScroll: H, unlockScroll: X } = me(), C = ye(() => I.value), y = we(), _ = g(
|
|
56
|
+
() => i.zIndex === "auto" ? y.zIndex.value : i.zIndex
|
|
57
|
+
), O = oe(!1);
|
|
58
58
|
async function p(e) {
|
|
59
59
|
if (!i.beforeClose) {
|
|
60
|
-
|
|
60
|
+
n.value = !1;
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
if (!O.value) {
|
|
64
64
|
O.value = !0;
|
|
65
65
|
try {
|
|
66
|
-
await i.beforeClose(e) && (
|
|
66
|
+
await i.beforeClose(e) && (n.value = !1);
|
|
67
67
|
} finally {
|
|
68
68
|
O.value = !1;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
function P(e) {
|
|
73
|
-
e.key === "Escape" && (
|
|
73
|
+
e.key === "Escape" && (k("escapeKeyDown", e), e.defaultPrevented || p("escapeKey"));
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
75
|
+
function j(e) {
|
|
76
|
+
k("pointerDownOutside", e), !i.disableOutsidePointerEvents && !e.defaultPrevented && p("outsidePointer");
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function T(e, l) {
|
|
79
79
|
e.defaultPrevented || !i.beforeClose || (e.preventDefault(), p(l));
|
|
80
80
|
}
|
|
81
|
-
function j(e) {
|
|
82
|
-
g("escapeKeyDown", e), R(e, "escapeKey");
|
|
83
|
-
}
|
|
84
81
|
function G(e) {
|
|
85
|
-
|
|
82
|
+
k("escapeKeyDown", e), T(e, "escapeKey");
|
|
83
|
+
}
|
|
84
|
+
function J(e) {
|
|
85
|
+
k("pointerDownOutside", e), !i.disableOutsidePointerEvents && T(e, "outsidePointer");
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
const Q = g(() => n.value && !S.value), { visible: W, dataState: A } = ge(
|
|
88
|
+
Q,
|
|
89
|
+
q,
|
|
90
90
|
{
|
|
91
91
|
onOpen: () => {
|
|
92
|
-
|
|
92
|
+
y.acquire(), H(), C.activate({ focusDelayMs: q }), document.addEventListener("keydown", P);
|
|
93
93
|
},
|
|
94
94
|
onCloseStart: () => {
|
|
95
|
-
|
|
95
|
+
C.deactivate(), document.removeEventListener("keydown", P);
|
|
96
96
|
},
|
|
97
97
|
onCloseEnd: () => {
|
|
98
|
-
|
|
98
|
+
X(), y.release();
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
|
+
N(M, (e) => y.registerElement(e));
|
|
102
103
|
let D;
|
|
103
|
-
return
|
|
104
|
-
D?.(), D = e ?
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}),
|
|
104
|
+
return N(I, (e) => {
|
|
105
|
+
D?.(), D = e ? ve(e, j, {
|
|
106
|
+
ignore: () => y.elementsAbove()
|
|
107
|
+
}) : void 0;
|
|
108
|
+
}), ie(() => {
|
|
109
|
+
D?.(), document.removeEventListener("keydown", P), C.deactivate();
|
|
110
|
+
}), L({
|
|
108
111
|
requestClose: (e = "programmatic") => p(e)
|
|
109
112
|
}), (e, l) => t(S) ? (s(), w(t(pe), {
|
|
110
113
|
key: 0,
|
|
111
|
-
open:
|
|
112
|
-
"onUpdate:open": l[0] || (l[0] = (
|
|
114
|
+
open: n.value,
|
|
115
|
+
"onUpdate:open": l[0] || (l[0] = (b) => n.value = b),
|
|
113
116
|
"z-index": o.zIndex,
|
|
114
117
|
"disable-outside-pointer-events": o.disableOutsidePointerEvents,
|
|
115
118
|
"disable-swipe-to-close": !!o.beforeClose,
|
|
116
119
|
"labelled-by": o.title?.text && !e.$slots.title ? v : void 0,
|
|
117
120
|
"test-id": o.testId,
|
|
118
|
-
onEscapeKeyDown:
|
|
119
|
-
onPointerDownOutside:
|
|
120
|
-
},
|
|
121
|
+
onEscapeKeyDown: G,
|
|
122
|
+
onPointerDownOutside: J
|
|
123
|
+
}, se({
|
|
121
124
|
default: m(() => [
|
|
122
|
-
d("div",
|
|
123
|
-
o.title?.text && !e.$slots.title ? (s(), u("div",
|
|
125
|
+
d("div", Ie, [
|
|
126
|
+
o.title?.text && !e.$slots.title ? (s(), u("div", r({
|
|
124
127
|
key: 0,
|
|
125
128
|
id: v,
|
|
126
129
|
class: "drawer-mobile__title"
|
|
127
|
-
}, t(a)("title")),
|
|
128
|
-
o.divider ? (s(), u("div",
|
|
129
|
-
d("div",
|
|
130
|
+
}, t(a)("title")), x(o.title.text), 17)) : c("", !0),
|
|
131
|
+
o.divider ? (s(), u("div", Ce)) : c("", !0),
|
|
132
|
+
d("div", r({ class: "drawer-mobile__content" }, t(a)("body")), [
|
|
130
133
|
f(e.$slots, "title", {}, void 0, !0),
|
|
131
134
|
f(e.$slots, "default", {}, void 0, !0)
|
|
132
135
|
], 16),
|
|
133
|
-
e.$slots.actions ? (s(), u("div",
|
|
136
|
+
e.$slots.actions ? (s(), u("div", r({
|
|
134
137
|
key: 2,
|
|
135
138
|
class: "drawer-mobile__actions"
|
|
136
139
|
}, t(a)("actions")), [
|
|
@@ -142,55 +145,57 @@ const $e = { class: "drawer-mobile" }, Ie = {
|
|
|
142
145
|
}, [
|
|
143
146
|
e.$slots.trigger ? {
|
|
144
147
|
name: "trigger",
|
|
145
|
-
fn: m((
|
|
146
|
-
f(e.$slots, "trigger",
|
|
148
|
+
fn: m((b) => [
|
|
149
|
+
f(e.$slots, "trigger", ae(re(b)), void 0, !0)
|
|
147
150
|
]),
|
|
148
151
|
key: "0"
|
|
149
152
|
} : void 0
|
|
150
153
|
]), 1032, ["open", "z-index", "disable-outside-pointer-events", "disable-swipe-to-close", "labelled-by", "test-id"])) : (s(), u(ne, { key: 1 }, [
|
|
151
|
-
e.$slots.trigger ? (s(), u("span",
|
|
154
|
+
e.$slots.trigger ? (s(), u("span", r({
|
|
152
155
|
key: 0,
|
|
153
156
|
ref_key: "triggerRef",
|
|
154
157
|
ref: z,
|
|
155
158
|
class: "drawer-trigger"
|
|
156
159
|
}, t(a)("trigger"), {
|
|
157
|
-
onClick: l[1] || (l[1] = (
|
|
160
|
+
onClick: l[1] || (l[1] = (b) => n.value = !0)
|
|
158
161
|
}), [
|
|
159
|
-
f(e.$slots, "trigger", { props:
|
|
162
|
+
f(e.$slots, "trigger", { props: U.value }, void 0, !0)
|
|
160
163
|
], 16)) : c("", !0),
|
|
161
|
-
t(
|
|
164
|
+
t(W) ? (s(), w(be, { key: 1 }, {
|
|
162
165
|
default: m(() => [
|
|
163
166
|
d("div", {
|
|
167
|
+
ref_key: "layerRef",
|
|
168
|
+
ref: M,
|
|
164
169
|
class: "drawer-layer",
|
|
165
|
-
style:
|
|
170
|
+
style: le({ zIndex: _.value })
|
|
166
171
|
}, [
|
|
167
|
-
d("div",
|
|
172
|
+
d("div", r({
|
|
168
173
|
class: "overlay drawer-overlay",
|
|
169
|
-
"data-state": t(
|
|
170
|
-
}, t(a)("overlay")), null, 16,
|
|
171
|
-
d("div",
|
|
172
|
-
id:
|
|
174
|
+
"data-state": t(A)
|
|
175
|
+
}, t(a)("overlay")), null, 16, Oe),
|
|
176
|
+
d("div", r({
|
|
177
|
+
id: $,
|
|
173
178
|
ref_key: "contentRef",
|
|
174
|
-
ref:
|
|
179
|
+
ref: I,
|
|
175
180
|
role: "dialog",
|
|
176
181
|
"aria-modal": "true",
|
|
177
182
|
"aria-labelledby": v,
|
|
178
183
|
"aria-describedby": e.$slots.default ? B : void 0,
|
|
179
184
|
class: ["drawer-content", `drawer-content--${o.position}`],
|
|
180
|
-
"data-state": t(
|
|
181
|
-
style:
|
|
185
|
+
"data-state": t(A),
|
|
186
|
+
style: Z.value
|
|
182
187
|
}, { ...e.$attrs, ...t(a)("content") }), [
|
|
183
|
-
d("div",
|
|
184
|
-
o.title?.text ? (s(), w(
|
|
188
|
+
d("div", De, [
|
|
189
|
+
o.title?.text ? (s(), w(K(R.value), r({
|
|
185
190
|
key: 0,
|
|
186
191
|
id: v,
|
|
187
192
|
class: "drawer-content__title"
|
|
188
193
|
}, t(a)("title")), {
|
|
189
194
|
default: m(() => [
|
|
190
|
-
|
|
195
|
+
de(x(o.title.text), 1)
|
|
191
196
|
]),
|
|
192
197
|
_: 1
|
|
193
|
-
}, 16)) : e.$slots.title ? (s(), w(
|
|
198
|
+
}, 16)) : e.$slots.title ? (s(), w(K(R.value), r({
|
|
194
199
|
key: 1,
|
|
195
200
|
id: v,
|
|
196
201
|
class: "drawer-content__title"
|
|
@@ -199,37 +204,37 @@ const $e = { class: "drawer-mobile" }, Ie = {
|
|
|
199
204
|
f(e.$slots, "title", {}, void 0, !0)
|
|
200
205
|
]),
|
|
201
206
|
_: 3
|
|
202
|
-
}, 16)) : (s(), w(
|
|
207
|
+
}, 16)) : (s(), w($e, { key: 2 }, {
|
|
203
208
|
default: m(() => [
|
|
204
209
|
d("h2", { id: v }, "Боковая панель")
|
|
205
210
|
]),
|
|
206
211
|
_: 1
|
|
207
212
|
})),
|
|
208
|
-
o.closeButton?.enabled ? (s(), u("button",
|
|
213
|
+
o.closeButton?.enabled ? (s(), u("button", r({
|
|
209
214
|
key: 3,
|
|
210
215
|
type: "button",
|
|
211
216
|
class: "drawer-content__close",
|
|
212
217
|
"aria-label": o.closeButton.label ?? "Закрыть"
|
|
213
218
|
}, t(a)("close"), {
|
|
214
|
-
onClick: l[2] || (l[2] = (
|
|
219
|
+
onClick: l[2] || (l[2] = (b) => p("closeButton"))
|
|
215
220
|
}), [
|
|
216
|
-
|
|
217
|
-
], 16,
|
|
221
|
+
ue(t(ce), { size: 20 })
|
|
222
|
+
], 16, Ee)) : c("", !0)
|
|
218
223
|
]),
|
|
219
224
|
o.divider ? (s(), u("div", Se)) : c("", !0),
|
|
220
|
-
d("div",
|
|
225
|
+
d("div", r({
|
|
221
226
|
id: B,
|
|
222
227
|
class: "drawer-content__wrapper"
|
|
223
228
|
}, t(a)("body")), [
|
|
224
229
|
f(e.$slots, "default", {}, void 0, !0)
|
|
225
230
|
], 16),
|
|
226
|
-
e.$slots.actions ? (s(), u("div",
|
|
231
|
+
e.$slots.actions ? (s(), u("div", r({
|
|
227
232
|
key: 1,
|
|
228
233
|
class: "drawer-content__actions"
|
|
229
234
|
}, t(a)("actions")), [
|
|
230
235
|
f(e.$slots, "actions", {}, void 0, !0)
|
|
231
236
|
], 16)) : c("", !0)
|
|
232
|
-
], 16,
|
|
237
|
+
], 16, Pe)
|
|
233
238
|
], 4)
|
|
234
239
|
]),
|
|
235
240
|
_: 3
|
|
@@ -238,5 +243,5 @@ const $e = { class: "drawer-mobile" }, Ie = {
|
|
|
238
243
|
}
|
|
239
244
|
});
|
|
240
245
|
export {
|
|
241
|
-
|
|
246
|
+
Ze as default
|
|
242
247
|
};
|
|
@@ -17,5 +17,15 @@ export interface UseLayerZIndexReturn {
|
|
|
17
17
|
zIndex: Ref<number | undefined>;
|
|
18
18
|
acquire: () => void;
|
|
19
19
|
release: () => void;
|
|
20
|
+
/** Элемент контента слоя — источник для чужого `elementsAbove()`. */
|
|
21
|
+
registerElement: (el: HTMLElement | null) => void;
|
|
22
|
+
/**
|
|
23
|
+
* DOM-элементы слоёв, открытых позже текущего (значит, лежащих выше по
|
|
24
|
+
* z-index) — например, ConfirmDialog поверх BottomSheet. Передавать в
|
|
25
|
+
* `onClickOutside` как `ignore`: клик по вложенному слою не должен
|
|
26
|
+
* считаться «кликом вне» текущего — иначе закрытие вложенного окна
|
|
27
|
+
* утаскивало бы за собой и родителя.
|
|
28
|
+
*/
|
|
29
|
+
elementsAbove: () => HTMLElement[];
|
|
20
30
|
}
|
|
21
31
|
export declare function useLayerZIndex(): UseLayerZIndexReturn;
|
|
@@ -1,18 +1,30 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
const
|
|
3
|
-
let
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ref as a, onBeforeUnmount as d } from "vue";
|
|
2
|
+
const v = 1e3, x = 10;
|
|
3
|
+
let i = 0, u = 0;
|
|
4
|
+
const o = [];
|
|
5
|
+
function m() {
|
|
6
|
+
const t = a();
|
|
7
|
+
let e;
|
|
8
|
+
function f() {
|
|
9
|
+
t.value === void 0 && (i++, u++, t.value = v + u * x, e = { zIndex: t.value, el: null }, o.push(e));
|
|
8
10
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
+
function l() {
|
|
12
|
+
if (t.value !== void 0 && (t.value = void 0, i = Math.max(0, i - 1), i === 0 && (u = 0), e)) {
|
|
13
|
+
const n = o.indexOf(e);
|
|
14
|
+
n !== -1 && o.splice(n, 1), e = void 0;
|
|
15
|
+
}
|
|
11
16
|
}
|
|
12
|
-
|
|
17
|
+
function s(n) {
|
|
18
|
+
e && (e.el = n);
|
|
19
|
+
}
|
|
20
|
+
function c() {
|
|
21
|
+
const n = e;
|
|
22
|
+
return n ? o.filter((r) => r !== n && r.zIndex > n.zIndex).map((r) => r.el).filter((r) => r !== null) : [];
|
|
23
|
+
}
|
|
24
|
+
return d(l), { zIndex: t, acquire: f, release: l, registerElement: s, elementsAbove: c };
|
|
13
25
|
}
|
|
14
26
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
v as LAYER_BASE_Z_INDEX,
|
|
28
|
+
x as LAYER_Z_INDEX_STEP,
|
|
29
|
+
m as useLayerZIndex
|
|
18
30
|
};
|
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
import { toValue as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { toValue as p, unref as g } from "vue";
|
|
2
|
+
const s = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
let c = 0;
|
|
4
|
+
const E = 500;
|
|
5
|
+
function l(t) {
|
|
6
|
+
const o = g(t);
|
|
7
|
+
return o?.$el ?? o;
|
|
6
8
|
}
|
|
7
|
-
function
|
|
8
|
-
return typeof t == "string" ? document.querySelector(t) :
|
|
9
|
+
function L(t) {
|
|
10
|
+
return typeof t == "string" ? document.querySelector(t) : l(t);
|
|
9
11
|
}
|
|
10
|
-
function
|
|
11
|
-
const n =
|
|
12
|
+
function y(t, o, d = {}) {
|
|
13
|
+
const n = L(t);
|
|
12
14
|
if (!n) return () => {
|
|
13
15
|
};
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
const a = s.get(n);
|
|
17
|
+
a && (a(), s.delete(n));
|
|
18
|
+
const u = (r) => {
|
|
19
|
+
if (r.type === "touchstart")
|
|
20
|
+
c = r.timeStamp;
|
|
21
|
+
else if (c > 0 && r.timeStamp - c < E)
|
|
22
|
+
return;
|
|
23
|
+
const i = r.target instanceof Node ? r.target : null;
|
|
24
|
+
if (!i) return;
|
|
25
|
+
const f = (p(d.ignore) ?? []).map((e) => typeof e == "string" ? document.querySelector(e) : l(e)).filter((e) => e != null);
|
|
26
|
+
n.contains(i) || f.some((e) => e.contains(i)) || o(r);
|
|
21
27
|
};
|
|
22
|
-
document.addEventListener("mousedown",
|
|
23
|
-
const
|
|
24
|
-
document.removeEventListener("mousedown",
|
|
28
|
+
document.addEventListener("mousedown", u, { capture: !0 }), document.addEventListener("touchstart", u, { capture: !0 });
|
|
29
|
+
const m = () => {
|
|
30
|
+
document.removeEventListener("mousedown", u, { capture: !0 }), document.removeEventListener("touchstart", u, { capture: !0 }), s.delete(n);
|
|
25
31
|
};
|
|
26
|
-
return
|
|
32
|
+
return s.set(n, m), m;
|
|
27
33
|
}
|
|
28
34
|
export {
|
|
29
|
-
|
|
35
|
+
y as onClickOutside
|
|
30
36
|
};
|