@muibook/components 19.6.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 +53 -2
- package/dist/esm/agent/keywords/index.js +2 -173
- package/dist/esm/agent/prompts/index.js +6 -432
- package/dist/esm/components/mui-accordion/core/index.js +25 -17
- package/dist/esm/components/mui-addon/index.js +14 -14
- package/dist/esm/components/mui-avatar/index.js +103 -43
- 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 +37 -20
- package/dist/esm/components/mui-body/index.js +20 -11
- package/dist/esm/components/mui-button/index.js +265 -78
- package/dist/esm/components/mui-calendar/index.js +199 -0
- package/dist/esm/components/mui-card/body/index.js +33 -18
- 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 +219 -73
- package/dist/esm/components/mui-chip-input/index.js +146 -137
- package/dist/esm/components/mui-chip-rail/index.js +342 -0
- package/dist/esm/components/mui-code/index.js +26 -7
- 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 +255 -59
- package/dist/esm/components/mui-field/index.js +1 -1
- package/dist/esm/components/mui-file-upload/index.js +14 -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-heading/index.js +3 -2
- 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 +96 -67
- package/dist/esm/components/mui-link/index.js +352 -96
- package/dist/esm/components/mui-media-player/index.js +1577 -83
- package/dist/esm/components/mui-message/index.js +7 -6
- 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 +143 -115
- 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 +235 -46
- 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-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 +37 -26
- 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-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-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 +205 -0
- package/dist/esm/css/mui-brand.css +12 -8
- package/dist/esm/css/mui-tokens.css +646 -344
- package/dist/esm/css/readme.md +2 -2
- package/dist/esm/custom-elements.json +4506 -1707
- package/dist/esm/dynamic-attrs.json +271 -54
- package/dist/esm/index.js +33 -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 +6 -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/api.d.ts +4 -0
- package/dist/types/components/mui-chip-input/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 +4 -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-link/api.d.ts +4 -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-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-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/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 +27 -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 +131 -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
|
@@ -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
|
-
[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,38 +48,38 @@ 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, 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
|
+
if (!v && !a) return;
|
|
53
|
+
(v || b) && e.preventDefault();
|
|
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
|
-
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:
|
|
80
|
-
textBadge: (l == null ? void 0 : l.badge) ||
|
|
78
|
+
items: n,
|
|
79
|
+
text: s || "",
|
|
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;
|
|
@@ -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 = () => {
|
|
@@ -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",
|
|
@@ -183,17 +184,17 @@ class S extends HTMLElement {
|
|
|
183
184
|
}
|
|
184
185
|
setDebugState(t, e) {
|
|
185
186
|
if (!this.shadowRoot) return;
|
|
186
|
-
const o = this.shadowRoot.querySelector(".debug-region"), r = this.shadowRoot.querySelector("#promptDebugStatus"),
|
|
187
|
-
if (!o || !r || !
|
|
187
|
+
const o = this.shadowRoot.querySelector(".debug-region"), r = this.shadowRoot.querySelector("#promptDebugStatus"), s = this.shadowRoot.querySelector("#promptDebugPayload");
|
|
188
|
+
if (!o || !r || !s) return;
|
|
188
189
|
const i = this.hasAttribute("debug");
|
|
189
|
-
o.toggleAttribute("hidden", !i), i && (r.textContent = t, e && (this.lastDebugPayload = JSON.stringify(e)),
|
|
190
|
+
o.toggleAttribute("hidden", !i), i && (r.textContent = t, e && (this.lastDebugPayload = JSON.stringify(e)), s.textContent = this.lastDebugPayload);
|
|
190
191
|
}
|
|
191
192
|
emitPromptItems({
|
|
192
193
|
items: t,
|
|
193
194
|
text: e,
|
|
194
195
|
textBadge: o,
|
|
195
196
|
overflowed: r,
|
|
196
|
-
thresholdChars:
|
|
197
|
+
thresholdChars: s,
|
|
197
198
|
source: i
|
|
198
199
|
}) {
|
|
199
200
|
this.dispatchEvent(
|
|
@@ -204,7 +205,7 @@ class S extends HTMLElement {
|
|
|
204
205
|
text: e,
|
|
205
206
|
textBadge: o,
|
|
206
207
|
overflowed: r,
|
|
207
|
-
thresholdChars:
|
|
208
|
+
thresholdChars: s,
|
|
208
209
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
209
210
|
},
|
|
210
211
|
bubbles: !0,
|
|
@@ -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
|
});
|
|
@@ -286,9 +285,9 @@ class S extends HTMLElement {
|
|
|
286
285
|
return;
|
|
287
286
|
}
|
|
288
287
|
if (t === "context-mode") {
|
|
289
|
-
const
|
|
290
|
-
if (o !==
|
|
291
|
-
this.setAttribute("context-mode",
|
|
288
|
+
const s = this.normalizeContextMode(o);
|
|
289
|
+
if (o !== s) {
|
|
290
|
+
this.setAttribute("context-mode", s);
|
|
292
291
|
return;
|
|
293
292
|
}
|
|
294
293
|
this.syncContextModeUI(), this.updateActionsLayout();
|
|
@@ -434,10 +433,10 @@ 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),
|
|
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
|
|
440
|
-
t.style.height = `${Math.ceil(
|
|
438
|
+
const v = t.scrollHeight, n = Math.max(u, Math.min(v, b));
|
|
439
|
+
t.style.height = `${Math.ceil(n)}px`, t.style.overflowY = v > b ? "auto" : "hidden";
|
|
441
440
|
}
|
|
442
441
|
detectBadge(t) {
|
|
443
442
|
const e = t.trim();
|
|
@@ -476,7 +475,7 @@ class S extends HTMLElement {
|
|
|
476
475
|
const o = e.match(/https?:\/\/[^\s]+/i), r = ((o == null ? void 0 : o[0]) || e).trim();
|
|
477
476
|
if (!/^https?:\/\//i.test(r)) return null;
|
|
478
477
|
try {
|
|
479
|
-
const
|
|
478
|
+
const s = new URL(r), i = s.pathname.toLowerCase(), a = s.hostname.toLowerCase();
|
|
480
479
|
if (/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/.test(i))
|
|
481
480
|
return { url: r, kind: "image", badge: "IMG", mimeType: "image/*" };
|
|
482
481
|
if (a === "youtu.be" || a.endsWith("youtube.com") || a.endsWith("youtube-nocookie.com"))
|
|
@@ -495,13 +494,13 @@ class S extends HTMLElement {
|
|
|
495
494
|
return null;
|
|
496
495
|
}
|
|
497
496
|
bindEvents() {
|
|
498
|
-
var
|
|
497
|
+
var s;
|
|
499
498
|
if (!this.shadowRoot) return;
|
|
500
499
|
this.unbindEvents();
|
|
501
500
|
const t = this.shadowRoot.querySelector("textarea");
|
|
502
501
|
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
502
|
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" && ((
|
|
503
|
+
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
504
|
childList: !0,
|
|
506
505
|
subtree: !0,
|
|
507
506
|
attributes: !0,
|
|
@@ -509,10 +508,10 @@ class S extends HTMLElement {
|
|
|
509
508
|
})), 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
509
|
}
|
|
511
510
|
unbindEvents() {
|
|
512
|
-
var
|
|
511
|
+
var s, i, a, l;
|
|
513
512
|
if (!this.shadowRoot) return;
|
|
514
513
|
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), (
|
|
514
|
+
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
515
|
}
|
|
517
516
|
bindPreviewOverflow() {
|
|
518
517
|
var t, e;
|
|
@@ -539,27 +538,27 @@ class S extends HTMLElement {
|
|
|
539
538
|
});
|
|
540
539
|
return;
|
|
541
540
|
}
|
|
542
|
-
const
|
|
541
|
+
const s = e === "auto" ? this.hasAttribute("loading") : !0;
|
|
543
542
|
r.forEach((a) => {
|
|
544
|
-
a.tagName.toLowerCase() === "mui-prompt-preview" && (
|
|
543
|
+
a.tagName.toLowerCase() === "mui-prompt-preview" && (s ? a.setAttribute("loading", "") : a.removeAttribute("loading"), o && a.setAttribute("loading-label", o));
|
|
545
544
|
});
|
|
546
545
|
}
|
|
547
546
|
normalizePreviewDetail(t) {
|
|
548
|
-
const e = String(t.value || "").trim(), o = String(t.bgImage || "").trim(), r = String(t.badge || "").trim(),
|
|
547
|
+
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
548
|
return {
|
|
550
549
|
id: String(t.id || ""),
|
|
551
550
|
value: e,
|
|
552
551
|
badge: r || (o ? "IMG" : this.detectBadge(e)),
|
|
553
|
-
label:
|
|
552
|
+
label: s,
|
|
554
553
|
bgImage: o,
|
|
555
554
|
imageTint: i,
|
|
556
555
|
type: a
|
|
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"),
|
|
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 = (() => {
|
|
563
562
|
if (!u || u.kind !== "audio") return !1;
|
|
564
563
|
try {
|
|
565
564
|
const g = new URL(u.url);
|
|
@@ -568,25 +567,25 @@ class S extends HTMLElement {
|
|
|
568
567
|
return !1;
|
|
569
568
|
}
|
|
570
569
|
})(), w = (() => {
|
|
571
|
-
if (!u || !
|
|
570
|
+
if (!u || !f) return "";
|
|
572
571
|
try {
|
|
573
|
-
const
|
|
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 (!(!
|
|
580
|
-
if (this.setAttribute("preview-dialog-value", p), this.setAttribute("preview-dialog-image",
|
|
581
|
-
a && a.setAttribute("hidden", ""),
|
|
582
|
-
else if (
|
|
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 g =
|
|
583
|
+
const g = f;
|
|
585
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", u.url), i.removeAttribute("type"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""),
|
|
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() {
|
|
@@ -609,9 +608,9 @@ class S extends HTMLElement {
|
|
|
609
608
|
e && (e.setAttribute("hidden", ""), e.style.display = "none");
|
|
610
609
|
return;
|
|
611
610
|
}
|
|
612
|
-
const
|
|
613
|
-
e && (e.toggleAttribute("hidden",
|
|
614
|
-
const i =
|
|
611
|
+
const s = o.length === 1 && this.isContextOnlyAction(o[0]);
|
|
612
|
+
e && (e.toggleAttribute("hidden", s), e.style.display = s ? "none" : "inline-flex");
|
|
613
|
+
const i = s || !r ? null : e;
|
|
615
614
|
i && (this.triggerEl = i, this.triggerEl.addEventListener("click", this.toggleFanOpen), this.syncTriggerIconState());
|
|
616
615
|
}
|
|
617
616
|
syncTriggerIconState() {
|
|
@@ -636,74 +635,75 @@ class S extends HTMLElement {
|
|
|
636
635
|
const t = this.shadowRoot.querySelector('slot[name="actions"]'), e = this.shadowRoot.querySelector("#promptDefaultActionsTrigger");
|
|
637
636
|
if (!t) return;
|
|
638
637
|
const o = t.assignedElements({ flatten: !0 }).filter(
|
|
639
|
-
(
|
|
640
|
-
), r = o.length > 0,
|
|
641
|
-
|
|
638
|
+
(n) => !n.hasAttribute("hidden")
|
|
639
|
+
), r = o.length > 0, s = this.shadowRoot.querySelector(".actions-slot-left");
|
|
640
|
+
s && (s.style.display = r ? "inline-flex" : "none");
|
|
642
641
|
const i = o.length === 1 && this.isContextOnlyAction(o[0]);
|
|
643
642
|
if (e) {
|
|
644
|
-
const
|
|
645
|
-
e.toggleAttribute("hidden",
|
|
643
|
+
const n = !r || i;
|
|
644
|
+
e.toggleAttribute("hidden", n), e.style.display = n ? "none" : "inline-flex";
|
|
646
645
|
}
|
|
647
|
-
const a = i || !r ? null : e, l = o.filter((
|
|
648
|
-
this.toggleAttribute("has-actions", r), this.toggleAttribute("has-extra-actions",
|
|
649
|
-
const u = r || this.hasTruthyFlagAttribute("actions-fan"), b = this.hasAttribute("fan-open"),
|
|
650
|
-
this.enforceActionVariants(),
|
|
651
|
-
|
|
652
|
-
const
|
|
653
|
-
if (
|
|
654
|
-
this.setFanItemInert(
|
|
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) => {
|
|
650
|
+
n.style.transition = `transform ${v}ms ease, opacity ${v}ms ease`, n.style.zIndex = "";
|
|
651
|
+
const f = this.fanAnimations.get(n);
|
|
652
|
+
if (f && (f.cancel(), this.fanAnimations.delete(n)), !u) {
|
|
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 (
|
|
658
|
-
this.setFanItemInert(
|
|
656
|
+
if (d === 0) {
|
|
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
|
}
|
|
661
660
|
if (!b) {
|
|
662
|
-
this.setFanItemInert(
|
|
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
|
-
|
|
667
|
-
if (
|
|
668
|
-
|
|
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) {
|
|
667
|
+
n.style.pointerEvents = "", this.setFanItemInert(n, !1);
|
|
669
668
|
return;
|
|
670
669
|
}
|
|
671
|
-
const A =
|
|
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
|
-
duration:
|
|
680
|
-
delay:
|
|
678
|
+
duration: v + 180,
|
|
679
|
+
delay: y,
|
|
681
680
|
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
682
681
|
fill: "forwards"
|
|
683
682
|
}
|
|
684
683
|
);
|
|
685
|
-
this.fanAnimations.set(
|
|
684
|
+
this.fanAnimations.set(n, A), A.finished.catch(() => {
|
|
686
685
|
}).finally(() => {
|
|
687
|
-
|
|
686
|
+
n.style.pointerEvents = "", this.setFanItemInert(n, !1);
|
|
688
687
|
});
|
|
689
688
|
});
|
|
690
|
-
}),
|
|
691
|
-
|
|
689
|
+
}), m.forEach((n) => {
|
|
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"),
|
|
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
|
-
width="${
|
|
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
|
`;
|