();
const pairs: [LibraryRow, number][] = [];
for (const j of artist >= 0 ? [artist, album] : [album]) {
if (j < 0) continue;
const held = previous.get(j);
const pair =
held && sameHeaderRow(held[0], rs[j]!) ? held : ([rs[j]!, j] as [LibraryRow, number]);
next.set(j, pair);
pairs.push(pair);
}
pinnedPairs = next;
return pairs;
};
return (
<>
{/* The library's own readout strip: what the index holds, how far the crawl has
got, and the news of a key. The field that used to sit at its left end is now
the command line above the transport (components/CommandLine.tsx), and the
search wash that lit this bar for it went with the field — the instrument that
answers "am I inside a search?" is the one holding the text now. The view toggle
has no buttons and no legend: `g` and Escape are the documented keys, and chrome
here would advertise a mouse this keyboard-first app does not want. */}
{count(cells().length, "album")}
{/* The harvest, in the gutter the counts already live in, and only while it
has something to say. Once the index is ready the list is the readout —
a total there repeats what the rows below already add up to — but while
it is not, this is the only place a user learns how far the crawl has got
or that the server is unreachable. The crawl line is the toolbar's bottom
border for the same duration. */}
{/* The share result, in the gutter where counts live. It replaces nothing and
is dismissed by the next key, because a link you have already pasted is
noise — except the line that reports a refused copy, which is kept: it is
the only place that link and that reason exist. The URL is its own span so
one click selects just it (see `.lib-share-url`), since a link set inside a
sentence has to be dragged across to be copied. */}
{(line) => (
{line().note}
{(u) => {u()}}
{line().tail}
)}
{/* Always mounted, and empty when there is nothing to say, rather than brought in
by the message: a live region has to be in the document before its text changes
or assistive tech treats the change as new markup and stays quiet. The empty span
is taken out of the flex row by `.lib-note:empty`, so an idle toolbar keeps its
gap. */}
{notice()?.text ?? ""}
{/* The commit this bundle was built from, pinned to the right end of the strip —
far from the readouts so it never moves when a line arrives, and faint enough
to read only when looked for. It is stamped at build time (vite.config.ts),
which is the whole point: this app gets opened from devices that cannot open
a terminal, and "which build am I looking at" should be answerable from the
screen. Absent entirely when the tree that built it knew no VCS. */}
{__COMMIT__}
{/* The list is the one pane that stays painted while it is not the view
being looked at: the gallery floats over the tracks it was made from
(see `.lib-pane--behind`). `inert` is what keeps them scenery — it is
set here, not by the stylesheet, so the paint and the a11y tree are
decided in one place. */}
row(r, i, false)}
>
{(r, i) => row(r, i)}
>
);
};
export default LibraryView;