@unocss/preset-attributify 66.6.6 → 66.6.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.mjs +10 -16
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { definePreset, isAttributifySelector, isValidSelector } from "@unocss/core";
|
|
2
|
-
|
|
3
2
|
//#region src/variant.ts
|
|
4
3
|
const variantsRE = /^(?!.*\[[^:]+:.+\]$)((?:.+:)?!?)(.*)$/;
|
|
5
4
|
function variantAttributify(options = {}) {
|
|
@@ -20,7 +19,7 @@ function variantAttributify(options = {}) {
|
|
|
20
19
|
if (body === "~" || trueToNonValued && body === "true" || !body) return `${variants}${name}`;
|
|
21
20
|
if (variantsValueRE == null) {
|
|
22
21
|
const separators = generator?.config?.separators?.join("|");
|
|
23
|
-
if (separators) variantsValueRE =
|
|
22
|
+
if (separators) variantsValueRE = new RegExp(`^(.*\\](?:${separators}))(\\[[^\\]]+?\\])$`);
|
|
24
23
|
else variantsValueRE = false;
|
|
25
24
|
}
|
|
26
25
|
if (variantsValueRE) {
|
|
@@ -37,7 +36,6 @@ function variantAttributify(options = {}) {
|
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
|
-
|
|
41
39
|
//#endregion
|
|
42
40
|
//#region src/autocomplete.ts
|
|
43
41
|
const elementRE$1 = /(<\w[\w:.$-]*\s)((?:'[^>']*'|"[^>"]*"|`[^>`]*`|\{[^>}]*\}|[^>]*?)*)/g;
|
|
@@ -51,11 +49,11 @@ function autocompleteExtractorAttributify(options) {
|
|
|
51
49
|
let attrs;
|
|
52
50
|
let elPos = 0;
|
|
53
51
|
for (const match of matchedElements) {
|
|
54
|
-
const [, prefix, content
|
|
55
|
-
const currentPos
|
|
56
|
-
if (cursor > currentPos
|
|
57
|
-
elPos = currentPos
|
|
58
|
-
attrs = content
|
|
52
|
+
const [, prefix, content] = match;
|
|
53
|
+
const currentPos = match.index + prefix.length;
|
|
54
|
+
if (cursor > currentPos && cursor <= currentPos + content.length) {
|
|
55
|
+
elPos = currentPos;
|
|
56
|
+
attrs = content;
|
|
59
57
|
break;
|
|
60
58
|
}
|
|
61
59
|
}
|
|
@@ -66,9 +64,9 @@ function autocompleteExtractorAttributify(options) {
|
|
|
66
64
|
let attrValues;
|
|
67
65
|
for (const match of matchedAttributes) {
|
|
68
66
|
const [matched, name, rawValues] = match;
|
|
69
|
-
const currentPos
|
|
70
|
-
if (cursor > currentPos
|
|
71
|
-
attrsPos = currentPos
|
|
67
|
+
const currentPos = elPos + match.index;
|
|
68
|
+
if (cursor > currentPos && cursor <= currentPos + matched.length) {
|
|
69
|
+
attrsPos = currentPos;
|
|
72
70
|
attrName = name;
|
|
73
71
|
attrValues = rawValues?.slice(1);
|
|
74
72
|
break;
|
|
@@ -121,7 +119,6 @@ function autocompleteExtractorAttributify(options) {
|
|
|
121
119
|
}
|
|
122
120
|
};
|
|
123
121
|
}
|
|
124
|
-
|
|
125
122
|
//#endregion
|
|
126
123
|
//#region src/extractor.ts
|
|
127
124
|
const strippedPrefixes = ["v-bind:", ":"];
|
|
@@ -168,7 +165,6 @@ function extractorAttributify(options) {
|
|
|
168
165
|
}
|
|
169
166
|
};
|
|
170
167
|
}
|
|
171
|
-
|
|
172
168
|
//#endregion
|
|
173
169
|
//#region src/index.ts
|
|
174
170
|
/**
|
|
@@ -206,7 +202,5 @@ const presetAttributify = definePreset((options = {}) => {
|
|
|
206
202
|
extractorDefault: options.strict ? false : void 0
|
|
207
203
|
};
|
|
208
204
|
});
|
|
209
|
-
var src_default = presetAttributify;
|
|
210
|
-
|
|
211
205
|
//#endregion
|
|
212
|
-
export { autocompleteExtractorAttributify,
|
|
206
|
+
export { autocompleteExtractorAttributify, presetAttributify as default, presetAttributify, defaultIgnoreAttributes, extractorAttributify, variantAttributify, variantsRE };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-attributify",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.6.
|
|
4
|
+
"version": "66.6.7",
|
|
5
5
|
"description": "Attributify preset for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@unocss/core": "66.6.
|
|
32
|
+
"@unocss/core": "66.6.7"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsdown",
|