Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit 9d80bf0

Browse files
committed
chore: search by useFuse
1 parent 04af532 commit 9d80bf0

File tree

8 files changed

+17
-12
lines changed

8 files changed

+17
-12
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"play": "nr -C playground dev",
5050
"stub": "unbuild --stub",
5151
"lint": "eslint .",
52+
"lint:fix": "eslint --fix .",
5253
"prepublishOnly": "npm run build",
5354
"release": "bumpp && npm publish",
5455
"dep:up": "taze -I major"

src/client/components/AssetPreview.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ defineProps<{
1919
/>
2020
<div v-else-if="asset.type === 'text' && !textContent" i-carbon-document text-3xl op20 />
2121
<div v-else-if="asset.type === 'text' && textContent" w-full self-start p4>
22-
<pre max-h-10rem of-hidden font-mono text-xs v-text="textContent" />
22+
<pre max-h-10rem of-hidden text-xs font-mono v-text="textContent" />
2323
</div>
2424
<div v-else i-carbon-help text-3xl op20 />
2525
</div>

src/client/components/RoutePathItem.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function navigate() {
4848
<div px2 text-sm op50>
4949
Fill params and navigate:
5050
</div>
51-
<div flex="~" items-center p2 font-mono text-sm>
51+
<div flex="~" items-center p2 text-sm font-mono>
5252
<template v-for="part, idx of parts" :key="idx">
5353
<VTextInput
5454
v-if="part[0] === ':'"

src/client/components/RoutesTable.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const sorted = computed(() => {
5757
/>
5858
</div>
5959
</td>
60-
<td w-30 ws-nowrap pr-1 text-left font-mono text-sm op50>
60+
<td w-30 ws-nowrap pr-1 text-left text-sm font-mono op50>
6161
{{ item.name ?? '-' }}
6262
</td>
6363
</tr>

src/client/pages/documentations.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup lang="ts">
2+
import { useFuse } from '@vueuse/integrations/useFuse'
23
import { rpc } from '../logic/rpc'
34
import type { DocumentInfo } from '../../types'
45
import { data } from '../logic/documentations'
@@ -21,9 +22,12 @@ function navigate(data: DocumentInfo) {
2122
}
2223
2324
const keywords = ref('')
25+
const { results: filterDocuments } = useFuse(keywords, rawItems.map(i => i.name), {
26+
matchAllWhenSearchEmpty: true,
27+
})
2428
25-
watch(keywords, () => {
26-
items.value = rawItems.filter(item => packagesName.includes(item.id) && (item.id.includes(keywords.value) || keywords.value.length === 0))
29+
watch(filterDocuments, () => {
30+
items.value = rawItems.filter(item => (filterDocuments.value.map(i => i.item).includes(item.name) && packagesName.includes(item.id)))
2731
})
2832
2933
function back() {

src/client/pages/npm.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ useInfiniteScroll(
225225
</td>
226226
<VDropdown max-w="10" placement="bottom-start" :distance="5">
227227
<td
228-
hover="text-primary" h-7 cursor-pointer ws-nowrap pr-1 text-left font-mono text-sm lh-7 underline
229-
op70
228+
hover="text-primary"
229+
h-7 cursor-pointer ws-nowrap pr-1 text-left text-sm lh-7 font-mono underline op70
230230
>
231231
{{ item.activeVersion ?? item.version }}
232232
</td>
@@ -243,12 +243,12 @@ useInfiniteScroll(
243243
</ul>
244244
</template>
245245
</VDropdown>
246-
<td w-30 ws-nowrap pr-1 text-left font-mono text-sm underline op70 hover="text-primary">
246+
<td w-30 ws-nowrap pr-1 text-left text-sm font-mono underline op70 hover="text-primary">
247247
<a :href="item?.owner?.link" target="_blank">
248248
{{ item?.owner?.name ?? '-' }}
249249
</a>
250250
</td>
251-
<td w-30 ws-nowrap pr-1 text-left font-mono text-sm op70>
251+
<td w-30 ws-nowrap pr-1 text-left text-sm font-mono op70>
252252
{{ item.humanDownloadsLast30Days }}
253253
</td>
254254
<td w-30 text-center>

src/client/pages/settings.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const showTabGroup = ref(false)
113113
<div>
114114
<VDarkToggle v-slot="{ toggle, isDark }">
115115
<VButton n="primary" @click="toggle">
116-
<div carbon-sun dark:carbon-moon translate-y--1px /> {{ isDark.value ? 'Dark' : 'Light' }}
116+
<div carbon-sun translate-y--1px dark:carbon-moon /> {{ isDark.value ? 'Dark' : 'Light' }}
117117
</VButton>
118118
</VDarkToggle>
119119
</div>

src/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ export interface DocumentInfo {
105105
website: string
106106
github: string
107107
icon: string
108-
tips: string
109-
openInBlank: boolean
108+
tips?: string
109+
openInBlank?: boolean
110110
}
111111

112112
export interface PackageInfo {

0 commit comments

Comments
 (0)