Spaces:
Running
Running
Download src/App.vue from lrigamai/browser: direct link, hf CLI and curl.
- Browser
- Download file 5.63 kB
-
https://huggingface.co/spaces/lrigamai/browser/resolve/main/src/App.vue
- Command line
-
hf download hf://spaces/lrigamai/browser/src/App.vue
-
curl -L -o App.vue https://huggingface.co/spaces/lrigamai/browser/resolve/main/src/App.vue
5.63 kB
| <script setup lang="ts"> | |
| import { computed, ref, watchEffect } from "vue"; | |
| import { config } from "./config"; | |
| import { hub } from "./lib/hub"; | |
| import { useCatalog } from "./composables/useCatalog"; | |
| import { useFilters } from "./composables/useFilters"; | |
| import ModelPicker from "./components/ModelPicker.vue"; | |
| import ScrollProgress from "./components/ScrollProgress.vue"; | |
| import LoraDock from "./components/LoraDock.vue"; | |
| import LoraGrid from "./components/LoraGrid.vue"; | |
| import LoraTable from "./components/LoraTable.vue"; | |
| import LoraDetail from "./components/LoraDetail.vue"; | |
| import Icon from "./components/Icon.vue"; | |
| import ZenLotus from "./components/ZenLotus.vue"; | |
| const { models, characters, loading, error } = useCatalog(); | |
| const { filters, openId, openCharacter, results, total } = useFilters(models, characters); | |
| const modelIds = computed(() => models.value.map((m) => m.id)); | |
| // Wide screens dock the detail panel beside the list, so picking another character is one click; | |
| // narrower ones keep the modal sheet. | |
| const wideQuery = matchMedia("(min-width: 1100px)"); | |
| const wide = ref(wideQuery.matches); | |
| wideQuery.addEventListener("change", (e) => (wide.value = e.matches)); | |
| const docked = computed(() => wide.value && !!openCharacter.value); | |
| watchEffect(() => document.documentElement.classList.toggle("panel-open", docked.value)); | |
| const openKey = computed(() => openCharacter.value?.key ?? ""); | |
| </script> | |
| <template> | |
| <header class="top"> | |
| <div class="wrap bar"> | |
| <div class="brand-row"> | |
| <a class="brand" :href="hub.repo(config.repo)" target="_blank" rel="noopener"> | |
| <span class="mark" aria-hidden="true" /> | |
| <span class="word">{{ config.repo.split("/")[0] }}</span> | |
| </a> | |
| <a | |
| v-if="config.trainer" | |
| class="credit mono" | |
| :href="config.trainer.url" | |
| target="_blank" | |
| rel="noopener" | |
| :aria-label="`Trained with ${config.trainer.name}`" | |
| > | |
| <ZenLotus class="lotus" /> | |
| <span class="label">Trained with <b>{{ config.trainer.name }}</b></span> | |
| <Icon name="external" class="ext" /> | |
| </a> | |
| </div> | |
| <ModelPicker v-model="filters.models" :models="models" :total="characters.length" /> | |
| </div> | |
| <ScrollProgress /> | |
| </header> | |
| <div class="page"> | |
| <main class="wrap content"> | |
| <p v-if="error" class="notice">{{ error }}</p> | |
| <ul v-else-if="loading" class="skeleton" aria-label="Loading"> | |
| <li v-for="i in 6" :key="i" /> | |
| </ul> | |
| <LoraTable | |
| v-else-if="filters.view === 'table'" | |
| v-model:sort="filters.sort" | |
| :selected="openKey" | |
| :items="results" | |
| :models="modelIds" | |
| :filter="filters.models" | |
| @open="openId = $event" | |
| @clear="filters.q = ''" | |
| /> | |
| <LoraGrid | |
| v-else | |
| :selected="openKey" | |
| :items="results" | |
| :models="modelIds" | |
| :filter="filters.models" | |
| @open="openId = $event" | |
| @clear="filters.q = ''" | |
| /> | |
| </main> | |
| </div> | |
| <LoraDock | |
| v-model:q="filters.q" | |
| v-model:sort="filters.sort" | |
| v-model:view="filters.view" | |
| :count="results.length" | |
| :total="total" | |
| :loading="loading" | |
| /> | |
| <LoraDetail :character="openCharacter" :filter="filters.models" :docked="wide" @close="openId = ''" /> | |
| </template> | |
| <style scoped> | |
| .wrap { | |
| max-width: 1320px; | |
| margin: 0 auto; | |
| padding: 0 16px; | |
| } | |
| .top { | |
| position: sticky; | |
| top: 0; | |
| z-index: 5; | |
| background: rgb(11 11 12 / 0.82); | |
| backdrop-filter: blur(12px); | |
| } | |
| .bar { | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-between; | |
| gap: 16px; | |
| min-height: 56px; | |
| } | |
| .brand { | |
| display: flex; | |
| align-items: center; | |
| gap: 10px; | |
| color: inherit; | |
| text-decoration: none; | |
| white-space: nowrap; | |
| } | |
| .mark { | |
| width: 12px; | |
| height: 12px; | |
| background: var(--accent); | |
| } | |
| .word { | |
| font-family: var(--font-display); | |
| font-size: 22px; | |
| font-weight: 800; | |
| letter-spacing: 0.02em; | |
| text-transform: uppercase; | |
| } | |
| .brand-row { | |
| display: flex; | |
| align-items: center; | |
| gap: 14px; | |
| min-width: 0; | |
| } | |
| /* maker's mark: lotus + mono credit, split from the brand by a hairline */ | |
| .credit { | |
| display: flex; | |
| align-items: center; | |
| gap: 7px; | |
| padding-left: 14px; | |
| border-left: 1px solid var(--line-strong); | |
| color: var(--text-3); | |
| font-size: 11px; | |
| letter-spacing: 0.08em; | |
| text-transform: uppercase; | |
| text-decoration: none; | |
| white-space: nowrap; | |
| transition: color 0.15s; | |
| } | |
| .credit .lotus { | |
| width: 19px; | |
| height: 14px; | |
| color: var(--accent); | |
| } | |
| .credit b { | |
| font-weight: 500; | |
| color: var(--text-2); | |
| transition: color 0.15s; | |
| } | |
| .credit .ext { | |
| opacity: 0; | |
| transition: opacity 0.15s; | |
| } | |
| .credit:hover b { | |
| color: var(--accent); | |
| } | |
| .credit:hover .ext { | |
| opacity: 1; | |
| } | |
| /* phones: the model picker needs the room, so the credit shrinks to the lotus */ | |
| @media (max-width: 760px) { | |
| .credit .label, | |
| .credit .ext { | |
| display: none; | |
| } | |
| } | |
| /* The list (and the header, so they stay aligned) makes room for the docked panel. This snaps in | |
| one frame on purpose: animating the width re-flows the grid every frame, cards hopping columns. */ | |
| .page, | |
| .top { | |
| padding-right: var(--panel); | |
| } | |
| /* class selector so it outranks .wrap's padding */ | |
| .content { | |
| display: grid; | |
| gap: 20px; | |
| /* room at the bottom so the floating dock never covers the last row */ | |
| padding-block: 24px 140px; | |
| } | |
| .notice { | |
| padding: 48px 0; | |
| text-align: center; | |
| color: var(--text-3); | |
| } | |
| .skeleton { | |
| display: grid; | |
| gap: 32px 20px; | |
| grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); | |
| margin: 0; | |
| padding: 0; | |
| list-style: none; | |
| } | |
| .skeleton li { | |
| aspect-ratio: 3 / 4.6; | |
| border: 1px solid var(--line); | |
| background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%; | |
| animation: shimmer 1.4s linear infinite; | |
| } | |
| @keyframes shimmer { | |
| to { | |
| background-position: -150% 0; | |
| } | |
| } | |
| </style> | |