@unocss/autocomplete 0.55.4 → 0.55.5
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 +3 -8
- package/dist/index.mjs +3 -8
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -39,10 +39,9 @@ function cartesian(arr) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const shorthands = {
|
|
42
|
-
directions: "(x|y|t|b|l|r|s|e)",
|
|
43
42
|
num: `(${[0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 24, 36].join("|")})`,
|
|
44
|
-
percent: `(${
|
|
45
|
-
|
|
43
|
+
percent: `(${Array.from({ length: 11 }, (_, i) => i * 10).join("|")})`,
|
|
44
|
+
directions: "(x|y|t|b|l|r|s|e)"
|
|
46
45
|
};
|
|
47
46
|
const ignoredThemeKeys = ["DEFAULT"];
|
|
48
47
|
function handleRegexMatch(str, regex, onMatched, onNotMatched) {
|
|
@@ -105,7 +104,7 @@ function parseAutocomplete(template, theme = {}, extraShorthands = {}) {
|
|
|
105
104
|
(m) => {
|
|
106
105
|
parts.push({
|
|
107
106
|
type: "group",
|
|
108
|
-
values: m[1].split("|")
|
|
107
|
+
values: m[1].split("|").sort((a, b) => b.length - a.length)
|
|
109
108
|
});
|
|
110
109
|
},
|
|
111
110
|
(str) => {
|
|
@@ -343,10 +342,6 @@ function createAutocomplete(uno, options = {}) {
|
|
|
343
342
|
}
|
|
344
343
|
function processSuggestions(suggestions, prefix = "", suffix = "") {
|
|
345
344
|
return core.uniq(suggestions.flat()).filter((i) => !!(i && !i.match(/-$/) && !uno.isBlocked(i))).sort((a, b) => {
|
|
346
|
-
if (/\d/.test(a) && /\D/.test(b))
|
|
347
|
-
return 1;
|
|
348
|
-
if (/\D/.test(a) && /\d/.test(b))
|
|
349
|
-
return -1;
|
|
350
345
|
const numA = +(a.match(/\d+$/)?.[0] || Number.NaN);
|
|
351
346
|
const numB = +(b.match(/\d+$/)?.[0] || Number.NaN);
|
|
352
347
|
if (!Number.isNaN(numA) && !Number.isNaN(numB))
|
package/dist/index.mjs
CHANGED
|
@@ -37,10 +37,9 @@ function cartesian(arr) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const shorthands = {
|
|
40
|
-
directions: "(x|y|t|b|l|r|s|e)",
|
|
41
40
|
num: `(${[0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 24, 36].join("|")})`,
|
|
42
|
-
percent: `(${
|
|
43
|
-
|
|
41
|
+
percent: `(${Array.from({ length: 11 }, (_, i) => i * 10).join("|")})`,
|
|
42
|
+
directions: "(x|y|t|b|l|r|s|e)"
|
|
44
43
|
};
|
|
45
44
|
const ignoredThemeKeys = ["DEFAULT"];
|
|
46
45
|
function handleRegexMatch(str, regex, onMatched, onNotMatched) {
|
|
@@ -103,7 +102,7 @@ function parseAutocomplete(template, theme = {}, extraShorthands = {}) {
|
|
|
103
102
|
(m) => {
|
|
104
103
|
parts.push({
|
|
105
104
|
type: "group",
|
|
106
|
-
values: m[1].split("|")
|
|
105
|
+
values: m[1].split("|").sort((a, b) => b.length - a.length)
|
|
107
106
|
});
|
|
108
107
|
},
|
|
109
108
|
(str) => {
|
|
@@ -341,10 +340,6 @@ function createAutocomplete(uno, options = {}) {
|
|
|
341
340
|
}
|
|
342
341
|
function processSuggestions(suggestions, prefix = "", suffix = "") {
|
|
343
342
|
return uniq(suggestions.flat()).filter((i) => !!(i && !i.match(/-$/) && !uno.isBlocked(i))).sort((a, b) => {
|
|
344
|
-
if (/\d/.test(a) && /\D/.test(b))
|
|
345
|
-
return 1;
|
|
346
|
-
if (/\D/.test(a) && /\d/.test(b))
|
|
347
|
-
return -1;
|
|
348
343
|
const numA = +(a.match(/\d+$/)?.[0] || Number.NaN);
|
|
349
344
|
const numB = +(b.match(/\d+$/)?.[0] || Number.NaN);
|
|
350
345
|
if (!Number.isNaN(numA) && !Number.isNaN(numB))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/autocomplete",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.5",
|
|
4
4
|
"description": "Autocomplete utils for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"lru-cache": "^10.0.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@unocss/core": "0.55.
|
|
40
|
+
"@unocss/core": "0.55.5"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "unbuild",
|