Files
openidea/src/features/agents/Composer.module.css
T
l0ng-ai fa33819afb fix(agents): keep the model name readable in a narrow chat composer (#5015)
In a narrow composer the toolbar's first item was capped at 110px, meant for the New Task agent picker. A chat's composer has no agent picker, so the cap fell on the model control and squeezed the model name to "G…" next to its settings chip while the row had room to spare. The agent picker already shows only its icon and doesn't grow, so the cap is removed.
2026-11-21 20:59:22 +08:00

598 lines
12 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);
}
/* The CodeMirror text field: the UI font, wrapping, growing with the text up to a limit. */
.field {
position: relative;
min-width: 0;
}
.field :global(.cm-editor) {
background: transparent;
color: var(--fg-strong);
font-size: var(--agent-fs-ui, var(--fs-ui));
}
.field :global(.cm-editor.cm-focused) {
outline: none;
}
.field :global(.cm-scroller) {
max-height: 280px;
overflow-y: auto;
font-family: inherit;
line-height: 1.5;
}
/* The minimum height goes on the text itself, not the scroller: clicks below the last line
must land in the editable text, or they focus the bare scroller and no caret appears. */
.field :global(.cm-content) {
min-height: 44px;
padding: 10px 12px 2px;
caret-color: var(--fg-strong);
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.field :global(.cm-line) {
padding: 0;
}
/* A wide card (a ``` block) takes the text's width, its code scrolling inside, rather than
widening the text past the box. */
.field :global(.cm-content) {
min-width: 0;
}
.field :global(.cm-placeholder) {
color: var(--fg-faint);
}
.field :global(.cm-cursor) {
border-left-color: var(--fg-strong);
}
.field ::selection {
background: var(--bg-editor-selection);
}
/* A dragged file over the box: what dropping does. */
.dropOverlay {
position: absolute;
z-index: 2;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
gap: var(--space-2);
border-radius: inherit;
background: color-mix(in srgb, var(--bg-popup) 82%, transparent);
color: var(--fg-strong);
pointer-events: none;
}
.bar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-0-5);
padding: 4px 6px 6px;
cursor: default;
}
.toolbar {
display: flex;
flex: 1;
flex-wrap: wrap;
align-items: center;
min-width: 0;
gap: var(--space-0-5);
}
.actions {
display: flex;
flex: none;
align-items: center;
gap: var(--space-1);
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,
.modelControl {
display: flex;
min-width: 0;
}
.modelControl {
align-items: center;
}
.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: var(--space-3);
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: var(--space-1-5);
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.chipLoading,
.chip.chipLoading:hover {
color: var(--fg-muted);
background: none;
}
.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;
}
.chipChevron {
flex: none;
color: var(--fg-muted);
}
.modelEffortPopup {
width: min(356px, calc(100vw - 24px));
padding: 6px 0;
}
/* The list takes the height of its models; with many it scrolls inside the popup. */
.modelEffortPopup .modelList {
max-height: 240px;
}
.catalogFooter {
margin-top: 6px;
padding: 8px 12px 2px;
border-top: 1px solid var(--border);
}
.catalogNote,
.catalogError {
margin: 0;
padding: 6px 12px;
color: var(--fg-muted);
font-size: var(--fs-small);
overflow-wrap: anywhere;
}
.catalogError {
color: var(--danger);
}
.catalogFooter .catalogError {
padding: 0 0 8px;
}
.refreshModels {
padding: 4px 0;
border: 0;
background: transparent;
color: var(--fg);
font: inherit;
cursor: pointer;
}
.refreshModels:hover:not(:disabled) {
color: var(--fg-strong);
}
.refreshModels:disabled {
color: var(--fg-muted);
cursor: default;
}
.quickSettings {
display: flex;
flex-direction: column;
gap: var(--space-3);
padding: 4px 12px 10px;
}
.quickRow {
display: flex;
flex-direction: column;
gap: var(--space-1);
}
.quickLabel {
color: var(--fg-secondary);
font-size: var(--fs-small);
font-weight: 600;
}
.modelEffortPopup [role="option"] .modelRowConfigure {
opacity: 0;
}
.modelEffortPopup [role="option"]:hover .modelRowConfigure,
.modelEffortPopup [role="option"][aria-selected="true"] .modelRowConfigure,
.modelEffortPopup [role="option"]:focus-within .modelRowConfigure {
opacity: 1;
}
.modelRowConfigure {
display: grid;
place-items: center;
width: 20px;
height: 20px;
padding: 0;
border: 0;
border-radius: var(--radius-small);
background: transparent;
color: var(--fg-muted);
cursor: pointer;
}
.modelRowConfigure:hover,
.modelRowConfigure:focus-visible {
outline: none;
background: var(--bg-hover);
color: var(--fg-strong);
}
.costBadge {
flex: none;
padding: 1px 7px;
border-radius: var(--radius-popup);
background: var(--bg-floating-toolbar);
color: var(--fg-secondary);
font-size: var(--fs-tiny);
white-space: nowrap;
}
.costBadgeLow {
background: color-mix(in srgb, var(--success) 18%, var(--bg-elev));
color: var(--success);
}
.costBadgeHigh {
background: color-mix(in srgb, var(--warning) 20%, var(--bg-elev));
color: var(--warning);
}
.pinnedButton {
color: var(--accent);
}
.segmented {
display: flex;
align-items: stretch;
gap: var(--space-0-5);
padding: 2px;
border-radius: var(--radius-popup);
background: var(--bg-input);
box-shadow: inset 0 0 0 1px var(--border-strong);
}
.segment {
flex: 1 1 0;
min-width: 0;
height: 26px;
padding: 0 6px;
border: 0;
border-radius: var(--radius-control);
background: transparent;
color: var(--fg-secondary);
font-size: var(--fs-small);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
transition:
background var(--dur-fast) var(--ease),
color var(--dur-fast) var(--ease);
}
.segment:hover {
color: var(--fg-strong);
}
.segment:focus-visible {
outline: 2px solid var(--focus-ring);
outline-offset: -2px;
}
.segmentActive {
background: var(--bg-toolbar-hover);
color: var(--fg-strong);
font-weight: 600;
}
.modePopup {
min-width: 200px;
padding: 6px 0;
}
.modeList {
display: flex;
flex-direction: column;
}
.modeOption {
display: flex;
align-items: center;
gap: var(--space-1-5);
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: var(--space-3);
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: var(--space-1-5);
}
.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;
}
.chipDetail {
display: none;
}
.modelDetail {
flex-shrink: 0;
max-width: 65%;
}
.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;
}
/* Above the text: the current file to reference, attached files and images. */
.context {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-1-5);
padding: 8px 10px 0;
cursor: default;
}
.image {
position: relative;
width: 40px;
height: 40px;
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,
.removeImage:focus-visible {
opacity: 1;
}
/* Attached files and the current-file suggestion: one height, like the chips in the text. */
.attachment,
.suggestion {
position: relative;
display: inline-flex;
align-items: center;
gap: 5px;
max-width: 240px;
height: 24px;
padding: 0 4px 0 7px;
border-radius: var(--radius-control);
box-shadow: inset 0 0 0 1px var(--border);
font-size: var(--fs-small);
color: var(--fg-strong);
}
.suggestion {
padding-right: 8px;
border: 0;
background: none;
box-shadow: none;
outline: 1px dashed var(--border-strong);
outline-offset: -1px;
color: var(--fg-muted);
cursor: pointer;
transition:
color var(--dur-fast) var(--ease),
background var(--dur-fast) var(--ease);
}
.suggestion:hover {
background: var(--bg-hover);
color: var(--fg-strong);
}
.suggestion:focus-visible {
outline: 2px solid var(--focus-ring);
}
/* The file name truncates first; the hint stays on one line. */
.suggestionHint {
flex: none;
white-space: nowrap;
color: var(--fg-faint);
}
.removeChip {
display: grid;
place-items: center;
width: 16px;
height: 16px;
padding: 0;
border: 0;
border-radius: var(--radius-small);
background: none;
color: var(--fg-muted);
cursor: pointer;
}
.removeChip:hover {
background: var(--bg-hover);
color: var(--fg-strong);
}
.attachmentName {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* `@` / `/` completion; Popup keeps the list within the viewport. */
.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);
}
.match {
background: none;
color: var(--fg-completion-match, var(--accent));
font-weight: 600;
}
.popupFooter {
display: flex;
flex-wrap: wrap;
gap: var(--space-1) 14px;
padding: 5px 12px 6px;
border-top: 1px solid var(--border);
color: var(--fg-subtle);
font-size: var(--fs-small);
}
.popupFooter kbd {
display: inline-grid;
place-items: center;
min-width: 16px;
height: 16px;
margin-right: 2px;
padding: 0 3px;
border-radius: var(--radius-small);
background: var(--bg-hover);
color: var(--fg-muted);
font-family: var(--font-keys, inherit);
font-size: var(--fs-tiny, 11px);
}