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