@unocss/preset-mini 0.52.7 → 0.53.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/index.cjs +6 -6
- package/dist/index.mjs +7 -7
- package/dist/rules.cjs +3 -3
- package/dist/rules.mjs +3 -3
- package/dist/shared/{preset-mini.fcd935e5.cjs → preset-mini.02aa6651.cjs} +13 -13
- package/dist/shared/{preset-mini.9dd74f3a.mjs → preset-mini.08cdeeea.mjs} +14 -14
- package/dist/shared/{preset-mini.27c86dd4.mjs → preset-mini.19364a2e.mjs} +68 -55
- package/dist/shared/{preset-mini.3e77961f.cjs → preset-mini.473275f7.cjs} +68 -55
- package/dist/shared/{preset-mini.3535c317.mjs → preset-mini.629d3881.mjs} +25 -25
- package/dist/shared/{preset-mini.b00661a7.cjs → preset-mini.62c94926.cjs} +2 -2
- package/dist/shared/{preset-mini.b1ff13dc.cjs → preset-mini.89cf0040.cjs} +25 -25
- package/dist/shared/{preset-mini.f5158c55.mjs → preset-mini.a201ed79.mjs} +58 -58
- package/dist/shared/{preset-mini.dd2d059b.cjs → preset-mini.c1922eb8.cjs} +1 -1
- package/dist/shared/{preset-mini.c8479548.mjs → preset-mini.c5ebe4cd.mjs} +2 -2
- package/dist/shared/{preset-mini.c0eda31d.cjs → preset-mini.daaac022.cjs} +58 -58
- package/dist/shared/{preset-mini.dfe8388f.mjs → preset-mini.e2fa1eff.mjs} +1 -1
- package/dist/theme.cjs +3 -3
- package/dist/theme.mjs +3 -3
- package/dist/utils.cjs +2 -2
- package/dist/utils.mjs +2 -2
- package/dist/variants.cjs +4 -4
- package/dist/variants.d.ts +2 -2
- package/dist/variants.mjs +3 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const extractorArbitraryVariants = require('@unocss/extractor-arbitrary-variants');
|
|
6
6
|
const core = require('@unocss/core');
|
|
7
|
-
require('./shared/preset-mini.
|
|
8
|
-
const _default$1 = require('./shared/preset-mini.
|
|
9
|
-
const colors$1 = require('./shared/preset-mini.
|
|
7
|
+
require('./shared/preset-mini.daaac022.cjs');
|
|
8
|
+
const _default$1 = require('./shared/preset-mini.89cf0040.cjs');
|
|
9
|
+
const colors$1 = require('./shared/preset-mini.02aa6651.cjs');
|
|
10
10
|
const colors = require('./shared/preset-mini.f3fc54d2.cjs');
|
|
11
|
-
const _default = require('./shared/preset-mini.
|
|
12
|
-
const _default$2 = require('./shared/preset-mini.
|
|
13
|
-
require('./shared/preset-mini.
|
|
11
|
+
const _default = require('./shared/preset-mini.62c94926.cjs');
|
|
12
|
+
const _default$2 = require('./shared/preset-mini.473275f7.cjs');
|
|
13
|
+
require('./shared/preset-mini.c1922eb8.cjs');
|
|
14
14
|
|
|
15
15
|
const preflights = [
|
|
16
16
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants';
|
|
2
2
|
import { entriesToCss, toArray } from '@unocss/core';
|
|
3
|
-
import './shared/preset-mini.
|
|
4
|
-
import { r as rules } from './shared/preset-mini.
|
|
5
|
-
export { p as parseColor } from './shared/preset-mini.
|
|
3
|
+
import './shared/preset-mini.a201ed79.mjs';
|
|
4
|
+
import { r as rules } from './shared/preset-mini.629d3881.mjs';
|
|
5
|
+
export { p as parseColor } from './shared/preset-mini.08cdeeea.mjs';
|
|
6
6
|
export { c as colors } from './shared/preset-mini.1c66bf79.mjs';
|
|
7
|
-
import { t as theme } from './shared/preset-mini.
|
|
8
|
-
export { t as theme } from './shared/preset-mini.
|
|
9
|
-
import { v as variants } from './shared/preset-mini.
|
|
10
|
-
import './shared/preset-mini.
|
|
7
|
+
import { t as theme } from './shared/preset-mini.c5ebe4cd.mjs';
|
|
8
|
+
export { t as theme } from './shared/preset-mini.c5ebe4cd.mjs';
|
|
9
|
+
import { v as variants } from './shared/preset-mini.19364a2e.mjs';
|
|
10
|
+
import './shared/preset-mini.e2fa1eff.mjs';
|
|
11
11
|
|
|
12
12
|
const preflights = [
|
|
13
13
|
{
|
package/dist/rules.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const transform = require('./shared/preset-mini.
|
|
6
|
-
const _default = require('./shared/preset-mini.
|
|
7
|
-
require('./shared/preset-mini.
|
|
5
|
+
const transform = require('./shared/preset-mini.daaac022.cjs');
|
|
6
|
+
const _default = require('./shared/preset-mini.89cf0040.cjs');
|
|
7
|
+
require('./shared/preset-mini.02aa6651.cjs');
|
|
8
8
|
require('@unocss/core');
|
|
9
9
|
|
|
10
10
|
|
package/dist/rules.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { I as alignments, F as appearance, w as appearances, b as bgColors, X as borderStyles, a as borders, r as boxShadows, V as boxShadowsBase, O as boxSizing, C as breaks, S as contains, c as contentVisibility, e as contents, v as cursors, d as displays, K as flexGridJustifiesAlignments, M as floats, q as fontSmoothings, p as fontStyles, f as fonts, Y as handlerBorderStyle, L as insets, H as justifies, o as opacity, G as orders, E as outline, D as overflows, J as placements, x as pointerEvents, u as positions, y as resizes, W as ringBase, s as rings, t as tabSizes, m as textAligns, n as textColors, i as textDecorations, g as textIndents, h as textOverflows, k as textShadows, j as textStrokes, l as textTransforms, T as textWraps, U as transformBase, Q as transforms, P as transitions, A as userSelects, Z as varEmpty, z as verticalAligns, B as whitespaces, R as willChange, N as zIndexes } from './shared/preset-mini.
|
|
2
|
-
export { b as aspectRatio, c as containerParent, h as cssProperty, e as cssVariables, f as flex, g as gaps, a as grids, m as margins, p as paddings, q as questionMark, r as rules, s as sizes, d as svgUtilities } from './shared/preset-mini.
|
|
3
|
-
import './shared/preset-mini.
|
|
1
|
+
export { I as alignments, F as appearance, w as appearances, b as bgColors, X as borderStyles, a as borders, r as boxShadows, V as boxShadowsBase, O as boxSizing, C as breaks, S as contains, c as contentVisibility, e as contents, v as cursors, d as displays, K as flexGridJustifiesAlignments, M as floats, q as fontSmoothings, p as fontStyles, f as fonts, Y as handlerBorderStyle, L as insets, H as justifies, o as opacity, G as orders, E as outline, D as overflows, J as placements, x as pointerEvents, u as positions, y as resizes, W as ringBase, s as rings, t as tabSizes, m as textAligns, n as textColors, i as textDecorations, g as textIndents, h as textOverflows, k as textShadows, j as textStrokes, l as textTransforms, T as textWraps, U as transformBase, Q as transforms, P as transitions, A as userSelects, Z as varEmpty, z as verticalAligns, B as whitespaces, R as willChange, N as zIndexes } from './shared/preset-mini.a201ed79.mjs';
|
|
2
|
+
export { b as aspectRatio, c as containerParent, h as cssProperty, e as cssVariables, f as flex, g as gaps, a as grids, m as margins, p as paddings, q as questionMark, r as rules, s as sizes, d as svgUtilities } from './shared/preset-mini.629d3881.mjs';
|
|
3
|
+
import './shared/preset-mini.08cdeeea.mjs';
|
|
4
4
|
import '@unocss/core';
|
|
@@ -173,7 +173,7 @@ function numberWithUnit(str) {
|
|
|
173
173
|
if (!match)
|
|
174
174
|
return;
|
|
175
175
|
const [, n, unit] = match;
|
|
176
|
-
const num = parseFloat(n);
|
|
176
|
+
const num = Number.parseFloat(n);
|
|
177
177
|
if (unit && !Number.isNaN(num))
|
|
178
178
|
return `${round(num)}${unit}`;
|
|
179
179
|
}
|
|
@@ -188,7 +188,7 @@ function rem(str) {
|
|
|
188
188
|
if (!match)
|
|
189
189
|
return;
|
|
190
190
|
const [, n, unit] = match;
|
|
191
|
-
const num = parseFloat(n);
|
|
191
|
+
const num = Number.parseFloat(n);
|
|
192
192
|
if (!Number.isNaN(num)) {
|
|
193
193
|
if (num === 0)
|
|
194
194
|
return "0";
|
|
@@ -202,7 +202,7 @@ function px(str) {
|
|
|
202
202
|
if (!match)
|
|
203
203
|
return;
|
|
204
204
|
const [, n, unit] = match;
|
|
205
|
-
const num = parseFloat(n);
|
|
205
|
+
const num = Number.parseFloat(n);
|
|
206
206
|
if (!Number.isNaN(num)) {
|
|
207
207
|
if (num === 0)
|
|
208
208
|
return "0";
|
|
@@ -212,7 +212,7 @@ function px(str) {
|
|
|
212
212
|
function number(str) {
|
|
213
213
|
if (!numberRE.test(str))
|
|
214
214
|
return;
|
|
215
|
-
const num = parseFloat(str);
|
|
215
|
+
const num = Number.parseFloat(str);
|
|
216
216
|
if (!Number.isNaN(num))
|
|
217
217
|
return round(num);
|
|
218
218
|
}
|
|
@@ -221,7 +221,7 @@ function percent(str) {
|
|
|
221
221
|
str = str.slice(0, -1);
|
|
222
222
|
if (!numberRE.test(str))
|
|
223
223
|
return;
|
|
224
|
-
const num = parseFloat(str);
|
|
224
|
+
const num = Number.parseFloat(str);
|
|
225
225
|
if (!Number.isNaN(num))
|
|
226
226
|
return `${round(num / 100)}`;
|
|
227
227
|
}
|
|
@@ -229,7 +229,7 @@ function fraction(str) {
|
|
|
229
229
|
if (str === "full")
|
|
230
230
|
return "100%";
|
|
231
231
|
const [left, right] = str.split("/");
|
|
232
|
-
const num = parseFloat(left) / parseFloat(right);
|
|
232
|
+
const num = Number.parseFloat(left) / Number.parseFloat(right);
|
|
233
233
|
if (!Number.isNaN(num)) {
|
|
234
234
|
if (num === 0)
|
|
235
235
|
return "0";
|
|
@@ -303,7 +303,7 @@ function time(str) {
|
|
|
303
303
|
if (!match)
|
|
304
304
|
return;
|
|
305
305
|
const [, n, unit] = match;
|
|
306
|
-
const num = parseFloat(n);
|
|
306
|
+
const num = Number.parseFloat(n);
|
|
307
307
|
if (!Number.isNaN(num)) {
|
|
308
308
|
if (num === 0 && !unit)
|
|
309
309
|
return "0s";
|
|
@@ -315,7 +315,7 @@ function degree(str) {
|
|
|
315
315
|
if (!match)
|
|
316
316
|
return;
|
|
317
317
|
const [, n, unit] = match;
|
|
318
|
-
const num = parseFloat(n);
|
|
318
|
+
const num = Number.parseFloat(n);
|
|
319
319
|
if (!Number.isNaN(num)) {
|
|
320
320
|
if (num === 0)
|
|
321
321
|
return "0";
|
|
@@ -362,7 +362,7 @@ const h = handler;
|
|
|
362
362
|
const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
|
|
363
363
|
function directionSize(propertyPrefix) {
|
|
364
364
|
return ([_, direction, size], { theme }) => {
|
|
365
|
-
const v = theme.spacing?.[size || "DEFAULT"] ??
|
|
365
|
+
const v = theme.spacing?.[size || "DEFAULT"] ?? h.bracket.cssvar.global.auto.fraction.rem(size);
|
|
366
366
|
if (v != null)
|
|
367
367
|
return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
|
|
368
368
|
};
|
|
@@ -402,16 +402,16 @@ function parseColor$1(body, theme) {
|
|
|
402
402
|
if (!name)
|
|
403
403
|
return;
|
|
404
404
|
let color;
|
|
405
|
-
const bracket =
|
|
405
|
+
const bracket = h.bracketOfColor(main);
|
|
406
406
|
const bracketOrMain = bracket || main;
|
|
407
|
-
if (
|
|
407
|
+
if (h.numberWithUnit(bracketOrMain))
|
|
408
408
|
return;
|
|
409
409
|
if (bracketOrMain.match(/^#[\da-fA-F]+/g))
|
|
410
410
|
color = bracketOrMain;
|
|
411
411
|
else if (bracketOrMain.match(/^hex-[\da-fA-F]+/g))
|
|
412
412
|
color = `#${bracketOrMain.slice(4)}`;
|
|
413
413
|
else if (main.startsWith("$"))
|
|
414
|
-
color =
|
|
414
|
+
color = h.cssvar(main);
|
|
415
415
|
color = color || bracket;
|
|
416
416
|
if (!color) {
|
|
417
417
|
const colorData = getThemeColor(theme, [main]);
|
|
@@ -447,7 +447,7 @@ function parseColor$1(body, theme) {
|
|
|
447
447
|
no,
|
|
448
448
|
color,
|
|
449
449
|
cssColor: parseCssColor(color),
|
|
450
|
-
alpha:
|
|
450
|
+
alpha: h.bracket.cssvar.percent(opacity ?? "")
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
453
|
function colorResolver(property, varName, shouldPass) {
|
|
@@ -171,7 +171,7 @@ function numberWithUnit(str) {
|
|
|
171
171
|
if (!match)
|
|
172
172
|
return;
|
|
173
173
|
const [, n, unit] = match;
|
|
174
|
-
const num = parseFloat(n);
|
|
174
|
+
const num = Number.parseFloat(n);
|
|
175
175
|
if (unit && !Number.isNaN(num))
|
|
176
176
|
return `${round(num)}${unit}`;
|
|
177
177
|
}
|
|
@@ -186,7 +186,7 @@ function rem(str) {
|
|
|
186
186
|
if (!match)
|
|
187
187
|
return;
|
|
188
188
|
const [, n, unit] = match;
|
|
189
|
-
const num = parseFloat(n);
|
|
189
|
+
const num = Number.parseFloat(n);
|
|
190
190
|
if (!Number.isNaN(num)) {
|
|
191
191
|
if (num === 0)
|
|
192
192
|
return "0";
|
|
@@ -200,7 +200,7 @@ function px(str) {
|
|
|
200
200
|
if (!match)
|
|
201
201
|
return;
|
|
202
202
|
const [, n, unit] = match;
|
|
203
|
-
const num = parseFloat(n);
|
|
203
|
+
const num = Number.parseFloat(n);
|
|
204
204
|
if (!Number.isNaN(num)) {
|
|
205
205
|
if (num === 0)
|
|
206
206
|
return "0";
|
|
@@ -210,7 +210,7 @@ function px(str) {
|
|
|
210
210
|
function number(str) {
|
|
211
211
|
if (!numberRE.test(str))
|
|
212
212
|
return;
|
|
213
|
-
const num = parseFloat(str);
|
|
213
|
+
const num = Number.parseFloat(str);
|
|
214
214
|
if (!Number.isNaN(num))
|
|
215
215
|
return round(num);
|
|
216
216
|
}
|
|
@@ -219,7 +219,7 @@ function percent(str) {
|
|
|
219
219
|
str = str.slice(0, -1);
|
|
220
220
|
if (!numberRE.test(str))
|
|
221
221
|
return;
|
|
222
|
-
const num = parseFloat(str);
|
|
222
|
+
const num = Number.parseFloat(str);
|
|
223
223
|
if (!Number.isNaN(num))
|
|
224
224
|
return `${round(num / 100)}`;
|
|
225
225
|
}
|
|
@@ -227,7 +227,7 @@ function fraction(str) {
|
|
|
227
227
|
if (str === "full")
|
|
228
228
|
return "100%";
|
|
229
229
|
const [left, right] = str.split("/");
|
|
230
|
-
const num = parseFloat(left) / parseFloat(right);
|
|
230
|
+
const num = Number.parseFloat(left) / Number.parseFloat(right);
|
|
231
231
|
if (!Number.isNaN(num)) {
|
|
232
232
|
if (num === 0)
|
|
233
233
|
return "0";
|
|
@@ -301,7 +301,7 @@ function time(str) {
|
|
|
301
301
|
if (!match)
|
|
302
302
|
return;
|
|
303
303
|
const [, n, unit] = match;
|
|
304
|
-
const num = parseFloat(n);
|
|
304
|
+
const num = Number.parseFloat(n);
|
|
305
305
|
if (!Number.isNaN(num)) {
|
|
306
306
|
if (num === 0 && !unit)
|
|
307
307
|
return "0s";
|
|
@@ -313,7 +313,7 @@ function degree(str) {
|
|
|
313
313
|
if (!match)
|
|
314
314
|
return;
|
|
315
315
|
const [, n, unit] = match;
|
|
316
|
-
const num = parseFloat(n);
|
|
316
|
+
const num = Number.parseFloat(n);
|
|
317
317
|
if (!Number.isNaN(num)) {
|
|
318
318
|
if (num === 0)
|
|
319
319
|
return "0";
|
|
@@ -360,7 +360,7 @@ const h = handler;
|
|
|
360
360
|
const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
|
|
361
361
|
function directionSize(propertyPrefix) {
|
|
362
362
|
return ([_, direction, size], { theme }) => {
|
|
363
|
-
const v = theme.spacing?.[size || "DEFAULT"] ??
|
|
363
|
+
const v = theme.spacing?.[size || "DEFAULT"] ?? h.bracket.cssvar.global.auto.fraction.rem(size);
|
|
364
364
|
if (v != null)
|
|
365
365
|
return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
|
|
366
366
|
};
|
|
@@ -400,16 +400,16 @@ function parseColor$1(body, theme) {
|
|
|
400
400
|
if (!name)
|
|
401
401
|
return;
|
|
402
402
|
let color;
|
|
403
|
-
const bracket =
|
|
403
|
+
const bracket = h.bracketOfColor(main);
|
|
404
404
|
const bracketOrMain = bracket || main;
|
|
405
|
-
if (
|
|
405
|
+
if (h.numberWithUnit(bracketOrMain))
|
|
406
406
|
return;
|
|
407
407
|
if (bracketOrMain.match(/^#[\da-fA-F]+/g))
|
|
408
408
|
color = bracketOrMain;
|
|
409
409
|
else if (bracketOrMain.match(/^hex-[\da-fA-F]+/g))
|
|
410
410
|
color = `#${bracketOrMain.slice(4)}`;
|
|
411
411
|
else if (main.startsWith("$"))
|
|
412
|
-
color =
|
|
412
|
+
color = h.cssvar(main);
|
|
413
413
|
color = color || bracket;
|
|
414
414
|
if (!color) {
|
|
415
415
|
const colorData = getThemeColor(theme, [main]);
|
|
@@ -445,7 +445,7 @@ function parseColor$1(body, theme) {
|
|
|
445
445
|
no,
|
|
446
446
|
color,
|
|
447
447
|
cssColor: parseCssColor(color),
|
|
448
|
-
alpha:
|
|
448
|
+
alpha: h.bracket.cssvar.percent(opacity ?? "")
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
451
|
function colorResolver(property, varName, shouldPass) {
|
|
@@ -770,4 +770,4 @@ function parseCssSpaceColorValues(componentString) {
|
|
|
770
770
|
};
|
|
771
771
|
}
|
|
772
772
|
|
|
773
|
-
export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, cornerMap as b, colorResolver as c, directionMap as d, colorToString as e, colorOpacityToString as f, globalKeywords as g,
|
|
773
|
+
export { CONTROL_MINI_NO_NEGATIVE as C, hasParseableColor as a, cornerMap as b, colorResolver as c, directionMap as d, colorToString as e, colorOpacityToString as f, globalKeywords as g, h, colorableShadows as i, insetMap as j, positionMap as k, resolveBreakpoints as l, makeGlobalStaticRules as m, numberWithUnitRE as n, directionSize as o, parseColor$1 as p, getBracket as q, resolveVerticalBreakpoints as r, splitShorthand as s, getComponent as t, hex2rgba as u, parseCssColor as v, handler as w, xyzMap as x, valueHandlers as y, getComponents as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h
|
|
1
|
+
import { h, l as resolveBreakpoints, q as getBracket, C as CONTROL_MINI_NO_NEGATIVE, t as getComponent } from './preset-mini.08cdeeea.mjs';
|
|
2
2
|
import { warnOnce, escapeRegExp, escapeSelector } from '@unocss/core';
|
|
3
|
-
import { v as variantGetParameter, a as variantGetBracket, b as variantMatcher, c as variantParentMatcher } from './preset-mini.
|
|
3
|
+
import { v as variantGetParameter, a as variantGetBracket, b as variantMatcher, c as variantParentMatcher } from './preset-mini.e2fa1eff.mjs';
|
|
4
4
|
|
|
5
5
|
const variantAria = {
|
|
6
6
|
name: "aria",
|
|
@@ -8,7 +8,7 @@ const variantAria = {
|
|
|
8
8
|
const variant = variantGetParameter("aria-", matcher, ctx.generator.config.separators);
|
|
9
9
|
if (variant) {
|
|
10
10
|
const [match, rest] = variant;
|
|
11
|
-
const aria =
|
|
11
|
+
const aria = h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
|
|
12
12
|
if (aria) {
|
|
13
13
|
return {
|
|
14
14
|
matcher: rest,
|
|
@@ -22,7 +22,7 @@ const variantAria = {
|
|
|
22
22
|
function calcMaxWidthBySize(size) {
|
|
23
23
|
const value = size.match(/^-?[0-9]+\.?[0-9]*/)?.[0] || "";
|
|
24
24
|
const unit = size.slice(value.length);
|
|
25
|
-
const maxWidth = parseFloat(value) - 0.1;
|
|
25
|
+
const maxWidth = Number.parseFloat(value) - 0.1;
|
|
26
26
|
return Number.isNaN(maxWidth) ? size : `${maxWidth}${unit}`;
|
|
27
27
|
}
|
|
28
28
|
function variantBreakpoints() {
|
|
@@ -99,7 +99,7 @@ function scopeMatcher(name, combinator) {
|
|
|
99
99
|
if (!body)
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
let bracketValue =
|
|
102
|
+
let bracketValue = h.bracket(body[0]) ?? "";
|
|
103
103
|
if (bracketValue === "")
|
|
104
104
|
bracketValue = "*";
|
|
105
105
|
return {
|
|
@@ -126,10 +126,10 @@ const variantContainerQuery = {
|
|
|
126
126
|
const variant = variantGetParameter("@", matcher, ctx.generator.config.separators);
|
|
127
127
|
if (variant) {
|
|
128
128
|
const [match, rest, label] = variant;
|
|
129
|
-
const unbracket =
|
|
129
|
+
const unbracket = h.bracket(match);
|
|
130
130
|
let container;
|
|
131
131
|
if (unbracket) {
|
|
132
|
-
const minWidth =
|
|
132
|
+
const minWidth = h.numberWithUnit(unbracket);
|
|
133
133
|
if (minWidth)
|
|
134
134
|
container = `(min-width: ${minWidth})`;
|
|
135
135
|
} else {
|
|
@@ -170,7 +170,7 @@ const variantDataAttribute = {
|
|
|
170
170
|
const variant = variantGetParameter("data-", matcher, ctx.generator.config.separators);
|
|
171
171
|
if (variant) {
|
|
172
172
|
const [match, rest] = variant;
|
|
173
|
-
const dataAttribute =
|
|
173
|
+
const dataAttribute = h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
|
|
174
174
|
if (dataAttribute) {
|
|
175
175
|
return {
|
|
176
176
|
matcher: rest,
|
|
@@ -192,7 +192,7 @@ const variantSelector = {
|
|
|
192
192
|
const variant = variantGetBracket("selector-", matcher, ctx.generator.config.separators);
|
|
193
193
|
if (variant) {
|
|
194
194
|
const [match, rest] = variant;
|
|
195
|
-
const selector =
|
|
195
|
+
const selector = h.bracket(match);
|
|
196
196
|
if (selector) {
|
|
197
197
|
return {
|
|
198
198
|
matcher: rest,
|
|
@@ -208,7 +208,7 @@ const variantCssLayer = {
|
|
|
208
208
|
const variant = variantGetParameter("layer-", matcher, ctx.generator.config.separators);
|
|
209
209
|
if (variant) {
|
|
210
210
|
const [match, rest] = variant;
|
|
211
|
-
const layer =
|
|
211
|
+
const layer = h.bracket(match) ?? match;
|
|
212
212
|
if (layer) {
|
|
213
213
|
return {
|
|
214
214
|
matcher: rest,
|
|
@@ -227,7 +227,7 @@ const variantInternalLayer = {
|
|
|
227
227
|
const variant = variantGetParameter("uno-layer-", matcher, ctx.generator.config.separators);
|
|
228
228
|
if (variant) {
|
|
229
229
|
const [match, rest] = variant;
|
|
230
|
-
const layer =
|
|
230
|
+
const layer = h.bracket(match) ?? match;
|
|
231
231
|
if (layer) {
|
|
232
232
|
return {
|
|
233
233
|
matcher: rest,
|
|
@@ -243,7 +243,7 @@ const variantScope = {
|
|
|
243
243
|
const variant = variantGetBracket("scope-", matcher, ctx.generator.config.separators);
|
|
244
244
|
if (variant) {
|
|
245
245
|
const [match, rest] = variant;
|
|
246
|
-
const scope =
|
|
246
|
+
const scope = h.bracket(match);
|
|
247
247
|
if (scope) {
|
|
248
248
|
return {
|
|
249
249
|
matcher: rest,
|
|
@@ -270,7 +270,7 @@ const variantVariables = {
|
|
|
270
270
|
}
|
|
271
271
|
if (newMatcher == null)
|
|
272
272
|
return;
|
|
273
|
-
const variant =
|
|
273
|
+
const variant = h.bracket(match) ?? "";
|
|
274
274
|
const useParent = variant.startsWith("@");
|
|
275
275
|
if (!(useParent || variant.includes("&")))
|
|
276
276
|
return;
|
|
@@ -374,7 +374,7 @@ const variantCustomMedia = {
|
|
|
374
374
|
const variant = variantGetParameter("media-", matcher, ctx.generator.config.separators);
|
|
375
375
|
if (variant) {
|
|
376
376
|
const [match, rest] = variant;
|
|
377
|
-
let media =
|
|
377
|
+
let media = h.bracket(match) ?? "";
|
|
378
378
|
if (media === "")
|
|
379
379
|
media = ctx.theme.media?.[match] ?? "";
|
|
380
380
|
if (media) {
|
|
@@ -397,7 +397,7 @@ const variantSupports = {
|
|
|
397
397
|
const variant = variantGetParameter("supports-", matcher, ctx.generator.config.separators);
|
|
398
398
|
if (variant) {
|
|
399
399
|
const [match, rest] = variant;
|
|
400
|
-
let supports =
|
|
400
|
+
let supports = h.bracket(match) ?? "";
|
|
401
401
|
if (supports === "")
|
|
402
402
|
supports = ctx.theme.supports?.[match] ?? "";
|
|
403
403
|
if (supports) {
|
|
@@ -422,26 +422,27 @@ const PseudoClasses = Object.fromEntries([
|
|
|
422
422
|
"visited",
|
|
423
423
|
"target",
|
|
424
424
|
["open", "[open]"],
|
|
425
|
-
"hover",
|
|
426
|
-
"active",
|
|
427
|
-
"focus-visible",
|
|
428
|
-
"focus-within",
|
|
429
|
-
"focus",
|
|
430
|
-
"autofill",
|
|
431
|
-
"enabled",
|
|
432
|
-
"disabled",
|
|
433
|
-
"read-only",
|
|
434
|
-
"read-write",
|
|
435
|
-
"placeholder-shown",
|
|
436
425
|
"default",
|
|
437
426
|
"checked",
|
|
438
427
|
"indeterminate",
|
|
428
|
+
"placeholder-shown",
|
|
429
|
+
"autofill",
|
|
430
|
+
"optional",
|
|
431
|
+
"required",
|
|
439
432
|
"valid",
|
|
440
433
|
"invalid",
|
|
441
434
|
"in-range",
|
|
442
435
|
"out-of-range",
|
|
443
|
-
"
|
|
444
|
-
"
|
|
436
|
+
"read-only",
|
|
437
|
+
"read-write",
|
|
438
|
+
"empty",
|
|
439
|
+
"focus-within",
|
|
440
|
+
"hover",
|
|
441
|
+
"focus",
|
|
442
|
+
"focus-visible",
|
|
443
|
+
"active",
|
|
444
|
+
"enabled",
|
|
445
|
+
"disabled",
|
|
445
446
|
"root",
|
|
446
447
|
"empty",
|
|
447
448
|
["even-of-type", ":nth-of-type(even)"],
|
|
@@ -462,43 +463,32 @@ const PseudoClasses = Object.fromEntries([
|
|
|
462
463
|
["marker", "::marker"],
|
|
463
464
|
["file", "::file-selector-button"]
|
|
464
465
|
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
466
|
+
const PseudoClassesKeys = Object.keys(PseudoClasses);
|
|
465
467
|
const PseudoClassesColon = Object.fromEntries([
|
|
466
468
|
["backdrop", "::backdrop"]
|
|
467
469
|
].map((key) => Array.isArray(key) ? key : [key, `:${key}`]));
|
|
470
|
+
const PseudoClassesColonKeys = Object.keys(PseudoClassesColon);
|
|
468
471
|
const PseudoClassFunctions = [
|
|
469
472
|
"not",
|
|
470
473
|
"is",
|
|
471
474
|
"where",
|
|
472
475
|
"has"
|
|
473
476
|
];
|
|
474
|
-
const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
475
|
-
const PseudoClassesColonStr = Object.entries(PseudoClassesColon).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).join("|");
|
|
477
|
+
const PseudoClassesStr = Object.entries(PseudoClasses).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).sort((a, b) => b.length - a.length).join("|");
|
|
478
|
+
const PseudoClassesColonStr = Object.entries(PseudoClassesColon).filter(([, pseudo]) => !pseudo.startsWith("::")).map(([key]) => key).sort((a, b) => b.length - a.length).join("|");
|
|
476
479
|
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
477
|
-
function pseudoModifier(pseudo) {
|
|
478
|
-
if (pseudo === "focus") {
|
|
479
|
-
return {
|
|
480
|
-
sort: 10,
|
|
481
|
-
noMerge: true
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
if (pseudo === "active") {
|
|
485
|
-
return {
|
|
486
|
-
sort: 20,
|
|
487
|
-
noMerge: true
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
480
|
function taggedPseudoClassMatcher(tag, parent, combinator) {
|
|
492
481
|
const rawRE = new RegExp(`^(${escapeRegExp(parent)}:)(\\S+)${escapeRegExp(combinator)}\\1`);
|
|
493
482
|
let splitRE;
|
|
494
483
|
let pseudoRE;
|
|
495
484
|
let pseudoColonRE;
|
|
485
|
+
let pseudoVarRE;
|
|
496
486
|
const matchBracket = (input) => {
|
|
497
487
|
const body = variantGetBracket(`${tag}-`, input, []);
|
|
498
488
|
if (!body)
|
|
499
489
|
return;
|
|
500
490
|
const [match, rest] = body;
|
|
501
|
-
const bracketValue =
|
|
491
|
+
const bracketValue = h.bracket(match);
|
|
502
492
|
if (bracketValue == null)
|
|
503
493
|
return;
|
|
504
494
|
const label = rest.split(splitRE, 1)?.[0] ?? "";
|
|
@@ -525,6 +515,19 @@ function taggedPseudoClassMatcher(tag, parent, combinator) {
|
|
|
525
515
|
pseudoKey
|
|
526
516
|
];
|
|
527
517
|
};
|
|
518
|
+
const matchPseudoVar = (input) => {
|
|
519
|
+
const match = input.match(pseudoVarRE);
|
|
520
|
+
if (!match)
|
|
521
|
+
return;
|
|
522
|
+
const [original, fn, pseudoValue] = match;
|
|
523
|
+
const label = match[3] ?? "";
|
|
524
|
+
const pseudo = `:${fn}(${pseudoValue})`;
|
|
525
|
+
return [
|
|
526
|
+
label,
|
|
527
|
+
input.slice(original.length),
|
|
528
|
+
`${parent}${escapeSelector(label)}${pseudo}`
|
|
529
|
+
];
|
|
530
|
+
};
|
|
528
531
|
return {
|
|
529
532
|
name: `pseudo:${tag}`,
|
|
530
533
|
match(input, ctx) {
|
|
@@ -532,10 +535,11 @@ function taggedPseudoClassMatcher(tag, parent, combinator) {
|
|
|
532
535
|
splitRE = new RegExp(`(?:${ctx.generator.config.separators.join("|")})`);
|
|
533
536
|
pseudoRE = new RegExp(`^${tag}-(?:(?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesStr}))(?:(/\\w+))?(?:${ctx.generator.config.separators.join("|")})`);
|
|
534
537
|
pseudoColonRE = new RegExp(`^${tag}-(?:(?:(${PseudoClassFunctionsStr})-)?(${PseudoClassesColonStr}))(?:(/\\w+))?(?:${ctx.generator.config.separators.filter((x) => x !== "-").join("|")})`);
|
|
538
|
+
pseudoVarRE = new RegExp(`^${tag}-(?:(${PseudoClassFunctionsStr})-)?\\[(.+)\\](?:(/\\w+))?(?:${ctx.generator.config.separators.filter((x) => x !== "-").join("|")})`);
|
|
535
539
|
}
|
|
536
540
|
if (!input.startsWith(tag))
|
|
537
541
|
return;
|
|
538
|
-
const result = matchBracket(input) || matchPseudo(input);
|
|
542
|
+
const result = matchBracket(input) || matchPseudo(input) || matchPseudoVar(input);
|
|
539
543
|
if (!result)
|
|
540
544
|
return;
|
|
541
545
|
const [label, matcher, prefix, pseudoName = ""] = result;
|
|
@@ -546,7 +550,7 @@ function taggedPseudoClassMatcher(tag, parent, combinator) {
|
|
|
546
550
|
handle: (input2, next) => next({
|
|
547
551
|
...input2,
|
|
548
552
|
prefix: `${prefix}${combinator}${input2.prefix}`.replace(rawRE, "$1$2:"),
|
|
549
|
-
|
|
553
|
+
sort: PseudoClassesKeys.indexOf(pseudoName) ?? PseudoClassesColonKeys.indexOf(pseudoName)
|
|
550
554
|
})
|
|
551
555
|
};
|
|
552
556
|
},
|
|
@@ -563,8 +567,8 @@ const excludedPseudo = [
|
|
|
563
567
|
"::-webkit-scrollbar-track-piece",
|
|
564
568
|
"::file-selector-button"
|
|
565
569
|
];
|
|
566
|
-
const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).join("|");
|
|
567
|
-
const PseudoClassesAndElementsColonStr = Object.entries(PseudoClassesColon).map(([key]) => key).join("|");
|
|
570
|
+
const PseudoClassesAndElementsStr = Object.entries(PseudoClasses).map(([key]) => key).sort((a, b) => b.length - a.length).join("|");
|
|
571
|
+
const PseudoClassesAndElementsColonStr = Object.entries(PseudoClassesColon).map(([key]) => key).sort((a, b) => b.length - a.length).join("|");
|
|
568
572
|
function variantPseudoClassesAndElements() {
|
|
569
573
|
let PseudoClassesAndElementsRE;
|
|
570
574
|
let PseudoClassesAndElementsColonRE;
|
|
@@ -578,6 +582,11 @@ function variantPseudoClassesAndElements() {
|
|
|
578
582
|
const match = input.match(PseudoClassesAndElementsRE) || input.match(PseudoClassesAndElementsColonRE);
|
|
579
583
|
if (match) {
|
|
580
584
|
const pseudo = PseudoClasses[match[1]] || PseudoClassesColon[match[1]] || `:${match[1]}`;
|
|
585
|
+
let index = PseudoClassesKeys.indexOf(match[1]);
|
|
586
|
+
if (index === -1)
|
|
587
|
+
index = PseudoClassesColonKeys.indexOf(match[1]);
|
|
588
|
+
if (index === -1)
|
|
589
|
+
index = void 0;
|
|
581
590
|
return {
|
|
582
591
|
matcher: input.slice(match[0].length),
|
|
583
592
|
handle: (input2, next) => {
|
|
@@ -589,7 +598,8 @@ function variantPseudoClassesAndElements() {
|
|
|
589
598
|
return next({
|
|
590
599
|
...input2,
|
|
591
600
|
...selectors,
|
|
592
|
-
|
|
601
|
+
sort: index,
|
|
602
|
+
noMerge: true
|
|
593
603
|
});
|
|
594
604
|
}
|
|
595
605
|
};
|
|
@@ -602,16 +612,19 @@ function variantPseudoClassesAndElements() {
|
|
|
602
612
|
function variantPseudoClassFunctions() {
|
|
603
613
|
let PseudoClassFunctionsRE;
|
|
604
614
|
let PseudoClassColonFunctionsRE;
|
|
615
|
+
let PseudoClassVarFunctionRE;
|
|
605
616
|
return {
|
|
606
617
|
match(input, ctx) {
|
|
607
618
|
if (!(PseudoClassFunctionsRE && PseudoClassColonFunctionsRE)) {
|
|
608
619
|
PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})(?:${ctx.generator.config.separators.join("|")})`);
|
|
609
620
|
PseudoClassColonFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesColonStr})(?:${ctx.generator.config.separators.filter((x) => x !== "-").join("|")})`);
|
|
621
|
+
PseudoClassVarFunctionRE = new RegExp(`^(${PseudoClassFunctionsStr})-(\\[.+\\])(?:${ctx.generator.config.separators.filter((x) => x !== "-").join("|")})`);
|
|
610
622
|
}
|
|
611
|
-
const match = input.match(PseudoClassFunctionsRE) || input.match(PseudoClassColonFunctionsRE);
|
|
623
|
+
const match = input.match(PseudoClassFunctionsRE) || input.match(PseudoClassColonFunctionsRE) || input.match(PseudoClassVarFunctionRE);
|
|
612
624
|
if (match) {
|
|
613
625
|
const fn = match[1];
|
|
614
|
-
const
|
|
626
|
+
const fnVal = getBracket(match[2], "[", "]");
|
|
627
|
+
const pseudo = fnVal ? h.bracket(match[2]) : PseudoClasses[match[2]] || PseudoClassesColon[match[2]] || `:${match[2]}`;
|
|
615
628
|
return {
|
|
616
629
|
matcher: input.slice(match[0].length),
|
|
617
630
|
selector: (s) => `${s}:${fn}(${pseudo})`
|
|
@@ -632,7 +645,7 @@ function variantTaggedPseudoClasses(options = {}) {
|
|
|
632
645
|
];
|
|
633
646
|
}
|
|
634
647
|
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
635
|
-
const
|
|
648
|
+
const variantPartClasses = {
|
|
636
649
|
match(input) {
|
|
637
650
|
const match = input.match(PartClassesRE);
|
|
638
651
|
if (match) {
|
|
@@ -663,7 +676,7 @@ function variants(options) {
|
|
|
663
676
|
variantPseudoClassesAndElements(),
|
|
664
677
|
variantPseudoClassFunctions(),
|
|
665
678
|
...variantTaggedPseudoClasses(options),
|
|
666
|
-
|
|
679
|
+
variantPartClasses,
|
|
667
680
|
...variantColorsMediaOrClass(options),
|
|
668
681
|
...variantLanguageDirections,
|
|
669
682
|
variantScope,
|
|
@@ -672,4 +685,4 @@ function variants(options) {
|
|
|
672
685
|
];
|
|
673
686
|
}
|
|
674
687
|
|
|
675
|
-
export { variantAria as a, variantBreakpoints as b, calcMaxWidthBySize as c, variantCombinators as d, variantContainerQuery as e, variantColorsMediaOrClass as f, variantDataAttribute as g, variantLanguageDirections as h, variantImportant as i, variantPrint as j, variantCustomMedia as k, variantSelector as l, variantCssLayer as m, variantInternalLayer as n, variantScope as o, variantVariables as p, variantNegative as q, variantPseudoClassesAndElements as r, variantPseudoClassFunctions as s, variantTaggedPseudoClasses as t,
|
|
688
|
+
export { variantAria as a, variantBreakpoints as b, calcMaxWidthBySize as c, variantCombinators as d, variantContainerQuery as e, variantColorsMediaOrClass as f, variantDataAttribute as g, variantLanguageDirections as h, variantImportant as i, variantPrint as j, variantCustomMedia as k, variantSelector as l, variantCssLayer as m, variantInternalLayer as n, variantScope as o, variantVariables as p, variantNegative as q, variantPseudoClassesAndElements as r, variantPseudoClassFunctions as s, variantTaggedPseudoClasses as t, variantPartClasses as u, variants as v, variantSupports as w };
|