@unocss/preset-mini 0.31.16 → 0.32.1
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/chunks/default2.cjs +4 -1
- package/dist/chunks/default2.mjs +4 -1
- package/dist/chunks/default3.cjs +38 -49
- package/dist/chunks/default3.mjs +39 -49
- package/dist/variants.cjs +1 -2
- package/dist/variants.d.ts +2 -3
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
package/dist/chunks/default2.cjs
CHANGED
|
@@ -540,7 +540,10 @@ const whitespaces = [
|
|
|
540
540
|
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v }), { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)" }]
|
|
541
541
|
];
|
|
542
542
|
const contents = [
|
|
543
|
-
[/^content
|
|
543
|
+
[/^content-(.+)$/, ([, v]) => {
|
|
544
|
+
const c = utilities.handler.bracket.cssvar(v);
|
|
545
|
+
return { content: c == null ? `"${v}"` : c };
|
|
546
|
+
}],
|
|
544
547
|
["content-empty", { content: '""' }],
|
|
545
548
|
["content-none", { content: '""' }]
|
|
546
549
|
];
|
package/dist/chunks/default2.mjs
CHANGED
|
@@ -538,7 +538,10 @@ const whitespaces = [
|
|
|
538
538
|
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v }), { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)" }]
|
|
539
539
|
];
|
|
540
540
|
const contents = [
|
|
541
|
-
[/^content
|
|
541
|
+
[/^content-(.+)$/, ([, v]) => {
|
|
542
|
+
const c = handler.bracket.cssvar(v);
|
|
543
|
+
return { content: c == null ? `"${v}"` : c };
|
|
544
|
+
}],
|
|
542
545
|
["content-empty", { content: '""' }],
|
|
543
546
|
["content-none", { content: '""' }]
|
|
544
547
|
];
|
package/dist/chunks/default3.cjs
CHANGED
|
@@ -155,25 +155,34 @@ const variantImportant = {
|
|
|
155
155
|
},
|
|
156
156
|
autocomplete: "(important)"
|
|
157
157
|
};
|
|
158
|
+
const numberRE = /[0-9.]+(?:[a-z]+|%)?/;
|
|
158
159
|
const variantNegative = {
|
|
159
160
|
match(matcher) {
|
|
160
|
-
if (matcher.startsWith("-"))
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
if (!matcher.startsWith("-") || !matcher.match(/\d|-px|-full/))
|
|
162
|
+
return;
|
|
163
|
+
return {
|
|
164
|
+
matcher: matcher.slice(1),
|
|
165
|
+
body: (body) => {
|
|
166
|
+
let changed = false;
|
|
167
|
+
body.forEach((v) => {
|
|
168
|
+
const value = v[1]?.toString();
|
|
169
|
+
if (!value || v[0].startsWith("--un-scale") || value === "0")
|
|
170
|
+
return;
|
|
171
|
+
if (numberRE.test(value)) {
|
|
172
|
+
v[1] = value.replace(numberRE, (i) => `-${i}`);
|
|
173
|
+
changed = true;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
if (changed)
|
|
169
177
|
return body;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
173
180
|
}
|
|
174
181
|
};
|
|
175
182
|
|
|
176
183
|
const PseudoClasses = Object.fromEntries([
|
|
184
|
+
["first-letter", "::first"],
|
|
185
|
+
["first-line", "::first"],
|
|
177
186
|
"any-link",
|
|
178
187
|
"link",
|
|
179
188
|
"visited",
|
|
@@ -210,31 +219,22 @@ const PseudoClasses = Object.fromEntries([
|
|
|
210
219
|
"last-of-type",
|
|
211
220
|
["last", ":last-child"],
|
|
212
221
|
"only-child",
|
|
213
|
-
"only-of-type"
|
|
214
|
-
]
|
|
215
|
-
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
"first-letter",
|
|
220
|
-
"first-line",
|
|
221
|
-
"selection",
|
|
222
|
-
"marker",
|
|
222
|
+
"only-of-type",
|
|
223
|
+
["placeholder", "::placeholder"],
|
|
224
|
+
["before", "::before"],
|
|
225
|
+
["after", "::after"],
|
|
226
|
+
["selection", "::selection"],
|
|
227
|
+
["marker", "::marker"],
|
|
223
228
|
["file", "::file-selector-button"]
|
|
224
|
-
].map(
|
|
229
|
+
].map((key) => typeof key === "string" ? [key, `:${key}`] : key));
|
|
225
230
|
const PseudoClassFunctions = [
|
|
226
231
|
"not",
|
|
227
232
|
"is",
|
|
228
233
|
"where",
|
|
229
234
|
"has"
|
|
230
235
|
];
|
|
231
|
-
const
|
|
232
|
-
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
236
|
+
const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
233
237
|
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
234
|
-
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
235
|
-
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
236
|
-
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
237
|
-
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
238
238
|
const sortValue = (pseudo) => {
|
|
239
239
|
if (pseudo === "active")
|
|
240
240
|
return 1;
|
|
@@ -256,22 +256,11 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
};
|
|
259
|
-
const
|
|
259
|
+
const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
|
|
260
|
+
const PseudoClassesAndElementsRE = new RegExp(`^(${PseudoClassesAndElementsStr})[:-]`);
|
|
261
|
+
const variantPseudoClassesAndElements = {
|
|
260
262
|
match: (input) => {
|
|
261
|
-
const match = input.match(
|
|
262
|
-
if (match) {
|
|
263
|
-
const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
|
|
264
|
-
return {
|
|
265
|
-
matcher: input.slice(match[0].length),
|
|
266
|
-
selector: (s) => `${s}${pseudo}`
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
autocomplete: `(${PseudoElementsStr}):`
|
|
271
|
-
};
|
|
272
|
-
const variantPseudoClasses = {
|
|
273
|
-
match: (input) => {
|
|
274
|
-
const match = input.match(PseudoClassesRE);
|
|
263
|
+
const match = input.match(PseudoClassesAndElementsRE);
|
|
275
264
|
if (match) {
|
|
276
265
|
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
277
266
|
return {
|
|
@@ -282,8 +271,9 @@ const variantPseudoClasses = {
|
|
|
282
271
|
}
|
|
283
272
|
},
|
|
284
273
|
multiPass: true,
|
|
285
|
-
autocomplete: `(${
|
|
274
|
+
autocomplete: `(${PseudoClassesAndElementsStr}):`
|
|
286
275
|
};
|
|
276
|
+
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
287
277
|
const variantPseudoClassFunctions = {
|
|
288
278
|
match: (input) => {
|
|
289
279
|
const match = input.match(PseudoClassFunctionsRE);
|
|
@@ -320,6 +310,7 @@ const variantTaggedPseudoClasses = (options = {}) => {
|
|
|
320
310
|
}
|
|
321
311
|
];
|
|
322
312
|
};
|
|
313
|
+
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
323
314
|
const partClasses = {
|
|
324
315
|
match: (input) => {
|
|
325
316
|
const match = input.match(PartClassesRE);
|
|
@@ -343,10 +334,9 @@ const variants = (options) => [
|
|
|
343
334
|
variantCustomMedia,
|
|
344
335
|
variantBreakpoints,
|
|
345
336
|
...variantCombinators,
|
|
346
|
-
|
|
337
|
+
variantPseudoClassesAndElements,
|
|
347
338
|
variantPseudoClassFunctions,
|
|
348
339
|
...variantTaggedPseudoClasses(options),
|
|
349
|
-
variantPseudoElements,
|
|
350
340
|
partClasses,
|
|
351
341
|
...variantColorsMediaOrClass(options),
|
|
352
342
|
...variantLanguageDirections,
|
|
@@ -364,8 +354,7 @@ exports.variantLayer = variantLayer;
|
|
|
364
354
|
exports.variantNegative = variantNegative;
|
|
365
355
|
exports.variantPrint = variantPrint;
|
|
366
356
|
exports.variantPseudoClassFunctions = variantPseudoClassFunctions;
|
|
367
|
-
exports.
|
|
368
|
-
exports.variantPseudoElements = variantPseudoElements;
|
|
357
|
+
exports.variantPseudoClassesAndElements = variantPseudoClassesAndElements;
|
|
369
358
|
exports.variantScope = variantScope;
|
|
370
359
|
exports.variantSelector = variantSelector;
|
|
371
360
|
exports.variantTaggedPseudoClasses = variantTaggedPseudoClasses;
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as resolveBreakpoints } from './utilities.mjs';
|
|
2
2
|
import { v as variantParentMatcher, a as variantMatcher } from './variants.mjs';
|
|
3
|
-
import {
|
|
3
|
+
import { escapeRegExp } from '@unocss/core';
|
|
4
4
|
|
|
5
5
|
const regexCache = {};
|
|
6
6
|
const calcMaxWidthBySize = (size) => {
|
|
@@ -153,25 +153,34 @@ const variantImportant = {
|
|
|
153
153
|
},
|
|
154
154
|
autocomplete: "(important)"
|
|
155
155
|
};
|
|
156
|
+
const numberRE = /[0-9.]+(?:[a-z]+|%)?/;
|
|
156
157
|
const variantNegative = {
|
|
157
158
|
match(matcher) {
|
|
158
|
-
if (matcher.startsWith("-"))
|
|
159
|
-
return
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
if (!matcher.startsWith("-") || !matcher.match(/\d|-px|-full/))
|
|
160
|
+
return;
|
|
161
|
+
return {
|
|
162
|
+
matcher: matcher.slice(1),
|
|
163
|
+
body: (body) => {
|
|
164
|
+
let changed = false;
|
|
165
|
+
body.forEach((v) => {
|
|
166
|
+
const value = v[1]?.toString();
|
|
167
|
+
if (!value || v[0].startsWith("--un-scale") || value === "0")
|
|
168
|
+
return;
|
|
169
|
+
if (numberRE.test(value)) {
|
|
170
|
+
v[1] = value.replace(numberRE, (i) => `-${i}`);
|
|
171
|
+
changed = true;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
if (changed)
|
|
167
175
|
return body;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
171
178
|
}
|
|
172
179
|
};
|
|
173
180
|
|
|
174
181
|
const PseudoClasses = Object.fromEntries([
|
|
182
|
+
["first-letter", "::first"],
|
|
183
|
+
["first-line", "::first"],
|
|
175
184
|
"any-link",
|
|
176
185
|
"link",
|
|
177
186
|
"visited",
|
|
@@ -208,31 +217,22 @@ const PseudoClasses = Object.fromEntries([
|
|
|
208
217
|
"last-of-type",
|
|
209
218
|
["last", ":last-child"],
|
|
210
219
|
"only-child",
|
|
211
|
-
"only-of-type"
|
|
212
|
-
]
|
|
213
|
-
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"first-letter",
|
|
218
|
-
"first-line",
|
|
219
|
-
"selection",
|
|
220
|
-
"marker",
|
|
220
|
+
"only-of-type",
|
|
221
|
+
["placeholder", "::placeholder"],
|
|
222
|
+
["before", "::before"],
|
|
223
|
+
["after", "::after"],
|
|
224
|
+
["selection", "::selection"],
|
|
225
|
+
["marker", "::marker"],
|
|
221
226
|
["file", "::file-selector-button"]
|
|
222
|
-
].map(
|
|
227
|
+
].map((key) => typeof key === "string" ? [key, `:${key}`] : key));
|
|
223
228
|
const PseudoClassFunctions = [
|
|
224
229
|
"not",
|
|
225
230
|
"is",
|
|
226
231
|
"where",
|
|
227
232
|
"has"
|
|
228
233
|
];
|
|
229
|
-
const
|
|
230
|
-
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
234
|
+
const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
231
235
|
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
232
|
-
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
233
|
-
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
234
|
-
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
235
|
-
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
236
236
|
const sortValue = (pseudo) => {
|
|
237
237
|
if (pseudo === "active")
|
|
238
238
|
return 1;
|
|
@@ -254,22 +254,11 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
256
|
};
|
|
257
|
-
const
|
|
257
|
+
const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
|
|
258
|
+
const PseudoClassesAndElementsRE = new RegExp(`^(${PseudoClassesAndElementsStr})[:-]`);
|
|
259
|
+
const variantPseudoClassesAndElements = {
|
|
258
260
|
match: (input) => {
|
|
259
|
-
const match = input.match(
|
|
260
|
-
if (match) {
|
|
261
|
-
const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
|
|
262
|
-
return {
|
|
263
|
-
matcher: input.slice(match[0].length),
|
|
264
|
-
selector: (s) => `${s}${pseudo}`
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
autocomplete: `(${PseudoElementsStr}):`
|
|
269
|
-
};
|
|
270
|
-
const variantPseudoClasses = {
|
|
271
|
-
match: (input) => {
|
|
272
|
-
const match = input.match(PseudoClassesRE);
|
|
261
|
+
const match = input.match(PseudoClassesAndElementsRE);
|
|
273
262
|
if (match) {
|
|
274
263
|
const pseudo = PseudoClasses[match[1]] || `:${match[1]}`;
|
|
275
264
|
return {
|
|
@@ -280,8 +269,9 @@ const variantPseudoClasses = {
|
|
|
280
269
|
}
|
|
281
270
|
},
|
|
282
271
|
multiPass: true,
|
|
283
|
-
autocomplete: `(${
|
|
272
|
+
autocomplete: `(${PseudoClassesAndElementsStr}):`
|
|
284
273
|
};
|
|
274
|
+
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
285
275
|
const variantPseudoClassFunctions = {
|
|
286
276
|
match: (input) => {
|
|
287
277
|
const match = input.match(PseudoClassFunctionsRE);
|
|
@@ -318,6 +308,7 @@ const variantTaggedPseudoClasses = (options = {}) => {
|
|
|
318
308
|
}
|
|
319
309
|
];
|
|
320
310
|
};
|
|
311
|
+
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
321
312
|
const partClasses = {
|
|
322
313
|
match: (input) => {
|
|
323
314
|
const match = input.match(PartClassesRE);
|
|
@@ -341,14 +332,13 @@ const variants = (options) => [
|
|
|
341
332
|
variantCustomMedia,
|
|
342
333
|
variantBreakpoints,
|
|
343
334
|
...variantCombinators,
|
|
344
|
-
|
|
335
|
+
variantPseudoClassesAndElements,
|
|
345
336
|
variantPseudoClassFunctions,
|
|
346
337
|
...variantTaggedPseudoClasses(options),
|
|
347
|
-
variantPseudoElements,
|
|
348
338
|
partClasses,
|
|
349
339
|
...variantColorsMediaOrClass(options),
|
|
350
340
|
...variantLanguageDirections,
|
|
351
341
|
variantScope
|
|
352
342
|
];
|
|
353
343
|
|
|
354
|
-
export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g, variantLayer as h, variantScope as i, variantImportant as j, variantNegative as k,
|
|
344
|
+
export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g, variantLayer as h, variantScope as i, variantImportant as j, variantNegative as k, variantPseudoClassesAndElements as l, variantPseudoClassFunctions as m, variantTaggedPseudoClasses as n, partClasses as p, variants as v };
|
package/dist/variants.cjs
CHANGED
|
@@ -20,8 +20,7 @@ exports.variantLayer = _default.variantLayer;
|
|
|
20
20
|
exports.variantNegative = _default.variantNegative;
|
|
21
21
|
exports.variantPrint = _default.variantPrint;
|
|
22
22
|
exports.variantPseudoClassFunctions = _default.variantPseudoClassFunctions;
|
|
23
|
-
exports.
|
|
24
|
-
exports.variantPseudoElements = _default.variantPseudoElements;
|
|
23
|
+
exports.variantPseudoClassesAndElements = _default.variantPseudoClassesAndElements;
|
|
25
24
|
exports.variantScope = _default.variantScope;
|
|
26
25
|
exports.variantSelector = _default.variantSelector;
|
|
27
26
|
exports.variantTaggedPseudoClasses = _default.variantTaggedPseudoClasses;
|
package/dist/variants.d.ts
CHANGED
|
@@ -24,10 +24,9 @@ declare const variantScope: Variant;
|
|
|
24
24
|
declare const variantImportant: Variant;
|
|
25
25
|
declare const variantNegative: Variant;
|
|
26
26
|
|
|
27
|
-
declare const
|
|
28
|
-
declare const variantPseudoClasses: VariantObject;
|
|
27
|
+
declare const variantPseudoClassesAndElements: VariantObject;
|
|
29
28
|
declare const variantPseudoClassFunctions: VariantObject;
|
|
30
29
|
declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject[];
|
|
31
30
|
declare const partClasses: VariantObject;
|
|
32
31
|
|
|
33
|
-
export { partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantCustomMedia, variantImportant, variantLanguageDirections, variantLayer, variantNegative, variantPrint, variantPseudoClassFunctions,
|
|
32
|
+
export { partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantCustomMedia, variantImportant, variantLanguageDirections, variantLayer, variantNegative, variantPrint, variantPseudoClassFunctions, variantPseudoClassesAndElements, variantScope, variantSelector, variantTaggedPseudoClasses, variants };
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { p as partClasses, a as variantBreakpoints, e as variantColorsMediaOrClass, b as variantCombinators, d as variantCustomMedia, j as variantImportant, f as variantLanguageDirections, h as variantLayer, k as variantNegative, c as variantPrint,
|
|
1
|
+
export { p as partClasses, a as variantBreakpoints, e as variantColorsMediaOrClass, b as variantCombinators, d as variantCustomMedia, j as variantImportant, f as variantLanguageDirections, h as variantLayer, k as variantNegative, c as variantPrint, m as variantPseudoClassFunctions, l as variantPseudoClassesAndElements, i as variantScope, g as variantSelector, n as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
|
|
2
2
|
import './chunks/utilities.mjs';
|
|
3
3
|
import '@unocss/core';
|
|
4
4
|
import './chunks/variants.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"description": "The minimal preset for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
],
|
|
62
62
|
"sideEffects": false,
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@unocss/core": "0.
|
|
64
|
+
"@unocss/core": "0.32.1"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|