spell-ui 0.8.10 → 0.8.12
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/_util/string.d.ts +7 -0
- package/dist/components/ui-modal/ModalDialogs.d.ts +7 -9
- package/dist/components/ui-modal/UIModal.d.ts +5 -0
- package/dist/components/ui-modal/UIModal.en.d.ts +5 -0
- package/dist/components/ui-toast/ToastStack.d.ts +9 -0
- package/dist/core.js +468 -453
- package/dist/core.js.map +1 -1
- package/dist/index.js +96 -96
- package/dist/jsx.d.ts +10 -0
- package/dist/runtime/runtime.types.d.ts +6 -1
- package/dist/{ui-modal.editor-CkkJRgab.js → ui-modal.editor-B6gmmGsR.js} +2 -2
- package/dist/ui-modal.editor-B6gmmGsR.js.map +1 -0
- package/dist/ui-modal.js +59 -66
- package/dist/ui-modal.js.map +1 -1
- package/dist/ui-property-editor.js +1 -1
- package/dist/ui-root.js +1 -0
- package/dist/ui-root.js.map +1 -1
- package/dist/ui-toast.js +89 -84
- package/dist/ui-toast.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui-modal.editor-CkkJRgab.js.map +0 -1
package/dist/ui-toast.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./rolldown-runtime-c6e9CmGy.js";
|
|
2
|
-
import { A as e, CloseButton as t, D as n, DOMElement as r, Disclosure as i, F as a, Gt as o, IconGlyph as s, Jt as c, Kt as l, L as u, Lt as d, NodeType as f, Nt as ee, OwnControls as te, R as ne, SlotContent as re, UI as p, UIComponent as m, Ut as h, V as ie, ValueSets as g, Warnings as
|
|
2
|
+
import { A as e, CloseButton as t, D as n, DOMElement as r, Disclosure as i, F as a, Gt as o, IconGlyph as s, Jt as c, Kt as l, L as u, Lt as d, NodeType as f, Nt as ee, OwnControls as te, R as ne, SlotContent as re, UI as p, UIComponent as m, Ut as h, V as ie, ValueSets as g, Warnings as _, Wt as ae, Yt as v, after as oe, afterSolidUpdate as se, c as ce, cssState as y, derived as b, f as le, hasMarkdown as ue, isBrowser as de, n as fe, on as x, onChange as pe, proto as me, protoMerged as he, qt as S, s as ge, state as C, v as _e } from "./core.js";
|
|
3
3
|
import "./ui-button.js";
|
|
4
|
-
import { Show as
|
|
5
|
-
import { addEvent as ve, className as
|
|
4
|
+
import { Show as w } from "solid-js";
|
|
5
|
+
import { addEvent as ve, className as T, createComponent as E, delegateEvents as ye, effect as D, getOwner as O, insert as k, memo as A, readShallow as j, ref as be, setAttribute as M, setStyleProperty as xe, template as N } from "@solidjs/web";
|
|
6
6
|
// src/components/ui-toast/UIToast.en.ts
|
|
7
|
-
var
|
|
7
|
+
var P = {
|
|
8
8
|
tag: "ui-toast",
|
|
9
9
|
icon: "bell",
|
|
10
10
|
topics: [
|
|
@@ -225,16 +225,16 @@ var N = {
|
|
|
225
225
|
text: "Notifications",
|
|
226
226
|
description: "Accessible name of each `UI.toast()` container (a `region` landmark)."
|
|
227
227
|
}]
|
|
228
|
-
},
|
|
228
|
+
}, F = "actions", I = "attached", Se = "inverted", L = "vertical", Ce = "@layer ui.components.toast.types{:host{display:block}.toast-box{--_ui-toast-width:var(--ui-toast-width,350px);--_ui-toast-mobile-width:var(--ui-toast-mobile-width,280px);--_ui-toast-radius:var(--ui-toast-radius,var(--ui-radius));--_ui-toast-padding:var(--ui-toast-padding,.785714em 1em);--_ui-toast-font-size:var(--ui-toast-font-size,var(--ui-font-size));--_ui-toast-box-margin:var(--ui-toast-box-margin,.5em);--_ui-toast-background:var(--ui-toast-background,var(--ui-surface));--_ui-toast-color:var(--ui-toast-color,var(--ui-text-color));--_ui-toast-inverted-background:var(--ui-toast-inverted-background,var(--ui-surface));--_ui-toast-border:var(--ui-toast-border,1px solid var(--ui-border-color));--_ui-toast-inverted-border:var(--ui-toast-inverted-border,1px solid oklch(from var(--ui-ink-on-dark) l c h / .5));--_ui-toast-shadow:var(--ui-toast-shadow,var(--ui-shadow-floating));--_ui-toast-duration:var(--ui-toast-duration,var(--ui-duration-slower));--_ui-toast-icon-size:var(--ui-toast-icon-size,1.5em);--_ui-toast-icon-padding:var(--ui-toast-icon-padding,3em);--_ui-toast-close-distance:var(--ui-toast-close-distance,.3em);--_ui-toast-close-opacity:var(--ui-toast-close-opacity,.7);--_ui-toast-action-background:var(--ui-toast-action-background,light-dark(oklch(100% 0 0/.25),oklch(0% 0 0/.2)));--_ui-toast-action-border:var(--ui-toast-action-border,1px solid oklch(0% 0 0/.2));--_ui-toast-action-margin:var(--ui-toast-action-margin,-1em);--_ui-toast-action-margin-top:var(--ui-toast-action-margin-top,.5em);--_ui-toast-action-margin-left:var(--ui-toast-action-margin-left,1em);--_ui-toast-action-gap:var(--ui-toast-action-gap,.3em);--_ui-toast-action-padding:var(--ui-toast-action-padding,.5em);--_ui-toast-action-padding-bottom:var(--ui-toast-action-padding-bottom,.75em);--_ui-toast-progress-height:var(--ui-toast-progress-height,.2em);--ui-animation-duration:var(--_ui-toast-duration);box-sizing:border-box;width:fit-content;max-width:100%;margin:0 0 var(--_ui-toast-box-margin);border-radius:var(--_ui-toast-radius);font-size:var(--_ui-toast-font-size);line-height:var(--ui-line-height);cursor:default;will-change:transform, opacity;display:block;position:relative}.toast-box:not(.unclickable):hover{cursor:var(--ui-control-cursor)}:host(:last-child)>.toast-box{margin-bottom:0}.ui.toast{box-sizing:border-box;padding:var(--_ui-toast-padding);border-radius:var(--_ui-toast-radius);background:var(--ui-color,var(--_ui-toast-background));color:var(--ui-color-on,var(--_ui-toast-color));margin:0;display:block;position:relative}.ui.toast>.content>.header{color:inherit;font-weight:var(--ui-font-weight-bold);margin:0}.ui.toast>.content>.message{color:inherit}}@layer ui.components.toast.content{.ui.toast>.icon:not(.close){width:1em;height:1em;font-size:var(--_ui-toast-icon-size);justify-content:center;align-items:center;display:inline-flex;position:absolute;top:50%;transform:translateY(-50%)}.ui.toast>.icon:not(.close)>svg{width:1em;height:1em}.ui.toast>.icon:not(.close)+.content{min-height:1.5em;padding-inline-start:var(--_ui-toast-icon-padding)}.ui.vertical.toast>.icon:not(.close){flex-shrink:0;align-self:center;position:static;transform:none}.ui.vertical.toast>.icon:not(.close)+.content{padding-inline-start:1em}.ui.actions.toast:not(.vertical)>.centered.icon{top:calc(50% - 1.2em)}.ui.toast>.close.icon{top:var(--_ui-toast-close-distance);right:var(--_ui-toast-close-distance);border-radius:var(--ui-radius-s);width:1.5em;height:1.5em;color:inherit;font:inherit;opacity:var(--_ui-toast-close-opacity);cursor:var(--ui-control-cursor);transition:opacity var(--ui-duration-normal) var(--ui-ease);background:0 0;border:0;justify-content:center;align-items:center;margin:0;padding:.25em;display:inline-flex;position:absolute}.ui.toast>.close.icon:hover,.ui.toast>.close.icon:focus-visible{opacity:1}.ui.toast>.close.icon>svg{width:1em;height:1em}.ui.toast:has(>.close.icon)>.content{padding-inline-end:1.5em}.ui.vertical.toast>.close.icon{margin:calc(var(--_ui-toast-close-distance) * -1) calc(var(--_ui-toast-close-distance) * -1) 0 0;order:1;align-self:flex-start;position:static}.ui.toast .actions{margin:var(--_ui-toast-action-margin-top) var(--_ui-toast-action-margin) var(--_ui-toast-action-margin);padding:var(--_ui-toast-action-padding) var(--_ui-toast-action-padding) var(--_ui-toast-action-padding-bottom);text-align:right}.ui.toast .actions:not(.basic,.attached){border-top:var(--_ui-toast-action-border);background:var(--_ui-toast-action-background);border-end-end-radius:var(--_ui-toast-radius);border-end-start-radius:var(--_ui-toast-radius)}.ui.toast:has(>.actions:not(.basic,.attached,.vertical):last-child){padding-bottom:0}.ui.toast>.actions:not(.basic,.attached,.vertical):last-child{margin-bottom:0}.ui.toast .left.actions{text-align:left}.actions>::slotted(*){margin-inline-start:var(--_ui-toast-action-gap)}}@layer ui.components.toast.variations{.toast-box.compact,.toast-box>.compact{width:var(--_ui-toast-width)}.toast-box.floating{border:var(--_ui-toast-border);box-shadow:var(--_ui-toast-shadow)}.toast-box.floating:has(>.inverted.toast){border:var(--_ui-toast-inverted-border)}.ui.neutral.toast{--ui-color:initial;--ui-color-on:initial}.ui.inverted.toast{--ui-scheme:dark;color-scheme:dark;background:var(--ui-color-inverted,var(--_ui-toast-inverted-background));color:var(--ui-color-inverted-on,var(--_ui-toast-color))}.ui.vertical.toast{display:flex}.ui.vertical.toast>.content{flex-grow:1}.ui.toast .vertical.actions{margin:calc(var(--_ui-toast-action-padding-bottom) * -1) -1em calc(var(--_ui-toast-action-padding-bottom) * -1) var(--_ui-toast-action-margin-left);padding:var(--_ui-toast-action-padding);border-radius:0 var(--_ui-toast-radius) var(--_ui-toast-radius) 0;border-top:0;flex-direction:column;justify-content:space-around;display:flex}.ui.toast .vertical.actions:not(.basic){border-inline-start:var(--_ui-toast-action-border)}.ui.toast .vertical.top.actions{justify-content:flex-start}.ui.toast .vertical.bottom.actions{justify-content:flex-end}.vertical.actions>::slotted(*){margin-inline-start:0}.vertical.actions>::slotted(:not(:last-child)){margin-block-end:var(--_ui-toast-action-gap)}.toast-box>.attached.actions,.vertical.attached>.attached.actions{margin:0;display:flex}.toast-box>.attached.actions>::slotted(*),.vertical.attached>.attached.actions>::slotted(*){flex:auto}.ui.attached.toast.top,.ui.attached.toast:not(.top,.bottom,.left){border-end-end-radius:0;border-end-start-radius:0}.ui.attached.toast.bottom{border-start-start-radius:0;border-start-end-radius:0}.vertical.attached{display:flex}.vertical.attached>.ui.toast{border-radius:var(--_ui-toast-radius) 0 0 var(--_ui-toast-radius);flex:1}.vertical.attached>.ui.left.toast{border-radius:0 var(--_ui-toast-radius) var(--_ui-toast-radius) 0}.vertical.attached>.attached.actions{flex-direction:column}.toast-box>.ui.attached.progress{z-index:1;height:var(--_ui-toast-progress-height);background:0 0;position:relative;overflow:hidden}.toast-box>.ui.attached.progress.top{margin-bottom:calc(var(--_ui-toast-progress-height) * -1);border-start-start-radius:var(--_ui-toast-radius);border-start-end-radius:var(--_ui-toast-radius)}.toast-box>.ui.attached.progress.bottom{margin-top:calc(var(--_ui-toast-progress-height) * -1);border-end-end-radius:var(--_ui-toast-radius);border-end-start-radius:var(--_ui-toast-radius)}.toast-box>.ui.progress>.bar{background:oklch(from var(--ui-color,var(--ui-text-muted)) calc(l - .15) c h);width:100%;min-width:0;height:100%}.toast-box>.ui.inverted.progress>.bar{background:oklch(from var(--ui-color-inverted,var(--ui-text-inverted-muted)) calc(l + .1) c h)}.toast-box>.ui.progress>.up.bar{width:0}.toast-box>.ui.progress>.progressing{animation-timing-function:linear;animation-iteration-count:1;animation-fill-mode:forwards}.toast-box>.ui.progress>.up.progressing{animation-name:ui-toast-progress-up}.toast-box>.ui.progress>.down.progressing{animation-name:ui-toast-progress-down}@media only screen and (width<=420px){.toast-box,.toast-box.compact,.toast-box>.compact{width:fit-content;min-width:var(--_ui-toast-mobile-width);max-width:100%}}}@layer ui.components.toast.states{:host(:state(paused)) .progressing{animation-play-state:paused}:host(:state(closing)) .toast-box{pointer-events:none}}@keyframes ui-toast-progress-down{0%{width:100%}to{width:0}}@keyframes ui-toast-progress-up{0%{width:0}to{width:100%}}", we = /* @__PURE__ */ N("<div><!><!><!>"), Te = /* @__PURE__ */ N("<div><!><!><!><!><!>"), Ee = /* @__PURE__ */ N("<span>"), R = /* @__PURE__ */ N("<div>"), De = /* @__PURE__ */ N("<div><div><!><slot></slot></div><!><!>"), Oe = /* @__PURE__ */ N("<div><slot>"), ke = /* @__PURE__ */ N("<div><div>"), z, B, V, H, U, W, G, Ae, je, Me, Ne, Pe, Fe, Ie, Le, Re, ze, Be, Ve, K, q, J, Y, X, DOMToastElement = class extends r {
|
|
229
229
|
static {
|
|
230
230
|
l(this, "DOMToastElement");
|
|
231
231
|
}
|
|
232
232
|
close() {
|
|
233
233
|
return this.component?.close() ?? !1;
|
|
234
234
|
}
|
|
235
|
-
},
|
|
235
|
+
}, Z = class _UIToast extends (K = m, Ve = [me], Be = [he], ze = [b], Re = [b], Le = [b], Ie = [b], Fe = [b], Pe = [b], Ne = [pe("isConnected", "isReady")], Me = [y("closing"), C], je = [b], Ae = [C], G = [y("paused"), C], W = [x("pointerenter")], U = [x("pointermove")], H = [x("pointerleave")], V = [x("focusin")], B = [x("focusout")], z = [x("command")], K) {
|
|
236
236
|
constructor(...e) {
|
|
237
|
-
super(...e),
|
|
237
|
+
super(...e), v(q, 5, this), c(this, "slots", new re(this.domElement)), c(this, "iconGlyph", new s({
|
|
238
238
|
owner: this,
|
|
239
239
|
name: /* @__PURE__ */ l(() => this.iconName, "name")
|
|
240
240
|
})), c(this, "closeButton", new t({
|
|
@@ -248,7 +248,7 @@ var N = {
|
|
|
248
248
|
kind: "toast",
|
|
249
249
|
restoreFocus: !1,
|
|
250
250
|
onDismiss: /* @__PURE__ */ l((e) => void this.close(e === "close-all" ? "close-all" : "dismiss"), "onDismiss")
|
|
251
|
-
}),
|
|
251
|
+
}), S(this, J, v(q, 8, this, !1)), v(q, 11, this), c(this, "disclosure", new i({
|
|
252
252
|
component: this,
|
|
253
253
|
kept: {
|
|
254
254
|
isOpen: /* @__PURE__ */ l(() => !this.isClosing, "isOpen"),
|
|
@@ -261,7 +261,7 @@ var N = {
|
|
|
261
261
|
originalEvent: t
|
|
262
262
|
}), "detail"),
|
|
263
263
|
afterDetail: /* @__PURE__ */ l((e) => e ? { displayTime: this.displayDuration } : { reason: this.closeReason }, "afterDetail")
|
|
264
|
-
})), c(this, "closeReason", "dismiss"),
|
|
264
|
+
})), c(this, "closeReason", "dismiss"), S(this, Y, v(q, 12, this, !1)), v(q, 15, this), S(this, X, v(q, 16, this, !1)), v(q, 19, this), c(this, "countdownTimer"), c(this, "timeLeft", 0), c(this, "startedAt", 0), c(this, "hasPointerEntered", !1), c(this, "isHovered", !1), c(this, "focusIsInside", !1), c(this, "onCloseIcon", /* @__PURE__ */ l((e) => {
|
|
265
265
|
e.stopPropagation(), this.close("close", e);
|
|
266
266
|
}, "onCloseIcon")), c(this, "onKeyDown", /* @__PURE__ */ l((e) => {
|
|
267
267
|
e.key !== a.escape || e.defaultPrevented || this.close("escape", e) && e.preventDefault();
|
|
@@ -283,7 +283,7 @@ var N = {
|
|
|
283
283
|
}, "onClick")), this.domElement.addReleaseCallback(() => this.countdownTimer?.cancel());
|
|
284
284
|
}
|
|
285
285
|
get hasActions() {
|
|
286
|
-
return this.slots.hasContent(this.slotForName(
|
|
286
|
+
return this.slots.hasContent(this.slotForName(F));
|
|
287
287
|
}
|
|
288
288
|
get actionWords() {
|
|
289
289
|
let e = g.get(this.elementDefinition.attribute("actions").spec.values ?? []), t = (this.actions ?? "").split(d).filter((t) => e.includes(t));
|
|
@@ -297,17 +297,17 @@ var N = {
|
|
|
297
297
|
}
|
|
298
298
|
get extraClass() {
|
|
299
299
|
let e = [], t = this.actionWords;
|
|
300
|
-
return this.actionsAreVertical && e.push(
|
|
300
|
+
return this.actionsAreVertical && e.push(L), this.hasActions && !this.actionsAreAttached && (!t.has("basic") || t.has("left")) && e.push(F), this.actionsAreAttached && (e.push(I), this.actionsAreVertical ? t.has("left") && e.push(u) : e.push(t.has("top") ? ge : "top")), this.compact && e.push(Q), e.join(" ") || void 0;
|
|
301
301
|
}
|
|
302
302
|
get boxClasses() {
|
|
303
303
|
let e = [We, Ge];
|
|
304
|
-
return this.compact && e.push(
|
|
304
|
+
return this.compact && e.push(Q), this.anyClickCloses || e.push(Ke), e.join(" ");
|
|
305
305
|
}
|
|
306
306
|
get verticalClasses() {
|
|
307
307
|
return [
|
|
308
|
+
L,
|
|
308
309
|
I,
|
|
309
|
-
|
|
310
|
-
...this.compact ? [Z] : []
|
|
310
|
+
...this.compact ? [Q] : []
|
|
311
311
|
].join(" ");
|
|
312
312
|
}
|
|
313
313
|
get actionsClasses() {
|
|
@@ -315,13 +315,13 @@ var N = {
|
|
|
315
315
|
return (this.actionsAreAttached ? [
|
|
316
316
|
$e,
|
|
317
317
|
...e,
|
|
318
|
-
|
|
319
|
-
] : [...e,
|
|
318
|
+
F
|
|
319
|
+
] : [...e, F]).join(" ");
|
|
320
320
|
}
|
|
321
321
|
get progressClasses() {
|
|
322
322
|
let e = [
|
|
323
323
|
"ui",
|
|
324
|
-
|
|
324
|
+
I,
|
|
325
325
|
fe,
|
|
326
326
|
et,
|
|
327
327
|
this.progress ?? "bottom"
|
|
@@ -339,154 +339,154 @@ var N = {
|
|
|
339
339
|
render() {
|
|
340
340
|
let e = this;
|
|
341
341
|
var t = Te(), n = t.firstChild, r = n.nextSibling, i = r.nextSibling, a = i.nextSibling, o = a.nextSibling;
|
|
342
|
-
return ve(t, "keydown", e.onKeyDown, !0), ve(t, "click", e.onClick, !0), be(() => (t) => e.box = t, t),
|
|
342
|
+
return ve(t, "keydown", e.onKeyDown, !0), ve(t, "click", e.onClick, !0), be(() => (t) => e.box = t, t), k(t, E(w, {
|
|
343
343
|
get when() {
|
|
344
344
|
return e.progress === "top";
|
|
345
345
|
},
|
|
346
346
|
get children() {
|
|
347
347
|
return e.progressBar();
|
|
348
348
|
}
|
|
349
|
-
}), n),
|
|
349
|
+
}), n), k(t, E(w, {
|
|
350
350
|
get when() {
|
|
351
|
-
return
|
|
351
|
+
return A(() => !(!e.actionsAreAttached || e.actionsAreVertical))() ? e.actionWords.has("top") : e.actionsAreAttached && !e.actionsAreVertical;
|
|
352
352
|
},
|
|
353
353
|
get children() {
|
|
354
354
|
return e.actionsBox();
|
|
355
355
|
}
|
|
356
|
-
}), r),
|
|
356
|
+
}), r), k(t, E(w, {
|
|
357
357
|
get when() {
|
|
358
|
-
return
|
|
358
|
+
return A(() => !!e.actionsAreAttached)() ? e.actionsAreVertical : e.actionsAreAttached;
|
|
359
359
|
},
|
|
360
360
|
get fallback() {
|
|
361
361
|
return e.toast();
|
|
362
362
|
},
|
|
363
363
|
get children() {
|
|
364
364
|
var t = we(), n = t.firstChild, r = n.nextSibling, i = r.nextSibling;
|
|
365
|
-
return
|
|
365
|
+
return k(t, E(w, {
|
|
366
366
|
get when() {
|
|
367
367
|
return e.actionWords.has(u);
|
|
368
368
|
},
|
|
369
369
|
get children() {
|
|
370
370
|
return e.actionsBox();
|
|
371
371
|
}
|
|
372
|
-
}), n),
|
|
372
|
+
}), n), k(t, () => e.toast(), r), k(t, E(w, {
|
|
373
373
|
get when() {
|
|
374
374
|
return !e.actionWords.has(u);
|
|
375
375
|
},
|
|
376
376
|
get children() {
|
|
377
377
|
return e.actionsBox();
|
|
378
378
|
}
|
|
379
|
-
}), i),
|
|
380
|
-
|
|
379
|
+
}), i), D(() => j(e.verticalClasses), (e, n) => {
|
|
380
|
+
T(t, e, n);
|
|
381
381
|
}), t;
|
|
382
382
|
}
|
|
383
|
-
}), i),
|
|
383
|
+
}), i), k(t, E(w, {
|
|
384
384
|
get when() {
|
|
385
|
-
return
|
|
385
|
+
return A(() => !(!e.actionsAreAttached || e.actionsAreVertical))() ? !e.actionWords.has("top") : e.actionsAreAttached && !e.actionsAreVertical;
|
|
386
386
|
},
|
|
387
387
|
get children() {
|
|
388
388
|
return e.actionsBox();
|
|
389
389
|
}
|
|
390
|
-
}), a),
|
|
390
|
+
}), a), k(t, E(w, {
|
|
391
391
|
get when() {
|
|
392
392
|
return e.progress === ge;
|
|
393
393
|
},
|
|
394
394
|
get children() {
|
|
395
395
|
return e.progressBar();
|
|
396
396
|
}
|
|
397
|
-
}), o),
|
|
398
|
-
e:
|
|
397
|
+
}), o), D(() => ({
|
|
398
|
+
e: j(e.boxClasses),
|
|
399
399
|
t: e.partForName("box")
|
|
400
400
|
}), ({ e, t: n }, r) => {
|
|
401
|
-
|
|
401
|
+
T(t, e, r?.e), n !== r?.t && M(t, "part", n);
|
|
402
402
|
}), t;
|
|
403
403
|
}
|
|
404
404
|
toast() {
|
|
405
405
|
let e = this;
|
|
406
406
|
var t = De(), r = t.firstChild, i = r.firstChild, a = i.nextSibling, o = r.nextSibling, s = o.nextSibling;
|
|
407
|
-
return
|
|
407
|
+
return k(t, E(w, {
|
|
408
408
|
get when() {
|
|
409
409
|
return e.iconName !== void 0;
|
|
410
410
|
},
|
|
411
411
|
get children() {
|
|
412
412
|
var t = Ee();
|
|
413
|
-
return
|
|
414
|
-
e:
|
|
413
|
+
return k(t, () => e.iconGlyph.svg), D(() => ({
|
|
414
|
+
e: j(Qe),
|
|
415
415
|
t: e.partForName("icon")
|
|
416
416
|
}), ({ e, t: n }, r) => {
|
|
417
|
-
|
|
417
|
+
T(t, e, r?.e), n !== r?.t && M(t, "part", n);
|
|
418
418
|
}), t;
|
|
419
419
|
}
|
|
420
|
-
}), r),
|
|
420
|
+
}), r), k(r, E(w, {
|
|
421
421
|
get when() {
|
|
422
422
|
return e.heading;
|
|
423
423
|
},
|
|
424
424
|
get children() {
|
|
425
|
-
var t =
|
|
426
|
-
return
|
|
427
|
-
e:
|
|
425
|
+
var t = R();
|
|
426
|
+
return k(t, () => e.heading), D(() => ({
|
|
427
|
+
e: j(n),
|
|
428
428
|
t: e.partForName("header")
|
|
429
429
|
}), ({ e, t: n }, r) => {
|
|
430
|
-
|
|
430
|
+
T(t, e, r?.e), n !== r?.t && M(t, "part", n);
|
|
431
431
|
}), t;
|
|
432
432
|
}
|
|
433
|
-
}), i),
|
|
433
|
+
}), i), k(r, E(w, {
|
|
434
434
|
get when() {
|
|
435
435
|
return e.message;
|
|
436
436
|
},
|
|
437
437
|
get children() {
|
|
438
|
-
var t =
|
|
439
|
-
return
|
|
440
|
-
e:
|
|
438
|
+
var t = R();
|
|
439
|
+
return k(t, () => e.message), D(() => ({
|
|
440
|
+
e: j(ne),
|
|
441
441
|
t: e.partForName("message")
|
|
442
442
|
}), ({ e, t: n }, r) => {
|
|
443
|
-
|
|
443
|
+
T(t, e, r?.e), n !== r?.t && M(t, "part", n);
|
|
444
444
|
}), t;
|
|
445
445
|
}
|
|
446
|
-
}), a), a._$owner =
|
|
446
|
+
}), a), a._$owner = O(), k(t, () => e.closeButton.draw(), o), k(t, E(w, {
|
|
447
447
|
get when() {
|
|
448
|
-
return
|
|
448
|
+
return A(() => !!e.hasActions)() ? !e.actionsAreAttached : e.hasActions;
|
|
449
449
|
},
|
|
450
450
|
get children() {
|
|
451
451
|
return e.actionsBox();
|
|
452
452
|
}
|
|
453
|
-
}), s),
|
|
454
|
-
e:
|
|
453
|
+
}), s), D(() => ({
|
|
454
|
+
e: j(e.rootClass),
|
|
455
455
|
t: e.partForName("toast"),
|
|
456
456
|
a: e.type === Ue ? "alert" : "status",
|
|
457
|
-
o:
|
|
457
|
+
o: j(le),
|
|
458
458
|
i: e.partForName("content")
|
|
459
459
|
}), ({ e, t: n, a: i, o: a, i: o }, s) => {
|
|
460
|
-
|
|
460
|
+
T(t, e, s?.e), n !== s?.t && M(t, "part", n), i !== s?.a && M(t, "role", i), T(r, a, s?.o), o !== s?.i && M(r, "part", o);
|
|
461
461
|
}), t;
|
|
462
462
|
}
|
|
463
463
|
actionsBox() {
|
|
464
464
|
let e = this;
|
|
465
465
|
var t = Oe(), n = t.firstChild;
|
|
466
|
-
return n._$owner =
|
|
467
|
-
e:
|
|
466
|
+
return n._$owner = O(), D(() => ({
|
|
467
|
+
e: j(e.actionsClasses),
|
|
468
468
|
t: e.partForName("actions"),
|
|
469
|
-
a: e.slotForName(
|
|
469
|
+
a: e.slotForName(F)
|
|
470
470
|
}), ({ e, t: r, a: i }, a) => {
|
|
471
|
-
|
|
471
|
+
T(t, e, a?.e), r !== a?.t && M(t, "part", r), i !== a?.a && M(n, "name", i);
|
|
472
472
|
}), t;
|
|
473
473
|
}
|
|
474
474
|
progressBar() {
|
|
475
475
|
let e = this;
|
|
476
|
-
return
|
|
476
|
+
return E(w, {
|
|
477
477
|
get when() {
|
|
478
478
|
return e.displayDuration > 0;
|
|
479
479
|
},
|
|
480
480
|
get children() {
|
|
481
481
|
var t = ke(), n = t.firstChild;
|
|
482
|
-
return
|
|
483
|
-
e:
|
|
482
|
+
return M(n, "data-ui-motion", it), D(() => ({
|
|
483
|
+
e: j(e.progressClasses),
|
|
484
484
|
t: e.partForName("progress"),
|
|
485
|
-
a:
|
|
485
|
+
a: j(e.barClasses),
|
|
486
486
|
o: e.partForName("bar"),
|
|
487
487
|
i: `${e.displayDuration}ms`
|
|
488
488
|
}), ({ e, t: r, a: i, o: a, i: o }, s) => {
|
|
489
|
-
|
|
489
|
+
T(t, e, s?.e), r !== s?.t && M(t, "part", r), T(n, i, s?.a), a !== s?.o && M(n, "part", a), o !== s?.i && xe(n, "animation-duration", o);
|
|
490
490
|
}), t;
|
|
491
491
|
}
|
|
492
492
|
});
|
|
@@ -534,7 +534,7 @@ var N = {
|
|
|
534
534
|
return Number.isFinite(t) && t > 0 ? t : 0;
|
|
535
535
|
}
|
|
536
536
|
get readingTime() {
|
|
537
|
-
let e = this.slotForName(
|
|
537
|
+
let e = this.slotForName(F), t = [...this.domElement.childNodes].filter((t) => t.nodeType === f.element ? t.slot !== e : t.nodeType === f.text), n = [
|
|
538
538
|
this.heading,
|
|
539
539
|
this.message,
|
|
540
540
|
...t.map((e) => e.textContent)
|
|
@@ -546,7 +546,7 @@ var N = {
|
|
|
546
546
|
e <= 0 || (this.timeLeft = e, this.countdownHasStarted = !0, !this.isHovered && !this.focusIsInside && this.resumeTimer());
|
|
547
547
|
}
|
|
548
548
|
resumeTimer() {
|
|
549
|
-
this.countdownTimer || this.isClosing || this.timeLeft <= 0 || !this.domElement.isConnected || (this.startedAt = performance.now(), this.countdownTimer =
|
|
549
|
+
this.countdownTimer || this.isClosing || this.timeLeft <= 0 || !this.domElement.isConnected || (this.startedAt = performance.now(), this.countdownTimer = oe(this.timeLeft / 1e3, () => {
|
|
550
550
|
this.countdownTimer = void 0, this.timeLeft = 0, this.close("timeout");
|
|
551
551
|
}));
|
|
552
552
|
}
|
|
@@ -572,7 +572,7 @@ var N = {
|
|
|
572
572
|
this.focusIsInside = !0, this.updatePause();
|
|
573
573
|
}
|
|
574
574
|
onFocusOut() {
|
|
575
|
-
|
|
575
|
+
se(() => {
|
|
576
576
|
this.focusIsInside = this.domElement.matches(":focus-within"), this.updatePause();
|
|
577
577
|
});
|
|
578
578
|
}
|
|
@@ -580,7 +580,7 @@ var N = {
|
|
|
580
580
|
e.command === ee.close && this.close("close", e);
|
|
581
581
|
}
|
|
582
582
|
actionFor(e) {
|
|
583
|
-
let t = this.slotForName(
|
|
583
|
+
let t = this.slotForName(F), n;
|
|
584
584
|
for (let r of ie.lightPath(e, this.domElement)) {
|
|
585
585
|
if (!n) {
|
|
586
586
|
let e = ie.of(r) ?? (_UIToast.isButton(r) ? "action" : void 0);
|
|
@@ -593,12 +593,12 @@ var N = {
|
|
|
593
593
|
return e.matches(at) || m.registry.definitions.get(e.localName)?.vocabulary.noun === "button";
|
|
594
594
|
}
|
|
595
595
|
};
|
|
596
|
-
|
|
596
|
+
q = o(K), J = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), h(q, 2, "actionWords", ze, Z), h(q, 2, "boxClasses", Re, Z), h(q, 2, "verticalClasses", Le, Z), h(q, 2, "actionsClasses", Ie, Z), h(q, 2, "progressClasses", Fe, Z), h(q, 2, "barClasses", Pe, Z), h(q, 1, "onConnectedChanged", Ne, Z), h(q, 4, "isClosing", Me, Z, J), h(q, 2, "displayDuration", je, Z), h(q, 4, "countdownHasStarted", Ae, Z, Y), h(q, 4, "isPaused", G, Z, X), h(q, 1, "onPointerEnter", W, Z), h(q, 1, "onPointerMove", U, Z), h(q, 1, "onPointerLeave", H, Z), h(q, 1, "onFocusIn", V, Z), h(q, 1, "onFocusOut", B, Z), h(q, 1, "onCommand", z, Z), h(q, 13, "vocabulary", Ve, Z), h(q, 13, "elementSetup", Be, Z), ae(q, Z), l(Z, "UIToast"), c(Z, "vocabulary", v(q, 20, Z, P)), v(q, 23, Z), c(Z, "elementSetup", v(q, 24, Z, {
|
|
597
597
|
styleSheets: { toast: Ce },
|
|
598
598
|
DOMElement: DOMToastElement,
|
|
599
599
|
delegatesFocus: !1
|
|
600
|
-
})),
|
|
601
|
-
var He =
|
|
600
|
+
})), v(q, 27, Z);
|
|
601
|
+
var He = Z, Ue = "error", We = "floating", Ge = "toast-box", Q = "compact", Ke = "unclickable", qe = {
|
|
602
602
|
info: "circle-info",
|
|
603
603
|
success: "circle-check",
|
|
604
604
|
warning: "triangle-exclamation",
|
|
@@ -632,11 +632,11 @@ var st = "@layer ui.components{.ui.toast-container{--_ui-toast-container-distanc
|
|
|
632
632
|
(this.showingToasts.get(e)?.element)?.close?.();
|
|
633
633
|
}
|
|
634
634
|
toastFor(e, t) {
|
|
635
|
-
let n = this.document.createElement(
|
|
635
|
+
let n = this.document.createElement(P.tag);
|
|
636
636
|
n.id = t;
|
|
637
|
-
let r = e.showIcon ?? !0, i = {
|
|
637
|
+
let r = e.showIcon ?? !0, i = e.markdown && e.message && ue(e.message) ? e.message : void 0, a = {
|
|
638
638
|
heading: e.title,
|
|
639
|
-
message: e.message,
|
|
639
|
+
message: i ? void 0 : e.message,
|
|
640
640
|
"display-time": String(e.displayTime ?? ft),
|
|
641
641
|
icon: r === !0 ? "" : r || void 0,
|
|
642
642
|
progress: e.showProgress || void 0,
|
|
@@ -647,23 +647,28 @@ var st = "@layer ui.components{.ui.toast-container{--_ui-toast-container-distanc
|
|
|
647
647
|
compact: e.compact === !1 ? "false" : void 0,
|
|
648
648
|
actions: e.actions?.length ? e.classActions : void 0,
|
|
649
649
|
type: e.type
|
|
650
|
-
},
|
|
651
|
-
for (let e of
|
|
652
|
-
for (let [e, t] of Object.entries(
|
|
653
|
-
return
|
|
650
|
+
}, o = (e.class ?? "").split(d).filter(Boolean);
|
|
651
|
+
for (let e of o) pt.includes(e) ? a.type = e : g.has(mt, e) ? a.color = e : e === "inverted" && (a.inverted = "");
|
|
652
|
+
for (let [e, t] of Object.entries(a)) t !== void 0 && n.setAttribute(e, t);
|
|
653
|
+
return o.length && (n.className = o.join(" ")), i && n.append(this.markdownFor(i)), e.actions?.length && n.append(this.actionsFor(e.actions, e.classActions ?? "")), n;
|
|
654
|
+
}
|
|
655
|
+
markdownFor(e) {
|
|
656
|
+
import("./ui-markdown.js").catch((e) => _.warn("UI.toast()", "can't load <ui-markdown> for a Markdown message", e));
|
|
657
|
+
let t = this.document.createElement(St);
|
|
658
|
+
return t.toggleAttribute(Ct, !0), t.toggleAttribute(wt, !0), t.textContent = e, t;
|
|
654
659
|
}
|
|
655
660
|
actionsFor(e, t) {
|
|
656
661
|
let n = t.split(d), r = e.map((e) => this.buttonFor(e)), i = ToastStack.definitionFor(vt);
|
|
657
662
|
if (!n.includes("attached") || !i) {
|
|
658
663
|
let e = this.document.createDocumentFragment();
|
|
659
|
-
for (let t of r) t.slot =
|
|
664
|
+
for (let t of r) t.slot = F, e.append(t);
|
|
660
665
|
return e;
|
|
661
666
|
}
|
|
662
667
|
let a = this.document.createElement(i.tag);
|
|
663
|
-
return a.slot =
|
|
668
|
+
return a.slot = F, a.setAttribute(n.includes("vertical") ? L : _e, ""), a.append(...r), a;
|
|
664
669
|
}
|
|
665
670
|
buttonFor(t) {
|
|
666
|
-
let n = ToastStack.definitionFor(
|
|
671
|
+
let n = ToastStack.definitionFor(ce), r = this.document.createElement(n?.tag ?? "button"), i = (t.class ?? "").split(d).filter(Boolean);
|
|
667
672
|
i.length && (r.className = i.join(" "));
|
|
668
673
|
let a = new Set(n?.vocabulary.attributes.filter(({ kind: e }) => e === ht).map(({ name: e }) => e)), o = ToastStack.oldSwitchesOf(n?.vocabulary);
|
|
669
674
|
for (let e of i) {
|
|
@@ -693,18 +698,18 @@ var st = "@layer ui.components{.ui.toast-container{--_ui-toast-container-distanc
|
|
|
693
698
|
for (let t of m.registry.definitions.values()) if (t.vocabulary.noun === e) return t;
|
|
694
699
|
}
|
|
695
700
|
containerFor(e) {
|
|
696
|
-
let t = e.position ??
|
|
697
|
-
ut.includes(t) || (
|
|
701
|
+
let t = e.position ?? $;
|
|
702
|
+
ut.includes(t) || (_.devWarn("UI.toast()", `unknown position "${t}"; using "${$}"`), t = $);
|
|
698
703
|
let n = e.horizontal ? `${t} horizontal` : t, r = this.containers.get(n);
|
|
699
704
|
if (r?.isConnected) return r;
|
|
700
|
-
p.styles.has(
|
|
705
|
+
p.styles.has(yt) || p.styles.register(yt, st, { page: !0 });
|
|
701
706
|
let i = this.document.createElement("div");
|
|
702
707
|
return i.popover = "manual", i.className = [
|
|
703
708
|
"ui",
|
|
704
709
|
t,
|
|
705
|
-
|
|
710
|
+
bt,
|
|
706
711
|
...e.horizontal ? ["horizontal"] : []
|
|
707
|
-
].join(" "), i.setAttribute("role", "region"), i.setAttribute("aria-label", p.i18n.t(
|
|
712
|
+
].join(" "), i.setAttribute("role", "region"), i.setAttribute("aria-label", p.i18n.t(xt)), this.document.body.append(i), this.containers.set(n, i), i;
|
|
708
713
|
}
|
|
709
714
|
static raise(e) {
|
|
710
715
|
let t = e.matches(":popover-open");
|
|
@@ -728,7 +733,7 @@ var st = "@layer ui.components{.ui.toast-container{--_ui-toast-container-distanc
|
|
|
728
733
|
"bottom left",
|
|
729
734
|
"bottom center",
|
|
730
735
|
"centered"
|
|
731
|
-
],
|
|
736
|
+
], $ = "bottom right", dt = P.tag, ft = 3e3, pt = P.attributes.find(({ name: e }) => e === "type").values, mt = "hues", ht = "keyOnly", gt = "multiple", _t = "color", vt = "buttons", yt = "toast-container", bt = "toast-container", xt = "notifications", St = "ui-markdown", Ct = "sanitized", wt = "breaks";
|
|
732
737
|
He.define(), de() && p.load().then(() => p.toasts.register(new ct()));
|
|
733
738
|
export { DOMToastElement, ct as ToastStack, He as UIToast };
|
|
734
739
|
|