@unocss/autocomplete 0.60.2 → 0.60.4

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.
Files changed (2) hide show
  1. package/dist/index.mjs +7 -4
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -47,8 +47,8 @@ function searchUsageBoundary(line, index, attributify = true) {
47
47
  }
48
48
  function searchAttrKey(content, cursor) {
49
49
  const text = content.substring(0, cursor);
50
- if (/(<\w+\s*)[^>]*$/.test(text))
51
- return text.match(/\S+(?=\s*=\s*["']?[^"']*$)/)?.[0];
50
+ if (/<\w[^>]*$/.test(text))
51
+ return text.match(/\S+(?=\s*=(?:\s*["'])?[^"']*$)/)?.[0];
52
52
  }
53
53
  function cartesian(arr) {
54
54
  return arr.reduce(
@@ -104,7 +104,7 @@ function parseAutocomplete(template, theme = {}, extraShorthands = {}) {
104
104
  function handleNonGroup(input) {
105
105
  handleRegexMatch(
106
106
  input,
107
- /\$([\w\.\|]+)/g,
107
+ /\$([\w.|]+)/g,
108
108
  (m) => {
109
109
  parts.push({
110
110
  type: "theme",
@@ -283,7 +283,10 @@ function createAutocomplete(uno, options = {}) {
283
283
  return [];
284
284
  if (cache.has(input))
285
285
  return cache.get(input);
286
- const [, processed, , variants] = await uno.matchVariants(input);
286
+ const attributify = uno.config.presets.find((i) => i.name === "@unocss/preset-attributify");
287
+ const attributifyPrefix = attributify?.options?.prefix;
288
+ const _input = attributifyPrefix ? input.startsWith(attributifyPrefix) ? input.slice(attributifyPrefix.length) : input.replace(`:${attributifyPrefix}`, ":") : input;
289
+ const [, processed, , variants] = await uno.matchVariants(_input);
287
290
  let idx = processed ? input.search(escapeRegExp(processed)) : input.length;
288
291
  if (idx === -1)
289
292
  idx = 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/autocomplete",
3
3
  "type": "module",
4
- "version": "0.60.2",
4
+ "version": "0.60.4",
5
5
  "description": "Autocomplete utils for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "lru-cache": "^10.2.2"
38
38
  },
39
39
  "devDependencies": {
40
- "@unocss/core": "0.60.2"
40
+ "@unocss/core": "0.60.4"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "unbuild",