@sugarat/theme 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node.d.ts +2 -2
- package/node.js +54 -0
- package/package.json +5 -3
- package/src/components/BlogAlert.vue +1 -1
- package/src/components/BlogApp.vue +1 -1
- package/src/components/BlogArticleAnalyze.vue +1 -1
- package/src/components/BlogComment.vue +6 -1
- package/src/components/BlogHomeInfo.vue +1 -1
- package/src/components/BlogHomeTags.vue +1 -1
- package/src/components/BlogHotArticle.vue +5 -1
- package/src/components/BlogList.vue +3 -3
- package/src/components/BlogPopover.vue +1 -1
- package/src/components/BlogRecommendArticle.vue +5 -1
- package/src/components/BlogSearch.vue +268 -118
- package/src/components/BlogSidebar.vue +1 -1
- package/src/components/LogoPagefind.vue +55 -0
- package/src/composables/config/index.ts +1 -1
- package/src/node.ts +57 -0
- package/src/styles/scss/algolia.scss +231 -0
- package/src/styles/scss/global.scss +161 -0
- package/src/styles/scss/highlight.scss +12 -0
package/node.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ declare namespace Theme {
|
|
|
139
139
|
author?: string;
|
|
140
140
|
hotArticle?: HotArticle;
|
|
141
141
|
home?: HomeBlog;
|
|
142
|
-
search?: boolean;
|
|
142
|
+
search?: boolean | 'pagefind';
|
|
143
143
|
/**
|
|
144
144
|
* 配置评论
|
|
145
145
|
* power by https://giscus.app/zh-CN
|
|
@@ -170,7 +170,7 @@ declare function getThemeConfig(cfg?: Partial<Theme.BlogConfig>): {
|
|
|
170
170
|
author?: string | undefined;
|
|
171
171
|
hotArticle?: Theme.HotArticle | undefined;
|
|
172
172
|
home?: Theme.HomeBlog | undefined;
|
|
173
|
-
search?: boolean | undefined;
|
|
173
|
+
search?: boolean | "pagefind" | undefined;
|
|
174
174
|
comment?: false | Theme.GiscusConfig | undefined;
|
|
175
175
|
recommend?: Theme.RecommendArticle | undefined;
|
|
176
176
|
article?: Theme.ArticleConfig | undefined;
|
package/node.js
CHANGED
|
@@ -183,6 +183,60 @@ function getTextSummary(text, count = 100) {
|
|
|
183
183
|
return clearMatterContent(text).match(/^# ([\s\S]+)/m)?.[1]?.replace(/#/g, "")?.replace(/!\[.*?\]\(.*?\)/g, "")?.replace(/\[(.*?)\]\(.*?\)/g, "$1")?.replace(/\*\*(.*?)\*\*/g, "$1")?.split("\n")?.filter((v) => !!v)?.slice(1)?.join("\n")?.replace(/>(.*)/, "")?.slice(0, count);
|
|
184
184
|
}
|
|
185
185
|
function defineConfig(config) {
|
|
186
|
+
if (config?.themeConfig?.blog?.search === "pagefind") {
|
|
187
|
+
config.head = (config.head || []).concat([
|
|
188
|
+
[
|
|
189
|
+
"script",
|
|
190
|
+
{},
|
|
191
|
+
`import('/_pagefind/pagefind.js')
|
|
192
|
+
.then((module) => {
|
|
193
|
+
window.__pagefind__ = module
|
|
194
|
+
})
|
|
195
|
+
.catch(() => {
|
|
196
|
+
console.log('not load /_pagefind/pagefind.js')
|
|
197
|
+
})`
|
|
198
|
+
]
|
|
199
|
+
]);
|
|
200
|
+
let flag = true;
|
|
201
|
+
let originLog = null;
|
|
202
|
+
config.vite = {
|
|
203
|
+
...config.vite,
|
|
204
|
+
plugins: [
|
|
205
|
+
...config.vite?.plugins || [],
|
|
206
|
+
{
|
|
207
|
+
name: "@sugarar/theme-plugin-pagefind",
|
|
208
|
+
buildEnd() {
|
|
209
|
+
const { log } = console;
|
|
210
|
+
if (flag) {
|
|
211
|
+
flag = false;
|
|
212
|
+
originLog = log;
|
|
213
|
+
Object.defineProperty(console, "log", {
|
|
214
|
+
value() {
|
|
215
|
+
if (`${arguments[0]}`.includes("build complete")) {
|
|
216
|
+
console.log = originLog;
|
|
217
|
+
setTimeout(() => {
|
|
218
|
+
originLog();
|
|
219
|
+
originLog("=== pagefind: https://pagefind.app/ ===");
|
|
220
|
+
const command = `npx pagefind --source ${import_path.default.join(
|
|
221
|
+
process.argv.slice(2)?.[1] || ".",
|
|
222
|
+
".vitepress/dist"
|
|
223
|
+
)}`;
|
|
224
|
+
originLog(command);
|
|
225
|
+
originLog();
|
|
226
|
+
(0, import_child_process.execSync)(command, {
|
|
227
|
+
stdio: "inherit"
|
|
228
|
+
});
|
|
229
|
+
}, 100);
|
|
230
|
+
}
|
|
231
|
+
return log.apply(this, arguments);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
};
|
|
239
|
+
}
|
|
186
240
|
return config;
|
|
187
241
|
}
|
|
188
242
|
// Annotate the CommonJS export names for ESM import in node:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sugarat/theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"@vue/shared": "^3.2.45",
|
|
36
36
|
"@vueuse/core": "^9.6.0",
|
|
37
37
|
"fast-glob": "^3.2.12",
|
|
38
|
-
"gray-matter": "^4.0.3"
|
|
38
|
+
"gray-matter": "^4.0.3",
|
|
39
|
+
"highlight.js": "^11.7.0",
|
|
40
|
+
"vue-command-palette": "^0.1.4"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
43
|
"@element-plus/icons-vue": "^2.0.10",
|
|
@@ -52,6 +54,6 @@
|
|
|
52
54
|
"build": "npm run build:node && npm run build:docs",
|
|
53
55
|
"build:docs": "vitepress build demo",
|
|
54
56
|
"build:node": "npx tsup src/node.ts --dts --out-dir=./",
|
|
55
|
-
"serve": "
|
|
57
|
+
"serve": "vitepress serve demo"
|
|
56
58
|
}
|
|
57
59
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="card recommend"
|
|
4
|
+
v-if="recommendList.length || empty"
|
|
5
|
+
data-pagefind-ignore="all"
|
|
6
|
+
>
|
|
3
7
|
<!-- 头部 -->
|
|
4
8
|
<div class="card-header">
|
|
5
9
|
<span class="title">{{ title }}</span>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ul>
|
|
2
|
+
<ul data-pagefind-ignore="all">
|
|
3
3
|
<li v-for="v in currentWikiData" :key="v.route">
|
|
4
4
|
<blog-item
|
|
5
5
|
:route="v.route"
|
|
@@ -44,8 +44,8 @@ const activeTag = useActiveTag()
|
|
|
44
44
|
const activeTagLabel = computed(() => activeTag.value.label)
|
|
45
45
|
|
|
46
46
|
const wikiList = computed(() => {
|
|
47
|
-
const topList = docs.value.filter((v) => v.meta.top)
|
|
48
|
-
topList.sort((a, b) => a.meta
|
|
47
|
+
const topList = docs.value.filter((v) => !!v.meta.top)
|
|
48
|
+
topList.sort((a, b) => a.meta!.top - b.meta!.top)
|
|
49
49
|
const data = docs.value.filter(
|
|
50
50
|
(v) => v.meta.date && v.meta.title && !v.meta.top && !v.meta.hidden
|
|
51
51
|
)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="card recommend"
|
|
4
|
+
v-if="recommendList.length || emptyText"
|
|
5
|
+
data-pagefind-ignore="all"
|
|
6
|
+
>
|
|
3
7
|
<!-- 头部 -->
|
|
4
8
|
<div class="card-header">
|
|
5
9
|
<span class="title">{{ title }}</span>
|
|
@@ -1,111 +1,257 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="blog-search" v-if="openSearch">
|
|
2
|
+
<div class="blog-search" v-if="openSearch" data-pagefind-ignore="all">
|
|
3
3
|
<div class="nav-search-btn-wait" @click="searchModal = true">
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
4
|
+
<svg width="14" height="14" viewBox="0 0 20 20">
|
|
5
|
+
<path
|
|
6
|
+
d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z"
|
|
7
|
+
stroke="currentColor"
|
|
8
|
+
fill="none"
|
|
9
|
+
fill-rule="evenodd"
|
|
10
|
+
stroke-linecap="round"
|
|
11
|
+
stroke-linejoin="round"
|
|
12
|
+
></path>
|
|
13
|
+
</svg>
|
|
7
14
|
<span class="search-tip">搜索</span>
|
|
15
|
+
<span class="metaKey"> ⌘ K </span>
|
|
8
16
|
</div>
|
|
9
|
-
<
|
|
10
|
-
class="search-dialog"
|
|
11
|
-
:fullscreen="isFullScreen"
|
|
12
|
-
append-to-body
|
|
13
|
-
modal
|
|
14
|
-
v-model="searchModal"
|
|
15
|
-
width="500px"
|
|
16
|
-
align-center
|
|
17
|
-
>
|
|
17
|
+
<Command.Dialog :visible="searchModal" theme="algolia">
|
|
18
18
|
<template #header>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
size="large"
|
|
23
|
-
v-model="searchWords"
|
|
24
|
-
class="w-50 m-2"
|
|
25
|
-
placeholder="Search Docs"
|
|
26
|
-
:prefix-icon="Search"
|
|
19
|
+
<Command.Input
|
|
20
|
+
v-model:value="searchWords"
|
|
21
|
+
placeholder="请输入要搜索的内容"
|
|
27
22
|
/>
|
|
28
23
|
</template>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
24
|
+
<template #body>
|
|
25
|
+
<div class="search-dialog">
|
|
26
|
+
<Command.List>
|
|
27
|
+
<Command.Empty v-if="!searchResult.length"
|
|
28
|
+
>No results found.</Command.Empty
|
|
29
|
+
>
|
|
30
|
+
<Command.Group
|
|
31
|
+
v-else
|
|
32
|
+
:heading="`共:${searchResult.length} 个搜索结果`"
|
|
33
|
+
>
|
|
34
|
+
<Command.Item
|
|
35
|
+
v-for="item in showSearchResult"
|
|
36
|
+
:data-value="item.route"
|
|
37
|
+
:key="item.route"
|
|
38
|
+
@select="handleSelect"
|
|
39
|
+
>
|
|
40
|
+
<div class="link">
|
|
41
|
+
<div class="title">
|
|
42
|
+
<span>{{ item.meta.title }}</span>
|
|
43
|
+
<span class="date">
|
|
44
|
+
{{ formatDate(item.meta.date, 'yyyy-MM-dd') }}</span
|
|
45
|
+
>
|
|
46
|
+
</div>
|
|
47
|
+
<div class="des" v-html="item.meta.description"></div>
|
|
48
|
+
</div>
|
|
49
|
+
</Command.Item>
|
|
50
|
+
</Command.Group>
|
|
51
|
+
</Command.List>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
<template #footer v-if="searchResult.length">
|
|
55
|
+
<div class="command-palette-logo">
|
|
56
|
+
<a
|
|
57
|
+
v-if="openSearch === 'pagefind'"
|
|
58
|
+
href="https://github.com/cloudcannon/pagefind"
|
|
59
|
+
target="_blank"
|
|
60
|
+
rel="noopener noreferrer"
|
|
61
|
+
>
|
|
62
|
+
<span class="command-palette-Label">Search by</span>
|
|
63
|
+
<logo-pagefind style="width: 77px" />
|
|
64
|
+
</a>
|
|
65
|
+
</div>
|
|
66
|
+
<ul class="command-palette-commands">
|
|
67
|
+
<li>
|
|
68
|
+
<kbd class="command-palette-commands-key"
|
|
69
|
+
><svg width="15" height="15" aria-label="Enter key" role="img">
|
|
70
|
+
<g
|
|
71
|
+
fill="none"
|
|
72
|
+
stroke="currentColor"
|
|
73
|
+
stroke-linecap="round"
|
|
74
|
+
stroke-linejoin="round"
|
|
75
|
+
stroke-width="1.2"
|
|
76
|
+
>
|
|
77
|
+
<path
|
|
78
|
+
d="M12 3.53088v3c0 1-1 2-2 2H4M7 11.53088l-3-3 3-3"
|
|
79
|
+
></path>
|
|
80
|
+
</g></svg></kbd
|
|
81
|
+
><span class="command-palette-Label">to select</span>
|
|
82
|
+
</li>
|
|
83
|
+
<li>
|
|
84
|
+
<kbd class="command-palette-commands-key"
|
|
85
|
+
><svg width="15" height="15" aria-label="Arrow down" role="img">
|
|
86
|
+
<g
|
|
87
|
+
fill="none"
|
|
88
|
+
stroke="currentColor"
|
|
89
|
+
stroke-linecap="round"
|
|
90
|
+
stroke-linejoin="round"
|
|
91
|
+
stroke-width="1.2"
|
|
92
|
+
>
|
|
93
|
+
<path d="M7.5 3.5v8M10.5 8.5l-3 3-3-3"></path>
|
|
94
|
+
</g></svg></kbd
|
|
95
|
+
><kbd class="command-palette-commands-key"
|
|
96
|
+
><svg width="15" height="15" aria-label="Arrow up" role="img">
|
|
97
|
+
<g
|
|
98
|
+
fill="none"
|
|
99
|
+
stroke="currentColor"
|
|
100
|
+
stroke-linecap="round"
|
|
101
|
+
stroke-linejoin="round"
|
|
102
|
+
stroke-width="1.2"
|
|
48
103
|
>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
104
|
+
<path d="M7.5 11.5v-8M10.5 6.5l-3-3-3 3"></path>
|
|
105
|
+
</g></svg></kbd
|
|
106
|
+
><span class="command-palette-Label">to navigate</span>
|
|
107
|
+
</li>
|
|
108
|
+
<li>
|
|
109
|
+
<kbd class="command-palette-commands-key"
|
|
110
|
+
><svg width="15" height="15" aria-label="Escape key" role="img">
|
|
111
|
+
<g
|
|
112
|
+
fill="none"
|
|
113
|
+
stroke="currentColor"
|
|
114
|
+
stroke-linecap="round"
|
|
115
|
+
stroke-linejoin="round"
|
|
116
|
+
stroke-width="1.2"
|
|
117
|
+
>
|
|
118
|
+
<path
|
|
119
|
+
d="M13.6167 8.936c-.1065.3583-.6883.962-1.4875.962-.7993 0-1.653-.9165-1.653-2.1258v-.5678c0-1.2548.7896-2.1016 1.653-2.1016.8634 0 1.3601.4778 1.4875 1.0724M9 6c-.1352-.4735-.7506-.9219-1.46-.8972-.7092.0246-1.344.57-1.344 1.2166s.4198.8812 1.3445.9805C8.465 7.3992 8.968 7.9337 9 8.5c.032.5663-.454 1.398-1.4595 1.398C6.6593 9.898 6 9 5.963 8.4851m-1.4748.5368c-.2635.5941-.8099.876-1.5443.876s-1.7073-.6248-1.7073-2.204v-.4603c0-1.0416.721-2.131 1.7073-2.131.9864 0 1.6425 1.031 1.5443 2.2492h-2.956"
|
|
120
|
+
></path>
|
|
121
|
+
</g></svg></kbd
|
|
122
|
+
><span class="command-palette-Label">to close</span>
|
|
123
|
+
</li>
|
|
124
|
+
</ul>
|
|
125
|
+
</template>
|
|
126
|
+
</Command.Dialog>
|
|
58
127
|
</div>
|
|
59
128
|
</template>
|
|
60
129
|
|
|
61
130
|
<script lang="ts" setup>
|
|
62
|
-
import { computed, ref, watch } from 'vue'
|
|
63
|
-
|
|
64
|
-
import {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
ElIcon,
|
|
68
|
-
ElDialog,
|
|
69
|
-
InputInstance,
|
|
70
|
-
ElCard,
|
|
71
|
-
ElButton
|
|
72
|
-
} from 'element-plus'
|
|
73
|
-
import { useWindowSize } from '@vueuse/core'
|
|
131
|
+
import { computed, nextTick, ref, watch } from 'vue'
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
import { Command } from 'vue-command-palette'
|
|
134
|
+
import { useRoute, useRouter } from 'vitepress'
|
|
135
|
+
import { useMagicKeys } from '@vueuse/core'
|
|
74
136
|
import { formatDate } from '../utils'
|
|
75
137
|
import { useArticles, useBlogConfig } from '../composables/config/blog'
|
|
138
|
+
import { Theme } from '../composables/config'
|
|
139
|
+
import LogoPagefind from './LogoPagefind.vue'
|
|
76
140
|
|
|
77
141
|
const { search: openSearch = true } = useBlogConfig()
|
|
78
142
|
|
|
79
143
|
const searchModal = ref(false)
|
|
144
|
+
const searchWords = ref('')
|
|
145
|
+
const docs = useArticles()
|
|
80
146
|
|
|
81
|
-
const
|
|
82
|
-
const
|
|
147
|
+
const keys = useMagicKeys()
|
|
148
|
+
const CmdK = keys['Meta+K']
|
|
149
|
+
// eslint-disable-next-line dot-notation, prefer-destructuring
|
|
150
|
+
const Escape = keys['Escape']
|
|
151
|
+
|
|
152
|
+
watch(CmdK, (v) => {
|
|
153
|
+
if (v) {
|
|
154
|
+
searchModal.value = true
|
|
155
|
+
}
|
|
156
|
+
})
|
|
157
|
+
watch(Escape, (v) => {
|
|
158
|
+
if (v) {
|
|
159
|
+
searchModal.value = false
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
const searchResult = ref<Theme.PageData[]>([])
|
|
164
|
+
const inlineSearch = () => {
|
|
165
|
+
if (!searchWords.value) {
|
|
166
|
+
searchResult.value = []
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
searchResult.value = docs.value
|
|
170
|
+
.filter((v) =>
|
|
171
|
+
`${v.meta.description}${v.meta.title}`.includes(searchWords.value)
|
|
172
|
+
)
|
|
173
|
+
.map((v) => {
|
|
174
|
+
return {
|
|
175
|
+
...v,
|
|
176
|
+
meta: {
|
|
177
|
+
...v.meta,
|
|
178
|
+
description:
|
|
179
|
+
v.meta?.description?.replace(
|
|
180
|
+
new RegExp(`(${searchWords.value})`, 'g'),
|
|
181
|
+
'<mark>$1</mark>'
|
|
182
|
+
) || ''
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
searchResult.value.sort((a, b) => {
|
|
187
|
+
return +new Date(b.meta.date) - +new Date(a.meta.date)
|
|
188
|
+
})
|
|
189
|
+
}
|
|
83
190
|
|
|
84
|
-
|
|
85
|
-
|
|
191
|
+
watch(
|
|
192
|
+
() => searchWords.value,
|
|
193
|
+
async () => {
|
|
194
|
+
if (openSearch === 'pagefind') {
|
|
195
|
+
// dev-server兜底
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
if (!window?.__pagefind__?.search) {
|
|
198
|
+
inlineSearch()
|
|
199
|
+
} else {
|
|
200
|
+
// @ts-ignore
|
|
201
|
+
await window?.__pagefind__
|
|
202
|
+
?.search?.(searchWords.value)
|
|
203
|
+
.then(async (search: any) => {
|
|
204
|
+
const result = await Promise.all(
|
|
205
|
+
search.results.map((v: any) => v.data())
|
|
206
|
+
)
|
|
207
|
+
searchResult.value = []
|
|
208
|
+
docs.value.forEach((v) => {
|
|
209
|
+
const match = result.find((r) => r.url.startsWith(v.route))
|
|
210
|
+
if (match) {
|
|
211
|
+
searchResult.value.push({
|
|
212
|
+
...v,
|
|
213
|
+
meta: {
|
|
214
|
+
...v.meta,
|
|
215
|
+
description: match.excerpt
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
})
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
inlineSearch()
|
|
224
|
+
}
|
|
225
|
+
nextTick(() => {
|
|
226
|
+
// hack 原组件实现
|
|
227
|
+
document.querySelectorAll('div[aria-disabled="true"]').forEach((v) => {
|
|
228
|
+
v.setAttribute('aria-disabled', 'false')
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
const handleClickMask = (e: any) => {
|
|
235
|
+
if (e.target === e.currentTarget) {
|
|
236
|
+
searchModal.value = false
|
|
237
|
+
}
|
|
238
|
+
}
|
|
86
239
|
watch(
|
|
87
240
|
() => searchModal.value,
|
|
88
|
-
() => {
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
241
|
+
(newValue) => {
|
|
242
|
+
if (newValue) {
|
|
243
|
+
nextTick(() => {
|
|
244
|
+
document
|
|
245
|
+
.querySelector('div[command-dialog-mask]')
|
|
246
|
+
?.addEventListener('click', handleClickMask)
|
|
92
247
|
})
|
|
248
|
+
} else {
|
|
249
|
+
document
|
|
250
|
+
.querySelector('div[command-dialog-mask]')
|
|
251
|
+
?.removeEventListener('click', handleClickMask)
|
|
93
252
|
}
|
|
94
253
|
}
|
|
95
254
|
)
|
|
96
|
-
|
|
97
|
-
const docs = useArticles()
|
|
98
|
-
|
|
99
|
-
const searchResult = computed(() => {
|
|
100
|
-
if (!searchWords.value) return []
|
|
101
|
-
const result = docs.value.filter((v) =>
|
|
102
|
-
`${v.meta.description}${v.meta.title}`.includes(searchWords.value)
|
|
103
|
-
)
|
|
104
|
-
result.sort((a, b) => {
|
|
105
|
-
return +new Date(b.meta.date) - +new Date(a.meta.date)
|
|
106
|
-
})
|
|
107
|
-
return result
|
|
108
|
-
})
|
|
109
255
|
const pageSize = ref(6)
|
|
110
256
|
const currentPage = ref(0)
|
|
111
257
|
const showSearchResult = computed(() => {
|
|
@@ -115,13 +261,15 @@ const showSearchResult = computed(() => {
|
|
|
115
261
|
const startIdx = pageIdx * pageSize.value
|
|
116
262
|
return searchResult.value.slice(startIdx, startIdx + pageSize.value)
|
|
117
263
|
})
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
)
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
264
|
+
|
|
265
|
+
const router = useRouter()
|
|
266
|
+
const route = useRoute()
|
|
267
|
+
const handleSelect = (target: any) => {
|
|
268
|
+
searchModal.value = false
|
|
269
|
+
if (!route.path.startsWith(target.value)) {
|
|
270
|
+
// searchWords.value = ''
|
|
271
|
+
router.go(target.value)
|
|
272
|
+
}
|
|
125
273
|
}
|
|
126
274
|
</script>
|
|
127
275
|
|
|
@@ -129,7 +277,6 @@ const handleNext = () => {
|
|
|
129
277
|
.blog-search {
|
|
130
278
|
flex: 1;
|
|
131
279
|
margin-left: 10px;
|
|
132
|
-
|
|
133
280
|
.nav-search-btn-wait {
|
|
134
281
|
cursor: pointer;
|
|
135
282
|
display: flex;
|
|
@@ -137,16 +284,21 @@ const handleNext = () => {
|
|
|
137
284
|
justify-content: center;
|
|
138
285
|
padding: 6px;
|
|
139
286
|
box-sizing: border-box;
|
|
140
|
-
width:
|
|
287
|
+
width: 120px;
|
|
288
|
+
|
|
289
|
+
.metaKey {
|
|
290
|
+
margin-left: 10px;
|
|
291
|
+
font-size: 12px;
|
|
292
|
+
}
|
|
141
293
|
|
|
142
294
|
&:hover {
|
|
143
|
-
border:
|
|
144
|
-
border-radius:
|
|
295
|
+
border: 1px solid #409eff;
|
|
296
|
+
border-radius: 6px;
|
|
145
297
|
}
|
|
146
298
|
|
|
147
299
|
.search-tip {
|
|
148
300
|
color: #909399;
|
|
149
|
-
font-size:
|
|
301
|
+
font-size: 12px;
|
|
150
302
|
padding-left: 10px;
|
|
151
303
|
}
|
|
152
304
|
}
|
|
@@ -154,45 +306,43 @@ const handleNext = () => {
|
|
|
154
306
|
</style>
|
|
155
307
|
|
|
156
308
|
<style lang="scss">
|
|
157
|
-
.
|
|
158
|
-
|
|
159
|
-
padding: 0;
|
|
160
|
-
}
|
|
309
|
+
@import '../styles/scss/global.scss';
|
|
310
|
+
@import '../styles/scss/algolia.scss';
|
|
161
311
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
312
|
+
div[command-group] {
|
|
313
|
+
display: block !important;
|
|
314
|
+
}
|
|
315
|
+
div[command-item] {
|
|
316
|
+
display: flex !important;
|
|
317
|
+
}
|
|
318
|
+
.search-dialog {
|
|
319
|
+
div[command-item] > div.link {
|
|
320
|
+
width: 100%;
|
|
171
321
|
}
|
|
172
|
-
|
|
173
|
-
li .title {
|
|
322
|
+
div[command-item] .title {
|
|
174
323
|
display: flex;
|
|
175
324
|
justify-content: space-between;
|
|
176
325
|
}
|
|
177
326
|
|
|
178
|
-
|
|
327
|
+
div[command-item] .des {
|
|
179
328
|
text-overflow: ellipsis;
|
|
180
329
|
overflow: hidden;
|
|
181
330
|
word-break: keep-all;
|
|
182
331
|
white-space: nowrap;
|
|
183
|
-
color: var(--el-color-info-dark-2);
|
|
184
332
|
}
|
|
185
333
|
|
|
186
|
-
|
|
187
|
-
color: var(--el-color-info-light-3);
|
|
334
|
+
div[command-item] .date {
|
|
188
335
|
min-width: 80px;
|
|
189
336
|
}
|
|
337
|
+
div[command-item] mark {
|
|
338
|
+
background: none;
|
|
339
|
+
color: var(--vp-c-brand);
|
|
340
|
+
}
|
|
190
341
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
top: -30px;
|
|
342
|
+
div[command-item][aria-selected='true'] mark,
|
|
343
|
+
div[command-item]:hover mark {
|
|
344
|
+
color: inherit;
|
|
345
|
+
text-decoration: underline;
|
|
196
346
|
}
|
|
197
347
|
}
|
|
198
348
|
</style>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
width="594"
|
|
4
|
+
height="112"
|
|
5
|
+
viewBox="0 0 594 112"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M147.8 111.2H164V77.5998H164.6C164.6 77.5998 170.6 87.1998 183.2 87.1998C197 87.1998 209.6 74.5998 209.6 56.5998C209.6 38.5998 197 25.9998 183.2 25.9998C170.6 25.9998 164.6 35.5998 164.6 35.5998H164V27.1998H147.8V111.2ZM178.4 72.1998C170 72.1998 163.4 65.5998 163.4 56.5998C163.4 47.5998 170 40.9998 178.4 40.9998C186.8 40.9998 193.4 47.5998 193.4 56.5998C193.4 65.5998 186.8 72.1998 178.4 72.1998Z"
|
|
11
|
+
fill="black"
|
|
12
|
+
/>
|
|
13
|
+
<path
|
|
14
|
+
d="M230.628 87.1998C242.028 87.1998 248.028 78.7998 248.028 78.7998H248.628V85.9998C252.228 85.9998 264.828 85.9998 264.828 85.9998V49.3998C264.828 36.1998 254.628 25.9998 239.628 25.9998C224.028 25.9998 215.628 37.3998 215.628 37.3998L225.228 46.9998C225.228 46.9998 230.028 40.3998 238.428 40.3998C244.428 40.3998 248.028 43.9998 248.628 48.1998L230.028 51.5598C219.228 53.4798 212.628 60.7998 212.628 70.3998C212.628 79.9998 219.828 87.1998 230.628 87.1998ZM236.028 73.9998C231.228 73.9998 228.828 71.5998 228.828 67.9998C228.828 64.9998 231.228 62.7198 235.428 61.9998L248.628 59.5998V60.7998C248.628 68.5998 243.228 73.9998 236.028 73.9998Z"
|
|
15
|
+
fill="black"
|
|
16
|
+
/>
|
|
17
|
+
<path
|
|
18
|
+
d="M299.033 111.2C317.633 111.2 330.833 97.9998 330.833 79.9998V27.1998H314.633V35.5998H314.033C314.033 35.5998 308.633 25.9998 296.033 25.9998C282.833 25.9998 270.833 37.9998 270.833 55.3998C270.833 72.7998 282.833 84.7998 296.033 84.7998C308.633 84.7998 314.033 75.1998 314.033 75.1998H314.633V79.9998C314.633 89.5998 308.033 96.1998 299.033 96.1998C289.433 96.1998 283.433 88.9998 283.433 88.9998L273.233 99.1998C273.233 99.1998 281.633 111.2 299.033 111.2ZM300.833 69.7998C293.033 69.7998 287.033 63.7998 287.033 55.3998C287.033 46.9998 293.033 40.9998 300.833 40.9998C308.633 40.9998 314.633 46.9998 314.633 55.3998C314.633 63.7998 308.633 69.7998 300.833 69.7998Z"
|
|
19
|
+
fill="black"
|
|
20
|
+
/>
|
|
21
|
+
<path
|
|
22
|
+
d="M367.986 87.1998C384.186 87.1998 393.186 77.5998 393.186 77.5998L384.786 66.1998C384.786 66.1998 379.386 72.7998 369.186 72.7998C360.186 72.7998 355.386 67.9998 353.586 62.5998H396.186C396.186 62.5998 396.786 59.5998 396.786 55.3998C396.786 39.1998 383.586 25.9998 367.386 25.9998C350.586 25.9998 336.786 39.7998 336.786 56.5998C336.786 73.3998 350.586 87.1998 367.986 87.1998ZM353.586 50.5998C355.386 45.1998 360.186 40.3998 366.786 40.3998C373.386 40.3998 378.186 45.1998 379.986 50.5998H353.586Z"
|
|
23
|
+
fill="black"
|
|
24
|
+
/>
|
|
25
|
+
<path
|
|
26
|
+
d="M406.423 85.9998H422.624V43.3998H444.224V85.9998H460.423V28.3998H422.624V24.7998C422.624 19.3998 425.624 16.3998 430.423 16.3998C433.423 16.3998 435.823 17.5998 435.823 17.5998V2.5998C435.823 2.5998 431.624 0.799805 426.224 0.799805C414.224 0.799805 406.423 8.59981 406.423 22.3998V28.3998H397.423V43.3998H406.423V85.9998ZM452.263 19.3998C457.423 19.3998 461.624 15.1998 461.624 10.3998C461.624 5.59981 457.424 1.3998 452.384 1.3998C447.224 1.3998 443.023 5.59981 443.023 10.3998C443.023 15.1998 447.223 19.3998 452.263 19.3998Z"
|
|
27
|
+
fill="black"
|
|
28
|
+
/>
|
|
29
|
+
<path
|
|
30
|
+
d="M470.652 85.9998H486.852V54.7998C486.852 46.9998 492.252 41.5998 499.452 41.5998C506.052 41.5998 510.252 45.7998 510.252 52.9998V85.9998H526.452V50.5998C526.452 35.5998 516.852 25.9998 504.852 25.9998C493.452 25.9998 487.452 35.5998 487.452 35.5998H486.852V27.1998H470.652V85.9998Z"
|
|
31
|
+
fill="black"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
d="M557.819 87.1998C570.419 87.1998 576.419 77.5998 576.419 77.5998H577.019V85.9998H593.219V1.9998H577.019V35.5998H576.419C576.419 35.5998 570.419 25.9998 557.819 25.9998C544.019 25.9998 531.419 38.5998 531.419 56.5998C531.419 74.5998 544.019 87.1998 557.819 87.1998ZM562.619 72.1998C554.219 72.1998 547.619 65.5998 547.619 56.5998C547.619 47.5998 554.219 40.9998 562.619 40.9998C571.019 40.9998 577.619 47.5998 577.619 56.5998C577.619 65.5998 571.019 72.1998 562.619 72.1998Z"
|
|
35
|
+
fill="black"
|
|
36
|
+
/>
|
|
37
|
+
<path
|
|
38
|
+
fill-rule="evenodd"
|
|
39
|
+
clip-rule="evenodd"
|
|
40
|
+
d="M60 96.9999C93.1371 96.9999 120 81.8416 120 63.1428V50.8311H115.91C107.182 38.2198 85.4398 29.2856 60 29.2856C34.5602 29.2856 12.8183 38.2198 4.09026 50.8311H0V63.1428C0 81.8416 26.8629 96.9999 60 96.9999Z"
|
|
41
|
+
fill="black"
|
|
42
|
+
/>
|
|
43
|
+
<path
|
|
44
|
+
d="M116 52C116 59.317 110.727 66.7404 100.454 72.5615C90.3014 78.3149 76.0069 82 60 82C43.9931 82 29.6986 78.3149 19.5456 72.5615C9.2731 66.7404 4 59.317 4 52C4 44.6831 9.2731 37.2596 19.5456 31.4385C29.6986 25.6851 43.9931 22 60 22C76.0069 22 90.3014 25.6851 100.454 31.4385C110.727 37.2596 116 44.6831 116 52Z"
|
|
45
|
+
fill="white"
|
|
46
|
+
stroke="black"
|
|
47
|
+
stroke-width="8"
|
|
48
|
+
/>
|
|
49
|
+
<path
|
|
50
|
+
d="M57.8864 72.0605L87.2817 41.837C88.6253 40.4556 87.43 38.1599 85.5278 38.4684L26.0819 48.1083C23.9864 48.4481 23.794 51.3882 25.8273 51.9982L46.7151 58.2645C47.2181 58.4154 47.6415 58.7581 47.894 59.2185L54.6991 71.6277C55.3457 72.8069 56.9487 73.0246 57.8864 72.0605Z"
|
|
51
|
+
fill="black"
|
|
52
|
+
/>
|
|
53
|
+
<ellipse cx="58" cy="53.5" rx="7" ry="4.5" fill="white" />
|
|
54
|
+
</svg>
|
|
55
|
+
</template>
|
package/src/node.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable prefer-rest-params */
|
|
1
2
|
import glob from 'fast-glob'
|
|
2
3
|
import matter from 'gray-matter'
|
|
3
4
|
import fs from 'fs'
|
|
@@ -188,5 +189,61 @@ function getTextSummary(text: string, count = 100) {
|
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
export function defineConfig(config: UserConfig<Theme.Config>) {
|
|
192
|
+
if (config?.themeConfig?.blog?.search === 'pagefind') {
|
|
193
|
+
config.head = (config.head || []).concat([
|
|
194
|
+
[
|
|
195
|
+
'script',
|
|
196
|
+
{},
|
|
197
|
+
`import('/_pagefind/pagefind.js')
|
|
198
|
+
.then((module) => {
|
|
199
|
+
window.__pagefind__ = module
|
|
200
|
+
})
|
|
201
|
+
.catch(() => {
|
|
202
|
+
console.log('not load /_pagefind/pagefind.js')
|
|
203
|
+
})`
|
|
204
|
+
]
|
|
205
|
+
])
|
|
206
|
+
let flag = true
|
|
207
|
+
let originLog: any = null
|
|
208
|
+
config.vite = {
|
|
209
|
+
...config.vite,
|
|
210
|
+
plugins: [
|
|
211
|
+
...(config.vite?.plugins || []),
|
|
212
|
+
{
|
|
213
|
+
name: '@sugarar/theme-plugin-pagefind',
|
|
214
|
+
buildEnd() {
|
|
215
|
+
const { log } = console
|
|
216
|
+
// TODO: hack
|
|
217
|
+
if (flag) {
|
|
218
|
+
flag = false
|
|
219
|
+
originLog = log
|
|
220
|
+
Object.defineProperty(console, 'log', {
|
|
221
|
+
value() {
|
|
222
|
+
if (`${arguments[0]}`.includes('build complete')) {
|
|
223
|
+
console.log = originLog
|
|
224
|
+
setTimeout(() => {
|
|
225
|
+
originLog()
|
|
226
|
+
originLog('=== pagefind: https://pagefind.app/ ===')
|
|
227
|
+
const command = `npx pagefind --source ${path.join(
|
|
228
|
+
process.argv.slice(2)?.[1] || '.',
|
|
229
|
+
'.vitepress/dist'
|
|
230
|
+
)}`
|
|
231
|
+
originLog(command)
|
|
232
|
+
originLog()
|
|
233
|
+
execSync(command, {
|
|
234
|
+
stdio: 'inherit'
|
|
235
|
+
})
|
|
236
|
+
}, 100)
|
|
237
|
+
}
|
|
238
|
+
// @ts-ignore
|
|
239
|
+
return log.apply(this, arguments)
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
}
|
|
191
248
|
return config
|
|
192
249
|
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
.algolia {
|
|
2
|
+
[command-root] {
|
|
3
|
+
padding: 8px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
[command-input] {
|
|
7
|
+
font-family: var(--font-sans);
|
|
8
|
+
width: 100%;
|
|
9
|
+
font-size: 18px;
|
|
10
|
+
padding: 12px;
|
|
11
|
+
outline: none;
|
|
12
|
+
background: var(--bg);
|
|
13
|
+
color: var(--gray12);
|
|
14
|
+
border-bottom: 1px solid var(--gray6);
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
caret-color: var(--vcp-c-brand);
|
|
17
|
+
margin: 0;
|
|
18
|
+
border: 1px solid var(--vcp-c-brand);
|
|
19
|
+
|
|
20
|
+
&::placeholder {
|
|
21
|
+
color: var(--gray9);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[command-list] {
|
|
26
|
+
height: var(--command-list-height);
|
|
27
|
+
max-height: 360px;
|
|
28
|
+
overflow: auto;
|
|
29
|
+
overscroll-behavior: contain;
|
|
30
|
+
transition: 100ms ease;
|
|
31
|
+
transition-property: height;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[command-item] {
|
|
35
|
+
position: relative;
|
|
36
|
+
content-visibility: auto;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
height: 56px;
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 12px;
|
|
43
|
+
padding: 0px 16px;
|
|
44
|
+
color: var(--gray12);
|
|
45
|
+
user-select: none;
|
|
46
|
+
will-change: background, color;
|
|
47
|
+
transition: all 150ms ease;
|
|
48
|
+
transition-property: none;
|
|
49
|
+
border-radius: 4px;
|
|
50
|
+
margin-top: 4px;
|
|
51
|
+
background-color: var(--lowContrast);
|
|
52
|
+
|
|
53
|
+
&:first-child {
|
|
54
|
+
margin-top: 0px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&[aria-selected='true'],
|
|
58
|
+
&:hover {
|
|
59
|
+
background: var(--vcp-c-brand);
|
|
60
|
+
color: #fff;
|
|
61
|
+
|
|
62
|
+
svg {
|
|
63
|
+
color: #fff;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[command-linear-shortcuts] {
|
|
67
|
+
display: flex;
|
|
68
|
+
margin-left: auto;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
|
|
71
|
+
kbd {
|
|
72
|
+
font-family: var(--font-sans);
|
|
73
|
+
font-size: 13px;
|
|
74
|
+
color: var(--gray11);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// &[aria-disabled='true'] {
|
|
80
|
+
// color: var(--gray8);
|
|
81
|
+
// cursor: not-allowed;
|
|
82
|
+
// }
|
|
83
|
+
|
|
84
|
+
&:active {
|
|
85
|
+
transition-property: background;
|
|
86
|
+
background: var(--gray4);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
svg {
|
|
90
|
+
width: 16px;
|
|
91
|
+
height: 16px;
|
|
92
|
+
color: var(--gray10);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[command-empty=''] {
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
height: 64px;
|
|
102
|
+
white-space: pre-wrap;
|
|
103
|
+
color: var(--gray11);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[command-dialog-mask] {
|
|
107
|
+
background-color: rgba(75, 75, 75, 0.8);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
[command-dialog-header] {
|
|
111
|
+
padding: 12px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
[command-dialog-body] {
|
|
115
|
+
padding: 0 12px 12px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
[command-dialog-footer] {
|
|
119
|
+
align-items: center;
|
|
120
|
+
border-radius: 0 0 8px 8px;
|
|
121
|
+
box-shadow: 0 -1px 0 0 #e0e3e8, 0 -3px 6px 0 rgba(69, 98, 155, 0.12);
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-direction: row-reverse;
|
|
124
|
+
flex-shrink: 0;
|
|
125
|
+
height: 44px;
|
|
126
|
+
justify-content: space-between;
|
|
127
|
+
padding: 0 12px;
|
|
128
|
+
position: relative;
|
|
129
|
+
user-select: none;
|
|
130
|
+
width: 100%;
|
|
131
|
+
z-index: 300;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[command-group-heading] {
|
|
135
|
+
color: var(--vcp-c-brand);
|
|
136
|
+
font-size: 0.85em;
|
|
137
|
+
font-weight: 600;
|
|
138
|
+
line-height: 32px;
|
|
139
|
+
margin: 0 -4px;
|
|
140
|
+
padding: 8px 4px 0;
|
|
141
|
+
top: 0;
|
|
142
|
+
z-index: 10;
|
|
143
|
+
width: 100%;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.command-palette-commands {
|
|
147
|
+
color: var(--docsearch-muted-color);
|
|
148
|
+
display: flex;
|
|
149
|
+
list-style: none;
|
|
150
|
+
margin: 0;
|
|
151
|
+
padding: 0;
|
|
152
|
+
|
|
153
|
+
li {
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
}
|
|
157
|
+
li:not(:last-of-type) {
|
|
158
|
+
margin-right: 0.8em;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.command-palette-logo {
|
|
163
|
+
a {
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
gap: 8px;
|
|
167
|
+
}
|
|
168
|
+
svg {
|
|
169
|
+
height: 24px;
|
|
170
|
+
width: 24px;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.command-palette-commands-key {
|
|
175
|
+
align-items: center;
|
|
176
|
+
background: var(--gray3);
|
|
177
|
+
border-radius: 2px;
|
|
178
|
+
display: flex;
|
|
179
|
+
height: 18px;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
margin-right: 0.4em;
|
|
182
|
+
padding: 0 0 1px;
|
|
183
|
+
color: var(--gray11);
|
|
184
|
+
border: 0;
|
|
185
|
+
width: 20px;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.dark .algolia [command-dialog-footer] {
|
|
190
|
+
box-shadow: none;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// transition for command-dialog
|
|
194
|
+
// .command-dialog-enter-active,
|
|
195
|
+
// .command-dialog-leave-active {
|
|
196
|
+
// transition: opacity 0.2s ease-in-out;
|
|
197
|
+
// }
|
|
198
|
+
|
|
199
|
+
// .command-dialog-enter-from,
|
|
200
|
+
// .command-dialog-leave-to {
|
|
201
|
+
// opacity: 0;
|
|
202
|
+
// }
|
|
203
|
+
|
|
204
|
+
// .command-dialog-enter-active {
|
|
205
|
+
// transition-duration: 0.5s;
|
|
206
|
+
// }
|
|
207
|
+
|
|
208
|
+
// // transition for command-dialog-wrapper
|
|
209
|
+
// .command-dialog-enter-active [command-dialog-wrapper] {
|
|
210
|
+
// // transition-delay: 0.2s;
|
|
211
|
+
// }
|
|
212
|
+
|
|
213
|
+
// .command-dialog-enter-from [command-dialog-wrapper],
|
|
214
|
+
// .command-dialog-leave-to [command-dialog-wrapper] {
|
|
215
|
+
// // opacity: 0;
|
|
216
|
+
// transform: translateY(10px) scale(0.95);
|
|
217
|
+
// }
|
|
218
|
+
|
|
219
|
+
// .command-dialog-enter-active [command-dialog-wrapper] {
|
|
220
|
+
// transition: transform ease-out 0.3s;
|
|
221
|
+
// }
|
|
222
|
+
|
|
223
|
+
// .command-dialog-enter-to [command-dialog-wrapper],
|
|
224
|
+
// .command-dialog-leave-from [command-dialog-wrapper] {
|
|
225
|
+
// opacity: 1;
|
|
226
|
+
// transform: translateY(0) scale(1);
|
|
227
|
+
// }
|
|
228
|
+
|
|
229
|
+
// .command-dialog-leave-active [command-dialog-wrapper] {
|
|
230
|
+
// transition: transfrom ease-in 0.2s;
|
|
231
|
+
// }
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
@import 'highlight.scss';
|
|
2
|
+
|
|
3
|
+
html,
|
|
4
|
+
body,
|
|
5
|
+
#app {
|
|
6
|
+
height: 100%;
|
|
7
|
+
}
|
|
8
|
+
body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
ul {
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:root {
|
|
19
|
+
--font-sans: 'Inter', --apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
|
|
20
|
+
Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
|
|
21
|
+
--app-bg: var(--gray1);
|
|
22
|
+
--app-text: #000000;
|
|
23
|
+
--command-shadow: 0 16px 70px rgb(0 0 0 / 20%);
|
|
24
|
+
|
|
25
|
+
--lowContrast: #ffffff;
|
|
26
|
+
--highContrast: #000000;
|
|
27
|
+
--vcp-c-brand: #44bd87;
|
|
28
|
+
--vcp-c-accent: #35495e;
|
|
29
|
+
|
|
30
|
+
--gray1: hsl(0, 0%, 98%);
|
|
31
|
+
--gray2: hsl(0, 0%, 97.3%);
|
|
32
|
+
--gray3: hsl(0, 0%, 95.1%);
|
|
33
|
+
--gray4: hsl(0, 0%, 93%);
|
|
34
|
+
--gray5: hsl(0, 0%, 90.9%);
|
|
35
|
+
--gray6: hsl(0, 0%, 88.7%);
|
|
36
|
+
--gray7: hsl(0, 0%, 85.8%);
|
|
37
|
+
--gray8: hsl(0, 0%, 78%);
|
|
38
|
+
--gray9: hsl(0, 0%, 56.1%);
|
|
39
|
+
--gray10: hsl(0, 0%, 52.3%);
|
|
40
|
+
--gray11: hsl(0, 0%, 43.5%);
|
|
41
|
+
--gray12: hsl(0, 0%, 9%);
|
|
42
|
+
|
|
43
|
+
--grayA1: hsla(0, 0%, 0%, 0.012);
|
|
44
|
+
--grayA2: hsla(0, 0%, 0%, 0.027);
|
|
45
|
+
--grayA3: hsla(0, 0%, 0%, 0.047);
|
|
46
|
+
--grayA4: hsla(0, 0%, 0%, 0.071);
|
|
47
|
+
--grayA5: hsla(0, 0%, 0%, 0.09);
|
|
48
|
+
--grayA6: hsla(0, 0%, 0%, 0.114);
|
|
49
|
+
--grayA7: hsla(0, 0%, 0%, 0.141);
|
|
50
|
+
--grayA8: hsla(0, 0%, 0%, 0.22);
|
|
51
|
+
--grayA9: hsla(0, 0%, 0%, 0.439);
|
|
52
|
+
--grayA10: hsla(0, 0%, 0%, 0.478);
|
|
53
|
+
--grayA11: hsla(0, 0%, 0%, 0.565);
|
|
54
|
+
--grayA12: hsla(0, 0%, 0%, 0.91);
|
|
55
|
+
|
|
56
|
+
--blue1: hsl(206, 100%, 99.2%);
|
|
57
|
+
--blue2: hsl(210, 100%, 98%);
|
|
58
|
+
--blue3: hsl(209, 100%, 96.5%);
|
|
59
|
+
--blue4: hsl(210, 98.8%, 94%);
|
|
60
|
+
--blue5: hsl(209, 95%, 90.1%);
|
|
61
|
+
--blue6: hsl(209, 81.2%, 84.5%);
|
|
62
|
+
--blue7: hsl(208, 77.5%, 76.9%);
|
|
63
|
+
--blue8: hsl(206, 81.9%, 65.3%);
|
|
64
|
+
--blue9: hsl(206, 100%, 50%);
|
|
65
|
+
--blue10: hsl(208, 100%, 47.3%);
|
|
66
|
+
--blue11: hsl(211, 100%, 43.2%);
|
|
67
|
+
--blue12: hsl(211, 100%, 15%);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.dark {
|
|
71
|
+
--app-bg: var(--gray1);
|
|
72
|
+
--app-text: #ffffff;
|
|
73
|
+
|
|
74
|
+
--lowContrast: #000000;
|
|
75
|
+
--highContrast: #ffffff;
|
|
76
|
+
|
|
77
|
+
--gray1: hsl(0, 0%, 8.5%);
|
|
78
|
+
--gray2: hsl(0, 0%, 11%);
|
|
79
|
+
--gray3: hsl(0, 0%, 13.6%);
|
|
80
|
+
--gray4: hsl(0, 0%, 15.8%);
|
|
81
|
+
--gray5: hsl(0, 0%, 17.9%);
|
|
82
|
+
--gray6: hsl(0, 0%, 20.5%);
|
|
83
|
+
--gray7: hsl(0, 0%, 24.3%);
|
|
84
|
+
--gray8: hsl(0, 0%, 31.2%);
|
|
85
|
+
--gray9: hsl(0, 0%, 43.9%);
|
|
86
|
+
--gray10: hsl(0, 0%, 49.4%);
|
|
87
|
+
--gray11: hsl(0, 0%, 62.8%);
|
|
88
|
+
--gray12: hsl(0, 0%, 93%);
|
|
89
|
+
|
|
90
|
+
--grayA1: hsla(0, 0%, 100%, 0);
|
|
91
|
+
--grayA2: hsla(0, 0%, 100%, 0.026);
|
|
92
|
+
--grayA3: hsla(0, 0%, 100%, 0.056);
|
|
93
|
+
--grayA4: hsla(0, 0%, 100%, 0.077);
|
|
94
|
+
--grayA5: hsla(0, 0%, 100%, 0.103);
|
|
95
|
+
--grayA6: hsla(0, 0%, 100%, 0.129);
|
|
96
|
+
--grayA7: hsla(0, 0%, 100%, 0.172);
|
|
97
|
+
--grayA8: hsla(0, 0%, 100%, 0.249);
|
|
98
|
+
--grayA9: hsla(0, 0%, 100%, 0.386);
|
|
99
|
+
--grayA10: hsla(0, 0%, 100%, 0.446);
|
|
100
|
+
--grayA11: hsla(0, 0%, 100%, 0.592);
|
|
101
|
+
--grayA12: hsla(0, 0%, 100%, 0.923);
|
|
102
|
+
|
|
103
|
+
--blue1: hsl(212, 35%, 9.2%);
|
|
104
|
+
--blue2: hsl(216, 50%, 11.8%);
|
|
105
|
+
--blue3: hsl(214, 59.4%, 15.3%);
|
|
106
|
+
--blue4: hsl(214, 65.8%, 17.9%);
|
|
107
|
+
--blue5: hsl(213, 71.2%, 20.2%);
|
|
108
|
+
--blue6: hsl(212, 77.4%, 23.1%);
|
|
109
|
+
--blue7: hsl(211, 85.1%, 27.4%);
|
|
110
|
+
--blue8: hsl(211, 89.7%, 34.1%);
|
|
111
|
+
--blue9: hsl(206, 100%, 50%);
|
|
112
|
+
--blue10: hsl(209, 100%, 60.6%);
|
|
113
|
+
--blue11: hsl(210, 100%, 66.1%);
|
|
114
|
+
--blue12: hsl(206, 98%, 95.8%);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
body {
|
|
118
|
+
background: var(--app-bg);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
div [command-dialog-mask] {
|
|
122
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
123
|
+
height: 100vh;
|
|
124
|
+
left: 0;
|
|
125
|
+
position: fixed;
|
|
126
|
+
top: 0;
|
|
127
|
+
width: 100vw;
|
|
128
|
+
z-index: 200;
|
|
129
|
+
// animation: 333ms cubic-bezier(0.16, 1, 0.3, 1) 0s 1 normal none running shown;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
div [command-dialog-wrapper] {
|
|
133
|
+
position: relative;
|
|
134
|
+
background: var(--gray2);
|
|
135
|
+
border-radius: 6px;
|
|
136
|
+
box-shadow: none;
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
margin: 20vh auto auto;
|
|
139
|
+
max-width: 560px;
|
|
140
|
+
// animation: 333ms cubic-bezier(0.16, 1, 0.3, 1) 0s 1 normal none running shown;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
div [command-dialog-footer] {
|
|
144
|
+
border-top: 1px solid var(--gray6);
|
|
145
|
+
align-items: center;
|
|
146
|
+
background: var(--gray4);
|
|
147
|
+
color: var(--gray11);
|
|
148
|
+
border-radius: 0 0 8px 8px;
|
|
149
|
+
box-shadow: none;
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: row-reverse;
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
height: 44px;
|
|
154
|
+
justify-content: space-between;
|
|
155
|
+
padding: 0 12px;
|
|
156
|
+
position: relative;
|
|
157
|
+
user-select: none;
|
|
158
|
+
width: 100%;
|
|
159
|
+
z-index: 300;
|
|
160
|
+
font-size: 12px;
|
|
161
|
+
}
|