mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-31 12:17:54 +01:00
chore(CommandPalette): improve fuse.js import types .ts file
This commit is contained in:
@@ -74,7 +74,7 @@ import { computed, defineComponent } from 'vue'
|
|||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { ComboboxOption as HComboboxOption, provideUseId } from '@headlessui/vue'
|
import { ComboboxOption as HComboboxOption, provideUseId } from '@headlessui/vue'
|
||||||
import { UIcon, UAvatar, UKbd } from '#components'
|
import { UIcon, UAvatar, UKbd } from '#components'
|
||||||
import type { Group } from '../../types'
|
import type { Command, Group } from '../../types'
|
||||||
import { commandPalette } from '#ui/ui.config'
|
import { commandPalette } from '#ui/ui.config'
|
||||||
import { useId } from '#imports'
|
import { useId } from '#imports'
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ export default defineComponent({
|
|||||||
return typeof label === 'function' ? label(props.query) : label
|
return typeof label === 'function' ? label(props.query) : label
|
||||||
})
|
})
|
||||||
|
|
||||||
function highlight (text: string, { indices, value }: { indices: number[][], value: string }): string {
|
function highlight (text: string, { indices, value }: Command['matches'][number]): string {
|
||||||
if (text === value) {
|
if (text === value) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { FuseSortFunctionMatch, FuseSortFunctionMatchList } from 'fuse.js'
|
import Fuse from 'fuse.js'
|
||||||
import type { Avatar } from './avatar'
|
import type { Avatar } from './avatar'
|
||||||
|
|
||||||
export interface Command {
|
export interface Command {
|
||||||
@@ -13,7 +13,7 @@ export interface Command {
|
|||||||
shortcuts?: string[]
|
shortcuts?: string[]
|
||||||
group?: string
|
group?: string
|
||||||
score?: number
|
score?: number
|
||||||
matches?: (FuseSortFunctionMatch | FuseSortFunctionMatchList)[]
|
matches?: Fuse.FuseResultMatch[]
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user