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-modal.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "./rolldown-runtime-c6e9CmGy.js";
|
|
2
|
-
import { CloseButton as e, D as t, Disclosure as n, F as r, Gt as i, Jt as a, Kt as o, Nt as s, O as ee, UI as c, UIComponent as l, Ut as u, V as d, Wt as f, Yt as p, a as te, after as ne, c as re, f as m,
|
|
2
|
+
import { CloseButton as e, D as t, Disclosure as n, F as r, Gt as i, Jt as a, Kt as o, Nt as s, O as ee, UI as c, UIComponent as l, Ut as u, V as d, Wt as f, Yt as p, a as te, after as ne, c as re, f as m, hasMarkdown as ie, isBrowser as ae, on as h, onChange as oe, proto as g, protoMerged as _, qt as se, soon as ce, state as le, u as v, untracked as y, whileConnected as ue } from "./core.js";
|
|
3
3
|
import "./ui-parts.js";
|
|
4
4
|
import "./ui-button.js";
|
|
5
|
-
import { Show as
|
|
6
|
-
import { addEvent as
|
|
5
|
+
import { Show as de } from "solid-js";
|
|
6
|
+
import { addEvent as b, className as x, createComponent as S, delegateEvents as fe, effect as C, getOwner as pe, insert as w, isServer as me, readShallow as T, ref as he, setAttribute as E, template as D } from "@solidjs/web";
|
|
7
7
|
// src/components/ui-modal/DialogComponent.tsx
|
|
8
|
-
var
|
|
8
|
+
var O = /* @__PURE__ */ D("<div>"), ge = /* @__PURE__ */ D("<dialog><!><slot></slot><!>"), k, A, j, M, N, P, F, I, L, R, z, B, V = class _DialogComponent extends (R = l, L = [_], I = [y], F = [ue], P = [h("command")], N = [y], M = [y], j = [le], A = [h("slotchange", { target: "renderRoot" })], k = [oe("isReady", "ariaLabel", "heading", "slottedHeading")], R) {
|
|
9
9
|
constructor(...t) {
|
|
10
|
-
super(...t), p(
|
|
10
|
+
super(...t), p(z, 5, this), a(this, "dialog"), a(this, "overlayEntry", {
|
|
11
11
|
element: this.domElement,
|
|
12
12
|
kind: "modal",
|
|
13
13
|
onDismiss: /* @__PURE__ */ o((e) => void this.requestClose(e), "onDismiss")
|
|
@@ -34,9 +34,9 @@ var k = /* @__PURE__ */ O("<div>"), me = /* @__PURE__ */ O("<dialog><!><slot></s
|
|
|
34
34
|
if (this.pressStartedOnBackdrop = !1, this.isDismissing) return;
|
|
35
35
|
let n = this.closedBy;
|
|
36
36
|
n === "none" || t === "outside" && n !== "any" || this.requestClose(t, e);
|
|
37
|
-
}, "onCancel")), a(this, "onClose", p(
|
|
37
|
+
}, "onCancel")), a(this, "onClose", p(z, 16, this, /* @__PURE__ */ o((e) => {
|
|
38
38
|
!this.dialog?.open && this.domElement.isConnected && (this.closeReason = "escape", this.disclosure.adopt(!1, e));
|
|
39
|
-
}, "onClose"))), p(
|
|
39
|
+
}, "onClose"))), p(z, 19, this), a(this, "closeButton", new e({
|
|
40
40
|
owner: this,
|
|
41
41
|
shows: /* @__PURE__ */ o(() => !!this.closable, "shows"),
|
|
42
42
|
label: /* @__PURE__ */ o(() => this.closeText, "label"),
|
|
@@ -52,7 +52,7 @@ var k = /* @__PURE__ */ O("<div>"), me = /* @__PURE__ */ O("<dialog><!><slot></s
|
|
|
52
52
|
originalEvent: e
|
|
53
53
|
};
|
|
54
54
|
this.fire(n === "approve" ? "ui-approving" : "ui-denying", i) && this.requestClose(n, e);
|
|
55
|
-
}, "onDialogClick")),
|
|
55
|
+
}, "onDialogClick")), se(this, B, p(z, 8, this, this.findHeading())), p(z, 11, this), a(this, "headerId", ""), this.overlayEntry.kind = this.overlayKind;
|
|
56
56
|
}
|
|
57
57
|
get isModeless() {
|
|
58
58
|
return !1;
|
|
@@ -64,7 +64,7 @@ var k = /* @__PURE__ */ O("<div>"), me = /* @__PURE__ */ O("<dialog><!><slot></s
|
|
|
64
64
|
return this.disclosure.open(e);
|
|
65
65
|
}
|
|
66
66
|
requestClose(e, t) {
|
|
67
|
-
return this.isVisible ? (this.isDismissing = !0,
|
|
67
|
+
return this.isVisible ? (this.isDismissing = !0, ce(() => this.isDismissing = !1), this.closeReason = e, this.disclosure.close(t)) : !1;
|
|
68
68
|
}
|
|
69
69
|
async onVisibleChange(e, t) {
|
|
70
70
|
let n = this.dialog;
|
|
@@ -110,7 +110,7 @@ var k = /* @__PURE__ */ O("<div>"), me = /* @__PURE__ */ O("<dialog><!><slot></s
|
|
|
110
110
|
t === "show" ? this.requestOpen(e) : t === "close" && this.requestClose("close", e);
|
|
111
111
|
}
|
|
112
112
|
get closedBy() {
|
|
113
|
-
return this.domElement.hasAttribute("closedby") ? this.closedby ?? "any" : this.domElement.hasAttribute(
|
|
113
|
+
return this.domElement.hasAttribute("closedby") ? this.closedby ?? "any" : this.domElement.hasAttribute(_e) && !this.closable ? "none" : "any";
|
|
114
114
|
}
|
|
115
115
|
get closeText() {
|
|
116
116
|
return this.translationForKey(v);
|
|
@@ -139,40 +139,40 @@ var k = /* @__PURE__ */ O("<div>"), me = /* @__PURE__ */ O("<dialog><!><slot></s
|
|
|
139
139
|
render() {
|
|
140
140
|
this.headerId = c.ids.next(`ui-${this.elementDefinition.vocabulary.noun}`);
|
|
141
141
|
let e = this;
|
|
142
|
-
var n =
|
|
143
|
-
return
|
|
142
|
+
var n = ge(), r = n.firstChild, i = r.nextSibling, a = i.nextSibling;
|
|
143
|
+
return b(n, "click", e.onDialogClick, !0), b(n, "pointerdown", e.onPointerDown, !0), b(n, "close", e.onClose), b(n, "cancel", e.onCancel), he(() => (t) => e.dialog = t, n), w(n, S(de, {
|
|
144
144
|
get when() {
|
|
145
145
|
return e.heading;
|
|
146
146
|
},
|
|
147
147
|
get children() {
|
|
148
|
-
var n =
|
|
149
|
-
return
|
|
148
|
+
var n = O();
|
|
149
|
+
return w(n, () => e.heading), C(() => ({
|
|
150
150
|
e: e.headerId,
|
|
151
|
-
t:
|
|
151
|
+
t: T(t),
|
|
152
152
|
a: e.dialogPart(t)
|
|
153
153
|
}), ({ e, t, a: r }, i) => {
|
|
154
|
-
e !== i?.e &&
|
|
154
|
+
e !== i?.e && E(n, "id", e), x(n, t, i?.t), r !== i?.a && E(n, "part", r);
|
|
155
155
|
}), n;
|
|
156
156
|
}
|
|
157
|
-
}), r),
|
|
157
|
+
}), r), w(n, S(de, {
|
|
158
158
|
get when() {
|
|
159
159
|
return e.content;
|
|
160
160
|
},
|
|
161
161
|
get children() {
|
|
162
|
-
var t =
|
|
163
|
-
return
|
|
164
|
-
e:
|
|
162
|
+
var t = O();
|
|
163
|
+
return w(t, () => e.content), C(() => ({
|
|
164
|
+
e: T(m),
|
|
165
165
|
t: e.dialogPart(m)
|
|
166
166
|
}), ({ e, t: n }, r) => {
|
|
167
|
-
|
|
167
|
+
x(t, e, r?.e), n !== r?.t && E(t, "part", n);
|
|
168
168
|
}), t;
|
|
169
169
|
}
|
|
170
|
-
}), i), i._$owner =
|
|
171
|
-
e:
|
|
170
|
+
}), i), i._$owner = pe(), w(n, () => e.closeButton.draw(), a), C(() => ({
|
|
171
|
+
e: T(e.rootClass),
|
|
172
172
|
t: e.dialogPart(e.rootPart),
|
|
173
|
-
a:
|
|
173
|
+
a: me ? e.serverLabelledBy() : void 0
|
|
174
174
|
}), ({ e, t, a: r }, i) => {
|
|
175
|
-
|
|
175
|
+
x(n, e, i?.e), t !== i?.t && E(n, "part", t), r !== i?.a && E(n, "aria-labelledby", r);
|
|
176
176
|
}), n;
|
|
177
177
|
}
|
|
178
178
|
dialogPart(e) {
|
|
@@ -185,11 +185,11 @@ var k = /* @__PURE__ */ O("<div>"), me = /* @__PURE__ */ O("<dialog><!><slot></s
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
|
-
|
|
189
|
-
var
|
|
190
|
-
|
|
188
|
+
z = i(R), B = /* @__PURE__ */ new WeakMap(), u(z, 1, "requestClose", I, V), u(z, 1, "watchPlacement", F, V), u(z, 1, "onCommand", P, V), u(z, 2, "closedBy", N, V), u(z, 4, "slottedHeading", j, V, B), u(z, 1, "onSlotChange", A, V), u(z, 1, "onNameChanged", k, V), u(z, 13, "elementSetup", L, V), u(z, 5, "onClose", M, V), f(z, V), o(V, "DialogComponent"), a(V, "elementSetup", p(z, 12, V, { visible: "hidden" })), p(z, 15, V);
|
|
189
|
+
var H = V, _e = "closable";
|
|
190
|
+
fe(["pointerdown", "click"]);
|
|
191
191
|
// src/components/ui-modal/UIModal.en.ts
|
|
192
|
-
var
|
|
192
|
+
var U = {
|
|
193
193
|
tag: "ui-modal",
|
|
194
194
|
icon: "window restore outline",
|
|
195
195
|
topics: [
|
|
@@ -233,6 +233,12 @@ var W = {
|
|
|
233
233
|
kind: "keyOnly",
|
|
234
234
|
description: "The dark scheme."
|
|
235
235
|
},
|
|
236
|
+
{
|
|
237
|
+
name: "transparent",
|
|
238
|
+
group: "appearance",
|
|
239
|
+
kind: "keyOnly",
|
|
240
|
+
description: "See-through: no box, no shadow, no padding, drawn as written. Its text keeps its colour (`appearance=\"basic\"` turns it light). In Spell, a modal naming none of its parts is laid out for you, unless it says `transparent`."
|
|
241
|
+
},
|
|
236
242
|
{
|
|
237
243
|
name: "fullscreen",
|
|
238
244
|
group: "appearance",
|
|
@@ -373,12 +379,12 @@ var W = {
|
|
|
373
379
|
"description",
|
|
374
380
|
"actions"
|
|
375
381
|
]
|
|
376
|
-
},
|
|
377
|
-
|
|
378
|
-
styleSheets: { modal:
|
|
382
|
+
}, ve = "@layer ui.components.modal.types{:host{display:contents}.ui.modal{--_ui-modal-background:var(--ui-modal-background,var(--ui-surface));--_ui-modal-color:var(--ui-modal-color,var(--ui-text-color));--_ui-modal-radius:var(--ui-modal-radius,var(--ui-radius));--_ui-modal-shadow:var(--ui-modal-shadow,1px 3px 3px 0 oklch(0% 0 0/.2), 1px 3px 15px 2px oklch(0% 0 0/.2));--_ui-modal-dimmer-background:var(--ui-modal-dimmer-background,var(--ui-dimmer-background,oklch(0% 0 0/.85)));--_ui-modal-duration:var(--ui-modal-duration,var(--ui-duration-slow));--_ui-modal-close-size:var(--ui-modal-close-size,1.25em);--_ui-modal-close-hitbox:var(--ui-modal-close-hitbox,2.25em);--_ui-modal-close-opacity:var(--ui-modal-close-opacity,.8);--_ui-modal-inner-close-top:var(--ui-modal-inner-close-top,1.0625em);--_ui-modal-inner-close-right:var(--ui-modal-inner-close-right,1em);--_ui-modal-width:var(--ui-modal-width,var(--_modal-width));--_ui-modal-aligned-margin:var(--ui-modal-aligned-margin,var(--_modal-aligned-margin));--_modal-ratio:1;--_modal-width:95%;--_modal-aligned-margin:5vh;--_ui-modal-basic:0;--_ui-modal-header-size:var(--ui-modal-header-size,1.42857em);--_ui-modal-header-color:var(--ui-modal-header-color,var(--ui-text-dark));--_ui-modal-header-background:var(--ui-modal-header-background,var(--ui-surface));--_ui-modal-content-background:var(--ui-modal-content-background,var(--ui-surface));--_ui-modal-actions-background:var(--ui-modal-actions-background,var(--ui-surface-muted));--ui-inverted:0;z-index:var(--ui-z-modal);box-sizing:border-box;width:var(--_ui-modal-width);border-radius:var(--_ui-modal-radius);background:var(--_ui-modal-background);max-width:100%;box-shadow:var(--_ui-modal-shadow);color:var(--_ui-modal-color);font-family:var(--ui-font-family);font-size:var(--ui-font-size);line-height:var(--ui-line-height);text-align:start;transform-origin:50% 25%;-webkit-user-select:text;user-select:text;border:none;outline:none;flex:none;margin:0;padding:0;display:none;position:absolute}dialog.ui.modal{overscroll-behavior:contain;opacity:1;max-height:calc(100dvh - 2em);transition:opacity var(--_ui-modal-duration) var(--ui-ease), transform var(--_ui-modal-duration) var(--ui-ease), display var(--_ui-modal-duration) allow-discrete, overlay var(--_ui-modal-duration) allow-discrete;margin:auto;position:fixed;inset:0;overflow:auto;transform:none}dialog.ui.modal[open]{display:block}dialog.ui.modal:not([open]){opacity:0;transform:scale(.8)}@starting-style{dialog.ui.modal[open]{opacity:0;transform:scale(.8)}}dialog.ui.modal::backdrop{background:var(--_ui-modal-dimmer-background);backdrop-filter:var(--ui-modal-dimmer-filter,none);opacity:1;transition:opacity var(--_ui-modal-duration) var(--ui-ease), display var(--_ui-modal-duration) allow-discrete, overlay var(--_ui-modal-duration) allow-discrete}dialog.ui.modal:not([open])::backdrop{opacity:0}@starting-style{dialog.ui.modal[open]::backdrop{opacity:0}}@media (prefers-reduced-motion:reduce){dialog.ui.modal::backdrop{transition-duration:.01ms}}.ui.modal slot{--ui-color:initial;--ui-color-text:initial;--ui-color-header:initial;--ui-color-border:initial;--ui-color-background:initial;--ui-color-inverted:initial;--ui-color-on:initial;--ui-color-inverted-on:initial;--ui-scale:initial}.ui.modal>:first-child:not(.close),.ui.modal>.close:first-child+*{border-start-start-radius:var(--_ui-modal-radius);border-start-end-radius:var(--_ui-modal-radius)}.ui.modal>:last-child{border-end-end-radius:var(--_ui-modal-radius);border-end-start-radius:var(--_ui-modal-radius)}.ui.modal>.header~slot::slotted(:first-child){--_ui-modal-radius:0px}}@layer ui.components.modal.content{.ui.modal>.close{top:calc(-.25em - var(--_ui-modal-close-hitbox));right:calc(-.25em - var(--_ui-modal-close-hitbox));z-index:1;box-sizing:border-box;width:var(--_ui-modal-close-hitbox);height:var(--_ui-modal-close-hitbox);border-radius:var(--ui-radius);color:var(--ui-text-inverted-color);font-size:var(--_ui-modal-close-size);opacity:var(--_ui-modal-close-opacity);cursor:var(--ui-control-cursor);background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:0;display:inline-flex;position:absolute}.ui.modal>.close>svg{width:1em;height:1em}.ui.modal>.close:is(:hover,:focus-visible){opacity:1}.ui.modal>.close:focus-visible{outline:var(--ui-focus-width) solid var(--ui-focus-color);outline-offset:calc(var(--ui-focus-width) * -1)}dialog.ui.modal>.close,.ui.modal>.close.inside,.ui.fullscreen.modal>.close{top:var(--_ui-modal-inner-close-top);right:var(--_ui-modal-inner-close-right);color:var(--_ui-modal-color);font-size:1em}@media (width<768px),(768px<=width<992px){.ui.modal>.close{top:var(--_ui-modal-inner-close-top);right:var(--_ui-modal-inner-close-right);color:var(--_ui-modal-color);font-size:1em}}.ui.modal:has(>.close)>.header{padding-inline-end:calc(var(--_ui-modal-close-hitbox) * 1.2)}.ui.modal>.header{border-bottom:var(--ui-border-width) solid var(--ui-border-color);background:var(--_ui-modal-header-background);box-shadow:none;color:var(--_ui-modal-header-color);font-family:var(--ui-font-family-heading);margin:0;padding:.875em 1.05em;display:block}.ui.modal>.header:not(.ui){font-size:var(--_ui-modal-header-size);font-weight:var(--ui-font-weight-bold);line-height:var(--ui-line-height-heading)}.ui.modal>.content{box-sizing:border-box;width:100%;padding:var(--ui-modal-content-padding,1.5em);background:var(--_ui-modal-content-background);font-size:1em;line-height:1.4;display:block}.ui.modal>.image.content{flex-direction:row;display:flex}.ui.modal>.content>.image{flex:0 auto;align-self:start;max-width:100%;display:block}.ui.modal>.content>.description{flex:1 0 auto;align-self:start;min-width:0;display:block}.ui.modal>.content>:is(.icon,.image)+.description{width:auto;min-width:auto;flex:auto;padding-inline-start:var(--ui-modal-description-distance,2em)}.ui.modal>.scrolling.content{max-height:var(--ui-modal-scrolling-height,calc(80dvh - 10em));overscroll-behavior:none;overflow:auto}.ui.modal>.actions{padding:var(--ui-modal-actions-padding,1em);border-top:var(--ui-border-width) solid var(--ui-border-color);background:var(--_ui-modal-actions-background);text-align:right}.ui.modal .actions>.button:not(.fluid){margin-inline-start:var(--ui-modal-button-distance,.75em)}.ui.modal>.left.actions{text-align:left}.ui.modal>.left.actions>.button:not(.fluid){margin-inline:.5em}.ui.modal>:is(.centered,[class*=center\\ aligned]){text-align:center}.ui.modal>:is(.centered,[class*=center\\ aligned]).actions>.button:not(.fluid){margin-inline:.5em}@media (width<768px){.ui.modal>.header{padding:.525em .7em}.ui.modal>.content{padding:1em;display:block}.ui.modal .image.content{flex-direction:column}.ui.modal>.content>.image{text-align:center;max-width:100%;margin:0 auto;padding:0 0 1em;display:block}.ui.modal>.content>.description,.ui.modal>.content>:is(.icon,.image)+.description{width:100%;margin:0;padding:1em 0;display:block}.ui.modal>.actions{padding:1em 1em 0}.ui.modal .actions>:is(.buttons,.button){margin-bottom:1em}}}@layer ui.components.modal.variations{.ui.mini.modal{--_modal-ratio:.4;--_ui-modal-header-size:1.3em}.ui.tiny.modal{--_modal-ratio:.6;--_ui-modal-header-size:1.3em}.ui.small.modal{--_modal-ratio:.8;--_ui-modal-header-size:1.3em}.ui.large.modal{--_modal-ratio:1.2;--_ui-modal-header-size:1.6em}.ui.big.modal{--_modal-ratio:1.4;--_ui-modal-header-size:1.6em}.ui.huge.modal{--_modal-ratio:1.6;--_ui-modal-header-size:1.6em}.ui.massive.modal{--_modal-ratio:1.8;--_ui-modal-header-size:1.8em}@media (768px<=width<992px){.ui.modal{--_modal-width:calc(88% * min(var(--_modal-ratio), 1))}}@media (width>=992px){.ui.modal{--_modal-width:calc(850px * var(--_modal-ratio))}}@media (width>=1200px){.ui.modal{--_modal-width:calc(900px * var(--_modal-ratio))}}@media (width>=1920px){.ui.modal{--_modal-width:calc(950px * var(--_modal-ratio))}}.ui.fullscreen.modal{--_ui-modal-width:95%}dialog.ui.fullscreen.modal{margin-block:1em}.ui.overlay.fullscreen.modal{--_ui-modal-width:100%;border-radius:0}dialog.ui.overlay.fullscreen.modal{height:100dvh;max-height:100dvh;margin:0}dialog.ui[class*=top\\ aligned].modal{margin-block:var(--_ui-modal-aligned-margin) auto}dialog.ui[class*=bottom\\ aligned].modal{margin-block:auto var(--_ui-modal-aligned-margin)}@media (width<768px){.ui.modal{--_modal-aligned-margin:1em}}dialog.ui.scrolling.modal{max-height:calc(100dvh - 4em)}.ui.basic.modal{--_ui-modal-basic:1;--_ui-modal-background:transparent;--_ui-modal-color:var(--ui-text-inverted-color);--_ui-modal-header-color:var(--ui-text-inverted-color);--_ui-modal-header-background:transparent;--_ui-modal-content-background:transparent;--_ui-modal-actions-background:transparent;box-shadow:none;border-radius:0}.ui.basic.modal>.header{border-bottom:none}.ui.basic.modal>.actions{border-top:none}.ui.basic.modal>.close{color:var(--ui-text-inverted-color);top:1em;right:1.5em}.ui.transparent.modal{--_ui-modal-background:transparent;--_ui-modal-header-background:transparent;--_ui-modal-content-background:transparent;--_ui-modal-actions-background:transparent;box-shadow:none;border-radius:0;padding:0}.ui.inverted.modal{--ui-inverted:1;--ui-scheme:dark;color-scheme:dark}}@layer ui.components.modal.states{.ui.active.modal{display:block}}", W, G, K, q, J, Y, X, Z = class _UIModal extends (Y = H, J = [g], q = [_], K = [g], G = [g], W = [g], Y) {};
|
|
383
|
+
X = i(Y), u(X, 13, "vocabulary", J, Z), u(X, 13, "elementSetup", q, Z), u(X, 13, "rootPart", K, Z), u(X, 13, "overlayKind", G, Z), u(X, 13, "shownClass", W, Z), f(X, Z), o(Z, "UIModal"), a(Z, "vocabulary", p(X, 8, Z, U)), p(X, 11, Z), a(Z, "elementSetup", p(X, 12, Z, {
|
|
384
|
+
styleSheets: { modal: ve },
|
|
379
385
|
animation: "scale"
|
|
380
|
-
})), p(
|
|
381
|
-
var
|
|
386
|
+
})), p(X, 15, Z), a(Z, "rootPart", p(X, 16, Z, "modal")), p(X, 19, Z), a(Z, "overlayKind", p(X, 20, Z, "modal")), p(X, 23, Z), a(Z, "shownClass", p(X, 24, Z, "active")), p(X, 27, Z);
|
|
387
|
+
var Q = Z, ye = class ModalDialogs {
|
|
382
388
|
document;
|
|
383
389
|
constructor({ document: e = globalThis.document } = {}) {
|
|
384
390
|
this.document = e;
|
|
@@ -396,13 +402,13 @@ var _e = Q, ve = class ModalDialogs {
|
|
|
396
402
|
}, (e, t) => e ? t : void 0);
|
|
397
403
|
}
|
|
398
404
|
run(e, t, n) {
|
|
399
|
-
return
|
|
405
|
+
return e.markdown && ie(e.message) ? this.markdown(e).then((r) => this.open(e, t, n, r)) : this.open(e, t, n);
|
|
400
406
|
}
|
|
401
407
|
open(e, { canDeny: t, input: n }, i, a) {
|
|
402
|
-
let o = this.document.createElement(
|
|
403
|
-
o.setAttribute(
|
|
408
|
+
let o = this.document.createElement(U.tag);
|
|
409
|
+
o.setAttribute(Se, we), o.setAttribute("closedby", "closerequest"), e.closable !== !1 && o.setAttribute(Ce, ""), e.title ? o.setAttribute(ee, e.title) : o.setAttribute("aria-label", e.message);
|
|
404
410
|
let s = this.document.createElement(ModalDialogs.tagFor(m)), l = n === void 0 ? void 0 : this.input(n);
|
|
405
|
-
s.append(l ? this.label(e.message, l) : a ?? this.paragraph(e));
|
|
411
|
+
s.append(l ? this.label(e.message, l, a) : a ?? this.paragraph(e));
|
|
406
412
|
let u = this.document.createElement(ModalDialogs.tagFor(Ne));
|
|
407
413
|
t && u.append(this.button(e.cancelText ?? c.i18n.t(Le), Le));
|
|
408
414
|
let d = this.button(e.okText ?? c.i18n.t(Re), Ie);
|
|
@@ -412,31 +418,28 @@ var _e = Q, ve = class ModalDialogs {
|
|
|
412
418
|
let f = a && ModalDialogs.drawn(a);
|
|
413
419
|
return this.document.body.append(o), f ? f.then(() => o.visible = !0) : o.visible = !0, new Promise((e) => {
|
|
414
420
|
let t = !1;
|
|
415
|
-
o.addEventListener(
|
|
421
|
+
o.addEventListener(be, () => t = !0), o.addEventListener(xe, () => {
|
|
416
422
|
o.remove(), e(i(t, l?.value ?? ""));
|
|
417
423
|
}, { once: !0 });
|
|
418
424
|
});
|
|
419
425
|
}
|
|
420
426
|
paragraph({ message: e, size: t }) {
|
|
421
427
|
let n = this.document.createElement("p");
|
|
422
|
-
if (n.style.whiteSpace = $, t && t !==
|
|
428
|
+
if (n.style.whiteSpace = $, t && t !== Te) {
|
|
423
429
|
let r = this.document.createElement("span");
|
|
424
|
-
r.className =
|
|
430
|
+
r.className = Ee + t, r.textContent = e, n.append(r);
|
|
425
431
|
} else n.textContent = e;
|
|
426
432
|
return n;
|
|
427
433
|
}
|
|
428
434
|
async markdown({ message: e, size: t }) {
|
|
429
435
|
await import("./ui-markdown.js");
|
|
430
|
-
let n = this.document.createElement(ModalDialogs.tagFor(
|
|
431
|
-
return n.toggleAttribute(
|
|
432
|
-
}
|
|
433
|
-
static hasMarkdown(e) {
|
|
434
|
-
return Me.some((t) => t.test(e));
|
|
436
|
+
let n = this.document.createElement(ModalDialogs.tagFor(De));
|
|
437
|
+
return n.toggleAttribute(Oe, !0), n.toggleAttribute(ke, !0), t && t !== Te && n.setAttribute(Se, t), n.style.marginBlock = Ae, n.textContent = e, n;
|
|
435
438
|
}
|
|
436
439
|
static drawn(e) {
|
|
437
440
|
return new Promise((t) => {
|
|
438
|
-
let n = ne(
|
|
439
|
-
e.addEventListener(
|
|
441
|
+
let n = ne(Me, t);
|
|
442
|
+
e.addEventListener(je, () => {
|
|
440
443
|
n.cancel(), t();
|
|
441
444
|
}, { once: !0 });
|
|
442
445
|
});
|
|
@@ -445,11 +448,11 @@ var _e = Q, ve = class ModalDialogs {
|
|
|
445
448
|
let t = this.document.createElement("input");
|
|
446
449
|
return t.type = "text", t.value = e, t.autofocus = !0, t;
|
|
447
450
|
}
|
|
448
|
-
label(e, t) {
|
|
449
|
-
let
|
|
450
|
-
|
|
451
|
-
let
|
|
452
|
-
return
|
|
451
|
+
label(e, t, n) {
|
|
452
|
+
let r = this.document.createElement("label");
|
|
453
|
+
r.className = ze, r.style.cssText = Be;
|
|
454
|
+
let i = n;
|
|
455
|
+
return i || (i = this.document.createElement("span"), i.style.whiteSpace = $, i.textContent = e), r.append(i, t), r;
|
|
453
456
|
}
|
|
454
457
|
button(e, t) {
|
|
455
458
|
let n = this.document.createElement(ModalDialogs.tagFor(re));
|
|
@@ -459,18 +462,8 @@ var _e = Q, ve = class ModalDialogs {
|
|
|
459
462
|
for (let t of c.vocabulary.vocabularies.values()) if (t.noun === e) return t.tag;
|
|
460
463
|
throw Error(`UI.modals: no component with the class noun "${e}" is registered; import its family (\`spell/ui/components/ui-parts\`, \`ui-button\`) before opening a dialog`);
|
|
461
464
|
}
|
|
462
|
-
},
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
/^>\s?/m,
|
|
466
|
-
/^```/m,
|
|
467
|
-
/(\*\*|__)\S(?:.*?\S)?\1/,
|
|
468
|
-
/(?<![\w*])\*[^\s*](?:[^*]*[^\s*])?\*(?![\w*])/,
|
|
469
|
-
/(?<!\w)_[^\s_](?:[^_]*[^\s_])?_(?!\w)/,
|
|
470
|
-
/`[^`\n]+`/,
|
|
471
|
-
/\[[^\]\n]+\]\([^)\s]+\)/
|
|
472
|
-
], Ne = "actions", Pe = "primary", Fe = "color", Ie = "approve", Le = "cancel", Re = "ok", ze = "ui-native", $ = "pre-line", Be = "display: grid; gap: 0.5em";
|
|
473
|
-
_e.define(), ie() && c.load().then(() => c.modals.register(new ve()));
|
|
474
|
-
export { U as DialogComponent, ve as ModalDialogs, _e as UIModal };
|
|
465
|
+
}, be = "ui-approving", xe = "ui-closed", Se = "size", Ce = "closable", we = "tiny", Te = "medium", Ee = "ui-font-size-", De = "markdown", Oe = "sanitized", ke = "breaks", Ae = "1em", je = "ui-drawn", Me = 1, Ne = "actions", Pe = "primary", Fe = "color", Ie = "approve", Le = "cancel", Re = "ok", ze = "ui-native", $ = "pre-line", Be = "display: grid; gap: 0.5em";
|
|
466
|
+
Q.define(), ae() && c.load().then(() => c.modals.register(new ye()));
|
|
467
|
+
export { H as DialogComponent, ye as ModalDialogs, Q as UIModal };
|
|
475
468
|
|
|
476
469
|
//# sourceMappingURL=ui-modal.js.map
|