Branch picker is a command palette: one searchable list with Branches and Tags sections, tip ages, a default chip and key hints
Browse files at this commit749adabe20dce7a519ab04ab9dd713e97ca5e6ceParent: 3d6ee62- style
- branch picker is a command palette: one searchable list with Branches and Tags sections, tip ages, a default chip and key hints
4 changed files +279 -184
- crates/forge-web/assets/nav.js +47 -42
- crates/forge-web/src/pages/refs.rs +1 -0
- crates/forge-web/src/views/mod.rs +60 -46
- style/main.scss +171 -96
crates/forge-web/assets/nav.jsmodified+47 -42
| @@ -2053,54 +2053,65 @@ | ||
| 2053 | 2053 | }, false); |
| 2054 | 2054 | |
| 2055 | 2055 | // ---- branch switcher ------------------------------------------------------------------------ |
| 2056 | - // The ref popover in the browse bar: a filter over the active list, Branches and Tags tabs, and | |
| 2057 | - // arrow keys through the visible entries as in the file finder. Entries past the first REF_SHOWN | |
| 2058 | - // stay hidden until the filter narrows them, so the filter still reaches every name. | |
| 2056 | + // The ref popover in the browse bar: one filter over a Branches and a Tags section, the matched | |
| 2057 | + // part of each name marked, and arrow keys (or the pointer) through the visible entries as in the | |
| 2058 | + // file finder. Entries past the first REF_SHOWN of a section stay hidden until the filter narrows | |
| 2059 | + // them, so the filter still reaches every name. | |
| 2059 | 2060 | |
| 2060 | - var REF_SHOWN = 10; | |
| 2061 | + var REF_SHOWN = 8; | |
| 2061 | 2062 | |
| 2062 | 2063 | function refSwitchOf(el) { |
| 2063 | 2064 | return el && el.closest ? el.closest('details[data-ref-switch]') : null; |
| 2064 | 2065 | } |
| 2065 | 2066 | |
| 2066 | - function refPanelOf(sw) { | |
| 2067 | - var tab = sw.querySelector('[data-ref-tab][aria-selected="true"]'); | |
| 2068 | - var kind = tab ? tab.getAttribute('data-ref-tab') : 'branches'; | |
| 2069 | - return sw.querySelector('[data-ref-panel="' + kind + '"]'); | |
| 2070 | - } | |
| 2071 | - | |
| 2072 | - function refShown(panel) { | |
| 2073 | - return Array.prototype.filter.call(panel.querySelectorAll('[data-ref-item]'), function (li) { | |
| 2067 | + function refShown(sw) { | |
| 2068 | + return Array.prototype.filter.call(sw.querySelectorAll('[data-ref-item]'), function (li) { | |
| 2074 | 2069 | return !li.hidden; |
| 2075 | 2070 | }); |
| 2076 | 2071 | } |
| 2077 | 2072 | |
| 2078 | - // Applies the filter to the active panel: every match, or the first entries when it is empty. | |
| 2073 | + // Writes `name` into `el`, the first case-insensitive match of `q` wrapped in <mark>. | |
| 2074 | + function refMark(el, name, q) { | |
| 2075 | + var at = q ? name.toLowerCase().indexOf(q) : -1; | |
| 2076 | + el.textContent = ''; | |
| 2077 | + if (at < 0) { el.textContent = name; return; } | |
| 2078 | + var mark = document.createElement('mark'); | |
| 2079 | + mark.textContent = name.slice(at, at + q.length); | |
| 2080 | + el.append(name.slice(0, at), mark, name.slice(at + q.length)); | |
| 2081 | + } | |
| 2082 | + | |
| 2083 | + // Applies the filter to every section: each match, or the first entries when it is empty. A | |
| 2084 | + // section with nothing to show hides with its heading. | |
| 2079 | 2085 | function refApply(sw) { |
| 2080 | 2086 | var q = sw.querySelector('[data-ref-filter]').value.trim().toLowerCase(); |
| 2081 | - var panel = refPanelOf(sw); | |
| 2082 | - var empty = panel.querySelector('[data-ref-empty]'); | |
| 2083 | - var shown = 0; | |
| 2084 | - Array.prototype.forEach.call(panel.querySelectorAll('[data-ref-item]'), function (li, i) { | |
| 2085 | - var show = q ? li.textContent.trim().toLowerCase().indexOf(q) >= 0 : i < REF_SHOWN; | |
| 2086 | - li.hidden = !show; | |
| 2087 | - li.removeAttribute('aria-selected'); | |
| 2088 | - if (show) { shown++; } | |
| 2087 | + var groups = sw.querySelectorAll('[data-ref-group]'); | |
| 2088 | + var total = 0; | |
| 2089 | + groups.forEach(function (group) { | |
| 2090 | + var shown = 0; | |
| 2091 | + group.querySelectorAll('[data-ref-item]').forEach(function (li, i) { | |
| 2092 | + var name = li.getAttribute('data-ref-name') || ''; | |
| 2093 | + var show = q ? name.toLowerCase().indexOf(q) >= 0 : i < REF_SHOWN; | |
| 2094 | + li.hidden = !show; | |
| 2095 | + li.removeAttribute('aria-selected'); | |
| 2096 | + if (show) { shown++; refMark(li.querySelector('.ref-text'), name, q); } | |
| 2097 | + }); | |
| 2098 | + group.hidden = shown === 0; | |
| 2099 | + total += shown; | |
| 2089 | 2100 | }); |
| 2090 | - if (empty) { empty.hidden = shown > 0; } | |
| 2101 | + var empty = sw.querySelector('[data-ref-empty]'); | |
| 2102 | + if (empty && groups.length) { empty.hidden = total > 0; } | |
| 2091 | 2103 | refSelect(sw, 0); |
| 2092 | 2104 | } |
| 2093 | 2105 | |
| 2094 | - function refSelect(sw, index) { | |
| 2095 | - var panel = refPanelOf(sw); | |
| 2106 | + function refSelect(sw, index, keep) { | |
| 2096 | 2107 | var input = sw.querySelector('[data-ref-filter]'); |
| 2097 | - var shown = refShown(panel); | |
| 2108 | + var shown = refShown(sw); | |
| 2098 | 2109 | if (!shown.length) { input.removeAttribute('aria-activedescendant'); return; } |
| 2099 | 2110 | index = Math.max(0, Math.min(shown.length - 1, index)); |
| 2100 | 2111 | shown.forEach(function (li, i) { li.setAttribute('aria-selected', i === index ? 'true' : 'false'); }); |
| 2101 | 2112 | input.setAttribute('aria-activedescendant', shown[index].id); |
| 2102 | - shown[index].scrollIntoView({ block: 'nearest' }); | |
| 2103 | - panel.__sel = index; | |
| 2113 | + if (!keep) { shown[index].scrollIntoView({ block: 'nearest' }); } | |
| 2114 | + sw.__refSel = index; | |
| 2104 | 2115 | } |
| 2105 | 2116 | |
| 2106 | 2117 | // Opening the switcher clears the filter and focuses it. |
| @@ -2113,31 +2124,25 @@ | ||
| 2113 | 2124 | input.focus(); |
| 2114 | 2125 | }, true); |
| 2115 | 2126 | |
| 2116 | - document.addEventListener('click', function (e) { | |
| 2117 | - var tab = e.target && e.target.closest ? e.target.closest('[data-ref-tab]') : null; | |
| 2118 | - if (!tab) { return; } | |
| 2119 | - var sw = refSwitchOf(tab); | |
| 2120 | - var kind = tab.getAttribute('data-ref-tab'); | |
| 2121 | - sw.querySelectorAll('[data-ref-tab]').forEach(function (t) { | |
| 2122 | - t.setAttribute('aria-selected', t === tab ? 'true' : 'false'); | |
| 2123 | - }); | |
| 2124 | - sw.querySelectorAll('[data-ref-panel]').forEach(function (p) { | |
| 2125 | - p.hidden = p.getAttribute('data-ref-panel') !== kind; | |
| 2126 | - }); | |
| 2127 | - refApply(sw); | |
| 2127 | + // The pointer moves the selection, so the keys pick up where it is. | |
| 2128 | + document.addEventListener('mouseover', function (e) { | |
| 2129 | + var li = e.target && e.target.closest ? e.target.closest('[data-ref-item]') : null; | |
| 2130 | + if (!li) { return; } | |
| 2131 | + var sw = refSwitchOf(li); | |
| 2132 | + var i = refShown(sw).indexOf(li); | |
| 2133 | + if (i >= 0 && i !== sw.__refSel) { refSelect(sw, i, true); } | |
| 2128 | 2134 | }, false); |
| 2129 | 2135 | |
| 2130 | 2136 | document.addEventListener('keydown', function (e) { |
| 2131 | 2137 | var input = e.target && e.target.closest ? e.target.closest('[data-ref-filter]') : null; |
| 2132 | 2138 | if (!input) { return; } |
| 2133 | 2139 | var sw = refSwitchOf(input); |
| 2134 | - var panel = refPanelOf(sw); | |
| 2135 | - var sel = panel.__sel || 0; | |
| 2140 | + var sel = sw.__refSel || 0; | |
| 2136 | 2141 | if (e.key === 'ArrowDown') { e.preventDefault(); refSelect(sw, sel + 1); } |
| 2137 | 2142 | else if (e.key === 'ArrowUp') { e.preventDefault(); refSelect(sw, sel - 1); } |
| 2138 | 2143 | else if (e.key === 'Enter') { |
| 2139 | 2144 | e.preventDefault(); |
| 2140 | - var item = refShown(panel)[sel]; | |
| 2145 | + var item = refShown(sw)[sel]; | |
| 2141 | 2146 | var link = item ? item.querySelector('a') : null; |
| 2142 | 2147 | if (link) { sw.open = false; link.click(); } |
| 2143 | 2148 | } |
crates/forge-web/src/pages/refs.rsmodified+1 -0
| @@ -53,6 +53,7 @@ pub fn ref_links( | ||
| 53 | 53 | name: r.name.clone(), |
| 54 | 54 | href: repo_href(&repo.owner_name, &repo.name, "tree", &r.name), |
| 55 | 55 | current: r.name == current, |
| 56 | + default: r.kind == RefKind::Branch && r.name == default_branch, | |
| 56 | 57 | updated: r.committer_time, |
| 57 | 58 | }; |
| 58 | 59 | let branches = sorted |
crates/forge-web/src/views/mod.rsmodified+60 -46
| @@ -23,7 +23,7 @@ use topcoat::context::{Cx, try_app_context}; | ||
| 23 | 23 | use topcoat::router::request::uri; |
| 24 | 24 | use topcoat::router::response::{Response, response_headers}; |
| 25 | 25 | use topcoat::router::{Body, Next, layer}; |
| 26 | -use topcoat::view::{Child, View, component, view}; | |
| 26 | +use topcoat::view::{Child, Unescaped, View, component, view}; | |
| 27 | 27 | |
| 28 | 28 | use crate::i18n::admin::{self as ad, K as AK}; |
| 29 | 29 | use crate::i18n::code::{self as g, K}; |
| @@ -1222,61 +1222,69 @@ pub async fn repo_tabs( | ||
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | /// A branch or tag in the ref switcher. `href` points at its root tree; `updated` is the commit |
| 1225 | -/// time of its tip (unix seconds). | |
| 1225 | +/// time of its tip (unix seconds); `default` marks the repository's default branch. | |
| 1226 | 1226 | #[derive(Clone)] |
| 1227 | 1227 | pub struct RefLink { |
| 1228 | 1228 | pub name: String, |
| 1229 | 1229 | pub href: String, |
| 1230 | 1230 | pub current: bool, |
| 1231 | + pub default: bool, | |
| 1231 | 1232 | pub updated: i64, |
| 1232 | 1233 | } |
| 1233 | 1234 | |
| 1234 | -/// Entries listed before the filter narrows the list. The rest stay in the page, hidden, so the | |
| 1235 | -/// filter still finds every name. | |
| 1236 | -pub const REF_SHOWN: usize = 10; | |
| 1235 | +/// Entries each section lists before the filter narrows it. The rest stay in the page, hidden, so | |
| 1236 | +/// the filter still finds every name. | |
| 1237 | +pub const REF_SHOWN: usize = 8; | |
| 1237 | 1238 | |
| 1238 | -/// One tab of the ref switcher: its entries, then the link to the full list. | |
| 1239 | +const BRANCH_ICON: &str = r#"<svg viewBox="0 0 24 24"><circle cx="6" cy="5" r="2"/><circle cx="6" cy="19" r="2"/><circle cx="18" cy="6" r="2"/><path d="M6 7v10M18 8c0 4-6 4-12 9"/></svg>"#; | |
| 1240 | +const TAG_ICON: &str = r#"<svg viewBox="0 0 24 24"><path d="M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8z"/><circle cx="7.5" cy="7.5" r="1.5"/></svg>"#; | |
| 1241 | + | |
| 1242 | +/// One section of the ref switcher: a heading with its count, then its entries. An empty section | |
| 1243 | +/// is left out. | |
| 1239 | 1244 | #[component] |
| 1240 | -async fn ref_panel( | |
| 1245 | +async fn ref_group( | |
| 1241 | 1246 | lang: Lang, |
| 1242 | 1247 | kind: &'static str, |
| 1248 | + heading: &'static str, | |
| 1243 | 1249 | links: Vec<RefLink>, |
| 1244 | - all_href: String, | |
| 1245 | - all_label: &'static str, | |
| 1250 | + now: i64, | |
| 1246 | 1251 | ) -> Result<impl View> { |
| 1247 | - let empty = links.is_empty(); | |
| 1252 | + let count = links.len(); | |
| 1253 | + let icon = if kind == "tags" { TAG_ICON } else { BRANCH_ICON }; | |
| 1254 | + let head_id = format!("ref-head-{kind}"); | |
| 1248 | 1255 | Ok(view! { |
| 1249 | - <div class="ref-panel" role="tabpanel" data-ref-panel=(kind) hidden=(kind != "branches")> | |
| 1250 | - if empty { | |
| 1251 | - <p class="muted small ref-note">(g::t(lang, K::NothingHere))</p> | |
| 1252 | - } else { | |
| 1253 | - <ul class="ref-list" role="listbox"> | |
| 1256 | + if count > 0 { | |
| 1257 | + <div class="ref-group" data-ref-group=""> | |
| 1258 | + <div class="ref-head" id=(head_id.as_str())> | |
| 1259 | + <span>(heading)</span> | |
| 1260 | + <span class="ref-count">(count)</span> | |
| 1261 | + </div> | |
| 1262 | + <ul class="ref-list" role="group" aria-labelledby=(head_id.as_str())> | |
| 1254 | 1263 | for (n, link) in links.into_iter().enumerate() { |
| 1255 | - <li role="option" id=(format!("ref-{kind}-{n}")) data-ref-item="" hidden=((n >= REF_SHOWN).then_some(""))> | |
| 1256 | - if link.current { | |
| 1257 | - <a class="current" aria-current="true" href=(link.href)> | |
| 1258 | - <span class="ref-check" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg></span> | |
| 1259 | - <span class="ref-text">(link.name)</span> | |
| 1260 | - </a> | |
| 1261 | - } else { | |
| 1262 | - <a href=(link.href)> | |
| 1263 | - <span class="ref-check" aria-hidden="true"></span> | |
| 1264 | - <span class="ref-text">(link.name)</span> | |
| 1265 | - </a> | |
| 1266 | - } | |
| 1264 | + <li role="option" id=(format!("ref-{kind}-{n}")) data-ref-item="" | |
| 1265 | + data-ref-name=(link.name.as_str()) aria-current=(link.current.then_some("true")) | |
| 1266 | + hidden=((n >= REF_SHOWN).then_some(""))> | |
| 1267 | + <a href=(link.href)> | |
| 1268 | + <span class="ref-kind" aria-hidden="true">(Unescaped::new_unchecked(icon))</span> | |
| 1269 | + <span class="ref-text">(link.name.as_str())</span> | |
| 1270 | + if link.default { | |
| 1271 | + <span class="ref-chip">(g::t(lang, K::DefaultBadge))</span> | |
| 1272 | + } | |
| 1273 | + <span class="ref-age">(relative_time(lang, link.updated, now))</span> | |
| 1274 | + </a> | |
| 1267 | 1275 | </li> |
| 1268 | 1276 | } |
| 1269 | 1277 | </ul> |
| 1270 | - <p class="muted small ref-note" data-ref-empty="" hidden=(true)>(g::t(lang, K::NoMatches))</p> | |
| 1271 | - } | |
| 1272 | - <a class="ref-all" href=(all_href)>(all_label)</a> | |
| 1273 | - </div> | |
| 1278 | + </div> | |
| 1279 | + } | |
| 1274 | 1280 | }) |
| 1275 | 1281 | } |
| 1276 | 1282 | |
| 1277 | 1283 | /// Branch and tag switcher for the browse bar: a button showing the current ref that opens a |
| 1278 | -/// popover with a filter, Branches and Tags tabs, and a link to each full list. The filter, tabs and | |
| 1279 | -/// arrow keys are wired in `assets/nav.js`; without it the popover still lists the first entries. | |
| 1284 | +/// command-palette popover: a search field over one list with a Branches and a Tags section, each | |
| 1285 | +/// row with its last commit's age, and a footer with key hints and links to the full lists. The | |
| 1286 | +/// filter, match highlight and arrow keys are wired in `assets/nav.js`; without it the popover | |
| 1287 | +/// still lists the first entries of each section. | |
| 1280 | 1288 | #[component] |
| 1281 | 1289 | pub async fn ref_selector( |
| 1282 | 1290 | lang: Lang, |
| @@ -1289,29 +1297,35 @@ pub async fn ref_selector( | ||
| 1289 | 1297 | ) -> Result<impl View> { |
| 1290 | 1298 | // A tag shows a tag icon only when it is the current ref and no branch of that name is. |
| 1291 | 1299 | let is_tag = !branches.iter().any(|b| b.current) && tags.iter().any(|t| t.current); |
| 1300 | + let none = branches.is_empty() && tags.is_empty(); | |
| 1301 | + let now = now_unix(); | |
| 1292 | 1302 | Ok(view! { |
| 1293 | 1303 | <details class="ref-select" data-ref-switch=""> |
| 1294 | 1304 | <summary title=(label) aria-label=(format!("{label}: {current}"))> |
| 1295 | - if is_tag { | |
| 1296 | - <span class="ref-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8z"/><circle cx="7.5" cy="7.5" r="1.5"/></svg></span> | |
| 1297 | - } else { | |
| 1298 | - <span class="ref-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><circle cx="6" cy="5" r="2"/><circle cx="6" cy="19" r="2"/><circle cx="18" cy="6" r="2"/><path d="M6 7v10M18 8c0 4-6 4-12 9"/></svg></span> | |
| 1299 | - } | |
| 1305 | + <span class="ref-icon" aria-hidden="true">(Unescaped::new_unchecked(if is_tag { TAG_ICON } else { BRANCH_ICON }))</span> | |
| 1300 | 1306 | <code class="ref-name">(current.as_str())</code> |
| 1301 | 1307 | <span class="ref-caret" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg></span> |
| 1302 | 1308 | </summary> |
| 1303 | 1309 | <div class="ref-menu"> |
| 1304 | - <div class="ref-top"> | |
| 1310 | + <label class="ref-search"> | |
| 1311 | + <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg> | |
| 1305 | 1312 | <input type="text" class="ref-filter" data-ref-filter="" autocomplete="off" spellcheck="false" |
| 1306 | 1313 | placeholder=(g::t(lang, K::FilterRefs)) aria-label=(g::t(lang, K::FilterRefs)) |
| 1307 | - role="combobox" aria-expanded="true" aria-autocomplete="list"> | |
| 1308 | - <div class="ref-tabs" role="tablist"> | |
| 1309 | - <button type="button" role="tab" aria-selected="true" data-ref-tab="branches">(g::t(lang, K::BranchesTitle))</button> | |
| 1310 | - <button type="button" role="tab" aria-selected="false" data-ref-tab="tags">(g::t(lang, K::TagsTitle))</button> | |
| 1311 | - </div> | |
| 1314 | + role="combobox" aria-expanded="true" aria-autocomplete="list" aria-controls="ref-results"> | |
| 1315 | + <kbd>"esc"</kbd> | |
| 1316 | + </label> | |
| 1317 | + <div class="ref-results" id="ref-results" role="listbox"> | |
| 1318 | + ref_group(lang: lang, kind: "branches", heading: g::t(lang, K::BranchesTitle), links: branches, now: now) | |
| 1319 | + ref_group(lang: lang, kind: "tags", heading: g::t(lang, K::TagsTitle), links: tags, now: now) | |
| 1320 | + <p class="muted small ref-note" data-ref-empty="" hidden=(!none)> | |
| 1321 | + (g::t(lang, if none { K::NothingHere } else { K::NoMatches })) | |
| 1322 | + </p> | |
| 1323 | + </div> | |
| 1324 | + <div class="ref-foot"> | |
| 1325 | + <span class="ref-keys" aria-hidden="true"><kbd>"↑"</kbd><kbd>"↓"</kbd><kbd>"↵"</kbd></span> | |
| 1326 | + <a href=(branches_href) title=(g::t(lang, K::ViewAllBranches))>(g::t(lang, K::BranchesTitle))" ↗"</a> | |
| 1327 | + <a href=(tags_href) title=(g::t(lang, K::ViewAllTags))>(g::t(lang, K::TagsTitle))" ↗"</a> | |
| 1312 | 1328 | </div> |
| 1313 | - ref_panel(lang: lang, kind: "branches", links: branches, all_href: branches_href, all_label: g::t(lang, K::ViewAllBranches)) | |
| 1314 | - ref_panel(lang: lang, kind: "tags", links: tags, all_href: tags_href, all_label: g::t(lang, K::ViewAllTags)) | |
| 1315 | 1329 | </div> |
| 1316 | 1330 | </details> |
| 1317 | 1331 | }) |
style/main.scssmodified+171 -96
| @@ -1164,148 +1164,229 @@ code { | ||
| 1164 | 1164 | } |
| 1165 | 1165 | } |
| 1166 | 1166 | |
| 1167 | -// Branch switcher popover: filter and tabs on top, the entries below, scrolling inside. | |
| 1167 | +// Branch switcher popover, laid out as a command palette: a borderless search row, one scrolling | |
| 1168 | +// list with a Branches and a Tags section, and a footer with key hints and the full lists. | |
| 1168 | 1169 | .ref-menu { |
| 1169 | 1170 | position: absolute; |
| 1170 | 1171 | left: 0; |
| 1171 | 1172 | top: calc(100% + 6px); |
| 1172 | 1173 | z-index: 10; |
| 1173 | - width: 300px; | |
| 1174 | + width: 360px; | |
| 1174 | 1175 | max-width: calc(100vw - 32px); |
| 1175 | - max-height: 60vh; | |
| 1176 | + max-height: min(60vh, 480px); | |
| 1176 | 1177 | display: flex; |
| 1177 | 1178 | flex-direction: column; |
| 1179 | + overflow: hidden; | |
| 1178 | 1180 | background: var(--surface); |
| 1179 | 1181 | border: 1px solid var(--border); |
| 1180 | 1182 | border-radius: var(--radius-lg); |
| 1181 | - box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); | |
| 1183 | + box-shadow: var(--shadow); | |
| 1184 | + | |
| 1185 | + kbd { | |
| 1186 | + min-width: 18px; | |
| 1187 | + padding: 0 5px; | |
| 1188 | + font-family: var(--mono); | |
| 1189 | + font-size: 11px; | |
| 1190 | + line-height: 18px; | |
| 1191 | + text-align: center; | |
| 1192 | + color: var(--muted); | |
| 1193 | + background: var(--surface); | |
| 1194 | + border: 1px solid var(--border-strong); | |
| 1195 | + border-radius: var(--radius-sm); | |
| 1196 | + } | |
| 1182 | 1197 | } |
| 1183 | 1198 | |
| 1184 | -// The tabs row is the bottom edge of the top block: its underline sits on the divider. | |
| 1185 | -.ref-top { | |
| 1186 | - padding: 8px 8px 0; | |
| 1199 | +// The search row is part of the menu, not a field inside it: no box, only the divider below. | |
| 1200 | +.ref-search { | |
| 1201 | + flex: none; | |
| 1202 | + display: flex; | |
| 1203 | + align-items: center; | |
| 1204 | + gap: 10px; | |
| 1205 | + padding: 0 12px; | |
| 1206 | + color: var(--muted); | |
| 1187 | 1207 | border-bottom: 1px solid var(--border); |
| 1208 | + | |
| 1209 | + &:focus-within { | |
| 1210 | + color: var(--accent); | |
| 1211 | + } | |
| 1188 | 1212 | } |
| 1189 | 1213 | |
| 1190 | 1214 | .ref-filter { |
| 1191 | - width: 100%; | |
| 1192 | - height: var(--control-h); | |
| 1193 | - box-sizing: border-box; | |
| 1194 | - padding: 0 10px; | |
| 1215 | + flex: 1 1 auto; | |
| 1216 | + min-width: 0; | |
| 1217 | + height: 46px; | |
| 1218 | + padding: 0; | |
| 1195 | 1219 | font: inherit; |
| 1196 | - font-size: 14px; | |
| 1220 | + font-size: 15px; | |
| 1197 | 1221 | color: var(--text); |
| 1198 | - background: var(--surface-2); | |
| 1199 | - border: 1px solid var(--border); | |
| 1200 | - border-radius: var(--radius-md); | |
| 1222 | + background: transparent; | |
| 1223 | + border: 0; | |
| 1224 | + | |
| 1225 | + &::placeholder { | |
| 1226 | + color: var(--muted); | |
| 1227 | + } | |
| 1201 | 1228 | |
| 1202 | 1229 | &:focus, |
| 1203 | 1230 | &:focus-visible { |
| 1204 | 1231 | outline: none; |
| 1205 | - border-color: var(--focus); | |
| 1206 | - box-shadow: 0 0 0 3px var(--accent-soft); | |
| 1207 | - } | |
| 1208 | -} | |
| 1209 | - | |
| 1210 | -// Underline tabs: the 2px underline overlaps the 1px divider of .ref-top. | |
| 1211 | -.ref-tabs { | |
| 1212 | - display: flex; | |
| 1213 | - gap: 16px; | |
| 1214 | - margin: 8px 0 -1px; | |
| 1215 | - | |
| 1216 | - button { | |
| 1217 | - flex: 0 0 auto; | |
| 1218 | - min-height: 32px; | |
| 1219 | - padding: 0 2px; | |
| 1220 | - font: inherit; | |
| 1221 | - font-size: 13px; | |
| 1222 | - color: var(--muted); | |
| 1223 | - background: transparent; | |
| 1224 | - border: 0; | |
| 1225 | - border-bottom: 2px solid transparent; | |
| 1226 | - border-radius: 0; | |
| 1227 | - cursor: pointer; | |
| 1228 | - | |
| 1229 | - &:hover { | |
| 1230 | - color: var(--text); | |
| 1231 | - } | |
| 1232 | - | |
| 1233 | - &[aria-selected="true"] { | |
| 1234 | - color: var(--text); | |
| 1235 | - font-weight: 600; | |
| 1236 | - border-bottom-color: var(--accent); | |
| 1237 | - } | |
| 1238 | - | |
| 1239 | - &:focus-visible { | |
| 1240 | - outline: 2px solid var(--focus); | |
| 1241 | - outline-offset: -2px; | |
| 1242 | - box-shadow: none; | |
| 1243 | - } | |
| 1232 | + box-shadow: none; | |
| 1244 | 1233 | } |
| 1245 | 1234 | } |
| 1246 | 1235 | |
| 1247 | -.ref-panel { | |
| 1236 | +.ref-results { | |
| 1248 | 1237 | min-height: 0; |
| 1249 | 1238 | overflow-y: auto; |
| 1250 | - padding: 4px 0; | |
| 1239 | + padding: 6px; | |
| 1251 | 1240 | } |
| 1252 | 1241 | |
| 1253 | -.ref-note { | |
| 1254 | - margin: 8px 14px; | |
| 1242 | +.ref-group + .ref-group { | |
| 1243 | + margin-top: 6px; | |
| 1244 | + padding-top: 6px; | |
| 1245 | + border-top: 1px dashed var(--border); | |
| 1255 | 1246 | } |
| 1256 | 1247 | |
| 1257 | -.ref-all { | |
| 1258 | - display: block; | |
| 1259 | - margin-top: 4px; | |
| 1260 | - padding: 8px 14px; | |
| 1261 | - font-size: 13px; | |
| 1262 | - color: var(--text-2); | |
| 1263 | - text-decoration: none; | |
| 1264 | - border-top: 1px solid var(--border); | |
| 1248 | +.ref-head { | |
| 1249 | + display: flex; | |
| 1250 | + align-items: center; | |
| 1251 | + gap: 6px; | |
| 1252 | + padding: 6px 8px 4px; | |
| 1253 | + font-size: 11px; | |
| 1254 | + font-weight: 600; | |
| 1255 | + letter-spacing: 0.06em; | |
| 1256 | + text-transform: uppercase; | |
| 1257 | + color: var(--muted); | |
| 1258 | +} | |
| 1265 | 1259 | |
| 1266 | - &:hover { | |
| 1267 | - color: var(--text); | |
| 1268 | - background: var(--surface-2); | |
| 1269 | - } | |
| 1260 | +.ref-count { | |
| 1261 | + padding: 0 6px; | |
| 1262 | + font-family: var(--mono); | |
| 1263 | + font-size: 10px; | |
| 1264 | + letter-spacing: 0; | |
| 1265 | + line-height: 16px; | |
| 1266 | + background: var(--surface-2); | |
| 1267 | + border-radius: var(--radius-full); | |
| 1268 | +} | |
| 1269 | + | |
| 1270 | +.ref-note { | |
| 1271 | + margin: 10px 8px; | |
| 1270 | 1272 | } |
| 1271 | 1273 | |
| 1272 | -// Rows: a fixed 16px gutter holds the checkmark on the current ref, so names line up. | |
| 1274 | +// Rows: kind icon, the name in mono, an optional default chip, and the tip's age pushed right. | |
| 1275 | +// The selected row (keys or pointer) gets a soft fill; the current ref an accent rail and name. | |
| 1273 | 1276 | .ref-list { |
| 1274 | 1277 | list-style: none; |
| 1275 | 1278 | margin: 0; |
| 1276 | 1279 | padding: 0; |
| 1277 | 1280 | |
| 1278 | - li[aria-selected="true"] a, | |
| 1279 | - a:hover { | |
| 1280 | - background: var(--surface-2); | |
| 1281 | - } | |
| 1282 | - | |
| 1283 | 1281 | a { |
| 1282 | + position: relative; | |
| 1284 | 1283 | display: flex; |
| 1285 | 1284 | align-items: center; |
| 1286 | 1285 | gap: 8px; |
| 1287 | - padding: 6px 14px; | |
| 1286 | + padding: 7px 8px 7px 10px; | |
| 1288 | 1287 | color: var(--text); |
| 1289 | 1288 | text-decoration: none; |
| 1289 | + border-radius: var(--radius-md); | |
| 1290 | + } | |
| 1290 | 1291 | |
| 1291 | - &.current { | |
| 1292 | + li[aria-selected="true"] a { | |
| 1293 | + background: var(--surface-2); | |
| 1294 | + } | |
| 1295 | + | |
| 1296 | + li[aria-current="true"] a { | |
| 1297 | + color: var(--accent); | |
| 1298 | + background: var(--accent-soft); | |
| 1299 | + | |
| 1300 | + &::before { | |
| 1301 | + content: ""; | |
| 1302 | + position: absolute; | |
| 1303 | + left: 0; | |
| 1304 | + top: 7px; | |
| 1305 | + bottom: 7px; | |
| 1306 | + width: 3px; | |
| 1307 | + background: var(--accent); | |
| 1308 | + border-radius: var(--radius-full); | |
| 1309 | + } | |
| 1310 | + | |
| 1311 | + .ref-text { | |
| 1292 | 1312 | font-weight: 600; |
| 1293 | 1313 | } |
| 1314 | + | |
| 1315 | + .ref-kind { | |
| 1316 | + color: inherit; | |
| 1317 | + } | |
| 1294 | 1318 | } |
| 1295 | 1319 | |
| 1296 | - .ref-check { | |
| 1320 | + .ref-kind { | |
| 1297 | 1321 | display: inline-flex; |
| 1298 | 1322 | flex: none; |
| 1299 | - width: 16px; | |
| 1300 | - height: 16px; | |
| 1323 | + color: var(--muted); | |
| 1324 | + | |
| 1325 | + svg { | |
| 1326 | + width: 14px; | |
| 1327 | + height: 14px; | |
| 1328 | + } | |
| 1301 | 1329 | } |
| 1302 | 1330 | |
| 1303 | 1331 | .ref-text { |
| 1304 | 1332 | min-width: 0; |
| 1333 | + font-family: var(--mono); | |
| 1334 | + font-size: 13px; | |
| 1305 | 1335 | word-break: break-all; |
| 1336 | + | |
| 1337 | + mark { | |
| 1338 | + color: inherit; | |
| 1339 | + background: var(--row-target); | |
| 1340 | + border-radius: 2px; | |
| 1341 | + } | |
| 1342 | + } | |
| 1343 | + | |
| 1344 | + .ref-chip { | |
| 1345 | + flex: none; | |
| 1346 | + padding: 0 6px; | |
| 1347 | + font-size: 11px; | |
| 1348 | + line-height: 18px; | |
| 1349 | + color: var(--text-2); | |
| 1350 | + border: 1px solid var(--border-strong); | |
| 1351 | + border-radius: var(--radius-full); | |
| 1352 | + } | |
| 1353 | + | |
| 1354 | + .ref-age { | |
| 1355 | + flex: none; | |
| 1356 | + margin-left: auto; | |
| 1357 | + padding-left: 8px; | |
| 1358 | + font-size: 12px; | |
| 1359 | + color: var(--muted); | |
| 1360 | + white-space: nowrap; | |
| 1361 | + } | |
| 1362 | +} | |
| 1363 | + | |
| 1364 | +.ref-foot { | |
| 1365 | + flex: none; | |
| 1366 | + display: flex; | |
| 1367 | + align-items: center; | |
| 1368 | + gap: 14px; | |
| 1369 | + padding: 8px 12px; | |
| 1370 | + font-size: 12px; | |
| 1371 | + background: var(--surface-2); | |
| 1372 | + border-top: 1px solid var(--border); | |
| 1373 | + | |
| 1374 | + a { | |
| 1375 | + color: var(--text-2); | |
| 1376 | + text-decoration: none; | |
| 1377 | + | |
| 1378 | + &:hover { | |
| 1379 | + color: var(--accent); | |
| 1380 | + } | |
| 1306 | 1381 | } |
| 1307 | 1382 | } |
| 1308 | 1383 | |
| 1384 | +.ref-keys { | |
| 1385 | + display: inline-flex; | |
| 1386 | + gap: 4px; | |
| 1387 | + margin-right: auto; | |
| 1388 | +} | |
| 1389 | + | |
| 1309 | 1390 | .crumbs { |
| 1310 | 1391 | min-width: 0; |
| 1311 | 1392 | font-size: 0.9375rem; |
| @@ -2040,29 +2121,23 @@ code { | ||
| 2040 | 2121 | box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12), 0 0 0 100vmax rgba(0, 0, 0, 0.4); |
| 2041 | 2122 | } |
| 2042 | 2123 | |
| 2043 | - .ref-top { | |
| 2044 | - padding: 8px 16px 0; | |
| 2045 | - } | |
| 2046 | - | |
| 2047 | - .ref-note { | |
| 2048 | - margin: 8px 16px; | |
| 2049 | - } | |
| 2050 | - | |
| 2051 | 2124 | .ref-filter { |
| 2052 | - height: 44px; | |
| 2125 | + height: 52px; | |
| 2053 | 2126 | font-size: 16px; |
| 2054 | 2127 | } |
| 2055 | 2128 | |
| 2056 | - .ref-tabs button { | |
| 2057 | - min-height: 44px; | |
| 2129 | + .ref-list a { | |
| 2130 | + padding: 12px 10px 12px 12px; | |
| 2058 | 2131 | } |
| 2059 | 2132 | |
| 2060 | - .ref-list a { | |
| 2061 | - padding: 12px 16px; | |
| 2133 | + // No keyboard on a phone: the footer keeps only the links. | |
| 2134 | + .ref-keys { | |
| 2135 | + display: none; | |
| 2062 | 2136 | } |
| 2063 | 2137 | |
| 2064 | - .ref-all { | |
| 2065 | - padding: 14px 16px; | |
| 2138 | + .ref-foot { | |
| 2139 | + justify-content: flex-end; | |
| 2140 | + padding: 12px 16px; | |
| 2066 | 2141 | } |
| 2067 | 2142 | } |
| 2068 | 2143 |