Файли
openidea/src/workbench/toolwindows/ToolWindows.module.css
T
Alexanderтаformiat 6f62917730 feat(toolwindows): Dock Unpinned and Undock view modes (#2802)
A tool window's Options menu gets a View Mode submenu with Dock Pinned (the default), Dock Unpinned and Undock, as actions `toolwindow.viewMode.dockPinned|dockUnpinned|undock` (category Window). Unpinned and undocked windows hide when focus moves to the editor or another tool window, not to a popup, menu or dialog; an undocked window lies over the editor at its side without resizing it, and its inner edge resizes it. The mode is kept per window in the project layout, saved with Tool Window Layouts and reset by Restore Default Layout.

A menu button in a tool window now takes focus when clicked: WebKit doesn't focus clicked buttons, so the menu returned focus to the editor on close and hid a window just switched to Dock Unpinned or Undock.

Co-authored-by: formiat <[email protected]>
2026-11-12 03:05:08 +08:00

558 рядки
12 KiB
CSS
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
.frame {
flex: 1;
display: flex;
min-height: 0;
min-width: 0;
}
/* No right stripe: keep the window-edge gap the stripe would have provided. */
.frameNoRight {
padding-right: var(--island-gap);
}
.frameNoLeft {
padding-left: var(--island-gap);
}
/*
* Only the grid reads its track variables. Not inherited, so dragging a tool window
* edge restyles the grid alone instead of every node in the workbench below it.
*/
@property --tw-left {
syntax: "*";
inherits: false;
}
@property --tw-right {
syntax: "*";
inherits: false;
}
@property --tw-bottom {
syntax: "*";
inherits: false;
}
@property --gap-left {
syntax: "*";
inherits: false;
}
@property --gap-right {
syntax: "*";
inherits: false;
}
@property --gap-bottom {
syntax: "*";
inherits: false;
}
.grid {
/* Undocked tool windows are positioned against the grid. */
position: relative;
flex: 1;
display: grid;
min-width: 0;
min-height: 0;
/* Track sizes come from ToolWindowLayout; the editor keeps 200 × 60 px and side tracks give way first. */
grid-template-columns:
minmax(0, var(--tw-left, 0px)) var(--gap-left, 0px) minmax(200px, 1fr) var(--gap-right, 0px)
minmax(0, var(--tw-right, 0px));
grid-template-rows: minmax(60px, 1fr) var(--gap-bottom, 0px) minmax(0, var(--tw-bottom, 0px));
grid-template-areas:
"left gap-left editor gap-right right"
"gap-bottom gap-bottom gap-bottom gap-bottom gap-bottom"
"bottom bottom bottom bottom bottom";
}
.widescreen {
grid-template-areas:
"left gap-left editor gap-right right"
"left gap-left gap-bottom gap-right right"
"left gap-left bottom gap-right right";
}
.grid > [data-anchor="left"] {
grid-area: left;
}
.grid > [data-anchor="right"] {
grid-area: right;
}
.grid > [data-anchor="bottom"] {
grid-area: bottom;
}
.editorIsland {
grid-area: editor;
}
.grid[data-maximized] {
grid-template-columns: minmax(0, 1fr);
grid-template-rows: minmax(0, 1fr);
grid-template-areas: none;
}
.grid[data-maximized] > [data-anchor] {
grid-area: 1 / 1;
}
/* A side: primary and split areas, each an island; stacked on the left and right, side by side at the bottom. */
.side {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
}
.sideRow {
flex-direction: row;
}
.island[hidden],
.side[hidden] {
display: none;
}
.side > .splitGap {
flex: none;
height: var(--island-gap);
}
.sideRow > .splitGap {
height: auto;
width: var(--island-gap);
}
/* Islands: rounded surfaces on the frame background, separated by gaps. */
.island {
position: relative;
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
overflow: hidden;
background: var(--bg-island);
border-radius: var(--island-radius);
}
/*
* Undock: the area leaves its (zero) track and lies over the editor at the side's
* edge, --undock-size deep; two undocked areas of a side share its length.
*/
.undocked {
position: absolute;
z-index: calc(var(--z-panel) + 1);
max-width: 100%;
max-height: 100%;
box-shadow: var(--shadow-popup);
}
.undocked[data-slot^="left"],
.undocked[data-slot^="right"] {
width: var(--undock-size);
height: calc(var(--undock-share) * 100% - var(--undock-gap));
}
/* The inner edge keeps the resize handle off the content (a tree's scrollbar). */
.undocked[data-slot^="left"] {
left: 0;
padding-right: var(--island-gap);
}
.undocked[data-slot^="right"] {
right: 0;
padding-left: var(--island-gap);
}
.undocked[data-slot="left"],
.undocked[data-slot="right"] {
top: 0;
}
.undocked[data-slot="left-split"],
.undocked[data-slot="right-split"] {
bottom: 0;
}
.undocked[data-slot^="bottom"] {
bottom: 0;
padding-top: var(--island-gap);
height: var(--undock-size);
width: calc(var(--undock-share) * 100% - var(--undock-gap));
}
.undocked[data-slot="bottom"] {
left: 0;
}
.undocked[data-slot="bottom-split"] {
right: 0;
}
.grid[data-maximized] .undocked {
inset: 0;
width: auto;
height: auto;
}
/* The inner edge of an undocked window resizes it. */
.undockEdge {
position: absolute;
z-index: 1;
outline: none;
}
.undocked[data-slot^="left"] > .undockEdge {
inset: 0 0 0 auto;
width: var(--island-gap);
cursor: ew-resize;
}
.undocked[data-slot^="right"] > .undockEdge {
inset: 0 auto 0 0;
width: var(--island-gap);
cursor: ew-resize;
}
.undocked[data-slot^="bottom"] > .undockEdge {
inset: 0 0 auto;
height: var(--island-gap);
cursor: ns-resize;
}
.undockEdge:focus-visible {
background: color-mix(in srgb, var(--accent) 45%, transparent);
}
/* Resize handles live in the gaps; a hidden neighbour takes no gap. */
.gap {
position: relative;
outline: none;
}
.gap[data-gap="left"] {
grid-area: gap-left;
}
.gap[data-gap="right"] {
grid-area: gap-right;
}
.gap[data-gap="bottom"] {
grid-area: gap-bottom;
}
.gap[aria-orientation="vertical"] {
cursor: ew-resize;
}
.gap[aria-orientation="horizontal"] {
cursor: ns-resize;
}
/* A slightly wider hit area than the gap itself. */
.gap::before {
content: "";
position: absolute;
z-index: var(--z-panel);
}
.gap[aria-orientation="vertical"]::before {
inset: 0 -2px;
}
.gap[aria-orientation="horizontal"]::before {
inset: -2px 0;
}
/* Keyboard focus only: a mouse drag never focuses the handle. */
.gap:focus-visible::after {
content: "";
position: absolute;
background: color-mix(in srgb, var(--accent) 45%, transparent);
border-radius: 2px;
}
.gap[aria-orientation="vertical"]::after {
inset: 12px 2px;
}
.gap[aria-orientation="horizontal"]::after {
inset: 2px 12px;
}
/* Stripes */
.stripe {
/* --stripe-drag: the width under the pointer while the stripe edge is dragged. */
--stripe-button: var(--stripe-drag, var(--stripe-icon-button));
/* Outer padding: narrower than the island gap so the side frame stays close to the status bar's height, as in IDEA. */
--stripe-pad: var(--stripe-outer-padding);
width: calc(var(--stripe-button) + var(--stripe-pad) + var(--island-gap));
container-type: inline-size;
flex: none;
display: flex;
flex-direction: column;
align-items: center;
/* Icon buttons repeat at the title bar's height, so the title bar's Settings button reads as the right stripe's first one, as in IDEA. */
--stripe-gap: calc(var(--h-titlebar) - var(--stripe-icon-button));
gap: var(--stripe-gap);
padding: calc(var(--stripe-gap) / 2) 0 6px;
/* Transparent: stripes sit on the window frame so the project-colour wash flows from the title bar. */
background: transparent;
/* Short windows: scroll the buttons instead of clipping the last ones. */
overflow-x: hidden;
overflow-y: auto;
scrollbar-width: none;
}
.stripe::-webkit-scrollbar {
display: none;
}
.stripeWithNames {
--stripe-button: var(--stripe-drag, var(--stripe-button-w, 56px));
--stripe-gap: 4px;
padding-top: 0;
}
.stripeSideLeft {
padding-left: var(--stripe-pad);
padding-right: var(--island-gap);
}
.stripeSideRight {
padding-left: var(--island-gap);
padding-right: var(--stripe-pad);
}
/* Drag the stripe's inner edge: wider shows names, narrow shows icons only. Hit area covers the stripe's gap. */
.stripeHandle {
position: relative;
flex: none;
width: 0;
outline: none;
cursor: ew-resize;
}
.stripeHandle::before {
content: "";
position: absolute;
inset: 0 0 0 calc(-1 * var(--island-gap));
z-index: var(--z-panel);
}
.stripeHandleRight::before {
inset: 0 calc(-1 * var(--island-gap)) 0 0;
}
.stripeHandle:focus-visible::before {
inset-block: 12px;
margin-inline: 2px;
background: color-mix(in srgb, var(--accent) 45%, transparent);
border-radius: 2px;
}
.stripeSpacer {
flex: 1;
}
.stripeGroup {
flex: none;
display: flex;
flex-direction: column;
align-items: center;
gap: inherit;
}
/* Between a stripe group's primary and split windows. */
.stripeSeparator {
flex: none;
width: 16px;
height: 1px;
margin: 2px 0;
background: var(--border);
}
.stripeButton {
position: relative;
flex: none;
width: var(--stripe-icon-button);
height: var(--stripe-icon-button);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 3px;
border-radius: var(--radius-toolbar-button);
color: var(--fg-muted);
transition:
background var(--dur-fast) var(--ease),
color var(--dur-fast) var(--ease);
}
.stripeNamed {
width: var(--stripe-button);
height: auto;
min-height: 44px;
padding: 6px 2px 5px;
}
.stripeMore {
height: var(--stripe-icon-button);
}
.stripeWithNames .stripeMore {
width: var(--stripe-button);
}
.stripeButton:hover,
.stripeButton[aria-expanded="true"] {
color: var(--fg-secondary);
background: var(--bg-stripe-hover);
}
.stripeActive,
.stripeActive:hover {
background: var(--bg-stripe-selected);
color: var(--fg-emphasis);
}
.stripeFocused,
.stripeFocused:hover {
background: var(--bg-stripe-selected);
color: var(--fg-emphasis);
--icon-color: currentColor;
}
.stripeButton:focus-visible {
outline-offset: -2px;
}
.stripeIcon {
position: relative;
display: flex;
}
.stripeLabel {
max-width: 100%;
font-size: var(--fs-stripe-label);
line-height: 1.2;
color: var(--fg-stripe-label);
text-align: center;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow-wrap: normal;
word-break: keep-all;
}
/* A single long word can't wrap: end it with an ellipsis instead of clipping mid-letter. */
.stripeLabelWord {
display: block;
white-space: nowrap;
text-overflow: ellipsis;
}
.stripeActive .stripeLabel {
color: inherit;
}
/* Narrow stripe: one line, truncated. */
@container (max-width: 62px) {
.stripeLabel {
display: block;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.badge {
position: absolute;
top: -5px;
left: 10px;
min-width: 13px;
height: 13px;
padding: 0 3px;
border-radius: 7px;
background: var(--bg-active);
color: var(--fg-emphasis);
font-family: var(--font-ui);
font-size: 9px;
font-weight: 600;
line-height: 13px;
text-align: center;
pointer-events: none;
}
/* Anchored panels */
.window {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
outline: none;
}
.window[hidden] {
display: none;
}
.header {
height: var(--h-header);
flex: none;
display: flex;
align-items: center;
gap: 6px;
padding: 0 6px 0 8px;
color: var(--fg-emphasis);
}
.headerTabbed {
border-bottom: 1px solid var(--border);
}
.title {
flex: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--fg-strong);
}
.titlePlain {
padding: 0 4px;
}
.titleButton {
flex: none;
height: 24px;
display: inline-flex;
align-items: center;
gap: 4px;
padding: 0 4px;
border-radius: var(--radius-small);
transition: background var(--dur-fast) var(--ease);
}
.titleButton:hover,
.titleButton[aria-expanded="true"] {
background: var(--bg-toolbar-hover);
}
.titleChevron {
flex: none;
color: var(--fg-muted);
}
.headerContent {
min-width: 0;
display: flex;
align-items: center;
margin-left: 6px;
overflow: hidden;
}
.headerContentOnly {
margin-left: 0;
}
.headerSpacer {
flex: 1;
}
.headerActions {
display: flex;
align-items: center;
gap: 2px;
opacity: 0;
transition: opacity var(--dur) var(--ease);
}
.window:hover .headerActions,
.window:focus-within .headerActions,
.headerActions:has([aria-expanded="true"]) {
opacity: 1;
}
.body {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
}
/* stripe drag & drop */
.stripeSlot {
position: relative;
flex: none;
display: flex;
flex-direction: column;
}
/* The drop target after a group's last button is empty: don't let it add a gap between groups. */
.stripeSlotEnd {
margin-top: calc(-1 * var(--stripe-gap));
}
.stripeSlotEnd .stripeDrop {
top: calc(var(--stripe-gap) / 2 - 1px);
}
.stripeDrop {
position: absolute;
/* Centred in the gap above the slot; the end slot sits on the last button's bottom edge, so below it. */
top: calc(var(--stripe-gap) / -2 - 1px);
left: 6px;
right: 6px;
height: 2px;
border-radius: 1px;
background: var(--accent);
pointer-events: none;
}
.stripeDragged {
opacity: 0.4;
}
.stripeGhost {
position: fixed;
z-index: 1000;
margin: 0;
pointer-events: none;
background: var(--bg-popup);
border-radius: var(--radius-toolbar-button);
box-shadow: var(--shadow-popup);
opacity: 0.9;
}
/* Settings › Appearance › "Different tool window background". */
:global(:root[data-tool-window-bg="different"]) .anchor {
background: var(--bg-elev);
}
@media (prefers-reduced-motion: reduce) {
.stripeButton {
transition: none;
}
}