Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(ui): align LightTooltip arrow surface

ducheng1b4588b47f1dc
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index 0a726360aa..d7759768d1 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -5066,7 +5066,7 @@ function treeItemMenuItems(): ContextMenuItem[] {
<CustomContextMenu v-else :items="treeItemMenuItems()" v-slot="contextMenuSlot">
<div @contextmenu="onTreeItemContextMenu($event, contextMenuSlot.onContextMenu)">
- <LightTooltip :text="displayLabel(node)" :disabled="isTooltipDisabled()" side="right" :side-offset="8" :delay="0" :close-delay="0">
+ <LightTooltip :text="displayLabel(node)" :disabled="isTooltipDisabled()" side="right" :side-offset="8" :delay="0" :close-delay="0" :surface="detailTooltip ? 'popover' : 'foreground'">
<div
ref="rowRef"
class="group flex items-center gap-1.5 py-1 px-2 cursor-pointer relative outline-none"
diff --git a/apps/desktop/src/components/ui/LightTooltip.vue b/apps/desktop/src/components/ui/LightTooltip.vue
index 9ce65eced7..dd8510ee37 100644
--- a/apps/desktop/src/components/ui/LightTooltip.vue
+++ b/apps/desktop/src/components/ui/LightTooltip.vue
@@ -11,6 +11,7 @@ const props = withDefaults(
closeDelay?: number;
openOnFocus?: boolean;
nowrap?: boolean;
+ surface?: "foreground" | "popover";
}>(),
{
disabled: false,
@@ -20,6 +21,7 @@ const props = withDefaults(
closeDelay: 100,
openOnFocus: true,
nowrap: false,
+ surface: "foreground",
},
);
@@ -62,17 +64,21 @@ const tooltipTransformClass = computed(() => {
const arrowClass = computed(() => {
switch (props.side) {
case "right":
- return "absolute -left-1 top-1/2 -translate-y-1/2";
+ return "absolute -left-1.25 top-1/2 -translate-y-1/2 border-b border-l";
case "left":
- return "absolute -right-1 top-1/2 -translate-y-1/2";
+ return "absolute -right-1.25 top-1/2 -translate-y-1/2 border-t border-r";
case "bottom":
- return "absolute -top-1 left-1/2 -translate-x-1/2";
+ return "absolute -top-1.25 left-1/2 -translate-x-1/2 border-t border-l";
case "top":
default:
- return "absolute -bottom-1 left-1/2 -translate-x-1/2";
+ return "absolute -bottom-1.25 left-1/2 -translate-x-1/2 border-b border-r";
}
});
+const tooltipSurfaceClass = computed(() => (props.surface === "popover" ? "bg-popover text-popover-foreground" : "bg-foreground text-background"));
+
+const arrowSurfaceClass = computed(() => (props.surface === "popover" ? "bg-popover border-border" : "bg-foreground border-foreground"));
+
function clearTimer() {
if (!timer) return;
clearTimeout(timer);
@@ -241,15 +247,15 @@ watch(
<div
v-if="show"
ref="tooltipRef"
- class="fixed z-50 rounded-md bg-foreground text-xs text-background"
- :class="[slots.content ? '' : ['inline-flex w-fit max-w-xs items-center gap-1.5 px-3 py-1.5', nowrap ? 'whitespace-nowrap' : ''], tooltipTransformClass]"
+ class="fixed z-50 rounded-md text-xs"
+ :class="[tooltipSurfaceClass, slots.content ? '' : ['inline-flex w-fit max-w-xs items-center gap-1.5 px-3 py-1.5', nowrap ? 'whitespace-nowrap' : ''], tooltipTransformClass]"
:style="{ left: `${x}px`, top: `${y}px` }"
role="tooltip"
@mouseenter="clearCloseTimer"
@mouseleave="scheduleClose"
>
<slot name="content">{{ text }}</slot>
- <span :class="[arrowClass, 'size-2.5 rotate-45 rounded-[2px] bg-foreground']" aria-hidden="true" />
+ <span :class="[arrowClass, arrowSurfaceClass, 'size-2.5 rotate-45 rounded-[2px]']" aria-hidden="true" />
</div>
</Teleport>
</template>