| @@ -0,0 +1,794 @@ |
| 1 | <script setup lang="ts"> |
| 2 | import { computed, ref, onMounted, watch } from 'vue' |
| 3 | import { renderEmojiShortcodes } from '../../configs/markdown/emoji' |
| 4 | import type { HomeCard } from '../../configs/constants' |
| 5 | |
| 6 | const props = defineProps<{ cards: HomeCard[] }>() |
| 7 | |
| 8 | const STORAGE_KEY = 'wotaku-home-cards-v1' |
| 9 | const PREFS_KEY = 'wotaku-home-prefs-v1' |
| 10 | |
| 11 | interface CardState { |
| 12 | order: string[] |
| 13 | hidden: string[] |
| 14 | } |
| 15 | |
| 16 | function defaultState(): CardState { |
| 17 | return { |
| 18 | order: props.cards.map((c) => c.id), |
| 19 | hidden: props.cards.filter((c) => !c.featured).map((c) => c.id) |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | const state = ref<CardState>(defaultState()) |
| 24 | |
| 25 | onMounted(() => { |
| 26 | const raw = localStorage.getItem(STORAGE_KEY) |
| 27 | if (!raw) return |
| 28 | try { |
| 29 | const parsed: CardState = JSON.parse(raw) |
| 30 | const allIds = new Set(props.cards.map((c) => c.id)) |
| 31 | const validOrder = parsed.order.filter((id) => allIds.has(id)) |
| 32 | const seenIds = new Set(validOrder) |
| 33 | const newIds = props.cards.map((c) => c.id).filter((id) => !seenIds.has(id)) |
| 34 | state.value = { |
| 35 | order: [...validOrder, ...newIds], |
| 36 | hidden: (parsed.hidden ?? []).filter((id: string) => allIds.has(id)) |
| 37 | } |
| 38 | } catch {} |
| 39 | }) |
| 40 | |
| 41 | function save() { |
| 42 | localStorage.setItem(STORAGE_KEY, JSON.stringify(state.value)) |
| 43 | } |
| 44 | |
| 45 | const cardMap = computed(() => new Map(props.cards.map((c) => [c.id, c]))) |
| 46 | |
| 47 | const orderedCards = computed(() => |
| 48 | state.value.order.map((id) => cardMap.value.get(id)!).filter(Boolean) |
| 49 | ) |
| 50 | |
| 51 | const hiddenSet = computed(() => new Set(state.value.hidden)) |
| 52 | |
| 53 | const visibleCards = computed(() => |
| 54 | orderedCards.value.filter((c) => !hiddenSet.value.has(c.id)) |
| 55 | ) |
| 56 | |
| 57 | const grid = computed(() => { |
| 58 | const n = visibleCards.value.length |
| 59 | if (n === 0) return undefined |
| 60 | if (columnMode.value === 'max') return 'grid-max' |
| 61 | if (n === 2) return 'grid-2' |
| 62 | if (n === 3) return 'grid-3' |
| 63 | if (n % 3 === 0) return 'grid-6' |
| 64 | if (n > 3) return 'grid-4' |
| 65 | return undefined |
| 66 | }) |
| 67 | |
| 68 | function cardIcon(card: HomeCard) { |
| 69 | return renderEmojiShortcodes(card.icon) |
| 70 | } |
| 71 | |
| 72 | /* ── Manager panel ── */ |
| 73 | const panelOpen = ref(false) |
| 74 | const dropdownOpen = ref(false) |
| 75 | const sortMode = ref<'default' | 'active'>('default') |
| 76 | const columnMode = ref<'default' | 'max'>('default') |
| 77 | |
| 78 | onMounted(() => { |
| 79 | try { |
| 80 | const prefs = JSON.parse(localStorage.getItem(PREFS_KEY) ?? '{}') |
| 81 | if (prefs.sortMode === 'active') sortMode.value = 'active' |
| 82 | if (prefs.columnMode === 'max') columnMode.value = 'max' |
| 83 | } catch {} |
| 84 | }) |
| 85 | |
| 86 | watch([sortMode, columnMode], () => { |
| 87 | localStorage.setItem(PREFS_KEY, JSON.stringify({ |
| 88 | sortMode: sortMode.value, |
| 89 | columnMode: columnMode.value |
| 90 | })) |
| 91 | }) |
| 92 | |
| 93 | const panelCards = computed(() => { |
| 94 | if (sortMode.value === 'active') { |
| 95 | const visible = orderedCards.value.filter((c) => !hiddenSet.value.has(c.id)) |
| 96 | const hidden = orderedCards.value.filter((c) => hiddenSet.value.has(c.id)) |
| 97 | return [...visible, ...hidden] |
| 98 | } |
| 99 | return orderedCards.value |
| 100 | }) |
| 101 | |
| 102 | function toggleCard(id: string) { |
| 103 | const h = state.value.hidden |
| 104 | const i = h.indexOf(id) |
| 105 | if (i === -1) h.push(id) |
| 106 | else h.splice(i, 1) |
| 107 | save() |
| 108 | } |
| 109 | |
| 110 | function showAll() { |
| 111 | state.value.hidden = [] |
| 112 | save() |
| 113 | } |
| 114 | |
| 115 | function hideAll() { |
| 116 | state.value.hidden = props.cards.map((c) => c.id) |
| 117 | save() |
| 118 | } |
| 119 | |
| 120 | function resetDefaults() { |
| 121 | state.value = defaultState() |
| 122 | save() |
| 123 | } |
| 124 | |
| 125 | /* ── Drag-to-reorder (pointer events — works on mouse & touch) ── */ |
| 126 | const dragging = ref<string | null>(null) |
| 127 | const dragTarget = ref<string | null>(null) |
| 128 | const cardListEl = ref<HTMLElement | null>(null) |
| 129 | const ghostPos = ref<{ x: number; y: number } | null>(null) |
| 130 | |
| 131 | function onHandlePointerDown(e: PointerEvent, id: string) { |
| 132 | e.preventDefault() |
| 133 | dragging.value = id |
| 134 | dragTarget.value = null |
| 135 | ghostPos.value = { x: e.clientX, y: e.clientY } |
| 136 | ;(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId) |
| 137 | } |
| 138 | |
| 139 | function onHandlePointerMove(e: PointerEvent) { |
| 140 | if (!dragging.value) return |
| 141 | ghostPos.value = { x: e.clientX, y: e.clientY } |
| 142 | const items = cardListEl.value?.querySelectorAll<HTMLElement>('[data-card-id]') |
| 143 | if (!items) return |
| 144 | for (const item of items) { |
| 145 | const rect = item.getBoundingClientRect() |
| 146 | if ( |
| 147 | e.clientX >= rect.left && e.clientX <= rect.right && |
| 148 | e.clientY >= rect.top && e.clientY <= rect.bottom |
| 149 | ) { |
| 150 | const id = item.dataset.cardId! |
| 151 | if (id !== dragging.value) dragTarget.value = id |
| 152 | break |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | function onHandlePointerUp() { |
| 158 | if (dragging.value && dragTarget.value) { |
| 159 | const order = panelCards.value.map((c) => c.id) |
| 160 | const from = order.indexOf(dragging.value) |
| 161 | const to = order.indexOf(dragTarget.value) |
| 162 | if (from !== -1 && to !== -1) { |
| 163 | order.splice(from, 1) |
| 164 | order.splice(to, 0, dragging.value) |
| 165 | state.value.order = order |
| 166 | save() |
| 167 | } |
| 168 | } |
| 169 | dragging.value = null |
| 170 | dragTarget.value = null |
| 171 | ghostPos.value = null |
| 172 | } |
| 173 | </script> |
| 174 | |
| 175 | <template> |
| 176 | <!-- ── Feature Grid ── --> |
| 177 | <div class="home-features"> |
| 178 | <div class="container"> |
| 179 | <div class="items"> |
| 180 | <div |
| 181 | v-for="card in visibleCards" |
| 182 | :key="card.id" |
| 183 | class="item" |
| 184 | :class="grid" |
| 185 | > |
| 186 | <a class="card" :href="card.link"> |
| 187 | <article class="box"> |
| 188 | <div class="icon" v-html="cardIcon(card)" /> |
| 189 | <h2 class="title">{{ card.title }}</h2> |
| 190 | <p class="details">{{ card.details }}</p> |
| 191 | </article> |
| 192 | </a> |
| 193 | </div> |
| 194 | </div> |
| 195 | <button class="gear-btn" aria-label="Customize cards" @click="panelOpen = true"> |
| 196 | <span class="i-lucide-ellipsis-vertical" /> |
| 197 | </button> |
| 198 | </div> |
| 199 | </div> |
| 200 | |
| 201 | <!-- ── Manager Panel ── --> |
| 202 | <Teleport to="body"> |
| 203 | <Transition name="fade"> |
| 204 | <div v-if="panelOpen" class="backdrop" @click.self="panelOpen = false"> |
| 205 | <Transition name="slide-up" appear> |
| 206 | <div v-if="panelOpen" class="panel" role="dialog" aria-modal="true" aria-label="Customize cards"> |
| 207 | <div class="panel-head"> |
| 208 | <span class="panel-title">Customize Cards</span> |
| 209 | <button class="close-btn" aria-label="Close" @click="panelOpen = false"> |
| 210 | <span class="i-lucide-x" /> |
| 211 | </button> |
| 212 | </div> |
| 213 | |
| 214 | <ul ref="cardListEl" class="card-list" :class="grid"> |
| 215 | <li |
| 216 | v-for="card in panelCards" |
| 217 | :key="card.id" |
| 218 | :data-card-id="card.id" |
| 219 | class="card-row" |
| 220 | :class="{ |
| 221 | 'is-dragging': dragging === card.id, |
| 222 | 'is-over': dragTarget === card.id && dragging !== card.id, |
| 223 | 'is-hidden': hiddenSet.has(card.id) |
| 224 | }" |
| 225 | > |
| 226 | <span |
| 227 | class="row-handle" |
| 228 | aria-hidden="true" |
| 229 | @pointerdown="onHandlePointerDown($event, card.id)" |
| 230 | @pointermove="onHandlePointerMove" |
| 231 | @pointerup="onHandlePointerUp" |
| 232 | > |
| 233 | <span class="i-lucide-grip-vertical" /> |
| 234 | </span> |
| 235 | <span class="row-icon" v-html="cardIcon(card)" /> |
| 236 | <span class="row-name">{{ card.title }}</span> |
| 237 | <button |
| 238 | class="row-toggle" |
| 239 | :class="{ active: !hiddenSet.has(card.id) }" |
| 240 | :aria-label="hiddenSet.has(card.id) ? 'Show' : 'Hide'" |
| 241 | @click="toggleCard(card.id)" |
| 242 | > |
| 243 | <span :class="hiddenSet.has(card.id) ? 'i-lucide-eye-off' : 'i-lucide-eye'" /> |
| 244 | </button> |
| 245 | </li> |
| 246 | </ul> |
| 247 | |
| 248 | <div class="panel-foot"> |
| 249 | <div class="foot-group"> |
| 250 | <button class="tool-btn" aria-label="Show all" @click="showAll"> |
| 251 | <span class="i-lucide-eye" /> |
| 252 | </button> |
| 253 | <button class="tool-btn" aria-label="Hide all" @click="hideAll"> |
| 254 | <span class="i-lucide-eye-off" /> |
| 255 | </button> |
| 256 | </div> |
| 257 | <div class="foot-group"> |
| 258 | <div class="settings-wrap"> |
| 259 | <div v-if="dropdownOpen" class="dropdown-overlay" @click="dropdownOpen = false" /> |
| 260 | <div v-if="dropdownOpen" class="settings-dropdown"> |
| 261 | <div class="dropdown-section"> |
| 262 | <span class="dropdown-label">Sort</span> |
| 263 | <div class="dropdown-group"> |
| 264 | <button class="tool-btn" :class="{ 'is-active': sortMode === 'default' }" @click="sortMode = 'default'">Default</button> |
| 265 | <button class="tool-btn" :class="{ 'is-active': sortMode === 'active' }" @click="sortMode = 'active'">Active</button> |
| 266 | </div> |
| 267 | </div> |
| 268 | <div class="dropdown-section"> |
| 269 | <span class="dropdown-label">Columns</span> |
| 270 | <div class="dropdown-group"> |
| 271 | <button class="tool-btn" :class="{ 'is-active': columnMode === 'default' }" @click="columnMode = 'default'">Default</button> |
| 272 | <button class="tool-btn" :class="{ 'is-active': columnMode === 'max' }" @click="columnMode = 'max'">Max</button> |
| 273 | </div> |
| 274 | </div> |
| 275 | </div> |
| 276 | <button |
| 277 | class="tool-btn" |
| 278 | :class="{ 'is-active': dropdownOpen }" |
| 279 | aria-label="Display settings" |
| 280 | @click.stop="dropdownOpen = !dropdownOpen" |
| 281 | > |
| 282 | <span class="i-lucide-settings-2" /> |
| 283 | </button> |
| 284 | </div> |
| 285 | <button class="tool-btn" aria-label="Reset to default" @click="resetDefaults"> |
| 286 | <span class="i-lucide-refresh-ccw" /> |
| 287 | </button> |
| 288 | </div> |
| 289 | </div> |
| 290 | </div> |
| 291 | </Transition> |
| 292 | </div> |
| 293 | </Transition> |
| 294 | |
| 295 | <Transition name="ghost-fade"> |
| 296 | <div |
| 297 | v-if="dragging && ghostPos" |
| 298 | class="drag-ghost" |
| 299 | :style="{ left: ghostPos.x + 'px', top: ghostPos.y + 'px' }" |
| 300 | > |
| 301 | <span class="row-icon" v-html="cardIcon(cardMap.get(dragging)!)" /> |
| 302 | <span class="drag-ghost-name">{{ cardMap.get(dragging)?.title }}</span> |
| 303 | </div> |
| 304 | </Transition> |
| 305 | </Teleport> |
| 306 | </template> |
| 307 | |
| 308 | <style scoped> |
| 309 | /* ── Grid ── */ |
| 310 | .home-features { |
| 311 | position: relative; |
| 312 | padding: 0 24px; |
| 313 | } |
| 314 | |
| 315 | @media (min-width: 640px) { |
| 316 | .home-features { padding: 0 48px; } |
| 317 | } |
| 318 | |
| 319 | @media (min-width: 960px) { |
| 320 | .home-features { padding: 0 64px; } |
| 321 | } |
| 322 | |
| 323 | .container { |
| 324 | position: relative; |
| 325 | margin: 0 auto; |
| 326 | max-width: 1152px; |
| 327 | } |
| 328 | |
| 329 | .items { |
| 330 | display: flex; |
| 331 | flex-wrap: wrap; |
| 332 | margin: -8px; |
| 333 | } |
| 334 | |
| 335 | .item { |
| 336 | padding: 8px; |
| 337 | width: 100%; |
| 338 | } |
| 339 | |
| 340 | @media (min-width: 640px) { |
| 341 | .item.grid-2, |
| 342 | .item.grid-4, |
| 343 | .item.grid-6 { width: calc(100% / 2); } |
| 344 | } |
| 345 | |
| 346 | @media (min-width: 768px) { |
| 347 | .item.grid-2, |
| 348 | .item.grid-4 { width: calc(100% / 2); } |
| 349 | .item.grid-3, |
| 350 | .item.grid-6 { width: calc(100% / 3); } |
| 351 | } |
| 352 | |
| 353 | @media (min-width: 960px) { |
| 354 | .item.grid-4 { width: calc(100% / 4); } |
| 355 | } |
| 356 | |
| 357 | @media (min-width: 640px) { |
| 358 | .item.grid-max { width: calc(100% / 2); } |
| 359 | } |
| 360 | |
| 361 | @media (min-width: 768px) { |
| 362 | .item.grid-max { width: calc(100% / 3); } |
| 363 | } |
| 364 | |
| 365 | @media (min-width: 960px) { |
| 366 | .item.grid-max { width: calc(100% / 4); } |
| 367 | } |
| 368 | |
| 369 | /* ── Card ── */ |
| 370 | .card { |
| 371 | display: block; |
| 372 | border: 2px solid #3d3d3d; |
| 373 | border-radius: 12px; |
| 374 | height: 100%; |
| 375 | background-color: var(--vp-c-bg-soft); |
| 376 | transition: border-color 0.25s, background-color 0.25s; |
| 377 | text-decoration: none; |
| 378 | color: inherit; |
| 379 | } |
| 380 | |
| 381 | .card:hover { |
| 382 | border-color: var(--vp-c-brand-1); |
| 383 | } |
| 384 | |
| 385 | .box { |
| 386 | display: flex; |
| 387 | flex-direction: column; |
| 388 | padding: 24px; |
| 389 | height: 100%; |
| 390 | } |
| 391 | |
| 392 | .icon { |
| 393 | display: flex; |
| 394 | justify-content: center; |
| 395 | align-items: center; |
| 396 | margin-bottom: 20px; |
| 397 | border-radius: 6px; |
| 398 | background-color: var(--vp-c-default-soft); |
| 399 | width: 48px; |
| 400 | height: 48px; |
| 401 | font-size: 27px; |
| 402 | transition: background-color 0.25s; |
| 403 | } |
| 404 | |
| 405 | .title { |
| 406 | line-height: 24px; |
| 407 | font-size: 16px; |
| 408 | font-weight: 600; |
| 409 | } |
| 410 | |
| 411 | .details { |
| 412 | flex-grow: 1; |
| 413 | padding-top: 8px; |
| 414 | line-height: 24px; |
| 415 | font-size: 14px; |
| 416 | font-weight: 500; |
| 417 | color: var(--vp-c-text-2); |
| 418 | } |
| 419 | |
| 420 | /* ── Gear Button ── */ |
| 421 | .gear-btn { |
| 422 | position: absolute; |
| 423 | top: 8px; |
| 424 | right: 0; |
| 425 | transform: translateX(100%); |
| 426 | background: none; |
| 427 | border: none; |
| 428 | padding: 4px; |
| 429 | color: var(--vp-c-text-3, var(--vp-c-text-2)); |
| 430 | font-size: 18px; |
| 431 | cursor: pointer; |
| 432 | transition: color 0.2s; |
| 433 | display: flex; |
| 434 | align-items: center; |
| 435 | } |
| 436 | |
| 437 | .gear-btn:hover { |
| 438 | color: var(--vp-c-brand-1); |
| 439 | } |
| 440 | |
| 441 | /* ── Backdrop ── */ |
| 442 | .backdrop { |
| 443 | position: fixed; |
| 444 | inset: 0; |
| 445 | z-index: 100; |
| 446 | display: flex; |
| 447 | align-items: center; |
| 448 | justify-content: center; |
| 449 | background: rgba(0, 0, 0, 0.5); |
| 450 | backdrop-filter: blur(4px); |
| 451 | } |
| 452 | |
| 453 | /* ── Panel ── */ |
| 454 | .panel { |
| 455 | width: min(520px, calc(100vw - 32px)); |
| 456 | max-height: 85vh; |
| 457 | display: flex; |
| 458 | flex-direction: column; |
| 459 | border-radius: 16px; |
| 460 | border: 2px solid #3d3d3d; |
| 461 | background: var(--vp-c-bg); |
| 462 | } |
| 463 | |
| 464 | @media (min-width: 768px) { |
| 465 | .panel { width: min(720px, calc(100vw - 32px)); } |
| 466 | } |
| 467 | |
| 468 | @media (min-width: 960px) { |
| 469 | .panel { width: min(940px, calc(100vw - 32px)); } |
| 470 | } |
| 471 | |
| 472 | .panel-head { |
| 473 | display: flex; |
| 474 | align-items: center; |
| 475 | justify-content: space-between; |
| 476 | padding: 10px 16px; |
| 477 | border-bottom: 1px solid var(--vp-c-divider); |
| 478 | flex-shrink: 0; |
| 479 | } |
| 480 | |
| 481 | .panel-title { |
| 482 | font-size: 15px; |
| 483 | font-weight: 600; |
| 484 | color: var(--vp-c-text-1); |
| 485 | } |
| 486 | |
| 487 | .close-btn { |
| 488 | position: relative; |
| 489 | display: flex; |
| 490 | align-items: center; |
| 491 | justify-content: center; |
| 492 | width: 28px; |
| 493 | height: 28px; |
| 494 | border-radius: 6px; |
| 495 | border: none; |
| 496 | background: transparent; |
| 497 | color: var(--vp-c-text-2); |
| 498 | font-size: 16px; |
| 499 | cursor: pointer; |
| 500 | transition: background 0.15s, color 0.15s; |
| 501 | } |
| 502 | |
| 503 | .close-btn:hover { |
| 504 | background: var(--vp-c-bg-soft); |
| 505 | color: var(--vp-c-text-1); |
| 506 | } |
| 507 | |
| 508 | .close-btn::after { |
| 509 | content: attr(aria-label); |
| 510 | position: absolute; |
| 511 | top: calc(100% + 6px); |
| 512 | right: 0; |
| 513 | background: var(--vp-c-bg-soft); |
| 514 | color: var(--vp-c-text-1); |
| 515 | border: 1px solid var(--vp-c-divider); |
| 516 | border-radius: 5px; |
| 517 | padding: 3px 8px; |
| 518 | font-size: 11px; |
| 519 | white-space: nowrap; |
| 520 | pointer-events: none; |
| 521 | opacity: 0; |
| 522 | transition: opacity 0.15s; |
| 523 | z-index: 10; |
| 524 | } |
| 525 | |
| 526 | .close-btn:hover::after { |
| 527 | opacity: 1; |
| 528 | } |
| 529 | |
| 530 | /* ── Card List ── */ |
| 531 | .card-list { |
| 532 | list-style: none; |
| 533 | margin: 0; |
| 534 | padding: 8px; |
| 535 | display: grid; |
| 536 | grid-template-columns: 1fr; |
| 537 | gap: 2px; |
| 538 | overflow-y: auto; |
| 539 | min-height: 0; |
| 540 | } |
| 541 | |
| 542 | @media (min-width: 640px) { |
| 543 | .card-list { grid-template-columns: 1fr 1fr; } |
| 544 | } |
| 545 | |
| 546 | @media (min-width: 768px) { |
| 547 | .card-list { grid-template-columns: 1fr 1fr 1fr; } |
| 548 | .card-list.grid-2, |
| 549 | .card-list.grid-4 { grid-template-columns: 1fr 1fr; } |
| 550 | } |
| 551 | |
| 552 | @media (min-width: 960px) { |
| 553 | .card-list.grid-4, |
| 554 | .card-list.grid-max { grid-template-columns: 1fr 1fr 1fr 1fr; } |
| 555 | } |
| 556 | |
| 557 | .card-row { |
| 558 | display: flex; |
| 559 | align-items: center; |
| 560 | gap: 8px; |
| 561 | padding: 7px 10px; |
| 562 | border-radius: 8px; |
| 563 | transition: background 0.15s, opacity 0.15s; |
| 564 | user-select: none; |
| 565 | } |
| 566 | |
| 567 | .card-row:hover { |
| 568 | background: var(--vp-c-bg-soft); |
| 569 | } |
| 570 | |
| 571 | .card-row.is-dragging { |
| 572 | opacity: 0.25; |
| 573 | cursor: grabbing; |
| 574 | } |
| 575 | |
| 576 | .card-row.is-over { |
| 577 | background: var(--vp-c-brand-soft); |
| 578 | outline: 2px solid var(--vp-c-brand-1); |
| 579 | outline-offset: -2px; |
| 580 | } |
| 581 | |
| 582 | .card-row.is-hidden { |
| 583 | opacity: 0.45; |
| 584 | } |
| 585 | |
| 586 | .row-handle { |
| 587 | color: var(--vp-c-text-3, var(--vp-c-text-2)); |
| 588 | font-size: 16px; |
| 589 | flex-shrink: 0; |
| 590 | display: flex; |
| 591 | align-items: center; |
| 592 | cursor: grab; |
| 593 | touch-action: none; |
| 594 | } |
| 595 | |
| 596 | .row-handle:active { |
| 597 | cursor: grabbing; |
| 598 | } |
| 599 | |
| 600 | .row-icon { |
| 601 | font-size: 18px; |
| 602 | flex-shrink: 0; |
| 603 | display: flex; |
| 604 | align-items: center; |
| 605 | width: 20px; |
| 606 | } |
| 607 | |
| 608 | .row-name { |
| 609 | flex: 1; |
| 610 | font-size: 14px; |
| 611 | font-weight: 500; |
| 612 | color: var(--vp-c-text-1); |
| 613 | } |
| 614 | |
| 615 | .row-toggle { |
| 616 | display: flex; |
| 617 | align-items: center; |
| 618 | justify-content: center; |
| 619 | width: 30px; |
| 620 | height: 30px; |
| 621 | border-radius: 6px; |
| 622 | border: none; |
| 623 | background: transparent; |
| 624 | color: var(--vp-c-text-2); |
| 625 | font-size: 16px; |
| 626 | cursor: pointer; |
| 627 | flex-shrink: 0; |
| 628 | transition: background 0.15s, color 0.15s; |
| 629 | } |
| 630 | |
| 631 | .row-toggle:hover { |
| 632 | background: var(--vp-c-bg-alt); |
| 633 | color: var(--vp-c-text-1); |
| 634 | } |
| 635 | |
| 636 | .row-toggle.active { |
| 637 | color: var(--vp-c-brand-1); |
| 638 | } |
| 639 | |
| 640 | /* ── Panel Footer ── */ |
| 641 | .panel-foot { |
| 642 | display: flex; |
| 643 | align-items: center; |
| 644 | justify-content: space-between; |
| 645 | padding: 5px 8px; |
| 646 | border-top: 1px solid var(--vp-c-divider); |
| 647 | flex-shrink: 0; |
| 648 | gap: 8px; |
| 649 | } |
| 650 | |
| 651 | .foot-group { |
| 652 | display: flex; |
| 653 | align-items: center; |
| 654 | gap: 4px; |
| 655 | } |
| 656 | |
| 657 | .tool-btn { |
| 658 | position: relative; |
| 659 | display: flex; |
| 660 | align-items: center; |
| 661 | gap: 5px; |
| 662 | font-size: 14px; |
| 663 | font-weight: 500; |
| 664 | color: var(--vp-c-text-2); |
| 665 | background: transparent; |
| 666 | border: none; |
| 667 | border-radius: 5px; |
| 668 | padding: 5px 6px; |
| 669 | cursor: pointer; |
| 670 | transition: color 0.15s, background 0.15s; |
| 671 | } |
| 672 | |
| 673 | .tool-btn[aria-label]::after { |
| 674 | content: attr(aria-label); |
| 675 | position: absolute; |
| 676 | bottom: calc(100% + 6px); |
| 677 | left: 50%; |
| 678 | transform: translateX(-50%); |
| 679 | background: var(--vp-c-bg-soft); |
| 680 | color: var(--vp-c-text-1); |
| 681 | border: 1px solid var(--vp-c-divider); |
| 682 | border-radius: 5px; |
| 683 | padding: 3px 8px; |
| 684 | font-size: 11px; |
| 685 | white-space: nowrap; |
| 686 | pointer-events: none; |
| 687 | opacity: 0; |
| 688 | transition: opacity 0.15s; |
| 689 | z-index: 10; |
| 690 | } |
| 691 | |
| 692 | .tool-btn[aria-label]:hover::after { |
| 693 | opacity: 1; |
| 694 | } |
| 695 | |
| 696 | .tool-btn:hover { |
| 697 | color: var(--vp-c-text-1); |
| 698 | background: var(--vp-c-bg-soft); |
| 699 | } |
| 700 | |
| 701 | .tool-btn.is-active { |
| 702 | color: var(--vp-c-brand-1); |
| 703 | background: var(--vp-c-brand-soft); |
| 704 | } |
| 705 | |
| 706 | /* ── Settings Dropdown ── */ |
| 707 | .settings-wrap { |
| 708 | position: relative; |
| 709 | } |
| 710 | |
| 711 | .dropdown-overlay { |
| 712 | position: fixed; |
| 713 | inset: 0; |
| 714 | z-index: 1; |
| 715 | } |
| 716 | |
| 717 | .settings-dropdown { |
| 718 | position: absolute; |
| 719 | bottom: calc(100% + 8px); |
| 720 | right: 0; |
| 721 | z-index: 2; |
| 722 | min-width: 196px; |
| 723 | background: var(--vp-c-bg); |
| 724 | border: 1px solid var(--vp-c-divider); |
| 725 | border-radius: 10px; |
| 726 | padding: 10px; |
| 727 | box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25); |
| 728 | } |
| 729 | |
| 730 | .dropdown-section + .dropdown-section { |
| 731 | border-top: 1px solid var(--vp-c-divider); |
| 732 | margin-top: 8px; |
| 733 | padding-top: 8px; |
| 734 | } |
| 735 | |
| 736 | .dropdown-label { |
| 737 | display: block; |
| 738 | font-size: 11px; |
| 739 | font-weight: 600; |
| 740 | text-transform: uppercase; |
| 741 | letter-spacing: 0.06em; |
| 742 | color: var(--vp-c-text-3, var(--vp-c-text-2)); |
| 743 | margin-bottom: 6px; |
| 744 | } |
| 745 | |
| 746 | .dropdown-group { |
| 747 | display: flex; |
| 748 | gap: 4px; |
| 749 | } |
| 750 | |
| 751 | /* ── Drag Ghost ── */ |
| 752 | .drag-ghost { |
| 753 | position: fixed; |
| 754 | pointer-events: none; |
| 755 | z-index: 9999; |
| 756 | display: flex; |
| 757 | align-items: center; |
| 758 | gap: 8px; |
| 759 | padding: 6px 12px 6px 10px; |
| 760 | background: var(--vp-c-bg); |
| 761 | border: 1px solid var(--vp-c-brand-1); |
| 762 | border-radius: 8px; |
| 763 | box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); |
| 764 | opacity: 0.88; |
| 765 | font-size: 14px; |
| 766 | font-weight: 500; |
| 767 | color: var(--vp-c-text-1); |
| 768 | white-space: nowrap; |
| 769 | user-select: none; |
| 770 | transform: translate(12px, -50%); |
| 771 | } |
| 772 | |
| 773 | .drag-ghost-name { |
| 774 | font-size: 14px; |
| 775 | font-weight: 500; |
| 776 | color: var(--vp-c-text-1); |
| 777 | } |
| 778 | |
| 779 | .ghost-fade-enter-active, |
| 780 | .ghost-fade-leave-active { transition: opacity 0.1s ease; } |
| 781 | .ghost-fade-enter-from, |
| 782 | .ghost-fade-leave-to { opacity: 0; } |
| 783 | |
| 784 | /* ── Transitions ── */ |
| 785 | .fade-enter-active, |
| 786 | .fade-leave-active { transition: opacity 0.2s ease; } |
| 787 | .fade-enter-from, |
| 788 | .fade-leave-to { opacity: 0; } |
| 789 | |
| 790 | .slide-up-enter-active { transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease; } |
| 791 | .slide-up-leave-active { transition: transform 0.2s ease, opacity 0.15s ease; } |
| 792 | .slide-up-enter-from { transform: translateY(20px); opacity: 0; } |
| 793 | .slide-up-leave-to { transform: translateY(10px); opacity: 0; } |
| 794 | </style> |