@unocss/autocomplete 0.57.7 → 0.58.0

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
@@ -20,7 +20,7 @@ function searchUsageBoundary(line, index) {
20
20
  }
21
21
  function searchAttrKey(content, cursor) {
22
22
  const text = content.substring(0, cursor);
23
- if (text.match(/(<\w+\s*)[^>]*$/) !== null)
23
+ if (/(<\w+\s*)[^>]*$/.test(text))
24
24
  return text.match(/\S+(?=\s*=\s*["']?[^"']*$)/)?.[0];
25
25
  }
26
26
  function cartesian(arr) {
@@ -232,7 +232,7 @@ function createAutocomplete(uno, options = {}) {
232
232
  keys.map((key) => suggest(key).then((i) => i.forEach((j) => matched.add(j))))
233
233
  );
234
234
  await Promise.all(
235
- [...matched].filter((i) => i.match(/^\w+$/) && i.length > 3).map((i) => suggest(`${i}-`).then((i2) => i2.forEach((j) => matched.add(j))))
235
+ [...matched].filter((i) => /^\w+$/.test(i) && i.length > 3).map((i) => suggest(`${i}-`).then((i2) => i2.forEach((j) => matched.add(j))))
236
236
  );
237
237
  return matched;
238
238
  }
@@ -338,7 +338,7 @@ function createAutocomplete(uno, options = {}) {
338
338
  );
339
339
  }
340
340
  function processSuggestions(suggestions, prefix = "", suffix = "") {
341
- return core.uniq(suggestions.flat()).filter((i) => !!(i && !i.match(/-$/) && !uno.isBlocked(i))).sort((a, b) => {
341
+ return core.uniq(suggestions.flat()).filter((i) => !!(i && !i.endsWith("-") && !uno.isBlocked(i))).sort((a, b) => {
342
342
  if (/\d/.test(a) && /\D/.test(b))
343
343
  return 1;
344
344
  if (/\D/.test(a) && /\d/.test(b))
package/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ function searchUsageBoundary(line, index) {
18
18
  }
19
19
  function searchAttrKey(content, cursor) {
20
20
  const text = content.substring(0, cursor);
21
- if (text.match(/(<\w+\s*)[^>]*$/) !== null)
21
+ if (/(<\w+\s*)[^>]*$/.test(text))
22
22
  return text.match(/\S+(?=\s*=\s*["']?[^"']*$)/)?.[0];
23
23
  }
24
24
  function cartesian(arr) {
@@ -230,7 +230,7 @@ function createAutocomplete(uno, options = {}) {
230
230
  keys.map((key) => suggest(key).then((i) => i.forEach((j) => matched.add(j))))
231
231
  );
232
232
  await Promise.all(
233
- [...matched].filter((i) => i.match(/^\w+$/) && i.length > 3).map((i) => suggest(`${i}-`).then((i2) => i2.forEach((j) => matched.add(j))))
233
+ [...matched].filter((i) => /^\w+$/.test(i) && i.length > 3).map((i) => suggest(`${i}-`).then((i2) => i2.forEach((j) => matched.add(j))))
234
234
  );
235
235
  return matched;
236
236
  }
@@ -336,7 +336,7 @@ function createAutocomplete(uno, options = {}) {
336
336
  );
337
337
  }
338
338
  function processSuggestions(suggestions, prefix = "", suffix = "") {
339
- return uniq(suggestions.flat()).filter((i) => !!(i && !i.match(/-$/) && !uno.isBlocked(i))).sort((a, b) => {
339
+ return uniq(suggestions.flat()).filter((i) => !!(i && !i.endsWith("-") && !uno.isBlocked(i))).sort((a, b) => {
340
340
  if (/\d/.test(a) && /\D/.test(b))
341
341
  return 1;
342
342
  if (/\D/.test(a) && /\d/.test(b))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/autocomplete",
3
- "version": "0.57.7",
3
+ "version": "0.58.0",
4
4
  "description": "Autocomplete utils for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -34,10 +34,10 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "fzf": "^0.5.2",
37
- "lru-cache": "^10.0.2"
37
+ "lru-cache": "^10.1.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@unocss/core": "0.57.7"
40
+ "@unocss/core": "0.58.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "unbuild",