wj-elements 0.1.48 → 0.1.50
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/dark.css +1 -0
- package/dist/light.css +1 -0
- package/dist/localize.js +45 -0
- package/dist/popup.element-CWsSOxs2.js +1072 -0
- package/dist/router-links-FtZbFUto.js +146 -0
- package/dist/styles.css +1 -0
- package/dist/wje-accordion-item.js +88 -0
- package/dist/wje-accordion.js +79 -0
- package/dist/wje-animation.js +121 -0
- package/dist/wje-aside.js +55 -0
- package/dist/wje-avatar.js +77 -0
- package/dist/wje-badge.js +50 -0
- package/dist/wje-breadcrumb.js +148 -0
- package/dist/wje-breadcrumbs.js +67 -0
- package/dist/wje-button-group.js +78 -0
- package/dist/wje-button.js +207 -0
- package/dist/wje-card-content.js +48 -0
- package/dist/wje-card-controls.js +48 -0
- package/dist/wje-card-header.js +47 -0
- package/dist/wje-card-subtitle.js +55 -0
- package/dist/wje-card-title.js +55 -0
- package/dist/wje-card.js +50 -0
- package/dist/wje-carousel-item.js +33 -0
- package/dist/wje-carousel.js +177 -0
- package/dist/wje-checkbox.js +96 -0
- package/dist/wje-chip.js +32 -0
- package/dist/wje-col.js +27 -0
- package/dist/wje-color-picker.js +953 -0
- package/dist/wje-container.js +57 -0
- package/dist/wje-copy-button.js +170 -0
- package/dist/wje-dialog.js +86 -0
- package/dist/wje-divider.js +53 -0
- package/dist/wje-dropdown.js +114 -0
- package/dist/wje-element.js +453 -0
- package/dist/wje-fetchAndParseCSS.js +40 -0
- package/dist/wje-file-upload-item.js +115 -0
- package/dist/wje-file-upload.js +297 -0
- package/dist/wje-footer.js +56 -0
- package/dist/wje-form.js +28 -0
- package/dist/wje-format-digital.js +85 -0
- package/dist/wje-grid.js +28 -0
- package/dist/wje-header.js +58 -0
- package/dist/wje-icon-picker.js +221 -0
- package/dist/wje-icon.js +119 -0
- package/dist/wje-img-comparer.js +111 -0
- package/dist/wje-img.js +58 -0
- package/dist/wje-infinite-scroll.js +201 -0
- package/dist/wje-inline-edit.js +145 -0
- package/dist/wje-input-file.js +85 -0
- package/dist/wje-input.js +334 -0
- package/dist/wje-item.js +45 -0
- package/dist/wje-label.js +67 -0
- package/dist/wje-list.js +53 -0
- package/dist/wje-main.js +56 -0
- package/dist/wje-masonry.js +218 -0
- package/dist/wje-master.js +423 -0
- package/dist/wje-menu-button.js +65 -0
- package/dist/wje-menu-item.js +230 -0
- package/dist/wje-menu-label.js +57 -0
- package/dist/wje-menu.js +74 -0
- package/dist/wje-option.js +99 -0
- package/dist/wje-options.js +63 -0
- package/dist/wje-popup.js +5 -0
- package/dist/wje-progress-bar.js +161 -0
- package/dist/wje-qr-code.js +2332 -0
- package/dist/wje-radio-group.js +101 -0
- package/dist/wje-radio.js +46 -0
- package/dist/wje-rate.js +260 -0
- package/dist/wje-relative-time.js +85 -0
- package/dist/wje-reorder-dropzone.js +27 -0
- package/dist/wje-reorder-handle.js +115 -0
- package/dist/wje-reorder-item.js +32 -0
- package/dist/wje-reorder.js +138 -0
- package/dist/wje-route.js +46 -0
- package/dist/wje-router-link.js +64 -0
- package/dist/wje-router-outlet.js +127 -0
- package/dist/wje-routerx.js +1088 -0
- package/dist/wje-row.js +58 -0
- package/dist/wje-select.js +257 -0
- package/dist/wje-slider.js +177 -0
- package/dist/wje-sliding-container.js +281 -0
- package/dist/wje-split-view.js +112 -0
- package/dist/wje-status.js +54 -0
- package/dist/wje-store.js +192 -0
- package/dist/wje-tab-group.js +107 -0
- package/dist/wje-tab-panel.js +52 -0
- package/dist/wje-tab.js +59 -0
- package/dist/wje-textarea.js +116 -0
- package/dist/wje-thumbnail.js +64 -0
- package/dist/wje-toast.js +76 -0
- package/dist/wje-toggle.js +94 -0
- package/dist/wje-toolbar-action.js +63 -0
- package/dist/wje-toolbar.js +61 -0
- package/dist/wje-tooltip.js +116 -0
- package/dist/wje-visually-hidden.js +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1072 @@
|
|
|
1
|
+
var Ot = Object.defineProperty;
|
|
2
|
+
var Lt = (t, e, n) => e in t ? Ot(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var st = (t, e, n) => (Lt(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
import Tt, { event as U } from "./wje-element.js";
|
|
5
|
+
const N = Math.min, R = Math.max, Z = Math.round, Q = Math.floor, B = (t) => ({
|
|
6
|
+
x: t,
|
|
7
|
+
y: t
|
|
8
|
+
}), Pt = {
|
|
9
|
+
left: "right",
|
|
10
|
+
right: "left",
|
|
11
|
+
bottom: "top",
|
|
12
|
+
top: "bottom"
|
|
13
|
+
}, St = {
|
|
14
|
+
start: "end",
|
|
15
|
+
end: "start"
|
|
16
|
+
};
|
|
17
|
+
function kt(t, e, n) {
|
|
18
|
+
return R(t, N(e, n));
|
|
19
|
+
}
|
|
20
|
+
function K(t, e) {
|
|
21
|
+
return typeof t == "function" ? t(e) : t;
|
|
22
|
+
}
|
|
23
|
+
function j(t) {
|
|
24
|
+
return t.split("-")[0];
|
|
25
|
+
}
|
|
26
|
+
function I(t) {
|
|
27
|
+
return t.split("-")[1];
|
|
28
|
+
}
|
|
29
|
+
function Dt(t) {
|
|
30
|
+
return t === "x" ? "y" : "x";
|
|
31
|
+
}
|
|
32
|
+
function ct(t) {
|
|
33
|
+
return t === "y" ? "height" : "width";
|
|
34
|
+
}
|
|
35
|
+
function nt(t) {
|
|
36
|
+
return ["top", "bottom"].includes(j(t)) ? "y" : "x";
|
|
37
|
+
}
|
|
38
|
+
function lt(t) {
|
|
39
|
+
return Dt(nt(t));
|
|
40
|
+
}
|
|
41
|
+
function Ht(t, e, n) {
|
|
42
|
+
n === void 0 && (n = !1);
|
|
43
|
+
const o = I(t), i = lt(t), s = ct(i);
|
|
44
|
+
let r = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
|
|
45
|
+
return e.reference[s] > e.floating[s] && (r = tt(r)), [r, tt(r)];
|
|
46
|
+
}
|
|
47
|
+
function Wt(t) {
|
|
48
|
+
const e = tt(t);
|
|
49
|
+
return [rt(t), e, rt(e)];
|
|
50
|
+
}
|
|
51
|
+
function rt(t) {
|
|
52
|
+
return t.replace(/start|end/g, (e) => St[e]);
|
|
53
|
+
}
|
|
54
|
+
function Mt(t, e, n) {
|
|
55
|
+
const o = ["left", "right"], i = ["right", "left"], s = ["top", "bottom"], r = ["bottom", "top"];
|
|
56
|
+
switch (t) {
|
|
57
|
+
case "top":
|
|
58
|
+
case "bottom":
|
|
59
|
+
return n ? e ? i : o : e ? o : i;
|
|
60
|
+
case "left":
|
|
61
|
+
case "right":
|
|
62
|
+
return e ? s : r;
|
|
63
|
+
default:
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function Ft(t, e, n, o) {
|
|
68
|
+
const i = I(t);
|
|
69
|
+
let s = Mt(j(t), n === "start", o);
|
|
70
|
+
return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(rt)))), s;
|
|
71
|
+
}
|
|
72
|
+
function tt(t) {
|
|
73
|
+
return t.replace(/left|right|bottom|top/g, (e) => Pt[e]);
|
|
74
|
+
}
|
|
75
|
+
function Nt(t) {
|
|
76
|
+
return {
|
|
77
|
+
top: 0,
|
|
78
|
+
right: 0,
|
|
79
|
+
bottom: 0,
|
|
80
|
+
left: 0,
|
|
81
|
+
...t
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function gt(t) {
|
|
85
|
+
return typeof t != "number" ? Nt(t) : {
|
|
86
|
+
top: t,
|
|
87
|
+
right: t,
|
|
88
|
+
bottom: t,
|
|
89
|
+
left: t
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function et(t) {
|
|
93
|
+
return {
|
|
94
|
+
...t,
|
|
95
|
+
top: t.y,
|
|
96
|
+
left: t.x,
|
|
97
|
+
right: t.x + t.width,
|
|
98
|
+
bottom: t.y + t.height
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function ht(t, e, n) {
|
|
102
|
+
let {
|
|
103
|
+
reference: o,
|
|
104
|
+
floating: i
|
|
105
|
+
} = t;
|
|
106
|
+
const s = nt(e), r = lt(e), l = ct(r), c = j(e), a = s === "y", d = o.x + o.width / 2 - i.width / 2, h = o.y + o.height / 2 - i.height / 2, p = o[l] / 2 - i[l] / 2;
|
|
107
|
+
let f;
|
|
108
|
+
switch (c) {
|
|
109
|
+
case "top":
|
|
110
|
+
f = {
|
|
111
|
+
x: d,
|
|
112
|
+
y: o.y - i.height
|
|
113
|
+
};
|
|
114
|
+
break;
|
|
115
|
+
case "bottom":
|
|
116
|
+
f = {
|
|
117
|
+
x: d,
|
|
118
|
+
y: o.y + o.height
|
|
119
|
+
};
|
|
120
|
+
break;
|
|
121
|
+
case "right":
|
|
122
|
+
f = {
|
|
123
|
+
x: o.x + o.width,
|
|
124
|
+
y: h
|
|
125
|
+
};
|
|
126
|
+
break;
|
|
127
|
+
case "left":
|
|
128
|
+
f = {
|
|
129
|
+
x: o.x - i.width,
|
|
130
|
+
y: h
|
|
131
|
+
};
|
|
132
|
+
break;
|
|
133
|
+
default:
|
|
134
|
+
f = {
|
|
135
|
+
x: o.x,
|
|
136
|
+
y: o.y
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
switch (I(e)) {
|
|
140
|
+
case "start":
|
|
141
|
+
f[r] -= p * (n && a ? -1 : 1);
|
|
142
|
+
break;
|
|
143
|
+
case "end":
|
|
144
|
+
f[r] += p * (n && a ? -1 : 1);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
return f;
|
|
148
|
+
}
|
|
149
|
+
const Bt = async (t, e, n) => {
|
|
150
|
+
const {
|
|
151
|
+
placement: o = "bottom",
|
|
152
|
+
strategy: i = "absolute",
|
|
153
|
+
middleware: s = [],
|
|
154
|
+
platform: r
|
|
155
|
+
} = n, l = s.filter(Boolean), c = await (r.isRTL == null ? void 0 : r.isRTL(e));
|
|
156
|
+
let a = await r.getElementRects({
|
|
157
|
+
reference: t,
|
|
158
|
+
floating: e,
|
|
159
|
+
strategy: i
|
|
160
|
+
}), {
|
|
161
|
+
x: d,
|
|
162
|
+
y: h
|
|
163
|
+
} = ht(a, o, c), p = o, f = {}, u = 0;
|
|
164
|
+
for (let m = 0; m < l.length; m++) {
|
|
165
|
+
const {
|
|
166
|
+
name: w,
|
|
167
|
+
fn: g
|
|
168
|
+
} = l[m], {
|
|
169
|
+
x,
|
|
170
|
+
y: b,
|
|
171
|
+
data: A,
|
|
172
|
+
reset: v
|
|
173
|
+
} = await g({
|
|
174
|
+
x: d,
|
|
175
|
+
y: h,
|
|
176
|
+
initialPlacement: o,
|
|
177
|
+
placement: p,
|
|
178
|
+
strategy: i,
|
|
179
|
+
middlewareData: f,
|
|
180
|
+
rects: a,
|
|
181
|
+
platform: r,
|
|
182
|
+
elements: {
|
|
183
|
+
reference: t,
|
|
184
|
+
floating: e
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
if (d = x ?? d, h = b ?? h, f = {
|
|
188
|
+
...f,
|
|
189
|
+
[w]: {
|
|
190
|
+
...f[w],
|
|
191
|
+
...A
|
|
192
|
+
}
|
|
193
|
+
}, v && u <= 50) {
|
|
194
|
+
u++, typeof v == "object" && (v.placement && (p = v.placement), v.rects && (a = v.rects === !0 ? await r.getElementRects({
|
|
195
|
+
reference: t,
|
|
196
|
+
floating: e,
|
|
197
|
+
strategy: i
|
|
198
|
+
}) : v.rects), {
|
|
199
|
+
x: d,
|
|
200
|
+
y: h
|
|
201
|
+
} = ht(a, p, c)), m = -1;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
x: d,
|
|
207
|
+
y: h,
|
|
208
|
+
placement: p,
|
|
209
|
+
strategy: i,
|
|
210
|
+
middlewareData: f
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
async function wt(t, e) {
|
|
214
|
+
var n;
|
|
215
|
+
e === void 0 && (e = {});
|
|
216
|
+
const {
|
|
217
|
+
x: o,
|
|
218
|
+
y: i,
|
|
219
|
+
platform: s,
|
|
220
|
+
rects: r,
|
|
221
|
+
elements: l,
|
|
222
|
+
strategy: c
|
|
223
|
+
} = t, {
|
|
224
|
+
boundary: a = "clippingAncestors",
|
|
225
|
+
rootBoundary: d = "viewport",
|
|
226
|
+
elementContext: h = "floating",
|
|
227
|
+
altBoundary: p = !1,
|
|
228
|
+
padding: f = 0
|
|
229
|
+
} = K(e, t), u = gt(f), w = l[p ? h === "floating" ? "reference" : "floating" : h], g = et(await s.getClippingRect({
|
|
230
|
+
element: (n = await (s.isElement == null ? void 0 : s.isElement(w))) == null || n ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
|
|
231
|
+
boundary: a,
|
|
232
|
+
rootBoundary: d,
|
|
233
|
+
strategy: c
|
|
234
|
+
})), x = h === "floating" ? {
|
|
235
|
+
...r.floating,
|
|
236
|
+
x: o,
|
|
237
|
+
y: i
|
|
238
|
+
} : r.reference, b = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), A = await (s.isElement == null ? void 0 : s.isElement(b)) ? await (s.getScale == null ? void 0 : s.getScale(b)) || {
|
|
239
|
+
x: 1,
|
|
240
|
+
y: 1
|
|
241
|
+
} : {
|
|
242
|
+
x: 1,
|
|
243
|
+
y: 1
|
|
244
|
+
}, v = et(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
245
|
+
rect: x,
|
|
246
|
+
offsetParent: b,
|
|
247
|
+
strategy: c
|
|
248
|
+
}) : x);
|
|
249
|
+
return {
|
|
250
|
+
top: (g.top - v.top + u.top) / A.y,
|
|
251
|
+
bottom: (v.bottom - g.bottom + u.bottom) / A.y,
|
|
252
|
+
left: (g.left - v.left + u.left) / A.x,
|
|
253
|
+
right: (v.right - g.right + u.right) / A.x
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
const Vt = (t) => ({
|
|
257
|
+
name: "arrow",
|
|
258
|
+
options: t,
|
|
259
|
+
async fn(e) {
|
|
260
|
+
const {
|
|
261
|
+
x: n,
|
|
262
|
+
y: o,
|
|
263
|
+
placement: i,
|
|
264
|
+
rects: s,
|
|
265
|
+
platform: r,
|
|
266
|
+
elements: l,
|
|
267
|
+
middlewareData: c
|
|
268
|
+
} = e, {
|
|
269
|
+
element: a,
|
|
270
|
+
padding: d = 0
|
|
271
|
+
} = K(t, e) || {};
|
|
272
|
+
if (a == null)
|
|
273
|
+
return {};
|
|
274
|
+
const h = gt(d), p = {
|
|
275
|
+
x: n,
|
|
276
|
+
y: o
|
|
277
|
+
}, f = lt(i), u = ct(f), m = await r.getDimensions(a), w = f === "y", g = w ? "top" : "left", x = w ? "bottom" : "right", b = w ? "clientHeight" : "clientWidth", A = s.reference[u] + s.reference[f] - p[f] - s.floating[u], v = p[f] - s.reference[f], y = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
|
|
278
|
+
let E = y ? y[b] : 0;
|
|
279
|
+
(!E || !await (r.isElement == null ? void 0 : r.isElement(y))) && (E = l.floating[b] || s.floating[u]);
|
|
280
|
+
const P = A / 2 - v / 2, F = E / 2 - m[u] / 2 - 1, Y = N(h[g], F), X = N(h[x], F), L = Y, q = E - m[u] - X, C = E / 2 - m[u] / 2 + P, S = kt(L, C, q), k = !c.arrow && I(i) != null && C != S && s.reference[u] / 2 - (C < L ? Y : X) - m[u] / 2 < 0, H = k ? C < L ? C - L : C - q : 0;
|
|
281
|
+
return {
|
|
282
|
+
[f]: p[f] + H,
|
|
283
|
+
data: {
|
|
284
|
+
[f]: S,
|
|
285
|
+
centerOffset: C - S - H,
|
|
286
|
+
...k && {
|
|
287
|
+
alignmentOffset: H
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
reset: k
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}), jt = function(t) {
|
|
294
|
+
return t === void 0 && (t = {}), {
|
|
295
|
+
name: "flip",
|
|
296
|
+
options: t,
|
|
297
|
+
async fn(e) {
|
|
298
|
+
var n, o;
|
|
299
|
+
const {
|
|
300
|
+
placement: i,
|
|
301
|
+
middlewareData: s,
|
|
302
|
+
rects: r,
|
|
303
|
+
initialPlacement: l,
|
|
304
|
+
platform: c,
|
|
305
|
+
elements: a
|
|
306
|
+
} = e, {
|
|
307
|
+
mainAxis: d = !0,
|
|
308
|
+
crossAxis: h = !0,
|
|
309
|
+
fallbackPlacements: p,
|
|
310
|
+
fallbackStrategy: f = "bestFit",
|
|
311
|
+
fallbackAxisSideDirection: u = "none",
|
|
312
|
+
flipAlignment: m = !0,
|
|
313
|
+
...w
|
|
314
|
+
} = K(t, e);
|
|
315
|
+
if ((n = s.arrow) != null && n.alignmentOffset)
|
|
316
|
+
return {};
|
|
317
|
+
const g = j(i), x = j(l) === l, b = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), A = p || (x || !m ? [tt(l)] : Wt(l));
|
|
318
|
+
!p && u !== "none" && A.push(...Ft(l, m, u, b));
|
|
319
|
+
const v = [l, ...A], y = await wt(e, w), E = [];
|
|
320
|
+
let P = ((o = s.flip) == null ? void 0 : o.overflows) || [];
|
|
321
|
+
if (d && E.push(y[g]), h) {
|
|
322
|
+
const L = Ht(i, r, b);
|
|
323
|
+
E.push(y[L[0]], y[L[1]]);
|
|
324
|
+
}
|
|
325
|
+
if (P = [...P, {
|
|
326
|
+
placement: i,
|
|
327
|
+
overflows: E
|
|
328
|
+
}], !E.every((L) => L <= 0)) {
|
|
329
|
+
var F, Y;
|
|
330
|
+
const L = (((F = s.flip) == null ? void 0 : F.index) || 0) + 1, q = v[L];
|
|
331
|
+
if (q)
|
|
332
|
+
return {
|
|
333
|
+
data: {
|
|
334
|
+
index: L,
|
|
335
|
+
overflows: P
|
|
336
|
+
},
|
|
337
|
+
reset: {
|
|
338
|
+
placement: q
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
let C = (Y = P.filter((S) => S.overflows[0] <= 0).sort((S, k) => S.overflows[1] - k.overflows[1])[0]) == null ? void 0 : Y.placement;
|
|
342
|
+
if (!C)
|
|
343
|
+
switch (f) {
|
|
344
|
+
case "bestFit": {
|
|
345
|
+
var X;
|
|
346
|
+
const S = (X = P.map((k) => [k.placement, k.overflows.filter((H) => H > 0).reduce((H, Rt) => H + Rt, 0)]).sort((k, H) => k[1] - H[1])[0]) == null ? void 0 : X[0];
|
|
347
|
+
S && (C = S);
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
case "initialPlacement":
|
|
351
|
+
C = l;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
if (i !== C)
|
|
355
|
+
return {
|
|
356
|
+
reset: {
|
|
357
|
+
placement: C
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
return {};
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
async function zt(t, e) {
|
|
366
|
+
const {
|
|
367
|
+
placement: n,
|
|
368
|
+
platform: o,
|
|
369
|
+
elements: i
|
|
370
|
+
} = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = j(n), l = I(n), c = nt(n) === "y", a = ["left", "top"].includes(r) ? -1 : 1, d = s && c ? -1 : 1, h = K(e, t);
|
|
371
|
+
let {
|
|
372
|
+
mainAxis: p,
|
|
373
|
+
crossAxis: f,
|
|
374
|
+
alignmentAxis: u
|
|
375
|
+
} = typeof h == "number" ? {
|
|
376
|
+
mainAxis: h,
|
|
377
|
+
crossAxis: 0,
|
|
378
|
+
alignmentAxis: null
|
|
379
|
+
} : {
|
|
380
|
+
mainAxis: 0,
|
|
381
|
+
crossAxis: 0,
|
|
382
|
+
alignmentAxis: null,
|
|
383
|
+
...h
|
|
384
|
+
};
|
|
385
|
+
return l && typeof u == "number" && (f = l === "end" ? u * -1 : u), c ? {
|
|
386
|
+
x: f * d,
|
|
387
|
+
y: p * a
|
|
388
|
+
} : {
|
|
389
|
+
x: p * a,
|
|
390
|
+
y: f * d
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
const $t = function(t) {
|
|
394
|
+
return t === void 0 && (t = 0), {
|
|
395
|
+
name: "offset",
|
|
396
|
+
options: t,
|
|
397
|
+
async fn(e) {
|
|
398
|
+
const {
|
|
399
|
+
x: n,
|
|
400
|
+
y: o
|
|
401
|
+
} = e, i = await zt(e, t);
|
|
402
|
+
return {
|
|
403
|
+
x: n + i.x,
|
|
404
|
+
y: o + i.y,
|
|
405
|
+
data: i
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
}, _t = function(t) {
|
|
410
|
+
return t === void 0 && (t = {}), {
|
|
411
|
+
name: "size",
|
|
412
|
+
options: t,
|
|
413
|
+
async fn(e) {
|
|
414
|
+
const {
|
|
415
|
+
placement: n,
|
|
416
|
+
rects: o,
|
|
417
|
+
platform: i,
|
|
418
|
+
elements: s
|
|
419
|
+
} = e, {
|
|
420
|
+
apply: r = () => {
|
|
421
|
+
},
|
|
422
|
+
...l
|
|
423
|
+
} = K(t, e), c = await wt(e, l), a = j(n), d = I(n), h = nt(n) === "y", {
|
|
424
|
+
width: p,
|
|
425
|
+
height: f
|
|
426
|
+
} = o.floating;
|
|
427
|
+
let u, m;
|
|
428
|
+
a === "top" || a === "bottom" ? (u = a, m = d === (await (i.isRTL == null ? void 0 : i.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (m = a, u = d === "end" ? "top" : "bottom");
|
|
429
|
+
const w = f - c[u], g = p - c[m], x = !e.middlewareData.shift;
|
|
430
|
+
let b = w, A = g;
|
|
431
|
+
if (h) {
|
|
432
|
+
const y = p - c.left - c.right;
|
|
433
|
+
A = d || x ? N(g, y) : y;
|
|
434
|
+
} else {
|
|
435
|
+
const y = f - c.top - c.bottom;
|
|
436
|
+
b = d || x ? N(w, y) : y;
|
|
437
|
+
}
|
|
438
|
+
if (x && !d) {
|
|
439
|
+
const y = R(c.left, 0), E = R(c.right, 0), P = R(c.top, 0), F = R(c.bottom, 0);
|
|
440
|
+
h ? A = p - 2 * (y !== 0 || E !== 0 ? y + E : R(c.left, c.right)) : b = f - 2 * (P !== 0 || F !== 0 ? P + F : R(c.top, c.bottom));
|
|
441
|
+
}
|
|
442
|
+
await r({
|
|
443
|
+
...e,
|
|
444
|
+
availableWidth: A,
|
|
445
|
+
availableHeight: b
|
|
446
|
+
});
|
|
447
|
+
const v = await i.getDimensions(s.floating);
|
|
448
|
+
return p !== v.width || f !== v.height ? {
|
|
449
|
+
reset: {
|
|
450
|
+
rects: !0
|
|
451
|
+
}
|
|
452
|
+
} : {};
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
function V(t) {
|
|
457
|
+
return vt(t) ? (t.nodeName || "").toLowerCase() : "#document";
|
|
458
|
+
}
|
|
459
|
+
function O(t) {
|
|
460
|
+
var e;
|
|
461
|
+
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
|
|
462
|
+
}
|
|
463
|
+
function M(t) {
|
|
464
|
+
var e;
|
|
465
|
+
return (e = (vt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
|
|
466
|
+
}
|
|
467
|
+
function vt(t) {
|
|
468
|
+
return t instanceof Node || t instanceof O(t).Node;
|
|
469
|
+
}
|
|
470
|
+
function W(t) {
|
|
471
|
+
return t instanceof Element || t instanceof O(t).Element;
|
|
472
|
+
}
|
|
473
|
+
function D(t) {
|
|
474
|
+
return t instanceof HTMLElement || t instanceof O(t).HTMLElement;
|
|
475
|
+
}
|
|
476
|
+
function dt(t) {
|
|
477
|
+
return typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof O(t).ShadowRoot;
|
|
478
|
+
}
|
|
479
|
+
function G(t) {
|
|
480
|
+
const {
|
|
481
|
+
overflow: e,
|
|
482
|
+
overflowX: n,
|
|
483
|
+
overflowY: o,
|
|
484
|
+
display: i
|
|
485
|
+
} = T(t);
|
|
486
|
+
return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !["inline", "contents"].includes(i);
|
|
487
|
+
}
|
|
488
|
+
function It(t) {
|
|
489
|
+
return ["table", "td", "th"].includes(V(t));
|
|
490
|
+
}
|
|
491
|
+
function at(t) {
|
|
492
|
+
const e = ft(), n = T(t);
|
|
493
|
+
return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
|
|
494
|
+
}
|
|
495
|
+
function Yt(t) {
|
|
496
|
+
let e = _(t);
|
|
497
|
+
for (; D(e) && !ot(e); ) {
|
|
498
|
+
if (at(e))
|
|
499
|
+
return e;
|
|
500
|
+
e = _(e);
|
|
501
|
+
}
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
function ft() {
|
|
505
|
+
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
506
|
+
}
|
|
507
|
+
function ot(t) {
|
|
508
|
+
return ["html", "body", "#document"].includes(V(t));
|
|
509
|
+
}
|
|
510
|
+
function T(t) {
|
|
511
|
+
return O(t).getComputedStyle(t);
|
|
512
|
+
}
|
|
513
|
+
function it(t) {
|
|
514
|
+
return W(t) ? {
|
|
515
|
+
scrollLeft: t.scrollLeft,
|
|
516
|
+
scrollTop: t.scrollTop
|
|
517
|
+
} : {
|
|
518
|
+
scrollLeft: t.pageXOffset,
|
|
519
|
+
scrollTop: t.pageYOffset
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function _(t) {
|
|
523
|
+
if (V(t) === "html")
|
|
524
|
+
return t;
|
|
525
|
+
const e = (
|
|
526
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
527
|
+
t.assignedSlot || // DOM Element detected.
|
|
528
|
+
t.parentNode || // ShadowRoot detected.
|
|
529
|
+
dt(t) && t.host || // Fallback.
|
|
530
|
+
M(t)
|
|
531
|
+
);
|
|
532
|
+
return dt(e) ? e.host : e;
|
|
533
|
+
}
|
|
534
|
+
function xt(t) {
|
|
535
|
+
const e = _(t);
|
|
536
|
+
return ot(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : D(e) && G(e) ? e : xt(e);
|
|
537
|
+
}
|
|
538
|
+
function J(t, e, n) {
|
|
539
|
+
var o;
|
|
540
|
+
e === void 0 && (e = []), n === void 0 && (n = !0);
|
|
541
|
+
const i = xt(t), s = i === ((o = t.ownerDocument) == null ? void 0 : o.body), r = O(i);
|
|
542
|
+
return s ? e.concat(r, r.visualViewport || [], G(i) ? i : [], r.frameElement && n ? J(r.frameElement) : []) : e.concat(i, J(i, [], n));
|
|
543
|
+
}
|
|
544
|
+
function bt(t) {
|
|
545
|
+
const e = T(t);
|
|
546
|
+
let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
|
|
547
|
+
const i = D(t), s = i ? t.offsetWidth : n, r = i ? t.offsetHeight : o, l = Z(n) !== s || Z(o) !== r;
|
|
548
|
+
return l && (n = s, o = r), {
|
|
549
|
+
width: n,
|
|
550
|
+
height: o,
|
|
551
|
+
$: l
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
function ut(t) {
|
|
555
|
+
return W(t) ? t : t.contextElement;
|
|
556
|
+
}
|
|
557
|
+
function $(t) {
|
|
558
|
+
const e = ut(t);
|
|
559
|
+
if (!D(e))
|
|
560
|
+
return B(1);
|
|
561
|
+
const n = e.getBoundingClientRect(), {
|
|
562
|
+
width: o,
|
|
563
|
+
height: i,
|
|
564
|
+
$: s
|
|
565
|
+
} = bt(e);
|
|
566
|
+
let r = (s ? Z(n.width) : n.width) / o, l = (s ? Z(n.height) : n.height) / i;
|
|
567
|
+
return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
|
|
568
|
+
x: r,
|
|
569
|
+
y: l
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
const Xt = /* @__PURE__ */ B(0);
|
|
573
|
+
function yt(t) {
|
|
574
|
+
const e = O(t);
|
|
575
|
+
return !ft() || !e.visualViewport ? Xt : {
|
|
576
|
+
x: e.visualViewport.offsetLeft,
|
|
577
|
+
y: e.visualViewport.offsetTop
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
function qt(t, e, n) {
|
|
581
|
+
return e === void 0 && (e = !1), !n || e && n !== O(t) ? !1 : e;
|
|
582
|
+
}
|
|
583
|
+
function z(t, e, n, o) {
|
|
584
|
+
e === void 0 && (e = !1), n === void 0 && (n = !1);
|
|
585
|
+
const i = t.getBoundingClientRect(), s = ut(t);
|
|
586
|
+
let r = B(1);
|
|
587
|
+
e && (o ? W(o) && (r = $(o)) : r = $(t));
|
|
588
|
+
const l = qt(s, n, o) ? yt(s) : B(0);
|
|
589
|
+
let c = (i.left + l.x) / r.x, a = (i.top + l.y) / r.y, d = i.width / r.x, h = i.height / r.y;
|
|
590
|
+
if (s) {
|
|
591
|
+
const p = O(s), f = o && W(o) ? O(o) : o;
|
|
592
|
+
let u = p.frameElement;
|
|
593
|
+
for (; u && o && f !== p; ) {
|
|
594
|
+
const m = $(u), w = u.getBoundingClientRect(), g = T(u), x = w.left + (u.clientLeft + parseFloat(g.paddingLeft)) * m.x, b = w.top + (u.clientTop + parseFloat(g.paddingTop)) * m.y;
|
|
595
|
+
c *= m.x, a *= m.y, d *= m.x, h *= m.y, c += x, a += b, u = O(u).frameElement;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return et({
|
|
599
|
+
width: d,
|
|
600
|
+
height: h,
|
|
601
|
+
x: c,
|
|
602
|
+
y: a
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
function Ut(t) {
|
|
606
|
+
let {
|
|
607
|
+
rect: e,
|
|
608
|
+
offsetParent: n,
|
|
609
|
+
strategy: o
|
|
610
|
+
} = t;
|
|
611
|
+
const i = D(n), s = M(n);
|
|
612
|
+
if (n === s)
|
|
613
|
+
return e;
|
|
614
|
+
let r = {
|
|
615
|
+
scrollLeft: 0,
|
|
616
|
+
scrollTop: 0
|
|
617
|
+
}, l = B(1);
|
|
618
|
+
const c = B(0);
|
|
619
|
+
if ((i || !i && o !== "fixed") && ((V(n) !== "body" || G(s)) && (r = it(n)), D(n))) {
|
|
620
|
+
const a = z(n);
|
|
621
|
+
l = $(n), c.x = a.x + n.clientLeft, c.y = a.y + n.clientTop;
|
|
622
|
+
}
|
|
623
|
+
return {
|
|
624
|
+
width: e.width * l.x,
|
|
625
|
+
height: e.height * l.y,
|
|
626
|
+
x: e.x * l.x - r.scrollLeft * l.x + c.x,
|
|
627
|
+
y: e.y * l.y - r.scrollTop * l.y + c.y
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
function Jt(t) {
|
|
631
|
+
return Array.from(t.getClientRects());
|
|
632
|
+
}
|
|
633
|
+
function At(t) {
|
|
634
|
+
return z(M(t)).left + it(t).scrollLeft;
|
|
635
|
+
}
|
|
636
|
+
function Kt(t) {
|
|
637
|
+
const e = M(t), n = it(t), o = t.ownerDocument.body, i = R(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), s = R(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
|
|
638
|
+
let r = -n.scrollLeft + At(t);
|
|
639
|
+
const l = -n.scrollTop;
|
|
640
|
+
return T(o).direction === "rtl" && (r += R(e.clientWidth, o.clientWidth) - i), {
|
|
641
|
+
width: i,
|
|
642
|
+
height: s,
|
|
643
|
+
x: r,
|
|
644
|
+
y: l
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function Gt(t, e) {
|
|
648
|
+
const n = O(t), o = M(t), i = n.visualViewport;
|
|
649
|
+
let s = o.clientWidth, r = o.clientHeight, l = 0, c = 0;
|
|
650
|
+
if (i) {
|
|
651
|
+
s = i.width, r = i.height;
|
|
652
|
+
const a = ft();
|
|
653
|
+
(!a || a && e === "fixed") && (l = i.offsetLeft, c = i.offsetTop);
|
|
654
|
+
}
|
|
655
|
+
return {
|
|
656
|
+
width: s,
|
|
657
|
+
height: r,
|
|
658
|
+
x: l,
|
|
659
|
+
y: c
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
function Qt(t, e) {
|
|
663
|
+
const n = z(t, !0, e === "fixed"), o = n.top + t.clientTop, i = n.left + t.clientLeft, s = D(t) ? $(t) : B(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = i * s.x, a = o * s.y;
|
|
664
|
+
return {
|
|
665
|
+
width: r,
|
|
666
|
+
height: l,
|
|
667
|
+
x: c,
|
|
668
|
+
y: a
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
function pt(t, e, n) {
|
|
672
|
+
let o;
|
|
673
|
+
if (e === "viewport")
|
|
674
|
+
o = Gt(t, n);
|
|
675
|
+
else if (e === "document")
|
|
676
|
+
o = Kt(M(t));
|
|
677
|
+
else if (W(e))
|
|
678
|
+
o = Qt(e, n);
|
|
679
|
+
else {
|
|
680
|
+
const i = yt(t);
|
|
681
|
+
o = {
|
|
682
|
+
...e,
|
|
683
|
+
x: e.x - i.x,
|
|
684
|
+
y: e.y - i.y
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
return et(o);
|
|
688
|
+
}
|
|
689
|
+
function Et(t, e) {
|
|
690
|
+
const n = _(t);
|
|
691
|
+
return n === e || !W(n) || ot(n) ? !1 : T(n).position === "fixed" || Et(n, e);
|
|
692
|
+
}
|
|
693
|
+
function Zt(t, e) {
|
|
694
|
+
const n = e.get(t);
|
|
695
|
+
if (n)
|
|
696
|
+
return n;
|
|
697
|
+
let o = J(t, [], !1).filter((l) => W(l) && V(l) !== "body"), i = null;
|
|
698
|
+
const s = T(t).position === "fixed";
|
|
699
|
+
let r = s ? _(t) : t;
|
|
700
|
+
for (; W(r) && !ot(r); ) {
|
|
701
|
+
const l = T(r), c = at(r);
|
|
702
|
+
!c && l.position === "fixed" && (i = null), (s ? !c && !i : !c && l.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || G(r) && !c && Et(t, r)) ? o = o.filter((d) => d !== r) : i = l, r = _(r);
|
|
703
|
+
}
|
|
704
|
+
return e.set(t, o), o;
|
|
705
|
+
}
|
|
706
|
+
function te(t) {
|
|
707
|
+
let {
|
|
708
|
+
element: e,
|
|
709
|
+
boundary: n,
|
|
710
|
+
rootBoundary: o,
|
|
711
|
+
strategy: i
|
|
712
|
+
} = t;
|
|
713
|
+
const r = [...n === "clippingAncestors" ? Zt(e, this._c) : [].concat(n), o], l = r[0], c = r.reduce((a, d) => {
|
|
714
|
+
const h = pt(e, d, i);
|
|
715
|
+
return a.top = R(h.top, a.top), a.right = N(h.right, a.right), a.bottom = N(h.bottom, a.bottom), a.left = R(h.left, a.left), a;
|
|
716
|
+
}, pt(e, l, i));
|
|
717
|
+
return {
|
|
718
|
+
width: c.right - c.left,
|
|
719
|
+
height: c.bottom - c.top,
|
|
720
|
+
x: c.left,
|
|
721
|
+
y: c.top
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
function ee(t) {
|
|
725
|
+
return bt(t);
|
|
726
|
+
}
|
|
727
|
+
function ne(t, e, n) {
|
|
728
|
+
const o = D(e), i = M(e), s = n === "fixed", r = z(t, !0, s, e);
|
|
729
|
+
let l = {
|
|
730
|
+
scrollLeft: 0,
|
|
731
|
+
scrollTop: 0
|
|
732
|
+
};
|
|
733
|
+
const c = B(0);
|
|
734
|
+
if (o || !o && !s)
|
|
735
|
+
if ((V(e) !== "body" || G(i)) && (l = it(e)), o) {
|
|
736
|
+
const a = z(e, !0, s, e);
|
|
737
|
+
c.x = a.x + e.clientLeft, c.y = a.y + e.clientTop;
|
|
738
|
+
} else
|
|
739
|
+
i && (c.x = At(i));
|
|
740
|
+
return {
|
|
741
|
+
x: r.left + l.scrollLeft - c.x,
|
|
742
|
+
y: r.top + l.scrollTop - c.y,
|
|
743
|
+
width: r.width,
|
|
744
|
+
height: r.height
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
function mt(t, e) {
|
|
748
|
+
return !D(t) || T(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
|
|
749
|
+
}
|
|
750
|
+
function Ct(t, e) {
|
|
751
|
+
const n = O(t);
|
|
752
|
+
if (!D(t))
|
|
753
|
+
return n;
|
|
754
|
+
let o = mt(t, e);
|
|
755
|
+
for (; o && It(o) && T(o).position === "static"; )
|
|
756
|
+
o = mt(o, e);
|
|
757
|
+
return o && (V(o) === "html" || V(o) === "body" && T(o).position === "static" && !at(o)) ? n : o || Yt(t) || n;
|
|
758
|
+
}
|
|
759
|
+
const oe = async function(t) {
|
|
760
|
+
let {
|
|
761
|
+
reference: e,
|
|
762
|
+
floating: n,
|
|
763
|
+
strategy: o
|
|
764
|
+
} = t;
|
|
765
|
+
const i = this.getOffsetParent || Ct, s = this.getDimensions;
|
|
766
|
+
return {
|
|
767
|
+
reference: ne(e, await i(n), o),
|
|
768
|
+
floating: {
|
|
769
|
+
x: 0,
|
|
770
|
+
y: 0,
|
|
771
|
+
...await s(n)
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
};
|
|
775
|
+
function ie(t) {
|
|
776
|
+
return T(t).direction === "rtl";
|
|
777
|
+
}
|
|
778
|
+
const se = {
|
|
779
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Ut,
|
|
780
|
+
getDocumentElement: M,
|
|
781
|
+
getClippingRect: te,
|
|
782
|
+
getOffsetParent: Ct,
|
|
783
|
+
getElementRects: oe,
|
|
784
|
+
getClientRects: Jt,
|
|
785
|
+
getDimensions: ee,
|
|
786
|
+
getScale: $,
|
|
787
|
+
isElement: W,
|
|
788
|
+
isRTL: ie
|
|
789
|
+
};
|
|
790
|
+
function re(t, e) {
|
|
791
|
+
let n = null, o;
|
|
792
|
+
const i = M(t);
|
|
793
|
+
function s() {
|
|
794
|
+
clearTimeout(o), n && n.disconnect(), n = null;
|
|
795
|
+
}
|
|
796
|
+
function r(l, c) {
|
|
797
|
+
l === void 0 && (l = !1), c === void 0 && (c = 1), s();
|
|
798
|
+
const {
|
|
799
|
+
left: a,
|
|
800
|
+
top: d,
|
|
801
|
+
width: h,
|
|
802
|
+
height: p
|
|
803
|
+
} = t.getBoundingClientRect();
|
|
804
|
+
if (l || e(), !h || !p)
|
|
805
|
+
return;
|
|
806
|
+
const f = Q(d), u = Q(i.clientWidth - (a + h)), m = Q(i.clientHeight - (d + p)), w = Q(a), x = {
|
|
807
|
+
rootMargin: -f + "px " + -u + "px " + -m + "px " + -w + "px",
|
|
808
|
+
threshold: R(0, N(1, c)) || 1
|
|
809
|
+
};
|
|
810
|
+
let b = !0;
|
|
811
|
+
function A(v) {
|
|
812
|
+
const y = v[0].intersectionRatio;
|
|
813
|
+
if (y !== c) {
|
|
814
|
+
if (!b)
|
|
815
|
+
return r();
|
|
816
|
+
y ? r(!1, y) : o = setTimeout(() => {
|
|
817
|
+
r(!1, 1e-7);
|
|
818
|
+
}, 100);
|
|
819
|
+
}
|
|
820
|
+
b = !1;
|
|
821
|
+
}
|
|
822
|
+
try {
|
|
823
|
+
n = new IntersectionObserver(A, {
|
|
824
|
+
...x,
|
|
825
|
+
// Handle <iframe>s
|
|
826
|
+
root: i.ownerDocument
|
|
827
|
+
});
|
|
828
|
+
} catch {
|
|
829
|
+
n = new IntersectionObserver(A, x);
|
|
830
|
+
}
|
|
831
|
+
n.observe(t);
|
|
832
|
+
}
|
|
833
|
+
return r(!0), s;
|
|
834
|
+
}
|
|
835
|
+
function ce(t, e, n, o) {
|
|
836
|
+
o === void 0 && (o = {});
|
|
837
|
+
const {
|
|
838
|
+
ancestorScroll: i = !0,
|
|
839
|
+
ancestorResize: s = !0,
|
|
840
|
+
elementResize: r = typeof ResizeObserver == "function",
|
|
841
|
+
layoutShift: l = typeof IntersectionObserver == "function",
|
|
842
|
+
animationFrame: c = !1
|
|
843
|
+
} = o, a = ut(t), d = i || s ? [...a ? J(a) : [], ...J(e)] : [];
|
|
844
|
+
d.forEach((g) => {
|
|
845
|
+
i && g.addEventListener("scroll", n, {
|
|
846
|
+
passive: !0
|
|
847
|
+
}), s && g.addEventListener("resize", n);
|
|
848
|
+
});
|
|
849
|
+
const h = a && l ? re(a, n) : null;
|
|
850
|
+
let p = -1, f = null;
|
|
851
|
+
r && (f = new ResizeObserver((g) => {
|
|
852
|
+
let [x] = g;
|
|
853
|
+
x && x.target === a && f && (f.unobserve(e), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
|
|
854
|
+
f && f.observe(e);
|
|
855
|
+
})), n();
|
|
856
|
+
}), a && !c && f.observe(a), f.observe(e));
|
|
857
|
+
let u, m = c ? z(t) : null;
|
|
858
|
+
c && w();
|
|
859
|
+
function w() {
|
|
860
|
+
const g = z(t);
|
|
861
|
+
m && (g.x !== m.x || g.y !== m.y || g.width !== m.width || g.height !== m.height) && n(), m = g, u = requestAnimationFrame(w);
|
|
862
|
+
}
|
|
863
|
+
return n(), () => {
|
|
864
|
+
d.forEach((g) => {
|
|
865
|
+
i && g.removeEventListener("scroll", n), s && g.removeEventListener("resize", n);
|
|
866
|
+
}), h && h(), f && f.disconnect(), f = null, c && cancelAnimationFrame(u);
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
const le = (t, e, n) => {
|
|
870
|
+
const o = /* @__PURE__ */ new Map(), i = {
|
|
871
|
+
platform: se,
|
|
872
|
+
...n
|
|
873
|
+
}, s = {
|
|
874
|
+
...i.platform,
|
|
875
|
+
_c: o
|
|
876
|
+
};
|
|
877
|
+
return Bt(t, e, {
|
|
878
|
+
...i,
|
|
879
|
+
platform: s
|
|
880
|
+
});
|
|
881
|
+
}, ae = ":host{--wje-popup-top: auto;--wje-popup-left: auto;display:flex}.native-popup{position:absolute;isolation:isolate;z-index:999;left:var(--wje-popup-left);top:var(--wje-popup-top)}.native-popup:not(.popup-active){display:none}";
|
|
882
|
+
class he extends Tt {
|
|
883
|
+
/**
|
|
884
|
+
* Creates an instance of Popup.
|
|
885
|
+
*
|
|
886
|
+
* @constructor
|
|
887
|
+
*/
|
|
888
|
+
constructor() {
|
|
889
|
+
super();
|
|
890
|
+
st(this, "className", "Popup");
|
|
891
|
+
st(this, "clickHandler", (n) => {
|
|
892
|
+
n.composedPath().some((i) => i === this) || this.hasAttribute("active") && this.removeAttribute("active");
|
|
893
|
+
});
|
|
894
|
+
this._manual = !1;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Sets the manual property of the popup.
|
|
898
|
+
*
|
|
899
|
+
* @param {boolean} value - The value to set.
|
|
900
|
+
*/
|
|
901
|
+
set manual(n) {
|
|
902
|
+
this._manual = n;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Gets the manual property of the popup.
|
|
906
|
+
*
|
|
907
|
+
* @returns {boolean} The value of the manual property.
|
|
908
|
+
*/
|
|
909
|
+
get manual() {
|
|
910
|
+
return this.hasAttribute("manual") && (this._manual = !0), this._manual;
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Returns the CSS styles for the component.
|
|
914
|
+
*
|
|
915
|
+
* @static
|
|
916
|
+
* @returns {CSSStyleSheet}
|
|
917
|
+
*/
|
|
918
|
+
static get cssStyleSheet() {
|
|
919
|
+
return ae;
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Returns the list of attributes to observe for changes.
|
|
923
|
+
*
|
|
924
|
+
* @static
|
|
925
|
+
* @returns {Array<string>}
|
|
926
|
+
*/
|
|
927
|
+
static get observedAttributes() {
|
|
928
|
+
return ["active"];
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Sets up the attributes for the component.
|
|
932
|
+
*/
|
|
933
|
+
setupAttributes() {
|
|
934
|
+
this.isShadowRoot = "open";
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Called when an attribute changes.
|
|
938
|
+
*
|
|
939
|
+
* @param {string} name - The name of the attribute.
|
|
940
|
+
* @param {string} old - The old value of the attribute.
|
|
941
|
+
* @param {string} newName - The new value of the attribute.
|
|
942
|
+
*/
|
|
943
|
+
attributeChangedCallback(n, o, i) {
|
|
944
|
+
n === "active" && (this.hasAttribute(n) ? this.show() : this.hide());
|
|
945
|
+
}
|
|
946
|
+
beforeDraw(n, o, i) {
|
|
947
|
+
document.removeEventListener("click", this.clickHandler);
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Draws the component.
|
|
951
|
+
*
|
|
952
|
+
* @param {Object} context - The context for drawing.
|
|
953
|
+
* @param {Object} store - The store for drawing.
|
|
954
|
+
* @param {Object} params - The parameters for drawing.
|
|
955
|
+
* @returns {DocumentFragment}
|
|
956
|
+
*/
|
|
957
|
+
draw(n, o, i) {
|
|
958
|
+
let s = document.createDocumentFragment(), r = document.createElement("slot");
|
|
959
|
+
r.setAttribute("name", "anchor");
|
|
960
|
+
let l = document.createElement("slot");
|
|
961
|
+
l.setAttribute("name", "arrow");
|
|
962
|
+
let c = document.createElement("div");
|
|
963
|
+
c.setAttribute("part", "native"), c.classList.add("native-popup");
|
|
964
|
+
let a = document.createElement("slot");
|
|
965
|
+
return c.appendChild(a), c.appendChild(l), s.appendChild(r), s.appendChild(c), this.slotAnchor = r, this.slotArrow = l, this.native = c, s;
|
|
966
|
+
}
|
|
967
|
+
afterDraw(n, o, i) {
|
|
968
|
+
this.setAnchor();
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Sets the anchor for the popup.
|
|
972
|
+
* Adds a click event listener to the anchor element.
|
|
973
|
+
*/
|
|
974
|
+
setAnchor() {
|
|
975
|
+
if (this.slotAnchor && typeof this.anchor == "string") {
|
|
976
|
+
const n = this.getRootNode();
|
|
977
|
+
this.anchorEl = n.querySelector("#" + this.anchor);
|
|
978
|
+
} else
|
|
979
|
+
this.slotAnchor instanceof HTMLSlotElement && (this.anchorEl = this.slotAnchor.assignedElements({ flatten: !0 })[0]);
|
|
980
|
+
this.manual && U.addListener(this.anchorEl, "click", null, (n) => {
|
|
981
|
+
this.hasAttribute("disabled") || this.showHide();
|
|
982
|
+
}, { stopPropagation: !0 }), document.addEventListener("click", this.clickHandler, { capture: !0 });
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Toggles the active attribute of the popup.
|
|
986
|
+
*/
|
|
987
|
+
showHide() {
|
|
988
|
+
this.hasAttribute("active") ? this.removeAttribute("active") : this.setAttribute("active", "");
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* Repositions the popup.
|
|
992
|
+
* Uses the floating-ui library to compute the position.
|
|
993
|
+
*/
|
|
994
|
+
reposition() {
|
|
995
|
+
const n = [];
|
|
996
|
+
this.offsetCalc = +this.offset || 0, this.slotArrow instanceof HTMLSlotElement && (this.arrow = this.slotArrow.assignedElements({ flatten: !0 })[0], this.arrow && (n.push(
|
|
997
|
+
Vt({
|
|
998
|
+
element: this.arrow
|
|
999
|
+
})
|
|
1000
|
+
), this.offsetCalc = Math.sqrt(2 * this.arrow.offsetWidth ** 2) / 2 + +this.offset)), n.push(
|
|
1001
|
+
$t(this.offsetCalc)
|
|
1002
|
+
), n.push(
|
|
1003
|
+
jt()
|
|
1004
|
+
), this.hasAttribute("size") && n.push(
|
|
1005
|
+
_t({
|
|
1006
|
+
apply({ availableWidth: o, availableHeight: i, elements: s }) {
|
|
1007
|
+
Object.assign(s.floating.style, {
|
|
1008
|
+
width: `${s.reference.offsetWidth}px`
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
})
|
|
1012
|
+
), le(this.anchorEl, this.native, {
|
|
1013
|
+
placement: this.placement || "bottom",
|
|
1014
|
+
strategy: "fixed",
|
|
1015
|
+
middleware: n
|
|
1016
|
+
}).then(({ x: o, y: i, middlewareData: s, placement: r, strategy: l }) => {
|
|
1017
|
+
if (this.native.style.setProperty("--wje-popup-left", o + "px"), this.native.style.setProperty("--wje-popup-top", i + "px"), this.native.style.position = l, this.arrow) {
|
|
1018
|
+
const c = {
|
|
1019
|
+
top: "bottom",
|
|
1020
|
+
right: "left",
|
|
1021
|
+
bottom: "top",
|
|
1022
|
+
left: "right"
|
|
1023
|
+
}[r];
|
|
1024
|
+
if (s.arrow) {
|
|
1025
|
+
const { width: a, height: d } = this.native.getBoundingClientRect(), { x: h, y: p } = s.arrow;
|
|
1026
|
+
Object.assign(this.arrow.style, {
|
|
1027
|
+
left: h != null ? `${a / 2 - this.arrow.offsetWidth / 2}px` : "",
|
|
1028
|
+
top: p != null ? `${d / 2 - this.arrow.offsetHeight / 2}px` : "",
|
|
1029
|
+
[c]: `${-this.arrow.offsetHeight / 2}px`
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}), U.dispatchCustomEvent(this, "wje-popup:reposition", {
|
|
1034
|
+
data: { top: "bottom", right: "left", bottom: "top", left: "right" },
|
|
1035
|
+
context: this,
|
|
1036
|
+
event: this
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Shows the popup.
|
|
1041
|
+
* Adds the popup-active class to the native element.
|
|
1042
|
+
* Sets up auto update for repositioning.
|
|
1043
|
+
*/
|
|
1044
|
+
show() {
|
|
1045
|
+
U.dispatchCustomEvent(this, "wje-popup:show"), this.native.classList.add("popup-active"), this.cleanup = ce(this.anchorEl, this.native, () => {
|
|
1046
|
+
this.reposition();
|
|
1047
|
+
}), this.hasAttribute("active") || this.setAttribute("active", "");
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Hides the popup.
|
|
1051
|
+
* Removes the popup-active class from the native element.
|
|
1052
|
+
* Cleans up the auto update for repositioning.
|
|
1053
|
+
*/
|
|
1054
|
+
hide() {
|
|
1055
|
+
U.dispatchCustomEvent(this, "wje-popup:hide"), this.native.classList.remove("popup-active"), this.removeAttribute("active"), this.cleanup, this.cleanup = void 0;
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Removes the active attribute when the popup is hidden.
|
|
1059
|
+
*/
|
|
1060
|
+
onHide() {
|
|
1061
|
+
this.removeAttribute("active");
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Adds event listeners after the component is drawn.
|
|
1065
|
+
*/
|
|
1066
|
+
disconnectedCallback() {
|
|
1067
|
+
U.removeElement(this.anchorEl);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
export {
|
|
1071
|
+
he as P
|
|
1072
|
+
};
|