feat(tabs): pin tabs to a Focus section on the vertical rail

A session or web-tab ref in the owner tab layout may now carry
`focus: true`. "Add to Focus" in a row's menu (right-click on a web tab)
sets it; the vertical rail then draws a shortcut to that tab in a pinned,
collapsible "Focus" section at its top, while the row itself stays where
it is. A click on a shortcut selects its tab, a right-click or the menu
key offers "Remove from Focus".

Model: `TabRef.focus?: true`, parsed strictly (only `true` or absent) and
carried through normalization, every pure edit and the legacy-order
projection; `setTabFocus()` is the pure helper. TabLayoutService needed
no change and no route was added: the flag rides the existing
`PUT /api/tab-layout`. Browser: `copyRef`/`normalizeLayout` keep `focus`
the way they keep `placement` (the browser writes whole layouts, so a
dropped field would be erased on every save), `setFocus` is a named
operation through `createEditCoordinator` and replays on a 409, and
`focusRefs()` (also on `project()`) lists what the rail can draw.

The section is its own element in #tabRail above #sessionTabs, so it
works on the flat rail (no named groups) as well as the grouped one, and
shortcuts are never rows: no Alt+N badge, no tree item, no lineage
anchor, no drag target. It is a list with one tab stop and
Up/Down/Home/End between shortcuts. Collapse is per-device localStorage
under its own key. A shortcut whose session closed or whose web tab is
not open drops out; the server already prunes deleted refs. zh-CN
strings added.
This commit is contained in:
Aamer Akhter committed 2026-10-10 13:43:20 -04:00
1 parent aa3730aace
commit cde90a465b
15 files changed
+1819 -16

No files matched your search

+135
View File
@@ -815,6 +815,141 @@ html[data-tab-orientation='vertical'] .tab-rail .session-tabs--grouped .tab-layo
user-select: none;
}
/* --- Focus section (pinned shortcuts, app.js _renderTabFocus) ---------- */
/* Its own element above #sessionTabs in the rail, so it shows above the flat
rail and the grouped one alike and never takes part in the list's order,
tree or Alt+N numbering. Capped so a long Focus never starves the list. */
.tab-focus {
display: none;
}
html[data-tab-orientation='vertical'] .tab-rail .tab-focus:not([hidden]) {
display: flex;
flex: 0 0 auto;
flex-direction: column;
gap: 2px;
max-height: 40%;
min-height: 0;
padding: 0.35rem 0.35rem 0.3rem calc(0.35rem + 24px);
border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
html[data-tab-orientation='vertical'] .tab-rail .tab-focus-toggle {
display: flex;
align-items: center;
gap: 6px;
width: 100%;
min-width: 0;
padding: 4px 6px 2px;
border: 0;
border-radius: 4px;
color: var(--text);
background: transparent;
font: inherit;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.08em;
text-align: left;
cursor: pointer;
user-select: none;
}
html[data-tab-orientation='vertical'] .tab-rail .tab-focus-toggle:hover {
background: var(--bg-hover);
}
html[data-tab-orientation='vertical'] .tab-rail :is(.tab-focus-toggle, .tab-focus-item):focus-visible {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
.tab-focus-title {
flex: 1 1 auto;
min-width: 0;
}
.tab-focus-count {
flex: 0 0 auto;
font-variant-numeric: tabular-nums;
opacity: 0.75;
}
.tab-focus--collapsed .tab-layout-group-chevron::before {
content: '\25B8';
}
html[data-tab-orientation='vertical'] .tab-rail .tab-focus-list {
display: flex;
flex-direction: column;
gap: 2px;
min-height: 0;
margin: 0;
padding: 0;
overflow-y: auto;
list-style: none;
}
html[data-tab-orientation='vertical'] .tab-rail .tab-focus-list[hidden] {
display: none;
}
html[data-tab-orientation='vertical'] .tab-rail .tab-focus-item {
position: relative;
display: flex;
align-items: center;
gap: 6px;
width: 100%;
min-width: 0;
padding: 3px 8px;
border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
border-radius: 4px;
color: var(--text-dim, var(--text-muted));
background: transparent;
font: inherit;
font-size: 12px;
text-align: left;
cursor: pointer;
}
html[data-tab-orientation='vertical'] .tab-rail .tab-focus-item:hover {
color: var(--text);
background: var(--bg-hover);
}
html[data-tab-orientation='vertical'] .tab-rail .tab-focus-item[aria-current='true'] {
color: var(--text);
background: color-mix(in srgb, var(--accent) 12%, transparent);
border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.tab-focus-name {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* The tab's own status dot and alert colour, so a shortcut says what its tab
says (the row keeps its full alert ring; a shortcut only recolours the dot). */
.tab-focus-item .tab-status {
width: 6px;
height: 6px;
border-radius: 50%;
flex-shrink: 0;
background: var(--green);
}
.tab-focus-item .tab-status.error { background: var(--red); }
.tab-focus-item .tab-status.ended { background: var(--text-muted); opacity: 0.5; }
.tab-focus-item.tab-alert-action .tab-status { background: var(--red); box-shadow: 0 0 6px rgba(239, 68, 68, 0.7); }
.tab-focus-item.tab-alert-idle .tab-status { background: var(--yellow); box-shadow: 0 0 6px rgba(234, 179, 8, 0.6); }
.tab-focus-item .tab-web-icon {
display: inline-flex;
align-items: center;
flex-shrink: 0;
color: var(--text-dim, var(--text-muted));
}
html[data-tab-orientation='vertical'] .tab-rail .tab-layout-drag-active {
cursor: grabbing;
}