Commit 7bddf6db76
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/crossapp/CrossAppSupport.vue +56 −7
| @@ -21,9 +21,15 @@ interface AppEntry { | |||
| 21 | platforms: string[] | 21 | platforms: string[] |
| 22 | icon: string | null | 22 | icon: string | null |
| 23 | repos: string[] | 23 | repos: string[] |
| 24 | comp?: string[] | ||
| 24 | notes: string[] | 25 | notes: string[] |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 28 | interface OpenRepo extends Repo { | ||
| 29 | id: string | ||
| 30 | comp: boolean | ||
| 31 | } | ||
| 32 | |||
| 27 | interface Payload { | 33 | interface Payload { |
| 28 | version: number | 34 | version: number |
| 29 | repos: Record<string, Repo> | 35 | repos: Record<string, Repo> |
| @@ -53,13 +59,19 @@ const openApp = computed(() => | |||
| 53 | apps.value.find(app => app.id === openId.value) ?? null | 59 | apps.value.find(app => app.id === openId.value) ?? null |
| 54 | ) | 60 | ) |
| 55 | 61 | ||
| 56 | const openRepos = computed(() => { | 62 | const openRepos = computed<OpenRepo[]>(() => { |
| 57 | if (!openApp.value || !payload.value) return [] | 63 | const app = openApp.value |
| 58 | return openApp.value.repos | 64 | const repos = payload.value?.repos |
| 59 | .map(id => payload.value!.repos[id]) | 65 | if (!app || !repos) return [] |
| 60 | .filter((repo): repo is Repo => Boolean(repo)) | 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 | const openRowEnd = computed(() => { | 75 | const openRowEnd = computed(() => { |
| 64 | const app = openApp.value | 76 | const app = openApp.value |
| 65 | if (!app) return -1 | 77 | if (!app) return -1 |
| @@ -294,9 +306,12 @@ onBeforeUnmount(() => resizeObserver?.disconnect()) | |||
| 294 | <component | 306 | <component |
| 295 | :is="repo.href ? 'a' : 'div'" | 307 | :is="repo.href ? 'a' : 'div'" |
| 296 | v-for="repo in openRepos" | 308 | v-for="repo in openRepos" |
| 297 | :key="repo.name" | 309 | :key="repo.id" |
| 298 | class="ca-repo" | 310 | class="ca-repo" |
| 299 | :class="{ 'is-disabled': !repo.href }" | 311 | :class="{ |
| 312 | 'is-disabled': !repo.href, | ||
| 313 | 'is-comp': repo.comp | ||
| 314 | }" | ||
| 300 | :href="repo.href ?? undefined" | 315 | :href="repo.href ?? undefined" |
| 301 | :title="repo.href ? repo.name : 'No page yet'" | 316 | :title="repo.href ? repo.name : 'No page yet'" |
| 302 | > | 317 | > |
| @@ -315,6 +330,16 @@ onBeforeUnmount(() => resizeObserver?.disconnect()) | |||
| 315 | <span class="ca-repo-name">{{ repo.name }}</span> | 330 | <span class="ca-repo-name">{{ repo.name }}</span> |
| 316 | </component> | 331 | </component> |
| 317 | </div> | 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 | </section> | 343 | </section> |
| 319 | </template> | 344 | </template> |
| 320 | </div> | 345 | </div> |
| @@ -571,6 +596,30 @@ onBeforeUnmount(() => resizeObserver?.disconnect()) | |||
| 571 | opacity: 0.55; | 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 | .ca-repo-name { | 623 | .ca-repo-name { |
| 575 | font-size: 12.5px; | 624 | font-size: 12.5px; |
| 576 | font-weight: 600; | 625 | font-weight: 600; |