web: motion across panes and rows, and the last polish
- Panes fade in on a destination/tab/selection change only; list rows FLIP when they move (sort, star, filter) and fade in when they appear; removals close the gap through the same move. Reduced-motion users get none of it. - Modal panels (audit, viewers, diff, tool calls, confirmations) arrive with a short scale/fade. - A collapsed list hides its filter/sort toolbars; the Refresh tooltip is stamped as soon as a populated list first paints. - The smoke settles after a sort before measuring a row for a click.
This commit is contained in:
@@ -720,6 +720,18 @@ function renderHeader() {
|
||||
if (active) control.setAttribute("aria-current", "page");
|
||||
else control.removeAttribute("aria-current");
|
||||
}
|
||||
// The list's data may have arrived before its first paint (the run watch's
|
||||
// snapshot); stamp it so the Refresh tooltip is never "Not refreshed yet"
|
||||
// while the list is visibly populated.
|
||||
const loaded =
|
||||
state.view === "runs"
|
||||
? state.runsLoaded
|
||||
: state.view === "pipelines"
|
||||
? state.pipelinesLoaded
|
||||
: state.view === "chat"
|
||||
? state.chatLoaded
|
||||
: true;
|
||||
if (loaded && !(Number(state.lastUpdated?.[state.view]) > 0)) touchView(state.view);
|
||||
railSearch.setAttribute("aria-expanded", state.searchOpen ? "true" : "false");
|
||||
dockSearch.setAttribute("aria-expanded", state.searchOpen ? "true" : "false");
|
||||
// aria-controls points at #searchPanel only while that panel exists.
|
||||
@@ -1189,7 +1201,55 @@ function renderContent() {
|
||||
// next render can put the operator back exactly where they were (a dialog, a
|
||||
// refresh or a paging frame must not move them).
|
||||
captureChatPosition();
|
||||
// A list re-render is animated, never jump-cut: rows that moved keep their
|
||||
// visual place with a FLIP, new rows fade in, and a destination/tab/selection
|
||||
// change fades the pane in once (the same view's live updates do not replay it).
|
||||
const reduceMotion =
|
||||
typeof window.matchMedia === "function" &&
|
||||
window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
const before = new Map();
|
||||
if (!reduceMotion) {
|
||||
for (const node of content.querySelectorAll("[data-animate-key]")) {
|
||||
before.set(node.getAttribute("data-animate-key"), node.getBoundingClientRect());
|
||||
}
|
||||
}
|
||||
content.replaceChildren(...nodes);
|
||||
if (!reduceMotion) {
|
||||
for (const node of content.querySelectorAll("[data-animate-key]")) {
|
||||
const key = node.getAttribute("data-animate-key");
|
||||
const prior = before.get(key);
|
||||
if (prior) {
|
||||
const rect = node.getBoundingClientRect();
|
||||
const dx = prior.left - rect.left;
|
||||
const dy = prior.top - rect.top;
|
||||
if (Math.abs(dx) > 0.5 || Math.abs(dy) > 0.5) {
|
||||
node.animate(
|
||||
[{ transform: `translate(${dx}px, ${dy}px)` }, { transform: "translate(0, 0)" }],
|
||||
{ duration: 180, easing: "ease-out" },
|
||||
);
|
||||
}
|
||||
} else {
|
||||
node.classList.add("row-enter");
|
||||
node.addEventListener("animationend", () => node.classList.remove("row-enter"), {
|
||||
once: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
const key = [
|
||||
state.view,
|
||||
state.selectedPipelineId ?? "",
|
||||
state.selectedRunId ?? "",
|
||||
state.runTab ?? "",
|
||||
state.pipelineTab ?? "",
|
||||
state.chatActiveId ?? "",
|
||||
].join("|");
|
||||
if (state.lastRenderKey !== key) {
|
||||
state.lastRenderKey = key;
|
||||
content.classList.remove("view-enter");
|
||||
void content.offsetWidth;
|
||||
content.classList.add("view-enter");
|
||||
}
|
||||
}
|
||||
if (state.view === "chat") {
|
||||
afterChatRender();
|
||||
modal.reconcile();
|
||||
|
||||
@@ -269,6 +269,7 @@ function renderPipelineRow(pipeline, latestRuns, runsKnown, now) {
|
||||
{
|
||||
class: `row${state.selectedPipelineId === pipeline.id ? " selected" : ""}`,
|
||||
"data-pipeline-id": String(pipeline.id),
|
||||
"data-animate-key": `pipeline:${pipeline.id}`,
|
||||
onclick: () => selectPipeline(pipeline),
|
||||
},
|
||||
...children,
|
||||
|
||||
@@ -119,6 +119,7 @@ function renderRunRow(run, now) {
|
||||
const row = h("button", {
|
||||
class: `row run-row${state.selectedRunId === run.id ? " selected" : ""}`,
|
||||
"data-run-id": String(run.id),
|
||||
"data-animate-key": `run:${run.id}`,
|
||||
onclick: () => selectRun(run.id),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user