wj-elements 0.1.11 → 0.1.13

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.
Files changed (92) hide show
  1. package/package.json +1 -1
  2. package/dist/dark.css +0 -1
  3. package/dist/light.css +0 -1
  4. package/dist/localize-DVuO3S17.js +0 -43
  5. package/dist/popup.element-CpEjis9f.js +0 -1068
  6. package/dist/router-links-FtZbFUto.js +0 -146
  7. package/dist/styles.css +0 -1
  8. package/dist/wje-accordion-item.js +0 -88
  9. package/dist/wje-accordion.js +0 -79
  10. package/dist/wje-animation.js +0 -121
  11. package/dist/wje-aside.js +0 -55
  12. package/dist/wje-avatar.js +0 -74
  13. package/dist/wje-badge.js +0 -50
  14. package/dist/wje-breadcrumb.js +0 -148
  15. package/dist/wje-breadcrumbs.js +0 -67
  16. package/dist/wje-button-group.js +0 -78
  17. package/dist/wje-button.js +0 -175
  18. package/dist/wje-card-content.js +0 -48
  19. package/dist/wje-card-controls.js +0 -48
  20. package/dist/wje-card-header.js +0 -47
  21. package/dist/wje-card-subtitle.js +0 -55
  22. package/dist/wje-card-title.js +0 -55
  23. package/dist/wje-card.js +0 -50
  24. package/dist/wje-carousel-item.js +0 -33
  25. package/dist/wje-carousel.js +0 -177
  26. package/dist/wje-checkbox.js +0 -104
  27. package/dist/wje-chip.js +0 -32
  28. package/dist/wje-col.js +0 -27
  29. package/dist/wje-color-picker.js +0 -953
  30. package/dist/wje-container.js +0 -57
  31. package/dist/wje-copy-button.js +0 -164
  32. package/dist/wje-dialog.js +0 -86
  33. package/dist/wje-divider.js +0 -53
  34. package/dist/wje-dropdown.js +0 -68
  35. package/dist/wje-element.js +0 -453
  36. package/dist/wje-fetchAndParseCSS.js +0 -40
  37. package/dist/wje-file-upload-item.js +0 -115
  38. package/dist/wje-file-upload.js +0 -297
  39. package/dist/wje-footer.js +0 -56
  40. package/dist/wje-form.js +0 -28
  41. package/dist/wje-format-digital.js +0 -85
  42. package/dist/wje-grid.js +0 -28
  43. package/dist/wje-header.js +0 -58
  44. package/dist/wje-icon-picker.js +0 -221
  45. package/dist/wje-icon.js +0 -119
  46. package/dist/wje-img-comparer.js +0 -111
  47. package/dist/wje-img.js +0 -58
  48. package/dist/wje-infinite-scroll.js +0 -193
  49. package/dist/wje-inline-edit.js +0 -120
  50. package/dist/wje-input-file.js +0 -85
  51. package/dist/wje-input.js +0 -240
  52. package/dist/wje-item.js +0 -45
  53. package/dist/wje-label.js +0 -67
  54. package/dist/wje-list.js +0 -53
  55. package/dist/wje-main.js +0 -56
  56. package/dist/wje-masonry.js +0 -218
  57. package/dist/wje-master.js +0 -196
  58. package/dist/wje-menu-button.js +0 -65
  59. package/dist/wje-menu-item.js +0 -192
  60. package/dist/wje-menu-label.js +0 -57
  61. package/dist/wje-menu.js +0 -74
  62. package/dist/wje-option.js +0 -99
  63. package/dist/wje-options.js +0 -63
  64. package/dist/wje-popup.js +0 -5
  65. package/dist/wje-progress-bar.js +0 -145
  66. package/dist/wje-radio-group.js +0 -101
  67. package/dist/wje-radio.js +0 -46
  68. package/dist/wje-rate.js +0 -260
  69. package/dist/wje-relative-time.js +0 -85
  70. package/dist/wje-reorder-dropzone.js +0 -27
  71. package/dist/wje-reorder-item.js +0 -32
  72. package/dist/wje-reorder.js +0 -132
  73. package/dist/wje-route.js +0 -28
  74. package/dist/wje-router-link.js +0 -64
  75. package/dist/wje-router-outlet.js +0 -127
  76. package/dist/wje-routerx.js +0 -1088
  77. package/dist/wje-row.js +0 -58
  78. package/dist/wje-select.js +0 -240
  79. package/dist/wje-slider.js +0 -177
  80. package/dist/wje-split-view.js +0 -112
  81. package/dist/wje-store.js +0 -192
  82. package/dist/wje-tab-group.js +0 -105
  83. package/dist/wje-tab-panel.js +0 -52
  84. package/dist/wje-tab.js +0 -59
  85. package/dist/wje-textarea.js +0 -116
  86. package/dist/wje-thumbnail.js +0 -64
  87. package/dist/wje-toast.js +0 -76
  88. package/dist/wje-toggle.js +0 -94
  89. package/dist/wje-toolbar-action.js +0 -63
  90. package/dist/wje-toolbar.js +0 -61
  91. package/dist/wje-tooltip.js +0 -105
  92. package/dist/wje-visually-hidden.js +0 -56
