Files
openidea/src/ui/Tabs.module.css
T
l0ng-ai 2215239ecb fix(editor): put the pin in the editor tab action slot (#5282)
- Put the pin in a pinned editor tab's action slot so the filename has more room. The pin follows the left or right placement and can unpin the tab directly.
- Use the same Unpin action in Hidden Editor Tabs. A modified pinned tab shows its unsaved marker beside the pin.
2026-11-23 09:23:25 +08:00

366 lines
7.9 KiB
CSS

.strip {
--tab-selected-bg: var(--bg-tab-selected);
--tab-selected-border: var(--border-tab-selected);
flex: none;
display: flex;
align-items: stretch;
min-width: 0;
}
/* IDEA: only the part holding focus accents its selected tab (src/ui/focusScope.ts). */
:where([data-focus-scope]:not([data-focus-active])) .strip {
--tab-selected-bg: var(--bg-tab-selected-inactive);
--tab-selected-border: var(--border-tab-selected-inactive);
}
/* Islands tabs: the selected tab is a rounded pill (tab-selected-bg / -border); no underline, no separators.
EditorTabs.tabInsets -6,8,-6,8 (tabInsets.compact -2,6,-2,4) put 8px (6px compact) around the tab label. */
.editor {
--tab-inline-padding: var(--tab-pad-x, 8px);
height: var(--h-header);
font-size: var(--fs-chrome);
padding: 0 4px;
}
.compact {
/* Shrinks inside tool window headers so the overflow dropdown can take over. */
flex: 0 1 auto;
height: var(--h-tab);
}
.scroller {
display: flex;
align-items: center;
gap: var(--space-0-5);
min-width: 0;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: none;
}
.scroller::-webkit-scrollbar {
display: none;
}
.tab {
position: relative;
flex: none;
display: flex;
align-items: stretch;
height: calc(100% - 6px);
min-height: 22px;
max-height: var(--h-tab);
border-radius: var(--radius-tab, 6px);
color: var(--fg-strong);
transition:
color var(--dur-fast) var(--ease),
background var(--dur-fast) var(--ease);
}
/* showContextMenu's owner keeps its hover appearance while the menu is open. */
.tab:hover,
.tab:where([data-context-menu-open]) {
background: var(--bg-toolbar-hover);
}
.selected,
.selected:hover {
background: var(--tab-selected-bg);
box-shadow: inset 0 0 0 1px var(--tab-selected-border);
}
.tinted {
--tab-tint-mix: color-mix(in srgb, var(--tab-tint) var(--tab-tint-strength, var(--tint-strength, 22%)), transparent);
background: var(--tab-tint-mix);
}
.tinted:hover,
.tinted:where([data-context-menu-open]) {
background: linear-gradient(var(--bg-toolbar-hover), var(--bg-toolbar-hover)), var(--tab-tint-mix);
}
.tinted.selected {
background: color-mix(
in srgb,
var(--tab-tint) var(--tab-tint-strength, var(--tint-strength, 22%)),
var(--tab-selected-bg)
);
}
.tabButton {
display: flex;
align-items: center;
gap: var(--space-1-5);
padding: 0 var(--tab-inline-padding, 10px);
border-radius: inherit;
white-space: nowrap;
color: inherit;
}
.compact .tabButton {
padding: 0 10px;
}
.closable .tabButton {
padding-right: 2px;
}
.tabButton:focus-visible {
outline: 2px solid var(--focus-ring);
outline-offset: -2px;
}
.tabIcon {
flex: none;
color: var(--fg-muted);
}
.tabLabel {
overflow: hidden;
text-overflow: ellipsis;
max-width: 260px;
}
.italic {
font-style: italic;
}
/* A file with errors, as the Project view marks it. */
.error {
text-decoration-line: underline;
text-decoration-style: wavy;
text-decoration-color: var(--danger);
text-decoration-skip-ink: none;
text-underline-offset: 3px;
/* Room for the wave below the line box, which the ellipsis' overflow would clip. */
padding-block: 4px;
margin-block: -4px;
}
.dimmed {
opacity: 0.6;
}
.closeSlot {
position: relative;
display: flex;
align-items: center;
width: 20px;
/* Squeezed tabs shrink the label, never the close button (#1740). */
flex: none;
margin-right: 4px;
}
.close {
color: var(--fg-muted);
opacity: 0;
transition: opacity var(--dur-fast) var(--ease);
}
.unpin {
color: var(--fg-muted);
}
.pinModified {
position: absolute;
top: calc(50% - 7px);
inset-inline-end: 1px;
width: var(--space-1);
height: var(--space-1);
border-radius: 50%;
background: var(--accent);
pointer-events: none;
}
.tab:hover .close,
.tab:where([data-context-menu-open]) .close,
.selected .close,
.close:focus-visible {
opacity: 1;
}
.modified {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--fg-muted);
flex: none;
}
.closeSlot .modified {
position: absolute;
left: 7px;
pointer-events: none;
transition: opacity var(--dur-fast) var(--ease);
}
.tab:hover .closeSlot .modified,
.tab:where([data-context-menu-open]) .closeSlot .modified,
.selected .closeSlot .modified {
opacity: 0;
}
.more {
align-self: center;
margin: 0 4px;
}
.trailing {
flex: 1 0 auto;
min-width: 0;
display: flex;
align-items: center;
justify-content: flex-end;
}
/* A scrolling tab can shorten its label to keep the close button in view. */
.fit .tab {
min-width: 0;
max-width: 100%;
}
/* Squeezed tabs share the available width. */
.squeeze .scroller {
flex: 0 1 auto;
}
.squeeze .tab {
flex: 0 1 auto;
min-width: 40px;
}
/* A closable tab keeps room for its close slot: only the label shrinks. */
.squeeze .closable {
min-width: 64px;
}
.squeeze .closeSlot {
flex: none;
}
.squeeze .tabButton,
.fit .tabButton {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
}
.squeeze .tabLabel,
.fit .tabLabel {
min-width: 0;
}
.wrap {
height: auto;
min-height: var(--h-header);
}
.wrap .scroller {
flex: 1;
flex-wrap: wrap;
overflow: visible;
row-gap: var(--space-0-5);
padding: 3px 0;
}
.wrap .tab {
height: calc(var(--h-header) - 6px);
}
/* Vertical strip (editor tabs placed left / right): a scrolling column of full-width tabs. */
.vertical {
flex-direction: column;
height: auto;
min-height: 0;
padding: 4px;
}
.vertical .scroller {
flex: 0 1 auto;
flex-direction: column;
align-items: stretch;
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
scrollbar-width: thin;
}
.vertical .scroller::-webkit-scrollbar {
display: initial;
}
.vertical .tab {
height: 24px;
min-height: 24px;
}
.vertical .tabButton {
flex: 1 1 auto;
min-width: 0;
}
.vertical .tabLabel {
min-width: 0;
max-width: none;
}
.vertical .trailing {
flex: none;
justify-content: flex-end;
padding-bottom: 4px;
}
.vertical .dropBefore::before,
.vertical .dropAfter::after {
top: auto;
bottom: auto;
left: 4px;
right: 4px;
width: auto;
height: 2px;
}
.vertical .dropBefore::before {
top: 0;
}
.vertical .dropAfter::after {
bottom: 0;
}
/* Close button on the left of the label */
.closeLeft .closeSlot {
order: -1;
margin: 0 0 0 4px;
}
.closeLeft .closable .tabButton {
padding: 0 var(--tab-inline-padding, 10px) 0 2px;
}
/* Editor tabs in a row sit 4px apart; wrapped rows keep their row gap. */
.editor:not(.vertical) .scroller {
column-gap: var(--space-1);
}
/* A long label can shrink to fit its split and keep the close slot in view. */
.editor:not(.vertical, .squeeze) .tab {
max-inline-size: 100%;
}
.editor:not(.vertical, .squeeze) .tabButton {
min-inline-size: 0;
}
/* Every closable tab keeps a close slot at one edge (IDEA), cut to what the close glyph needs: 18px, a 2px
inset and the 16px button. The label side keeps the 8px inset, so the side doesn't change a tab's width. */
.editor:not(.vertical) .closeSlot {
position: absolute;
top: 0;
bottom: 0;
right: 2px;
width: auto;
margin: 0;
}
.editor:not(.vertical) :is(.close, .unpin) {
width: 16px;
}
.editor:not(.vertical) .closeSlot .modified {
left: 5px;
}
.editor:not(.vertical, .closeLeft) .closable .tabButton {
padding-right: 18px;
}
.editor.closeLeft:not(.vertical) .closeSlot {
right: auto;
left: 2px;
}
.editor.closeLeft:not(.vertical) .closable .tabButton {
padding-left: 18px;
}
/* drag & drop: the dragged tab is an empty slot the other tabs make room for (IDEA) */
.tab.dragging,
.tab.dragging:hover {
background: var(--bg-toolbar-hover);
box-shadow: none;
}
.dragging > * {
visibility: hidden;
}
.dropBefore::before,
.dropAfter::after {
content: "";
position: absolute;
top: 4px;
bottom: 4px;
width: 2px;
background: var(--accent);
z-index: 1;
pointer-events: none;
}
/* Inside the tab: the scroller clips anything past the first and last tab. */
.dropBefore::before {
left: 0;
}
.dropAfter::after {
right: 0;
}
@media (prefers-reduced-motion: reduce) {
.tab,
.close,
.closeSlot .modified {
transition: none;
}
}