@unocss/preset-attributify 0.1.4 → 0.2.2
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.d.ts +2 -2
- package/dist/index.js +15 -17
- package/dist/index.mjs +15 -17
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Extractor,
|
|
1
|
+
import { Extractor, VariantFunction, Preset } from '@unocss/core';
|
|
2
2
|
|
|
3
3
|
interface AttributifyOptions {
|
|
4
4
|
/**
|
|
@@ -32,7 +32,7 @@ interface AttributifyOptions {
|
|
|
32
32
|
|
|
33
33
|
declare const extractorAttributify: (options?: AttributifyOptions | undefined) => Extractor;
|
|
34
34
|
|
|
35
|
-
declare const variantAttributify: (options?: AttributifyOptions) =>
|
|
35
|
+
declare const variantAttributify: (options?: AttributifyOptions) => VariantFunction;
|
|
36
36
|
|
|
37
37
|
declare const preset: (options?: AttributifyOptions | undefined) => Preset;
|
|
38
38
|
|
package/dist/index.js
CHANGED
|
@@ -67,23 +67,21 @@ var variantsRE = /^(.+\:\!?)?(.*?)$/;
|
|
|
67
67
|
var variantAttributify = (options = {}) => {
|
|
68
68
|
var _a;
|
|
69
69
|
const prefix = (_a = options.prefix) != null ? _a : "un-";
|
|
70
|
-
return {
|
|
71
|
-
match(input)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return `${variants}${name}-${body}`;
|
|
86
|
-
}
|
|
70
|
+
return (input) => {
|
|
71
|
+
const match = (0, import_core2.isAttributifySelector)(input);
|
|
72
|
+
if (!match)
|
|
73
|
+
return;
|
|
74
|
+
let name = match[1];
|
|
75
|
+
if (name.startsWith(prefix))
|
|
76
|
+
name = name.slice(prefix.length);
|
|
77
|
+
else if (options.prefixedOnly)
|
|
78
|
+
return;
|
|
79
|
+
const content = match[2];
|
|
80
|
+
const [, variants = "", body = content] = content.match(variantsRE) || [];
|
|
81
|
+
if (body === "~" || !body)
|
|
82
|
+
return `${variants}${name}`;
|
|
83
|
+
else
|
|
84
|
+
return `${variants}${name}-${body}`;
|
|
87
85
|
};
|
|
88
86
|
};
|
|
89
87
|
|
package/dist/index.mjs
CHANGED
|
@@ -38,23 +38,21 @@ var variantsRE = /^(.+\:\!?)?(.*?)$/;
|
|
|
38
38
|
var variantAttributify = (options = {}) => {
|
|
39
39
|
var _a;
|
|
40
40
|
const prefix = (_a = options.prefix) != null ? _a : "un-";
|
|
41
|
-
return {
|
|
42
|
-
match(input)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return `${variants}${name}-${body}`;
|
|
57
|
-
}
|
|
41
|
+
return (input) => {
|
|
42
|
+
const match = isAttributifySelector(input);
|
|
43
|
+
if (!match)
|
|
44
|
+
return;
|
|
45
|
+
let name = match[1];
|
|
46
|
+
if (name.startsWith(prefix))
|
|
47
|
+
name = name.slice(prefix.length);
|
|
48
|
+
else if (options.prefixedOnly)
|
|
49
|
+
return;
|
|
50
|
+
const content = match[2];
|
|
51
|
+
const [, variants = "", body = content] = content.match(variantsRE) || [];
|
|
52
|
+
if (body === "~" || !body)
|
|
53
|
+
return `${variants}${name}`;
|
|
54
|
+
else
|
|
55
|
+
return `${variants}${name}-${body}`;
|
|
58
56
|
};
|
|
59
57
|
};
|
|
60
58
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-attributify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/antfu/unocss#readme",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@unocss/core": "0.
|
|
31
|
+
"@unocss/core": "0.2.2"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "tsup",
|