Move plugin sort from dropdown to clickable column headers

Replace the toolbar sort dropdown with sortable Name/Source/Status column
headers that cycle ascending, descending, then clear. Add a Source column
and a PluginSortKey::None baseline for the cleared state. The whole header
cell is the click target and the sort triangle snaps in without a fade.
This commit is contained in:
Andrew
2026-07-06 14:46:31 +08:00
parent b724cb6631
commit 714fe54f77
8 changed files with 150 additions and 194 deletions

View File

@@ -1,89 +1,42 @@
/* why: isolate dropdown styling from the existing plugin dialog styles. */
/* why: sort affordance lives on the list column headers, not a toolbar dropdown. */
.sort-dropdown {
position: relative;
display: inline-flex;
margin-right: auto;
}
.sort-menu-btn {
height: 32px !important;
display: inline-flex;
align-items: center;
gap: 6px;
/* why: global .ButtonTypeChoice adds margin-left:15px (dialog button rows); as the leftmost
toolbar item that stacks on .app's 8px padding - kill it like .explore-dropdown does. */
margin-left: 0 !important;
}
/* note: asc is bars growing downward + up arrow; a vertical flip yields the desc icon. */
.sort-order-icon {
display: block;
flex: none;
}
.sort-menu-btn.order-desc .sort-order-icon,
.sort-order-icon.desc {
transform: scaleY(-1);
}
.sort-caret {
width: 7px;
height: 7px;
border-right: 1.5px solid currentColor;
border-bottom: 1.5px solid currentColor;
transform: translateY(-2px) rotate(45deg);
}
.sort-menu {
position: absolute;
left: 0;
top: calc(100% + 2px);
z-index: 20;
min-width: 200px;
padding: 4px 0;
background: var(--main-color);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.sort-menu[hidden] {
display: none !important;
}
.sort-group-label {
padding: 8px 10px 4px;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.04em;
color: rgba(255, 255, 255, 0.55);
}
.sort-menu-item {
.hdr .sort-th {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
padding: 8px 10px 8px 28px; /* why: reserve space for the active-row checkmark. */
border: 0;
background: transparent;
color: #ffffff;
box-sizing: border-box;
text-align: left;
font: inherit;
gap: 6px;
cursor: pointer;
position: relative;
user-select: none;
}
/* note: same tint as .explore-menu-item hover/.selected, so the two menus match */
.sort-menu-item:hover,
.sort-menu-item:focus-visible,
.sort-menu-item[aria-checked="true"] {
outline: none;
background: rgba(255, 255, 255, 0.14);
.hdr .sort-th .sort-tri {
width: 0;
height: 0;
flex: none;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
display: none;
}
.sort-menu-item[aria-checked="true"]::before {
content: "\2713"; /* note: checkmark on the active field/order. */
position: absolute;
left: 10px;
/* faint up-triangle hint on hover, only while the column is not the active sort */
.hdr .sort-th:hover .sort-tri {
display: block;
border-bottom: 5px solid var(--muted);
}
/* active column wins over the hover hint (same specificity, declared later) */
.hdr .sort-th[data-sort="asc"] .sort-tri {
display: block;
border-bottom: 5px solid var(--text);
border-top: 0;
}
.hdr .sort-th[data-sort="desc"] .sort-tri {
display: block;
border-top: 5px solid var(--text);
border-bottom: 0;
}
.hdr .sort-th[data-sort="asc"],
.hdr .sort-th[data-sort="desc"] {
color: var(--text);
}