@@ -1,1068 +0,0 @@
1
- var Ot = Object.defineProperty;
2
- var Tt = (t, e, n) => e in t ? Ot(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var ut = (t, e, n) => (Tt(t, typeof e != "symbol" ? e + "" : e, n), n);
4
- import Lt, { 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 Dt(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 _(t) {
27
- return t.split("-")[1];
28
- }
29
- function kt(t) {
30
- return t === "x" ? "y" : "x";
31
- }
32
- function rt(t) {
33
- return t === "y" ? "height" : "width";
34
- }
35
- function nt(t) {
36
- return ["top", "bottom"].includes(j(t)) ? "y" : "x";
37
- }
38
- function ct(t) {
39
- return kt(nt(t));
40
- }
41
- function Ht(t, e, n) {
42
- n === void 0 && (n = !1);
43
- const o = _(t), i = ct(t), s = rt(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 Mt(t) {
48
- const e = tt(t);
49
- return [st(t), e, st(e)];
50
- }
51
- function st(t) {
52
- return t.replace(/start|end/g, (e) => St[e]);
53
- }
54
- function Wt(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 = _(t);
69
- let s = Wt(j(t), n === "start", o);
70
- return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(st)))), 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 = ct(e), l = rt(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 (_(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,
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 = y ?? 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, y = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), A = await (s.isElement == null ? void 0 : s.isElement(y)) ? await (s.getScale == null ? void 0 : s.getScale(y)) || {
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: y,
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 = ct(i), u = rt(f), m = await r.getDimensions(a), w = f === "y", g = w ? "top" : "left", x = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", A = s.reference[u] + s.reference[f] - p[f] - s.floating[u], v = p[f] - s.reference[f], b = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
278
- let E = b ? b[y] : 0;
279
- (!E || !await (r.isElement == null ? void 0 : r.isElement(b))) && (E = l.floating[y] || 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), T = Y, q = E - m[u] - X, C = E / 2 - m[u] / 2 + P, S = Dt(T, C, q), D = !c.arrow && _(i) != null && C != S && s.reference[u] / 2 - (C < T ? Y : X) - m[u] / 2 < 0, H = D ? C < T ? C - T : C - q : 0;
281
- return {
282
- [f]: p[f] + H,
283
- data: {
284
- [f]: S,
285
- centerOffset: C - S - H,
286
- ...D && {
287
- alignmentOffset: H
288
- }
289
- },
290
- reset: D
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, y = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), A = p || (x || !m ? [tt(l)] : Mt(l));
318
- !p && u !== "none" && A.push(...Ft(l, m, u, y));
319
- const v = [l, ...A], b = await wt(e, w), E = [];
320
- let P = ((o = s.flip) == null ? void 0 : o.overflows) || [];
321
- if (d && E.push(b[g]), h) {
322
- const T = Ht(i, r, y);
323
- E.push(b[T[0]], b[T[1]]);
324
- }
325
- if (P = [...P, {
326
- placement: i,
327
- overflows: E
328
- }], !E.every((T) => T <= 0)) {
329
- var F, Y;
330
- const T = (((F = s.flip) == null ? void 0 : F.index) || 0) + 1, q = v[T];
331
- if (q)
332
- return {
333
- data: {
334
- index: T,
335
- overflows: P
336
- },
337
- reset: {
338
- placement: q
339
- }
340
- };
341
- let C = (Y = P.filter((S) => S.overflows[0] <= 0).sort((S, D) => S.overflows[1] - D.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((D) => [D.placement, D.overflows.filter((H) => H > 0).reduce((H, Rt) => H + Rt, 0)]).sort((D, H) => D[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 = _(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
- }, It = 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 = _(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 y = w, A = g;
431
- if (h) {
432
- const b = p - c.left - c.right;
433
- A = d || x ? N(g, b) : b;
434
- } else {
435
- const b = f - c.top - c.bottom;
436
- y = d || x ? N(w, b) : b;
437
- }
438
- if (x && !d) {
439
- const b = R(c.left, 0), E = R(c.right, 0), P = R(c.top, 0), F = R(c.bottom, 0);
440
- h ? A = p - 2 * (b !== 0 || E !== 0 ? b + E : R(c.left, c.right)) : y = f - 2 * (P !== 0 || F !== 0 ? P + F : R(c.top, c.bottom));
441
- }
442
- await r({
443
- ...e,
444
- availableWidth: A,
445
- availableHeight: y
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 W(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 M(t) {
471
- return t instanceof Element || t instanceof O(t).Element;
472
- }
473
- function k(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
- } = L(t);
486
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !["inline", "contents"].includes(i);
487
- }
488
- function _t(t) {
489
- return ["table", "td", "th"].includes(V(t));
490
- }
491
- function lt(t) {
492
- const e = at(), n = L(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 = I(t);
497
- for (; k(e) && !ot(e); ) {
498
- if (lt(e))
499
- return e;
500
- e = I(e);
501
- }
502
- return null;
503
- }
504
- function at() {
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 L(t) {
511
- return O(t).getComputedStyle(t);
512
- }
513
- function it(t) {
514
- return M(t) ? {
515
- scrollLeft: t.scrollLeft,
516
- scrollTop: t.scrollTop
517
- } : {
518
- scrollLeft: t.pageXOffset,
519
- scrollTop: t.pageYOffset
520
- };
521
- }
522
- function I(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
- W(t)
531
- );
532
- return dt(e) ? e.host : e;
533
- }
534
- function xt(t) {
535
- const e = I(t);
536
- return ot(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : k(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 yt(t) {
545
- const e = L(t);
546
- let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
547
- const i = k(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 ft(t) {
555
- return M(t) ? t : t.contextElement;
556
- }
557
- function $(t) {
558
- const e = ft(t);
559
- if (!k(e))
560
- return B(1);
561
- const n = e.getBoundingClientRect(), {
562
- width: o,
563
- height: i,
564
- $: s
565
- } = yt(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 bt(t) {
574
- const e = O(t);
575
- return !at() || !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 = ft(t);
586
- let r = B(1);
587
- e && (o ? M(o) && (r = $(o)) : r = $(t));
588
- const l = qt(s, n, o) ? bt(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 && M(o) ? O(o) : o;
592
- let u = p.frameElement;
593
- for (; u && o && f !== p; ) {
594
- const m = $(u), w = u.getBoundingClientRect(), g = L(u), x = w.left + (u.clientLeft + parseFloat(g.paddingLeft)) * m.x, y = 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 += y, 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 = k(n), s = W(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)), k(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(W(t)).left + it(t).scrollLeft;
635
- }
636
- function Kt(t) {
637
- const e = W(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 L(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 = W(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 = at();
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 = k(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(W(t));
677
- else if (M(e))
678
- o = Qt(e, n);
679
- else {
680
- const i = bt(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 = I(t);
691
- return n === e || !M(n) || ot(n) ? !1 : L(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) => M(l) && V(l) !== "body"), i = null;
698
- const s = L(t).position === "fixed";
699
- let r = s ? I(t) : t;
700
- for (; M(r) && !ot(r); ) {
701
- const l = L(r), c = lt(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 = I(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 yt(t);
726
- }
727
- function ne(t, e, n) {
728
- const o = k(e), i = W(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 !k(t) || L(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
749
- }
750
- function Ct(t, e) {
751
- const n = O(t);
752
- if (!k(t))
753
- return n;
754
- let o = mt(t, e);
755
- for (; o && _t(o) && L(o).position === "static"; )
756
- o = mt(o, e);
757
- return o && (V(o) === "html" || V(o) === "body" && L(o).position === "static" && !lt(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 L(t).direction === "rtl";
777
- }
778
- const se = {
779
- convertOffsetParentRelativeRectToViewportRelativeRect: Ut,
780
- getDocumentElement: W,
781
- getClippingRect: te,
782
- getOffsetParent: Ct,
783
- getElementRects: oe,
784
- getClientRects: Jt,
785
- getDimensions: ee,
786
- getScale: $,
787
- isElement: M,
788
- isRTL: ie
789
- };
790
- function re(t, e) {
791
- let n = null, o;
792
- const i = W(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 y = !0;
811
- function A(v) {
812
- const b = v[0].intersectionRatio;
813
- if (b !== c) {
814
- if (!y)
815
- return r();
816
- b ? r(!1, b) : o = setTimeout(() => {
817
- r(!1, 1e-7);
818
- }, 100);
819
- }
820
- y = !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 = ft(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 Lt {
883
- /**
884
- * Creates an instance of Popup.
885
- *
886
- * @constructor
887
- */
888
- constructor() {
889
- super();
890
- ut(this, "className", "Popup");
891
- this._manual = !1;
892
- }
893
- /**
894
- * Sets the manual property of the popup.
895
- *
896
- * @param {boolean} value - The value to set.
897
- */
898
- set manual(n) {
899
- this._manual = n;
900
- }
901
- /**
902
- * Gets the manual property of the popup.
903
- *
904
- * @returns {boolean} The value of the manual property.
905
- */
906
- get manual() {
907
- return this.hasAttribute("manual") && (this._manual = !0), this._manual;
908
- }
909
- /**
910
- * Returns the CSS styles for the component.
911
- *
912
- * @static
913
- * @returns {CSSStyleSheet}
914
- */
915
- static get cssStyleSheet() {
916
- return ae;
917
- }
918
- /**
919
- * Returns the list of attributes to observe for changes.
920
- *
921
- * @static
922
- * @returns {Array<string>}
923
- */
924
- static get observedAttributes() {
925
- return ["active"];
926
- }
927
- /**
928
- * Sets up the attributes for the component.
929
- */
930
- setupAttributes() {
931
- this.isShadowRoot = "open";
932
- }
933
- /**
934
- * Called when an attribute changes.
935
- *
936
- * @param {string} name - The name of the attribute.
937
- * @param {string} old - The old value of the attribute.
938
- * @param {string} newName - The new value of the attribute.
939
- */
940
- attributeChangedCallback(n, o, i) {
941
- n === "active" && (this.hasAttribute(n) ? this.show() : this.hide());
942
- }
943
- /**
944
- * Draws the component.
945
- *
946
- * @param {Object} context - The context for drawing.
947
- * @param {Object} store - The store for drawing.
948
- * @param {Object} params - The parameters for drawing.
949
- * @returns {DocumentFragment}
950
- */
951
- draw(n, o, i) {
952
- let s = document.createDocumentFragment(), r = document.createElement("slot");
953
- r.setAttribute("name", "anchor");
954
- let l = document.createElement("slot");
955
- l.setAttribute("name", "arrow");
956
- let c = document.createElement("div");
957
- c.setAttribute("part", "native"), c.classList.add("native-popup");
958
- let a = document.createElement("slot");
959
- return c.appendChild(a), c.appendChild(l), s.appendChild(r), s.appendChild(c), this.slotAnchor = r, this.slotArrow = l, this.native = c, s;
960
- }
961
- afterDraw(n, o, i) {
962
- this.setAnchor();
963
- }
964
- /**
965
- * Sets the anchor for the popup.
966
- * Adds a click event listener to the anchor element.
967
- */
968
- setAnchor() {
969
- if (this.slotAnchor && typeof this.anchor == "string") {
970
- const n = this.getRootNode();
971
- this.anchorEl = n.getElementById(this.anchor);
972
- } else
973
- this.slotAnchor instanceof HTMLSlotElement && (this.anchorEl = this.slotAnchor.assignedElements({ flatten: !0 })[0]);
974
- this.manual || (console.log("SOM TU????", this.anchorEl), U.addListener(this.anchorEl, "click", null, (n) => {
975
- this.hasAttribute("disabled") || this.showHide();
976
- }, { stopPropagation: !0 })), document.addEventListener("click", (n) => {
977
- n.composedPath().some((i) => i === this) || this.hasAttribute("active") && this.removeAttribute("active");
978
- });
979
- }
980
- /**
981
- * Toggles the active attribute of the popup.
982
- */
983
- showHide() {
984
- this.hasAttribute("active") ? this.removeAttribute("active") : this.setAttribute("active", "");
985
- }
986
- /**
987
- * Repositions the popup.
988
- * Uses the floating-ui library to compute the position.
989
- */
990
- reposition() {
991
- const n = [];
992
- this.offsetCalc = +this.offset || 0, this.slotArrow instanceof HTMLSlotElement && (this.arrow = this.slotArrow.assignedElements({ flatten: !0 })[0], this.arrow && (n.push(
993
- Vt({
994
- element: this.arrow
995
- })
996
- ), this.offsetCalc = Math.sqrt(2 * this.arrow.offsetWidth ** 2) / 2 + +this.offset)), n.push(
997
- $t(this.offsetCalc)
998
- ), n.push(
999
- jt()
1000
- ), this.hasAttribute("size") && n.push(
1001
- It({
1002
- apply({ availableWidth: o, availableHeight: i, elements: s }) {
1003
- Object.assign(s.floating.style, {
1004
- width: `${s.reference.offsetWidth}px`
1005
- });
1006
- }
1007
- })
1008
- ), le(this.anchorEl, this.native, {
1009
- placement: this.placement || "bottom",
1010
- strategy: "fixed",
1011
- middleware: n
1012
- }).then(({ x: o, y: i, middlewareData: s, placement: r, strategy: l }) => {
1013
- 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) {
1014
- const c = {
1015
- top: "bottom",
1016
- right: "left",
1017
- bottom: "top",
1018
- left: "right"
1019
- }[r];
1020
- if (s.arrow) {
1021
- const { width: a, height: d } = this.native.getBoundingClientRect(), { x: h, y: p } = s.arrow;
1022
- Object.assign(this.arrow.style, {
1023
- left: h != null ? `${a / 2 - this.arrow.offsetWidth / 2}px` : "",
1024
- top: p != null ? `${d / 2 - this.arrow.offsetHeight / 2}px` : "",
1025
- [c]: `${-this.arrow.offsetHeight / 2}px`
1026
- });
1027
- }
1028
- }
1029
- }), U.dispatchCustomEvent(this, "wje-popup:reposition", {
1030
- data: { top: "bottom", right: "left", bottom: "top", left: "right" },
1031
- context: this,
1032
- event: this
1033
- });
1034
- }
1035
- /**
1036
- * Shows the popup.
1037
- * Adds the popup-active class to the native element.
1038
- * Sets up auto update for repositioning.
1039
- */
1040
- show() {
1041
- U.dispatchCustomEvent(this, "wje-popup:show"), this.native.classList.add("popup-active"), this.cleanup = ce(this.anchorEl, this.native, () => {
1042
- this.reposition();
1043
- }), this.hasAttribute("active") || this.setAttribute("active", "");
1044
- }
1045
- /**
1046
- * Hides the popup.
1047
- * Removes the popup-active class from the native element.
1048
- * Cleans up the auto update for repositioning.
1049
- */
1050
- hide() {
1051
- U.dispatchCustomEvent(this, "wje-popup:hide"), this.native.classList.remove("popup-active"), this.removeAttribute("active"), this.cleanup, this.cleanup = void 0;
1052
- }
1053
- /**
1054
- * Removes the active attribute when the popup is hidden.
1055
- */
1056
- onHide() {
1057
- this.removeAttribute("active");
1058
- }
1059
- /**
1060
- * Adds event listeners after the component is drawn.
1061
- */
1062
- disconnectedCallback() {
1063
- U.removeElement(this.anchorEl);
1064
- }
1065
- }
1066
- export {
1067
- he as P
1068
- };