@unocss/autocomplete 0.31.15 → 0.32.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
@@ -151,8 +151,20 @@ function createAutocomplete(uno) {
151
151
  suggestInFile,
152
152
  templates,
153
153
  cache,
154
- reset
154
+ reset,
155
+ enumerate
155
156
  };
157
+ async function enumerate() {
158
+ const matched = /* @__PURE__ */ new Set();
159
+ const a2z = Array.from("abcdefghijklmnopqrstuvwxyz");
160
+ const a2zd = [...a2z, "-"];
161
+ const keys = a2z.flatMap((i) => [
162
+ i,
163
+ ...a2zd.map((j) => `${i}${j}`)
164
+ ]);
165
+ await Promise.all(keys.map((key) => suggest(key).then((i) => i.forEach((j) => matched.add(j)))));
166
+ return matched;
167
+ }
156
168
  function getParsed(template) {
157
169
  if (!templateCache.has(template))
158
170
  templateCache.set(template, parseAutocomplete(template, uno.config.theme));
package/dist/index.d.ts CHANGED
@@ -7,6 +7,10 @@ declare function createAutocomplete(uno: UnoGenerator): {
7
7
  templates: (string | AutoCompleteFunction)[];
8
8
  cache: LRU<string, string[]>;
9
9
  reset: () => void;
10
+ /**
11
+ * Enumerate possible suggestions from 'aa' - 'zz'
12
+ */
13
+ enumerate: () => Promise<Set<string>>;
10
14
  };
11
15
 
12
16
  declare type AutocompleteTemplatePart = AutocompleteTemplateStatic | AutocompleteTemplateGroup | AutocompleteTemplateTheme;
package/dist/index.mjs CHANGED
@@ -143,8 +143,20 @@ function createAutocomplete(uno) {
143
143
  suggestInFile,
144
144
  templates,
145
145
  cache,
146
- reset
146
+ reset,
147
+ enumerate
147
148
  };
149
+ async function enumerate() {
150
+ const matched = /* @__PURE__ */ new Set();
151
+ const a2z = Array.from("abcdefghijklmnopqrstuvwxyz");
152
+ const a2zd = [...a2z, "-"];
153
+ const keys = a2z.flatMap((i) => [
154
+ i,
155
+ ...a2zd.map((j) => `${i}${j}`)
156
+ ]);
157
+ await Promise.all(keys.map((key) => suggest(key).then((i) => i.forEach((j) => matched.add(j)))));
158
+ return matched;
159
+ }
148
160
  function getParsed(template) {
149
161
  if (!templateCache.has(template))
150
162
  templateCache.set(template, parseAutocomplete(template, uno.config.theme));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/autocomplete",
3
- "version": "0.31.15",
3
+ "version": "0.32.0",
4
4
  "description": "Autocomplete utils for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/lru-cache": "^7.6.1",
39
- "@unocss/core": "0.31.15"
39
+ "@unocss/core": "0.32.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",