@unocss/autocomplete 0.53.4 → 0.53.6

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/dist/index.cjs CHANGED
@@ -113,7 +113,7 @@ function parseAutocomplete(template, theme = {}) {
113
113
  );
114
114
  }
115
115
  function suggest(input, matchType = "prefix") {
116
- if (input.length && matchType === "fuzzy")
116
+ if (input.length > 1 && matchType === "fuzzy")
117
117
  return fzf$1.find(input).map((i) => i.item);
118
118
  let rest = input;
119
119
  let matched = "";
@@ -339,8 +339,8 @@ function createAutocomplete(uno, options = {}) {
339
339
  }
340
340
  function processSuggestions(suggestions, prefix = "", suffix = "") {
341
341
  return core.uniq(suggestions.flat()).filter((i) => !!(i && !i.match(/-$/) && !uno.isBlocked(i))).sort((a, b) => {
342
- const numA = +(a.match(/\d+$/)?.[0] || NaN);
343
- const numB = +(b.match(/\d+$/)?.[0] || NaN);
342
+ const numA = +(a.match(/\d+$/)?.[0] || Number.NaN);
343
+ const numB = +(b.match(/\d+$/)?.[0] || Number.NaN);
344
344
  if (!Number.isNaN(numA) && !Number.isNaN(numB))
345
345
  return numA - numB;
346
346
  return a.localeCompare(b);
package/dist/index.mjs CHANGED
@@ -109,7 +109,7 @@ function parseAutocomplete(template, theme = {}) {
109
109
  );
110
110
  }
111
111
  function suggest(input, matchType = "prefix") {
112
- if (input.length && matchType === "fuzzy")
112
+ if (input.length > 1 && matchType === "fuzzy")
113
113
  return fzf.find(input).map((i) => i.item);
114
114
  let rest = input;
115
115
  let matched = "";
@@ -335,8 +335,8 @@ function createAutocomplete(uno, options = {}) {
335
335
  }
336
336
  function processSuggestions(suggestions, prefix = "", suffix = "") {
337
337
  return uniq(suggestions.flat()).filter((i) => !!(i && !i.match(/-$/) && !uno.isBlocked(i))).sort((a, b) => {
338
- const numA = +(a.match(/\d+$/)?.[0] || NaN);
339
- const numB = +(b.match(/\d+$/)?.[0] || NaN);
338
+ const numA = +(a.match(/\d+$/)?.[0] || Number.NaN);
339
+ const numB = +(b.match(/\d+$/)?.[0] || Number.NaN);
340
340
  if (!Number.isNaN(numA) && !Number.isNaN(numB))
341
341
  return numA - numB;
342
342
  return a.localeCompare(b);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/autocomplete",
3
- "version": "0.53.4",
3
+ "version": "0.53.6",
4
4
  "description": "Autocomplete utils for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "lru-cache": "^10.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@unocss/core": "0.53.4"
40
+ "@unocss/core": "0.53.6"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "unbuild",