@unocss/autocomplete 0.55.5 → 0.55.7
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 +8 -3
- package/dist/index.mjs +8 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -39,9 +39,10 @@ function cartesian(arr) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const shorthands = {
|
|
42
|
+
directions: "(x|y|t|b|l|r|s|e)",
|
|
42
43
|
num: `(${[0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 24, 36].join("|")})`,
|
|
43
|
-
percent: `(${
|
|
44
|
-
|
|
44
|
+
percent: `(${[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100].join("|")})`,
|
|
45
|
+
percentage: `(${["10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"].join("|")})`
|
|
45
46
|
};
|
|
46
47
|
const ignoredThemeKeys = ["DEFAULT"];
|
|
47
48
|
function handleRegexMatch(str, regex, onMatched, onNotMatched) {
|
|
@@ -104,7 +105,7 @@ function parseAutocomplete(template, theme = {}, extraShorthands = {}) {
|
|
|
104
105
|
(m) => {
|
|
105
106
|
parts.push({
|
|
106
107
|
type: "group",
|
|
107
|
-
values: m[1].split("|")
|
|
108
|
+
values: m[1].split("|")
|
|
108
109
|
});
|
|
109
110
|
},
|
|
110
111
|
(str) => {
|
|
@@ -342,6 +343,10 @@ function createAutocomplete(uno, options = {}) {
|
|
|
342
343
|
}
|
|
343
344
|
function processSuggestions(suggestions, prefix = "", suffix = "") {
|
|
344
345
|
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;
|
|
345
350
|
const numA = +(a.match(/\d+$/)?.[0] || Number.NaN);
|
|
346
351
|
const numB = +(b.match(/\d+$/)?.[0] || Number.NaN);
|
|
347
352
|
if (!Number.isNaN(numA) && !Number.isNaN(numB))
|
package/dist/index.mjs
CHANGED
|
@@ -37,9 +37,10 @@ function cartesian(arr) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const shorthands = {
|
|
40
|
+
directions: "(x|y|t|b|l|r|s|e)",
|
|
40
41
|
num: `(${[0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 24, 36].join("|")})`,
|
|
41
|
-
percent: `(${
|
|
42
|
-
|
|
42
|
+
percent: `(${[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100].join("|")})`,
|
|
43
|
+
percentage: `(${["10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"].join("|")})`
|
|
43
44
|
};
|
|
44
45
|
const ignoredThemeKeys = ["DEFAULT"];
|
|
45
46
|
function handleRegexMatch(str, regex, onMatched, onNotMatched) {
|
|
@@ -102,7 +103,7 @@ function parseAutocomplete(template, theme = {}, extraShorthands = {}) {
|
|
|
102
103
|
(m) => {
|
|
103
104
|
parts.push({
|
|
104
105
|
type: "group",
|
|
105
|
-
values: m[1].split("|")
|
|
106
|
+
values: m[1].split("|")
|
|
106
107
|
});
|
|
107
108
|
},
|
|
108
109
|
(str) => {
|
|
@@ -340,6 +341,10 @@ function createAutocomplete(uno, options = {}) {
|
|
|
340
341
|
}
|
|
341
342
|
function processSuggestions(suggestions, prefix = "", suffix = "") {
|
|
342
343
|
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;
|
|
343
348
|
const numA = +(a.match(/\d+$/)?.[0] || Number.NaN);
|
|
344
349
|
const numB = +(b.match(/\d+$/)?.[0] || Number.NaN);
|
|
345
350
|
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.7",
|
|
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.7"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "unbuild",
|