feat(console-web): add swinging iframe load progress

- place an indeterminate progress track below the loading label
- animate the indicator between both ends of the track
- expose an accessible progressbar label for the active view
- honor reduced-motion preferences with a static indicator
This commit is contained in:
Maofeng
2026-07-30 10:11:52 +08:00
parent 391901a71a
commit 868da49a52
2 changed files with 38 additions and 3 deletions
+10 -1
View File
@@ -482,10 +482,19 @@ export default function HostApp() {
</For> </For>
<Show when={!frameReady()}> <Show when={!frameReady()}>
<div class="pointer-events-none absolute inset-0 flex items-center justify-center bg-canvas"> <div class="pointer-events-none absolute inset-0 flex items-center justify-center bg-canvas">
<div class="flex items-center gap-2 text-sm text-muted"> <div class="flex flex-col items-center gap-3 text-sm text-muted">
<div class="flex items-center gap-2">
<span class="size-2 animate-pulse rounded-full bg-brand" /> <span class="size-2 animate-pulse rounded-full bg-brand" />
{title()} {title()}
</div> </div>
<div
class="loading-progress-track"
role="progressbar"
aria-label={`${title()}加载进度`}
>
<span class="loading-progress-indicator" />
</div>
</div>
</div> </div>
</Show> </Show>
<Show when={connection() === "offline"}> <Show when={connection() === "offline"}>
@@ -317,13 +317,39 @@
@apply h-3 animate-pulse rounded-sm bg-[#dfe6e4]; @apply h-3 animate-pulse rounded-sm bg-[#dfe6e4];
} }
.loading-progress-track {
@apply h-1 w-40 overflow-hidden rounded-sm bg-line;
}
.loading-progress-indicator {
@apply block h-full w-[36%] rounded-sm bg-brand;
animation: loading-progress-swing 1s ease-in-out infinite alternate;
}
.spin { .spin {
animation: spin 0.8s linear infinite; animation: spin 0.8s linear infinite;
} }
} }
@keyframes loading-progress-swing {
from {
transform: translateX(0);
}
to {
transform: translateX(178%);
}
}
@keyframes spin { @keyframes spin {
to { to {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
@media (prefers-reduced-motion: reduce) {
.loading-progress-indicator {
animation: none;
transform: translateX(89%);
}
}