@unocss/preset-attributify 66.5.10 → 66.5.12
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.mts +989 -40
- package/dist/index.mjs +192 -197
- package/package.json +5 -6
- package/dist/index.d.ts +0 -90
package/dist/index.mjs
CHANGED
|
@@ -1,217 +1,212 @@
|
|
|
1
|
-
import { isAttributifySelector, isValidSelector
|
|
1
|
+
import { definePreset, isAttributifySelector, isValidSelector } from "@unocss/core";
|
|
2
2
|
|
|
3
|
+
//#region src/variant.ts
|
|
3
4
|
const variantsRE = /^(?!.*\[[^:]+:.+\]$)((?:.+:)?!?)(.*)$/;
|
|
4
5
|
function variantAttributify(options = {}) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const variantParts = variants.split(/([^:]*:)/g).filter(Boolean);
|
|
39
|
-
const _body = variantParts.pop() + body;
|
|
40
|
-
const _variants = variantParts.join("");
|
|
41
|
-
return [
|
|
42
|
-
{ matcher: `${variants}${name}-${body}` },
|
|
43
|
-
{ matcher: `${_variants}${name}-${_body}` }
|
|
44
|
-
];
|
|
45
|
-
}
|
|
46
|
-
return `${variants}${name}-${body}`;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
6
|
+
const prefix = options.prefix ?? "un-";
|
|
7
|
+
const prefixedOnly = options.prefixedOnly ?? false;
|
|
8
|
+
const trueToNonValued = options.trueToNonValued ?? false;
|
|
9
|
+
let variantsValueRE;
|
|
10
|
+
return {
|
|
11
|
+
name: "attributify",
|
|
12
|
+
match(input, { generator }) {
|
|
13
|
+
const match = isAttributifySelector(input);
|
|
14
|
+
if (!match) return;
|
|
15
|
+
let name = match[1];
|
|
16
|
+
if (name.startsWith(prefix)) name = name.slice(prefix.length);
|
|
17
|
+
else if (prefixedOnly) return;
|
|
18
|
+
const content = match[2];
|
|
19
|
+
const [, variants = "", body = content] = content.match(variantsRE) || [];
|
|
20
|
+
if (body === "~" || trueToNonValued && body === "true" || !body) return `${variants}${name}`;
|
|
21
|
+
if (variantsValueRE == null) {
|
|
22
|
+
const separators = generator?.config?.separators?.join("|");
|
|
23
|
+
if (separators) variantsValueRE = /* @__PURE__ */ new RegExp(`^(.*\\](?:${separators}))(\\[[^\\]]+?\\])$`);
|
|
24
|
+
else variantsValueRE = false;
|
|
25
|
+
}
|
|
26
|
+
if (variantsValueRE) {
|
|
27
|
+
const [, bodyVariant, bracketValue] = content.match(variantsValueRE) || [];
|
|
28
|
+
if (bracketValue) return `${bodyVariant}${variants}${name}-${bracketValue}`;
|
|
29
|
+
}
|
|
30
|
+
if (variants && body.match(/^[\d.]+$/)) {
|
|
31
|
+
const variantParts = variants.split(/([^:]*:)/g).filter(Boolean);
|
|
32
|
+
const _body = variantParts.pop() + body;
|
|
33
|
+
const _variants = variantParts.join("");
|
|
34
|
+
return [{ matcher: `${variants}${name}-${body}` }, { matcher: `${_variants}${name}-${_body}` }];
|
|
35
|
+
}
|
|
36
|
+
return `${variants}${name}-${body}`;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
49
39
|
}
|
|
50
40
|
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/autocomplete.ts
|
|
51
43
|
const elementRE$1 = /(<\w[\w:.$-]*\s)((?:'[^>']*'|"[^>"]*"|`[^>`]*`|\{[^>}]*\}|[^>]*?)*)/g;
|
|
52
44
|
const valuedAttributeRE$1 = /(\?|(?!\d|-{2}|-\d)[\w\u00A0-\uFFFF-:%]+)(?:=("[^"]*|'[^']*))?/g;
|
|
53
45
|
const splitterRE$1 = /[\s'"`;>]+/;
|
|
54
46
|
function autocompleteExtractorAttributify(options) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
end: currentPos + attrValuePos + value.length,
|
|
132
|
-
replacement: variants + suggestion.slice(variants.length + attrNameWithoutPrefix.length + 1)
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
};
|
|
47
|
+
return {
|
|
48
|
+
name: "attributify",
|
|
49
|
+
extract: ({ content, cursor }) => {
|
|
50
|
+
const matchedElements = content.matchAll(elementRE$1);
|
|
51
|
+
let attrs;
|
|
52
|
+
let elPos = 0;
|
|
53
|
+
for (const match of matchedElements) {
|
|
54
|
+
const [, prefix, content$1] = match;
|
|
55
|
+
const currentPos$1 = match.index + prefix.length;
|
|
56
|
+
if (cursor > currentPos$1 && cursor <= currentPos$1 + content$1.length) {
|
|
57
|
+
elPos = currentPos$1;
|
|
58
|
+
attrs = content$1;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!attrs) return null;
|
|
63
|
+
const matchedAttributes = attrs.matchAll(valuedAttributeRE$1);
|
|
64
|
+
let attrsPos = 0;
|
|
65
|
+
let attrName;
|
|
66
|
+
let attrValues;
|
|
67
|
+
for (const match of matchedAttributes) {
|
|
68
|
+
const [matched, name, rawValues] = match;
|
|
69
|
+
const currentPos$1 = elPos + match.index;
|
|
70
|
+
if (cursor > currentPos$1 && cursor <= currentPos$1 + matched.length) {
|
|
71
|
+
attrsPos = currentPos$1;
|
|
72
|
+
attrName = name;
|
|
73
|
+
attrValues = rawValues?.slice(1);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (!attrName) return null;
|
|
78
|
+
if (attrName === "class" || attrName === "className" || attrName === ":class") return null;
|
|
79
|
+
const hasPrefix = !!options?.prefix && attrName.startsWith(options.prefix);
|
|
80
|
+
if (options?.prefixedOnly && !hasPrefix) return null;
|
|
81
|
+
const attrNameWithoutPrefix = hasPrefix ? attrName.slice(options.prefix.length) : attrName;
|
|
82
|
+
if (attrValues === void 0) return {
|
|
83
|
+
extracted: attrNameWithoutPrefix,
|
|
84
|
+
resolveReplacement(suggestion) {
|
|
85
|
+
const startOffset = hasPrefix ? options.prefix.length : 0;
|
|
86
|
+
return {
|
|
87
|
+
start: attrsPos + startOffset,
|
|
88
|
+
end: attrsPos + attrName.length,
|
|
89
|
+
replacement: suggestion
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const attrValuePos = attrsPos + attrName.length + 2;
|
|
94
|
+
let matchSplit = splitterRE$1.exec(attrValues);
|
|
95
|
+
let currentPos = 0;
|
|
96
|
+
let value;
|
|
97
|
+
while (matchSplit) {
|
|
98
|
+
const [matched] = matchSplit;
|
|
99
|
+
if (cursor > attrValuePos + currentPos && cursor <= attrValuePos + currentPos + matchSplit.index) {
|
|
100
|
+
value = attrValues.slice(currentPos, currentPos + matchSplit.index);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
currentPos += matchSplit.index + matched.length;
|
|
104
|
+
matchSplit = splitterRE$1.exec(attrValues.slice(currentPos));
|
|
105
|
+
}
|
|
106
|
+
if (value === void 0) value = attrValues.slice(currentPos);
|
|
107
|
+
const [, variants = "", body] = value.match(variantsRE) || [];
|
|
108
|
+
return {
|
|
109
|
+
extracted: `${variants}${attrNameWithoutPrefix}-${body}`,
|
|
110
|
+
transformSuggestions(suggestions) {
|
|
111
|
+
return suggestions.filter((v) => v.startsWith(`${variants}${attrNameWithoutPrefix}-`)).map((v) => variants + v.slice(variants.length + attrNameWithoutPrefix.length + 1));
|
|
112
|
+
},
|
|
113
|
+
resolveReplacement(suggestion) {
|
|
114
|
+
return {
|
|
115
|
+
start: currentPos + attrValuePos,
|
|
116
|
+
end: currentPos + attrValuePos + value.length,
|
|
117
|
+
replacement: variants + suggestion.slice(variants.length + attrNameWithoutPrefix.length + 1)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
};
|
|
138
123
|
}
|
|
139
124
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
];
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/extractor.ts
|
|
127
|
+
const strippedPrefixes = ["v-bind:", ":"];
|
|
144
128
|
const splitterRE = /[\s'"`;]+/g;
|
|
145
129
|
const elementRE = /<[^>\s]*\s((?:'[^']*'|"[^"]*"|`[^`]*`|\{[^}]*\}|=>|[^>]*?)*)/g;
|
|
146
130
|
const valuedAttributeRE = /(\?|(?!\d|-{2}|-\d)[\w\u00A0-\uFFFF:!%.~<-]+)=?(?:"([^"]*)"|'([^']*)'|\{([^}]*)\})?/g;
|
|
147
|
-
const defaultIgnoreAttributes = [
|
|
131
|
+
const defaultIgnoreAttributes = [
|
|
132
|
+
"placeholder",
|
|
133
|
+
"fill",
|
|
134
|
+
"opacity",
|
|
135
|
+
"stroke-opacity"
|
|
136
|
+
];
|
|
148
137
|
function extractorAttributify(options) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return [];
|
|
182
|
-
return content.split(splitterRE).filter((v) => Boolean(v) && v !== ":").map((v) => `[${name}~="${v}"]`);
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
};
|
|
138
|
+
const ignoreAttributes = options?.ignoreAttributes ?? defaultIgnoreAttributes;
|
|
139
|
+
const nonValuedAttribute = options?.nonValuedAttribute ?? true;
|
|
140
|
+
const trueToNonValued = options?.trueToNonValued ?? false;
|
|
141
|
+
return {
|
|
142
|
+
name: "@unocss/preset-attributify/extractor",
|
|
143
|
+
extract({ code }) {
|
|
144
|
+
return Array.from(code.matchAll(elementRE)).flatMap((match) => Array.from((match[1] || "").matchAll(valuedAttributeRE))).flatMap(([, name, ...contents]) => {
|
|
145
|
+
const content = contents.filter(Boolean).join("");
|
|
146
|
+
if (ignoreAttributes.includes(name)) return [];
|
|
147
|
+
for (const prefix of strippedPrefixes) if (name.startsWith(prefix)) {
|
|
148
|
+
name = name.slice(prefix.length);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
if (!content) {
|
|
152
|
+
if (isValidSelector(name) && nonValuedAttribute !== false) {
|
|
153
|
+
const result = [`[${name}=""]`];
|
|
154
|
+
if (trueToNonValued) result.push(`[${name}="true"]`);
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
return [];
|
|
158
|
+
}
|
|
159
|
+
if (["class", "className"].includes(name)) return content.split(splitterRE).filter(isValidSelector);
|
|
160
|
+
else if (elementRE.test(content)) {
|
|
161
|
+
elementRE.lastIndex = 0;
|
|
162
|
+
return this.extract({ code: content });
|
|
163
|
+
} else {
|
|
164
|
+
if (options?.prefixedOnly && options.prefix && !name.startsWith(options.prefix)) return [];
|
|
165
|
+
return content.split(splitterRE).filter((v) => Boolean(v) && v !== ":").map((v) => `[${name}~="${v}"]`);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
};
|
|
187
170
|
}
|
|
188
171
|
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/index.ts
|
|
174
|
+
/**
|
|
175
|
+
* This enables the attributify mode for other presets.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
*
|
|
179
|
+
* ```html
|
|
180
|
+
* <button
|
|
181
|
+
* bg="blue-400 hover:blue-500 dark:blue-500 dark:hover:blue-600"
|
|
182
|
+
* text="sm white"
|
|
183
|
+
* font="mono light"
|
|
184
|
+
* p="y-2 x-4"
|
|
185
|
+
* border="2 rounded blue-200"
|
|
186
|
+
* >
|
|
187
|
+
* Button
|
|
188
|
+
* </button>
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* @see https://unocss.dev/presets/attributify
|
|
192
|
+
*/
|
|
189
193
|
const presetAttributify = definePreset((options = {}) => {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return {
|
|
205
|
-
name: "@unocss/preset-attributify",
|
|
206
|
-
enforce: "post",
|
|
207
|
-
variants,
|
|
208
|
-
extractors,
|
|
209
|
-
options,
|
|
210
|
-
autocomplete: {
|
|
211
|
-
extractors: autocompleteExtractors
|
|
212
|
-
},
|
|
213
|
-
extractorDefault: options.strict ? false : void 0
|
|
214
|
-
};
|
|
194
|
+
options.strict = options.strict ?? false;
|
|
195
|
+
options.prefix = options.prefix ?? "un-";
|
|
196
|
+
options.prefixedOnly = options.prefixedOnly ?? false;
|
|
197
|
+
options.nonValuedAttribute = options.nonValuedAttribute ?? true;
|
|
198
|
+
options.ignoreAttributes = options.ignoreAttributes ?? defaultIgnoreAttributes;
|
|
199
|
+
return {
|
|
200
|
+
name: "@unocss/preset-attributify",
|
|
201
|
+
enforce: "post",
|
|
202
|
+
variants: [variantAttributify(options)],
|
|
203
|
+
extractors: [extractorAttributify(options)],
|
|
204
|
+
options,
|
|
205
|
+
autocomplete: { extractors: [autocompleteExtractorAttributify(options)] },
|
|
206
|
+
extractorDefault: options.strict ? false : void 0
|
|
207
|
+
};
|
|
215
208
|
});
|
|
209
|
+
var src_default = presetAttributify;
|
|
216
210
|
|
|
217
|
-
|
|
211
|
+
//#endregion
|
|
212
|
+
export { autocompleteExtractorAttributify, src_default as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, 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.5.
|
|
4
|
+
"version": "66.5.12",
|
|
5
5
|
"description": "Attributify preset for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,16 +28,15 @@
|
|
|
28
28
|
},
|
|
29
29
|
"main": "dist/index.mjs",
|
|
30
30
|
"module": "dist/index.mjs",
|
|
31
|
-
"types": "dist/index.d.
|
|
31
|
+
"types": "dist/index.d.mts",
|
|
32
32
|
"files": [
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unocss/core": "66.5.
|
|
36
|
+
"@unocss/core": "66.5.12"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
|
-
"build": "
|
|
40
|
-
"
|
|
41
|
-
"test:attw": "attw --pack --config-path ../../.attw-esm-only.json"
|
|
39
|
+
"build": "tsdown",
|
|
40
|
+
"dev": "tsdown --watch"
|
|
42
41
|
}
|
|
43
42
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import * as _unocss_core from '@unocss/core';
|
|
2
|
-
import { PresetOptions, AutoCompleteExtractor, Extractor, VariantObject } from '@unocss/core';
|
|
3
|
-
|
|
4
|
-
interface AttributifyOptions extends PresetOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Only generate CSS for attributify or class
|
|
7
|
-
*
|
|
8
|
-
* @default false
|
|
9
|
-
*/
|
|
10
|
-
strict?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* @default 'un-'
|
|
13
|
-
*/
|
|
14
|
-
prefix?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Only match for prefixed attributes
|
|
17
|
-
*
|
|
18
|
-
* @default false
|
|
19
|
-
*/
|
|
20
|
-
prefixedOnly?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Support matching non-valued attributes
|
|
23
|
-
*
|
|
24
|
-
* For example
|
|
25
|
-
* ```html
|
|
26
|
-
* <div mt-2 />
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @default true
|
|
30
|
-
*/
|
|
31
|
-
nonValuedAttribute?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* A list of attributes to be ignored from extracting.
|
|
34
|
-
*/
|
|
35
|
-
ignoreAttributes?: string[];
|
|
36
|
-
/**
|
|
37
|
-
* Non-valued attributes will also match if the actual value represented in DOM is `true`.
|
|
38
|
-
* This option exists for supporting frameworks that encodes non-valued attributes as `true`.
|
|
39
|
-
* Enabling this option will break rules that ends with `true`.
|
|
40
|
-
*
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
trueToNonValued?: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
declare function autocompleteExtractorAttributify(options?: AttributifyOptions): AutoCompleteExtractor;
|
|
47
|
-
|
|
48
|
-
declare const defaultIgnoreAttributes: string[];
|
|
49
|
-
declare function extractorAttributify(options?: AttributifyOptions): Extractor;
|
|
50
|
-
|
|
51
|
-
type TwoStringsCompositionPrefix = 'm' | 'p';
|
|
52
|
-
type TwoStringsCompositionSuffix = 'r' | 'b' | 'l' | 't' | 'a' | 'x' | 'y';
|
|
53
|
-
/** Some words can compose with two strings to become a complete unocss rule such as ha, mr, mb */
|
|
54
|
-
type TwoStringsComposition = `${TwoStringsCompositionPrefix}${TwoStringsCompositionSuffix}` | 'ha' | 'wa';
|
|
55
|
-
/** Some words can be a complete unocss rule by itself */
|
|
56
|
-
type SpecialSingleWord = 'container' | 'flex' | 'block' | 'inline' | 'table' | 'isolate' | 'absolute' | 'relative' | 'fixed' | 'sticky' | 'static' | 'visible' | 'invisible' | 'grow' | 'shrink' | 'antialiased' | 'italic' | 'ordinal' | 'overline' | 'underline' | 'uppercase' | 'lowercase' | 'capitalize' | 'truncate' | 'border' | 'rounded' | 'outline' | 'ring' | 'shadow' | 'blur' | 'grayscale' | 'invert' | 'sepia' | 'transition' | 'resize' | 'transform' | 'filter';
|
|
57
|
-
type PseudoPrefix = 'active' | 'before' | 'after' | 'dark' | 'light' | 'first' | 'last' | 'focus' | 'hover' | 'link' | 'root' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'enabled' | 'disabled' | 'all' | 'children';
|
|
58
|
-
/** Some words can be used to separate utilities, such as font="mono light", text="sm white" */
|
|
59
|
-
type SeparateEnabled = 'align' | 'animate' | 'backdrop' | 'bg' | 'blend' | 'border' | 'box' | 'container' | 'content' | 'cursor' | 'display' | 'divide' | 'filter' | 'flex' | 'font' | 'fw' | 'gap' | 'gradient' | 'grid' | 'h' | 'icon' | 'items' | 'justify' | 'list' | 'm' | 'op' | 'opacity' | 'order' | 'outline' | 'overflow' | 'p' | 'place' | 'pos' | 'position' | 'ring' | 'select' | 'shadow' | 'size' | 'space' | 'table' | 'text' | 'transform' | 'transition' | 'underline' | 'w' | 'z' | PseudoPrefix;
|
|
60
|
-
type BasicAttributes = SpecialSingleWord | TwoStringsComposition | SeparateEnabled;
|
|
61
|
-
type AttributifyNames<Prefix extends string = ''> = `${Prefix}${BasicAttributes}` | `${Prefix}${PseudoPrefix}:${BasicAttributes}`;
|
|
62
|
-
interface AttributifyAttributes extends Partial<Record<AttributifyNames, string | boolean>> {
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare const variantsRE: RegExp;
|
|
66
|
-
declare function variantAttributify(options?: AttributifyOptions): VariantObject;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* This enables the attributify mode for other presets.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
*
|
|
73
|
-
* ```html
|
|
74
|
-
* <button
|
|
75
|
-
* bg="blue-400 hover:blue-500 dark:blue-500 dark:hover:blue-600"
|
|
76
|
-
* text="sm white"
|
|
77
|
-
* font="mono light"
|
|
78
|
-
* p="y-2 x-4"
|
|
79
|
-
* border="2 rounded blue-200"
|
|
80
|
-
* >
|
|
81
|
-
* Button
|
|
82
|
-
* </button>
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* @see https://unocss.dev/presets/attributify
|
|
86
|
-
*/
|
|
87
|
-
declare const presetAttributify: _unocss_core.PresetFactory<object, AttributifyOptions>;
|
|
88
|
-
|
|
89
|
-
export { autocompleteExtractorAttributify, presetAttributify as default, defaultIgnoreAttributes, extractorAttributify, presetAttributify, variantAttributify, variantsRE };
|
|
90
|
-
export type { AttributifyAttributes, AttributifyNames, AttributifyOptions, BasicAttributes, PseudoPrefix, SeparateEnabled, SpecialSingleWord, TwoStringsComposition, TwoStringsCompositionPrefix, TwoStringsCompositionSuffix };
|