@helixui/library 3.4.1 → 3.6.0
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/custom-elements.json +1536 -1293
- package/dist/components/hx-drawer/hx-drawer.d.ts +17 -0
- package/dist/components/hx-drawer/hx-drawer.d.ts.map +1 -1
- package/dist/components/hx-drawer/index.js +1 -1
- package/dist/components/hx-tabs/hx-tabs.d.ts.map +1 -1
- package/dist/components/hx-tabs/index.js +1 -1
- package/dist/components/hx-toast/index.js +1 -1
- package/dist/components/hx-toast/toast-factory.d.ts.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/manifest.json +1 -1
- package/dist/index.js +3 -3
- package/dist/shared/{hx-drawer-D81tb4BD.js → hx-drawer-CM_upadk.js} +26 -7
- package/dist/shared/hx-drawer-CM_upadk.js.map +1 -0
- package/dist/shared/{hx-tab-panel-Cu--8psg.js → hx-tab-panel-DzsX8BHV.js} +2 -2
- package/dist/shared/hx-tab-panel-DzsX8BHV.js.map +1 -0
- package/dist/shared/{toast-factory-CL2BzdSB.js → toast-factory-Dht3pVsw.js} +237 -114
- package/dist/shared/toast-factory-Dht3pVsw.js.map +1 -0
- package/figma-inventory.json +1303 -103
- package/package.json +2 -2
- package/dist/shared/hx-drawer-D81tb4BD.js.map +0 -1
- package/dist/shared/hx-tab-panel-Cu--8psg.js.map +0 -1
- package/dist/shared/toast-factory-CL2BzdSB.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
3
|
-
import { classMap as
|
|
4
|
-
import { d as
|
|
5
|
-
import { H as
|
|
6
|
-
const
|
|
1
|
+
import { css as V, html as f, nothing as E } from "lit";
|
|
2
|
+
import { property as T, query as U, state as Z, customElement as G } from "lit/decorators.js";
|
|
3
|
+
import { classMap as X } from "lit/directives/class-map.js";
|
|
4
|
+
import { d as ee } from "./dev-warn-YlwPHjtX.js";
|
|
5
|
+
import { H as J } from "./helix-element-BNEYeiys.js";
|
|
6
|
+
const te = V`
|
|
7
7
|
/* ─── hx-toast host ─── */
|
|
8
8
|
|
|
9
9
|
:host {
|
|
@@ -196,7 +196,7 @@ const L = w`
|
|
|
196
196
|
border: 1px solid ButtonText;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`,
|
|
199
|
+
`, se = V`
|
|
200
200
|
:host {
|
|
201
201
|
display: block;
|
|
202
202
|
position: fixed;
|
|
@@ -270,19 +270,19 @@ const L = w`
|
|
|
270
270
|
--hx-toast-enter-translate: calc(var(--hx-space-2, 0.5rem) * -1);
|
|
271
271
|
}
|
|
272
272
|
`;
|
|
273
|
-
var
|
|
274
|
-
for (var
|
|
275
|
-
(
|
|
276
|
-
return
|
|
273
|
+
var ne = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, _ = (e, t, n, s) => {
|
|
274
|
+
for (var o = s > 1 ? void 0 : s ? oe(t, n) : t, l = e.length - 1, h; l >= 0; l--)
|
|
275
|
+
(h = e[l]) && (o = (s ? h(t, n, o) : h(o)) || o);
|
|
276
|
+
return s && o && ne(t, n, o), o;
|
|
277
277
|
};
|
|
278
|
-
const
|
|
278
|
+
const re = {
|
|
279
279
|
default: 3e3,
|
|
280
280
|
info: 3e3,
|
|
281
281
|
success: 3e3,
|
|
282
282
|
warning: 4e3,
|
|
283
283
|
danger: 6e3
|
|
284
284
|
};
|
|
285
|
-
let
|
|
285
|
+
let d = class extends J {
|
|
286
286
|
constructor() {
|
|
287
287
|
super(...arguments), this.variant = "default", this.duration = 5e3, this.closable = !1, this.open = !1, this.labelClose = "Dismiss notification", this._hasActionContent = !1, this._timer = null, this._timerStartedAt = null, this._timerRemaining = null;
|
|
288
288
|
}
|
|
@@ -295,8 +295,8 @@ let a = class extends A {
|
|
|
295
295
|
connectedCallback() {
|
|
296
296
|
super.connectedCallback(), this._internals.role = this._role, this._internals.ariaAtomic = "true", this.setAttribute("role", this._role);
|
|
297
297
|
}
|
|
298
|
-
updated(
|
|
299
|
-
super.updated(
|
|
298
|
+
updated(e) {
|
|
299
|
+
super.updated(e), e.has("variant") && (this._internals.role = this._role, this.setAttribute("role", this._role)), (e.has("open") || e.has("duration")) && this._auditWcag223(), e.has("open") && (this.open ? (this.removeAttribute("aria-hidden"), this._emitShow(), this.duration > 0 && !this._reducedMotion && !this._hasActionContent && this._startTimer()) : (this.setAttribute("aria-hidden", "true"), this._clearTimer(), this._emitHide()));
|
|
300
300
|
}
|
|
301
301
|
disconnectedCallback() {
|
|
302
302
|
super.disconnectedCallback(), this._clearTimer();
|
|
@@ -315,10 +315,10 @@ let a = class extends A {
|
|
|
315
315
|
*/
|
|
316
316
|
_auditWcag223() {
|
|
317
317
|
if (this.duration <= 0) return;
|
|
318
|
-
const
|
|
319
|
-
this.duration <
|
|
318
|
+
const e = re[this.variant] ?? 0;
|
|
319
|
+
this.duration < e && ee(
|
|
320
320
|
"hx-toast",
|
|
321
|
-
`duration=${this.duration}ms is shorter than the WCAG 2.2.3 minimum (${
|
|
321
|
+
`duration=${this.duration}ms is shorter than the WCAG 2.2.3 minimum (${e}ms) for variant="${this.variant}". Increase duration or set duration=0 for persistent toasts (recommended for variant="danger").`
|
|
322
322
|
);
|
|
323
323
|
}
|
|
324
324
|
// ─── Public API ───
|
|
@@ -332,19 +332,19 @@ let a = class extends A {
|
|
|
332
332
|
}
|
|
333
333
|
// ─── Private Helpers ───
|
|
334
334
|
/** @internal */
|
|
335
|
-
_startTimer(
|
|
335
|
+
_startTimer(e) {
|
|
336
336
|
this._clearTimerHandle();
|
|
337
|
-
const
|
|
338
|
-
this._timerStartedAt = Date.now(), this._timerRemaining =
|
|
337
|
+
const t = e ?? this.duration;
|
|
338
|
+
this._timerStartedAt = Date.now(), this._timerRemaining = t, this._timer = setTimeout(() => {
|
|
339
339
|
this.open = !1;
|
|
340
|
-
},
|
|
340
|
+
}, t);
|
|
341
341
|
}
|
|
342
342
|
/** @internal */
|
|
343
343
|
_pauseTimer() {
|
|
344
344
|
if (this._timer === null || this._timerStartedAt === null || this._timerRemaining === null)
|
|
345
345
|
return;
|
|
346
|
-
const
|
|
347
|
-
this._timerRemaining = Math.max(0, this._timerRemaining -
|
|
346
|
+
const e = Date.now() - this._timerStartedAt;
|
|
347
|
+
this._timerRemaining = Math.max(0, this._timerRemaining - e), this._clearTimerHandle();
|
|
348
348
|
}
|
|
349
349
|
/** @internal */
|
|
350
350
|
_clearTimerHandle() {
|
|
@@ -361,11 +361,11 @@ let a = class extends A {
|
|
|
361
361
|
/** @internal */
|
|
362
362
|
_emitHide() {
|
|
363
363
|
this.dispatchEvent(new CustomEvent("hx-hide", { bubbles: !0, composed: !0 }));
|
|
364
|
-
let
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
},
|
|
368
|
-
|
|
364
|
+
let e = !1;
|
|
365
|
+
const t = () => {
|
|
366
|
+
e || (e = !0, this.dispatchEvent(new CustomEvent("hx-after-hide", { bubbles: !0, composed: !0 })));
|
|
367
|
+
}, n = this._toastEl;
|
|
368
|
+
n && n.addEventListener("transitionend", t, { once: !0 }), setTimeout(t, 300);
|
|
369
369
|
}
|
|
370
370
|
// ─── Event Handlers ───
|
|
371
371
|
/** @internal */
|
|
@@ -389,9 +389,9 @@ let a = class extends A {
|
|
|
389
389
|
this.hide();
|
|
390
390
|
}
|
|
391
391
|
/** @internal */
|
|
392
|
-
_handleActionSlotChange(
|
|
393
|
-
const
|
|
394
|
-
this._hasActionContent =
|
|
392
|
+
_handleActionSlotChange(e) {
|
|
393
|
+
const t = e.target;
|
|
394
|
+
this._hasActionContent = t.assignedNodes({ flatten: !0 }).length > 0, this._hasActionContent && this.open && this._pauseTimer();
|
|
395
395
|
}
|
|
396
396
|
// ─── ARIA Helpers ───
|
|
397
397
|
/**
|
|
@@ -410,7 +410,7 @@ let a = class extends A {
|
|
|
410
410
|
// ensuring the severity is not conveyed by color alone.
|
|
411
411
|
/** @internal */
|
|
412
412
|
_renderSuccessIcon() {
|
|
413
|
-
return
|
|
413
|
+
return f`<svg viewBox="0 0 20 20" aria-hidden="true" width="16" height="16">
|
|
414
414
|
<path
|
|
415
415
|
fill="currentColor"
|
|
416
416
|
d="M10 2a8 8 0 100 16 8 8 0 000-16zm3.03 6.28a.75.75 0 00-1.06-1.06L9 10.19 7.78 8.97a.75.75 0 00-1.06 1.06l1.75 1.75a.75.75 0 001.06 0l3.5-3.5z"
|
|
@@ -419,7 +419,7 @@ let a = class extends A {
|
|
|
419
419
|
}
|
|
420
420
|
/** @internal */
|
|
421
421
|
_renderWarningIcon() {
|
|
422
|
-
return
|
|
422
|
+
return f`<svg viewBox="0 0 20 20" aria-hidden="true" width="16" height="16">
|
|
423
423
|
<path
|
|
424
424
|
fill="currentColor"
|
|
425
425
|
d="M8.49 2.92a1.75 1.75 0 013.02 0l6.25 10.83A1.75 1.75 0 0116.25 16H3.75a1.75 1.75 0 01-1.51-2.25L8.49 2.92zM10 7a.75.75 0 01.75.75v3a.75.75 0 01-1.5 0v-3A.75.75 0 0110 7zm0 7.5a.75.75 0 100-1.5.75.75 0 000 1.5z"
|
|
@@ -428,7 +428,7 @@ let a = class extends A {
|
|
|
428
428
|
}
|
|
429
429
|
/** @internal */
|
|
430
430
|
_renderDangerIcon() {
|
|
431
|
-
return
|
|
431
|
+
return f`<svg viewBox="0 0 20 20" aria-hidden="true" width="16" height="16">
|
|
432
432
|
<path
|
|
433
433
|
fill="currentColor"
|
|
434
434
|
d="M10 2a8 8 0 100 16 8 8 0 000-16zm-1.72 5.22a.75.75 0 011.06 0L10 7.94l.66-.72a.75.75 0 111.06 1.06L11.06 9l.66.72a.75.75 0 11-1.06 1.06L10 10.06l-.66.72a.75.75 0 01-1.06-1.06L8.94 9l-.66-.72a.75.75 0 010-1.06z"
|
|
@@ -437,7 +437,7 @@ let a = class extends A {
|
|
|
437
437
|
}
|
|
438
438
|
/** @internal */
|
|
439
439
|
_renderInfoIcon() {
|
|
440
|
-
return
|
|
440
|
+
return f`<svg viewBox="0 0 20 20" aria-hidden="true" width="16" height="16">
|
|
441
441
|
<path
|
|
442
442
|
fill="currentColor"
|
|
443
443
|
d="M10 2a8 8 0 100 16 8 8 0 000-16zm.75 4.75a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM9.25 9a.75.75 0 011.5 0v4a.75.75 0 01-1.5 0V9z"
|
|
@@ -456,12 +456,12 @@ let a = class extends A {
|
|
|
456
456
|
case "info":
|
|
457
457
|
return this._renderInfoIcon();
|
|
458
458
|
default:
|
|
459
|
-
return
|
|
459
|
+
return E;
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
/** @internal */
|
|
463
463
|
get _severityLabel() {
|
|
464
|
-
return
|
|
464
|
+
return d._SEVERITY_LABELS[this.variant] ?? "";
|
|
465
465
|
}
|
|
466
466
|
// ─── Render ───
|
|
467
467
|
//
|
|
@@ -473,11 +473,11 @@ let a = class extends A {
|
|
|
473
473
|
// older NVDA/JAWS that read both role and aria-live as separate live
|
|
474
474
|
// regions).
|
|
475
475
|
render() {
|
|
476
|
-
const
|
|
477
|
-
return
|
|
476
|
+
const e = this._severityLabel;
|
|
477
|
+
return f`
|
|
478
478
|
<div
|
|
479
479
|
part="base"
|
|
480
|
-
class=${
|
|
480
|
+
class=${X({
|
|
481
481
|
toast: !0,
|
|
482
482
|
[`toast--${this.variant}`]: !0
|
|
483
483
|
})}
|
|
@@ -486,8 +486,8 @@ let a = class extends A {
|
|
|
486
486
|
@focusin=${this._handleFocusIn}
|
|
487
487
|
@focusout=${this._handleFocusOut}
|
|
488
488
|
>
|
|
489
|
-
${this.open ?
|
|
490
|
-
${
|
|
489
|
+
${this.open ? f`
|
|
490
|
+
${e ? f`<span class="toast__severity-label">${e}: </span>` : E}
|
|
491
491
|
<span part="icon" class="toast__icon">
|
|
492
492
|
<slot name="icon">${this._defaultIcon}</slot>
|
|
493
493
|
</span>
|
|
@@ -497,7 +497,7 @@ let a = class extends A {
|
|
|
497
497
|
<span part="action" class="toast__action">
|
|
498
498
|
<slot name="action" @slotchange=${this._handleActionSlotChange}></slot>
|
|
499
499
|
</span>
|
|
500
|
-
${this.closable ?
|
|
500
|
+
${this.closable ? f`
|
|
501
501
|
<button
|
|
502
502
|
part="close-button"
|
|
503
503
|
class="toast__close"
|
|
@@ -518,57 +518,57 @@ let a = class extends A {
|
|
|
518
518
|
<path d="M18 6L6 18M6 6l12 12" />
|
|
519
519
|
</svg>
|
|
520
520
|
</button>
|
|
521
|
-
` :
|
|
522
|
-
` :
|
|
521
|
+
` : E}
|
|
522
|
+
` : E}
|
|
523
523
|
</div>
|
|
524
524
|
`;
|
|
525
525
|
}
|
|
526
526
|
};
|
|
527
|
-
|
|
528
|
-
|
|
527
|
+
d.styles = [te];
|
|
528
|
+
d._SEVERITY_LABELS = {
|
|
529
529
|
success: "Success",
|
|
530
530
|
warning: "Warning",
|
|
531
531
|
danger: "Error",
|
|
532
532
|
info: "Info"
|
|
533
533
|
};
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
],
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
],
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
],
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
],
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
],
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
],
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
],
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
],
|
|
558
|
-
var
|
|
559
|
-
for (var
|
|
560
|
-
(
|
|
561
|
-
return
|
|
534
|
+
_([
|
|
535
|
+
T({ type: String, reflect: !0 })
|
|
536
|
+
], d.prototype, "variant", 2);
|
|
537
|
+
_([
|
|
538
|
+
T({ type: Number })
|
|
539
|
+
], d.prototype, "duration", 2);
|
|
540
|
+
_([
|
|
541
|
+
T({ type: Boolean, reflect: !0 })
|
|
542
|
+
], d.prototype, "closable", 2);
|
|
543
|
+
_([
|
|
544
|
+
T({ type: Boolean, reflect: !0 })
|
|
545
|
+
], d.prototype, "open", 2);
|
|
546
|
+
_([
|
|
547
|
+
T({ attribute: "label-close" })
|
|
548
|
+
], d.prototype, "labelClose", 2);
|
|
549
|
+
_([
|
|
550
|
+
U(".toast")
|
|
551
|
+
], d.prototype, "_toastEl", 2);
|
|
552
|
+
_([
|
|
553
|
+
Z()
|
|
554
|
+
], d.prototype, "_hasActionContent", 2);
|
|
555
|
+
d = _([
|
|
556
|
+
G("hx-toast")
|
|
557
|
+
], d);
|
|
558
|
+
var ae = Object.defineProperty, ie = Object.getOwnPropertyDescriptor, B = (e, t, n, s) => {
|
|
559
|
+
for (var o = s > 1 ? void 0 : s ? ie(t, n) : t, l = e.length - 1, h; l >= 0; l--)
|
|
560
|
+
(h = e[l]) && (o = (s ? h(t, n, o) : h(o)) || o);
|
|
561
|
+
return s && o && ae(t, n, o), o;
|
|
562
562
|
};
|
|
563
|
-
let
|
|
563
|
+
let L = class extends J {
|
|
564
564
|
constructor() {
|
|
565
565
|
super(...arguments), this.placement = "bottom-end", this.stackLimit = 3;
|
|
566
566
|
}
|
|
567
567
|
render() {
|
|
568
|
-
return
|
|
568
|
+
return f`
|
|
569
569
|
<div
|
|
570
570
|
part="base"
|
|
571
|
-
class=${
|
|
571
|
+
class=${X({
|
|
572
572
|
"toast-stack": !0,
|
|
573
573
|
[`toast-stack--${this.placement}`]: !0
|
|
574
574
|
})}
|
|
@@ -578,45 +578,168 @@ let p = class extends A {
|
|
|
578
578
|
`;
|
|
579
579
|
}
|
|
580
580
|
};
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
],
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
],
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
],
|
|
591
|
-
const
|
|
592
|
-
function
|
|
581
|
+
L.styles = [se];
|
|
582
|
+
B([
|
|
583
|
+
T({ type: String, reflect: !0 })
|
|
584
|
+
], L.prototype, "placement", 2);
|
|
585
|
+
B([
|
|
586
|
+
T({ type: Number, attribute: "stack-limit" })
|
|
587
|
+
], L.prototype, "stackLimit", 2);
|
|
588
|
+
L = B([
|
|
589
|
+
G("hx-toast-stack")
|
|
590
|
+
], L);
|
|
591
|
+
const W = 1500, A = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakSet(), S = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap();
|
|
592
|
+
function z(e, t, n) {
|
|
593
|
+
const s = e.get(t);
|
|
594
|
+
s ? (s.push(n), s.sort((o, l) => o - l)) : e.set(t, [n]);
|
|
595
|
+
}
|
|
596
|
+
function D(e, t, n) {
|
|
597
|
+
const s = e.get(t);
|
|
598
|
+
if (!s) return;
|
|
599
|
+
const o = s.indexOf(n);
|
|
600
|
+
o >= 0 && s.splice(o, 1), s.length === 0 && e.delete(t);
|
|
601
|
+
}
|
|
602
|
+
function K(e) {
|
|
603
|
+
const t = (S.get(e) ?? 1) - 1;
|
|
604
|
+
t > 0 ? S.set(e, t) : S.delete(e);
|
|
605
|
+
}
|
|
606
|
+
function P(e) {
|
|
607
|
+
const t = A.get(e);
|
|
608
|
+
if (!(!t || t.status !== "queued")) {
|
|
609
|
+
if (t.status = "cancelled", t.removalObserver !== null && (t.removalObserver.disconnect(), t.removalObserver = null), t.timerId !== null && (clearTimeout(t.timerId), t.timerId = null), K(t.stack), D(H, t.stack, t.fireAt), t.displacement) {
|
|
610
|
+
const { target: n, fireAt: s, timerId: o } = t.displacement;
|
|
611
|
+
clearTimeout(o), I.delete(n), D(y, t.stack, s);
|
|
612
|
+
}
|
|
613
|
+
for (const n of t.synthDisplacements)
|
|
614
|
+
clearTimeout(n.timerId), D(y, t.stack, n.fireAt);
|
|
615
|
+
t.synthDisplacements = [], e.style.removeProperty("display"), e.remove(), A.delete(e);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function le(e, t) {
|
|
619
|
+
const n = A.get(e);
|
|
620
|
+
!n || n.status !== "queued" || (n.status = "showing", n.timerId = null, n.removalObserver !== null && (n.removalObserver.disconnect(), n.removalObserver = null), K(n.stack), D(H, n.stack, n.fireAt), e.style.removeProperty("display"), t(), e.show(), $.set(e, Date.now()), A.delete(e));
|
|
621
|
+
}
|
|
622
|
+
function me(e) {
|
|
593
623
|
if (typeof document > "u") throw new Error("toast() requires a browser environment");
|
|
594
|
-
const
|
|
595
|
-
let
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
}
|
|
624
|
+
const t = e.placement ?? "bottom-end", n = `hx-toast-stack[placement="${t}"]`;
|
|
625
|
+
let s = document.querySelector(n);
|
|
626
|
+
s || (s = document.createElement("hx-toast-stack"), s.placement = t, document.body.appendChild(s));
|
|
627
|
+
let o = 0;
|
|
628
|
+
const l = [], h = [];
|
|
629
|
+
if (s.stackLimit > 0) {
|
|
630
|
+
const x = [...s.querySelectorAll("hx-toast")].filter((c) => c.open).filter((c) => !I.has(c)), b = S.get(s) ?? 0, m = x.length + b + 1 - s.stackLimit, w = [];
|
|
631
|
+
for (let c = 0; c < m; c++) {
|
|
632
|
+
const u = x[c];
|
|
633
|
+
if (u) {
|
|
634
|
+
const i = $.get(u), a = i === void 0 ? Number.POSITIVE_INFINITY : Date.now() - i;
|
|
635
|
+
if (a >= W) {
|
|
636
|
+
u.hide();
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
const C = W - a, v = Date.now() + C;
|
|
640
|
+
I.add(u), z(y, s, v);
|
|
641
|
+
const R = s, g = setTimeout(() => {
|
|
642
|
+
I.delete(u), D(y, R, v), u.open && u.hide();
|
|
643
|
+
}, C);
|
|
644
|
+
w.push(v), l.push({ target: u, fireAt: v, timerId: g }), C > o && (o = C);
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
const O = y.get(s) ?? [], N = H.get(s) ?? [], k = [...O].sort((i, a) => i - a), Q = [...N].sort((i, a) => i - a);
|
|
648
|
+
for (const i of Q)
|
|
649
|
+
for (let a = 0; a < k.length; a++)
|
|
650
|
+
if (k[a] <= i) {
|
|
651
|
+
k.splice(a, 1);
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
for (const i of w) {
|
|
655
|
+
const a = k.indexOf(i);
|
|
656
|
+
a >= 0 && k.splice(a, 1);
|
|
657
|
+
}
|
|
658
|
+
let M = k[0];
|
|
659
|
+
if (M === void 0) {
|
|
660
|
+
const i = [];
|
|
661
|
+
for (const g of O) i.push(g);
|
|
662
|
+
for (const g of N) i.push(g);
|
|
663
|
+
for (const g of w) i.push(g);
|
|
664
|
+
if (i.length === 0)
|
|
665
|
+
break;
|
|
666
|
+
M = Math.max(...i) + W;
|
|
667
|
+
const a = M, C = a - Date.now(), v = s;
|
|
668
|
+
z(y, v, a);
|
|
669
|
+
const R = setTimeout(() => {
|
|
670
|
+
D(y, v, a);
|
|
671
|
+
const Y = [...v.querySelectorAll("hx-toast")].filter(
|
|
672
|
+
(j) => j.open && !I.has(j)
|
|
673
|
+
)[0];
|
|
674
|
+
Y && Y.hide();
|
|
675
|
+
}, C);
|
|
676
|
+
h.push({ fireAt: a, timerId: R });
|
|
609
677
|
}
|
|
678
|
+
w.push(M);
|
|
679
|
+
const F = M - Date.now();
|
|
680
|
+
F > o && (o = Math.max(0, F));
|
|
610
681
|
}
|
|
611
682
|
}
|
|
612
|
-
const
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
683
|
+
const r = document.createElement("hx-toast");
|
|
684
|
+
r.variant = e.variant ?? "default", r.duration = e.duration ?? 3e3, r.closable = !0, r.textContent = e.message;
|
|
685
|
+
const q = () => {
|
|
686
|
+
r.addEventListener("hx-after-hide", () => {
|
|
687
|
+
$.delete(r), I.delete(r), r.remove();
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
if (o > 0) {
|
|
691
|
+
const p = (b) => {
|
|
692
|
+
b.stopImmediatePropagation(), b.stopPropagation();
|
|
693
|
+
};
|
|
694
|
+
r.addEventListener("hx-hide", p, { once: !0 }), r.addEventListener("hx-after-hide", p, { once: !0 }), r.style.display = "none";
|
|
695
|
+
const x = r.hide.bind(r);
|
|
696
|
+
r.hide = function() {
|
|
697
|
+
const m = A.get(r);
|
|
698
|
+
if ((m == null ? void 0 : m.status) === "queued") {
|
|
699
|
+
P(r);
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
x();
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
if (s.appendChild(r), o > 0) {
|
|
706
|
+
const p = s, x = Date.now() + o;
|
|
707
|
+
S.set(p, (S.get(p) ?? 0) + 1), z(H, p, x);
|
|
708
|
+
const b = l.length > 0 ? l[0] : null, m = {
|
|
709
|
+
status: "queued",
|
|
710
|
+
stack: p,
|
|
711
|
+
fireAt: x,
|
|
712
|
+
timerId: null,
|
|
713
|
+
displacement: b,
|
|
714
|
+
synthDisplacements: [...h],
|
|
715
|
+
removalObserver: null
|
|
716
|
+
};
|
|
717
|
+
A.set(r, m);
|
|
718
|
+
const w = new MutationObserver((c) => {
|
|
719
|
+
for (const u of c)
|
|
720
|
+
for (const O of u.removedNodes)
|
|
721
|
+
if (O === r) {
|
|
722
|
+
P(r);
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
w.observe(p, { childList: !0 }), m.removalObserver = w, m.timerId = setTimeout(() => {
|
|
727
|
+
const c = A.get(r);
|
|
728
|
+
if (!(!c || c.status === "cancelled")) {
|
|
729
|
+
if (!r.isConnected) {
|
|
730
|
+
P(r);
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
le(r, q);
|
|
734
|
+
}
|
|
735
|
+
}, o);
|
|
736
|
+
} else
|
|
737
|
+
q(), r.show(), $.set(r, Date.now());
|
|
738
|
+
return r;
|
|
616
739
|
}
|
|
617
740
|
export {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
741
|
+
d as H,
|
|
742
|
+
L as a,
|
|
743
|
+
me as t
|
|
621
744
|
};
|
|
622
|
-
//# sourceMappingURL=toast-factory-
|
|
745
|
+
//# sourceMappingURL=toast-factory-Dht3pVsw.js.map
|