mirror of
https://github.com/groundfic/image-peek.git
synced 2026-07-22 07:44:37 +00:00
168 lines
3.5 KiB
CSS
168 lines
3.5 KiB
CSS
/* Quick Peek — Quick Look 式圖片預覽 */
|
||
|
||
.image-peek-overlay {
|
||
position: fixed;
|
||
inset: 0;
|
||
z-index: var(--layer-modal, 50);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.image-peek-overlay .qp-backdrop {
|
||
position: absolute;
|
||
inset: 0;
|
||
background: rgba(0, 0, 0, 0.42);
|
||
opacity: 0;
|
||
transition: opacity 220ms ease;
|
||
}
|
||
.image-peek-overlay.qp-blur .qp-backdrop {
|
||
backdrop-filter: blur(10px) saturate(1.1);
|
||
-webkit-backdrop-filter: blur(10px) saturate(1.1);
|
||
}
|
||
.image-peek-overlay.qp-open .qp-backdrop {
|
||
opacity: 1;
|
||
}
|
||
.image-peek-overlay.qp-closing .qp-backdrop {
|
||
opacity: 0;
|
||
}
|
||
|
||
/* 面板 */
|
||
.image-peek-overlay .qp-panel {
|
||
position: relative;
|
||
display: flex;
|
||
flex-direction: column;
|
||
max-width: min(96vw, 1500px);
|
||
max-height: 94vh;
|
||
border-radius: 14px;
|
||
overflow: hidden;
|
||
background: var(--background-primary);
|
||
box-shadow:
|
||
0 0 0 0.5px rgba(0, 0, 0, 0.2),
|
||
0 24px 64px rgba(0, 0, 0, 0.4);
|
||
opacity: 0;
|
||
transition: opacity 180ms ease;
|
||
}
|
||
.image-peek-overlay.qp-open .qp-panel {
|
||
opacity: 1;
|
||
}
|
||
|
||
/* 標題列:模仿 Quick Look,半透明浮在內容上 */
|
||
.image-peek-overlay .qp-header {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
height: 42px;
|
||
padding: 0 10px;
|
||
flex-shrink: 0;
|
||
background: color-mix(in srgb, var(--background-primary) 88%, transparent);
|
||
backdrop-filter: blur(12px);
|
||
-webkit-backdrop-filter: blur(12px);
|
||
border-bottom: 1px solid var(--background-modifier-border);
|
||
}
|
||
|
||
.image-peek-overlay .qp-title {
|
||
flex: 1;
|
||
text-align: center;
|
||
font-size: var(--font-ui-small);
|
||
font-weight: 600;
|
||
color: var(--text-normal);
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
padding: 0 8px;
|
||
}
|
||
|
||
.image-peek-overlay .qp-actions {
|
||
display: flex;
|
||
gap: 4px;
|
||
}
|
||
|
||
.image-peek-overlay .qp-btn {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 28px;
|
||
height: 28px;
|
||
border-radius: 7px;
|
||
color: var(--text-muted);
|
||
cursor: var(--cursor, pointer);
|
||
transition: background 120ms ease, color 120ms ease;
|
||
}
|
||
.image-peek-overlay .qp-btn:hover {
|
||
background: var(--background-modifier-hover);
|
||
color: var(--text-normal);
|
||
}
|
||
.image-peek-overlay .qp-btn svg {
|
||
width: 16px;
|
||
height: 16px;
|
||
}
|
||
|
||
/* 舞台 */
|
||
.image-peek-overlay .qp-stage {
|
||
position: relative;
|
||
touch-action: none;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
overflow: hidden;
|
||
padding: 6px;
|
||
min-width: 240px;
|
||
min-height: 160px;
|
||
background:
|
||
radial-gradient(
|
||
circle at 50% 40%,
|
||
color-mix(in srgb, var(--background-secondary) 60%, transparent),
|
||
transparent 70%
|
||
);
|
||
}
|
||
|
||
.image-peek-overlay .qp-img {
|
||
max-width: calc(96vw - 12px);
|
||
max-height: calc(94vh - 42px - 12px);
|
||
object-fit: contain;
|
||
border-radius: 6px;
|
||
cursor: grab;
|
||
user-select: none;
|
||
-webkit-user-select: none;
|
||
-webkit-user-drag: none;
|
||
touch-action: none;
|
||
will-change: transform;
|
||
}
|
||
.image-peek-overlay .qp-img.qp-grabbing {
|
||
cursor: grabbing;
|
||
}
|
||
|
||
/* 頁碼 */
|
||
.image-peek-overlay .qp-counter {
|
||
position: absolute;
|
||
bottom: 10px;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
font-size: var(--font-ui-smaller);
|
||
color: var(--text-faint);
|
||
background: color-mix(in srgb, var(--background-primary) 80%, transparent);
|
||
padding: 2px 10px;
|
||
border-radius: 99px;
|
||
pointer-events: none;
|
||
}
|
||
.image-peek-overlay .qp-counter:empty {
|
||
display: none;
|
||
}
|
||
|
||
/* 進場前先隱藏,避免閃爍 */
|
||
.image-peek-overlay.qp-entering .qp-panel {
|
||
opacity: 1;
|
||
}
|
||
.image-peek-overlay.qp-entering .qp-backdrop {
|
||
opacity: 1;
|
||
transition: none;
|
||
}
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
.image-peek-overlay .qp-backdrop,
|
||
.image-peek-overlay .qp-panel,
|
||
.image-peek-overlay .qp-img {
|
||
transition: none;
|
||
}
|
||
}
|