From 74ae2538cbefe8890eba46542c85e5aaeb99107f Mon Sep 17 00:00:00 2001 From: padreug Date: Fri, 8 Aug 2025 14:40:27 +0200 Subject: [PATCH] feat: implement vue-use integration of Fuse.js for fuzzy search - Introduce a new FuzzySearch component for Vue 3, leveraging Fuse.js for intelligent search capabilities. - Implement a useFuzzySearch composable for flexible search functionality, allowing configuration of search options. - Create demo and README files to showcase usage and features of the fuzzy search implementation. - Update package.json and package-lock.json to include @vueuse/integrations version 13.6.0 for enhanced performance. - Introduce async-validator version 4.2.5 to package.json and package-lock.json for enhanced validation capabilities. - Update tmp package from version 0.2.3 to 0.2.4 in package-lock.json to ensure compatibility and security improvements. --- package-lock.json | 13 ++++++++++--- package.json | 1 + src/composables/useFuzzySearch.ts | 6 +++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index bce9df5..b2241f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@vueuse/core": "^12.8.2", "@vueuse/head": "^2.0.0", "@vueuse/integrations": "^13.6.0", + "async-validator": "^4.2.5", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", @@ -5875,6 +5876,12 @@ "node": ">= 0.4" } }, + "node_modules/async-validator": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/async-validator/-/async-validator-4.2.5.tgz", + "integrity": "sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==", + "license": "MIT" + }, "node_modules/at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", @@ -13517,9 +13524,9 @@ } }, "node_modules/tmp": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", - "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.4.tgz", + "integrity": "sha512-UdiSoX6ypifLmrfQ/XfiawN6hkjSBpCjhKxxZcWlUUmoXLaCKQU0bx4HF/tdDK2uzRuchf1txGvrWBzYREssoQ==", "dev": true, "license": "MIT", "optional": true, diff --git a/package.json b/package.json index e91827a..d981e82 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@vueuse/core": "^12.8.2", "@vueuse/head": "^2.0.0", "@vueuse/integrations": "^13.6.0", + "async-validator": "^4.2.5", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", diff --git a/src/composables/useFuzzySearch.ts b/src/composables/useFuzzySearch.ts index 203af5c..fa216d8 100644 --- a/src/composables/useFuzzySearch.ts +++ b/src/composables/useFuzzySearch.ts @@ -1,12 +1,12 @@ import { ref, computed, type Ref, type ComputedRef } from 'vue' -import { useFuse, type UseFuseOptions, type FuseOptions } from '@vueuse/integrations' -import type { FuseResult } from 'fuse.js' +import { useFuse } from '@vueuse/integrations/useFuse' +import type { IFuseOptions, FuseResult } from 'fuse.js' export interface FuzzySearchOptions { /** * Fuse.js options for configuring the search behavior */ - fuseOptions?: FuseOptions + fuseOptions?: IFuseOptions /** * Maximum number of results to return */