@unocss/preset-tagify 0.37.1 → 0.37.4
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 +14 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +14 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -8,12 +8,24 @@ const MARKER = "__TAGIFY__";
|
|
|
8
8
|
const htmlTagRE = /<([\w\d-:]+)/g;
|
|
9
9
|
const extractorTagify = (options) => {
|
|
10
10
|
const {
|
|
11
|
-
prefix = ""
|
|
11
|
+
prefix = "",
|
|
12
|
+
excludedTags = ["b", /^h\d+$/, "table"]
|
|
12
13
|
} = options;
|
|
13
14
|
return {
|
|
14
15
|
name: "tagify",
|
|
15
16
|
extract({ code }) {
|
|
16
|
-
return new Set(Array.from(code.matchAll(htmlTagRE)).filter(({ 1: match }) =>
|
|
17
|
+
return new Set(Array.from(code.matchAll(htmlTagRE)).filter(({ 1: match }) => {
|
|
18
|
+
for (const exclude of excludedTags) {
|
|
19
|
+
if (typeof exclude === "string") {
|
|
20
|
+
if (match === exclude)
|
|
21
|
+
return false;
|
|
22
|
+
} else {
|
|
23
|
+
if (exclude.test(match))
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return match.startsWith(prefix);
|
|
28
|
+
}).map(([, matched]) => `${MARKER}${matched}`));
|
|
17
29
|
}
|
|
18
30
|
};
|
|
19
31
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ interface TagifyOptions {
|
|
|
5
5
|
* The prefix to use for the tagify variant.
|
|
6
6
|
*/
|
|
7
7
|
prefix?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Tags excluded from processing.
|
|
10
|
+
* @default ['b', /^h\d+$/, 'table']
|
|
11
|
+
*/
|
|
12
|
+
excludedTags?: (string | RegExp)[];
|
|
8
13
|
/**
|
|
9
14
|
* Extra CSS properties to apply to matched rules
|
|
10
15
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -4,12 +4,24 @@ const MARKER = "__TAGIFY__";
|
|
|
4
4
|
const htmlTagRE = /<([\w\d-:]+)/g;
|
|
5
5
|
const extractorTagify = (options) => {
|
|
6
6
|
const {
|
|
7
|
-
prefix = ""
|
|
7
|
+
prefix = "",
|
|
8
|
+
excludedTags = ["b", /^h\d+$/, "table"]
|
|
8
9
|
} = options;
|
|
9
10
|
return {
|
|
10
11
|
name: "tagify",
|
|
11
12
|
extract({ code }) {
|
|
12
|
-
return new Set(Array.from(code.matchAll(htmlTagRE)).filter(({ 1: match }) =>
|
|
13
|
+
return new Set(Array.from(code.matchAll(htmlTagRE)).filter(({ 1: match }) => {
|
|
14
|
+
for (const exclude of excludedTags) {
|
|
15
|
+
if (typeof exclude === "string") {
|
|
16
|
+
if (match === exclude)
|
|
17
|
+
return false;
|
|
18
|
+
} else {
|
|
19
|
+
if (exclude.test(match))
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return match.startsWith(prefix);
|
|
24
|
+
}).map(([, matched]) => `${MARKER}${matched}`));
|
|
13
25
|
}
|
|
14
26
|
};
|
|
15
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-tagify",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.4",
|
|
4
4
|
"description": "Tagify preset for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unocss/core": "0.37.
|
|
36
|
+
"@unocss/core": "0.37.4"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "unbuild",
|