fix: honor editor font in redis views
This commit is contained in:
1 parent
8c157c7c5e
commit
a68af9c740
6 files changed
+115
-34
No files matched your search
@@ -41,10 +41,12 @@ import { classifyRedisCommandSafety } from "@/lib/redisCommandSafety";
|
|||||||
import { isRedisClearScreenCommand, nextRedisCommandDb, redisKeyTextToRaw } from "@/lib/redisCommandSession";
|
import { isRedisClearScreenCommand, nextRedisCommandDb, redisKeyTextToRaw } from "@/lib/redisCommandSession";
|
||||||
import { formatRedisCommandResult, formatRedisStringValue } from "@/lib/redisValuePresentation";
|
import { formatRedisCommandResult, formatRedisStringValue } from "@/lib/redisValuePresentation";
|
||||||
import { isCancelSearchShortcut } from "@/lib/keyboardShortcuts";
|
import { isCancelSearchShortcut } from "@/lib/keyboardShortcuts";
|
||||||
|
import { useEditorFontFamilyStyle } from "@/composables/useEditorFontFamilyStyle";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const connectionStore = useConnectionStore();
|
const connectionStore = useConnectionStore();
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
|
const editorFontFamilyStyle = useEditorFontFamilyStyle();
|
||||||
|
|
||||||
type RedisSearchMode = "key" | "value";
|
type RedisSearchMode = "key" | "value";
|
||||||
type RedisCreateKeyType = "string" | "hash" | "list" | "set" | "zset";
|
type RedisCreateKeyType = "string" | "hash" | "list" | "set" | "zset";
|
||||||
@@ -577,7 +579,7 @@ defineExpose({ focusSearch });
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div ref="rootRef" class="h-full">
|
<div ref="rootRef" class="h-full" :style="editorFontFamilyStyle">
|
||||||
<Splitpanes class="redis-workspace-splitpanes h-full">
|
<Splitpanes class="redis-workspace-splitpanes h-full">
|
||||||
<!-- Key tree (left) -->
|
<!-- Key tree (left) -->
|
||||||
<Pane :size="36" :min-size="24">
|
<Pane :size="36" :min-size="24">
|
||||||
@@ -688,7 +690,7 @@ defineExpose({ focusSearch });
|
|||||||
:is="expandedGroupIds.has(row.node.id) ? FolderOpen : FolderClosed"
|
:is="expandedGroupIds.has(row.node.id) ? FolderOpen : FolderClosed"
|
||||||
class="w-3 h-3 shrink-0 text-amber-500"
|
class="w-3 h-3 shrink-0 text-amber-500"
|
||||||
/>
|
/>
|
||||||
<span class="truncate font-mono">{{ row.node.label }}</span>
|
<span class="dbx-editor-font-family truncate">{{ row.node.label }}</span>
|
||||||
<span class="text-muted-foreground ml-1">({{ countLeaves(row.node) }})</span>
|
<span class="text-muted-foreground ml-1">({{ countLeaves(row.node) }})</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
@@ -705,7 +707,7 @@ defineExpose({ focusSearch });
|
|||||||
@click="toggleCheck(row.node.keyRaw, $event)"
|
@click="toggleCheck(row.node.keyRaw, $event)"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span class="truncate font-mono">{{ row.node.label }}</span>
|
<span class="dbx-editor-font-family truncate">{{ row.node.label }}</span>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -785,7 +787,7 @@ defineExpose({ focusSearch });
|
|||||||
|
|
||||||
<TabsContent value="command" class="m-0 min-h-0 flex-1 flex flex-col">
|
<TabsContent value="command" class="m-0 min-h-0 flex-1 flex flex-col">
|
||||||
<div
|
<div
|
||||||
class="relative flex min-h-0 flex-1 flex-col bg-[#090c10] font-mono text-[13px] leading-5 text-slate-100"
|
class="dbx-editor-font-family relative flex min-h-0 flex-1 flex-col bg-[#090c10] text-[13px] leading-5 text-slate-100"
|
||||||
@click="getCommandInput()?.focus()"
|
@click="getCommandInput()?.focus()"
|
||||||
>
|
>
|
||||||
<div ref="commandTerminalRef" class="min-h-0 flex-1 overflow-auto px-4 pb-3 pt-4">
|
<div ref="commandTerminalRef" class="min-h-0 flex-1 overflow-auto px-4 pb-3 pt-4">
|
||||||
@@ -815,7 +817,7 @@ defineExpose({ focusSearch });
|
|||||||
<input
|
<input
|
||||||
v-model="commandText"
|
v-model="commandText"
|
||||||
data-redis-command-input
|
data-redis-command-input
|
||||||
class="min-w-0 flex-1 border-0 bg-transparent p-0 font-mono text-[13px] text-slate-100 caret-[#d7ba7d] outline-none placeholder:text-slate-600"
|
class="dbx-editor-font-family min-w-0 flex-1 border-0 bg-transparent p-0 text-[13px] text-slate-100 caret-[#d7ba7d] outline-none placeholder:text-slate-600"
|
||||||
:disabled="commandRunning"
|
:disabled="commandRunning"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
@@ -840,7 +842,7 @@ defineExpose({ focusSearch });
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Dialog v-model:open="showCreateKeyDialog">
|
<Dialog v-model:open="showCreateKeyDialog">
|
||||||
<DialogContent class="sm:max-w-md">
|
<DialogContent class="sm:max-w-md" :style="editorFontFamilyStyle">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{{ t("redis.createKey") }}</DialogTitle>
|
<DialogTitle>{{ t("redis.createKey") }}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -850,7 +852,7 @@ defineExpose({ focusSearch });
|
|||||||
<span>{{ t("redis.createKeyName") }}</span>
|
<span>{{ t("redis.createKeyName") }}</span>
|
||||||
<Input
|
<Input
|
||||||
v-model="createKeyName"
|
v-model="createKeyName"
|
||||||
class="h-8 font-mono text-xs"
|
class="dbx-editor-font-family h-8 text-xs"
|
||||||
:placeholder="t('redis.createKeyNamePlaceholder')"
|
:placeholder="t('redis.createKeyNamePlaceholder')"
|
||||||
@keydown.enter="createRedisKey"
|
@keydown.enter="createRedisKey"
|
||||||
/>
|
/>
|
||||||
@@ -877,7 +879,7 @@ defineExpose({ focusSearch });
|
|||||||
<span>{{ t("redis.createField") }}</span>
|
<span>{{ t("redis.createField") }}</span>
|
||||||
<Input
|
<Input
|
||||||
v-model="createKeyField"
|
v-model="createKeyField"
|
||||||
class="h-8 font-mono text-xs"
|
class="dbx-editor-font-family h-8 text-xs"
|
||||||
:placeholder="t('redis.createFieldPlaceholder')"
|
:placeholder="t('redis.createFieldPlaceholder')"
|
||||||
@keydown.enter="createRedisKey"
|
@keydown.enter="createRedisKey"
|
||||||
/>
|
/>
|
||||||
@@ -887,7 +889,7 @@ defineExpose({ focusSearch });
|
|||||||
<span>{{ t("redis.createScore") }}</span>
|
<span>{{ t("redis.createScore") }}</span>
|
||||||
<Input
|
<Input
|
||||||
v-model="createKeyScore"
|
v-model="createKeyScore"
|
||||||
class="h-8 font-mono text-xs"
|
class="dbx-editor-font-family h-8 text-xs"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
@keydown.enter="createRedisKey"
|
@keydown.enter="createRedisKey"
|
||||||
/>
|
/>
|
||||||
@@ -899,7 +901,7 @@ defineExpose({ focusSearch });
|
|||||||
}}</span>
|
}}</span>
|
||||||
<textarea
|
<textarea
|
||||||
v-model="createKeyValue"
|
v-model="createKeyValue"
|
||||||
class="min-h-28 resize-y rounded-md border bg-background p-2 font-mono text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
class="dbx-editor-font-family min-h-28 resize-y rounded-md border bg-background p-2 text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
:placeholder="t('redis.createValuePlaceholder')"
|
:placeholder="t('redis.createValuePlaceholder')"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import * as api from "@/lib/api";
|
|||||||
import type { RedisKeyInfo, RedisValue } from "@/lib/api";
|
import type { RedisKeyInfo, RedisValue } from "@/lib/api";
|
||||||
import { useToast } from "@/composables/useToast";
|
import { useToast } from "@/composables/useToast";
|
||||||
import { useTheme } from "@/composables/useTheme";
|
import { useTheme } from "@/composables/useTheme";
|
||||||
|
import { useEditorFontFamilyStyle } from "@/composables/useEditorFontFamilyStyle";
|
||||||
import { createRedisShikiJsonHighlighter, type RedisJsonHighlighter } from "@/lib/redisJsonHighlighter";
|
import { createRedisShikiJsonHighlighter, type RedisJsonHighlighter } from "@/lib/redisJsonHighlighter";
|
||||||
import { copyToClipboard } from "@/lib/clipboard";
|
import { copyToClipboard } from "@/lib/clipboard";
|
||||||
import {
|
import {
|
||||||
@@ -26,6 +27,7 @@ import {
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
const { isDark } = useTheme();
|
const { isDark } = useTheme();
|
||||||
|
const editorFontFamilyStyle = useEditorFontFamilyStyle();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
connectionId: string;
|
connectionId: string;
|
||||||
@@ -603,7 +605,7 @@ onBeforeUnmount(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="h-full flex flex-col overflow-hidden">
|
<div class="h-full flex flex-col overflow-hidden" :style="editorFontFamilyStyle">
|
||||||
<div v-if="loading" class="flex-1 flex items-center justify-center text-muted-foreground">
|
<div v-if="loading" class="flex-1 flex items-center justify-center text-muted-foreground">
|
||||||
{{ t("common.loading") }}
|
{{ t("common.loading") }}
|
||||||
</div>
|
</div>
|
||||||
@@ -612,7 +614,9 @@ onBeforeUnmount(() => {
|
|||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="shrink-0 border-b bg-background">
|
<div class="shrink-0 border-b bg-background">
|
||||||
<div class="flex h-9 items-center gap-2 px-4">
|
<div class="flex h-9 items-center gap-2 px-4">
|
||||||
<span class="min-w-0 flex-1 truncate font-mono text-sm font-semibold">{{ data.key_display }}</span>
|
<span class="dbx-editor-font-family min-w-0 flex-1 truncate text-sm font-semibold">{{
|
||||||
|
data.key_display
|
||||||
|
}}</span>
|
||||||
<Button variant="ghost" size="icon" class="h-7 w-7 shrink-0" @click="load"
|
<Button variant="ghost" size="icon" class="h-7 w-7 shrink-0" @click="load"
|
||||||
><RefreshCw class="h-3.5 w-3.5"
|
><RefreshCw class="h-3.5 w-3.5"
|
||||||
/></Button>
|
/></Button>
|
||||||
@@ -625,7 +629,7 @@ onBeforeUnmount(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex min-h-7 flex-wrap items-center gap-2 px-4 pb-1">
|
<div class="flex min-h-7 flex-wrap items-center gap-2 px-4 pb-1">
|
||||||
<Badge variant="secondary" class="font-mono text-xs uppercase">{{ data.key_type }}</Badge>
|
<Badge variant="secondary" class="dbx-editor-font-family text-xs uppercase">{{ data.key_type }}</Badge>
|
||||||
<Badge v-if="metadataSizeLabel" variant="outline" class="text-xs text-muted-foreground">
|
<Badge v-if="metadataSizeLabel" variant="outline" class="text-xs text-muted-foreground">
|
||||||
{{ t("redis.columnSize") }}: {{ metadataSizeLabel }}
|
{{ t("redis.columnSize") }}: {{ metadataSizeLabel }}
|
||||||
</Badge>
|
</Badge>
|
||||||
@@ -697,7 +701,7 @@ onBeforeUnmount(() => {
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="stringJsonDetail && stringValueView === 'json'"
|
v-if="stringJsonDetail && stringValueView === 'json'"
|
||||||
class="min-h-0 flex-1 overflow-auto bg-background p-4 font-mono text-sm leading-6"
|
class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-4 text-sm leading-6"
|
||||||
>
|
>
|
||||||
<RedisJsonTree
|
<RedisJsonTree
|
||||||
:value="stringJsonDetail.value"
|
:value="stringJsonDetail.value"
|
||||||
@@ -708,7 +712,7 @@ onBeforeUnmount(() => {
|
|||||||
<textarea
|
<textarea
|
||||||
v-else
|
v-else
|
||||||
v-model="editValue"
|
v-model="editValue"
|
||||||
class="flex-1 p-4 font-mono text-sm bg-background resize-none outline-none"
|
class="dbx-editor-font-family flex-1 p-4 text-sm bg-background resize-none outline-none"
|
||||||
:class="{ 'whitespace-pre': stringJsonDetail && !redisJsonWordWrap }"
|
:class="{ 'whitespace-pre': stringJsonDetail && !redisJsonWordWrap }"
|
||||||
:readonly="isBinaryStringValue"
|
:readonly="isBinaryStringValue"
|
||||||
@input="handleStringInput"
|
@input="handleStringInput"
|
||||||
@@ -758,7 +762,7 @@ onBeforeUnmount(() => {
|
|||||||
<template #default="{ item: row }">
|
<template #default="{ item: row }">
|
||||||
<div
|
<div
|
||||||
data-redis-value-row
|
data-redis-value-row
|
||||||
class="grid grid-cols-[60px_1fr_84px] border-b text-sm font-mono hover:bg-accent/50 group cursor-pointer"
|
class="dbx-editor-font-family grid grid-cols-[60px_1fr_84px] border-b text-sm hover:bg-accent/50 group cursor-pointer"
|
||||||
:class="{ 'bg-accent/60': isSelectedMember(`#${row.index}`, row.value) }"
|
:class="{ 'bg-accent/60': isSelectedMember(`#${row.index}`, row.value) }"
|
||||||
:style="{ height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"
|
:style="{ height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"
|
||||||
@click="viewMember(`#${row.index}`, row.value, { kind: 'list', index: row.index })"
|
@click="viewMember(`#${row.index}`, row.value, { kind: 'list', index: row.index })"
|
||||||
@@ -830,7 +834,7 @@ onBeforeUnmount(() => {
|
|||||||
<template #default="{ item: row }">
|
<template #default="{ item: row }">
|
||||||
<div
|
<div
|
||||||
data-redis-value-row
|
data-redis-value-row
|
||||||
class="grid grid-cols-[1fr_84px] border-b text-sm font-mono hover:bg-accent/50 group cursor-pointer"
|
class="dbx-editor-font-family grid grid-cols-[1fr_84px] border-b text-sm hover:bg-accent/50 group cursor-pointer"
|
||||||
:class="{ 'bg-accent/60': isSelectedMember(t('redis.member'), row.value) }"
|
:class="{ 'bg-accent/60': isSelectedMember(t('redis.member'), row.value) }"
|
||||||
:style="{ height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"
|
:style="{ height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"
|
||||||
@click="viewMember(t('redis.member'), row.value, { kind: 'set', member: String(row.value) })"
|
@click="viewMember(t('redis.member'), row.value, { kind: 'set', member: String(row.value) })"
|
||||||
@@ -909,7 +913,7 @@ onBeforeUnmount(() => {
|
|||||||
<template #default="{ item: row }">
|
<template #default="{ item: row }">
|
||||||
<div
|
<div
|
||||||
data-redis-value-row
|
data-redis-value-row
|
||||||
class="grid border-b text-sm font-mono hover:bg-accent/50 group cursor-pointer"
|
class="dbx-editor-font-family grid border-b text-sm hover:bg-accent/50 group cursor-pointer"
|
||||||
:style="{ ...hashGridStyle, height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"
|
:style="{ ...hashGridStyle, height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"
|
||||||
:class="{ 'bg-accent/60': isSelectedMember(String(row.value.field), row.value.value) }"
|
:class="{ 'bg-accent/60': isSelectedMember(String(row.value.field), row.value.value) }"
|
||||||
@click="
|
@click="
|
||||||
@@ -990,7 +994,7 @@ onBeforeUnmount(() => {
|
|||||||
<template #default="{ item: row }">
|
<template #default="{ item: row }">
|
||||||
<div
|
<div
|
||||||
data-redis-value-row
|
data-redis-value-row
|
||||||
class="grid grid-cols-[100px_1fr_84px] border-b text-sm font-mono hover:bg-accent/50 group cursor-pointer"
|
class="dbx-editor-font-family grid grid-cols-[100px_1fr_84px] border-b text-sm hover:bg-accent/50 group cursor-pointer"
|
||||||
:class="{ 'bg-accent/60': isSelectedMember(String(row.value.score), row.value.member) }"
|
:class="{ 'bg-accent/60': isSelectedMember(String(row.value.score), row.value.member) }"
|
||||||
:style="{ height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"
|
:style="{ height: `${REDIS_COLLECTION_ROW_HEIGHT}px` }"
|
||||||
@click="
|
@click="
|
||||||
@@ -1066,7 +1070,7 @@ onBeforeUnmount(() => {
|
|||||||
:size-dependencies="[streamFieldCount(row)]"
|
:size-dependencies="[streamFieldCount(row)]"
|
||||||
:data-index="row.index"
|
:data-index="row.index"
|
||||||
>
|
>
|
||||||
<div data-redis-stream-entry class="px-4 py-2 border-b text-sm font-mono hover:bg-accent/50">
|
<div data-redis-stream-entry class="dbx-editor-font-family px-4 py-2 border-b text-sm hover:bg-accent/50">
|
||||||
<div class="mb-1 text-xs text-muted-foreground">{{ row.entry.id }}</div>
|
<div class="mb-1 text-xs text-muted-foreground">{{ row.entry.id }}</div>
|
||||||
<div
|
<div
|
||||||
v-for="[field, val] in streamFields(row.entry)"
|
v-for="[field, val] in streamFields(row.entry)"
|
||||||
@@ -1104,7 +1108,7 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
<!-- Unknown -->
|
<!-- Unknown -->
|
||||||
<div v-else class="flex-1 overflow-auto p-4">
|
<div v-else class="flex-1 overflow-auto p-4">
|
||||||
<pre class="font-mono text-sm whitespace-pre-wrap">{{ formatValue(data.value) }}</pre>
|
<pre class="dbx-editor-font-family text-sm whitespace-pre-wrap">{{ formatValue(data.value) }}</pre>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -1121,7 +1125,7 @@ onBeforeUnmount(() => {
|
|||||||
side="right"
|
side="right"
|
||||||
class="gap-0 p-0 sm:max-w-[calc(100vw-2rem)]"
|
class="gap-0 p-0 sm:max-w-[calc(100vw-2rem)]"
|
||||||
:class="{ 'select-none': isResizingMemberSheet }"
|
:class="{ 'select-none': isResizingMemberSheet }"
|
||||||
:style="{ width: `${memberDetailSheetWidth}px`, maxWidth: 'calc(100vw - 2rem)' }"
|
:style="[editorFontFamilyStyle, { width: `${memberDetailSheetWidth}px`, maxWidth: 'calc(100vw - 2rem)' }]"
|
||||||
@close-auto-focus="finishMemberDetailClose"
|
@close-auto-focus="finishMemberDetailClose"
|
||||||
@pointer-down-outside.prevent
|
@pointer-down-outside.prevent
|
||||||
@interact-outside.prevent
|
@interact-outside.prevent
|
||||||
@@ -1139,7 +1143,7 @@ onBeforeUnmount(() => {
|
|||||||
<textarea
|
<textarea
|
||||||
v-if="isEditingMember"
|
v-if="isEditingMember"
|
||||||
v-model="memberEditValue"
|
v-model="memberEditValue"
|
||||||
class="min-h-0 flex-1 resize-none bg-background p-5 font-mono text-[13px] leading-6 outline-none"
|
class="dbx-editor-font-family min-h-0 flex-1 resize-none bg-background p-5 text-[13px] leading-6 outline-none"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
/>
|
/>
|
||||||
<template v-else-if="selectedMemberJsonDetail">
|
<template v-else-if="selectedMemberJsonDetail">
|
||||||
@@ -1179,7 +1183,7 @@ onBeforeUnmount(() => {
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="memberValueView === 'json'"
|
v-if="memberValueView === 'json'"
|
||||||
class="min-h-0 flex-1 overflow-auto bg-background p-5 font-mono text-[13px] leading-6"
|
class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-5 text-[13px] leading-6"
|
||||||
>
|
>
|
||||||
<RedisJsonTree
|
<RedisJsonTree
|
||||||
:value="selectedMemberJsonDetail.value"
|
:value="selectedMemberJsonDetail.value"
|
||||||
@@ -1189,14 +1193,14 @@ onBeforeUnmount(() => {
|
|||||||
</div>
|
</div>
|
||||||
<pre
|
<pre
|
||||||
v-else
|
v-else
|
||||||
class="min-h-0 flex-1 overflow-auto bg-background p-5 font-mono text-[13px] leading-6"
|
class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-5 text-[13px] leading-6"
|
||||||
:class="redisJsonWordWrap ? 'whitespace-pre-wrap break-words' : 'whitespace-pre'"
|
:class="redisJsonWordWrap ? 'whitespace-pre-wrap break-words' : 'whitespace-pre'"
|
||||||
v-html="memberRawJsonHtml"
|
v-html="memberRawJsonHtml"
|
||||||
></pre>
|
></pre>
|
||||||
</template>
|
</template>
|
||||||
<pre
|
<pre
|
||||||
v-else
|
v-else
|
||||||
class="min-h-0 flex-1 overflow-auto bg-background p-5 font-mono text-[13px] leading-6 whitespace-pre-wrap break-words"
|
class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-5 text-[13px] leading-6 whitespace-pre-wrap break-words"
|
||||||
>{{ selectedMemberDetail.text }}</pre
|
>{{ selectedMemberDetail.text }}</pre
|
||||||
>
|
>
|
||||||
<SheetFooter class="shrink-0 border-t px-5 py-3">
|
<SheetFooter class="shrink-0 border-t px-5 py-3">
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { computed } from "vue";
|
||||||
|
import { EDITOR_FONT_FAMILY_CSS_VAR } from "@/lib/editorThemes";
|
||||||
|
import { useSettingsStore } from "@/stores/settingsStore";
|
||||||
|
|
||||||
|
export function useEditorFontFamilyStyle() {
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
|
return computed<Record<string, string>>(() => ({
|
||||||
|
[EDITOR_FONT_FAMILY_CSS_VAR]: settingsStore.editorSettings.fontFamily,
|
||||||
|
}));
|
||||||
|
}
|
||||||
@@ -151,6 +151,10 @@ html.disable-transitions *::after {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dbx-editor-font-family {
|
||||||
|
font-family: var(--dbx-editor-font-family, var(--font-mono, monospace));
|
||||||
|
}
|
||||||
|
|
||||||
/* Splitpanes */
|
/* Splitpanes */
|
||||||
.splitpanes--horizontal .splitpanes__pane {
|
.splitpanes--horizontal .splitpanes__pane {
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
|
|||||||
@@ -39,11 +39,26 @@ test("sql completion theme styles the autocomplete popup", () => {
|
|||||||
assert.equal(rules[".cm-completionIcon:before"]?.content, "''");
|
assert.equal(rules[".cm-completionIcon:before"]?.content, "''");
|
||||||
assert.equal(rules[".cm-completionIcon:before"]?.WebkitMaskSize, "14px 14px");
|
assert.equal(rules[".cm-completionIcon:before"]?.WebkitMaskSize, "14px 14px");
|
||||||
assert.equal(rules[".cm-completionIcon:after"]?.display, "none");
|
assert.equal(rules[".cm-completionIcon:after"]?.display, "none");
|
||||||
assert.equal(rules[".cm-completionIcon-table"]?.color, "color-mix(in oklch, var(--primary) 92%, var(--popover-foreground))");
|
assert.equal(
|
||||||
assert.equal(rules[".cm-completionIcon-column"]?.color, "color-mix(in oklch, var(--blue-500, #3b82f6) 92%, var(--popover-foreground))");
|
rules[".cm-completionIcon-table"]?.color,
|
||||||
assert.equal(rules[".cm-completionIcon-keyword"]?.color, "color-mix(in oklch, var(--orange-500, #f97316) 92%, var(--popover-foreground))");
|
"color-mix(in oklch, var(--primary) 92%, var(--popover-foreground))",
|
||||||
assert.equal(rules[".cm-completionIcon-keyword"]?.["--dbx-completion-icon-mask"]?.includes("m16%2018%206-6-6-6"), true);
|
);
|
||||||
assert.equal(rules[".cm-completionIcon-snippet"]?.color, "color-mix(in oklch, var(--emerald-500, #10b981) 92%, var(--popover-foreground))");
|
assert.equal(
|
||||||
|
rules[".cm-completionIcon-column"]?.color,
|
||||||
|
"color-mix(in oklch, var(--blue-500, #3b82f6) 92%, var(--popover-foreground))",
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
rules[".cm-completionIcon-keyword"]?.color,
|
||||||
|
"color-mix(in oklch, var(--orange-500, #f97316) 92%, var(--popover-foreground))",
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
rules[".cm-completionIcon-keyword"]?.["--dbx-completion-icon-mask"]?.includes("m16%2018%206-6-6-6"),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
rules[".cm-completionIcon-snippet"]?.color,
|
||||||
|
"color-mix(in oklch, var(--emerald-500, #10b981) 92%, var(--popover-foreground))",
|
||||||
|
);
|
||||||
assert.deepEqual(rules[".cm-completionLabel"], {
|
assert.deepEqual(rules[".cm-completionLabel"], {
|
||||||
color: "inherit",
|
color: "inherit",
|
||||||
fontFamily: `var(${EDITOR_FONT_FAMILY_CSS_VAR}, var(--font-mono, monospace))`,
|
fontFamily: `var(${EDITOR_FONT_FAMILY_CSS_VAR}, var(--font-mono, monospace))`,
|
||||||
@@ -72,6 +87,8 @@ test("editor font theme reads size and family from CSS variables", () => {
|
|||||||
assert.equal(rules["&"]?.fontSize, `var(${EDITOR_FONT_SIZE_CSS_VAR}, 13px)`);
|
assert.equal(rules["&"]?.fontSize, `var(${EDITOR_FONT_SIZE_CSS_VAR}, 13px)`);
|
||||||
assert.deepEqual(rules[".cm-content"], {
|
assert.deepEqual(rules[".cm-content"], {
|
||||||
fontFamily: `var(${EDITOR_FONT_FAMILY_CSS_VAR}, monospace)`,
|
fontFamily: `var(${EDITOR_FONT_FAMILY_CSS_VAR}, monospace)`,
|
||||||
|
lineHeight: "1.6",
|
||||||
|
padding: "0",
|
||||||
});
|
});
|
||||||
assert.equal(rules[".cm-gutters"]?.fontSize, `var(${EDITOR_FONT_SIZE_CSS_VAR}, 13px)`);
|
assert.equal(rules[".cm-gutters"]?.fontSize, `var(${EDITOR_FONT_SIZE_CSS_VAR}, 13px)`);
|
||||||
assert.deepEqual(rules[".cm-scroller"], { overflow: "auto" });
|
assert.deepEqual(rules[".cm-scroller"], { overflow: "auto" });
|
||||||
|
|||||||
@@ -92,11 +92,54 @@ test("Redis command workspace uses a terminal-like surface", () => {
|
|||||||
assert.match(source, /{{ commandPrompt }}/);
|
assert.match(source, /{{ commandPrompt }}/);
|
||||||
assert.match(source, /{{ entry\.prompt }}/);
|
assert.match(source, /{{ entry\.prompt }}/);
|
||||||
assert.match(source, /{{ entry\.command }}/);
|
assert.match(source, /{{ entry\.command }}/);
|
||||||
assert.match(source, /class="relative flex min-h-0 flex-1 flex-col bg-\[#090c10\] font-mono text-\[13px\] leading-5 text-slate-100"/);
|
assert.match(
|
||||||
|
source,
|
||||||
|
/class="dbx-editor-font-family relative flex min-h-0 flex-1 flex-col bg-\[#090c10\] text-\[13px\] leading-5 text-slate-100"/,
|
||||||
|
);
|
||||||
assert.match(source, /class="flex shrink-0 items-center gap-2 border-t border-white\/10 bg-\[#090c10\] px-4 py-2"/);
|
assert.match(source, /class="flex shrink-0 items-center gap-2 border-t border-white\/10 bg-\[#090c10\] px-4 py-2"/);
|
||||||
assert.match(source, /class="min-w-0 flex-1 border-0 bg-transparent p-0 font-mono text-\[13px\] text-slate-100 caret-\[#d7ba7d\] outline-none/);
|
assert.match(
|
||||||
|
source,
|
||||||
|
/class="dbx-editor-font-family min-w-0 flex-1 border-0 bg-transparent p-0 text-\[13px\] text-slate-100 caret-\[#d7ba7d\] outline-none/,
|
||||||
|
);
|
||||||
assert.doesNotMatch(source, /class="border-b border-slate-800 bg-slate-950 px-4 py-3 text-slate-100"/);
|
assert.doesNotMatch(source, /class="border-b border-slate-800 bg-slate-950 px-4 py-3 text-slate-100"/);
|
||||||
assert.doesNotMatch(source, /class="min-h-full whitespace-pre-wrap break-words rounded-md border border-slate-800 bg-slate-950/);
|
assert.doesNotMatch(
|
||||||
|
source,
|
||||||
|
/class="min-h-full whitespace-pre-wrap break-words rounded-md border border-slate-800 bg-slate-950/,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Redis text surfaces inherit the configured editor font family without changing sizing classes", () => {
|
||||||
|
const keyBrowserSource = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8");
|
||||||
|
const valueViewerSource = readFileSync("apps/desktop/src/components/redis/RedisValueViewer.vue", "utf8");
|
||||||
|
const fontComposableSource = readFileSync("apps/desktop/src/composables/useEditorFontFamilyStyle.ts", "utf8");
|
||||||
|
const globalStylesSource = readFileSync("apps/desktop/src/styles/globals.css", "utf8");
|
||||||
|
|
||||||
|
assert.match(fontComposableSource, /EDITOR_FONT_FAMILY_CSS_VAR/);
|
||||||
|
assert.match(fontComposableSource, /\[EDITOR_FONT_FAMILY_CSS_VAR\]: settingsStore\.editorSettings\.fontFamily/);
|
||||||
|
assert.match(globalStylesSource, /\.dbx-editor-font-family/);
|
||||||
|
assert.match(globalStylesSource, /font-family: var\(--dbx-editor-font-family, var\(--font-mono, monospace\)\)/);
|
||||||
|
|
||||||
|
assert.match(keyBrowserSource, /const editorFontFamilyStyle = useEditorFontFamilyStyle\(\)/);
|
||||||
|
assert.match(keyBrowserSource, /<div ref="rootRef" class="h-full" :style="editorFontFamilyStyle">/);
|
||||||
|
assert.match(keyBrowserSource, /<DialogContent class="sm:max-w-md" :style="editorFontFamilyStyle">/);
|
||||||
|
assert.match(keyBrowserSource, /class="dbx-editor-font-family truncate"/);
|
||||||
|
assert.match(keyBrowserSource, /class="dbx-editor-font-family h-8 text-xs"/);
|
||||||
|
assert.match(keyBrowserSource, /class="dbx-editor-font-family .* text-\[13px\] leading-5/);
|
||||||
|
|
||||||
|
assert.match(valueViewerSource, /const editorFontFamilyStyle = useEditorFontFamilyStyle\(\)/);
|
||||||
|
assert.match(valueViewerSource, /<div class="h-full flex flex-col overflow-hidden" :style="editorFontFamilyStyle">/);
|
||||||
|
assert.match(
|
||||||
|
valueViewerSource,
|
||||||
|
/:style="\[editorFontFamilyStyle, \{ width: `\$\{memberDetailSheetWidth\}px`, maxWidth: 'calc\(100vw - 2rem\)' \}\]"/,
|
||||||
|
);
|
||||||
|
assert.match(
|
||||||
|
valueViewerSource,
|
||||||
|
/class="dbx-editor-font-family min-h-0 flex-1 overflow-auto bg-background p-4 text-sm leading-6"/,
|
||||||
|
);
|
||||||
|
assert.match(
|
||||||
|
valueViewerSource,
|
||||||
|
/class="dbx-editor-font-family min-h-0 flex-1 resize-none bg-background p-5 text-\[13px\] leading-6 outline-none"/,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Redis browser uses a single thin shared splitter between panes", () => {
|
test("Redis browser uses a single thin shared splitter between panes", () => {
|
||||||
|
|||||||
Reference in new issue
Block a user