@unocss/autocomplete 66.7.0 → 66.7.1
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.mjs +7 -6
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -267,6 +267,10 @@ function createAutocomplete(uno, options = {}) {
|
|
|
267
267
|
const templateCache = /* @__PURE__ */ new Map();
|
|
268
268
|
const cache = new LRUCache({ max: 5e3 });
|
|
269
269
|
const errorCache = /* @__PURE__ */ new Map();
|
|
270
|
+
const collator = new Intl.Collator(void 0, {
|
|
271
|
+
numeric: true,
|
|
272
|
+
sensitivity: "base"
|
|
273
|
+
});
|
|
270
274
|
let staticUtils = [];
|
|
271
275
|
const templates = [];
|
|
272
276
|
const { matchType = "prefix", throwErrors = true } = options;
|
|
@@ -380,12 +384,9 @@ function createAutocomplete(uno, options = {}) {
|
|
|
380
384
|
}
|
|
381
385
|
function processSuggestions(suggestions, prefix = "", suffix = "") {
|
|
382
386
|
return uniq(suggestions.flat()).filter((i) => !!(i && !i.endsWith("-") && !uno.isBlocked(i))).sort((a, b) => {
|
|
383
|
-
|
|
384
|
-
if (
|
|
385
|
-
|
|
386
|
-
const numB = +(b.match(/\d+$/)?.[0] || NaN);
|
|
387
|
-
if (!Number.isNaN(numA) && !Number.isNaN(numB)) return numA - numB;
|
|
388
|
-
return a.localeCompare(b);
|
|
387
|
+
const aHasDigit = /\d/.test(a);
|
|
388
|
+
if (aHasDigit !== /\d/.test(b)) return aHasDigit ? 1 : -1;
|
|
389
|
+
return collator.compare(a, b);
|
|
389
390
|
}).map((i) => prefix + i + suffix);
|
|
390
391
|
}
|
|
391
392
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/autocomplete",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.7.
|
|
4
|
+
"version": "66.7.1",
|
|
5
5
|
"description": "Autocomplete utils for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"lru-cache": "^11.4.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@unocss/core": "66.7.
|
|
36
|
+
"@unocss/core": "66.7.1"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsdown --config-loader unrun",
|