@unocss/transformer-attributify-jsx 0.60.3 → 0.61.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.mjs +4 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -37,6 +37,8 @@ function transformerAttributifyJsx(options = {}) {
|
|
|
37
37
|
idFilter,
|
|
38
38
|
async transform(code, _, { uno }) {
|
|
39
39
|
const tasks = [];
|
|
40
|
+
const attributify = uno.config.presets.find((i) => i.name === "@unocss/preset-attributify");
|
|
41
|
+
const attributifyPrefix = attributify?.options?.prefix ?? "un-";
|
|
40
42
|
for (const item of Array.from(code.original.matchAll(elementRE))) {
|
|
41
43
|
let attributifyPart = item[2];
|
|
42
44
|
if (valuedAttributeRE.test(attributifyPart)) {
|
|
@@ -62,7 +64,8 @@ function transformerAttributifyJsx(options = {}) {
|
|
|
62
64
|
const matchedRule = attr[0].replace(/:/, "-");
|
|
63
65
|
if (matchedRule.includes("=") || isBlocked(matchedRule))
|
|
64
66
|
continue;
|
|
65
|
-
|
|
67
|
+
const updatedMatchedRule = matchedRule.startsWith(attributifyPrefix) ? matchedRule.slice(attributifyPrefix.length) : matchedRule;
|
|
68
|
+
tasks.push(uno.parseToken(updatedMatchedRule).then((matched) => {
|
|
66
69
|
if (matched) {
|
|
67
70
|
const startIdx = (item.index || 0) + (attr.index || 0) + item[0].indexOf(item[2]);
|
|
68
71
|
const endIdx = startIdx + matchedRule.length;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/transformer-attributify-jsx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.61.0",
|
|
5
5
|
"description": "Support valueless attributify in JSX/TSX.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unocss/core": "0.
|
|
36
|
+
"@unocss/core": "0.61.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"magic-string": "^0.30.10"
|