@muibook/components 19.5.1 → 20.0.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/README.md +1 -1
- package/dist/esm/agent/keywords/index.js +41 -2
- package/dist/esm/agent/prompts/index.js +14 -11
- package/dist/esm/components/mui-addon/index.js +14 -14
- package/dist/esm/components/mui-avatar/index.js +4 -1
- package/dist/esm/components/mui-badge/index.js +35 -18
- package/dist/esm/components/mui-body/index.js +57 -14
- package/dist/esm/components/mui-button/index.js +187 -52
- package/dist/esm/components/mui-card/body/index.js +1 -1
- package/dist/esm/components/mui-chip/index.js +56 -26
- package/dist/esm/components/mui-chip-rail/index.js +239 -0
- package/dist/esm/components/mui-code/index.js +5 -5
- package/dist/esm/components/mui-dropdown/index.js +55 -46
- package/dist/esm/components/mui-file-upload/index.js +1 -0
- package/dist/esm/components/mui-form-message/index.js +21 -13
- package/dist/esm/components/mui-heading/index.js +47 -10
- package/dist/esm/components/mui-hint/index.js +2 -2
- package/dist/esm/components/mui-input/index.js +21 -17
- package/dist/esm/components/mui-link/index.js +199 -55
- package/dist/esm/components/mui-message/index.js +7 -6
- package/dist/esm/components/mui-prompt/index.js +102 -102
- package/dist/esm/components/mui-rule/index.js +8 -1
- package/dist/esm/components/mui-select/index.js +4 -4
- package/dist/esm/components/mui-slat/slat/index.js +9 -1
- package/dist/esm/components/mui-stack/hstack/index.js +10 -5
- package/dist/esm/components/mui-status/index.js +239 -0
- package/dist/esm/components/mui-stepper/step/index.js +46 -32
- package/dist/esm/components/mui-switch/index.js +21 -13
- package/dist/esm/components/mui-tabs/controller/index.js +17 -6
- package/dist/esm/components/mui-tabs/item/index.js +17 -5
- package/dist/esm/components/mui-tabs/tab-bar/index.js +93 -39
- package/dist/esm/components/mui-video-thumbnail/index.js +205 -0
- package/dist/esm/css/mui-brand.css +3 -1
- package/dist/esm/css/mui-tokens.css +270 -78
- package/dist/esm/custom-elements.json +2608 -1900
- package/dist/esm/dynamic-attrs.json +26 -6
- package/dist/esm/index.js +7 -4
- package/dist/esm/tokens/js/index.js +119 -118
- package/dist/types/components/mui-body/api.d.ts +9 -2
- package/dist/types/components/mui-button/api.d.ts +4 -0
- package/dist/types/components/mui-chip/api.d.ts +4 -0
- package/dist/types/components/mui-chip-rail/api.d.ts +21 -0
- package/dist/types/components/mui-chip-rail/doc.d.ts +2 -0
- package/dist/types/components/mui-chip-rail/index.d.ts +3 -0
- package/dist/types/components/mui-link/api.d.ts +4 -0
- package/dist/types/components/mui-status/api.d.ts +24 -0
- package/dist/types/components/mui-status/doc.d.ts +2 -0
- package/dist/types/components/mui-status/index.d.ts +1 -0
- package/dist/types/components/mui-video-thumbnail/api.d.ts +28 -0
- package/dist/types/components/mui-video-thumbnail/doc.d.ts +2 -0
- package/dist/types/components/mui-video-thumbnail/index.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/tokens/js/index.d.ts +1 -0
- package/package.json +13 -1
|
@@ -20,8 +20,8 @@ class S extends HTMLElement {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
super(), this.triggerEl = null, this.previewShellEl = null, this.previewRowEl = null, this.previewSlotEl = null, this.previewResizeObserver = null, this.fanAnimations = /* @__PURE__ */ new Map(), this.pendingColorFade = !1, this.lastDebugPayload = '{"event":"idle"}', this.lightDomObserver = null, this.onActionsSlotChange = () => this.updateActionsLayout(), this.enforceActionVariants = () => {
|
|
22
22
|
if (!this.shadowRoot) return;
|
|
23
|
-
const e = Array.from(this.shadowRoot.querySelectorAll('slot[name="actions"], slot[name="actions-right"]')), o = (r,
|
|
24
|
-
if (!
|
|
23
|
+
const e = Array.from(this.shadowRoot.querySelectorAll('slot[name="actions"], slot[name="actions-right"]')), o = (r, s) => {
|
|
24
|
+
if (!s || r.tagName.toLowerCase() !== "mui-button") return;
|
|
25
25
|
if (r.hasAttribute("icon-only")) {
|
|
26
26
|
r.style.marginRight = "var(--space-025)";
|
|
27
27
|
return;
|
|
@@ -29,16 +29,16 @@ class S extends HTMLElement {
|
|
|
29
29
|
r.style.marginRight === "var(--space-025)" && (r.style.marginRight = "");
|
|
30
30
|
};
|
|
31
31
|
e.forEach((r) => {
|
|
32
|
-
const
|
|
32
|
+
const s = r.name === "actions";
|
|
33
33
|
r.assignedElements({ flatten: !0 }).forEach((a) => {
|
|
34
34
|
[a, ...Array.from(a.querySelectorAll("*"))].forEach((m) => {
|
|
35
35
|
const p = m.tagName.toLowerCase();
|
|
36
36
|
if (p === "mui-button") {
|
|
37
|
-
m.setAttribute("variant", "tertiary"), o(m,
|
|
37
|
+
m.setAttribute("variant", "tertiary"), o(m, s);
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
p === "mui-dropdown" && m.querySelectorAll('[slot="action"]').forEach((d) => {
|
|
41
|
-
d instanceof HTMLElement && d.tagName.toLowerCase() === "mui-button" && (d.setAttribute("variant", "tertiary"), o(d,
|
|
41
|
+
d instanceof HTMLElement && d.tagName.toLowerCase() === "mui-button" && (d.setAttribute("variant", "tertiary"), o(d, s));
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
});
|
|
@@ -48,35 +48,35 @@ class S extends HTMLElement {
|
|
|
48
48
|
}, this.onPaste = (t) => {
|
|
49
49
|
const e = t, o = e.clipboardData;
|
|
50
50
|
if (!o) return;
|
|
51
|
-
const r = Array.from(o.files || []),
|
|
52
|
-
if (!
|
|
53
|
-
(
|
|
54
|
-
const
|
|
55
|
-
kind:
|
|
56
|
-
mimeType:
|
|
57
|
-
file:
|
|
58
|
-
fileName:
|
|
59
|
-
size:
|
|
60
|
-
badge:
|
|
61
|
-
preview:
|
|
62
|
-
value:
|
|
51
|
+
const r = Array.from(o.files || []), s = o.getData("text/plain") || "", i = s.trim(), a = i.length > 0, l = a ? this.detectMediaUrl(i) : null, m = this.getAttribute("preview-overflow-to-preview") !== "false", p = this.getAttribute("preview-threshold-chars"), c = Number.isFinite(Number.parseInt(p || "", 10)) ? Math.max(1, Number.parseInt(p || "", 10)) : 220, d = a ? this.detectBadge(i) : "", h = d !== "" && d !== "Insightful", b = m && a && (!!(l != null && l.url) || i.length >= c || h), v = r.length > 0;
|
|
52
|
+
if (!v && !a) return;
|
|
53
|
+
(v || b) && e.preventDefault();
|
|
54
|
+
const n = r.map((u) => ({
|
|
55
|
+
kind: u.type.startsWith("image/") ? "image" : u.type.startsWith("video/") ? "video" : u.type.startsWith("audio/") ? "audio" : "file",
|
|
56
|
+
mimeType: u.type || "",
|
|
57
|
+
file: u,
|
|
58
|
+
fileName: u.name || "",
|
|
59
|
+
size: u.size || 0,
|
|
60
|
+
badge: u.type.startsWith("image/") ? "IMG" : u.type.startsWith("video/") ? "VIDEO" : u.type.startsWith("audio/") ? "MUSIC" : "FILE",
|
|
61
|
+
preview: u.name || "Pasted file",
|
|
62
|
+
value: u.name || ""
|
|
63
63
|
}));
|
|
64
|
-
b && i && (l != null && l.url ?
|
|
64
|
+
b && i && (l != null && l.url ? n.unshift({
|
|
65
65
|
kind: l.kind === "image" ? "image" : "text",
|
|
66
66
|
mimeType: l.mimeType,
|
|
67
67
|
badge: l.badge,
|
|
68
68
|
preview: l.url,
|
|
69
69
|
value: l.url
|
|
70
|
-
}) :
|
|
70
|
+
}) : n.unshift({
|
|
71
71
|
kind: "text",
|
|
72
72
|
mimeType: "text/plain",
|
|
73
73
|
badge: this.detectBadge(i),
|
|
74
74
|
preview: i.slice(0, 260),
|
|
75
|
-
value:
|
|
75
|
+
value: s
|
|
76
76
|
})), this.emitPromptItems({
|
|
77
77
|
source: "paste",
|
|
78
|
-
items:
|
|
79
|
-
text:
|
|
78
|
+
items: n,
|
|
79
|
+
text: s || "",
|
|
80
80
|
textBadge: (l == null ? void 0 : l.badge) || d,
|
|
81
81
|
overflowed: b,
|
|
82
82
|
thresholdChars: c
|
|
@@ -135,8 +135,8 @@ class S extends HTMLElement {
|
|
|
135
135
|
}, this.onContextChipDismiss = (t) => {
|
|
136
136
|
t.composedPath().find(
|
|
137
137
|
(r) => {
|
|
138
|
-
var
|
|
139
|
-
return r instanceof HTMLElement && (((
|
|
138
|
+
var s, i, a;
|
|
139
|
+
return r instanceof HTMLElement && (((s = r.hasAttribute) == null ? void 0 : s.call(r, "context-active")) || ((i = r.hasAttribute) == null ? void 0 : i.call(r, "context-chip")) || ((a = r.hasAttribute) == null ? void 0 : a.call(r, "context-spinner")));
|
|
140
140
|
}
|
|
141
141
|
) && (this.setContextMode("icon", "dismiss"), this.updateActionsLayout());
|
|
142
142
|
}, this.toggleFanOpen = () => {
|
|
@@ -183,17 +183,17 @@ class S extends HTMLElement {
|
|
|
183
183
|
}
|
|
184
184
|
setDebugState(t, e) {
|
|
185
185
|
if (!this.shadowRoot) return;
|
|
186
|
-
const o = this.shadowRoot.querySelector(".debug-region"), r = this.shadowRoot.querySelector("#promptDebugStatus"),
|
|
187
|
-
if (!o || !r || !
|
|
186
|
+
const o = this.shadowRoot.querySelector(".debug-region"), r = this.shadowRoot.querySelector("#promptDebugStatus"), s = this.shadowRoot.querySelector("#promptDebugPayload");
|
|
187
|
+
if (!o || !r || !s) return;
|
|
188
188
|
const i = this.hasAttribute("debug");
|
|
189
|
-
o.toggleAttribute("hidden", !i), i && (r.textContent = t, e && (this.lastDebugPayload = JSON.stringify(e)),
|
|
189
|
+
o.toggleAttribute("hidden", !i), i && (r.textContent = t, e && (this.lastDebugPayload = JSON.stringify(e)), s.textContent = this.lastDebugPayload);
|
|
190
190
|
}
|
|
191
191
|
emitPromptItems({
|
|
192
192
|
items: t,
|
|
193
193
|
text: e,
|
|
194
194
|
textBadge: o,
|
|
195
195
|
overflowed: r,
|
|
196
|
-
thresholdChars:
|
|
196
|
+
thresholdChars: s,
|
|
197
197
|
source: i
|
|
198
198
|
}) {
|
|
199
199
|
this.dispatchEvent(
|
|
@@ -204,7 +204,7 @@ class S extends HTMLElement {
|
|
|
204
204
|
text: e,
|
|
205
205
|
textBadge: o,
|
|
206
206
|
overflowed: r,
|
|
207
|
-
thresholdChars:
|
|
207
|
+
thresholdChars: s,
|
|
208
208
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
209
209
|
},
|
|
210
210
|
bubbles: !0,
|
|
@@ -286,9 +286,9 @@ class S extends HTMLElement {
|
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
288
|
if (t === "context-mode") {
|
|
289
|
-
const
|
|
290
|
-
if (o !==
|
|
291
|
-
this.setAttribute("context-mode",
|
|
289
|
+
const s = this.normalizeContextMode(o);
|
|
290
|
+
if (o !== s) {
|
|
291
|
+
this.setAttribute("context-mode", s);
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
294
|
this.syncContextModeUI(), this.updateActionsLayout();
|
|
@@ -434,10 +434,10 @@ class S extends HTMLElement {
|
|
|
434
434
|
t == null || t.focus();
|
|
435
435
|
}
|
|
436
436
|
syncTextareaHeight(t) {
|
|
437
|
-
const o = Number.parseInt(this.getAttribute("rows") || String(3), 10) || 3, r = Math.max(o + 6, 10),
|
|
437
|
+
const o = Number.parseInt(this.getAttribute("rows") || String(3), 10) || 3, r = Math.max(o + 6, 10), s = getComputedStyle(t), a = (Number.parseFloat(s.fontSize) || 16) * 1.55, l = Number.parseFloat(s.paddingTop) || 0, m = Number.parseFloat(s.paddingBottom) || 0, p = Number.parseFloat(s.borderTopWidth) || 0, c = Number.parseFloat(s.borderBottomWidth) || 0, d = l + m + p + c, h = 3 * a + d, b = r * a + d;
|
|
438
438
|
t.style.height = "auto";
|
|
439
|
-
const
|
|
440
|
-
t.style.height = `${Math.ceil(
|
|
439
|
+
const v = t.scrollHeight, n = Math.max(h, Math.min(v, b));
|
|
440
|
+
t.style.height = `${Math.ceil(n)}px`, t.style.overflowY = v > b ? "auto" : "hidden";
|
|
441
441
|
}
|
|
442
442
|
detectBadge(t) {
|
|
443
443
|
const e = t.trim();
|
|
@@ -476,7 +476,7 @@ class S extends HTMLElement {
|
|
|
476
476
|
const o = e.match(/https?:\/\/[^\s]+/i), r = ((o == null ? void 0 : o[0]) || e).trim();
|
|
477
477
|
if (!/^https?:\/\//i.test(r)) return null;
|
|
478
478
|
try {
|
|
479
|
-
const
|
|
479
|
+
const s = new URL(r), i = s.pathname.toLowerCase(), a = s.hostname.toLowerCase();
|
|
480
480
|
if (/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/.test(i))
|
|
481
481
|
return { url: r, kind: "image", badge: "IMG", mimeType: "image/*" };
|
|
482
482
|
if (a === "youtu.be" || a.endsWith("youtube.com") || a.endsWith("youtube-nocookie.com"))
|
|
@@ -495,13 +495,13 @@ class S extends HTMLElement {
|
|
|
495
495
|
return null;
|
|
496
496
|
}
|
|
497
497
|
bindEvents() {
|
|
498
|
-
var
|
|
498
|
+
var s;
|
|
499
499
|
if (!this.shadowRoot) return;
|
|
500
500
|
this.unbindEvents();
|
|
501
501
|
const t = this.shadowRoot.querySelector("textarea");
|
|
502
502
|
t == null || t.addEventListener("input", this.onInput), t == null || t.addEventListener("keydown", this.onKeyDown), t == null || t.addEventListener("paste", this.onPaste), t == null || t.addEventListener("focus", this.onTextareaFocus);
|
|
503
503
|
const e = this.shadowRoot.querySelector('slot[name="actions"]'), o = this.shadowRoot.querySelector('slot[name="actions-right"]'), r = this.shadowRoot.querySelector("#promptDefaultSubmitAction");
|
|
504
|
-
e == null || e.addEventListener("slotchange", this.onActionsSlotChange), o == null || o.addEventListener("slotchange", this.onActionsSlotChange), typeof MutationObserver < "u" && ((
|
|
504
|
+
e == null || e.addEventListener("slotchange", this.onActionsSlotChange), o == null || o.addEventListener("slotchange", this.onActionsSlotChange), typeof MutationObserver < "u" && ((s = this.lightDomObserver) == null || s.disconnect(), this.lightDomObserver = new MutationObserver(() => this.updateActionsLayout()), this.lightDomObserver.observe(this, {
|
|
505
505
|
childList: !0,
|
|
506
506
|
subtree: !0,
|
|
507
507
|
attributes: !0,
|
|
@@ -509,10 +509,10 @@ class S extends HTMLElement {
|
|
|
509
509
|
})), r == null || r.addEventListener("click", this.onDefaultSubmitClick), this.addEventListener("prompt-preview-open", this.onPreviewOpen), this.addEventListener("click", this.onContextToggleClick), this.addEventListener("dismiss", this.onContextChipDismiss), this.syncErrorVisibility(), this.bindPreviewOverflow(), this.bindActionTrigger(), this.syncLoadingState();
|
|
510
510
|
}
|
|
511
511
|
unbindEvents() {
|
|
512
|
-
var
|
|
512
|
+
var s, i, a, l;
|
|
513
513
|
if (!this.shadowRoot) return;
|
|
514
514
|
const t = this.shadowRoot.querySelector("textarea"), e = this.shadowRoot.querySelector('slot[name="actions"]'), o = this.shadowRoot.querySelector('slot[name="actions-right"]'), r = this.shadowRoot.querySelector("#promptDefaultSubmitAction");
|
|
515
|
-
t == null || t.removeEventListener("input", this.onInput), t == null || t.removeEventListener("keydown", this.onKeyDown), t == null || t.removeEventListener("paste", this.onPaste), t == null || t.removeEventListener("focus", this.onTextareaFocus), r == null || r.removeEventListener("click", this.onDefaultSubmitClick), e == null || e.removeEventListener("slotchange", this.onActionsSlotChange), o == null || o.removeEventListener("slotchange", this.onActionsSlotChange), this.removeEventListener("prompt-preview-open", this.onPreviewOpen), this.removeEventListener("click", this.onContextToggleClick), this.removeEventListener("dismiss", this.onContextChipDismiss), this.triggerEl && (this.triggerEl.removeEventListener("click", this.toggleFanOpen), this.triggerEl = null), (
|
|
515
|
+
t == null || t.removeEventListener("input", this.onInput), t == null || t.removeEventListener("keydown", this.onKeyDown), t == null || t.removeEventListener("paste", this.onPaste), t == null || t.removeEventListener("focus", this.onTextareaFocus), r == null || r.removeEventListener("click", this.onDefaultSubmitClick), e == null || e.removeEventListener("slotchange", this.onActionsSlotChange), o == null || o.removeEventListener("slotchange", this.onActionsSlotChange), this.removeEventListener("prompt-preview-open", this.onPreviewOpen), this.removeEventListener("click", this.onContextToggleClick), this.removeEventListener("dismiss", this.onContextChipDismiss), this.triggerEl && (this.triggerEl.removeEventListener("click", this.toggleFanOpen), this.triggerEl = null), (s = this.previewRowEl) == null || s.removeEventListener("scroll", this.onPreviewScroll), (i = this.previewSlotEl) == null || i.removeEventListener("slotchange", this.onPreviewSlotChange), (a = this.previewResizeObserver) == null || a.disconnect(), this.previewResizeObserver = null, (l = this.lightDomObserver) == null || l.disconnect(), this.lightDomObserver = null, this.previewShellEl = null, this.previewRowEl = null, this.previewSlotEl = null;
|
|
516
516
|
}
|
|
517
517
|
bindPreviewOverflow() {
|
|
518
518
|
var t, e;
|
|
@@ -539,54 +539,54 @@ class S extends HTMLElement {
|
|
|
539
539
|
});
|
|
540
540
|
return;
|
|
541
541
|
}
|
|
542
|
-
const
|
|
542
|
+
const s = e === "auto" ? this.hasAttribute("loading") : !0;
|
|
543
543
|
r.forEach((a) => {
|
|
544
|
-
a.tagName.toLowerCase() === "mui-prompt-preview" && (
|
|
544
|
+
a.tagName.toLowerCase() === "mui-prompt-preview" && (s ? a.setAttribute("loading", "") : a.removeAttribute("loading"), o && a.setAttribute("loading-label", o));
|
|
545
545
|
});
|
|
546
546
|
}
|
|
547
547
|
normalizePreviewDetail(t) {
|
|
548
|
-
const e = String(t.value || "").trim(), o = String(t.bgImage || "").trim(), r = String(t.badge || "").trim(),
|
|
548
|
+
const e = String(t.value || "").trim(), o = String(t.bgImage || "").trim(), r = String(t.badge || "").trim(), s = String(t.label || "Pasted Content"), i = String(t.imageTint || "").trim(), a = o ? "image" : e ? "code" : "text";
|
|
549
549
|
return {
|
|
550
550
|
id: String(t.id || ""),
|
|
551
551
|
value: e,
|
|
552
552
|
badge: r || (o ? "IMG" : this.detectBadge(e)),
|
|
553
|
-
label:
|
|
553
|
+
label: s,
|
|
554
554
|
bgImage: o,
|
|
555
555
|
imageTint: i,
|
|
556
556
|
type: a
|
|
557
557
|
};
|
|
558
558
|
}
|
|
559
559
|
openInternalPreviewDialog(t) {
|
|
560
|
-
var
|
|
560
|
+
var w;
|
|
561
561
|
if (!this.shadowRoot) return;
|
|
562
|
-
const e = this.shadowRoot.querySelector("#promptAutoPreviewDialog"), o = this.shadowRoot.querySelector("#promptAutoPreviewTitle"), r = this.shadowRoot.querySelector("#promptAutoPreviewCode"),
|
|
563
|
-
if (!
|
|
562
|
+
const e = this.shadowRoot.querySelector("#promptAutoPreviewDialog"), o = this.shadowRoot.querySelector("#promptAutoPreviewTitle"), r = this.shadowRoot.querySelector("#promptAutoPreviewCode"), s = this.shadowRoot.querySelector("#promptAutoPreviewImage"), i = this.shadowRoot.querySelector("#promptAutoPreviewMedia"), a = this.shadowRoot.querySelector("#promptAutoPreviewMediaUrl"), l = this.normalizePreviewDetail(t), m = this.getAttribute("preview-dialog-title") || l.label, p = l.value, c = l.bgImage, d = l.badge, h = p ? this.detectMediaUrl(p) : null, b = !c && p.length > 0 && (d === "VIDEO" || d === "MUSIC"), v = !c && (!!(h && (h.kind === "video" || h.kind === "audio")) || b), n = c.length > 0, u = p.length > 0, y = (() => {
|
|
563
|
+
if (!h || h.kind !== "audio") return !1;
|
|
564
564
|
try {
|
|
565
|
-
const
|
|
566
|
-
return /\.(mp3|wav|m4a|aac|flac|ogg|oga)$/.test(
|
|
565
|
+
const f = new URL(h.url);
|
|
566
|
+
return /\.(mp3|wav|m4a|aac|flac|ogg|oga)$/.test(f.pathname.toLowerCase());
|
|
567
567
|
} catch {
|
|
568
568
|
return !1;
|
|
569
569
|
}
|
|
570
|
-
})(),
|
|
571
|
-
if (!
|
|
570
|
+
})(), g = (() => {
|
|
571
|
+
if (!h || !y) return "";
|
|
572
572
|
try {
|
|
573
|
-
const
|
|
573
|
+
const A = new URL(h.url).pathname.split("/").filter(Boolean).pop() || "", x = decodeURIComponent(A), E = x.replace(/\.(mp3|wav|m4a|aac|flac|ogg|oga)$/i, "") || x || "Audio";
|
|
574
574
|
return E.charAt(0).toUpperCase() + E.slice(1);
|
|
575
575
|
} catch {
|
|
576
576
|
return "Audio";
|
|
577
577
|
}
|
|
578
578
|
})();
|
|
579
|
-
if (!(!
|
|
580
|
-
if (this.setAttribute("preview-dialog-value", p), this.setAttribute("preview-dialog-image", c), this.setAttribute("preview-dialog-type", d || (
|
|
581
|
-
a && a.setAttribute("hidden", ""),
|
|
582
|
-
else if (
|
|
579
|
+
if (!(!n && !u && !v)) {
|
|
580
|
+
if (this.setAttribute("preview-dialog-value", p), this.setAttribute("preview-dialog-image", c), this.setAttribute("preview-dialog-type", d || (n ? "IMG" : "CODE")), o && (o.textContent = m), v ? e == null || e.setAttribute("content-max-height", "none") : e == null || e.removeAttribute("content-max-height"), n)
|
|
581
|
+
a && a.setAttribute("hidden", ""), s && (s.setAttribute("src", c), s.removeAttribute("hidden")), i && i.setAttribute("hidden", ""), r && r.setAttribute("hidden", "");
|
|
582
|
+
else if (v && h) {
|
|
583
583
|
if (a) {
|
|
584
|
-
const
|
|
585
|
-
a.textContent =
|
|
584
|
+
const f = y;
|
|
585
|
+
a.textContent = f ? g : h.url, f ? (a.setAttribute("href", h.url), a.setAttribute("target", "_blank"), a.setAttribute("rel", "noopener noreferrer")) : (a.removeAttribute("href"), a.removeAttribute("target"), a.removeAttribute("rel")), a.toggleAttribute("hidden", !f);
|
|
586
586
|
}
|
|
587
|
-
i && (i.setAttribute("src",
|
|
588
|
-
} else b ? (a && (a.textContent = p, a.toggleAttribute("hidden", !0)), i && (i.setAttribute("src", p), i.setAttribute("type", d === "VIDEO" ? "video" : "audio"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""),
|
|
589
|
-
(
|
|
587
|
+
i && (i.setAttribute("src", h.url), i.removeAttribute("type"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), s && (s.removeAttribute("src"), s.setAttribute("hidden", ""));
|
|
588
|
+
} else b ? (a && (a.textContent = p, a.toggleAttribute("hidden", !0)), i && (i.setAttribute("src", p), i.setAttribute("type", d === "VIDEO" ? "video" : "audio"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), s && (s.removeAttribute("src"), s.setAttribute("hidden", ""))) : (a && a.setAttribute("hidden", ""), r && (r.textContent = this.formatPreviewCode(p, d), r.removeAttribute("hidden")), i && (i.removeAttribute("src"), i.removeAttribute("prefer-native-controls"), i.setAttribute("hidden", "")), s && (s.removeAttribute("src"), s.setAttribute("hidden", "")));
|
|
589
|
+
(w = e == null ? void 0 : e.open) == null || w.call(e);
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
syncPreviewEdgeShadows() {
|
|
@@ -609,9 +609,9 @@ class S extends HTMLElement {
|
|
|
609
609
|
e && (e.setAttribute("hidden", ""), e.style.display = "none");
|
|
610
610
|
return;
|
|
611
611
|
}
|
|
612
|
-
const
|
|
613
|
-
e && (e.toggleAttribute("hidden",
|
|
614
|
-
const i =
|
|
612
|
+
const s = o.length === 1 && this.isContextOnlyAction(o[0]);
|
|
613
|
+
e && (e.toggleAttribute("hidden", s), e.style.display = s ? "none" : "inline-flex");
|
|
614
|
+
const i = s || !r ? null : e;
|
|
615
615
|
i && (this.triggerEl = i, this.triggerEl.addEventListener("click", this.toggleFanOpen), this.syncTriggerIconState());
|
|
616
616
|
}
|
|
617
617
|
syncTriggerIconState() {
|
|
@@ -636,64 +636,64 @@ class S extends HTMLElement {
|
|
|
636
636
|
const t = this.shadowRoot.querySelector('slot[name="actions"]'), e = this.shadowRoot.querySelector("#promptDefaultActionsTrigger");
|
|
637
637
|
if (!t) return;
|
|
638
638
|
const o = t.assignedElements({ flatten: !0 }).filter(
|
|
639
|
-
(
|
|
640
|
-
), r = o.length > 0,
|
|
641
|
-
|
|
639
|
+
(n) => !n.hasAttribute("hidden")
|
|
640
|
+
), r = o.length > 0, s = this.shadowRoot.querySelector(".actions-slot-left");
|
|
641
|
+
s && (s.style.display = r ? "inline-flex" : "none");
|
|
642
642
|
const i = o.length === 1 && this.isContextOnlyAction(o[0]);
|
|
643
643
|
if (e) {
|
|
644
|
-
const
|
|
645
|
-
e.toggleAttribute("hidden",
|
|
644
|
+
const n = !r || i;
|
|
645
|
+
e.toggleAttribute("hidden", n), e.style.display = n ? "none" : "inline-flex";
|
|
646
646
|
}
|
|
647
|
-
const a = i || !r ? null : e, l = o.filter((
|
|
647
|
+
const a = i || !r ? null : e, l = o.filter((n) => n !== a), m = a ? [a, ...l] : o, p = this.shadowRoot.querySelector('slot[name="actions-right"]'), c = (p == null ? void 0 : p.assignedElements({ flatten: !0 })) || [], d = l.length > 0;
|
|
648
648
|
this.toggleAttribute("has-actions", r), this.toggleAttribute("has-extra-actions", d);
|
|
649
|
-
const
|
|
650
|
-
this.enforceActionVariants(), m.forEach((
|
|
651
|
-
|
|
652
|
-
const
|
|
653
|
-
if (
|
|
654
|
-
this.setFanItemInert(
|
|
649
|
+
const h = r || this.hasTruthyFlagAttribute("actions-fan"), b = this.hasAttribute("fan-open"), v = 100;
|
|
650
|
+
this.enforceActionVariants(), m.forEach((n, u) => {
|
|
651
|
+
n.style.transition = `transform ${v}ms ease, opacity ${v}ms ease`, n.style.zIndex = "";
|
|
652
|
+
const y = this.fanAnimations.get(n);
|
|
653
|
+
if (y && (y.cancel(), this.fanAnimations.delete(n)), !h) {
|
|
654
|
+
this.setFanItemInert(n, !1), n.style.transitionDelay = "", n.style.transform = "", n.style.opacity = "", n.style.pointerEvents = "", n.style.filter = "";
|
|
655
655
|
return;
|
|
656
656
|
}
|
|
657
|
-
if (
|
|
658
|
-
this.setFanItemInert(
|
|
657
|
+
if (u === 0) {
|
|
658
|
+
this.setFanItemInert(n, !1), n.style.transitionDelay = "", n.style.transform = "translateX(0)", n.style.opacity = "1", n.style.pointerEvents = "", n.style.filter = "";
|
|
659
659
|
return;
|
|
660
660
|
}
|
|
661
661
|
if (!b) {
|
|
662
|
-
this.setFanItemInert(
|
|
662
|
+
this.setFanItemInert(n, !0), n.style.transitionDelay = "", n.style.transform = "translateX(0) scale(0.8)", n.style.opacity = "0", n.style.pointerEvents = "none", n.style.filter = "";
|
|
663
663
|
return;
|
|
664
664
|
}
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
if (
|
|
668
|
-
|
|
665
|
+
const g = "0px", w = u * 50;
|
|
666
|
+
n.style.transition = `opacity ${Math.max(120, v - 40)}ms ease, transform ${v}ms cubic-bezier(0.22, 1, 0.36, 1)`, n.style.transitionDelay = `${w}ms`, n.style.transform = "translateX(0) scale(0.92)", n.style.opacity = "0", n.style.pointerEvents = "none", n.style.filter = "", this.setFanItemInert(n, !0), requestAnimationFrame(() => {
|
|
667
|
+
if (n.style.transform = `translateX(${g})`, n.style.opacity = "1", window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
668
|
+
n.style.pointerEvents = "", this.setFanItemInert(n, !1);
|
|
669
669
|
return;
|
|
670
670
|
}
|
|
671
|
-
const A =
|
|
671
|
+
const A = n.animate(
|
|
672
672
|
[
|
|
673
673
|
{ transform: "translateX(0) scale(0.92)" },
|
|
674
|
-
{ transform: `translateX(${
|
|
675
|
-
{ transform: `translateX(calc(${
|
|
676
|
-
{ transform: `translateX(${
|
|
674
|
+
{ transform: `translateX(${g}) scale(1.03)`, offset: 0.68 },
|
|
675
|
+
{ transform: `translateX(calc(${g} - var(--space-050))) scale(0.99)`, offset: 0.86 },
|
|
676
|
+
{ transform: `translateX(${g}) scale(1)` }
|
|
677
677
|
],
|
|
678
678
|
{
|
|
679
|
-
duration:
|
|
680
|
-
delay:
|
|
679
|
+
duration: v + 180,
|
|
680
|
+
delay: w,
|
|
681
681
|
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
682
682
|
fill: "forwards"
|
|
683
683
|
}
|
|
684
684
|
);
|
|
685
|
-
this.fanAnimations.set(
|
|
685
|
+
this.fanAnimations.set(n, A), A.finished.catch(() => {
|
|
686
686
|
}).finally(() => {
|
|
687
|
-
|
|
687
|
+
n.style.pointerEvents = "", this.setFanItemInert(n, !1);
|
|
688
688
|
});
|
|
689
689
|
});
|
|
690
|
-
}), c.forEach((
|
|
691
|
-
|
|
690
|
+
}), c.forEach((n) => {
|
|
691
|
+
n.style.transition = "", n.style.zIndex = "";
|
|
692
692
|
}), this.bindActionTrigger(), this.syncTriggerIconState();
|
|
693
693
|
}
|
|
694
694
|
render() {
|
|
695
695
|
if (!this.shadowRoot) return;
|
|
696
|
-
const t = this.getAttribute("placeholder") || "Reply to Mui...", e = this.getAttribute("value") || "", o = this.getAttribute("rows") || "3", r = this.hasAttribute("disabled"),
|
|
696
|
+
const t = this.getAttribute("placeholder") || "Reply to Mui...", e = this.getAttribute("value") || "", o = this.getAttribute("rows") || "3", r = this.hasAttribute("disabled"), s = this.getAttribute("preview-dialog-width") || "560px", i = this.getAttribute("color-top-start") || "", a = this.getAttribute("color-top-mid") || "", l = this.getAttribute("color-top-end") || "", m = this.getAttribute("color-top-accent") || "", c = (this.getAttribute("color-layout") || "default").toLowerCase() === "swap", d = c ? l || "var(--prompt-color-top-end, var(--green-500))" : i || "var(--prompt-color-top-start, var(--blue-500))", h = c ? m || "var(--prompt-color-top-accent, var(--orange-500))" : a || "var(--prompt-color-top-mid, var(--blue-500))", b = c ? i || "var(--prompt-color-top-start, var(--blue-500))" : l || "var(--prompt-color-top-end, var(--green-500))", v = c ? a || "var(--prompt-color-top-mid, var(--blue-500))" : m || "var(--prompt-color-top-accent, var(--orange-500))", n = this.getAttribute("aria-label"), u = this.getAttribute("aria-labelledby"), y = this.getAttribute("aria-describedby"), g = !n && !u ? "Prompt input" : "", w = (this.getAttribute("error-message") || "").trim(), f = w;
|
|
697
697
|
this.shadowRoot.innerHTML = /*html*/
|
|
698
698
|
`
|
|
699
699
|
<style>
|
|
@@ -701,9 +701,9 @@ class S extends HTMLElement {
|
|
|
701
701
|
display: block;
|
|
702
702
|
--prompt-action-radius: var(--chip-radius-small, var(--radius-400));
|
|
703
703
|
--prompt-color-top-start-source: ${d};
|
|
704
|
-
--prompt-color-top-mid-source: ${
|
|
704
|
+
--prompt-color-top-mid-source: ${h};
|
|
705
705
|
--prompt-color-top-end-source: ${b};
|
|
706
|
-
--prompt-color-top-accent-source: ${
|
|
706
|
+
--prompt-color-top-accent-source: ${v};
|
|
707
707
|
--prompt-accent-primary-derived: var(--prompt-accent-primary, var(--prompt-spectrum-start, var(--blue-500)));
|
|
708
708
|
--prompt-accent-secondary-derived: var(--prompt-accent-secondary, var(--blue-500));
|
|
709
709
|
--prompt-accent-mid: color-mix(
|
|
@@ -1421,10 +1421,10 @@ class S extends HTMLElement {
|
|
|
1421
1421
|
<textarea
|
|
1422
1422
|
rows="${o}"
|
|
1423
1423
|
placeholder="${t}"
|
|
1424
|
-
${
|
|
1425
|
-
${
|
|
1424
|
+
${n ? `aria-label="${n.replace(/"/g, """)}"` : ""}
|
|
1425
|
+
${u ? `aria-labelledby="${u.replace(/"/g, """)}"` : ""}
|
|
1426
1426
|
${y ? `aria-describedby="${y.replace(/"/g, """)}"` : ""}
|
|
1427
|
-
${
|
|
1427
|
+
${g ? `aria-label="${g}"` : ""}
|
|
1428
1428
|
${r ? "disabled" : ""}
|
|
1429
1429
|
>${e}</textarea>
|
|
1430
1430
|
</slot>
|
|
@@ -1456,9 +1456,9 @@ class S extends HTMLElement {
|
|
|
1456
1456
|
</div>
|
|
1457
1457
|
<div class="error-region" hidden>
|
|
1458
1458
|
|
|
1459
|
-
<mui-body size="x-small" variant="error" class="error-default" ${
|
|
1459
|
+
<mui-body size="x-small" variant="error" class="error-default" ${w ? "" : "hidden"}>
|
|
1460
1460
|
<mui-icon-attention slot="before"></mui-icon-attention>
|
|
1461
|
-
<span class="error-text">${
|
|
1461
|
+
<span class="error-text">${f}</span>
|
|
1462
1462
|
</mui-body>
|
|
1463
1463
|
|
|
1464
1464
|
</div>
|
|
@@ -1470,7 +1470,7 @@ class S extends HTMLElement {
|
|
|
1470
1470
|
|
|
1471
1471
|
<mui-dialog
|
|
1472
1472
|
id="promptAutoPreviewDialog"
|
|
1473
|
-
width="${
|
|
1473
|
+
width="${s}"
|
|
1474
1474
|
content-padding="none"
|
|
1475
1475
|
>
|
|
1476
1476
|
<mui-heading id="promptAutoPreviewTitle" slot="title" size="5">Pasted Content</mui-heading>
|
|
@@ -15,8 +15,15 @@ class s extends HTMLElement {
|
|
|
15
15
|
const t = !!this.closest("mui-card"), e = !!this.closest("mui-form-section"), i = !!this.closest("mui-dialog"), o = !!this.closest("mui-drawer");
|
|
16
16
|
this.toggleAttribute("in-card", t), this.toggleAttribute("in-form-section", e), this.toggleAttribute("in-dialog", i), this.toggleAttribute("in-drawer", o);
|
|
17
17
|
}
|
|
18
|
+
getRuleWeight() {
|
|
19
|
+
const t = this.getAttribute("weight") || "var(--stroke-size-100)";
|
|
20
|
+
return {
|
|
21
|
+
thin: "var(--stroke-size-100)",
|
|
22
|
+
thick: "var(--stroke-size-200)"
|
|
23
|
+
}[t] || t;
|
|
24
|
+
}
|
|
18
25
|
updateStyles() {
|
|
19
|
-
const t = this.getAttribute("length") || "100%", e = this.
|
|
26
|
+
const t = this.getAttribute("length") || "100%", e = this.getRuleWeight(), i = (
|
|
20
27
|
/*css*/
|
|
21
28
|
`
|
|
22
29
|
:host {
|
|
@@ -108,25 +108,25 @@ class x extends HTMLElement {
|
|
|
108
108
|
appearance: none;
|
|
109
109
|
}
|
|
110
110
|
select.size-x-small {
|
|
111
|
-
min-height: var(--action-
|
|
111
|
+
min-height: var(--action-size-x-small);
|
|
112
112
|
padding: var(--action-padding-x-small);
|
|
113
113
|
font-size: var(--text-font-size-xs);
|
|
114
114
|
line-height: var(--text-line-height-xs);
|
|
115
115
|
}
|
|
116
116
|
select.size-small {
|
|
117
|
-
min-height: var(--action-
|
|
117
|
+
min-height: var(--action-size-small);
|
|
118
118
|
padding: var(--action-padding-small);
|
|
119
119
|
font-size: var(--text-font-size-s);
|
|
120
120
|
line-height: var(--text-line-height-s);
|
|
121
121
|
}
|
|
122
122
|
select.size-medium {
|
|
123
|
-
min-height:
|
|
123
|
+
min-height: var(--action-size-medium);
|
|
124
124
|
padding: var(--space-200) var(--space-300);
|
|
125
125
|
font-size: var(--text-font-size);
|
|
126
126
|
line-height: var(--text-line-height);
|
|
127
127
|
}
|
|
128
128
|
select.size-large {
|
|
129
|
-
min-height: var(--action-
|
|
129
|
+
min-height: var(--action-size-large);
|
|
130
130
|
padding: var(--space-300) var(--space-400);
|
|
131
131
|
font-size: var(--text-font-size-l);
|
|
132
132
|
line-height: var(--text-line-height-l);
|
|
@@ -39,7 +39,7 @@ class i extends HTMLElement {
|
|
|
39
39
|
return this.querySelector('[slot="accessory"]') !== null;
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
|
-
const a = this.variant === "action", t = this.getAttribute("col") || "1fr 1fr", r = this.getAttribute("space") || "var(--space-500)", e = this.hasAccessorySlot(), s = (
|
|
42
|
+
const a = this.variant === "action", t = this.getAttribute("col") || (a ? "minmax(0, 1fr) auto" : "1fr 1fr"), r = this.getAttribute("space") || "var(--space-500)", e = this.hasAccessorySlot(), s = (
|
|
43
43
|
/*css*/
|
|
44
44
|
`
|
|
45
45
|
:host {
|
|
@@ -72,6 +72,14 @@ class i extends HTMLElement {
|
|
|
72
72
|
text-align: left;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
.action::part(grid-template-columns) {
|
|
76
|
+
grid-template-columns: ${t};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.action::part(gap) {
|
|
80
|
+
gap: ${r};
|
|
81
|
+
}
|
|
82
|
+
|
|
75
83
|
.action:focus {
|
|
76
84
|
z-index: 1;
|
|
77
85
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getPartMap as a } from "../../../utils/part-map/index.js";
|
|
2
|
-
class
|
|
2
|
+
class r extends HTMLElement {
|
|
3
3
|
static get observedAttributes() {
|
|
4
|
-
return ["space", "aligny", "alignx", "padding", "height", "width", "viewport", "fill"];
|
|
4
|
+
return ["space", "aligny", "alignx", "padding", "height", "width", "viewport", "fill", "wrap"];
|
|
5
5
|
}
|
|
6
6
|
constructor() {
|
|
7
|
-
super(), this.attachShadow({ mode: "open" }), this.space = "var(--space-500)", this.alignY = "flex-start", this.alignX = "flex-start", this.styles = /*css*/
|
|
7
|
+
super(), this.attachShadow({ mode: "open" }), this.space = "var(--space-500)", this.alignY = "flex-start", this.alignX = "flex-start", this.wrap = "nowrap", this.styles = /*css*/
|
|
8
8
|
`
|
|
9
9
|
:host {
|
|
10
10
|
display: block;
|
|
@@ -20,6 +20,7 @@ class h extends HTMLElement {
|
|
|
20
20
|
padding: var(--padding);
|
|
21
21
|
align-items: var(--alignY);
|
|
22
22
|
justify-content: var(--alignX);
|
|
23
|
+
flex-wrap: var(--wrap);
|
|
23
24
|
}
|
|
24
25
|
:host([height]) slot,
|
|
25
26
|
:host([viewport]) slot,
|
|
@@ -46,6 +47,7 @@ class h extends HTMLElement {
|
|
|
46
47
|
--padding: ${this.getAttribute("padding") || "var(--space-000)"};
|
|
47
48
|
--alignY: ${this.getAttribute("aligny") || this.alignY};
|
|
48
49
|
--alignX: ${this.getAttribute("alignx") || this.alignX};
|
|
50
|
+
--wrap: ${this.resolveWrap(this.getAttribute("wrap"))};
|
|
49
51
|
">
|
|
50
52
|
</slot>
|
|
51
53
|
`;
|
|
@@ -53,12 +55,15 @@ class h extends HTMLElement {
|
|
|
53
55
|
attributeChangedCallback(t, i, s) {
|
|
54
56
|
if (i === s || ((t === "height" || t === "width" || t === "viewport" || t === "fill") && this.syncDimensions(), !this.shadowRoot)) return;
|
|
55
57
|
const e = this.shadowRoot.querySelector("slot");
|
|
56
|
-
e && (t === "space" && e.style.setProperty("--space", s || this.space), t === "padding" && e.style.setProperty("--padding", s || "var(--space-000)"), t === "aligny" && e.style.setProperty("--alignY", s || this.alignY), t === "alignx" && e.style.setProperty("--alignX", s || this.alignX));
|
|
58
|
+
e && (t === "space" && e.style.setProperty("--space", s || this.space), t === "padding" && e.style.setProperty("--padding", s || "var(--space-000)"), t === "aligny" && e.style.setProperty("--alignY", s || this.alignY), t === "alignx" && e.style.setProperty("--alignX", s || this.alignX), t === "wrap" && e.style.setProperty("--wrap", this.resolveWrap(s)));
|
|
57
59
|
}
|
|
58
60
|
syncDimensions() {
|
|
59
61
|
const t = this.getAttribute("height") || (this.hasAttribute("viewport") ? "100dvh" : this.hasAttribute("fill") ? "100%" : "auto"), i = this.getAttribute("width") || (this.hasAttribute("fill") ? "100%" : "auto");
|
|
60
62
|
this.style.setProperty("--stack-height", t), this.style.setProperty("--stack-width", i);
|
|
61
63
|
}
|
|
64
|
+
resolveWrap(t) {
|
|
65
|
+
return t === null || t === "" ? this.hasAttribute("wrap") ? "wrap" : this.wrap : t;
|
|
66
|
+
}
|
|
62
67
|
waitForPartMap() {
|
|
63
68
|
return new Promise((t) => {
|
|
64
69
|
if (typeof a == "function") return t();
|
|
@@ -69,4 +74,4 @@ class h extends HTMLElement {
|
|
|
69
74
|
});
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
|
-
customElements.get("mui-h-stack") || customElements.define("mui-h-stack",
|
|
77
|
+
customElements.get("mui-h-stack") || customElements.define("mui-h-stack", r);
|