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