Commit 7bddf6db76
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/crossapp/CrossAppSupport.vue +56 −7
| @@ -21,9 +21,15 @@ interface AppEntry { | ||
| 21 | 21 | platforms: string[] |
| 22 | 22 | icon: string | null |
| 23 | 23 | repos: string[] |
| 24 | comp?: string[] | |
| 24 | 25 | notes: string[] |
| 25 | 26 | } |
| 26 | 27 | |
| 28 | interface OpenRepo extends Repo { | |
| 29 | id: string | |
| 30 | comp: boolean | |
| 31 | } | |
| 32 | ||
| 27 | 33 | interface Payload { |
| 28 | 34 | version: number |
| 29 | 35 | repos: Record<string, Repo> |
| @@ -53,13 +59,19 @@ const openApp = computed(() => | ||
| 53 | 59 | apps.value.find(app => app.id === openId.value) ?? null |
| 54 | 60 | ) |
| 55 | 61 | |
| 56 | const openRepos = computed(() => { | |
| 57 | if (!openApp.value || !payload.value) return [] | |
| 58 | return openApp.value.repos | |
| 59 | .map(id => payload.value!.repos[id]) | |
| 60 | .filter((repo): repo is Repo => Boolean(repo)) | |
| 62 | const openRepos = computed<OpenRepo[]>(() => { | |
| 63 | const app = openApp.value | |
| 64 | const repos = payload.value?.repos | |
| 65 | if (!app || !repos) return [] | |
| 66 | const comp = new Set(app.comp ?? []) | |
| 67 | return app.repos.flatMap(id => { | |
| 68 | const repo = repos[id] | |
| 69 | return repo ? [{ ...repo, id, comp: comp.has(id) }] : [] | |
| 70 | }) | |
| 61 | 71 | }) |
| 62 | 72 | |
| 73 | const hasCompRepo = computed(() => openRepos.value.some(repo => repo.comp)) | |
| 74 | ||
| 63 | 75 | const openRowEnd = computed(() => { |
| 64 | 76 | const app = openApp.value |
| 65 | 77 | if (!app) return -1 |
| @@ -294,9 +306,12 @@ onBeforeUnmount(() => resizeObserver?.disconnect()) | ||
| 294 | 306 | <component |
| 295 | 307 | :is="repo.href ? 'a' : 'div'" |
| 296 | 308 | v-for="repo in openRepos" |
| 297 | :key="repo.name" | |
| 309 | :key="repo.id" | |
| 298 | 310 | class="ca-repo" |
| 299 | :class="{ 'is-disabled': !repo.href }" | |
| 311 | :class="{ | |
| 312 | 'is-disabled': !repo.href, | |
| 313 | 'is-comp': repo.comp | |
| 314 | }" | |
| 300 | 315 | :href="repo.href ?? undefined" |
| 301 | 316 | :title="repo.href ? repo.name : 'No page yet'" |
| 302 | 317 | > |
| @@ -315,6 +330,16 @@ onBeforeUnmount(() => resizeObserver?.disconnect()) | ||
| 315 | 330 | <span class="ca-repo-name">{{ repo.name }}</span> |
| 316 | 331 | </component> |
| 317 | 332 | </div> |
| 333 | ||
| 334 | <p v-if="hasCompRepo" class="ca-comp-foot"> | |
| 335 | <span | |
| 336 | class="i-lucide-square-dashed ca-comp-icon" | |
| 337 | aria-hidden="true" | |
| 338 | /> | |
| 339 | <span> | |
| 340 | App uses an extension as a compatibility layer. All the extensions / features may not work properly. | |
| 341 | </span> | |
| 342 | </p> | |
| 318 | 343 | </section> |
| 319 | 344 | </template> |
| 320 | 345 | </div> |
| @@ -571,6 +596,30 @@ onBeforeUnmount(() => resizeObserver?.disconnect()) | ||
| 571 | 596 | opacity: 0.55; |
| 572 | 597 | } |
| 573 | 598 | |
| 599 | .ca-repo.is-comp { | |
| 600 | border-style: dashed; | |
| 601 | } | |
| 602 | ||
| 603 | .ca-comp-foot { | |
| 604 | display: flex; | |
| 605 | align-items: flex-start; | |
| 606 | gap: 6px; | |
| 607 | margin: 6px 4px 2px; | |
| 608 | font-size: 10.5px; | |
| 609 | line-height: 1.4; | |
| 610 | color: var(--vp-c-text-2); | |
| 611 | } | |
| 612 | ||
| 613 | .ca-comp-icon { | |
| 614 | flex-shrink: 0; | |
| 615 | width: 12px; | |
| 616 | height: 12px; | |
| 617 | min-width: 0; | |
| 618 | margin-top: 1px; | |
| 619 | font-size: 12px; | |
| 620 | line-height: 1; | |
| 621 | } | |
| 622 | ||
| 574 | 623 | .ca-repo-name { |
| 575 | 624 | font-size: 12.5px; |
| 576 | 625 | font-weight: 600; |