Settings > Panel: a cleaner module selector with reordering
CI / test (push) Failing after 17s

The Panel tab was one flat list: every panel module with an "x" that removed
it on any click, then every module on disk again with cryptic "x1" counts and
a Browse row that looked selected.

- "In the panel, left to right": the modules in panel order, each with
  move up / move down / remove buttons. Clicking the row itself does nothing,
  so a stray click no longer removes a module. Backspace/Delete removes the
  highlighted one, PageUp/PageDown move it.
- "Add to the panel": grouped (Apps and windows, System, Clocks, Other),
  each with a one-line description and an Add button. A module already in the
  panel is left out, except clocks, which offer "Add another". With nothing
  left: "Everything is in the panel".
- "Browse for a module file..." is a secondary outlined button.
- Section headings are larger and full contrast; the popup is 320 wide and
  now fits a 720-high screen with the default panel.

Reordering goes through a new modules.move-instance(slot, delta) capability
call, plumbed through both hosts: wasmer stub request 17, host-wasm, the
plasmoids host WIT (move-instance(instance-move)) and wasmhost. The shell's
move_slot clamps to the ends and saves panel.edn, so the saved format is
unchanged. DesktopShell::slot_popup_texts lets tests find popup rows by text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhRDWZf5WcmrNwnFe3
This commit is contained in:
Claude committed 2026-11-25 20:35:54 +00:00
1 parent c1936299cb
commit 8ecdef17d4
16 files changed
+514 -98

No files matched your search

+41 -20
View File
@@ -596,34 +596,55 @@ test "the wasm picker opens the settings module's Panel tab, which loads and unl
ignore(comp.compose_frame())
let pr = comp.shell.slot_popup_rect(mgr)
assert_true(pr.w > 0) // the picker opened the popup
// Rows below the tab bar (40): heading, one per loaded module, heading, one per available
// module, browse; 28 each.
let loaded = comp.shell.slots().length()
assert_true(pr.h >= 40 + (loaded + 3) * 28)
let avail_y = fn(pr : @scene.Rect, k : Int) { pr.y + 40 + (loaded + 2 + k) * 28 + 13 }
let mut k_bin = -1
for k = 0; k < comp.shell.catalog.length(); k = k + 1 {
if comp.shell.catalog[k].id == "clock-binary" {
k_bin = k
// Find rows by their text: the y of the first (or last) line reading `label`.
let row_y = fn(label : String, last : Bool) -> Int {
let mut y = -1
for t in comp.shell.slot_popup_texts(mgr) {
if t.0 == label && (last || y < 0) {
y = t.2
}
}
y
}
assert_true(k_bin >= 0)
let texts = comp.shell.slot_popup_texts(mgr).map(t => t.0)
assert_true(texts.contains("In the panel, left to right"))
assert_true(texts.contains("Add to the panel"))
assert_true(texts.contains("Browse for a module file..."))
// The Add list leaves out what is already in the panel (but a clock can be added twice) and
// has no cryptic instance counts.
assert_eq(texts.filter(t => t == "Task Manager").length(), 1)
assert_false(texts.contains("x1"))
assert_true(texts.contains("Pinned apps, one click away")) // the Dock's description
let loaded = comp.shell.slots().length()
assert_eq(comp.shell.slot_of("clock-binary"), "")
click_at(comp, pr.x + 40, avail_y(pr, k_bin), 20U) // select it: it is loaded into the panel
let by = row_y("Binary Clock", false)
assert_true(by > 0)
click_at(comp, pr.x + 40, pr.y + by, 20U) // its Add row: it is loaded into the panel
assert_true(comp.shell.slot_of("clock-binary") != "")
assert_eq(comp.shell.slots().length(), loaded + 1)
// The popup stays open (it grew a row); click the loaded module's row to unload it again.
ignore(comp.compose_frame())
// A clock can go in twice, so it stays in the Add list, offered as another one.
assert_true(comp.shell.slot_popup_texts(mgr).map(t => t.0).contains("Add another"))
let pr2 = comp.shell.slot_popup_rect(mgr)
assert_true(pr2.w > 0)
assert_true(pr2.w > 0) // the popup stays open
let bin = comp.shell.slot_of("clock-binary")
let ly = row_y("Binary Clock", false) // now the panel list's row comes first
// Clicking the row itself does nothing: only its buttons act.
click_at(comp, pr2.x + 40, pr2.y + ly, 30U)
assert_eq(comp.shell.slot_of("clock-binary"), bin)
// It was added at the end; move it up one place with the up button.
let slots = comp.shell.slots()
let mut idx = -1
for i = 0; i < slots.length(); i = i + 1 {
if slots[i] == comp.shell.slot_of("clock-binary") {
idx = i
}
}
click_at(comp, pr2.x + 40, pr2.y + 40 + (1 + idx) * 28 + 13, 30U)
assert_eq(slots[slots.length() - 1], bin)
click_at(comp, pr2.x + pr2.w - 86, pr2.y + ly, 40U)
let moved = comp.shell.slots()
assert_eq(moved[moved.length() - 2], bin)
assert_eq(moved.length(), slots.length())
// Then remove it with its x button (its row moved up one place).
ignore(comp.compose_frame())
let pr3 = comp.shell.slot_popup_rect(mgr)
let ly3 = row_y("Binary Clock", false)
assert_true(ly3 < ly)
click_at(comp, pr3.x + pr3.w - 24, pr3.y + ly3, 50U)
assert_eq(comp.shell.slot_of("clock-binary"), "")
assert_eq(comp.shell.slots().length(), loaded)
// The settings module is just another module: it can be removed too, and the picker brings it