Файли
openidea/src/features/agents/Composer.module.css
T
Ernstjan FreriksтаEjaYF 2414773d61 fix(agents): attach files dropped from outside the project (#2767)
Dropping a file from the OS onto the agent message box did nothing when it was outside the project (a screen recording on the Desktop, say): the drop handler only turned project paths into @ references and skipped the rest silently. Such files now show as attachment chips next to the image thumbnails and reach the agent as resource links. A dropped image over the 5 MB inline limit, or one that cannot be read, is attached by path instead of inlined. The box highlights while an OS drag is over it. Remote windows still skip paths outside the project.

Co-authored-by: EjaYF <[email protected]>
2026-11-12 00:45:19 +08:00

456 рядки
9.2 KiB
CSS

/* A framed text area (IDEA text field frame), with the pickers in its bottom row. */
.composer {
container: agent-composer / inline-size;
min-width: 0;
position: relative;
display: flex;
flex-direction: column;
border-radius: var(--radius-popup);
background: var(--bg-field, var(--bg-button));
box-shadow: inset 0 0 0 1px var(--border-button);
cursor: text;
transition: box-shadow var(--dur-fast) var(--ease);
}
.composer:focus-within {
box-shadow:
inset 0 0 0 1px var(--focus-ring),
0 0 0 1px var(--focus-ring);
}
/* A file or folder dragged over it from the Project view or the OS. */
.fileOver {
box-shadow:
inset 0 0 0 1px var(--focus-ring),
0 0 0 1px var(--focus-ring);
}
.field {
position: relative;
}
/* Tags under the transparent textarea: same font, metrics and padding, so the caret
and selection of the real textarea line up with the painted text. */
.mirror {
position: absolute;
inset: 0;
overflow: hidden;
padding: 10px 12px 2px;
font: inherit;
font-size: var(--fs-ui);
line-height: 1.5;
white-space: pre-wrap;
overflow-wrap: anywhere;
color: var(--fg-strong);
pointer-events: none;
-webkit-user-select: none;
user-select: none;
}
.textarea {
position: relative;
z-index: 1;
display: block;
width: 100%;
min-height: 44px;
resize: none;
border: 0;
outline: none;
background: transparent;
color: transparent;
caret-color: var(--fg-strong);
font: inherit;
font-size: var(--fs-ui);
line-height: 1.5;
padding: 10px 12px 2px;
overflow-wrap: anywhere;
-webkit-user-select: text;
user-select: text;
}
.textarea:focus-visible {
outline: none;
}
.textarea::placeholder {
color: var(--fg-faint);
}
/* The textarea's own glyphs are transparent so the mirror above shows the tags; the
selection would then paint an empty highlight. Paint the selected glyphs here instead —
the opaque selection background covers the mirror underneath. */
.textarea::selection {
background: var(--bg-editor-selection);
color: var(--fg-strong);
}
.bar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 2px;
padding: 4px 6px 6px;
cursor: default;
}
.toolbar {
display: flex;
flex: 1;
flex-wrap: wrap;
align-items: center;
min-width: 0;
gap: 2px;
}
.actions {
display: flex;
flex: none;
align-items: center;
gap: 4px;
margin-left: auto;
}
/* Attach/reference buttons share the send button's 24px footprint and chrome. */
/* Plain toolbar icons, framed only on hover like the rest of the IDE's toolbars. */
.composerButton {
width: var(--h-control);
height: var(--h-control);
}
.spacer {
flex: 1;
}
.configPicker {
display: flex;
min-width: 0;
}
.configPicker > button {
max-width: 100%;
}
.settingsMenu {
display: none;
}
.settingsPopup {
width: min(320px, calc(100vw - 24px));
padding: 12px;
}
.settingsTitle {
margin-bottom: 12px;
font-weight: 600;
}
.settingsRow {
display: grid;
grid-template-columns: minmax(0, 80px) minmax(0, 1fr);
align-items: center;
gap: 12px;
margin-top: 8px;
}
.settingsLabel {
min-width: 0;
color: var(--fg-muted);
overflow-wrap: anywhere;
}
/* A ghost button showing a value and its detail, like a ghost Select. */
.chip {
display: inline-flex;
align-items: center;
gap: 6px;
height: var(--h-control);
min-width: 0;
padding: 0 4px 0 6px;
border-radius: var(--radius-control);
color: var(--fg-secondary);
white-space: nowrap;
transition: background var(--dur-fast) var(--ease);
}
.chip:hover,
.chip[aria-expanded="true"] {
background: var(--bg-toolbar-hover);
color: var(--fg-strong);
}
.chipValue {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.chipDetail {
display: inline-grid;
color: var(--fg-subtle);
}
.chipDetail > span {
grid-area: 1 / 1;
}
.chipSizer {
visibility: hidden;
}
.chipChevron {
flex: none;
color: var(--fg-muted);
}
.modelEffortPopup {
width: min(340px, calc(100vw - 24px));
padding: 12px 0 6px;
}
.effortBlock {
padding: 0 12px 8px;
}
/* The list takes the height of its models; with many it scrolls inside the popup. */
.modelEffortPopup .modelList {
max-height: 216px;
}
.effortHeader {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
}
.effortValue {
color: var(--fg-strong);
}
.effortSlider {
--thumb: 14px;
margin-top: 8px;
}
.effortSlider input {
display: block;
width: 100%;
height: var(--thumb);
margin: 0;
appearance: none;
background: transparent;
}
.effortSlider input::-webkit-slider-runnable-track {
height: 4px;
border-radius: 2px;
background: linear-gradient(to right, var(--accent) var(--fill), var(--control-off) var(--fill));
}
.effortSlider input::-webkit-slider-thumb {
width: var(--thumb);
height: var(--thumb);
margin-top: calc((4px - var(--thumb)) / 2);
border-radius: 50%;
appearance: none;
background: var(--fg-on-accent);
box-shadow:
0 0 0 1px var(--border-button),
var(--shadow-tooltip);
}
.effortSlider input:focus-visible {
outline: none;
}
.effortSlider input:focus-visible::-webkit-slider-thumb {
box-shadow: 0 0 0 2px var(--focus-ring);
}
/* One dot per level, centred under the thumb's positions. */
.effortTicks {
display: flex;
justify-content: space-between;
padding: 0 calc(var(--thumb) / 2 - 2px);
margin-top: 4px;
}
.effortTicks > span {
width: 4px;
height: 4px;
border-radius: 50%;
background: var(--control-off);
}
.effortTicks > .effortTickActive {
background: var(--accent);
}
.modePopup {
min-width: 200px;
padding: 6px 0;
}
.modeList {
display: flex;
flex-direction: column;
}
.modeOption {
display: flex;
align-items: center;
gap: 6px;
height: 24px;
margin: 0 6px;
padding: 0 8px;
border-radius: var(--radius-row);
color: var(--fg-strong);
text-align: left;
white-space: nowrap;
}
.modeOption:hover,
.modeOption:focus-visible {
outline: none;
background: var(--bg-list-selected);
}
.modeCheck {
width: 12px;
flex: none;
color: var(--fg-muted);
}
.modeFooter {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 6px;
padding: 8px 14px 2px;
border-top: 1px solid var(--border);
}
@container agent-composer (max-width: 600px) {
/* Narrow: keep one row of icons next to the agent picker. The model/mode pickers
collapse into the settings menu, so nothing has to wrap onto a second line. */
.bar {
flex-direction: row;
align-items: center;
gap: 6px;
}
.toolbar {
flex-wrap: nowrap;
}
.toolbar > button,
.toolbar > .configPicker {
flex: 0 1 auto;
min-width: 0;
}
.configPicker > button {
min-width: 0;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* The agent picker keeps its icon and truncates its name instead of taking the row. */
.toolbar > :first-child {
flex: 0 1 auto;
min-width: 0;
max-width: 110px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* The effort is in the model popup: the button keeps the model's name readable. */
.chipDetail {
display: none;
}
.inlineSetting {
display: none;
}
.settingsMenu {
display: flex;
flex: none;
margin-left: auto;
}
.actions {
width: auto;
flex: none;
margin-left: 0;
justify-content: flex-end;
}
.actions .spacer {
display: none;
}
}
.pickerValue {
display: inline-flex;
align-items: baseline;
gap: 5px;
white-space: nowrap;
}
.pickerName {
color: var(--fg-subtle);
}
.images {
display: flex;
flex-wrap: wrap;
gap: 6px;
padding: 8px 10px 0;
cursor: default;
}
.image {
position: relative;
width: 44px;
height: 44px;
border-radius: var(--radius-small);
box-shadow: inset 0 0 0 1px var(--border);
overflow: hidden;
}
.previewImage {
display: block;
width: 100%;
height: 100%;
padding: 0;
border: 0;
background: none;
cursor: zoom-in;
}
.image img {
width: 100%;
height: 100%;
object-fit: cover;
}
.removeImage {
position: absolute;
top: 2px;
right: 2px;
display: grid;
place-items: center;
width: 16px;
height: 16px;
padding: 0;
border: 0;
border-radius: 50%;
background: var(--bg-popup);
color: var(--fg);
cursor: pointer;
opacity: 0;
}
.image:hover .removeImage,
.attachment:hover .removeImage,
.removeImage:focus-visible {
opacity: 1;
}
.attachment {
position: relative;
display: inline-flex;
align-items: center;
gap: 6px;
max-width: 240px;
height: 44px;
padding: 0 10px;
border-radius: var(--radius-small);
box-shadow: inset 0 0 0 1px var(--border);
}
.attachmentName {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* `@` / `/` completion; Popup keeps the list within the viewport. */
.caretMirror {
position: fixed;
top: 0;
left: 0;
box-sizing: border-box;
visibility: hidden;
pointer-events: none;
white-space: pre-wrap;
overflow-wrap: break-word;
}
.popup {
display: flex;
flex-direction: column;
width: min(560px, calc(100vw - 12px));
border-radius: var(--radius-popup);
cursor: default;
}
.items {
max-height: 300px;
margin: 4px 0;
}
.itemName {
flex: none;
color: var(--fg-strong);
}
.itemHint {
flex: none;
color: var(--fg-muted);
font-style: italic;
}
.itemDetail {
flex: 1 1 0;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
color: var(--fg-subtle);
}