@muibook/components 10.0.1 → 11.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/LICENSE +27 -11
- package/README.md +4 -0
- package/dist/esm/components/mui-accordion/block/index.js +9 -5
- package/dist/esm/components/mui-alert/index.js +88 -52
- package/dist/esm/components/mui-badge/index.js +61 -16
- package/dist/esm/components/mui-body/index.js +76 -10
- package/dist/esm/components/mui-button/index.js +152 -32
- package/dist/esm/components/mui-card/card/index.js +13 -8
- package/dist/esm/components/mui-checkbox/index.js +64 -30
- package/dist/esm/components/mui-chip/index.js +153 -33
- package/dist/esm/components/mui-chip-input/index.js +407 -0
- package/dist/esm/components/mui-code/index.js +11 -9
- package/dist/esm/components/mui-dialog/index.js +17 -8
- package/dist/esm/components/mui-dropdown/index.js +44 -44
- package/dist/esm/components/mui-field/index.js +56 -21
- package/dist/esm/components/mui-form-group/index.js +88 -0
- package/dist/esm/components/mui-form-hint/index.js +1 -0
- package/dist/esm/components/mui-form-message/index.js +72 -0
- package/dist/esm/components/mui-form-section/index.js +108 -0
- package/dist/esm/components/mui-form-section-footer/index.js +46 -0
- package/dist/esm/components/mui-hint/index.js +146 -0
- package/dist/esm/components/mui-icons/accessibility/index.js +5 -4
- package/dist/esm/components/mui-icons/add/index.js +1 -0
- package/dist/esm/components/mui-icons/ai/index.js +5 -4
- package/dist/esm/components/mui-icons/attention/index.js +1 -0
- package/dist/esm/components/mui-icons/calendar/index.js +5 -4
- package/dist/esm/components/mui-icons/check/index.js +6 -5
- package/dist/esm/components/mui-icons/checkmark/index.js +9 -8
- package/dist/esm/components/mui-icons/close/index.js +6 -5
- package/dist/esm/components/mui-icons/down-arrow-circle/index.js +9 -8
- package/dist/esm/components/mui-icons/down-chevron/index.js +8 -7
- package/dist/esm/components/mui-icons/ellipsis/index.js +1 -0
- package/dist/esm/components/mui-icons/exclamationmark/index.js +49 -0
- package/dist/esm/components/mui-icons/game-controller/index.js +8 -7
- package/dist/esm/components/mui-icons/gear/index.js +5 -4
- package/dist/esm/components/mui-icons/globe/index.js +8 -7
- package/dist/esm/components/mui-icons/grid/index.js +1 -0
- package/dist/esm/components/mui-icons/home/index.js +9 -8
- package/dist/esm/components/mui-icons/index.js +3 -0
- package/dist/esm/components/mui-icons/info/index.js +3 -2
- package/dist/esm/components/mui-icons/left-arrow/index.js +1 -0
- package/dist/esm/components/mui-icons/left-chevron/index.js +6 -5
- package/dist/esm/components/mui-icons/left-sidebar/index.js +6 -5
- package/dist/esm/components/mui-icons/list-and-film/index.js +1 -0
- package/dist/esm/components/mui-icons/menu/index.js +8 -7
- package/dist/esm/components/mui-icons/message/index.js +5 -4
- package/dist/esm/components/mui-icons/moon/index.js +3 -2
- package/dist/esm/components/mui-icons/movie-clapper/index.js +5 -4
- package/dist/esm/components/mui-icons/music-microphone/index.js +6 -5
- package/dist/esm/components/mui-icons/music-quarter-note/index.js +1 -0
- package/dist/esm/components/mui-icons/notification/index.js +5 -4
- package/dist/esm/components/mui-icons/pin/index.js +3 -2
- package/dist/esm/components/mui-icons/pin-slash/index.js +6 -5
- package/dist/esm/components/mui-icons/play-rectangle/index.js +9 -8
- package/dist/esm/components/mui-icons/play-stack/index.js +5 -4
- package/dist/esm/components/mui-icons/rectangle/index.js +6 -5
- package/dist/esm/components/mui-icons/rectangle-bottom-panel/index.js +1 -0
- package/dist/esm/components/mui-icons/rectangle-dashed/index.js +1 -0
- package/dist/esm/components/mui-icons/rectangle-left-drawer/index.js +1 -0
- package/dist/esm/components/mui-icons/rectangle-media-text/index.js +6 -5
- package/dist/esm/components/mui-icons/right-chevron/index.js +1 -0
- package/dist/esm/components/mui-icons/search/index.js +6 -5
- package/dist/esm/components/mui-icons/spinner/index.js +56 -0
- package/dist/esm/components/mui-icons/stop/index.js +3 -2
- package/dist/esm/components/mui-icons/subtract/index.js +1 -0
- package/dist/esm/components/mui-icons/sun/index.js +1 -0
- package/dist/esm/components/mui-icons/text-below-folder/index.js +55 -0
- package/dist/esm/components/mui-icons/toggle/index.js +8 -6
- package/dist/esm/components/mui-icons/translate/index.js +5 -4
- package/dist/esm/components/mui-icons/up-arrow/index.js +5 -4
- package/dist/esm/components/mui-icons/up-chevron/index.js +6 -5
- package/dist/esm/components/mui-icons/warning/index.js +7 -6
- package/dist/esm/components/mui-input/index.js +298 -47
- package/dist/esm/components/mui-link/index.js +187 -59
- package/dist/esm/components/mui-list/item/index.js +3 -0
- package/dist/esm/components/mui-markdown/index.js +149 -0
- package/dist/esm/components/mui-media-player/index.js +184 -0
- package/dist/esm/components/mui-message/index.js +50 -20
- package/dist/esm/components/mui-progress/index.js +15 -15
- package/dist/esm/components/mui-prompt/index.js +1461 -0
- package/dist/esm/components/mui-prompt-message/index.js +114 -0
- package/dist/esm/components/mui-prompt-preview/index.js +497 -0
- package/dist/esm/components/mui-prompt-toggle/index.js +48 -0
- package/dist/esm/components/mui-radio/index.js +155 -0
- package/dist/esm/components/mui-radio-group/index.js +104 -0
- package/dist/esm/components/mui-range-input/index.js +122 -0
- package/dist/esm/components/mui-rule/index.js +11 -3
- package/dist/esm/components/mui-select/index.js +89 -30
- package/dist/esm/components/mui-spinner/index.js +70 -0
- package/dist/esm/components/mui-stepper/step/index.js +255 -18
- package/dist/esm/components/mui-stepper/stepper/index.js +68 -72
- package/dist/esm/components/mui-table/row/index.js +16 -3
- package/dist/esm/components/mui-tabs/controller/index.js +21 -14
- package/dist/esm/components/mui-tabs/item/index.js +285 -29
- package/dist/esm/components/mui-tabs/panel/index.js +3 -0
- package/dist/esm/components/mui-tabs/tab-bar/index.js +85 -34
- package/dist/esm/components/mui-textarea/index.js +257 -0
- package/dist/esm/css/mui-base.css +27 -0
- package/dist/esm/css/mui-brand.css +3 -1
- package/dist/esm/css/mui-tokens.css +234 -7
- package/dist/esm/custom-elements.json +5113 -1702
- package/dist/esm/index.js +24 -4
- package/dist/esm/tokens/js/index.js +107 -105
- package/dist/types/components/mui-agent-bubble/doc.d.ts +2 -0
- package/dist/types/components/mui-agent-bubble/index.d.ts +1 -0
- package/dist/types/components/mui-agent-prompt/doc.d.ts +2 -0
- package/dist/types/components/mui-agent-prompt/index.d.ts +1 -0
- package/dist/types/components/mui-chip-input/doc.d.ts +2 -0
- package/dist/types/components/mui-chip-input/index.d.ts +3 -0
- package/dist/types/components/mui-form-group/doc.d.ts +2 -0
- package/dist/types/components/mui-form-group/index.d.ts +2 -0
- package/dist/types/components/mui-form-group-horizontal/index.d.ts +1 -0
- package/dist/types/components/mui-form-hint/doc.d.ts +2 -0
- package/dist/types/components/mui-form-hint/index.d.ts +1 -0
- package/dist/types/components/mui-form-message/index.d.ts +2 -0
- package/dist/types/components/mui-form-section/doc.d.ts +2 -0
- package/dist/types/components/mui-form-section/index.d.ts +1 -0
- package/dist/types/components/mui-form-section-footer/doc.d.ts +2 -0
- package/dist/types/components/mui-form-section-footer/index.d.ts +1 -0
- package/dist/types/components/mui-hint/doc.d.ts +2 -0
- package/dist/types/components/mui-hint/index.d.ts +1 -0
- package/dist/types/components/mui-icons/exclamationmark.d.ts +1 -0
- package/dist/types/components/mui-icons/index.d.ts +3 -0
- package/dist/types/components/mui-icons/spinner.d.ts +1 -0
- package/dist/types/components/mui-icons/text-below-folder.d.ts +1 -0
- package/dist/types/components/mui-markdown/doc.d.ts +2 -0
- package/dist/types/components/mui-markdown/index.d.ts +1 -0
- package/dist/types/components/mui-media-player/doc.d.ts +2 -0
- package/dist/types/components/mui-media-player/index.d.ts +8 -0
- package/dist/types/components/mui-prompt/doc.d.ts +2 -0
- package/dist/types/components/mui-prompt/index.d.ts +18 -0
- package/dist/types/components/mui-prompt-chip/index.d.ts +1 -0
- package/dist/types/components/mui-prompt-message/doc.d.ts +2 -0
- package/dist/types/components/mui-prompt-message/index.d.ts +1 -0
- package/dist/types/components/mui-prompt-preview/doc.d.ts +2 -0
- package/dist/types/components/mui-prompt-preview/index.d.ts +7 -0
- package/dist/types/components/mui-prompt-toggle/index.d.ts +1 -0
- package/dist/types/components/mui-radio/doc.d.ts +2 -0
- package/dist/types/components/mui-radio/index.d.ts +1 -0
- package/dist/types/components/mui-radio-group/index.d.ts +1 -0
- package/dist/types/components/mui-range-input/doc.d.ts +2 -0
- package/dist/types/components/mui-range-input/index.d.ts +1 -0
- package/dist/types/components/mui-spinner/doc.d.ts +2 -0
- package/dist/types/components/mui-spinner/index.d.ts +1 -0
- package/dist/types/components/mui-stepper/step/index.d.ts +4 -1
- package/dist/types/components/mui-textarea/doc.d.ts +2 -0
- package/dist/types/components/mui-textarea/index.d.ts +1 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/tokens/js/index.d.ts +2 -0
- package/package.json +88 -1
|
@@ -0,0 +1,1461 @@
|
|
|
1
|
+
import "../mui-stack/hstack/index.js";
|
|
2
|
+
import "../mui-stack/vstack/index.js";
|
|
3
|
+
import "../mui-dialog/index.js";
|
|
4
|
+
import "../mui-heading/index.js";
|
|
5
|
+
import "../mui-code/index.js";
|
|
6
|
+
import "../mui-media-player/index.js";
|
|
7
|
+
import "../mui-button/index.js";
|
|
8
|
+
import "../mui-body/index.js";
|
|
9
|
+
import "../mui-link/index.js";
|
|
10
|
+
import "../mui-spinner/index.js";
|
|
11
|
+
import "../mui-icons/grid/index.js";
|
|
12
|
+
import "../mui-icons/close/index.js";
|
|
13
|
+
import "../mui-icons/toggle/index.js";
|
|
14
|
+
import "../mui-icons/up-arrow/index.js";
|
|
15
|
+
import "../mui-icons/stop/index.js";
|
|
16
|
+
import "../mui-icons/attention/index.js";
|
|
17
|
+
import "../mui-rule/index.js";
|
|
18
|
+
import "../mui-prompt-toggle/index.js";
|
|
19
|
+
class k extends HTMLElement {
|
|
20
|
+
constructor() {
|
|
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.enforceActionVariants = () => {
|
|
22
|
+
if (!this.shadowRoot) return;
|
|
23
|
+
const e = Array.from(this.shadowRoot.querySelectorAll('slot[name="actions"], slot[name="actions-trigger"], slot[name="actions-right"]')), o = (r, a) => {
|
|
24
|
+
if (!a || r.tagName.toLowerCase() !== "mui-button") return;
|
|
25
|
+
if (r.hasAttribute("icon-only")) {
|
|
26
|
+
r.style.marginRight = "var(--space-025)";
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
r.style.marginRight === "var(--space-025)" && (r.style.marginRight = "");
|
|
30
|
+
};
|
|
31
|
+
e.forEach((r) => {
|
|
32
|
+
const a = r.name === "actions";
|
|
33
|
+
r.assignedElements({ flatten: !0 }).forEach((s) => {
|
|
34
|
+
[s, ...Array.from(s.querySelectorAll("*"))].forEach((c) => {
|
|
35
|
+
const u = c.tagName.toLowerCase();
|
|
36
|
+
if (u === "mui-button") {
|
|
37
|
+
c.setAttribute("variant", "tertiary"), o(c, a);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
u === "mui-dropdown" && c.querySelectorAll('[slot="action"]').forEach((h) => {
|
|
41
|
+
h instanceof HTMLElement && h.tagName.toLowerCase() === "mui-button" && (h.setAttribute("variant", "tertiary"), o(h, a));
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}, this.onDefaultSubmitClick = (t) => {
|
|
47
|
+
t.preventDefault(), t.stopPropagation(), !this.hasAttribute("disabled") && this.submit("api");
|
|
48
|
+
}, this.onPaste = (t) => {
|
|
49
|
+
const e = t, o = e.clipboardData;
|
|
50
|
+
if (!o) return;
|
|
51
|
+
const r = Array.from(o.files || []), a = o.getData("text/plain") || "", i = a.trim(), s = i.length > 0, l = s ? this.detectMediaUrl(i) : null, c = this.getAttribute("preview-overflow-to-preview") !== "false", u = this.getAttribute("preview-threshold-chars"), p = Number.isFinite(Number.parseInt(u || "", 10)) ? Math.max(1, Number.parseInt(u || "", 10)) : 220, h = s ? this.detectBadge(i) : "", m = h !== "" && h !== "Insightful", b = c && s && (!!(l != null && l.url) || i.length >= p || m), g = r.length > 0;
|
|
52
|
+
if (!g && !s) return;
|
|
53
|
+
(g || b) && e.preventDefault();
|
|
54
|
+
const v = 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
|
+
}));
|
|
64
|
+
b && i && (l != null && l.url ? v.unshift({
|
|
65
|
+
kind: l.kind === "image" ? "image" : "text",
|
|
66
|
+
mimeType: l.mimeType,
|
|
67
|
+
badge: l.badge,
|
|
68
|
+
preview: l.url,
|
|
69
|
+
value: l.url
|
|
70
|
+
}) : v.unshift({
|
|
71
|
+
kind: "text",
|
|
72
|
+
mimeType: "text/plain",
|
|
73
|
+
badge: this.detectBadge(i),
|
|
74
|
+
preview: i.slice(0, 260),
|
|
75
|
+
value: a
|
|
76
|
+
})), this.emitPromptItems({
|
|
77
|
+
source: "paste",
|
|
78
|
+
items: v,
|
|
79
|
+
text: a || "",
|
|
80
|
+
textBadge: (l == null ? void 0 : l.badge) || h,
|
|
81
|
+
overflowed: b,
|
|
82
|
+
thresholdChars: p
|
|
83
|
+
});
|
|
84
|
+
}, this.onInput = (t) => {
|
|
85
|
+
const e = t.target;
|
|
86
|
+
!e || e.tagName !== "TEXTAREA" || (this.syncTextareaHeight(e), this.hasAttribute("has-error") && !this.hasAttribute("persist-message") && this.clearError("input"), this.getAttribute("value") !== e.value && this.setAttribute("value", e.value), this.dispatchEvent(
|
|
87
|
+
new CustomEvent("input", {
|
|
88
|
+
detail: { value: e.value },
|
|
89
|
+
bubbles: !0,
|
|
90
|
+
composed: !0
|
|
91
|
+
})
|
|
92
|
+
));
|
|
93
|
+
}, this.onTextareaFocus = () => {
|
|
94
|
+
this.hasAttribute("persist-message") || this.clearError("focus");
|
|
95
|
+
}, this.onKeyDown = (t) => {
|
|
96
|
+
const e = t;
|
|
97
|
+
if (e.key === "Escape") {
|
|
98
|
+
this.hasAttribute("fan-open") && (this.removeAttribute("fan-open"), this.updateActionsLayout()), this.dispatchEvent(
|
|
99
|
+
new CustomEvent("escape", {
|
|
100
|
+
detail: { value: this.getValue() },
|
|
101
|
+
bubbles: !0,
|
|
102
|
+
composed: !0
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this.getAttribute("enter-submit") !== "false" && (e.key !== "Enter" || e.shiftKey || e.isComposing || this.hasAttribute("disabled") || (e.preventDefault(), this.submit("keyboard")));
|
|
108
|
+
}, this.onPreviewScroll = () => {
|
|
109
|
+
this.syncPreviewEdgeShadows();
|
|
110
|
+
}, this.onPreviewSlotChange = () => {
|
|
111
|
+
this.syncPreviewVisibility(), this.syncPreviewEdgeShadows();
|
|
112
|
+
}, this.onPreviewOpen = (t) => {
|
|
113
|
+
const e = t, o = this.normalizePreviewDetail(e.detail || {});
|
|
114
|
+
this.openInternalPreviewDialog(o);
|
|
115
|
+
}, this.onContextToggleClick = (t) => {
|
|
116
|
+
const e = t.composedPath();
|
|
117
|
+
if (e.some((i) => {
|
|
118
|
+
if (!(i instanceof HTMLElement)) return !1;
|
|
119
|
+
const s = i.tagName.toLowerCase();
|
|
120
|
+
return s === "textarea" || s === "input" || i.isContentEditable;
|
|
121
|
+
})) return;
|
|
122
|
+
if (e.find((i) => {
|
|
123
|
+
var s;
|
|
124
|
+
return i instanceof HTMLElement && ((s = i.hasAttribute) == null ? void 0 : s.call(i, "context-close"));
|
|
125
|
+
})) {
|
|
126
|
+
this.setContextMode("icon", "dismiss"), this.updateActionsLayout();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
e.find(
|
|
130
|
+
(i) => {
|
|
131
|
+
var s, l;
|
|
132
|
+
return i instanceof HTMLElement && (((s = i.hasAttribute) == null ? void 0 : s.call(i, "context-toggle")) || ((l = i.getAttribute) == null ? void 0 : l.call(i, "slot")) === "toggle");
|
|
133
|
+
}
|
|
134
|
+
) && (this.setContextMode("chip", "click"), this.updateActionsLayout());
|
|
135
|
+
}, this.onContextChipDismiss = (t) => {
|
|
136
|
+
t.composedPath().find(
|
|
137
|
+
(r) => {
|
|
138
|
+
var a, i, s;
|
|
139
|
+
return r instanceof HTMLElement && (((a = r.hasAttribute) == null ? void 0 : a.call(r, "context-active")) || ((i = r.hasAttribute) == null ? void 0 : i.call(r, "context-chip")) || ((s = r.hasAttribute) == null ? void 0 : s.call(r, "context-spinner")));
|
|
140
|
+
}
|
|
141
|
+
) && (this.setContextMode("icon", "dismiss"), this.updateActionsLayout());
|
|
142
|
+
}, this.toggleFanOpen = () => {
|
|
143
|
+
this.hasAttribute("actions-fan") && (this.toggleAttribute("fan-open"), this.updateActionsLayout());
|
|
144
|
+
}, this.attachShadow({ mode: "open" });
|
|
145
|
+
}
|
|
146
|
+
static get observedAttributes() {
|
|
147
|
+
return [
|
|
148
|
+
"placeholder",
|
|
149
|
+
"value",
|
|
150
|
+
"disabled",
|
|
151
|
+
"rows",
|
|
152
|
+
"enter-submit",
|
|
153
|
+
"actions-fan",
|
|
154
|
+
"fan-open",
|
|
155
|
+
"preview-overflow-to-preview",
|
|
156
|
+
"preview-scrollbar",
|
|
157
|
+
"preview-threshold-chars",
|
|
158
|
+
"preview-auto-clickable",
|
|
159
|
+
"preview-dialog-width",
|
|
160
|
+
"preview-dialog-title",
|
|
161
|
+
"context-mode",
|
|
162
|
+
"effects-off",
|
|
163
|
+
"color-layout",
|
|
164
|
+
"color-top-start",
|
|
165
|
+
"color-top-mid",
|
|
166
|
+
"color-top-end",
|
|
167
|
+
"color-top-accent",
|
|
168
|
+
"aria-label",
|
|
169
|
+
"aria-labelledby",
|
|
170
|
+
"aria-describedby",
|
|
171
|
+
"error-message",
|
|
172
|
+
"debug",
|
|
173
|
+
"loading",
|
|
174
|
+
"loading-label"
|
|
175
|
+
];
|
|
176
|
+
}
|
|
177
|
+
syncLoadingState() {
|
|
178
|
+
if (!this.shadowRoot) return;
|
|
179
|
+
const t = this.hasAttribute("loading"), e = this.shadowRoot.querySelector(".prompt-loading-spinner"), o = this.shadowRoot.querySelector("#promptDefaultSubmitAction"), r = o == null ? void 0 : o.querySelector("mui-icon-toggle");
|
|
180
|
+
e && (e.toggleAttribute("hidden", !t), e.setAttribute("label", this.getAttribute("loading-label") || "Sending")), this.toggleAttribute("aria-busy", t), t ? this.setAttribute("aria-busy", "true") : this.removeAttribute("aria-busy"), o && o.toggleAttribute("disabled", t), r && (r.toggleAttribute("toggle", t), r.setAttribute("aria-pressed", String(t)));
|
|
181
|
+
}
|
|
182
|
+
setDebugState(t, e) {
|
|
183
|
+
if (!this.shadowRoot) return;
|
|
184
|
+
const o = this.shadowRoot.querySelector(".debug-region"), r = this.shadowRoot.querySelector("#promptDebugStatus"), a = this.shadowRoot.querySelector("#promptDebugPayload");
|
|
185
|
+
if (!o || !r || !a) return;
|
|
186
|
+
const i = this.hasAttribute("debug");
|
|
187
|
+
o.toggleAttribute("hidden", !i), i && (r.textContent = t, e && (this.lastDebugPayload = JSON.stringify(e)), a.textContent = this.lastDebugPayload);
|
|
188
|
+
}
|
|
189
|
+
emitPromptItems({
|
|
190
|
+
items: t,
|
|
191
|
+
text: e,
|
|
192
|
+
textBadge: o,
|
|
193
|
+
overflowed: r,
|
|
194
|
+
thresholdChars: a,
|
|
195
|
+
source: i
|
|
196
|
+
}) {
|
|
197
|
+
this.dispatchEvent(
|
|
198
|
+
new CustomEvent("prompt-paste", {
|
|
199
|
+
detail: {
|
|
200
|
+
source: i,
|
|
201
|
+
items: t,
|
|
202
|
+
text: e,
|
|
203
|
+
textBadge: o,
|
|
204
|
+
overflowed: r,
|
|
205
|
+
thresholdChars: a,
|
|
206
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
207
|
+
},
|
|
208
|
+
bubbles: !0,
|
|
209
|
+
composed: !0
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
normalizeContextMode(t) {
|
|
214
|
+
return t === "chip" ? "chip" : "icon";
|
|
215
|
+
}
|
|
216
|
+
setContextMode(t, e = "api") {
|
|
217
|
+
const o = this.normalizeContextMode(t);
|
|
218
|
+
this.getAttribute("context-mode") !== o && this.setAttribute("context-mode", o), this.syncContextModeUI(), this.dispatchEvent(
|
|
219
|
+
new CustomEvent("prompt-context-change", {
|
|
220
|
+
detail: { mode: o, source: e },
|
|
221
|
+
bubbles: !0,
|
|
222
|
+
composed: !0
|
|
223
|
+
})
|
|
224
|
+
), e === "dismiss" && this.dispatchEvent(
|
|
225
|
+
new CustomEvent("prompt-context-dismiss", {
|
|
226
|
+
detail: { mode: o },
|
|
227
|
+
bubbles: !0,
|
|
228
|
+
composed: !0
|
|
229
|
+
})
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
syncContextModeUI() {
|
|
233
|
+
if (!this.shadowRoot) return;
|
|
234
|
+
const t = this.normalizeContextMode(this.getAttribute("context-mode"));
|
|
235
|
+
Array.from(
|
|
236
|
+
this.shadowRoot.querySelectorAll(
|
|
237
|
+
'slot[name="actions"], slot[name="actions-right"], slot[name="actions-trigger"]'
|
|
238
|
+
)
|
|
239
|
+
).flatMap((r) => r.assignedElements({ flatten: !0 })).forEach((r) => {
|
|
240
|
+
[r, ...Array.from(r.querySelectorAll("*"))].forEach((i) => {
|
|
241
|
+
const l = i.tagName.toLowerCase() === "mui-prompt-toggle", c = i.hasAttribute("context-toggle"), u = i.hasAttribute("context-active") || i.hasAttribute("context-close") || i.hasAttribute("context-chip") || i.hasAttribute("context-spinner");
|
|
242
|
+
if (l) {
|
|
243
|
+
i.setAttribute("mode", t);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (c || u) {
|
|
247
|
+
i.hasAttribute("context-chip") && i.tagName.toLowerCase() === "mui-chip" && !i.hasAttribute("variant") && i.setAttribute("variant", "ghost");
|
|
248
|
+
const p = c ? t === "icon" : t === "chip";
|
|
249
|
+
i.toggleAttribute("hidden", !p), i.style.display = p ? "inline-flex" : "none";
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
connectedCallback() {
|
|
255
|
+
var e;
|
|
256
|
+
this.hasAttribute("context-mode") || this.setAttribute("context-mode", "icon"), this.render(), this.bindEvents(), this.updateActionsLayout();
|
|
257
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("textarea");
|
|
258
|
+
t && (this.syncTextareaHeight(t), requestAnimationFrame(() => this.syncTextareaHeight(t)));
|
|
259
|
+
}
|
|
260
|
+
disconnectedCallback() {
|
|
261
|
+
this.unbindEvents();
|
|
262
|
+
}
|
|
263
|
+
attributeChangedCallback(t, e, o) {
|
|
264
|
+
if (!this.shadowRoot || e === o) return;
|
|
265
|
+
const r = this.shadowRoot.querySelector("textarea");
|
|
266
|
+
if (t === "value" && r) {
|
|
267
|
+
r.value = o ?? "", this.syncTextareaHeight(r);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (t === "context-mode") {
|
|
271
|
+
const a = this.normalizeContextMode(o);
|
|
272
|
+
if (o !== a) {
|
|
273
|
+
this.setAttribute("context-mode", a);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
this.syncContextModeUI(), this.updateActionsLayout();
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (t === "disabled" && r) {
|
|
280
|
+
o === null || o === "false" ? r.removeAttribute("disabled") : r.setAttribute("disabled", "");
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (t === "placeholder" && r) {
|
|
284
|
+
r.setAttribute("placeholder", o ?? "");
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (t === "rows" && r) {
|
|
288
|
+
r.setAttribute("rows", o || "3"), this.syncTextareaHeight(r);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if ((t === "aria-label" || t === "aria-labelledby" || t === "aria-describedby") && r) {
|
|
292
|
+
o === null ? r.removeAttribute(t) : r.setAttribute(t, o);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (t === "fan-open" || t === "actions-fan") {
|
|
296
|
+
this.updateActionsLayout();
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (t === "debug") {
|
|
300
|
+
this.setDebugState("Idle: no submit yet.");
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (t === "loading" || t === "loading-label") {
|
|
304
|
+
this.syncLoadingState();
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
(t === "color-layout" || t === "color-top-start" || t === "color-top-mid" || t === "color-top-end" || t === "color-top-accent") && (this.pendingColorFade = !0), this.render(), this.bindEvents(), this.updateActionsLayout(), this.pendingColorFade && (this.runColorFade(), this.pendingColorFade = !1);
|
|
308
|
+
}
|
|
309
|
+
runColorFade() {
|
|
310
|
+
var e;
|
|
311
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".surface");
|
|
312
|
+
!t || typeof t.animate != "function" || t.animate(
|
|
313
|
+
[
|
|
314
|
+
{ opacity: 0.82, filter: "saturate(0.92)" },
|
|
315
|
+
{ opacity: 1, filter: "saturate(1)" }
|
|
316
|
+
],
|
|
317
|
+
{
|
|
318
|
+
duration: 240,
|
|
319
|
+
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
320
|
+
fill: "none"
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
getValue() {
|
|
325
|
+
var e;
|
|
326
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("textarea");
|
|
327
|
+
return (t == null ? void 0 : t.value) ?? this.getAttribute("value") ?? "";
|
|
328
|
+
}
|
|
329
|
+
get value() {
|
|
330
|
+
return this.getValue();
|
|
331
|
+
}
|
|
332
|
+
set value(t) {
|
|
333
|
+
var r;
|
|
334
|
+
const e = t == null ? "" : String(t);
|
|
335
|
+
if (this.getAttribute("value") !== e) {
|
|
336
|
+
this.setAttribute("value", e);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const o = (r = this.shadowRoot) == null ? void 0 : r.querySelector("textarea");
|
|
340
|
+
!o || o.value === e || (o.value = e, this.syncTextareaHeight(o));
|
|
341
|
+
}
|
|
342
|
+
submit(t = "api") {
|
|
343
|
+
if (this.hasAttribute("disabled") || this.hasAttribute("loading")) return !1;
|
|
344
|
+
const e = this.getValue(), o = t === "keyboard" ? "enter" : "api", r = {
|
|
345
|
+
event: "sent",
|
|
346
|
+
source: o,
|
|
347
|
+
prompt: e,
|
|
348
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
349
|
+
};
|
|
350
|
+
return this.dispatchEvent(
|
|
351
|
+
new CustomEvent("before-submit", {
|
|
352
|
+
detail: { value: e, source: t },
|
|
353
|
+
bubbles: !0,
|
|
354
|
+
composed: !0,
|
|
355
|
+
cancelable: !0
|
|
356
|
+
})
|
|
357
|
+
) ? (this.dispatchEvent(
|
|
358
|
+
new CustomEvent("submit", {
|
|
359
|
+
detail: { value: e, source: t },
|
|
360
|
+
bubbles: !0,
|
|
361
|
+
composed: !0
|
|
362
|
+
})
|
|
363
|
+
), this.setDebugState(`Sent JSON (${o})`, r), !0) : (this.setDebugState(`Blocked JSON (${o})`, { ...r, event: "blocked" }), !1);
|
|
364
|
+
}
|
|
365
|
+
clear() {
|
|
366
|
+
this.value = "", this.dispatchEvent(
|
|
367
|
+
new CustomEvent("input", {
|
|
368
|
+
detail: { value: "" },
|
|
369
|
+
bubbles: !0,
|
|
370
|
+
composed: !0
|
|
371
|
+
})
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
get errorMessage() {
|
|
375
|
+
return this.getAttribute("error-message") || "";
|
|
376
|
+
}
|
|
377
|
+
set errorMessage(t) {
|
|
378
|
+
const e = t == null ? "" : String(t).trim();
|
|
379
|
+
if (!e) {
|
|
380
|
+
this.removeAttribute("error-message");
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
this.setAttribute("error-message", e);
|
|
384
|
+
}
|
|
385
|
+
setError(t) {
|
|
386
|
+
this.errorMessage = t, this.errorMessage && this.dispatchEvent(
|
|
387
|
+
new CustomEvent("prompt-error-set", {
|
|
388
|
+
detail: { message: this.errorMessage },
|
|
389
|
+
bubbles: !0,
|
|
390
|
+
composed: !0
|
|
391
|
+
})
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
clearError(t = "api") {
|
|
395
|
+
const e = this.errorMessage;
|
|
396
|
+
this.removeAttribute("error-message"), this.removeAttribute("error-expanded"), e && this.dispatchEvent(
|
|
397
|
+
new CustomEvent("prompt-error-clear", {
|
|
398
|
+
detail: { source: t, message: e },
|
|
399
|
+
bubbles: !0,
|
|
400
|
+
composed: !0
|
|
401
|
+
})
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
syncErrorVisibility() {
|
|
405
|
+
if (!this.shadowRoot) return;
|
|
406
|
+
const t = this.shadowRoot.querySelector(".error-region"), e = !!this.errorMessage.trim().length;
|
|
407
|
+
t == null || t.toggleAttribute("hidden", !e), this.toggleAttribute("has-error", e);
|
|
408
|
+
}
|
|
409
|
+
focus() {
|
|
410
|
+
var e;
|
|
411
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("textarea");
|
|
412
|
+
t == null || t.focus();
|
|
413
|
+
}
|
|
414
|
+
syncTextareaHeight(t) {
|
|
415
|
+
const o = Number.parseInt(this.getAttribute("rows") || String(3), 10) || 3, r = Math.max(o + 6, 10), a = getComputedStyle(t), s = (Number.parseFloat(a.fontSize) || 16) * 1.55, l = Number.parseFloat(a.paddingTop) || 0, c = Number.parseFloat(a.paddingBottom) || 0, u = Number.parseFloat(a.borderTopWidth) || 0, p = Number.parseFloat(a.borderBottomWidth) || 0, h = l + c + u + p, m = 3 * s + h, b = r * s + h;
|
|
416
|
+
t.style.height = "auto";
|
|
417
|
+
const g = t.scrollHeight, v = Math.max(m, Math.min(g, b));
|
|
418
|
+
t.style.height = `${Math.ceil(v)}px`, t.style.overflowY = g > b ? "auto" : "hidden";
|
|
419
|
+
}
|
|
420
|
+
detectBadge(t) {
|
|
421
|
+
const e = t.trim();
|
|
422
|
+
if (!e) return "Insightful";
|
|
423
|
+
const o = this.detectMediaUrl(e);
|
|
424
|
+
if (o != null && o.badge) return o.badge;
|
|
425
|
+
if (e.startsWith("{") || e.startsWith("["))
|
|
426
|
+
try {
|
|
427
|
+
return JSON.parse(e), "JSON";
|
|
428
|
+
} catch {
|
|
429
|
+
}
|
|
430
|
+
return /(^|\n)\s*[@.#a-zA-Z0-9\-\s]+\{[\s\S]*:[\s\S]*\}/.test(e) ? "CSS" : /^\s{0,3}(#{1,6}|\* |- |\d+\. )/.test(e) ? "MD" : /\b(select|from|where|group by|order by|join)\b/i.test(e) ? "SQL" : /\b(const|let|function|=>|import|export|return)\b/.test(e) ? "JS" : "Insightful";
|
|
431
|
+
}
|
|
432
|
+
formatPreviewCode(t, e) {
|
|
433
|
+
const o = t.trim();
|
|
434
|
+
if (!o) return t;
|
|
435
|
+
if (e === "JSON")
|
|
436
|
+
try {
|
|
437
|
+
return JSON.stringify(JSON.parse(o), null, 2);
|
|
438
|
+
} catch {
|
|
439
|
+
return t;
|
|
440
|
+
}
|
|
441
|
+
return e === "CSS" ? o.replace(/\s+/g, " ").trim().replace(/\s*{\s*/g, ` {
|
|
442
|
+
`).replace(/;\s*/g, `;
|
|
443
|
+
`).replace(/\s*}\s*/g, `
|
|
444
|
+
}
|
|
445
|
+
`).replace(/\n\s*\n/g, `
|
|
446
|
+
`).trim().replace(/\n {2}\n/g, `
|
|
447
|
+
`).trim() : t;
|
|
448
|
+
}
|
|
449
|
+
detectMediaUrl(t) {
|
|
450
|
+
const e = t.trim();
|
|
451
|
+
if (!e) return null;
|
|
452
|
+
if (e.startsWith("blob:"))
|
|
453
|
+
return { url: e, kind: "video", badge: "VIDEO", mimeType: "video/*" };
|
|
454
|
+
const o = e.match(/https?:\/\/[^\s]+/i), r = ((o == null ? void 0 : o[0]) || e).trim();
|
|
455
|
+
if (!/^https?:\/\//i.test(r)) return null;
|
|
456
|
+
try {
|
|
457
|
+
const a = new URL(r), i = a.pathname.toLowerCase(), s = a.hostname.toLowerCase();
|
|
458
|
+
if (/\.(png|jpe?g|gif|webp|svg|avif|bmp)$/.test(i))
|
|
459
|
+
return { url: r, kind: "image", badge: "IMG", mimeType: "image/*" };
|
|
460
|
+
if (s === "youtu.be" || s.endsWith("youtube.com") || s.endsWith("youtube-nocookie.com"))
|
|
461
|
+
return { url: r, kind: "video", badge: "VIDEO", mimeType: "video/*" };
|
|
462
|
+
if (s.endsWith("vimeo.com") || s.endsWith("twitch.tv"))
|
|
463
|
+
return { url: r, kind: "video", badge: "VIDEO", mimeType: "video/*" };
|
|
464
|
+
if (s.endsWith("soundcloud.com") || s.endsWith("spotify.com") || s.endsWith("bandcamp.com") || s.endsWith("mixcloud.com"))
|
|
465
|
+
return { url: r, kind: "audio", badge: "MUSIC", mimeType: "audio/*" };
|
|
466
|
+
if (/\.(mp4|webm|mov|m4v|ogv)$/.test(i))
|
|
467
|
+
return { url: r, kind: "video", badge: "VIDEO", mimeType: "video/*" };
|
|
468
|
+
if (/\.(mp3|wav|m4a|aac|flac|ogg|oga)$/.test(i))
|
|
469
|
+
return { url: r, kind: "audio", badge: "MUSIC", mimeType: "audio/*" };
|
|
470
|
+
} catch {
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
bindEvents() {
|
|
476
|
+
if (!this.shadowRoot) return;
|
|
477
|
+
this.unbindEvents();
|
|
478
|
+
const t = this.shadowRoot.querySelector("textarea");
|
|
479
|
+
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);
|
|
480
|
+
const e = this.shadowRoot.querySelector('slot[name="actions"]'), o = this.shadowRoot.querySelector('slot[name="actions-trigger"]'), r = this.shadowRoot.querySelector('slot[name="actions-right"]'), a = this.shadowRoot.querySelector("#promptDefaultSubmitAction");
|
|
481
|
+
e == null || e.addEventListener("slotchange", () => this.updateActionsLayout()), o == null || o.addEventListener("slotchange", () => this.updateActionsLayout()), r == null || r.addEventListener("slotchange", () => this.updateActionsLayout()), a == null || a.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();
|
|
482
|
+
}
|
|
483
|
+
unbindEvents() {
|
|
484
|
+
var o, r, a;
|
|
485
|
+
if (!this.shadowRoot) return;
|
|
486
|
+
const t = this.shadowRoot.querySelector("textarea"), e = this.shadowRoot.querySelector("#promptDefaultSubmitAction");
|
|
487
|
+
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), e == null || e.removeEventListener("click", this.onDefaultSubmitClick), 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), (o = this.previewRowEl) == null || o.removeEventListener("scroll", this.onPreviewScroll), (r = this.previewSlotEl) == null || r.removeEventListener("slotchange", this.onPreviewSlotChange), (a = this.previewResizeObserver) == null || a.disconnect(), this.previewResizeObserver = null, this.previewShellEl = null, this.previewRowEl = null, this.previewSlotEl = null;
|
|
488
|
+
}
|
|
489
|
+
bindPreviewOverflow() {
|
|
490
|
+
var t, e;
|
|
491
|
+
this.shadowRoot && (this.previewShellEl = this.shadowRoot.querySelector(".preview-shell"), this.previewRowEl = this.shadowRoot.querySelector(".preview-row"), this.previewSlotEl = this.shadowRoot.querySelector('slot[name="preview"]'), (t = this.previewRowEl) == null || t.addEventListener("scroll", this.onPreviewScroll, { passive: !0 }), (e = this.previewSlotEl) == null || e.addEventListener("slotchange", this.onPreviewSlotChange), typeof ResizeObserver < "u" && this.previewRowEl && (this.previewResizeObserver = new ResizeObserver(() => this.syncPreviewEdgeShadows()), this.previewResizeObserver.observe(this.previewRowEl)), this.syncPreviewVisibility(), this.syncPreviewEdgeShadows());
|
|
492
|
+
}
|
|
493
|
+
syncPreviewVisibility() {
|
|
494
|
+
if (!this.previewShellEl || !this.previewSlotEl) return;
|
|
495
|
+
const t = this.previewSlotEl.assignedElements({ flatten: !0 }), e = t.length > 0;
|
|
496
|
+
this.previewShellEl.toggleAttribute("hidden", !e), this.syncPreviewInteractivity(t);
|
|
497
|
+
}
|
|
498
|
+
syncPreviewInteractivity(t) {
|
|
499
|
+
var o;
|
|
500
|
+
if (this.getAttribute("preview-auto-clickable") === "false") return;
|
|
501
|
+
(t || ((o = this.previewSlotEl) == null ? void 0 : o.assignedElements({ flatten: !0 })) || []).forEach((r) => {
|
|
502
|
+
r.tagName.toLowerCase() === "mui-prompt-preview" && r.getAttribute("clickable") !== "false" && r.setAttribute("clickable", "");
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
normalizePreviewDetail(t) {
|
|
506
|
+
const e = String(t.value || "").trim(), o = String(t.bgImage || "").trim(), r = String(t.badge || "").trim(), a = String(t.label || "Pasted Content"), i = String(t.imageTint || "").trim(), s = o ? "image" : e ? "code" : "text";
|
|
507
|
+
return {
|
|
508
|
+
id: String(t.id || ""),
|
|
509
|
+
value: e,
|
|
510
|
+
badge: r || (o ? "IMG" : this.detectBadge(e)),
|
|
511
|
+
label: a,
|
|
512
|
+
bgImage: o,
|
|
513
|
+
imageTint: i,
|
|
514
|
+
type: s
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
openInternalPreviewDialog(t) {
|
|
518
|
+
var y;
|
|
519
|
+
if (!this.shadowRoot) return;
|
|
520
|
+
const e = this.shadowRoot.querySelector("#promptAutoPreviewDialog"), o = this.shadowRoot.querySelector("#promptAutoPreviewTitle"), r = this.shadowRoot.querySelector("#promptAutoPreviewCode"), a = this.shadowRoot.querySelector("#promptAutoPreviewImage"), i = this.shadowRoot.querySelector("#promptAutoPreviewMedia"), s = this.shadowRoot.querySelector("#promptAutoPreviewMediaUrl"), l = this.normalizePreviewDetail(t), c = this.getAttribute("preview-dialog-title") || l.label, u = l.value, p = l.bgImage, h = l.badge, m = u ? this.detectMediaUrl(u) : null, b = !p && u.length > 0 && (h === "VIDEO" || h === "MUSIC"), g = !p && (!!(m && (m.kind === "video" || m.kind === "audio")) || b), v = p.length > 0, d = u.length > 0, w = (() => {
|
|
521
|
+
if (!m || m.kind !== "audio") return !1;
|
|
522
|
+
try {
|
|
523
|
+
const f = new URL(m.url);
|
|
524
|
+
return /\.(mp3|wav|m4a|aac|flac|ogg|oga)$/.test(f.pathname.toLowerCase());
|
|
525
|
+
} catch {
|
|
526
|
+
return !1;
|
|
527
|
+
}
|
|
528
|
+
})(), n = (() => {
|
|
529
|
+
if (!m || !w) return "";
|
|
530
|
+
try {
|
|
531
|
+
const A = new URL(m.url).pathname.split("/").filter(Boolean).pop() || "", x = decodeURIComponent(A), E = x.replace(/\.(mp3|wav|m4a|aac|flac|ogg|oga)$/i, "") || x || "Audio";
|
|
532
|
+
return E.charAt(0).toUpperCase() + E.slice(1);
|
|
533
|
+
} catch {
|
|
534
|
+
return "Audio";
|
|
535
|
+
}
|
|
536
|
+
})();
|
|
537
|
+
if (!(!v && !d && !g)) {
|
|
538
|
+
if (this.setAttribute("preview-dialog-value", u), this.setAttribute("preview-dialog-image", p), this.setAttribute("preview-dialog-type", h || (v ? "IMG" : "CODE")), o && (o.textContent = c), g ? e == null || e.setAttribute("content-max-height", "none") : e == null || e.removeAttribute("content-max-height"), v)
|
|
539
|
+
s && s.setAttribute("hidden", ""), a && (a.setAttribute("src", p), a.removeAttribute("hidden")), i && i.setAttribute("hidden", ""), r && r.setAttribute("hidden", "");
|
|
540
|
+
else if (g && m) {
|
|
541
|
+
if (s) {
|
|
542
|
+
const f = w;
|
|
543
|
+
s.textContent = f ? n : m.url, f ? (s.setAttribute("href", m.url), s.setAttribute("target", "_blank"), s.setAttribute("rel", "noopener noreferrer")) : (s.removeAttribute("href"), s.removeAttribute("target"), s.removeAttribute("rel")), s.toggleAttribute("hidden", !f);
|
|
544
|
+
}
|
|
545
|
+
i && (i.setAttribute("src", m.url), i.removeAttribute("type"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), a && (a.removeAttribute("src"), a.setAttribute("hidden", ""));
|
|
546
|
+
} else b ? (s && (s.textContent = u, s.toggleAttribute("hidden", !0)), i && (i.setAttribute("src", u), i.setAttribute("type", h === "VIDEO" ? "video" : "audio"), i.removeAttribute("prefer-native-controls"), i.removeAttribute("hidden")), r && r.setAttribute("hidden", ""), a && (a.removeAttribute("src"), a.setAttribute("hidden", ""))) : (s && s.setAttribute("hidden", ""), r && (r.textContent = this.formatPreviewCode(u, h), r.removeAttribute("hidden")), i && (i.removeAttribute("src"), i.removeAttribute("prefer-native-controls"), i.setAttribute("hidden", "")), a && (a.removeAttribute("src"), a.setAttribute("hidden", "")));
|
|
547
|
+
(y = e == null ? void 0 : e.open) == null || y.call(e);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
syncPreviewEdgeShadows() {
|
|
551
|
+
if (!this.previewShellEl || !this.previewRowEl) return;
|
|
552
|
+
const t = Math.max(0, this.previewRowEl.scrollWidth - this.previewRowEl.clientWidth), e = t > 1, o = this.previewRowEl.scrollLeft <= 1, r = this.previewRowEl.scrollLeft >= t - 1;
|
|
553
|
+
this.previewShellEl.toggleAttribute("show-start", e && !o), this.previewShellEl.toggleAttribute("show-end", e && !r);
|
|
554
|
+
}
|
|
555
|
+
isContextOnlyAction(t) {
|
|
556
|
+
return t.tagName.toLowerCase() === "mui-prompt-toggle" || t.hasAttribute("context-toggle") ? !0 : !!t.querySelector("[context-toggle]");
|
|
557
|
+
}
|
|
558
|
+
bindActionTrigger() {
|
|
559
|
+
if (!this.shadowRoot || !this.hasAttribute("actions-fan")) return;
|
|
560
|
+
const t = this.shadowRoot.querySelector('slot[name="actions"]'), e = this.shadowRoot.querySelector('slot[name="actions-trigger"]'), o = this.shadowRoot.querySelector("#promptDefaultActionsTrigger");
|
|
561
|
+
if (!t) return;
|
|
562
|
+
this.triggerEl && (this.triggerEl.removeEventListener("click", this.toggleFanOpen), this.triggerEl = null);
|
|
563
|
+
const r = ((e == null ? void 0 : e.assignedElements({ flatten: !0 })) || []).filter(
|
|
564
|
+
(c) => !c.hasAttribute("hidden")
|
|
565
|
+
), a = t.assignedElements({ flatten: !0 }).filter(
|
|
566
|
+
(c) => !c.hasAttribute("hidden")
|
|
567
|
+
);
|
|
568
|
+
if (!(a.length > 0)) {
|
|
569
|
+
o && (o.setAttribute("hidden", ""), o.style.display = "none");
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
const s = r.length === 0 && a.length === 1 && this.isContextOnlyAction(a[0]);
|
|
573
|
+
o && (o.toggleAttribute("hidden", s), o.style.display = s ? "none" : "inline-flex");
|
|
574
|
+
const l = s ? null : r.find((c) => c.hasAttribute("fan-trigger")) || r[0] || o || a.find((c) => c.hasAttribute("fan-trigger")) || a[0] || null;
|
|
575
|
+
l && (this.triggerEl = l, this.triggerEl.addEventListener("click", this.toggleFanOpen), this.syncTriggerIconState());
|
|
576
|
+
}
|
|
577
|
+
syncTriggerIconState() {
|
|
578
|
+
if (!this.triggerEl) return;
|
|
579
|
+
const t = this.triggerEl.querySelector("mui-icon-toggle");
|
|
580
|
+
if (!t) return;
|
|
581
|
+
const e = this.hasAttribute("fan-open");
|
|
582
|
+
t.toggleAttribute("toggle", e), t.setAttribute("aria-pressed", String(e));
|
|
583
|
+
}
|
|
584
|
+
setFanItemInert(t, e) {
|
|
585
|
+
if (!e) {
|
|
586
|
+
t.removeAttribute("inert"), t.removeAttribute("aria-hidden");
|
|
587
|
+
const o = t.getAttribute("data-fan-tabindex");
|
|
588
|
+
o !== null && (o === "__none__" ? t.removeAttribute("tabindex") : t.setAttribute("tabindex", o), t.removeAttribute("data-fan-tabindex"));
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
t.hasAttribute("data-fan-tabindex") || t.setAttribute("data-fan-tabindex", t.getAttribute("tabindex") ?? "__none__"), t.setAttribute("tabindex", "-1"), t.setAttribute("inert", ""), t.setAttribute("aria-hidden", "true");
|
|
592
|
+
}
|
|
593
|
+
updateActionsLayout() {
|
|
594
|
+
if (!this.shadowRoot) return;
|
|
595
|
+
this.syncContextModeUI();
|
|
596
|
+
const t = this.shadowRoot.querySelector('slot[name="actions"]'), e = this.shadowRoot.querySelector('slot[name="actions-trigger"]'), o = this.shadowRoot.querySelector("#promptDefaultActionsTrigger"), r = this.shadowRoot.querySelector(".actions-separator");
|
|
597
|
+
if (!t) return;
|
|
598
|
+
const a = ((e == null ? void 0 : e.assignedElements({ flatten: !0 })) || []).filter(
|
|
599
|
+
(n) => !n.hasAttribute("hidden")
|
|
600
|
+
), i = t.assignedElements({ flatten: !0 }).filter(
|
|
601
|
+
(n) => !n.hasAttribute("hidden")
|
|
602
|
+
), s = i.length > 0, l = this.shadowRoot.querySelector(".actions-slot-left");
|
|
603
|
+
l && (l.style.display = s ? "inline-flex" : "none");
|
|
604
|
+
const c = a.length === 0 && i.length === 1 && this.isContextOnlyAction(i[0]);
|
|
605
|
+
if (o) {
|
|
606
|
+
const n = !s || c;
|
|
607
|
+
o.toggleAttribute("hidden", n), o.style.display = n ? "none" : "inline-flex";
|
|
608
|
+
}
|
|
609
|
+
const u = c ? null : a.find((n) => n.hasAttribute("fan-trigger")) || a[0] || o || i.find((n) => n.hasAttribute("fan-trigger")) || i[0] || null, p = i.filter((n) => n !== u), h = u ? [u, ...p] : i, m = this.shadowRoot.querySelector('slot[name="actions-right"]'), b = (m == null ? void 0 : m.assignedElements({ flatten: !0 })) || [], g = this.hasAttribute("actions-fan"), v = this.hasAttribute("fan-open"), d = 100, w = "calc(var(--action-icon-only-size-medium) + var(--space-100))";
|
|
610
|
+
if (r) {
|
|
611
|
+
const n = g && v && i.length > 0;
|
|
612
|
+
r.toggleAttribute("hidden", !n), r.style.display = n ? "inline-flex" : "none";
|
|
613
|
+
}
|
|
614
|
+
this.enforceActionVariants(), h.forEach((n, y) => {
|
|
615
|
+
n.style.transition = `transform ${d}ms ease, opacity ${d}ms ease`, n.style.zIndex = "";
|
|
616
|
+
const f = this.fanAnimations.get(n);
|
|
617
|
+
if (f && (f.cancel(), this.fanAnimations.delete(n)), !g) {
|
|
618
|
+
this.setFanItemInert(n, !1), n.style.transitionDelay = "", n.style.transform = "", n.style.opacity = "", n.style.pointerEvents = "", n.style.filter = "";
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
if (y === 0) {
|
|
622
|
+
this.setFanItemInert(n, !1), n.style.transitionDelay = "", n.style.transform = "translateX(0)", n.style.opacity = "1", n.style.pointerEvents = "", n.style.filter = "";
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
if (!v) {
|
|
626
|
+
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 = "";
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
const A = `calc(${w} * -${y})`, x = y * 50;
|
|
630
|
+
n.style.transition = `opacity ${Math.max(120, d - 40)}ms ease, transform ${d}ms cubic-bezier(0.22, 1, 0.36, 1)`, n.style.transitionDelay = `${x}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(() => {
|
|
631
|
+
if (n.style.transform = `translateX(${A})`, n.style.opacity = "1", window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
632
|
+
n.style.pointerEvents = "", this.setFanItemInert(n, !1);
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
const S = n.animate(
|
|
636
|
+
[
|
|
637
|
+
{ transform: "translateX(0) scale(0.92)" },
|
|
638
|
+
{ transform: `translateX(${A}) scale(1.03)`, offset: 0.68 },
|
|
639
|
+
{ transform: `translateX(calc(${A} - var(--space-050))) scale(0.99)`, offset: 0.86 },
|
|
640
|
+
{ transform: `translateX(${A}) scale(1)` }
|
|
641
|
+
],
|
|
642
|
+
{
|
|
643
|
+
duration: d + 180,
|
|
644
|
+
delay: x,
|
|
645
|
+
easing: "cubic-bezier(0.22, 1, 0.36, 1)",
|
|
646
|
+
fill: "forwards"
|
|
647
|
+
}
|
|
648
|
+
);
|
|
649
|
+
this.fanAnimations.set(n, S), S.finished.catch(() => {
|
|
650
|
+
}).finally(() => {
|
|
651
|
+
n.style.pointerEvents = "", this.setFanItemInert(n, !1);
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
}), b.forEach((n) => {
|
|
655
|
+
n.style.transition = "", n.style.zIndex = "";
|
|
656
|
+
}), this.bindActionTrigger(), this.syncTriggerIconState();
|
|
657
|
+
}
|
|
658
|
+
render() {
|
|
659
|
+
if (!this.shadowRoot) return;
|
|
660
|
+
const t = this.getAttribute("placeholder") || "Reply to Mui...", e = this.getAttribute("value") || "", o = this.getAttribute("rows") || "3", r = this.hasAttribute("disabled"), a = this.getAttribute("preview-dialog-width") || "560px", i = this.getAttribute("color-top-start") || "", s = this.getAttribute("color-top-mid") || "", l = this.getAttribute("color-top-end") || "", c = this.getAttribute("color-top-accent") || "", p = (this.getAttribute("color-layout") || "default").toLowerCase() === "swap", h = p ? l || "var(--prompt-color-top-end, var(--green-500))" : i || "var(--prompt-color-top-start, var(--mui-brand-400))", m = p ? c || "var(--prompt-color-top-accent, var(--orange-500))" : s || "var(--prompt-color-top-mid, var(--blue-500))", b = p ? i || "var(--prompt-color-top-start, var(--mui-brand-400))" : l || "var(--prompt-color-top-end, var(--green-500))", g = p ? s || "var(--prompt-color-top-mid, var(--blue-500))" : c || "var(--prompt-color-top-accent, var(--orange-500))", v = this.getAttribute("aria-label"), d = this.getAttribute("aria-labelledby"), w = this.getAttribute("aria-describedby"), n = !v && !d ? "Prompt input" : "", y = (this.getAttribute("error-message") || "").trim(), f = y;
|
|
661
|
+
this.shadowRoot.innerHTML = /*html*/
|
|
662
|
+
`
|
|
663
|
+
<style>
|
|
664
|
+
:host {
|
|
665
|
+
display: block;
|
|
666
|
+
--prompt-action-radius: var(--chip-radius-small, var(--radius-400));
|
|
667
|
+
--_prompt-color-top-start-source: ${h};
|
|
668
|
+
--_prompt-color-top-mid-source: ${m};
|
|
669
|
+
--_prompt-color-top-end-source: ${b};
|
|
670
|
+
--_prompt-color-top-accent-source: ${g};
|
|
671
|
+
--_prompt-accent-primary: var(--prompt-accent-primary, var(--prompt-spectrum-start, var(--mui-brand-400)));
|
|
672
|
+
--_prompt-accent-secondary: var(--prompt-accent-secondary, var(--blue-500));
|
|
673
|
+
--_prompt-accent-mid: color-mix(in srgb, var(--_prompt-accent-primary) 52%, var(--_prompt-accent-secondary) 48%);
|
|
674
|
+
--_prompt-start-tint: color-mix(in srgb, var(--_prompt-color-top-start-source) 24%, transparent 76%);
|
|
675
|
+
--_prompt-mid-tint: color-mix(in srgb, var(--_prompt-color-top-mid-source) 18%, transparent 82%);
|
|
676
|
+
--_prompt-end-tint: color-mix(in srgb, var(--_prompt-color-top-end-source) 20%, transparent 80%);
|
|
677
|
+
--_prompt-accent-tint: color-mix(
|
|
678
|
+
in srgb,
|
|
679
|
+
var(--_prompt-color-top-accent-source) 16%,
|
|
680
|
+
transparent 84%
|
|
681
|
+
);
|
|
682
|
+
--_prompt-layer-start-tint: ${p ? "var(--_prompt-end-tint)" : "var(--_prompt-start-tint)"};
|
|
683
|
+
--_prompt-layer-mid-tint: ${p ? "var(--_prompt-accent-tint)" : "var(--_prompt-mid-tint)"};
|
|
684
|
+
--_prompt-layer-end-tint: ${p ? "var(--_prompt-start-tint)" : "var(--_prompt-end-tint)"};
|
|
685
|
+
--_prompt-layer-accent-tint: ${p ? "var(--_prompt-mid-tint)" : "var(--_prompt-accent-tint)"};
|
|
686
|
+
--_prompt-spectrum-blend-mode-hover: normal;
|
|
687
|
+
--_prompt-spectrum-blend-mode-focus: normal;
|
|
688
|
+
--prompt-placeholder-color-hover-light: var(--grey-1200);
|
|
689
|
+
--prompt-placeholder-color-hover-dark: var(--white);
|
|
690
|
+
--prompt-placeholder-color-focus-light: var(--grey-1200);
|
|
691
|
+
--prompt-placeholder-color-focus-dark: var(--white);
|
|
692
|
+
--prompt-focus-border-color: var(--black-opacity-50);
|
|
693
|
+
--prompt-surface-filter: drop-shadow(
|
|
694
|
+
0 var(--stroke-size-100) 0 var(--black-opacity-5)
|
|
695
|
+
);
|
|
696
|
+
--prompt-focus-after-opacity: 0.28;
|
|
697
|
+
--prompt-focus-after-opacity-min: 0;
|
|
698
|
+
--prompt-focus-after-opacity-max: 0.28;
|
|
699
|
+
--prompt-focus-after-pulse-speed-global: calc(var(--speed-400) * 4);
|
|
700
|
+
--prompt-focus-after-pulse-speed-light: var(--prompt-focus-after-pulse-speed-global);
|
|
701
|
+
--prompt-focus-after-pulse-speed-dark: var(--prompt-focus-after-pulse-speed-global);
|
|
702
|
+
--prompt-focus-after-pulse-speed: var(--prompt-focus-after-pulse-speed-global);
|
|
703
|
+
--prompt-focus-surface-opacity: 0.35;
|
|
704
|
+
--prompt-mesh-scale-max-x: 1;
|
|
705
|
+
--prompt-mesh-scale-max-y: 1.09;
|
|
706
|
+
--prompt-mesh-scale-min-x: 0.98;
|
|
707
|
+
--prompt-mesh-scale-min-y: 1.04;
|
|
708
|
+
--prompt-mesh-overflow: calc((var(--prompt-mesh-scale-max-y) - 1) * 50%);
|
|
709
|
+
--prompt-mesh-blur-pad: var(--space-100);
|
|
710
|
+
--prompt-hover-border-pulse-start: color-mix(
|
|
711
|
+
in srgb,
|
|
712
|
+
var(--prompt-focus-border-color) 10%,
|
|
713
|
+
transparent 90%
|
|
714
|
+
);
|
|
715
|
+
--prompt-hover-border-pulse-end: color-mix(
|
|
716
|
+
in srgb,
|
|
717
|
+
var(--prompt-focus-border-color) 25%,
|
|
718
|
+
transparent 75%
|
|
719
|
+
);
|
|
720
|
+
--_prompt-border-hover-primary-soft: color-mix(
|
|
721
|
+
in srgb,
|
|
722
|
+
var(--prompt-border-color-hover-primary, var(--_prompt-accent-primary)) 46%,
|
|
723
|
+
var(--form-default-border-color-hover) 54%
|
|
724
|
+
);
|
|
725
|
+
--_prompt-border-hover-primary-strong: color-mix(
|
|
726
|
+
in srgb,
|
|
727
|
+
var(--prompt-border-color-hover-primary, var(--_prompt-accent-primary)) 70%,
|
|
728
|
+
var(--form-default-border-color-hover) 30%
|
|
729
|
+
);
|
|
730
|
+
--_prompt-border-hover-secondary-soft: color-mix(
|
|
731
|
+
in srgb,
|
|
732
|
+
var(--prompt-border-color-hover-secondary, var(--_prompt-accent-secondary)) 46%,
|
|
733
|
+
var(--form-default-border-color-hover) 54%
|
|
734
|
+
);
|
|
735
|
+
--_prompt-border-hover-secondary-strong: color-mix(
|
|
736
|
+
in srgb,
|
|
737
|
+
var(--prompt-border-color-hover-secondary, var(--_prompt-accent-secondary)) 70%,
|
|
738
|
+
var(--form-default-border-color-hover) 30%
|
|
739
|
+
);
|
|
740
|
+
overflow: visible;
|
|
741
|
+
}
|
|
742
|
+
.surface {
|
|
743
|
+
position: relative;
|
|
744
|
+
border: var(--border-thin);
|
|
745
|
+
border-color: var(--form-default-border-color);
|
|
746
|
+
border-radius: var(--radius-300);
|
|
747
|
+
background: var(--surface-elevated-100);
|
|
748
|
+
padding: 0;
|
|
749
|
+
box-sizing: border-box;
|
|
750
|
+
overflow: visible;
|
|
751
|
+
isolation: isolate;
|
|
752
|
+
transition:
|
|
753
|
+
border-color var(--speed-200) cubic-bezier(0.22, 1, 0.36, 1),
|
|
754
|
+
box-shadow var(--speed-200) cubic-bezier(0.22, 1, 0.36, 1);
|
|
755
|
+
filter: var(--prompt-surface-filter);
|
|
756
|
+
box-shadow: none;
|
|
757
|
+
}
|
|
758
|
+
.surface::before {
|
|
759
|
+
content: "";
|
|
760
|
+
position: absolute;
|
|
761
|
+
inset: var(--stroke-size-200);
|
|
762
|
+
pointer-events: none;
|
|
763
|
+
border-radius: calc(var(--radius-300) - var(--stroke-size-200));
|
|
764
|
+
z-index: 1;
|
|
765
|
+
opacity: 1;
|
|
766
|
+
background: var(--surface-elevated-100);
|
|
767
|
+
transition: opacity var(--speed-200) cubic-bezier(0.22, 1, 0.36, 1);
|
|
768
|
+
}
|
|
769
|
+
.surface::after {
|
|
770
|
+
content: "";
|
|
771
|
+
position: absolute;
|
|
772
|
+
inset: calc((var(--prompt-mesh-overflow) + var(--prompt-mesh-blur-pad)) * -1);
|
|
773
|
+
pointer-events: none;
|
|
774
|
+
border-radius: calc(var(--radius-300) + var(--prompt-mesh-overflow) + var(--prompt-mesh-blur-pad));
|
|
775
|
+
z-index: 0;
|
|
776
|
+
opacity: 0;
|
|
777
|
+
background:
|
|
778
|
+
radial-gradient(
|
|
779
|
+
90% 120% at 12% 16%,
|
|
780
|
+
var(--_prompt-layer-start-tint) 0%,
|
|
781
|
+
transparent 62%
|
|
782
|
+
),
|
|
783
|
+
radial-gradient(
|
|
784
|
+
90% 120% at 72% 8%,
|
|
785
|
+
var(--_prompt-layer-mid-tint) 0%,
|
|
786
|
+
transparent 60%
|
|
787
|
+
),
|
|
788
|
+
radial-gradient(
|
|
789
|
+
80% 120% at 86% 72%,
|
|
790
|
+
var(--_prompt-layer-end-tint) 0%,
|
|
791
|
+
transparent 58%
|
|
792
|
+
),
|
|
793
|
+
radial-gradient(
|
|
794
|
+
110% 120% at 34% 88%,
|
|
795
|
+
var(--_prompt-layer-accent-tint) 0%,
|
|
796
|
+
transparent 64%
|
|
797
|
+
);
|
|
798
|
+
mix-blend-mode: var(--_prompt-spectrum-blend-mode-hover);
|
|
799
|
+
filter: blur(var(--space-050));
|
|
800
|
+
transform: translate3d(0, 0, 0) scaleX(0.94) scaleY(1.01);
|
|
801
|
+
transform-origin: center;
|
|
802
|
+
will-change: transform, opacity, filter;
|
|
803
|
+
transition: opacity var(--speed-200) cubic-bezier(0.22, 1, 0.36, 1), filter var(--speed-200) ease;
|
|
804
|
+
}
|
|
805
|
+
.surface:hover {
|
|
806
|
+
overflow: hidden;
|
|
807
|
+
background: var(--surface-elevated-100);
|
|
808
|
+
animation: promptBorderHoverPulse var(--prompt-hover-border-pulse-speed, var(--speed-500)) ease-in-out infinite;
|
|
809
|
+
}
|
|
810
|
+
:host(:has(.actions-slot:hover)) .surface,
|
|
811
|
+
:host(:has(.actions-slot:focus-within)) .surface {
|
|
812
|
+
overflow: visible;
|
|
813
|
+
}
|
|
814
|
+
.surface:hover::before {
|
|
815
|
+
opacity: 1;
|
|
816
|
+
background:
|
|
817
|
+
radial-gradient(
|
|
818
|
+
90% 120% at 12% 16%,
|
|
819
|
+
var(--_prompt-layer-start-tint) 0%,
|
|
820
|
+
transparent 62%
|
|
821
|
+
),
|
|
822
|
+
radial-gradient(
|
|
823
|
+
90% 120% at 72% 8%,
|
|
824
|
+
var(--_prompt-layer-mid-tint) 0%,
|
|
825
|
+
transparent 60%
|
|
826
|
+
),
|
|
827
|
+
radial-gradient(
|
|
828
|
+
80% 120% at 86% 72%,
|
|
829
|
+
var(--_prompt-layer-end-tint) 0%,
|
|
830
|
+
transparent 58%
|
|
831
|
+
),
|
|
832
|
+
radial-gradient(
|
|
833
|
+
110% 120% at 34% 88%,
|
|
834
|
+
var(--_prompt-layer-accent-tint) 0%,
|
|
835
|
+
transparent 64%
|
|
836
|
+
),
|
|
837
|
+
var(--surface-elevated-100);
|
|
838
|
+
mix-blend-mode: var(--_prompt-spectrum-blend-mode-hover);
|
|
839
|
+
filter: none;
|
|
840
|
+
animation:
|
|
841
|
+
promptMeshHoverPulse var(--prompt-hover-sweep-speed, var(--speed-500)) ease-in-out infinite alternate,
|
|
842
|
+
promptMeshPulse calc(var(--prompt-hover-sweep-speed, var(--speed-500)) * 1.15) ease-in-out infinite;
|
|
843
|
+
}
|
|
844
|
+
.surface:hover::after {
|
|
845
|
+
opacity: 0;
|
|
846
|
+
animation: none;
|
|
847
|
+
}
|
|
848
|
+
.surface:focus-within {
|
|
849
|
+
overflow: visible;
|
|
850
|
+
border-color: var(--prompt-focus-border-color);
|
|
851
|
+
background: var(--surface-elevated-100);
|
|
852
|
+
animation: none;
|
|
853
|
+
}
|
|
854
|
+
.surface:focus-within::after {
|
|
855
|
+
z-index: 1;
|
|
856
|
+
opacity: 0;
|
|
857
|
+
mix-blend-mode: normal;
|
|
858
|
+
filter: blur(var(--space-200));
|
|
859
|
+
animation: promptMeshPulseFocusSoft var(--prompt-focus-after-pulse-speed) ease-in-out infinite;
|
|
860
|
+
}
|
|
861
|
+
.surface:focus-within::before {
|
|
862
|
+
z-index: 2;
|
|
863
|
+
inset: 0;
|
|
864
|
+
border-radius: var(--radius-300);
|
|
865
|
+
opacity: var(--prompt-focus-surface-opacity);
|
|
866
|
+
background:
|
|
867
|
+
radial-gradient(
|
|
868
|
+
90% 120% at 12% 16%,
|
|
869
|
+
var(--_prompt-layer-start-tint) 0%,
|
|
870
|
+
transparent 62%
|
|
871
|
+
),
|
|
872
|
+
radial-gradient(
|
|
873
|
+
90% 120% at 72% 8%,
|
|
874
|
+
var(--_prompt-layer-mid-tint) 0%,
|
|
875
|
+
transparent 60%
|
|
876
|
+
),
|
|
877
|
+
radial-gradient(
|
|
878
|
+
80% 120% at 86% 72%,
|
|
879
|
+
var(--_prompt-layer-end-tint) 0%,
|
|
880
|
+
transparent 58%
|
|
881
|
+
),
|
|
882
|
+
radial-gradient(
|
|
883
|
+
110% 120% at 34% 88%,
|
|
884
|
+
var(--_prompt-layer-accent-tint) 0%,
|
|
885
|
+
transparent 64%
|
|
886
|
+
),
|
|
887
|
+
var(--prompt-focus-surface-background, var(--surface-elevated-100));
|
|
888
|
+
mix-blend-mode: var(--_prompt-spectrum-blend-mode-hover);
|
|
889
|
+
animation: none;
|
|
890
|
+
}
|
|
891
|
+
:host([effects-off]) .surface::before {
|
|
892
|
+
inset: 0;
|
|
893
|
+
border-radius: var(--radius-300);
|
|
894
|
+
background: var(--surface-elevated-100);
|
|
895
|
+
mix-blend-mode: normal;
|
|
896
|
+
opacity: 1;
|
|
897
|
+
filter: none;
|
|
898
|
+
animation: none;
|
|
899
|
+
}
|
|
900
|
+
:host([effects-off]) .surface::after {
|
|
901
|
+
display: none;
|
|
902
|
+
}
|
|
903
|
+
:host([effects-off]) .surface:hover {
|
|
904
|
+
box-shadow: none;
|
|
905
|
+
border-color: var(--form-default-border-color-hover);
|
|
906
|
+
}
|
|
907
|
+
:host([effects-off]) .surface:focus-within {
|
|
908
|
+
background: var(--surface-elevated-100);
|
|
909
|
+
}
|
|
910
|
+
@keyframes promptMeshFloat {
|
|
911
|
+
0% {
|
|
912
|
+
transform: translate3d(0, 0, 0) scaleX(var(--prompt-mesh-scale-max-x)) scaleY(var(--prompt-mesh-scale-max-y));
|
|
913
|
+
}
|
|
914
|
+
100% {
|
|
915
|
+
transform: translate3d(0, 0, 0) scaleX(var(--prompt-mesh-scale-min-x)) scaleY(var(--prompt-mesh-scale-min-y));
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
@keyframes promptBorderHoverPulse {
|
|
919
|
+
0%,
|
|
920
|
+
100% {
|
|
921
|
+
border-color: var(--prompt-hover-border-pulse-start);
|
|
922
|
+
}
|
|
923
|
+
50% {
|
|
924
|
+
border-color: var(--prompt-hover-border-pulse-end);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
@keyframes promptMeshPulse {
|
|
928
|
+
0%,
|
|
929
|
+
100% {
|
|
930
|
+
opacity: 1;
|
|
931
|
+
}
|
|
932
|
+
50% {
|
|
933
|
+
opacity: 0;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
@keyframes promptMeshPulseStrong {
|
|
937
|
+
0%,
|
|
938
|
+
100% {
|
|
939
|
+
opacity: 0.18;
|
|
940
|
+
}
|
|
941
|
+
50% {
|
|
942
|
+
opacity: 0.34;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
@keyframes promptMeshPulseFocusSoft {
|
|
946
|
+
0%,
|
|
947
|
+
100% {
|
|
948
|
+
opacity: var(--prompt-focus-after-opacity-min);
|
|
949
|
+
}
|
|
950
|
+
50% {
|
|
951
|
+
opacity: var(--prompt-focus-after-opacity-max);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
@keyframes promptMeshHoverPulse {
|
|
955
|
+
0% {
|
|
956
|
+
transform: translate3d(0, 0, 0) scale(1.02);
|
|
957
|
+
}
|
|
958
|
+
100% {
|
|
959
|
+
transform: translate3d(0, 0, 0) scale(1.04);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
@media (prefers-reduced-motion: reduce) {
|
|
963
|
+
.surface,
|
|
964
|
+
.surface::before,
|
|
965
|
+
.surface::after {
|
|
966
|
+
transition: none;
|
|
967
|
+
animation: none !important;
|
|
968
|
+
}
|
|
969
|
+
.surface:focus-within {
|
|
970
|
+
animation: none !important;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
.input-wrap {
|
|
974
|
+
position: relative;
|
|
975
|
+
z-index: 2;
|
|
976
|
+
width: 100%;
|
|
977
|
+
padding-bottom: 5rem;
|
|
978
|
+
box-sizing: border-box;
|
|
979
|
+
overflow: visible;
|
|
980
|
+
}
|
|
981
|
+
:host([has-error]) .input-wrap {
|
|
982
|
+
padding-bottom: calc(5rem + var(--space-500));
|
|
983
|
+
}
|
|
984
|
+
.preview-shell {
|
|
985
|
+
position: relative;
|
|
986
|
+
width: 100%;
|
|
987
|
+
z-index: 2;
|
|
988
|
+
box-sizing: border-box;
|
|
989
|
+
margin-inline: 0;
|
|
990
|
+
padding-top: var(--space-300);
|
|
991
|
+
}
|
|
992
|
+
.preview-shell[hidden] {
|
|
993
|
+
display: none;
|
|
994
|
+
}
|
|
995
|
+
.preview-shell::before,
|
|
996
|
+
.preview-shell::after {
|
|
997
|
+
content: "";
|
|
998
|
+
position: absolute;
|
|
999
|
+
top: 0;
|
|
1000
|
+
bottom: 0px;
|
|
1001
|
+
width: calc(var(--space-300) + var(--space-100));
|
|
1002
|
+
pointer-events: none;
|
|
1003
|
+
opacity: 0;
|
|
1004
|
+
transition: opacity var(--speed-200) ease, filter var(--speed-200) ease;
|
|
1005
|
+
z-index: 2;
|
|
1006
|
+
filter: blur(var(--space-050));
|
|
1007
|
+
}
|
|
1008
|
+
.preview-shell::before {
|
|
1009
|
+
left: 0;
|
|
1010
|
+
background: linear-gradient(
|
|
1011
|
+
90deg,
|
|
1012
|
+
color-mix(in srgb, var(--black-opacity-30) 90%, transparent 10%) 0%,
|
|
1013
|
+
color-mix(in srgb, var(--black-opacity-20) 70%, transparent 30%) 35%,
|
|
1014
|
+
transparent 100%
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
.preview-shell::after {
|
|
1018
|
+
right: 0;
|
|
1019
|
+
background: linear-gradient(
|
|
1020
|
+
270deg,
|
|
1021
|
+
color-mix(in srgb, var(--black-opacity-30) 90%, transparent 10%) 0%,
|
|
1022
|
+
color-mix(in srgb, var(--black-opacity-20) 70%, transparent 30%) 35%,
|
|
1023
|
+
transparent 100%
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
.preview-shell[show-start]::before {
|
|
1027
|
+
opacity: 0.45;
|
|
1028
|
+
}
|
|
1029
|
+
.preview-shell[show-end]::after {
|
|
1030
|
+
opacity: 0.45;
|
|
1031
|
+
}
|
|
1032
|
+
.preview-row {
|
|
1033
|
+
display: block;
|
|
1034
|
+
width: 100%;
|
|
1035
|
+
max-width: 100%;
|
|
1036
|
+
box-sizing: border-box;
|
|
1037
|
+
overflow-x: auto;
|
|
1038
|
+
overflow-y: hidden;
|
|
1039
|
+
padding-inline: calc(var(--space-300) + var(--stroke-size-100));
|
|
1040
|
+
padding-top: var(--stroke-size-200);
|
|
1041
|
+
padding-bottom: var(--stroke-size-200);
|
|
1042
|
+
scrollbar-width: thin;
|
|
1043
|
+
scrollbar-color: color-mix(in srgb, var(--text-color-optional) 65%, transparent) transparent;
|
|
1044
|
+
}
|
|
1045
|
+
.preview-row::-webkit-scrollbar {
|
|
1046
|
+
height: var(--space-100);
|
|
1047
|
+
}
|
|
1048
|
+
.preview-row::-webkit-scrollbar-track {
|
|
1049
|
+
background: transparent;
|
|
1050
|
+
}
|
|
1051
|
+
.preview-row::-webkit-scrollbar-thumb {
|
|
1052
|
+
background: color-mix(in srgb, var(--text-color-optional) 65%, transparent);
|
|
1053
|
+
border-radius: var(--radius-300);
|
|
1054
|
+
border: var(--stroke-size-100) solid transparent;
|
|
1055
|
+
background-clip: padding-box;
|
|
1056
|
+
}
|
|
1057
|
+
.preview-row::-webkit-scrollbar-thumb:hover {
|
|
1058
|
+
background: color-mix(in srgb, var(--text-color-optional) 85%, transparent);
|
|
1059
|
+
background-clip: padding-box;
|
|
1060
|
+
}
|
|
1061
|
+
:host([preview-scrollbar="hidden"]) .preview-row {
|
|
1062
|
+
scrollbar-width: none;
|
|
1063
|
+
}
|
|
1064
|
+
:host([preview-scrollbar="hidden"]) .preview-row::-webkit-scrollbar {
|
|
1065
|
+
display: none;
|
|
1066
|
+
}
|
|
1067
|
+
.preview-row::part(display) {
|
|
1068
|
+
display: flex;
|
|
1069
|
+
}
|
|
1070
|
+
.preview-row::part(flex-wrap) {
|
|
1071
|
+
flex-wrap: nowrap;
|
|
1072
|
+
}
|
|
1073
|
+
.preview-row::part(gap) {
|
|
1074
|
+
gap: var(--space-100);
|
|
1075
|
+
}
|
|
1076
|
+
.preview-end-spacer {
|
|
1077
|
+
flex: 0 0 calc(var(--space-300) - var(--space-100) + var(--stroke-size-100));
|
|
1078
|
+
width: calc(var(--space-300) - var(--space-100) + var(--stroke-size-100));
|
|
1079
|
+
min-width: calc(var(--space-300) - var(--space-100) + var(--stroke-size-100));
|
|
1080
|
+
pointer-events: none;
|
|
1081
|
+
}
|
|
1082
|
+
::slotted([slot="preview"]) {
|
|
1083
|
+
display: block;
|
|
1084
|
+
flex: 0 0 auto;
|
|
1085
|
+
}
|
|
1086
|
+
textarea {
|
|
1087
|
+
width: 100%;
|
|
1088
|
+
border: none;
|
|
1089
|
+
outline: none;
|
|
1090
|
+
background: transparent;
|
|
1091
|
+
color: var(--text-color);
|
|
1092
|
+
font: inherit;
|
|
1093
|
+
padding-block-start: calc(var(--space-300) + var(--space-050));
|
|
1094
|
+
padding-inline: calc(var(--space-300) + var(--space-100));
|
|
1095
|
+
padding-block-end: var(--space-000);
|
|
1096
|
+
line-height: var(--text-line-height-medium);
|
|
1097
|
+
resize: none;
|
|
1098
|
+
height: calc(3 * 1.55em);
|
|
1099
|
+
min-height: calc(3 * 1.55em);
|
|
1100
|
+
box-sizing: border-box;
|
|
1101
|
+
}
|
|
1102
|
+
textarea::placeholder {
|
|
1103
|
+
color: var(--prompt-placeholder-color, var(--form-default-placeholder-color, var(--text-color-optional)));
|
|
1104
|
+
opacity: 1;
|
|
1105
|
+
transition: color var(--speed-200) cubic-bezier(0.22, 1, 0.36, 1);
|
|
1106
|
+
}
|
|
1107
|
+
.surface:hover textarea::placeholder {
|
|
1108
|
+
color: var(
|
|
1109
|
+
--prompt-placeholder-color-hover,
|
|
1110
|
+
var(--prompt-placeholder-color-hover-light)
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
:host-context([data-theme="dark"]) .surface:hover textarea::placeholder,
|
|
1114
|
+
:host-context([theme="dark"]) .surface:hover textarea::placeholder,
|
|
1115
|
+
:host-context(.theme-dark) .surface:hover textarea::placeholder {
|
|
1116
|
+
color: var(
|
|
1117
|
+
--prompt-placeholder-color-hover,
|
|
1118
|
+
var(--prompt-placeholder-color-hover-dark)
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
:host-context([data-theme="dark"]),
|
|
1122
|
+
:host-context([theme="dark"]),
|
|
1123
|
+
:host-context(.theme-dark) {
|
|
1124
|
+
--prompt-focus-surface-opacity: 0.35;
|
|
1125
|
+
--_prompt-accent-secondary: var(
|
|
1126
|
+
--prompt-accent-secondary,
|
|
1127
|
+
color-mix(in srgb, var(--_prompt-accent-primary) 64%, var(--grey-1200) 36%)
|
|
1128
|
+
);
|
|
1129
|
+
--_prompt-accent-mid: color-mix(
|
|
1130
|
+
in srgb,
|
|
1131
|
+
var(--_prompt-accent-primary) 56%,
|
|
1132
|
+
var(--_prompt-accent-secondary) 44%
|
|
1133
|
+
);
|
|
1134
|
+
--_prompt-start-tint: color-mix(in srgb, var(--_prompt-color-top-start-source) 22%, transparent 78%);
|
|
1135
|
+
--_prompt-mid-tint: color-mix(in srgb, var(--_prompt-color-top-mid-source) 18%, transparent 82%);
|
|
1136
|
+
--_prompt-end-tint: color-mix(in srgb, var(--_prompt-color-top-end-source) 20%, transparent 80%);
|
|
1137
|
+
--_prompt-accent-tint: color-mix(
|
|
1138
|
+
in srgb,
|
|
1139
|
+
var(--_prompt-color-top-accent-source) 16%,
|
|
1140
|
+
transparent 84%
|
|
1141
|
+
);
|
|
1142
|
+
--_prompt-border-hover-primary-soft: color-mix(
|
|
1143
|
+
in srgb,
|
|
1144
|
+
var(--prompt-border-color-hover-primary, var(--_prompt-accent-primary)) 56%,
|
|
1145
|
+
var(--form-default-border-color-hover) 44%
|
|
1146
|
+
);
|
|
1147
|
+
--_prompt-border-hover-primary-strong: color-mix(
|
|
1148
|
+
in srgb,
|
|
1149
|
+
var(--prompt-border-color-hover-primary, var(--_prompt-accent-primary)) 78%,
|
|
1150
|
+
var(--form-default-border-color-hover) 22%
|
|
1151
|
+
);
|
|
1152
|
+
--_prompt-border-hover-secondary-soft: color-mix(
|
|
1153
|
+
in srgb,
|
|
1154
|
+
var(--prompt-border-color-hover-secondary, var(--_prompt-accent-secondary)) 56%,
|
|
1155
|
+
var(--form-default-border-color-hover) 44%
|
|
1156
|
+
);
|
|
1157
|
+
--_prompt-border-hover-secondary-strong: color-mix(
|
|
1158
|
+
in srgb,
|
|
1159
|
+
var(--prompt-border-color-hover-secondary, var(--_prompt-accent-secondary)) 78%,
|
|
1160
|
+
var(--form-default-border-color-hover) 22%
|
|
1161
|
+
);
|
|
1162
|
+
--prompt-hover-border-pulse-start: color-mix(
|
|
1163
|
+
in srgb,
|
|
1164
|
+
var(--prompt-focus-border-color) 10%,
|
|
1165
|
+
transparent 90%
|
|
1166
|
+
);
|
|
1167
|
+
--prompt-hover-border-pulse-end: color-mix(
|
|
1168
|
+
in srgb,
|
|
1169
|
+
var(--prompt-focus-border-color) 25%,
|
|
1170
|
+
transparent 75%
|
|
1171
|
+
);
|
|
1172
|
+
--prompt-focus-border-color: var(--white-opacity-50);
|
|
1173
|
+
--prompt-surface-filter: drop-shadow(
|
|
1174
|
+
0 var(--stroke-size-100) 0 var(--black-opacity-10)
|
|
1175
|
+
);
|
|
1176
|
+
--prompt-focus-after-opacity: 0.3;
|
|
1177
|
+
--prompt-focus-after-opacity-min: 0;
|
|
1178
|
+
--prompt-focus-after-opacity-max: 0.3;
|
|
1179
|
+
--_prompt-spectrum-blend-mode-hover: soft-light;
|
|
1180
|
+
--_prompt-spectrum-blend-mode-focus: normal;
|
|
1181
|
+
}
|
|
1182
|
+
:host-context([data-theme="light"]),
|
|
1183
|
+
:host-context([theme="light"]),
|
|
1184
|
+
:host-context(.theme-light) {
|
|
1185
|
+
--prompt-focus-after-pulse-speed: var(--prompt-focus-after-pulse-speed-light);
|
|
1186
|
+
}
|
|
1187
|
+
:host-context([data-theme="dark"]),
|
|
1188
|
+
:host-context([theme="dark"]),
|
|
1189
|
+
:host-context(.theme-dark) {
|
|
1190
|
+
--prompt-focus-after-pulse-speed: var(--prompt-focus-after-pulse-speed-dark);
|
|
1191
|
+
}
|
|
1192
|
+
.surface:focus-within textarea::placeholder {
|
|
1193
|
+
color: var(
|
|
1194
|
+
--prompt-placeholder-color-focus,
|
|
1195
|
+
var(--prompt-placeholder-color-focus-light)
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
:host-context([data-theme="dark"]) .surface:focus-within textarea::placeholder,
|
|
1199
|
+
:host-context([theme="dark"]) .surface:focus-within textarea::placeholder,
|
|
1200
|
+
:host-context(.theme-dark) .surface:focus-within textarea::placeholder {
|
|
1201
|
+
color: var(
|
|
1202
|
+
--prompt-placeholder-color-focus,
|
|
1203
|
+
var(--prompt-placeholder-color-focus-dark)
|
|
1204
|
+
);
|
|
1205
|
+
}
|
|
1206
|
+
textarea:disabled {
|
|
1207
|
+
cursor: not-allowed;
|
|
1208
|
+
}
|
|
1209
|
+
.actions-slot {
|
|
1210
|
+
position: absolute;
|
|
1211
|
+
z-index: 2;
|
|
1212
|
+
bottom: var(--space-300);
|
|
1213
|
+
display: inline-flex;
|
|
1214
|
+
align-items: center;
|
|
1215
|
+
gap: var(--space-100);
|
|
1216
|
+
pointer-events: none;
|
|
1217
|
+
overflow: visible;
|
|
1218
|
+
}
|
|
1219
|
+
.actions-slot > * {
|
|
1220
|
+
pointer-events: auto;
|
|
1221
|
+
}
|
|
1222
|
+
.actions-slot-left {
|
|
1223
|
+
left: var(--space-300);
|
|
1224
|
+
gap: 0;
|
|
1225
|
+
}
|
|
1226
|
+
.actions-slot-right {
|
|
1227
|
+
right: var(--space-300);
|
|
1228
|
+
}
|
|
1229
|
+
.prompt-loading-spinner[hidden] {
|
|
1230
|
+
display: none !important;
|
|
1231
|
+
}
|
|
1232
|
+
.prompt-loading-spinner {
|
|
1233
|
+
display: inline-flex;
|
|
1234
|
+
align-items: center;
|
|
1235
|
+
justify-content: center;
|
|
1236
|
+
pointer-events: none;
|
|
1237
|
+
margin-inline-end: var(--space-100);
|
|
1238
|
+
}
|
|
1239
|
+
.actions-separator {
|
|
1240
|
+
margin-inline: var(--space-200);
|
|
1241
|
+
pointer-events: none;
|
|
1242
|
+
}
|
|
1243
|
+
.actions-separator[hidden] {
|
|
1244
|
+
display: none !important;
|
|
1245
|
+
}
|
|
1246
|
+
.actions-slot mui-button {
|
|
1247
|
+
--action-radius-x-small: var(--prompt-action-radius);
|
|
1248
|
+
--action-radius-small: var(--prompt-action-radius);
|
|
1249
|
+
--action-radius-medium: var(--prompt-action-radius);
|
|
1250
|
+
--action-radius-large: var(--prompt-action-radius);
|
|
1251
|
+
}
|
|
1252
|
+
slot[name="actions-trigger"]::slotted(mui-button),
|
|
1253
|
+
slot[name="actions"]::slotted(mui-button),
|
|
1254
|
+
slot[name="actions-right"]::slotted(mui-button) {
|
|
1255
|
+
--action-radius-x-small: var(--prompt-action-radius);
|
|
1256
|
+
--action-radius-small: var(--prompt-action-radius);
|
|
1257
|
+
--action-radius-medium: var(--prompt-action-radius);
|
|
1258
|
+
--action-radius-large: var(--prompt-action-radius);
|
|
1259
|
+
}
|
|
1260
|
+
slot[name="actions-trigger"]::slotted(mui-dropdown),
|
|
1261
|
+
slot[name="actions"]::slotted(mui-dropdown),
|
|
1262
|
+
slot[name="actions-right"]::slotted(mui-dropdown) {
|
|
1263
|
+
--action-radius-x-small: var(--prompt-action-radius);
|
|
1264
|
+
--action-radius-small: var(--prompt-action-radius);
|
|
1265
|
+
--action-radius-medium: var(--prompt-action-radius);
|
|
1266
|
+
--action-radius-large: var(--prompt-action-radius);
|
|
1267
|
+
position: relative;
|
|
1268
|
+
z-index: 4;
|
|
1269
|
+
}
|
|
1270
|
+
slot[name="actions-trigger"]::slotted(mui-h-stack),
|
|
1271
|
+
slot[name="actions"]::slotted(mui-h-stack),
|
|
1272
|
+
slot[name="actions-right"]::slotted(mui-h-stack) {
|
|
1273
|
+
--action-radius-x-small: var(--prompt-action-radius);
|
|
1274
|
+
--action-radius-small: var(--prompt-action-radius);
|
|
1275
|
+
--action-radius-medium: var(--prompt-action-radius);
|
|
1276
|
+
--action-radius-large: var(--prompt-action-radius);
|
|
1277
|
+
}
|
|
1278
|
+
slot[name="actions-trigger"]::slotted(mui-prompt-toggle),
|
|
1279
|
+
slot[name="actions"]::slotted(mui-prompt-toggle),
|
|
1280
|
+
slot[name="actions-right"]::slotted(mui-prompt-toggle) {
|
|
1281
|
+
--action-radius-x-small: var(--prompt-action-radius);
|
|
1282
|
+
--action-radius-small: var(--prompt-action-radius);
|
|
1283
|
+
--action-radius-medium: var(--prompt-action-radius);
|
|
1284
|
+
--action-radius-large: var(--prompt-action-radius);
|
|
1285
|
+
}
|
|
1286
|
+
slot[name="actions-trigger"],
|
|
1287
|
+
slot[name="actions"],
|
|
1288
|
+
slot[name="actions-right"] {
|
|
1289
|
+
display: inline-flex;
|
|
1290
|
+
align-items: center;
|
|
1291
|
+
gap: var(--space-025);
|
|
1292
|
+
}
|
|
1293
|
+
slot[name="actions-trigger"] {
|
|
1294
|
+
flex: 0 0 auto;
|
|
1295
|
+
}
|
|
1296
|
+
::slotted([slot="actions"]:not([hidden])),
|
|
1297
|
+
::slotted([slot="actions-trigger"]:not([hidden])),
|
|
1298
|
+
::slotted([slot="actions-right"]:not([hidden])) {
|
|
1299
|
+
display: inline-flex;
|
|
1300
|
+
align-items: center;
|
|
1301
|
+
gap: var(--space-100);
|
|
1302
|
+
pointer-events: auto;
|
|
1303
|
+
}
|
|
1304
|
+
.auto-preview-image {
|
|
1305
|
+
display: block;
|
|
1306
|
+
width: 100%;
|
|
1307
|
+
height: auto;
|
|
1308
|
+
border-radius: var(--radius-100);
|
|
1309
|
+
}
|
|
1310
|
+
.auto-preview-media-url {
|
|
1311
|
+
display: inline-flex;
|
|
1312
|
+
width: 100%;
|
|
1313
|
+
box-sizing: border-box;
|
|
1314
|
+
padding: var(--space-300);
|
|
1315
|
+
background: var(--surface-elevated-200);
|
|
1316
|
+
}
|
|
1317
|
+
.auto-preview-media-url::part(width) {
|
|
1318
|
+
width: 100%;
|
|
1319
|
+
}
|
|
1320
|
+
.auto-preview-media-url::part(display) {
|
|
1321
|
+
display: block;
|
|
1322
|
+
}
|
|
1323
|
+
.auto-preview-media-url::part(white-space) {
|
|
1324
|
+
white-space: nowrap;
|
|
1325
|
+
}
|
|
1326
|
+
.auto-preview-media-url::part(overflow) {
|
|
1327
|
+
overflow: hidden;
|
|
1328
|
+
}
|
|
1329
|
+
.auto-preview-media-url::part(text-overflow) {
|
|
1330
|
+
text-overflow: ellipsis;
|
|
1331
|
+
}
|
|
1332
|
+
#promptAutoPreviewCode[hidden],
|
|
1333
|
+
#promptAutoPreviewImage[hidden],
|
|
1334
|
+
#promptAutoPreviewMediaUrl[hidden],
|
|
1335
|
+
#promptAutoPreviewMedia[hidden] {
|
|
1336
|
+
display: none !important;
|
|
1337
|
+
}
|
|
1338
|
+
.error-region {
|
|
1339
|
+
position: absolute;
|
|
1340
|
+
left: calc(var(--space-300) + var(--space-100));
|
|
1341
|
+
right: calc(var(--space-300) + var(--space-100));
|
|
1342
|
+
bottom: calc(var(--space-300) + var(--action-icon-only-size-small) + var(--space-100));
|
|
1343
|
+
display: grid;
|
|
1344
|
+
gap: var(--space-100);
|
|
1345
|
+
z-index: 3;
|
|
1346
|
+
pointer-events: auto;
|
|
1347
|
+
}
|
|
1348
|
+
.error-default[hidden] {
|
|
1349
|
+
display: none !important;
|
|
1350
|
+
}
|
|
1351
|
+
.error-default {
|
|
1352
|
+
display: grid;
|
|
1353
|
+
grid-template-columns: 1fr;
|
|
1354
|
+
gap: var(--space-100);
|
|
1355
|
+
align-items: start;
|
|
1356
|
+
min-width: 0;
|
|
1357
|
+
margin-left: var(--space-050);
|
|
1358
|
+
}
|
|
1359
|
+
.error-default mui-body {
|
|
1360
|
+
min-width: 0;
|
|
1361
|
+
max-width: 100%;
|
|
1362
|
+
}
|
|
1363
|
+
.error-default mui-body::part(width) {
|
|
1364
|
+
width: 100%;
|
|
1365
|
+
min-width: 0;
|
|
1366
|
+
max-width: 100%;
|
|
1367
|
+
}
|
|
1368
|
+
.error-text {
|
|
1369
|
+
display: block;
|
|
1370
|
+
min-width: 0;
|
|
1371
|
+
max-width: 100%;
|
|
1372
|
+
white-space: normal;
|
|
1373
|
+
overflow-wrap: anywhere;
|
|
1374
|
+
word-break: break-word;
|
|
1375
|
+
}
|
|
1376
|
+
.debug-region[hidden] {
|
|
1377
|
+
display: none !important;
|
|
1378
|
+
}
|
|
1379
|
+
.debug-region {
|
|
1380
|
+
margin-top: var(--space-400);
|
|
1381
|
+
padding-left: var(--space-100);
|
|
1382
|
+
}
|
|
1383
|
+
</style>
|
|
1384
|
+
|
|
1385
|
+
<div class="surface">
|
|
1386
|
+
<div class="input-wrap">
|
|
1387
|
+
<div class="preview-shell" part="preview-shell">
|
|
1388
|
+
<mui-h-stack class="preview-row" part="preview-row" aligny="stretch" alignx="start" space="var(--space-100)">
|
|
1389
|
+
<slot name="preview"></slot>
|
|
1390
|
+
<span class="preview-end-spacer" aria-hidden="true"></span>
|
|
1391
|
+
</mui-h-stack>
|
|
1392
|
+
</div>
|
|
1393
|
+
<slot name="input">
|
|
1394
|
+
<textarea
|
|
1395
|
+
rows="${o}"
|
|
1396
|
+
placeholder="${t}"
|
|
1397
|
+
${v ? `aria-label="${v.replace(/"/g, """)}"` : ""}
|
|
1398
|
+
${d ? `aria-labelledby="${d.replace(/"/g, """)}"` : ""}
|
|
1399
|
+
${w ? `aria-describedby="${w.replace(/"/g, """)}"` : ""}
|
|
1400
|
+
${n ? `aria-label="${n}"` : ""}
|
|
1401
|
+
${r ? "disabled" : ""}
|
|
1402
|
+
>${e}</textarea>
|
|
1403
|
+
</slot>
|
|
1404
|
+
</div>
|
|
1405
|
+
<div class="actions-slot actions-slot-left">
|
|
1406
|
+
<slot name="actions-trigger">
|
|
1407
|
+
<mui-button id="promptDefaultActionsTrigger" variant="tertiary" fan-trigger icon-only size="small" aria-label="More actions">
|
|
1408
|
+
<mui-icon-toggle rotate size="small">
|
|
1409
|
+
<mui-icon-grid slot="start" size="small"></mui-icon-grid>
|
|
1410
|
+
<mui-icon-close slot="end" size="small"></mui-icon-close>
|
|
1411
|
+
</mui-icon-toggle>
|
|
1412
|
+
</mui-button>
|
|
1413
|
+
</slot>
|
|
1414
|
+
<mui-rule class="actions-separator" direction="vertical" length="var(--space-400)" weight="var(--stroke-size-100)" aria-hidden="true"></mui-rule>
|
|
1415
|
+
<slot name="actions"></slot>
|
|
1416
|
+
</div>
|
|
1417
|
+
<div class="actions-slot actions-slot-right">
|
|
1418
|
+
<mui-spinner
|
|
1419
|
+
class="prompt-loading-spinner"
|
|
1420
|
+
size="small"
|
|
1421
|
+
label="${(this.getAttribute("loading-label") || "Sending").replace(/"/g, """)}"
|
|
1422
|
+
${this.hasAttribute("loading") ? "" : "hidden"}
|
|
1423
|
+
></mui-spinner>
|
|
1424
|
+
<slot name="actions-right">
|
|
1425
|
+
<mui-button id="promptDefaultSubmitAction" variant="tertiary" size="small" icon-only aria-label="Submit prompt">
|
|
1426
|
+
<mui-icon-toggle rotate size="small" style="--icon-toggle-size: 2.1rem;">
|
|
1427
|
+
<mui-icon-up-arrow slot="start" size="small" class="mui-icon"></mui-icon-up-arrow>
|
|
1428
|
+
<mui-icon-stop slot="end" size="small" class="mui-icon"></mui-icon-stop>
|
|
1429
|
+
</mui-icon-toggle>
|
|
1430
|
+
</mui-button>
|
|
1431
|
+
</slot>
|
|
1432
|
+
</div>
|
|
1433
|
+
<div class="error-region" hidden>
|
|
1434
|
+
|
|
1435
|
+
<mui-body size="x-small" variant="error" class="error-default" ${y ? "" : "hidden"}>
|
|
1436
|
+
<mui-icon-attention slot="before"></mui-icon-attention>
|
|
1437
|
+
<span class="error-text">${f}</span>
|
|
1438
|
+
</mui-body>
|
|
1439
|
+
|
|
1440
|
+
</div>
|
|
1441
|
+
</div>
|
|
1442
|
+
<mui-v-stack class="debug-region" space="var(--space-050)" ${this.hasAttribute("debug") ? "" : "hidden"}>
|
|
1443
|
+
<mui-body id="promptDebugStatus" size="x-small" variant="optional" weight="regular">Idle: no submit yet.</mui-body>
|
|
1444
|
+
<mui-body id="promptDebugPayload" size="x-small" variant="optional" weight="regular">{"event":"idle"}</mui-body>
|
|
1445
|
+
</mui-v-stack>
|
|
1446
|
+
|
|
1447
|
+
<mui-dialog
|
|
1448
|
+
id="promptAutoPreviewDialog"
|
|
1449
|
+
width="${a}"
|
|
1450
|
+
content-padding="none"
|
|
1451
|
+
>
|
|
1452
|
+
<mui-heading id="promptAutoPreviewTitle" slot="title" size="5">Pasted Content</mui-heading>
|
|
1453
|
+
<mui-code id="promptAutoPreviewCode" size="x-small" wrap hidden></mui-code>
|
|
1454
|
+
<img id="promptAutoPreviewImage" class="auto-preview-image" alt="Pasted preview" hidden />
|
|
1455
|
+
<mui-link id="promptAutoPreviewMediaUrl" class="auto-preview-media-url" size="x-small" variant="tertiary" weight="regular" hidden></mui-link>
|
|
1456
|
+
<mui-media-player id="promptAutoPreviewMedia" hidden></mui-media-player>
|
|
1457
|
+
</mui-dialog>
|
|
1458
|
+
`, this.setDebugState("Idle: no submit yet.");
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
customElements.get("mui-prompt") || customElements.define("mui-prompt", k);
|