Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ node_modules
# vitepress
.vitepress/cache/
/cache/

# Local preview and design files
/.impeccable.md
/docs/zh/markdown-style-preview.md
58 changes: 35 additions & 23 deletions .vitepress/theme/components/DocHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@
<span class="doc-brand-name">DeepFlow</span>
</a>

<input
type="text"
class="doc-search"
readonly
:placeholder="isZh ? '搜索文档' : 'Search docs'"
:aria-label="isZh ? '搜索文档' : 'Search docs'"
@mousedown.prevent="openSearch"
@focus="openSearch"
/>
<div class="doc-search-trigger">
<span class="vpi-search search-icon" aria-hidden="true" />
<input
type="text"
class="doc-search"
readonly
:placeholder="isZh ? '搜索文档' : 'Search docs'"
:aria-label="isZh ? '搜索文档' : 'Search docs'"
@mousedown.prevent="openSearch"
@focus="openSearch"
/>
</div>

<div class="doc-actions">
<div
Expand Down Expand Up @@ -164,35 +167,44 @@ function openSearch() {
}

/* 中:搜索(readonly,点击唤起 VitePress 本地搜索弹层) */
.doc-search {
.doc-search-trigger {
position: relative;
width: min(320px, 36vw);
min-width: 0;
}
.doc-search-trigger .search-icon {
position: absolute;
top: 50%;
left: 12px;
width: 16px;
height: 16px;
transform: translateY(-50%);
color: var(--df-md-text-3);
pointer-events: none;
}
.doc-search {
width: 100%;
height: 38px;
line-height: 38px;
padding: 0 1rem 0 2.1rem;
color: var(--vp-c-text-1);
border: 1px solid var(--vp-c-border);
color: var(--df-md-text-1);
border: 1px solid var(--df-md-border-2);
border-radius: 999px;
font-size: 13.5px;
font-family: inherit;
cursor: pointer;
background:
var(--vp-c-bg-soft)
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='13'%3E%3Cg stroke-width='2' stroke='%23aaa' fill='none'%3E%3Cpath d='M11.29 11.71l-4-4'/%3E%3Ccircle cx='5' cy='5' r='4'/%3E%3C/g%3E%3C/svg%3E")
0.8rem
0.55rem
no-repeat;
background-size: 1rem;
background: var(--df-md-fill-1);
transition: border-color 0.2s ease;
}
.doc-search:hover {
border-color: var(--vp-c-brand-1);
border-color: var(--df-md-primary-6);
}
.doc-search:focus {
border-color: var(--vp-c-brand-1);
border-color: var(--df-md-primary-6);
outline: none;
}
.doc-search::placeholder {
color: var(--vp-c-text-3);
color: var(--df-md-text-3);
}

/* 右:语言切换 + 主题切换 */
Expand Down Expand Up @@ -327,7 +339,7 @@ html.dark .theme-toggle .icon-moon {
gap: 10px;
padding: 0 14px;
}
.doc-search {
.doc-search-trigger {
width: 100%;
}
}
Expand Down
44 changes: 28 additions & 16 deletions .vitepress/theme/components/SidebarActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
</svg>
</button>
<input
type="text"
class="search-box"
readonly
:placeholder="isZh ? '搜索' : 'Search'"
aria-label="Search"
@mousedown.prevent="openSearch"
@focus="openSearch"
/>
<div class="search-trigger">
<span class="vpi-search search-icon" aria-hidden="true" />
<input
type="text"
class="search-box"
readonly
:placeholder="isZh ? '搜索' : 'Search'"
aria-label="Search"
@mousedown.prevent="openSearch"
@focus="openSearch"
/>
</div>
<div
:class="['lang-switch', { open: langOpen }]"
@mouseenter="langOpen = true"
Expand Down Expand Up @@ -201,6 +204,21 @@ html.dark .theme-toggle .icon-moon {
}

/* 搜索框:暗色玻璃输入框,点击唤起 VitePress 本地搜索 */
.search-trigger {
position: relative;
flex: 1 1 0;
min-width: 0;
}
.search-trigger .search-icon {
position: absolute;
top: 50%;
left: 10px;
width: 16px;
height: 16px;
transform: translateY(-50%);
color: var(--text-3);
pointer-events: none;
}
.search-box {
width: 100%;
height: 36px;
Expand All @@ -212,13 +230,7 @@ html.dark .theme-toggle .icon-moon {
font-size: 13px;
font-family: inherit;
cursor: pointer;
background:
var(--fill-1)
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='13'%3E%3Cg stroke-width='2' stroke='%23aaa' fill='none'%3E%3Cpath d='M11.29 11.71l-4-4'/%3E%3Ccircle cx='5' cy='5' r='4'/%3E%3C/g%3E%3C/svg%3E")
0.6rem
0.55rem
no-repeat;
background-size: 1rem;
background: var(--fill-1);
transition: border-color 0.2s ease;
}
.search-box:focus {
Expand Down
2 changes: 2 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import HomeHero from './components/HomeHero.vue'
import EmbeddedSidebarButton from './components/EmbeddedSidebarButton.vue'
import SidebarActions from './components/SidebarActions.vue'
import './custom.css'
import './markdown.css'
import './search.css'

export default {
extends: DefaultTheme,
Expand Down
Loading
Loading