From 6ab97f1fb0832f483ae81d50b5354d389930e52a Mon Sep 17 00:00:00 2001 From: Pavel Kuznetsov Date: Mon, 30 Nov 2026 11:47:20 +0300 Subject: [PATCH] feat(ui): pin Community Store above installed add-ins --- CommunityStore/ui/store.css | 5 +++-- CommunityStore/ui/store.js | 11 +++++++---- tests/test_palette_browser.cjs | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/CommunityStore/ui/store.css b/CommunityStore/ui/store.css index bffe938..ca77170 100644 --- a/CommunityStore/ui/store.css +++ b/CommunityStore/ui/store.css @@ -195,8 +195,9 @@ main:has(#installed:not([hidden])) {scrollbar-gutter:stable} #notice-dismiss:hover {background:var(--hover)} table {width:100%;border-collapse:separate;border-spacing:0} .installed-table {table-layout:fixed} +.installed-table .store-row:not(:last-child) {--row-divider:3px solid var(--line)} .installed-table thead {position:sticky;top:0;z-index:1;background:var(--surface)} -.installed-table th, .installed-table td {padding:5px 4px;text-align:center;border-bottom:1px solid var(--soft-line)} +.installed-table th, .installed-table td {padding:5px 4px;text-align:center;border-bottom:var(--row-divider,1px solid var(--soft-line))} .installed-table thead th {font-size:11px;line-height:1.2;font-weight:650;color:var(--secondary);height:32px;vertical-align:middle;border-block-start:1px solid var(--soft-line)} .installed-table :is(.source-cell,.author-cell) {display:none;text-align:start;overflow-wrap:anywhere} .installed-credits {display:flex;flex-wrap:wrap;gap:1px 8px;margin-top:1px;color:var(--muted);font-size:12px;font-weight:450} @@ -453,7 +454,7 @@ fieldset label.unavailable { color: var(--muted); } #toolbar:has(#sources:not([hidden])) #check:not([data-checking]) span {display:none} .installed-table, .installed-table tbody {display:block} .installed-table thead {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)} - .installed-table tbody tr {display:grid;grid-template-columns:22px minmax(90px,1fr) minmax(96px,1fr) repeat(2,minmax(0,1fr)) 32px;gap:5px 6px;align-items:start;padding:8px 3px;border-bottom:1px solid var(--soft-line)} + .installed-table tbody tr {display:grid;grid-template-columns:22px minmax(90px,1fr) minmax(96px,1fr) repeat(2,minmax(0,1fr)) 32px;gap:5px 6px;align-items:start;padding:8px 3px;border-bottom:var(--row-divider,1px solid var(--soft-line))} .installed-table tbody :is(th,td) {width:auto;min-width:0;padding:0;border:0;text-align:start} .installed-table .selection-cell {grid-column:1;grid-row:1;align-self:center;text-align:center} .installed-table .identity-cell {grid-column:2/-2;grid-row:1} diff --git a/CommunityStore/ui/store.js b/CommunityStore/ui/store.js index c61f3b1..4cf4f56 100644 --- a/CommunityStore/ui/store.js +++ b/CommunityStore/ui/store.js @@ -461,6 +461,7 @@ function installedRow(row) { const tr = node("tr"); tr.setAttribute("role", "row"); tr.dataset.row = row.key; + if (row.self) tr.classList.add("store-row"); const cell = (name, label, heading = false) => { const element = node(heading ? "th" : "td", name + "-cell"); element.setAttribute("role", heading ? "rowheader" : "cell"); @@ -964,14 +965,16 @@ function render() { if (detail) { renderDetails(details.local, details.entry, details.installations); } else if (tab === "installed") { - const rows = state.installed.filter((row) => matches(row) && + const matching = state.installed.filter((row) => matches(row) && (!updatesOnly || row.update || row.newerTag)); - if (search || updatesOnly) filteredCount = rows.length; + const store = state.installed.find((row) => row.self); + const rows = store ? [store, ...matching.filter((row) => !row.self)] : matching; + if (search || updatesOnly) filteredCount = matching.length; replaceList(tab, find("installed-body"), rows, installedRow); const empty = find("installed-empty"); - empty.hidden = Boolean(rows.length); + empty.hidden = Boolean(matching.length); find("installed").querySelector("table").hidden = !rows.length; - if (!rows.length) { + if (!matching.length) { if (search || updatesOnly) { renderEmpty(empty, search ? "search_empty" : "updates_empty", clearFilters, "clear_filters"); } else { diff --git a/tests/test_palette_browser.cjs b/tests/test_palette_browser.cjs index 71025af..caf860e 100644 --- a/tests/test_palette_browser.cjs +++ b/tests/test_palette_browser.cjs @@ -213,6 +213,29 @@ test("palette actions, keyboard focus and localization", async (suite) => { } }); + await suite.test("the Store stays first and separate when filtering installed add-ins", async (test) => { + const {page} = await openPalette(browser, {language: "en"}); + test.after(() => page.close()); + await page.evaluate(() => { + Object.assign(window.fixture.model.installed[2], {self: true, name: "Community Store"}); + window.fixture.publish(); + }); + const rows = page.locator("#installed-body tr"); + assert.deepEqual(await rows.evaluateAll(items => items.map(item => item.dataset.row)), + ["app-store", "panel", "linked"]); + for (const width of [900, 400]) { + await page.setViewportSize({width, height: 680}); + const divider = width > 570 ? rows.first().locator("td").first() : rows.first(); + assert.equal(await divider.evaluate(el => getComputedStyle(el).borderBottomWidth), "3px"); + } + await page.locator("#updates-only").check(); + assert.deepEqual(await rows.evaluateAll(items => items.map(item => item.dataset.row)), ["app-store", "panel"]); + await page.locator("#search").fill("No matching plugin"); + assert.equal(await rows.count(), 1); + assert.equal(await rows.first().getAttribute("data-row"), "app-store"); + assert(await page.locator("#installed-empty").isVisible()); + }); + await suite.test("a hung state read is retried and its late response is ignored", async (test) => { const {page, errors} = await openPalette(browser, {language: "en", hangFirstState: true}); test.after(() => page.close());