feat(plugins): tidy marketplace cards and collapse badge rows

This commit is contained in:
t8y2 committed 2026-10-03 06:49:54 +08:00
1 parent 4a9620a720
commit 5dc11f26ca
12 files changed
+146 -164

No files matched your search

@@ -58,16 +58,18 @@ const emit = defineEmits<{
pluginRuntimeReplaced: [pluginId: string];
}>();
// lucide no longer ships brand icons; mirror the inline glyph used in AppToolbar.
// lucide no longer ships brand icons; this stroke glyph keeps the 2px outline style of
// neighboring lucide icons instead of the heavier filled brand mark.
const GithubIcon = defineComponent({
props: {
iconClass: { type: String, default: "size-3" },
},
render() {
return h("svg", { class: this.iconClass, viewBox: "0 0 24 24", fill: "currentColor" }, [
return h("svg", { class: this.iconClass, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round" }, [
h("path", {
d: "M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.387.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61-.546-1.387-1.333-1.756-1.333-1.756-1.09-.745.083-.729.083-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 21.795 24 17.295 24 12 24 5.37 18.627 0 12 0z",
d: "M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",
}),
h("path", { d: "M9 18c-4.51 2-5-2-7-2" }),
]);
},
});
@@ -225,18 +227,24 @@ const showCustomRepositoryTrustSettings = computed(() => customRepositories.valu
const pluginDevelopmentDocsUrl = computed(() => `https://dbxio.com/${appLocale.value.startsWith("zh") ? "cn" : "en"}/docs/plugin-development`);
function marketplaceActionClass(listing: MarketplacePluginListing): string {
if (listing.status === "update") return "text-blue-600 hover:bg-gray-200 dark:text-blue-400 dark:hover:bg-gray-700";
if (listing.status === "install") return "text-foreground hover:bg-gray-200 dark:hover:bg-gray-700";
return "cursor-default text-gray-600 dark:text-gray-400";
if (listing.status === "update") return "bg-blue-600/10 text-blue-700 hover:bg-blue-600/20 dark:bg-blue-400/10 dark:text-blue-400 dark:hover:bg-blue-400/20";
if (listing.status === "install") return "bg-muted text-foreground hover:bg-accent";
return "cursor-default bg-muted text-muted-foreground";
}
// 紧凑档(窄卡)下 "+N" 折叠标签的展开状态;只影响展示,重开面板自然复位。
const expandedTagKeys = ref(new Set<string>());
function toggleTagExpansion(key: string) {
const next = new Set(expandedTagKeys.value);
if (next.has(key)) next.delete(key);
else next.add(key);
expandedTagKeys.value = next;
// Badge row budget: tags first, then permissions, then one trailing "+N" counter. The row must
// stay single-line; everything past the limit rides in the "+N" tooltip, and when the overflow
// hides a sensitive permission the "+N" badge itself takes the destructive variant so the risk
// signal never leaves the card.
const MARKETPLACE_CARD_BADGE_LIMIT = 3;
type MarketplaceCardBadge = { value: string; kind: "tag" | "permission"; sensitive: boolean };
function marketplaceCardBadges(listing: MarketplacePluginListing): { visible: MarketplaceCardBadge[]; hidden: MarketplaceCardBadge[]; hiddenSensitive: boolean } {
const badges: MarketplaceCardBadge[] = [...listing.plugin.tags.map((value) => ({ value, kind: "tag" as const, sensitive: false })), ...listing.plugin.permissions.map((value) => ({ value, kind: "permission" as const, sensitive: isSensitivePluginPermission(value) }))];
const visible = badges.slice(0, MARKETPLACE_CARD_BADGE_LIMIT);
const hidden = badges.slice(MARKETPLACE_CARD_BADGE_LIMIT);
return { visible, hidden, hiddenSensitive: hidden.some((badge) => badge.sensitive) };
}
// 安装/更新完成后的短促确认窗口:动作按钮上的对勾弹入几百毫秒即退场。
@@ -1201,104 +1209,72 @@ onBeforeUnmount(() => {
<div class="mt-1 text-xs text-muted-foreground">{{ t("pluginPlatform.noMarketplacePluginsDescription") }}</div>
</div>
<TransitionGroup v-else-if="marketplaceViewMode === 'grid'" name="marketplace-cards" tag="div" class="grid w-full grid-cols-[repeat(auto-fill,minmax(min(100%,19rem),1fr))] gap-3">
<article v-for="listing in sortedMarketplaceListings" :key="listing.key" class="group @container marketplace-card flex min-w-0 min-h-48 flex-col rounded-xl border bg-card p-4 transition-colors hover:border-primary/40">
<div class="mb-3 flex min-w-0 items-start gap-3">
<PluginIcon :plugin-id="listing.plugin.id" :icon="listing.plugin.icon" class="size-11 shrink-0 rounded-xl border bg-background p-1.5" />
<article v-for="listing in sortedMarketplaceListings" :key="listing.key" class="group marketplace-card flex min-w-0 min-h-48 flex-col rounded-xl border bg-card p-4 transition-colors hover:border-primary/40">
<div class="flex min-w-0 items-start gap-3">
<PluginIcon :plugin-id="listing.plugin.id" :icon="listing.plugin.icon" class="size-10 shrink-0 rounded-lg border bg-background p-1.5" />
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-semibold" :title="listing.name">{{ listing.name }}</div>
<div class="mt-1 flex min-w-0 items-center">
<Badge variant="outline" class="h-auto min-h-5 min-w-0 max-w-full shrink px-1.5 py-0.5 text-[10px] leading-tight whitespace-normal break-all" :title="`v${listing.plugin.latestVersion}`">v{{ listing.plugin.latestVersion }}</Badge>
</div>
<div class="mt-1 flex min-w-0 items-center gap-1 text-xs text-muted-foreground">
<BadgeCheck v-if="listingRepositoryCanVerify(listing.repository)" class="size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" :title="t('pluginPlatform.verified')" :aria-label="t('pluginPlatform.verified')" />
<span class="truncate">{{ listing.plugin.publisher }} · {{ listing.repository.name }}</span>
</div>
<div class="mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-muted-foreground">
<button
v-if="listing.plugin.source"
type="button"
class="shrink-0 rounded p-0.5 opacity-60 transition-opacity [will-change:opacity] hover:opacity-100"
:title="t('pluginPlatform.sourceRepository')"
:aria-label="t('pluginPlatform.sourceRepository')"
@click.stop="openExternal(listing.plugin.source)"
>
<GithubIcon icon-class="size-3.5" />
</button>
<button
v-if="marketplaceHomepageUrl(listing.plugin.source, listing.plugin.homepage)"
type="button"
class="shrink-0 rounded p-0.5 opacity-60 transition-opacity [will-change:opacity] hover:opacity-100"
:title="t('pluginPlatform.pluginHomepage')"
:aria-label="t('pluginPlatform.pluginHomepage')"
@click.stop="openExternal(marketplaceHomepageUrl(listing.plugin.source, listing.plugin.homepage))"
>
<Globe class="size-3.5" />
</button>
<span v-if="listing.latestVersionReleasedAt" class="shrink-0 text-[10px] text-muted-foreground">{{ formatMarketplaceReleasedDate(listing.latestVersionReleasedAt, appLocale) }}</span>
</div>
</div>
<button
v-if="batchMode && isBatchSelectableListing(listing.status)"
type="button"
class="mt-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded border transition-colors"
:class="isListingSelected(listing) ? 'border-primary bg-primary text-primary-foreground' : 'border-muted-foreground/40 bg-background'"
:aria-pressed="isListingSelected(listing)"
:aria-label="listing.name"
:disabled="batchRunning"
@click.stop="toggleListingSelection(listing)"
>
<Check v-if="isListingSelected(listing)" class="size-3" />
</button>
<div class="flex shrink-0 items-center gap-0.5">
<button
v-if="listing.plugin.source"
type="button"
class="rounded p-1 text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground"
:title="t('pluginPlatform.sourceRepository')"
:aria-label="t('pluginPlatform.sourceRepository')"
@click.stop="openExternal(listing.plugin.source)"
>
<GithubIcon icon-class="size-3.5" />
</button>
<button
v-if="marketplaceHomepageUrl(listing.plugin.source, listing.plugin.homepage)"
type="button"
class="rounded p-1 text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground"
:title="t('pluginPlatform.pluginHomepage')"
:aria-label="t('pluginPlatform.pluginHomepage')"
@click.stop="openExternal(marketplaceHomepageUrl(listing.plugin.source, listing.plugin.homepage))"
>
<Globe class="size-3.5" />
</button>
<button
v-if="batchMode && isBatchSelectableListing(listing.status)"
type="button"
class="ml-1 inline-flex size-4 shrink-0 items-center justify-center rounded border transition-colors"
:class="isListingSelected(listing) ? 'border-primary bg-primary text-primary-foreground' : 'border-muted-foreground/40 bg-background'"
:aria-pressed="isListingSelected(listing)"
:aria-label="listing.name"
:disabled="batchRunning"
@click.stop="toggleListingSelection(listing)"
>
<Check v-if="isListingSelected(listing)" class="size-3" />
</button>
</div>
</div>
<div class="marketplace-tags mt-3 flex min-w-0 flex-wrap items-center gap-1.5 @max-[21rem]:mt-2.5">
<!-- 紧凑档(卡宽 <21rem)只露第 1 个标签 + "+N" 折叠;标准档由下方 t-extra 全显 -->
<Tooltip v-if="listing.plugin.tags.length" :delay-duration="500">
<div v-if="listing.plugin.tags.length || listing.plugin.permissions.length" class="marketplace-tags mt-3 flex min-w-0 items-center gap-1.5 overflow-hidden">
<!-- Single clipped badge line: tags, then permissions, then one trailing "+N" whose
tooltip lists the overflow (sensitive permissions highlighted in the tooltip). -->
<Tooltip v-for="badge in marketplaceCardBadges(listing).visible" :key="badge.value" :delay-duration="500">
<TooltipTrigger as-child>
<Badge variant="outline" class="h-5 min-w-0 max-w-full truncate px-1.5 text-[10px]" :title="listing.plugin.tags[0]">{{ listing.plugin.tags[0] }}</Badge>
</TooltipTrigger>
<TooltipContent side="bottom" class="max-w-md break-all text-[11px]">{{ listing.plugin.tags[0] }}</TooltipContent>
</Tooltip>
<span v-if="listing.plugin.tags.length > 1" class="hidden flex-wrap gap-1.5 @min-[21rem]:flex">
<Tooltip v-for="tag in listing.plugin.tags.slice(1, 3)" :key="tag" :delay-duration="500">
<TooltipTrigger as-child>
<Badge variant="outline" class="h-5 min-w-0 max-w-full truncate px-1.5 text-[10px]" :title="tag">{{ tag }}</Badge>
</TooltipTrigger>
<TooltipContent side="bottom" class="max-w-md break-all text-[11px]">{{ tag }}</TooltipContent>
</Tooltip>
</span>
<button
v-if="listing.plugin.tags.length > 1"
type="button"
class="hidden h-5 items-center rounded-full border border-dashed px-1.5 text-[10px] text-muted-foreground transition-colors hover:border-muted-foreground/60 hover:text-foreground @max-[21rem]:inline-flex"
:aria-expanded="expandedTagKeys.has(listing.key)"
@click.stop="toggleTagExpansion(listing.key)"
>
{{ expandedTagKeys.has(listing.key) ? t("pluginPlatform.showFewerTags") : `+${Math.min(listing.plugin.tags.length - 1, 2)}` }}
</button>
<!-- Keep each permission visible as its own wrapping badge. Sensitive permissions
use the destructive variant so the risk surface remains obvious. -->
<Tooltip v-for="permission in listing.plugin.permissions" :key="permission" :delay-duration="300">
<TooltipTrigger as-child>
<Badge :variant="isSensitivePluginPermission(permission) ? 'destructive' : 'outline'" class="h-5 min-w-0 max-w-full truncate px-1.5 font-mono text-[10px]" :title="permission" :data-sensitive-permission="isSensitivePluginPermission(permission) ? permission : undefined">{{
permission
<Badge :variant="badge.sensitive ? 'destructive' : 'outline'" class="h-5 min-w-0 max-w-full truncate px-1.5 text-[10px]" :class="badge.kind === 'permission' ? 'font-mono' : ''" :title="badge.value" :data-sensitive-permission="badge.sensitive ? badge.value : undefined">{{
badge.value
}}</Badge>
</TooltipTrigger>
<TooltipContent side="bottom" class="max-w-md break-all font-mono text-[11px]">{{ permission }}</TooltipContent>
<TooltipContent side="bottom" class="max-w-md break-all text-[11px]" :class="badge.kind === 'permission' ? 'font-mono' : ''">{{ badge.value }}</TooltipContent>
</Tooltip>
<Tooltip v-if="marketplaceCardBadges(listing).hidden.length" :delay-duration="500">
<TooltipTrigger as-child>
<Badge :variant="marketplaceCardBadges(listing).hiddenSensitive ? 'destructive' : 'outline'" class="h-5 shrink-0 px-1.5 text-[10px]">+{{ marketplaceCardBadges(listing).hidden.length }}</Badge>
</TooltipTrigger>
<TooltipContent side="bottom" class="max-w-md break-all text-[11px]">
<div class="flex flex-col gap-0.5 font-mono">
<span v-for="badge in marketplaceCardBadges(listing).hidden" :key="badge.value" :class="badge.sensitive ? 'text-destructive' : ''">{{ badge.value }}</span>
</div>
</TooltipContent>
</Tooltip>
</div>
<!-- "+N" 展开区:块级兄弟节点而非标签行内联项 —— 收起时 0fr 高度、零占位;
间距放在被裁剪的子元素内(pt-1.5),收起时随高度一起归零,不留幻影间隙 -->
<div v-if="listing.plugin.tags.length > 1" class="marketplace-tags-more" :data-open="expandedTagKeys.has(listing.key) ? 'true' : 'false'">
<div class="overflow-hidden">
<div class="flex flex-wrap gap-1.5 pt-1.5">
<Tooltip v-for="tag in listing.plugin.tags.slice(1, 3)" :key="`more-${tag}`" :delay-duration="500">
<TooltipTrigger as-child>
<Badge variant="outline" class="h-5 min-w-0 max-w-full truncate px-1.5 text-[10px]" :title="tag">{{ tag }}</Badge>
</TooltipTrigger>
<TooltipContent side="bottom" class="max-w-md break-all text-[11px]">{{ tag }}</TooltipContent>
</Tooltip>
</div>
</div>
</div>
<Tooltip :delay-duration="700">
<TooltipTrigger as-child>
@@ -1307,17 +1283,24 @@ onBeforeUnmount(() => {
<TooltipContent side="bottom" class="max-w-md whitespace-pre-wrap break-words">{{ listing.description || t("pluginPlatform.noDescription") }}</TooltipContent>
</Tooltip>
<div class="marketplace-footer mt-auto flex items-center justify-between gap-3 pt-4">
<div class="min-w-0 flex-1 truncate text-[11px] text-muted-foreground">
<span v-if="listing.status === 'unsupported'">{{ t("pluginPlatform.unsupportedTarget", { target: listing.target }) }}</span>
<!-- In the update state the left line states both versions: the badge above shows the
catalog latest version, which otherwise reads as the installed one. -->
<span v-else-if="listing.installed && listing.status === 'update'">{{ t("pluginPlatform.installedVersionUpdatable", { installed: listing.installed.manifest.version, latest: listing.plugin.latestVersion }) }}</span>
<span v-else-if="listing.installed">{{ t("pluginPlatform.installedVersion", { version: listing.installed.manifest.version }) }}</span>
<span v-else>{{ listing.plugin.license || t("pluginPlatform.licenseUnknown") }}</span>
<div class="flex min-w-0 flex-1 items-baseline gap-1.5 text-[11px] text-muted-foreground">
<span v-if="listing.status === 'unsupported'" class="min-w-0 truncate">{{ t("pluginPlatform.unsupportedTarget", { target: listing.target }) }}</span>
<!-- Versions are stated only in this footer (no separate badge above): the update case
keeps installed and catalog latest in one sentence so neither reads as the other,
and the plain install state leads with the full catalog version that never shrinks
while license and release date absorb the truncation. -->
<span v-else-if="listing.installed && listing.status === 'update'" class="min-w-0 truncate">{{ t("pluginPlatform.installedVersionUpdatable", { installed: listing.installed.manifest.version, latest: listing.plugin.latestVersion }) }}</span>
<span v-else-if="listing.installed" class="min-w-0 truncate">{{ t("pluginPlatform.installedVersion", { version: listing.installed.manifest.version }) }}</span>
<template v-else>
<span class="shrink-0 font-medium">v{{ listing.plugin.latestVersion }}</span>
<span class="min-w-0 truncate"
>{{ listing.plugin.license || t("pluginPlatform.licenseUnknown") }}<span v-if="listing.latestVersionReleasedAt"> · {{ formatMarketplaceReleasedDate(listing.latestVersionReleasedAt, appLocale) }}</span></span
>
</template>
</div>
<button
type="button"
class="inline-flex h-7 items-center justify-center gap-1.5 rounded-full border-0 bg-gray-100 px-4 py-1 text-xs font-semibold transition-colors disabled:opacity-50 dark:bg-gray-800"
class="inline-flex h-7 shrink-0 items-center justify-center gap-1.5 rounded-full px-4 py-1 text-xs font-semibold transition-colors disabled:opacity-50"
:class="marketplaceActionClass(listing)"
:disabled="listing.status === 'installed' || listing.status === 'unsupported' || mutationRunning"
@click="installMarketplaceListing(listing)"
@@ -1345,19 +1328,18 @@ onBeforeUnmount(() => {
</button>
<PluginIcon :plugin-id="listing.plugin.id" :icon="listing.plugin.icon" class="size-10 shrink-0 rounded-lg border bg-background p-1.5" />
<div class="min-w-0 flex-1">
<div class="truncate text-sm font-semibold" :title="listing.name">{{ listing.name }}</div>
<div class="mt-1 flex min-w-0 items-center">
<Badge variant="outline" class="h-auto min-h-5 min-w-0 max-w-full shrink px-1.5 py-0.5 text-[10px] leading-tight whitespace-normal break-all" :title="`v${listing.plugin.latestVersion}`">v{{ listing.plugin.latestVersion }}</Badge>
</div>
<div class="mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">
<div class="flex min-w-0 items-center gap-1">
<span class="truncate text-sm font-semibold" :title="listing.name">{{ listing.name }}</span>
<BadgeCheck v-if="listingRepositoryCanVerify(listing.repository)" class="size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" :title="t('pluginPlatform.verified')" :aria-label="t('pluginPlatform.verified')" />
<span class="min-w-0 truncate">{{ listing.plugin.publisher }} · {{ listing.repository.name }}</span>
</div>
<div class="mt-1 flex min-w-0 flex-wrap items-center gap-1.5 text-muted-foreground">
<div class="mt-1 flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs text-muted-foreground">
<span class="min-w-0 truncate">{{ listing.plugin.publisher }} · {{ listing.repository.name }}</span>
<span class="shrink-0">· v{{ listing.plugin.latestVersion }}</span>
<span v-if="listing.latestVersionReleasedAt" class="shrink-0">· {{ formatMarketplaceReleasedDate(listing.latestVersionReleasedAt, appLocale) }}</span>
<button
v-if="listing.plugin.source"
type="button"
class="shrink-0 rounded p-0.5 opacity-60 transition-opacity [will-change:opacity] hover:opacity-100"
class="shrink-0 rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground"
:title="t('pluginPlatform.sourceRepository')"
:aria-label="t('pluginPlatform.sourceRepository')"
@click.stop="openExternal(listing.plugin.source)"
@@ -1367,14 +1349,13 @@ onBeforeUnmount(() => {
<button
v-if="marketplaceHomepageUrl(listing.plugin.source, listing.plugin.homepage)"
type="button"
class="shrink-0 rounded p-0.5 opacity-60 transition-opacity [will-change:opacity] hover:opacity-100"
class="shrink-0 rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground"
:title="t('pluginPlatform.pluginHomepage')"
:aria-label="t('pluginPlatform.pluginHomepage')"
@click.stop="openExternal(marketplaceHomepageUrl(listing.plugin.source, listing.plugin.homepage))"
>
<Globe class="size-3.5" />
</button>
<span v-if="listing.latestVersionReleasedAt" class="shrink-0 text-[10px] text-muted-foreground">{{ formatMarketplaceReleasedDate(listing.latestVersionReleasedAt, appLocale) }}</span>
</div>
<Tooltip :delay-duration="700">
<TooltipTrigger as-child>
@@ -1383,17 +1364,18 @@ onBeforeUnmount(() => {
<TooltipContent side="bottom" class="max-w-md whitespace-pre-wrap break-words">{{ listing.description || t("pluginPlatform.noDescription") }}</TooltipContent>
</Tooltip>
</div>
<div class="hidden min-w-0 max-w-52 shrink-0 flex-wrap gap-1.5 @min-[64rem]:flex">
<div class="hidden min-w-0 max-w-52 shrink-0 flex-wrap items-center gap-1.5 @min-[64rem]:flex">
<Tooltip v-for="tag in listing.plugin.tags.slice(0, 3)" :key="tag" :delay-duration="500">
<TooltipTrigger as-child>
<Badge variant="outline" class="h-5 min-w-0 max-w-full truncate px-1.5 text-[10px]" :title="tag">{{ tag }}</Badge>
</TooltipTrigger>
<TooltipContent side="bottom" class="max-w-md break-all text-[11px]">{{ tag }}</TooltipContent>
</Tooltip>
<Badge v-if="listing.plugin.tags.length > 3" variant="outline" class="h-5 shrink-0 px-1.5 text-[10px] text-muted-foreground" :title="listing.plugin.tags.slice(3).join(' · ')">+{{ listing.plugin.tags.length - 3 }}</Badge>
</div>
<button
type="button"
class="inline-flex h-7 shrink-0 items-center justify-center gap-1.5 rounded-full border-0 bg-gray-100 px-4 py-1 text-xs font-semibold transition-colors disabled:opacity-50 dark:bg-gray-800"
class="inline-flex h-7 shrink-0 items-center justify-center gap-1.5 rounded-full px-4 py-1 text-xs font-semibold transition-colors disabled:opacity-50"
:class="marketplaceActionClass(listing)"
:disabled="listing.status === 'installed' || listing.status === 'unsupported' || mutationRunning"
@click="installMarketplaceListing(listing)"
@@ -1829,8 +1811,8 @@ onBeforeUnmount(() => {
<style scoped>
/*
* 商店卡片的响应式补充样式。布局分级主体走 Tailwind 容器变体(卡片自身 @container,
* 阈值 21rem),这里只放三件事:TransitionGroup 的 FLIP 过渡、"+N" 展开区、矮窗降密度。
* 商店卡片的补充样式。布局主体走 Tailwind 工具类,这里只放三件事:
* TransitionGroup 的 FLIP 过渡、完成对勾弹入、矮窗降密度。
* 所有动效集中在 prefers-reduced-motion: no-preference 下,减弱动效的用户自动退化为静态。
*/
@media (prefers-reduced-motion: no-preference) {
@@ -1847,10 +1829,6 @@ onBeforeUnmount(() => {
transition: opacity 0.12s ease-out;
}
.marketplace-tags-more {
transition: grid-template-rows 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.marketplace-check-pop {
animation: marketplace-check-pop 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}
@@ -1861,23 +1839,6 @@ onBeforeUnmount(() => {
opacity: 0;
}
/* "+N" 展开区:块级兄弟节点而非标签行内联项(内联时宽度仍按内容计算,收起会占位)。
0fr 收起 + overflow hidden 清零子项内容贡献;标准档不参与渲染,避免与全显标签重复。 */
.marketplace-tags-more {
display: none;
grid-template-rows: 0fr;
}
.marketplace-tags-more[data-open="true"] {
grid-template-rows: 1fr;
}
@container (width < 21rem) {
.marketplace-tags-more {
display: grid;
}
}
@keyframes marketplace-check-pop {
from {
transform: scale(0.4);
@@ -1137,14 +1137,22 @@ describe("PluginContributionsPanel marketplace sort", () => {
});
describe("PluginContributionsPanel marketplace card layout", () => {
it("keeps the three-column grid and shows full names and versions in both views", async () => {
it("keeps the auto-fill grid and shows full names and versions in both views", async () => {
state.batchMode = false;
const longName = "Database Schema Explorer Marketplace Plugin With Deliberately Long Name";
const installedLongName = `${longName} Installed`;
const versionValue = "3.0.0-preview.10483";
const plugin = state.catalogResults[0].catalog!.plugins.find((entry) => entry.id === "a")!;
plugin.name = longName;
plugin.latestVersion = versionValue;
plugin.versions[0].version = versionValue;
const installedPlugin = state.catalogResults[0].catalog!.plugins.find((entry) => entry.id === "a")!;
const freshPlugin = state.catalogResults[0].catalog!.plugins.find((entry) => entry.id === "b")!;
installedPlugin.name = installedLongName;
installedPlugin.latestVersion = versionValue;
installedPlugin.versions[0].version = versionValue;
freshPlugin.name = longName;
freshPlugin.latestVersion = versionValue;
freshPlugin.versions[0].version = versionValue;
// Only "a" stays installed (update state); "b" becomes a plain install so the catalog
// version line renders on a card that is not installed yet.
state.installedPlugins = [installed("a")];
await flushUi();
for (const view of ["grid", "list"] as const) {
@@ -1158,20 +1166,43 @@ describe("PluginContributionsPanel marketplace card layout", () => {
expect(pluginName?.classList.contains("text-sm"), `${view}: name size stays fixed`).toBe(true);
const card = pluginName?.closest("article");
const versionBadge = [...(card?.querySelectorAll<HTMLElement>("[data-stub='Badge']") ?? [])].find((element) => element.textContent?.trim() === `v${versionValue}`);
expect(versionBadge?.textContent?.trim(), `${view}: full version`).toBe(`v${versionValue}`);
expect(versionBadge?.classList.contains("max-w-full"), `${view}: version fits the available width`).toBe(true);
expect(card, `${view}: listing card renders`).toBeDefined();
const versionText = [...(card?.querySelectorAll<HTMLElement>("span") ?? [])].find((element) => element.textContent?.includes(`v${versionValue}`));
expect(versionText, `${view}: full catalog version renders`).toBeDefined();
expect(versionText?.classList.contains("shrink-0"), `${view}: version never shrinks to an ellipsis`).toBe(true);
const details = [...(card?.querySelectorAll<HTMLElement>("span") ?? [])].find((element) => element.textContent?.trim() === "DBX · first");
const details = [...card.querySelectorAll<HTMLElement>("span")].find((element) => element.textContent?.trim() === "DBX · first");
expect(details, `${view}: publisher and repository details render`).toBeDefined();
expect(versionBadge!.compareDocumentPosition(details!) & Node.DOCUMENT_POSITION_FOLLOWING).not.toBe(0);
// Update state: versions ride inside the footer i18n sentence instead of a separate badge.
const installedCard = cards.find((element) => element.textContent?.includes(installedLongName));
expect(installedCard?.textContent, `${view}: update state keeps the catalog latest version`).toContain(versionValue);
if (view === "grid") {
expect(card?.parentElement?.classList.contains("md:grid-cols-3"), "grid must not use the viewport breakpoint removed by #10444").toBe(false);
expect(card?.parentElement?.className, "grid tracks the panel width via auto-fill").toContain("auto-fill");
expect(card.parentElement?.classList.contains("md:grid-cols-3"), "grid must not use the viewport breakpoint removed by #10444").toBe(false);
expect(card.parentElement?.className, "grid tracks the panel width via auto-fill").toContain("auto-fill");
}
}
});
it("keeps tags and permissions on a single badge line with a trailing overflow counter", async () => {
state.batchMode = false;
const plugin = state.catalogResults[0].catalog!.plugins.find((entry) => entry.id === "b")!;
plugin.tags = ["ssh", "terminal", "sftp", "dev"];
plugin.permissions = ["host.binary", "host.clipboard:read", "host.events", "host.filesystem", "host.storage", "host.workbench"];
await flushUi();
state.marketplaceViewMode = "grid";
await nextTick();
const card = [...host.querySelectorAll("article")].find((element) => element.textContent?.includes("sftp"));
const badgeRow = card?.querySelector(".marketplace-tags");
expect(badgeRow, "badge row renders").toBeDefined();
expect(badgeRow?.classList.contains("flex-wrap"), "badge row must stay single-line").toBe(false);
const badges = [...(badgeRow?.querySelectorAll<HTMLElement>("[data-stub='Badge']") ?? [])].map((element) => element.textContent?.trim());
expect(badges, "three visible badges plus the overflow counter").toEqual(["ssh", "terminal", "sftp", "+7"]);
});
});
describe("PluginContributionsPanel single uninstall outcomes", () => {
-1
View File
@@ -228,7 +228,6 @@ export default {
sortByUpdatesFirst: "Updates first",
allRepositories: "All repositories",
marketplaceGuideTitle: "Plugins are maintained by community developers",
showFewerTags: "Show less",
marketplaceGuideDescription: "For plugin issues or feature requests, please open an issue in the plugin's own repository (use the source repository link on the plugin card); the main DBX repository only handles issues with the app itself.",
loadingMarketplace: "Loading plugin marketplace",
noMarketplacePlugins: "No plugins to show",
-1
View File
@@ -230,7 +230,6 @@ export default withEnglishFallback({
sortByUpdatesFirst: "Actualizaciones primero",
allRepositories: "Todos los repositorios",
marketplaceGuideTitle: "Los plugins los mantienen desarrolladores de la comunidad",
showFewerTags: "Menos",
marketplaceGuideDescription: "Para problemas o sugerencias sobre un plugin, abre una issue en el repositorio del propio plugin (usa el enlace del repositorio de origen en la tarjeta); el repositorio principal de DBX solo atiende problemas de la propia aplicación.",
loadingMarketplace: "Cargando marketplace de plugins",
noMarketplacePlugins: "No hay plugins para mostrar",
-1
View File
@@ -146,7 +146,6 @@ export default withEnglishFallback({
sortByUpdatesFirst: "Pembaruan lebih dulu",
allRepositories: "Semua repositori",
marketplaceGuideTitle: "Plugin dikelola oleh pengembang komunitas",
showFewerTags: "Tampilkan lebih sedikit",
marketplaceGuideDescription: "Untuk masalah plugin atau permintaan fitur, silakan buka issue di repositori plugin itu sendiri (gunakan tautan repositori sumber pada kartu plugin); repositori utama DBX hanya menangani masalah aplikasinya sendiri.",
loadingMarketplace: "Memuat marketplace plugin",
noMarketplacePlugins: "Tidak ada plugin untuk ditampilkan",
-1
View File
@@ -230,7 +230,6 @@ export default withEnglishFallback({
sortByUpdatesFirst: "Prima gli aggiornamenti",
allRepositories: "Tutti i repository",
marketplaceGuideTitle: "I plugin sono mantenuti dagli sviluppatori della community",
showFewerTags: "Meno",
marketplaceGuideDescription: "Per problemi o suggerimenti su un plugin, apri una issue nel repository del plugin stesso (usa il link del repository sorgente sulla scheda); il repository principale di DBX gestisce solo i problemi dell'applicazione.",
loadingMarketplace: "Caricamento marketplace plugin",
noMarketplacePlugins: "Nessun plugin da mostrare",
-1
View File
@@ -231,7 +231,6 @@ export default withEnglishFallback({
sortByUpdatesFirst: "更新ありを優先",
allRepositories: "すべてのリポジトリ",
marketplaceGuideTitle: "プラグインはコミュニティ開発者がメンテナンスしています",
showFewerTags: "折りたたむ",
marketplaceGuideDescription: "プラグインの問題や機能要望は、プラグインカードのソースリポジトリリンクから該当リポジトリに Issue を投稿してください。DBX メインリポジトリはアプリ本体の問題のみを受け付けています。",
loadingMarketplace: "プラグインマーケットプレイスを読み込み中",
noMarketplacePlugins: "表示できるプラグインがありません",
-1
View File
@@ -230,7 +230,6 @@ export default withEnglishFallback({
sortByUpdatesFirst: "업데이트 우선",
allRepositories: "모든 저장소",
marketplaceGuideTitle: "플러그인은 커뮤니티 개발자가 유지 관리합니다",
showFewerTags: "접기",
marketplaceGuideDescription: "플러그인 문제나 기능 제안은 플러그인 카드의 소스 저장소 링크를 통해 해당 저장소에 Issue를 등록해 주세요. DBX 메인 저장소는 앱 자체의 문제만 처리합니다.",
loadingMarketplace: "플러그인 마켓플레이스 로드 중",
noMarketplacePlugins: "표시할 플러그인이 없습니다",
-1
View File
@@ -231,7 +231,6 @@ export default withEnglishFallback({
sortByUpdatesFirst: "Atualizações primeiro",
allRepositories: "Todos os repositórios",
marketplaceGuideTitle: "Os plugins são mantidos por desenvolvedores da comunidade",
showFewerTags: "Mostrar menos",
marketplaceGuideDescription: "Para problemas ou sugestões sobre um plugin, abra uma issue no repositório do próprio plugin (use o link do repositório de origem no cartão); o repositório principal do DBX trata apenas de problemas do próprio aplicativo.",
loadingMarketplace: "Carregando marketplace de plugins",
noMarketplacePlugins: "Nenhum plugin para exibir",
-1
View File
@@ -178,7 +178,6 @@ export default withEnglishFallback({
sortByUpdatesFirst: "Сначала с обновлениями",
allRepositories: "Все репозитории",
marketplaceGuideTitle: "Плагины поддерживаются сообществом разработчиков",
showFewerTags: "Свернуть",
marketplaceGuideDescription: "По вопросам о плагинах или для запроса функций создайте issue в собственном репозитории плагина (ссылка на исходный репозиторий есть на карточке плагина); основной репозиторий DBX принимает только вопросы о самом приложении.",
loadingMarketplace: "Загрузка магазина плагинов",
noMarketplacePlugins: "Нет плагинов для отображения",
-1
View File
@@ -153,7 +153,6 @@ export default withEnglishFallback({
sortByUpdatesFirst: "有更新优先",
allRepositories: "全部仓库",
marketplaceGuideTitle: "插件由社区开发者维护",
showFewerTags: "收起",
marketplaceGuideDescription: "插件问题或功能建议请通过插件卡片上的源码仓库入口,前往对应插件仓库提交 Issue;DBX 主仓库仅受理应用本身的问题。",
loadingMarketplace: "正在加载插件商店",
noMarketplacePlugins: "暂无可展示的插件",
-1
View File
@@ -231,7 +231,6 @@ export default withEnglishFallback({
sortByUpdatesFirst: "有更新優先",
allRepositories: "全部倉庫",
marketplaceGuideTitle: "外掛由社群開發者維護",
showFewerTags: "收合",
marketplaceGuideDescription: "外掛問題或功能建議請透過外掛卡片上的原始碼倉庫入口,前往對應外掛倉庫提交 Issue;DBX 主倉庫僅受理應用程式本身的問題。",
loadingMarketplace: "正在載入外掛商店",
noMarketplacePlugins: "沒有可顯示的外掛",