mirror of
https://github.com/yibaiba/hideck.git
synced 2026-12-06 00:01:20 +00:00
fix(web): refine global loading state
This commit is contained in:
1 parent
06fd373519
commit
28488d4aed
2 files changed
+81
-42
No files matched your search
@@ -6,75 +6,95 @@ defineProps({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="loading-screen min-h-[260px] w-full flex items-center justify-center" role="status" aria-live="polite">
|
||||
<div class="loading-panel">
|
||||
<span class="loading-mark">V</span>
|
||||
<div class="loading-screen" role="status" aria-live="polite">
|
||||
<div class="loading-state">
|
||||
<div class="loading-context">
|
||||
<span class="loading-dot" aria-hidden="true" />
|
||||
<span>VOHIVE CONTROL PLANE</span>
|
||||
</div>
|
||||
<div class="loading-copy">
|
||||
<strong>{{ title }}</strong>
|
||||
<span>{{ subtitle }}</span>
|
||||
</div>
|
||||
<span class="loading-spinner" aria-hidden="true" />
|
||||
<span class="loading-line" aria-hidden="true" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.loading-panel {
|
||||
width: min(100%, 420px);
|
||||
min-height: 72px;
|
||||
padding: 14px 16px;
|
||||
display: grid;
|
||||
grid-template-columns: 38px minmax(0, 1fr) 20px;
|
||||
align-items: center;
|
||||
gap: 13px;
|
||||
border: 1px solid var(--ui-border);
|
||||
border-radius: 6px;
|
||||
background: var(--ui-surface);
|
||||
box-shadow: var(--ui-shadow-sm);
|
||||
}
|
||||
|
||||
.loading-mark {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
.loading-screen {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 260px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border-radius: 5px;
|
||||
background: var(--ui-primary-solid);
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
overflow: hidden;
|
||||
background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--ui-primary) 7%, transparent), transparent 34%);
|
||||
}
|
||||
|
||||
.loading-state {
|
||||
width: min(calc(100% - 40px), 360px);
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
animation: loading-state-enter 220ms var(--ui-ease-out) both;
|
||||
}
|
||||
|
||||
.loading-context {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--ui-primary);
|
||||
font: 700 var(--ui-font-caption) "v-mono", ui-monospace, monospace;
|
||||
letter-spacing: .14em;
|
||||
}
|
||||
|
||||
.loading-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
flex: 0 0 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--ui-primary);
|
||||
box-shadow: 0 0 12px color-mix(in srgb, var(--ui-primary) 55%, transparent);
|
||||
}
|
||||
|
||||
.loading-copy {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.loading-copy strong {
|
||||
overflow: hidden;
|
||||
color: var(--ui-text);
|
||||
font-size: 14px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 18px;
|
||||
font-weight: 650;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.loading-copy span {
|
||||
overflow: hidden;
|
||||
color: var(--ui-text-muted);
|
||||
font-size: var(--ui-font-caption);
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: var(--ui-font-body-sm);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.loading-spinner {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 2px solid color-mix(in srgb, var(--ui-primary) 25%, var(--ui-border));
|
||||
border-top-color: var(--ui-primary);
|
||||
border-radius: 50%;
|
||||
animation: spin .72s linear infinite;
|
||||
.loading-line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
margin-top: 4px;
|
||||
background: linear-gradient(90deg, var(--ui-primary), color-mix(in srgb, var(--ui-primary) 18%, transparent) 46%, transparent 82%);
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
@keyframes loading-state-enter {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.loading-state { animation-name: loading-state-fade; }
|
||||
|
||||
@keyframes loading-state-fade {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,19 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const source = readFileSync(new URL('../src/components/LoadingScreen.vue', import.meta.url), 'utf8')
|
||||
|
||||
test('loading state uses a lightweight workspace surface instead of a notification card', () => {
|
||||
assert.match(source, /class="loading-screen" role="status" aria-live="polite"/)
|
||||
assert.match(source, /class="loading-state"/)
|
||||
assert.match(source, /VOHIVE CONTROL PLANE/)
|
||||
assert.doesNotMatch(source, /loading-panel|loading-mark|loading-spinner/)
|
||||
})
|
||||
|
||||
test('loading state motion is brief, transform-opacity only, and reduced-motion safe', () => {
|
||||
assert.match(source, /animation: loading-state-enter 220ms var\(--ui-ease-out\) both/)
|
||||
assert.match(source, /@keyframes loading-state-enter\s*\{[^}]*opacity: 0; transform: translateY\(6px\)/s)
|
||||
assert.doesNotMatch(source, /animation:[^;]*infinite/)
|
||||
assert.match(source, /@media \(prefers-reduced-motion: reduce\)[\s\S]*animation-name: loading-state-fade/)
|
||||
})
|
||||
Reference in new issue
Block a user