@unocss/autocomplete 0.65.1 → 0.65.3

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 +15 -6
  2. package/package.json +4 -3
package/dist/index.mjs CHANGED
@@ -6,10 +6,8 @@ function searchUsageBoundary(line, index, attributify = true) {
6
6
  let start = index;
7
7
  let end = index;
8
8
  const regex = /[^\s>"'`;]/;
9
- while (start && regex.test(line.charAt(start - 1)))
10
- --start;
11
- while (end < line.length && regex.test(line.charAt(end)))
12
- ++end;
9
+ while (start && regex.test(line.charAt(start - 1))) --start;
10
+ while (end < line.length && regex.test(line.charAt(end))) ++end;
13
11
  if (attributify) {
14
12
  return {
15
13
  content: line.slice(start, end),
@@ -20,7 +18,18 @@ function searchUsageBoundary(line, index, attributify = true) {
20
18
  let temp = start - 1;
21
19
  const matchClassText = "class";
22
20
  const matchClassNameText = "className";
23
- while (temp > matchClassText.length && !/[="'{}><]/.test(line[temp--])) {
21
+ const applyText = "@apply";
22
+ while (temp > matchClassText.length && !/[="'{}><@;]/.test(line[temp--])) {
23
+ }
24
+ if (line[temp + 1] === "@") {
25
+ const data = line.slice(temp + 1, temp + applyText.length + 1);
26
+ if (data === applyText) {
27
+ return {
28
+ content: line.slice(start, end),
29
+ start,
30
+ end
31
+ };
32
+ }
24
33
  }
25
34
  if (line[temp] !== "=")
26
35
  return;
@@ -366,7 +375,7 @@ function createAutocomplete(_uno, options = {}) {
366
375
  return staticUtils.filter((i) => i.startsWith(input));
367
376
  }
368
377
  async function suggestUnoCache(input) {
369
- const keys = Array.from(uno._cache.entries());
378
+ const keys = Array.from(uno.cache.entries());
370
379
  return keys.filter((i) => i[1] && i[0].startsWith(input)).map((i) => i[0]);
371
380
  }
372
381
  function suggestFromPreset(input) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/autocomplete",
3
3
  "type": "module",
4
- "version": "0.65.1",
4
+ "version": "0.65.3",
5
5
  "description": "Autocomplete utils for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -37,10 +37,11 @@
37
37
  "lru-cache": "^10.4.3"
38
38
  },
39
39
  "devDependencies": {
40
- "@unocss/core": "0.65.1"
40
+ "@unocss/core": "0.65.3"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "unbuild",
44
- "stub": "unbuild --stub"
44
+ "stub": "unbuild --stub",
45
+ "test:attw": "attw --pack --config-path ../../.attw-esm-only.json"
45
46
  }
46
47
  }