@muibook/components 20.0.0 → 20.1.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/AGENTS.md +67 -0
- package/DESIGN.md +358 -0
- package/README.md +52 -1
- package/dist/esm/agent/keywords/index.js +2 -204
- package/dist/esm/agent/prompts/index.js +6 -434
- package/dist/esm/components/mui-accordion/core/index.js +25 -17
- package/dist/esm/components/mui-avatar/index.js +99 -42
- package/dist/esm/components/mui-avatar-chip/index.js +158 -0
- package/dist/esm/components/mui-avatar-group/index.js +88 -0
- package/dist/esm/components/mui-badge/index.js +2 -2
- package/dist/esm/components/mui-body/index.js +20 -11
- package/dist/esm/components/mui-button/index.js +117 -65
- package/dist/esm/components/mui-calendar/index.js +199 -0
- package/dist/esm/components/mui-card/body/index.js +32 -17
- package/dist/esm/components/mui-card/footer/index.js +11 -9
- package/dist/esm/components/mui-carousel/controller/index.js +1 -1
- package/dist/esm/components/mui-checkbox/index.js +23 -18
- package/dist/esm/components/mui-chip/index.js +184 -68
- package/dist/esm/components/mui-chip-input/index.js +146 -137
- package/dist/esm/components/mui-chip-rail/index.js +154 -51
- package/dist/esm/components/mui-code/index.js +27 -8
- package/dist/esm/components/mui-container/index.js +68 -45
- package/dist/esm/components/mui-date-picker/index.js +169 -0
- package/dist/esm/components/mui-drawer/index.js +968 -100
- package/dist/esm/components/mui-dropdown/index.js +250 -63
- package/dist/esm/components/mui-field/index.js +1 -1
- package/dist/esm/components/mui-file-upload/index.js +13 -4
- package/dist/esm/components/mui-form-group/index.js +1 -2
- package/dist/esm/components/mui-form-message/index.js +4 -9
- package/dist/esm/components/mui-hint/index.js +178 -72
- package/dist/esm/components/mui-icons/copy/index.js +54 -0
- package/dist/esm/components/mui-icons/fullscreen/index.js +5 -0
- package/dist/esm/components/mui-icons/icon-helper/index.js +56 -0
- package/dist/esm/components/mui-icons/index.js +14 -1
- package/dist/esm/components/mui-icons/moon/index.js +3 -1
- package/dist/esm/components/mui-icons/{rectangle-bottom-panel → panel}/index.js +6 -6
- package/dist/esm/components/mui-icons/pause/index.js +5 -0
- package/dist/esm/components/mui-icons/picture-in-picture/index.js +5 -0
- package/dist/esm/components/mui-icons/play-fill/index.js +5 -0
- package/dist/esm/components/mui-icons/rectangle-right-drawer/index.js +56 -0
- package/dist/esm/components/mui-icons/reload/index.js +5 -0
- package/dist/esm/components/mui-icons/speaker-mute/index.js +5 -0
- package/dist/esm/components/mui-icons/speaker-one-wave/index.js +5 -0
- package/dist/esm/components/mui-icons/speaker-two-wave/index.js +5 -0
- package/dist/esm/components/mui-icons/spinner/index.js +7 -5
- package/dist/esm/components/mui-icons/stop-fill/index.js +5 -0
- package/dist/esm/components/mui-icons/sun/index.js +5 -5
- package/dist/esm/components/mui-icons/timer/index.js +54 -0
- package/dist/esm/components/mui-icons/toggle/index.js +16 -6
- package/dist/esm/components/mui-icons/vertical-ellipsis/index.js +5 -0
- package/dist/esm/components/mui-illustrations/trash/index.js +6 -5
- package/dist/esm/components/mui-input/index.js +87 -62
- package/dist/esm/components/mui-link/index.js +195 -83
- package/dist/esm/components/mui-media-player/index.js +1577 -83
- package/dist/esm/components/mui-model-viewer/index.js +258 -0
- package/dist/esm/components/mui-progress-ring/index.js +349 -0
- package/dist/esm/components/mui-prompt/index.js +99 -71
- package/dist/esm/components/mui-prompt-preview/index.js +11 -23
- package/dist/esm/components/mui-radio/index.js +38 -17
- package/dist/esm/components/mui-range-input/index.js +9 -4
- package/dist/esm/components/mui-responsive/index.js +60 -27
- package/dist/esm/components/mui-search-input/index.js +300 -0
- package/dist/esm/components/mui-select/index.js +231 -42
- package/dist/esm/components/mui-slat/slat/index.js +40 -12
- package/dist/esm/components/mui-spinner/index.js +11 -9
- package/dist/esm/components/mui-switch/index.js +23 -20
- package/dist/esm/components/mui-table/row/index.js +2 -6
- package/dist/esm/components/mui-table/table/index.js +157 -14
- package/dist/esm/components/mui-textarea/index.js +43 -26
- package/dist/esm/components/mui-time/index/index.js +336 -0
- package/dist/esm/components/mui-time-picker/index.js +126 -0
- package/dist/esm/components/mui-video-thumbnail/index.js +5 -5
- package/dist/esm/css/mui-brand.css +12 -8
- package/dist/esm/css/mui-tokens.css +417 -305
- package/dist/esm/css/readme.md +2 -2
- package/dist/esm/custom-elements.json +3678 -1553
- package/dist/esm/dynamic-attrs.json +263 -66
- package/dist/esm/index.js +30 -6
- package/dist/esm/knowledge/compositions/index.js +1560 -0
- package/dist/esm/knowledge/index.js +28 -0
- package/dist/esm/knowledge/keywords/index.js +306 -0
- package/dist/esm/knowledge/rules/index.js +199 -0
- package/dist/esm/tokens/js/index.js +143 -139
- package/dist/types/agent/keywords/index.d.ts +1 -1
- package/dist/types/components/mui-avatar-chip/api.d.ts +28 -0
- package/dist/types/components/mui-avatar-chip/index.d.ts +18 -0
- package/dist/types/components/mui-avatar-group/api.d.ts +28 -0
- package/dist/types/components/mui-avatar-group/doc.d.ts +2 -0
- package/dist/types/components/mui-avatar-group/index.d.ts +1 -0
- package/dist/types/components/mui-button/api.d.ts +2 -2
- package/dist/types/components/mui-calendar/api.d.ts +41 -0
- package/dist/types/components/mui-calendar/doc.d.ts +2 -0
- package/dist/types/components/mui-calendar/index.d.ts +3 -0
- package/dist/types/components/mui-checkbox/api.d.ts +4 -0
- package/dist/types/components/mui-chip-input/api.d.ts +4 -0
- package/dist/types/components/mui-chip-rail/index.d.ts +1 -0
- package/dist/types/components/mui-date-picker/api.d.ts +38 -0
- package/dist/types/components/mui-date-picker/doc.d.ts +2 -0
- package/dist/types/components/mui-date-picker/index.d.ts +6 -0
- package/dist/types/components/mui-drawer/api.d.ts +4 -0
- package/dist/types/components/mui-drawer/index.d.ts +2 -0
- package/dist/types/components/mui-file-upload/api.d.ts +4 -0
- package/dist/types/components/mui-icons/fullscreen.d.ts +1 -0
- package/dist/types/components/mui-icons/icon-helper.d.ts +1 -0
- package/dist/types/components/mui-icons/index.d.ts +14 -1
- package/dist/types/components/mui-icons/panel.d.ts +1 -0
- package/dist/types/components/mui-icons/pause.d.ts +1 -0
- package/dist/types/components/mui-icons/picture-in-picture.d.ts +1 -0
- package/dist/types/components/mui-icons/play-fill.d.ts +1 -0
- package/dist/types/components/mui-icons/rectangle-right-drawer.d.ts +1 -0
- package/dist/types/components/mui-icons/reload.d.ts +1 -0
- package/dist/types/components/mui-icons/speaker-mute.d.ts +1 -0
- package/dist/types/components/mui-icons/speaker-one-wave.d.ts +1 -0
- package/dist/types/components/mui-icons/speaker-two-wave.d.ts +1 -0
- package/dist/types/components/mui-icons/stop-fill.d.ts +1 -0
- package/dist/types/components/mui-icons/timer.d.ts +1 -0
- package/dist/types/components/mui-icons/vertical-ellipsis.d.ts +1 -0
- package/dist/types/components/mui-input/api.d.ts +12 -0
- package/dist/types/components/mui-media-player/api.d.ts +4 -0
- package/dist/types/components/mui-media-player/index.d.ts +13 -4
- package/dist/types/components/mui-model-viewer/api.d.ts +28 -0
- package/dist/types/components/mui-model-viewer/doc.d.ts +2 -0
- package/dist/types/components/mui-model-viewer/index.d.ts +17 -0
- package/dist/types/components/mui-progress-ring/api.d.ts +24 -0
- package/dist/types/components/mui-progress-ring/doc.d.ts +2 -0
- package/dist/types/components/mui-progress-ring/index.d.ts +1 -0
- package/dist/types/components/mui-radio/api.d.ts +12 -0
- package/dist/types/components/mui-range-input/api.d.ts +4 -0
- package/dist/types/components/mui-responsive/api.d.ts +10 -2
- package/dist/types/components/mui-search-input/api.d.ts +40 -0
- package/dist/types/components/mui-search-input/doc.d.ts +2 -0
- package/dist/types/components/mui-search-input/index.d.ts +3 -0
- package/dist/types/components/mui-select/api.d.ts +12 -0
- package/dist/types/components/mui-switch/api.d.ts +4 -0
- package/dist/types/components/mui-table/api.d.ts +15 -0
- package/dist/types/components/mui-textarea/api.d.ts +12 -0
- package/dist/types/components/mui-time/api.d.ts +41 -0
- package/dist/types/components/mui-time/doc.d.ts +2 -0
- package/dist/types/components/mui-time/index.d.ts +1 -0
- package/dist/types/components/mui-time-picker/api.d.ts +38 -0
- package/dist/types/components/mui-time-picker/doc.d.ts +2 -0
- package/dist/types/components/mui-time-picker/index.d.ts +4 -0
- package/dist/types/index.d.ts +24 -2
- package/dist/types/knowledge/compositions.d.ts +4644 -0
- package/dist/types/knowledge/index.d.ts +4657 -0
- package/dist/types/knowledge/keywords.d.ts +4 -0
- package/dist/types/knowledge/rules.d.ts +1 -0
- package/dist/types/tokens/js/index.d.ts +11 -7
- package/package.json +119 -12
- package/dist/esm/components/mui-form-hint/index.js +0 -1
- package/dist/types/components/mui-form-hint/index.d.ts +0 -1
- /package/dist/types/components/{mui-form-hint → mui-avatar-chip}/doc.d.ts +0 -0
- /package/dist/types/components/mui-icons/{rectangle-bottom-panel.d.ts → copy.d.ts} +0 -0
|
@@ -31,14 +31,14 @@ class S extends HTMLElement {
|
|
|
31
31
|
e.forEach((r) => {
|
|
32
32
|
const s = r.name === "actions";
|
|
33
33
|
r.assignedElements({ flatten: !0 }).forEach((a) => {
|
|
34
|
-
[a, ...Array.from(a.querySelectorAll("*"))].forEach((
|
|
35
|
-
const p =
|
|
34
|
+
[a, ...Array.from(a.querySelectorAll("*"))].forEach((h) => {
|
|
35
|
+
const p = h.tagName.toLowerCase();
|
|
36
36
|
if (p === "mui-button") {
|
|
37
|
-
|
|
37
|
+
h.setAttribute("variant", "tertiary"), o(h, s);
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
p === "mui-dropdown" &&
|
|
41
|
-
|
|
40
|
+
p === "mui-dropdown" && h.querySelectorAll('[slot="action"]').forEach((c) => {
|
|
41
|
+
c instanceof HTMLElement && c.tagName.toLowerCase() === "mui-button" && (c.setAttribute("variant", "tertiary"), o(c, s));
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
44
|
});
|
|
@@ -48,18 +48,18 @@ 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 || []), s = o.getData("text/plain") || "", i = s.trim(), a = i.length > 0, l = a ? this.detectMediaUrl(i) : null,
|
|
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, h = this.getAttribute("preview-overflow-to-preview") !== "false", p = this.getAttribute("preview-threshold-chars"), m = Number.isFinite(Number.parseInt(p || "", 10)) ? Math.max(1, Number.parseInt(p || "", 10)) : 220, c = a ? this.detectBadge(i) : "", u = c !== "" && c !== "Insightful", b = h && a && (!!(l != null && l.url) || i.length >= m || u), v = r.length > 0;
|
|
52
52
|
if (!v && !a) return;
|
|
53
53
|
(v || b) && e.preventDefault();
|
|
54
|
-
const n = r.map((
|
|
55
|
-
kind:
|
|
56
|
-
mimeType:
|
|
57
|
-
file:
|
|
58
|
-
fileName:
|
|
59
|
-
size:
|
|
60
|
-
badge:
|
|
61
|
-
preview:
|
|
62
|
-
value:
|
|
54
|
+
const n = r.map((d) => ({
|
|
55
|
+
kind: d.type.startsWith("image/") ? "image" : d.type.startsWith("video/") ? "video" : d.type.startsWith("audio/") ? "audio" : "file",
|
|
56
|
+
mimeType: d.type || "",
|
|
57
|
+
file: d,
|
|
58
|
+
fileName: d.name || "",
|
|
59
|
+
size: d.size || 0,
|
|
60
|
+
badge: d.type.startsWith("image/") ? "IMG" : d.type.startsWith("video/") ? "VIDEO" : d.type.startsWith("audio/") ? "MUSIC" : "FILE",
|
|
61
|
+
preview: d.name || "Pasted file",
|
|
62
|
+
value: d.name || ""
|
|
63
63
|
}));
|
|
64
64
|
b && i && (l != null && l.url ? n.unshift({
|
|
65
65
|
kind: l.kind === "image" ? "image" : "text",
|
|
@@ -77,9 +77,9 @@ class S extends HTMLElement {
|
|
|
77
77
|
source: "paste",
|
|
78
78
|
items: n,
|
|
79
79
|
text: s || "",
|
|
80
|
-
textBadge: (l == null ? void 0 : l.badge) ||
|
|
80
|
+
textBadge: (l == null ? void 0 : l.badge) || c,
|
|
81
81
|
overflowed: b,
|
|
82
|
-
thresholdChars:
|
|
82
|
+
thresholdChars: m
|
|
83
83
|
});
|
|
84
84
|
}, this.onInput = (t) => {
|
|
85
85
|
const e = t.target;
|
|
@@ -160,6 +160,7 @@ class S extends HTMLElement {
|
|
|
160
160
|
"preview-loading-label",
|
|
161
161
|
"preview-dialog-width",
|
|
162
162
|
"preview-dialog-title",
|
|
163
|
+
"preview-dialog-bordered",
|
|
163
164
|
"context-mode",
|
|
164
165
|
"effects-off",
|
|
165
166
|
"color-layout",
|
|
@@ -235,20 +236,18 @@ class S extends HTMLElement {
|
|
|
235
236
|
if (!this.shadowRoot) return;
|
|
236
237
|
const t = this.normalizeContextMode(this.getAttribute("context-mode"));
|
|
237
238
|
Array.from(
|
|
238
|
-
this.shadowRoot.querySelectorAll(
|
|
239
|
-
'slot[name="actions"], slot[name="actions-right"]'
|
|
240
|
-
)
|
|
239
|
+
this.shadowRoot.querySelectorAll('slot[name="actions"], slot[name="actions-right"]')
|
|
241
240
|
).flatMap((r) => r.assignedElements({ flatten: !0 })).forEach((r) => {
|
|
242
241
|
[r, ...Array.from(r.querySelectorAll("*"))].forEach((i) => {
|
|
243
|
-
const l = i.tagName.toLowerCase() === "mui-prompt-toggle",
|
|
242
|
+
const l = i.tagName.toLowerCase() === "mui-prompt-toggle", h = i.hasAttribute("context-toggle"), p = i.hasAttribute("context-active") || i.hasAttribute("context-close") || i.hasAttribute("context-chip") || i.hasAttribute("context-spinner");
|
|
244
243
|
if (l) {
|
|
245
244
|
i.setAttribute("mode", t);
|
|
246
245
|
return;
|
|
247
246
|
}
|
|
248
|
-
if (
|
|
247
|
+
if (h || p) {
|
|
249
248
|
i.hasAttribute("context-chip") && i.tagName.toLowerCase() === "mui-chip" && !i.hasAttribute("variant") && i.setAttribute("variant", "ghost");
|
|
250
|
-
const
|
|
251
|
-
i.toggleAttribute("hidden", !
|
|
249
|
+
const m = h ? t === "icon" : t === "chip";
|
|
250
|
+
i.toggleAttribute("hidden", !m), i.style.display = m ? "inline-flex" : "none";
|
|
252
251
|
}
|
|
253
252
|
});
|
|
254
253
|
});
|
|
@@ -434,9 +433,9 @@ class S extends HTMLElement {
|
|
|
434
433
|
t == null || t.focus();
|
|
435
434
|
}
|
|
436
435
|
syncTextareaHeight(t) {
|
|
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,
|
|
436
|
+
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, h = Number.parseFloat(s.paddingBottom) || 0, p = Number.parseFloat(s.borderTopWidth) || 0, m = Number.parseFloat(s.borderBottomWidth) || 0, c = l + h + p + m, u = 3 * a + c, b = r * a + c;
|
|
438
437
|
t.style.height = "auto";
|
|
439
|
-
const v = t.scrollHeight, n = Math.max(
|
|
438
|
+
const v = t.scrollHeight, n = Math.max(u, Math.min(v, b));
|
|
440
439
|
t.style.height = `${Math.ceil(n)}px`, t.style.overflowY = v > b ? "auto" : "hidden";
|
|
441
440
|
}
|
|
442
441
|
detectBadge(t) {
|
|
@@ -557,36 +556,36 @@ class S extends HTMLElement {
|
|
|
557
556
|
};
|
|
558
557
|
}
|
|
559
558
|
openInternalPreviewDialog(t) {
|
|
560
|
-
var
|
|
559
|
+
var y;
|
|
561
560
|
if (!this.shadowRoot) return;
|
|
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),
|
|
563
|
-
if (!
|
|
561
|
+
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), h = this.getAttribute("preview-dialog-title") || l.label, p = l.value, m = l.bgImage, c = l.badge, u = p ? this.detectMediaUrl(p) : null, b = !m && p.length > 0 && (c === "VIDEO" || c === "MUSIC"), v = !m && (!!(u && (u.kind === "video" || u.kind === "audio")) || b), n = m.length > 0, d = p.length > 0, f = (() => {
|
|
562
|
+
if (!u || u.kind !== "audio") return !1;
|
|
564
563
|
try {
|
|
565
|
-
const
|
|
566
|
-
return /\.(mp3|wav|m4a|aac|flac|ogg|oga)$/.test(
|
|
564
|
+
const g = new URL(u.url);
|
|
565
|
+
return /\.(mp3|wav|m4a|aac|flac|ogg|oga)$/.test(g.pathname.toLowerCase());
|
|
567
566
|
} catch {
|
|
568
567
|
return !1;
|
|
569
568
|
}
|
|
570
|
-
})(),
|
|
571
|
-
if (!
|
|
569
|
+
})(), w = (() => {
|
|
570
|
+
if (!u || !f) return "";
|
|
572
571
|
try {
|
|
573
|
-
const A = new URL(
|
|
572
|
+
const A = new URL(u.url).pathname.split("/").filter(Boolean).pop() || "", x = decodeURIComponent(A), E = x.replace(/\.(mp3|wav|m4a|aac|flac|ogg|oga)$/i, "") || x || "Audio";
|
|
574
573
|
return E.charAt(0).toUpperCase() + E.slice(1);
|
|
575
574
|
} catch {
|
|
576
575
|
return "Audio";
|
|
577
576
|
}
|
|
578
577
|
})();
|
|
579
|
-
if (!(!n && !
|
|
580
|
-
if (this.setAttribute("preview-dialog-value", p), this.setAttribute("preview-dialog-image",
|
|
581
|
-
a && a.setAttribute("hidden", ""), s && (s.setAttribute("src",
|
|
582
|
-
else if (v &&
|
|
578
|
+
if (!(!n && !d && !v)) {
|
|
579
|
+
if (this.setAttribute("preview-dialog-value", p), this.setAttribute("preview-dialog-image", m), this.setAttribute("preview-dialog-type", c || (n ? "IMG" : "CODE")), o && (o.textContent = h), v ? e == null || e.setAttribute("content-max-height", "none") : e == null || e.removeAttribute("content-max-height"), n)
|
|
580
|
+
a && a.setAttribute("hidden", ""), s && (s.setAttribute("src", m), s.removeAttribute("hidden")), i && i.setAttribute("hidden", ""), r && r.setAttribute("hidden", "");
|
|
581
|
+
else if (v && u) {
|
|
583
582
|
if (a) {
|
|
584
|
-
const
|
|
585
|
-
a.textContent =
|
|
583
|
+
const g = f;
|
|
584
|
+
a.textContent = g ? w : u.url, g ? (a.setAttribute("href", u.url), a.setAttribute("target", "_blank"), a.setAttribute("rel", "noopener noreferrer")) : (a.removeAttribute("href"), a.removeAttribute("target"), a.removeAttribute("rel")), a.toggleAttribute("hidden", !g);
|
|
586
585
|
}
|
|
587
|
-
i && (i.setAttribute("src",
|
|
588
|
-
} else b ? (a && (a.textContent = p, a.toggleAttribute("hidden", !0)), i && (i.setAttribute("src", p), i.setAttribute("type",
|
|
589
|
-
(
|
|
586
|
+
i && (i.setAttribute("src", u.url), i.removeAttribute("type"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), s && (s.removeAttribute("src"), s.setAttribute("hidden", ""));
|
|
587
|
+
} else b ? (a && (a.textContent = p, a.toggleAttribute("hidden", !0)), i && (i.setAttribute("src", p), i.setAttribute("type", c === "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, c), r.removeAttribute("hidden")), i && (i.removeAttribute("src"), i.removeAttribute("prefer-native-controls"), i.setAttribute("hidden", "")), s && (s.removeAttribute("src"), s.setAttribute("hidden", "")));
|
|
588
|
+
(y = e == null ? void 0 : e.open) == null || y.call(e);
|
|
590
589
|
}
|
|
591
590
|
}
|
|
592
591
|
syncPreviewEdgeShadows() {
|
|
@@ -644,17 +643,17 @@ class S extends HTMLElement {
|
|
|
644
643
|
const n = !r || i;
|
|
645
644
|
e.toggleAttribute("hidden", n), e.style.display = n ? "none" : "inline-flex";
|
|
646
645
|
}
|
|
647
|
-
const a = i || !r ? null : e, l = o.filter((n) => n !== a),
|
|
648
|
-
this.toggleAttribute("has-actions", r), this.toggleAttribute("has-extra-actions",
|
|
649
|
-
const
|
|
650
|
-
this.enforceActionVariants(),
|
|
646
|
+
const a = i || !r ? null : e, l = o.filter((n) => n !== a), h = a ? [a, ...l] : o, p = this.shadowRoot.querySelector('slot[name="actions-right"]'), m = (p == null ? void 0 : p.assignedElements({ flatten: !0 })) || [], c = l.length > 0;
|
|
647
|
+
this.toggleAttribute("has-actions", r), this.toggleAttribute("has-extra-actions", c);
|
|
648
|
+
const u = r || this.hasTruthyFlagAttribute("actions-fan"), b = this.hasAttribute("fan-open"), v = 100;
|
|
649
|
+
this.enforceActionVariants(), h.forEach((n, d) => {
|
|
651
650
|
n.style.transition = `transform ${v}ms ease, opacity ${v}ms ease`, n.style.zIndex = "";
|
|
652
|
-
const
|
|
653
|
-
if (
|
|
651
|
+
const f = this.fanAnimations.get(n);
|
|
652
|
+
if (f && (f.cancel(), this.fanAnimations.delete(n)), !u) {
|
|
654
653
|
this.setFanItemInert(n, !1), n.style.transitionDelay = "", n.style.transform = "", n.style.opacity = "", n.style.pointerEvents = "", n.style.filter = "";
|
|
655
654
|
return;
|
|
656
655
|
}
|
|
657
|
-
if (
|
|
656
|
+
if (d === 0) {
|
|
658
657
|
this.setFanItemInert(n, !1), n.style.transitionDelay = "", n.style.transform = "translateX(0)", n.style.opacity = "1", n.style.pointerEvents = "", n.style.filter = "";
|
|
659
658
|
return;
|
|
660
659
|
}
|
|
@@ -662,22 +661,22 @@ class S extends HTMLElement {
|
|
|
662
661
|
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
662
|
return;
|
|
664
663
|
}
|
|
665
|
-
const
|
|
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 = `${
|
|
667
|
-
if (n.style.transform = `translateX(${
|
|
664
|
+
const w = "0px", y = d * 50;
|
|
665
|
+
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 = `${y}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(() => {
|
|
666
|
+
if (n.style.transform = `translateX(${w})`, n.style.opacity = "1", window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
668
667
|
n.style.pointerEvents = "", this.setFanItemInert(n, !1);
|
|
669
668
|
return;
|
|
670
669
|
}
|
|
671
670
|
const A = n.animate(
|
|
672
671
|
[
|
|
673
672
|
{ transform: "translateX(0) scale(0.92)" },
|
|
674
|
-
{ transform: `translateX(${
|
|
675
|
-
{ transform: `translateX(calc(${
|
|
676
|
-
{ transform: `translateX(${
|
|
673
|
+
{ transform: `translateX(${w}) scale(1.03)`, offset: 0.68 },
|
|
674
|
+
{ transform: `translateX(calc(${w} - var(--space-050))) scale(0.99)`, offset: 0.86 },
|
|
675
|
+
{ transform: `translateX(${w}) scale(1)` }
|
|
677
676
|
],
|
|
678
677
|
{
|
|
679
678
|
duration: v + 180,
|
|
680
|
-
delay:
|
|
679
|
+
delay: y,
|
|
681
680
|
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
682
681
|
fill: "forwards"
|
|
683
682
|
}
|
|
@@ -687,23 +686,24 @@ class S extends HTMLElement {
|
|
|
687
686
|
n.style.pointerEvents = "", this.setFanItemInert(n, !1);
|
|
688
687
|
});
|
|
689
688
|
});
|
|
690
|
-
}),
|
|
689
|
+
}), m.forEach((n) => {
|
|
691
690
|
n.style.transition = "", n.style.zIndex = "";
|
|
692
691
|
}), this.bindActionTrigger(), this.syncTriggerIconState();
|
|
693
692
|
}
|
|
694
693
|
render() {
|
|
695
694
|
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"), s = this.getAttribute("preview-dialog-width") || "560px", i = this.getAttribute("color-top-start") || "",
|
|
695
|
+
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.hasAttribute("preview-dialog-bordered") ? "var(--border-thin)" : "var(--dialog-border)", a = this.getAttribute("color-top-start") || "", l = this.getAttribute("color-top-mid") || "", h = this.getAttribute("color-top-end") || "", p = this.getAttribute("color-top-accent") || "", c = (this.getAttribute("color-layout") || "default").toLowerCase() === "swap", u = c ? h || "var(--prompt-color-top-end, var(--green-500))" : a || "var(--prompt-color-top-start, var(--blue-500))", b = c ? p || "var(--prompt-color-top-accent, var(--orange-500))" : l || "var(--prompt-color-top-mid, var(--blue-500))", v = c ? a || "var(--prompt-color-top-start, var(--blue-500))" : h || "var(--prompt-color-top-end, var(--green-500))", n = c ? l || "var(--prompt-color-top-mid, var(--blue-500))" : p || "var(--prompt-color-top-accent, var(--orange-500))", d = this.getAttribute("aria-label"), f = this.getAttribute("aria-labelledby"), w = this.getAttribute("aria-describedby"), y = !d && !f ? "Prompt input" : "", g = (this.getAttribute("error-message") || "").trim(), A = g;
|
|
697
696
|
this.shadowRoot.innerHTML = /*html*/
|
|
698
697
|
`
|
|
699
698
|
<style>
|
|
700
699
|
:host {
|
|
701
700
|
display: block;
|
|
702
701
|
--prompt-action-radius: var(--chip-radius-small, var(--radius-400));
|
|
703
|
-
--prompt-
|
|
704
|
-
--prompt-color-top-
|
|
705
|
-
--prompt-color-top-
|
|
706
|
-
--prompt-color-top-
|
|
702
|
+
--prompt-preview-dialog-border: ${i};
|
|
703
|
+
--prompt-color-top-start-source: ${u};
|
|
704
|
+
--prompt-color-top-mid-source: ${b};
|
|
705
|
+
--prompt-color-top-end-source: ${v};
|
|
706
|
+
--prompt-color-top-accent-source: ${n};
|
|
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(
|
|
@@ -922,7 +922,7 @@ class S extends HTMLElement {
|
|
|
922
922
|
var(--prompt-layer-accent-tint) 0%,
|
|
923
923
|
transparent 64%
|
|
924
924
|
),
|
|
925
|
-
var(--prompt-focus-surface-background
|
|
925
|
+
var(--prompt-focus-surface-background);
|
|
926
926
|
mix-blend-mode: var(--prompt-spectrum-blend-mode-hover);
|
|
927
927
|
animation: none;
|
|
928
928
|
}
|
|
@@ -1407,6 +1407,31 @@ class S extends HTMLElement {
|
|
|
1407
1407
|
margin-top: var(--space-400);
|
|
1408
1408
|
padding-left: var(--space-100);
|
|
1409
1409
|
}
|
|
1410
|
+
.debug-region mui-body {
|
|
1411
|
+
min-width: 0;
|
|
1412
|
+
max-width: 100%;
|
|
1413
|
+
}
|
|
1414
|
+
.debug-region mui-body::part(width) {
|
|
1415
|
+
width: 100%;
|
|
1416
|
+
min-width: 0;
|
|
1417
|
+
max-width: 100%;
|
|
1418
|
+
}
|
|
1419
|
+
.debug-payload-body::part(display) {
|
|
1420
|
+
display: block;
|
|
1421
|
+
}
|
|
1422
|
+
.debug-payload-body::part(width) {
|
|
1423
|
+
width: 100%;
|
|
1424
|
+
min-width: 0;
|
|
1425
|
+
max-width: 100%;
|
|
1426
|
+
}
|
|
1427
|
+
.debug-payload-text {
|
|
1428
|
+
display: block;
|
|
1429
|
+
min-width: 0;
|
|
1430
|
+
max-width: 100%;
|
|
1431
|
+
white-space: normal;
|
|
1432
|
+
overflow-wrap: anywhere;
|
|
1433
|
+
word-break: break-word;
|
|
1434
|
+
}
|
|
1410
1435
|
</style>
|
|
1411
1436
|
|
|
1412
1437
|
<div class="surface">
|
|
@@ -1421,10 +1446,10 @@ class S extends HTMLElement {
|
|
|
1421
1446
|
<textarea
|
|
1422
1447
|
rows="${o}"
|
|
1423
1448
|
placeholder="${t}"
|
|
1424
|
-
${
|
|
1425
|
-
${
|
|
1426
|
-
${
|
|
1427
|
-
${
|
|
1449
|
+
${d ? `aria-label="${d.replace(/"/g, """)}"` : ""}
|
|
1450
|
+
${f ? `aria-labelledby="${f.replace(/"/g, """)}"` : ""}
|
|
1451
|
+
${w ? `aria-describedby="${w.replace(/"/g, """)}"` : ""}
|
|
1452
|
+
${y ? `aria-label="${y}"` : ""}
|
|
1428
1453
|
${r ? "disabled" : ""}
|
|
1429
1454
|
>${e}</textarea>
|
|
1430
1455
|
</slot>
|
|
@@ -1456,22 +1481,25 @@ class S extends HTMLElement {
|
|
|
1456
1481
|
</div>
|
|
1457
1482
|
<div class="error-region" hidden>
|
|
1458
1483
|
|
|
1459
|
-
<mui-body size="x-small" variant="error" class="error-default" ${
|
|
1484
|
+
<mui-body size="x-small" variant="error" class="error-default" ${g ? "" : "hidden"}>
|
|
1460
1485
|
<mui-icon-attention slot="before"></mui-icon-attention>
|
|
1461
|
-
<span class="error-text">${
|
|
1486
|
+
<span class="error-text">${A}</span>
|
|
1462
1487
|
</mui-body>
|
|
1463
1488
|
|
|
1464
1489
|
</div>
|
|
1465
1490
|
</div>
|
|
1466
1491
|
<mui-v-stack class="debug-region" space="var(--space-050)" ${this.hasAttribute("debug") ? "" : "hidden"}>
|
|
1467
1492
|
<mui-body id="promptDebugStatus" size="x-small" variant="optional" weight="regular">Idle: no submit yet.</mui-body>
|
|
1468
|
-
<mui-body
|
|
1493
|
+
<mui-body class="debug-payload-body" size="x-small" variant="optional" weight="regular">
|
|
1494
|
+
<span id="promptDebugPayload" class="debug-payload-text">{"event":"idle"}</span>
|
|
1495
|
+
</mui-body>
|
|
1469
1496
|
</mui-v-stack>
|
|
1470
1497
|
|
|
1471
1498
|
<mui-dialog
|
|
1472
1499
|
id="promptAutoPreviewDialog"
|
|
1473
1500
|
width="${s}"
|
|
1474
1501
|
content-padding="none"
|
|
1502
|
+
style="--dialog-border: var(--prompt-preview-dialog-border);"
|
|
1475
1503
|
>
|
|
1476
1504
|
<mui-heading id="promptAutoPreviewTitle" slot="title" size="5">Pasted Content</mui-heading>
|
|
1477
1505
|
<mui-code id="promptAutoPreviewCode" size="x-small" wrap hidden></mui-code>
|
|
@@ -159,7 +159,7 @@ class S extends HTMLElement {
|
|
|
159
159
|
}
|
|
160
160
|
render() {
|
|
161
161
|
if (!this.shadowRoot) return;
|
|
162
|
-
const e = this.getAttribute("value") || "", a = e.trim() || "Paste long content to preview it here.", t = this.getBadge(e), s = C("text", "spacing", "layout", "visual"), r = this.getAttribute("accent") || "var(--prompt-preview-accent, var(--surface-elevated-200))", i = this.getAttribute("bg-image") || "", n = this.getAttribute("image-tint") || r,
|
|
162
|
+
const e = this.getAttribute("value") || "", a = e.trim() || "Paste long content to preview it here.", t = this.getBadge(e), s = C("text", "spacing", "layout", "visual"), r = this.getAttribute("accent") || "var(--prompt-preview-accent, var(--surface-elevated-200))", i = this.getAttribute("bg-image") || "", n = this.getAttribute("image-tint") || r, u = i ? n : r, v = this.hasAttribute("inverted"), g = this.hasAttribute("badge-only") ? !1 : !i || this.hasAttribute("show-text"), d = (this.getAttribute("animation-mode") || "loop").toLowerCase(), h = (this.getAttribute("variant") || "").toLowerCase(), l = this.hasAttribute("loading"), b = (this.getAttribute("loading-label") || "Loading preview").trim(), w = (this.hasAttribute("animated") || !!i) && d !== "off", f = d === "once" ? "1" : "infinite", c = h === "overlay" || !!i, x = c ? "overlay" : "neutral", y = c ? "overlay" : "secondary", A = `dismiss-action${c ? "" : " dismiss-secondary"}`, k = this.hasAttribute("clickable") && !l, o = this.extractUrl(e), $ = !!(o && this.isImageUrl(o)), z = !!(o && !i && (t === "VIDEO" || t === "MUSIC")), I = o ? this.escapeHtml(o) : "", P = i.replace(/"/g, """), E = i ? `
|
|
163
163
|
linear-gradient(
|
|
164
164
|
180deg,
|
|
165
165
|
color-mix(in srgb, ${n} 42%, transparent 58%) 0%,
|
|
@@ -193,6 +193,10 @@ class S extends HTMLElement {
|
|
|
193
193
|
color-mix(in srgb, ${r} var(--prompt-preview-accent-mix-400), transparent) 0%,
|
|
194
194
|
color-mix(in srgb, ${r} var(--prompt-preview-accent-mix-500), transparent) 30%,
|
|
195
195
|
transparent 100%
|
|
196
|
+
),
|
|
197
|
+
linear-gradient(
|
|
198
|
+
var(--prompt-preview-background),
|
|
199
|
+
var(--prompt-preview-background)
|
|
196
200
|
)
|
|
197
201
|
`, L = `box${i ? " has-image" : ""}${c ? " variant-overlay" : ""}${v ? " inverted" : ""}`;
|
|
198
202
|
this.shadowRoot.innerHTML = /*html*/
|
|
@@ -216,17 +220,9 @@ class S extends HTMLElement {
|
|
|
216
220
|
.box {
|
|
217
221
|
position: relative;
|
|
218
222
|
border: var(--border-thin);
|
|
219
|
-
border-color: var(--form-default-border-color);
|
|
220
223
|
border-radius: var(--radius-200);
|
|
221
224
|
box-shadow:
|
|
222
|
-
var(--
|
|
223
|
-
0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-20),
|
|
224
|
-
inset 0 0 0 1px color-mix(in srgb, ${d} 12%, transparent 88%),
|
|
225
|
-
inset 0 calc(var(--space-050) * -1) var(--space-300) color-mix(in srgb, #000 12%, transparent 88%);
|
|
226
|
-
filter: var(
|
|
227
|
-
--prompt-preview-box-drop-shadow,
|
|
228
|
-
drop-shadow(0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-20))
|
|
229
|
-
);
|
|
225
|
+
0 var(--stroke-size-100) var(--stroke-size-200) var(--black-opacity-5);
|
|
230
226
|
background: ${E};
|
|
231
227
|
box-sizing: border-box;
|
|
232
228
|
width: 100%;
|
|
@@ -296,19 +292,11 @@ class S extends HTMLElement {
|
|
|
296
292
|
.box::before {
|
|
297
293
|
background: radial-gradient(
|
|
298
294
|
120% 80% at 50% -10%,
|
|
299
|
-
color-mix(in srgb, ${
|
|
295
|
+
color-mix(in srgb, ${u} 32%, transparent 68%) 0%,
|
|
300
296
|
transparent 70%
|
|
301
297
|
);
|
|
302
298
|
filter: blur(var(--space-050));
|
|
303
299
|
}
|
|
304
|
-
.box::after {
|
|
305
|
-
background: radial-gradient(
|
|
306
|
-
120% 90% at 50% 110%,
|
|
307
|
-
color-mix(in srgb, #000 14%, transparent 86%) 0%,
|
|
308
|
-
transparent 72%
|
|
309
|
-
);
|
|
310
|
-
filter: blur(var(--space-100));
|
|
311
|
-
}
|
|
312
300
|
.box.animated::before {
|
|
313
301
|
animation: previewPulse 2400ms ease-in-out var(--prompt-preview-iterations);
|
|
314
302
|
}
|
|
@@ -382,7 +370,7 @@ class S extends HTMLElement {
|
|
|
382
370
|
mui-badge {
|
|
383
371
|
position: absolute;
|
|
384
372
|
z-index: 3;
|
|
385
|
-
top: calc(var(--space-100) + var(--stroke-size-
|
|
373
|
+
top: calc(var(--space-100) + var(--stroke-size-200));
|
|
386
374
|
left: calc(var(--space-100) + var(--stroke-size-100));
|
|
387
375
|
|
|
388
376
|
}
|
|
@@ -504,12 +492,12 @@ class S extends HTMLElement {
|
|
|
504
492
|
<mui-button class="${A}" icon-only size="xx-small" variant="${y}" aria-label="Dismiss preview">
|
|
505
493
|
<mui-icon-close size="xx-small"></mui-icon-close>
|
|
506
494
|
</mui-button>
|
|
507
|
-
<mui-badge variant="${x}" size="
|
|
495
|
+
<mui-badge variant="${x}" size="xx-small">${t}</mui-badge>
|
|
508
496
|
<mui-v-stack class="inner${z ? " media-inline" : ""}" space="var(--space-025)" alignX="stretch">
|
|
509
497
|
${g ? $ && !i ? `<img class="snippet-image" src="${I}" alt="${this.escapeHtml(t)} preview image" />` : `<mui-body class="snippet" size="x-small" variant="optional">${o ? `${t === "VIDEO" ? '<span class="snippet-media-only"><mui-icon-play-rectangle class="snippet-media-icon" size="medium"></mui-icon-play-rectangle></span>' : t === "MUSIC" ? '<span class="snippet-media-only"><mui-icon-music-microphone class="snippet-media-icon" size="medium"></mui-icon-music-microphone></span>' : this.escapeHtml(a.slice(0, 260))}` : this.escapeHtml(a.slice(0, 260))}</mui-body>` : ""}
|
|
510
498
|
</mui-v-stack>
|
|
511
|
-
<div class="loading-overlay" aria-live="polite" aria-label="${this.escapeHtml(
|
|
512
|
-
<mui-spinner size="small" label="${this.escapeHtml(
|
|
499
|
+
<div class="loading-overlay" aria-live="polite" aria-label="${this.escapeHtml(b)}">
|
|
500
|
+
<mui-spinner size="small" label="${this.escapeHtml(b)}"></mui-spinner>
|
|
513
501
|
</div>
|
|
514
502
|
</div>
|
|
515
503
|
`;
|
|
@@ -6,41 +6,62 @@ class c extends HTMLElement {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super(), this.attachShadow({ mode: "open" });
|
|
8
8
|
}
|
|
9
|
+
get checked() {
|
|
10
|
+
var t;
|
|
11
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
12
|
+
return (e == null ? void 0 : e.checked) ?? this.hasAttribute("checked");
|
|
13
|
+
}
|
|
14
|
+
set checked(e) {
|
|
15
|
+
this.toggleAttribute("checked", !!e);
|
|
16
|
+
}
|
|
17
|
+
get value() {
|
|
18
|
+
var t;
|
|
19
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
20
|
+
return (e == null ? void 0 : e.value) ?? this.getAttribute("value") ?? "";
|
|
21
|
+
}
|
|
22
|
+
set value(e) {
|
|
23
|
+
this.setAttribute("value", e ?? "");
|
|
24
|
+
}
|
|
25
|
+
focus(e) {
|
|
26
|
+
var a;
|
|
27
|
+
const t = (a = this.shadowRoot) == null ? void 0 : a.querySelector("input");
|
|
28
|
+
t ? t.focus(e) : super.focus(e);
|
|
29
|
+
}
|
|
9
30
|
connectedCallback() {
|
|
10
31
|
this.hasAttribute("size") || this.setAttribute("size", "medium"), this.render(), this.setupListener();
|
|
11
32
|
}
|
|
12
33
|
disconnectedCallback() {
|
|
13
34
|
this.cleanupListeners();
|
|
14
35
|
}
|
|
15
|
-
attributeChangedCallback(e,
|
|
36
|
+
attributeChangedCallback(e, t, a) {
|
|
16
37
|
var r;
|
|
17
|
-
const
|
|
38
|
+
const i = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
|
|
18
39
|
if (e === "checked") {
|
|
19
|
-
|
|
40
|
+
i && (i.checked = a !== null);
|
|
20
41
|
return;
|
|
21
42
|
}
|
|
22
43
|
if (e === "disabled") {
|
|
23
|
-
|
|
44
|
+
i && (i.disabled = a !== null);
|
|
24
45
|
return;
|
|
25
46
|
}
|
|
26
47
|
["id", "name", "value", "aria-label", "size"].includes(e) && (this.render(), this.setupListener());
|
|
27
48
|
}
|
|
28
49
|
cleanupListeners() {
|
|
29
|
-
var
|
|
30
|
-
const e = (
|
|
50
|
+
var t;
|
|
51
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
31
52
|
e && this._changeHandler && e.removeEventListener("change", this._changeHandler);
|
|
32
53
|
}
|
|
33
54
|
setupListener() {
|
|
34
|
-
var
|
|
35
|
-
const e = (
|
|
55
|
+
var t;
|
|
56
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
36
57
|
e && (this.cleanupListeners(), this._changeHandler = (a) => {
|
|
37
|
-
const
|
|
38
|
-
|
|
58
|
+
const i = a.target;
|
|
59
|
+
i.checked ? this.setAttribute("checked", "") : this.removeAttribute("checked"), this.dispatchEvent(
|
|
39
60
|
new CustomEvent("change", {
|
|
40
61
|
detail: {
|
|
41
|
-
checked:
|
|
42
|
-
value:
|
|
43
|
-
name:
|
|
62
|
+
checked: i.checked,
|
|
63
|
+
value: i.value,
|
|
64
|
+
name: i.name
|
|
44
65
|
},
|
|
45
66
|
bubbles: !0,
|
|
46
67
|
composed: !0
|
|
@@ -49,7 +70,7 @@ class c extends HTMLElement {
|
|
|
49
70
|
}, e.addEventListener("change", this._changeHandler));
|
|
50
71
|
}
|
|
51
72
|
render() {
|
|
52
|
-
const e = this.getAttribute("id") || `mui-radio-${Math.random().toString(36).substr(2, 9)}`,
|
|
73
|
+
const e = this.getAttribute("id") || `mui-radio-${Math.random().toString(36).substr(2, 9)}`, t = this.getAttribute("name") || "", a = this.getAttribute("value") || "", i = this.hasAttribute("checked"), r = this.hasAttribute("disabled"), s = this.getAttribute("aria-label") || "", o = this.getAttribute("size") || "medium", d = ["x-small", "small", "medium", "large"].includes(o) ? o : "medium", l = this.innerHTML.trim().length > 0;
|
|
53
74
|
this.shadowRoot.innerHTML = /*html*/
|
|
54
75
|
`
|
|
55
76
|
<style>
|
|
@@ -141,11 +162,11 @@ class c extends HTMLElement {
|
|
|
141
162
|
<input
|
|
142
163
|
type="radio"
|
|
143
164
|
id="${e}"
|
|
144
|
-
name="${
|
|
165
|
+
name="${t}"
|
|
145
166
|
value="${a}"
|
|
146
|
-
${
|
|
167
|
+
${i ? "checked" : ""}
|
|
147
168
|
${r ? "disabled" : ""}
|
|
148
|
-
${
|
|
169
|
+
${s ? `aria-label="${s}"` : ""}
|
|
149
170
|
/>
|
|
150
171
|
${l ? `<mui-body size="${d === "x-small" || d === "small" ? "x-small" : "small"}"><slot></slot></mui-body>` : ""}
|
|
151
172
|
</label>
|
|
@@ -18,6 +18,11 @@ class u extends HTMLElement {
|
|
|
18
18
|
set value(e) {
|
|
19
19
|
this.setAttribute("value", String(Number.isFinite(e) ? e : 0));
|
|
20
20
|
}
|
|
21
|
+
focus(e) {
|
|
22
|
+
var r;
|
|
23
|
+
const t = (r = this.shadowRoot) == null ? void 0 : r.querySelector("input");
|
|
24
|
+
t ? t.focus(e) : super.focus(e);
|
|
25
|
+
}
|
|
21
26
|
getThumbSize() {
|
|
22
27
|
return Number(this.getAttribute("thumb-size") || "16");
|
|
23
28
|
}
|
|
@@ -32,8 +37,8 @@ class u extends HTMLElement {
|
|
|
32
37
|
if (!this.shadowRoot) return;
|
|
33
38
|
const e = this.shadowRoot.querySelector("input"), t = this.shadowRoot.querySelector('[data-role="bubble"]');
|
|
34
39
|
if (!e || !t) return;
|
|
35
|
-
const r = Number(e.min || "0"), a = Number(e.max || "0"), i = Number(e.value || "0"),
|
|
36
|
-
t.textContent = this.formatBubble(i), t.style.left = `calc(${
|
|
40
|
+
const r = Number(e.min || "0"), a = Number(e.max || "0"), i = Number(e.value || "0"), s = Math.max(0, a - r), o = s > 0 ? Math.max(0, Math.min(1, (i - r) / s)) : 0, n = this.getThumbSize();
|
|
41
|
+
t.textContent = this.formatBubble(i), t.style.left = `calc(${o * 100}% - ${(o - 0.5) * n}px)`;
|
|
37
42
|
}
|
|
38
43
|
bind() {
|
|
39
44
|
if (!this.shadowRoot) return;
|
|
@@ -64,7 +69,7 @@ class u extends HTMLElement {
|
|
|
64
69
|
}
|
|
65
70
|
render() {
|
|
66
71
|
if (!this.shadowRoot) return;
|
|
67
|
-
const e = this.getAttribute("min") || "0", t = this.getAttribute("max") || "100", r = this.getAttribute("value") || "0", a = this.getAttribute("step") || "1", i = this.hasAttribute("disabled"),
|
|
72
|
+
const e = this.getAttribute("min") || "0", t = this.getAttribute("max") || "100", r = this.getAttribute("value") || "0", a = this.getAttribute("step") || "1", i = this.hasAttribute("disabled"), s = this.getAttribute("label") || "Range input";
|
|
68
73
|
this.shadowRoot.innerHTML = /*html*/
|
|
69
74
|
`
|
|
70
75
|
<style>
|
|
@@ -111,7 +116,7 @@ class u extends HTMLElement {
|
|
|
111
116
|
max="${t}"
|
|
112
117
|
value="${r}"
|
|
113
118
|
step="${a}"
|
|
114
|
-
aria-label="${
|
|
119
|
+
aria-label="${s.replace(/"/g, """)}"
|
|
115
120
|
${i ? "disabled" : ""}
|
|
116
121
|
/>
|
|
117
122
|
<mui-body data-role="bubble" size="x-small" variant="optional" aria-hidden="true">0</mui-body>
|