@unocss/preset-mini 0.15.4 → 0.16.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 +158 -202
- package/dist/chunks/default2.mjs +156 -180
- package/dist/chunks/index.cjs +7 -39
- package/dist/chunks/index.mjs +6 -30
- package/dist/rules.cjs +3 -23
- package/dist/rules.d.ts +8 -27
- package/dist/rules.mjs +1 -1
- package/dist/utils.cjs +3 -10
- package/dist/utils.d.ts +4 -12
- package/dist/utils.mjs +2 -1
- package/package.json +2 -2
package/dist/chunks/default2.mjs
CHANGED
|
@@ -23,11 +23,13 @@ const parseColorUtil = (body, theme) => {
|
|
|
23
23
|
if (!name)
|
|
24
24
|
return;
|
|
25
25
|
let color;
|
|
26
|
-
const bracket = handler.bracket(main)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const bracket = handler.bracket(main);
|
|
27
|
+
const bracketOrMain = bracket || main;
|
|
28
|
+
if (bracketOrMain.startsWith("#"))
|
|
29
|
+
color = bracketOrMain.slice(1);
|
|
30
|
+
if (bracketOrMain.startsWith("hex-"))
|
|
31
|
+
color = bracketOrMain.slice(4);
|
|
32
|
+
color = color || bracket;
|
|
31
33
|
if (!color) {
|
|
32
34
|
const colorData = theme.colors?.[name];
|
|
33
35
|
if (typeof colorData === "string")
|
|
@@ -76,22 +78,6 @@ const textColors = [
|
|
|
76
78
|
[/^(?:text|color|c)-(.+)$/, colorResolver$1("color", "text")],
|
|
77
79
|
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-opacity": handler.bracket.percent.cssvar(opacity2) })]
|
|
78
80
|
];
|
|
79
|
-
const textDecorationColors = [
|
|
80
|
-
[/^underline-(.+)$/, (match, ctx) => {
|
|
81
|
-
const result = colorResolver$1("text-decoration-color", "line")(match, ctx);
|
|
82
|
-
if (result) {
|
|
83
|
-
return {
|
|
84
|
-
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
85
|
-
...result
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}],
|
|
89
|
-
[/^underline-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-line-opacity": handler.bracket.percent(opacity2) })]
|
|
90
|
-
];
|
|
91
|
-
const textStrokeColors = [
|
|
92
|
-
[/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
|
|
93
|
-
[/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity2) })]
|
|
94
|
-
];
|
|
95
81
|
const bgColors = [
|
|
96
82
|
[/^bg-(.+)$/, colorResolver$1("background-color", "bg")],
|
|
97
83
|
[/^bg-op(?:acity)?-?(.+)$/m, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
|
|
@@ -176,39 +162,51 @@ const placeholder = [
|
|
|
176
162
|
]
|
|
177
163
|
];
|
|
178
164
|
|
|
179
|
-
const
|
|
165
|
+
const borders = [
|
|
180
166
|
[/^border$/, handlerBorder],
|
|
181
|
-
[/^(?:border|b)(
|
|
182
|
-
[/^(?:border|b)(
|
|
183
|
-
]
|
|
184
|
-
|
|
185
|
-
[/^(?:border
|
|
186
|
-
[/^(?:border
|
|
187
|
-
[/^(?:border-
|
|
188
|
-
];
|
|
189
|
-
const borderStyles = [
|
|
167
|
+
[/^(?:border|b)()-(.+)$/, handlerBorder],
|
|
168
|
+
[/^(?:border|b)-([^-]+)-(.+)$/, handlerBorder],
|
|
169
|
+
[/^(?:border|b)()-size-(.+)$/, handlerBorderSize],
|
|
170
|
+
[/^(?:border|b)-([^-]+)-size-(.+)$/, handlerBorderSize],
|
|
171
|
+
[/^(?:border|b)()-(.+)$/, handlerBorderColor],
|
|
172
|
+
[/^(?:border|b)-([^-]+)-(.+)$/, handlerBorderColor],
|
|
173
|
+
[/^(?:border|b)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-border-opacity": handler.bracket.percent(opacity) })],
|
|
190
174
|
["border-solid", { "border-style": "solid" }],
|
|
191
175
|
["border-dashed", { "border-style": "dashed" }],
|
|
192
176
|
["border-dotted", { "border-style": "dotted" }],
|
|
193
177
|
["border-double", { "border-style": "double" }],
|
|
194
|
-
["border-none", { "border-style": "none" }]
|
|
178
|
+
["border-none", { "border-style": "none" }],
|
|
179
|
+
[/^(?:border-)?(?:rounded|rd)$/, handlerRounded],
|
|
180
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?$/, handlerRounded],
|
|
181
|
+
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-([^-]+))?$/, handlerRounded]
|
|
195
182
|
];
|
|
196
|
-
|
|
197
|
-
borderSizes
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
]
|
|
202
|
-
|
|
183
|
+
function handlerBorder(m) {
|
|
184
|
+
const borderSizes = handlerBorderSize(m);
|
|
185
|
+
if (borderSizes) {
|
|
186
|
+
return [
|
|
187
|
+
...borderSizes,
|
|
188
|
+
["border-style", "solid"]
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function handlerBorderSize([, a, b]) {
|
|
203
193
|
const [d, s = "1"] = directionMap[a] ? [a, b] : ["", a];
|
|
204
194
|
const v = handler.bracket.px(s);
|
|
205
195
|
if (v != null) {
|
|
206
196
|
return [
|
|
207
|
-
...directionMap[d].map((i) => [`border${i}-width`, v])
|
|
208
|
-
["border-style", "solid"]
|
|
197
|
+
...directionMap[d].map((i) => [`border${i}-width`, v])
|
|
209
198
|
];
|
|
210
199
|
}
|
|
211
200
|
}
|
|
201
|
+
function handlerBorderColor([, a, c], ctx) {
|
|
202
|
+
const ofColor = colorResolver$1("border-color", "border")(["", c], ctx);
|
|
203
|
+
if (ofColor) {
|
|
204
|
+
const borders2 = directionMap[directionMap[a] ? a : ""].map((i) => colorResolver$1(`border${i}-color`, "border")(["", c], ctx));
|
|
205
|
+
const borderObject = {};
|
|
206
|
+
Object.assign(borderObject, ...borders2);
|
|
207
|
+
return borderObject;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
212
210
|
function handlerRounded([, a, b], { theme }) {
|
|
213
211
|
const [d, s = "DEFAULT"] = cornerMap[a] ? [a, b] : ["", a];
|
|
214
212
|
const v = theme.borderRadius?.[s] || handler.bracket.fraction.rem(s);
|
|
@@ -307,37 +305,27 @@ const transitions = [
|
|
|
307
305
|
];
|
|
308
306
|
|
|
309
307
|
const flex = [
|
|
310
|
-
["flex
|
|
311
|
-
["flex
|
|
312
|
-
["flex-
|
|
313
|
-
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
314
|
-
["flex-wrap", { "flex-wrap": "wrap" }],
|
|
315
|
-
["flex-wrap-reverse", { "flex-wrap": "wrap-reverse" }],
|
|
316
|
-
["flex-nowrap", { "flex-wrap": "nowrap" }],
|
|
308
|
+
["flex", { display: "flex" }],
|
|
309
|
+
["inline-flex", { display: "inline-flex" }],
|
|
310
|
+
["flex-inline", { display: "inline-flex" }],
|
|
317
311
|
["flex-1", { flex: "1 1 0%" }],
|
|
318
312
|
["flex-auto", { flex: "1 1 auto" }],
|
|
319
313
|
["flex-initial", { flex: "0 1 auto" }],
|
|
320
314
|
["flex-none", { flex: "none" }],
|
|
321
315
|
[/^flex-\[(.+)\]$/, ([, d]) => ({ flex: d })],
|
|
322
|
-
["flex-grow", { "flex-grow": 1 }],
|
|
323
|
-
["flex-grow-0", { "flex-grow": 0 }],
|
|
324
316
|
["flex-shrink", { "flex-shrink": 1 }],
|
|
325
317
|
["flex-shrink-0", { "flex-shrink": 0 }],
|
|
326
|
-
["flex", {
|
|
327
|
-
["
|
|
328
|
-
["flex-
|
|
318
|
+
["flex-grow", { "flex-grow": 1 }],
|
|
319
|
+
["flex-grow-0", { "flex-grow": 0 }],
|
|
320
|
+
["flex-row", { "flex-direction": "row" }],
|
|
321
|
+
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
322
|
+
["flex-col", { "flex-direction": "column" }],
|
|
323
|
+
["flex-col-reverse", { "flex-direction": "column-reverse" }],
|
|
324
|
+
["flex-wrap", { "flex-wrap": "wrap" }],
|
|
325
|
+
["flex-wrap-reverse", { "flex-wrap": "wrap-reverse" }],
|
|
326
|
+
["flex-nowrap", { "flex-wrap": "nowrap" }]
|
|
329
327
|
];
|
|
330
328
|
|
|
331
|
-
const fontsFamilies = [
|
|
332
|
-
[/^font-(\w+)$/, ([, d], { theme }) => {
|
|
333
|
-
const font = theme.fontFamily?.[d];
|
|
334
|
-
if (font) {
|
|
335
|
-
return {
|
|
336
|
-
"font-family": font
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
}]
|
|
340
|
-
];
|
|
341
329
|
const weightMap = {
|
|
342
330
|
thin: "100",
|
|
343
331
|
extralight: "200",
|
|
@@ -349,40 +337,48 @@ const weightMap = {
|
|
|
349
337
|
extrabold: "800",
|
|
350
338
|
black: "900"
|
|
351
339
|
};
|
|
352
|
-
const
|
|
353
|
-
[/^
|
|
354
|
-
const
|
|
355
|
-
if (
|
|
356
|
-
|
|
340
|
+
const fonts = [
|
|
341
|
+
[/^font-(\w+)$/, ([, d], { theme }) => {
|
|
342
|
+
const font = theme.fontFamily?.[d];
|
|
343
|
+
if (font) {
|
|
344
|
+
return {
|
|
345
|
+
"font-family": font
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
}],
|
|
349
|
+
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
350
|
+
const size = handler.bracket.rem(s);
|
|
351
|
+
if (size)
|
|
352
|
+
return { "font-size": size };
|
|
353
|
+
const themed = toArray(theme.fontSize?.[s]);
|
|
354
|
+
if (themed?.[0]) {
|
|
355
|
+
const [size2, height] = themed;
|
|
357
356
|
return {
|
|
358
|
-
"font-size":
|
|
357
|
+
"font-size": size2,
|
|
359
358
|
"line-height": height
|
|
360
359
|
};
|
|
361
360
|
}
|
|
362
|
-
}]
|
|
363
|
-
]
|
|
364
|
-
const
|
|
361
|
+
}],
|
|
362
|
+
[/^text-size-(.+)$/, ([, s]) => {
|
|
363
|
+
const raw = handler.bracket.rem(s);
|
|
364
|
+
if (raw)
|
|
365
|
+
return { "font-size": raw };
|
|
366
|
+
}],
|
|
365
367
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => {
|
|
366
368
|
const v = weightMap[s] || handler.number(s);
|
|
367
369
|
if (v)
|
|
368
370
|
return { "font-weight": v };
|
|
369
|
-
}]
|
|
370
|
-
];
|
|
371
|
-
const leadings = [
|
|
371
|
+
}],
|
|
372
372
|
[/^(?:leading|lh)-([^-]+)$/, ([, s], { theme }) => {
|
|
373
373
|
const v = theme.lineHeight?.[s] || handler.bracket.rem(s);
|
|
374
374
|
if (v !== null)
|
|
375
375
|
return { "line-height": v };
|
|
376
|
-
}]
|
|
377
|
-
];
|
|
378
|
-
const trackings = [
|
|
376
|
+
}],
|
|
379
377
|
[/^tracking-([^-]+)$/, ([, s], { theme }) => {
|
|
380
378
|
const v = theme.letterSpacing?.[s] || handler.bracket.rem(s);
|
|
381
379
|
if (v !== null)
|
|
382
380
|
return { "letter-spacing": v };
|
|
383
|
-
}]
|
|
384
|
-
];
|
|
385
|
-
const wordSpacings = [
|
|
381
|
+
}],
|
|
386
382
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => {
|
|
387
383
|
const v = theme.wordSpacing?.[s] || handler.bracket.rem(s);
|
|
388
384
|
if (v !== null)
|
|
@@ -402,20 +398,6 @@ const tabSizes = [
|
|
|
402
398
|
}
|
|
403
399
|
}]
|
|
404
400
|
];
|
|
405
|
-
const textDecorationLengths = [
|
|
406
|
-
[/^underline-([^-]+)$/, ([, s]) => {
|
|
407
|
-
const v = s === "auto" ? s : handler.bracket.px(s);
|
|
408
|
-
if (v != null)
|
|
409
|
-
return { "text-decoration-thickness": v };
|
|
410
|
-
}]
|
|
411
|
-
];
|
|
412
|
-
const textDecorationOffsets = [
|
|
413
|
-
[/^underline-offset-([^-]+)$/, ([, s]) => {
|
|
414
|
-
const v = s === "auto" ? s : handler.bracket.px(s);
|
|
415
|
-
if (v != null)
|
|
416
|
-
return { "text-underline-offset": v };
|
|
417
|
-
}]
|
|
418
|
-
];
|
|
419
401
|
const textIndents = [
|
|
420
402
|
[/^indent(?:-(.+))?$/, ([, s], { theme }) => {
|
|
421
403
|
const v = theme.textIndent?.[s || "DEFAULT"] || handler.bracket.cssvar.fraction.rem(s);
|
|
@@ -423,12 +405,14 @@ const textIndents = [
|
|
|
423
405
|
return { "text-indent": v };
|
|
424
406
|
}]
|
|
425
407
|
];
|
|
426
|
-
const
|
|
408
|
+
const textStrokes = [
|
|
427
409
|
[/^text-stroke(?:-(.+))?$/, ([, s], { theme }) => {
|
|
428
410
|
const v = theme.textStrokeWidth?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s);
|
|
429
411
|
if (v != null)
|
|
430
412
|
return { "-webkit-text-stroke-width": v };
|
|
431
|
-
}]
|
|
413
|
+
}],
|
|
414
|
+
[/^text-stroke-(.+)$/, colorResolver$1("-webkit-text-stroke-color", "text-stroke")],
|
|
415
|
+
[/^text-stroke-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-text-stroke-opacity": handler.bracket.percent(opacity) })]
|
|
432
416
|
];
|
|
433
417
|
const textShadows = [
|
|
434
418
|
[/^text-shadow(?:-(.+))?$/, ([, s], { theme }) => {
|
|
@@ -437,11 +421,6 @@ const textShadows = [
|
|
|
437
421
|
return { "text-shadow": v };
|
|
438
422
|
}]
|
|
439
423
|
];
|
|
440
|
-
const fonts = [
|
|
441
|
-
fontsFamilies,
|
|
442
|
-
fontSizes,
|
|
443
|
-
fontWeights
|
|
444
|
-
].flat(1);
|
|
445
424
|
|
|
446
425
|
const gaps = [
|
|
447
426
|
[/^(?:flex-|grid-)?gap-([^-]+)$/, ([, s]) => {
|
|
@@ -486,12 +465,10 @@ const autoDirection = (selector, theme) => {
|
|
|
486
465
|
const grids = [
|
|
487
466
|
["grid", { display: "grid" }],
|
|
488
467
|
["inline-grid", { display: "inline-grid" }],
|
|
489
|
-
[/^grid-
|
|
490
|
-
[/^grid-
|
|
491
|
-
[/^grid-
|
|
492
|
-
[/^grid-
|
|
493
|
-
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
494
|
-
[/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })],
|
|
468
|
+
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
|
|
469
|
+
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
|
|
470
|
+
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
|
|
471
|
+
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
|
|
495
472
|
[/^(?:grid-)?(row|col)-(.+)$/, ([, d, v]) => {
|
|
496
473
|
const key = d === "row" ? "grid-row" : "grid-column";
|
|
497
474
|
let raw = handler.bracket(v);
|
|
@@ -508,13 +485,15 @@ const grids = [
|
|
|
508
485
|
return { [key]: `span ${raw}/span ${raw}` };
|
|
509
486
|
}
|
|
510
487
|
}],
|
|
488
|
+
[/^(?:grid-)?auto-cols-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-columns": `${autoDirection(v, theme)}` })],
|
|
511
489
|
[/^(?:grid-)?auto-flow-([\w.-]+)$/, ([, v]) => ({ "grid-auto-flow": `${v.replace("col", "column").split("-").join(" ")}` })],
|
|
512
|
-
[/^(?:grid-)?row-start-([\w.-]+)$/, ([, v]) => ({ "grid-row-start": `${v}` })],
|
|
513
|
-
[/^(?:grid-)?row-end-([\w.-]+)$/, ([, v]) => ({ "grid-row-end": `${v}` })],
|
|
514
|
-
[/^(?:grid-)?col-start-([\w.-]+)$/, ([, v]) => ({ "grid-column-start": `${v}` })],
|
|
515
|
-
[/^(?:grid-)?col-end-([\w.]+)$/, ([, v]) => ({ "grid-column-end": `${v}` })],
|
|
516
490
|
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({ "grid-auto-rows": `${autoDirection(v, theme)}` })],
|
|
517
|
-
[/^
|
|
491
|
+
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-columns": `repeat(auto-fill, minmax(${d}, 1fr))` })],
|
|
492
|
+
[/^grid-rows-minmax-([\w.-]+)$/, ([, d]) => ({ "grid-template-rows": `repeat(auto-fill, minmax(${d}, 1fr))` })],
|
|
493
|
+
[/^grid-cols-(\d+)$/, ([, d]) => ({ "grid-template-columns": `repeat(${d},minmax(0,1fr))` })],
|
|
494
|
+
[/^grid-rows-(\d+)$/, ([, d]) => ({ "grid-template-rows": `repeat(${d},minmax(0,1fr))` })],
|
|
495
|
+
[/^grid-cols-\[(.+)\]$/, ([, v]) => ({ "grid-template-columns": v.replace(/,/g, " ") })],
|
|
496
|
+
[/^grid-rows-\[(.+)\]$/, ([, v]) => ({ "grid-template-rows": v.replace(/,/g, " ") })]
|
|
518
497
|
];
|
|
519
498
|
|
|
520
499
|
const overflowValues = [
|
|
@@ -528,6 +507,7 @@ const overflows = [
|
|
|
528
507
|
[/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
|
|
529
508
|
];
|
|
530
509
|
|
|
510
|
+
const basicSet = ["auto", "start", "end", "center", "stretch"];
|
|
531
511
|
const positions = [
|
|
532
512
|
["relative", { position: "relative" }],
|
|
533
513
|
["absolute", { position: "absolute" }],
|
|
@@ -541,47 +521,42 @@ const justifies = [
|
|
|
541
521
|
["justify-center", { "justify-content": "center" }],
|
|
542
522
|
["justify-between", { "justify-content": "space-between" }],
|
|
543
523
|
["justify-around", { "justify-content": "space-around" }],
|
|
544
|
-
["justify-evenly", { "justify-content": "space-evenly" }]
|
|
524
|
+
["justify-evenly", { "justify-content": "space-evenly" }],
|
|
525
|
+
...basicSet.map((i) => [`justify-items-${i}`, { "justify-items": i }]),
|
|
526
|
+
...basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }])
|
|
545
527
|
];
|
|
546
528
|
const orders = [
|
|
547
529
|
[/^order-(.+)$/, ([, v]) => ({ order: { first: "-9999", last: "9999", none: "0" }[v] || handler.bracket.number(v) })]
|
|
548
530
|
];
|
|
549
|
-
const
|
|
550
|
-
const justifyItems = basicSet.map((i) => [`justify-items-${i}`, { "justify-items": i }]);
|
|
551
|
-
const justifySelfs = basicSet.map((i) => [`justify-self-${i}`, { "justify-self": i }]);
|
|
552
|
-
const alignContents = [
|
|
531
|
+
const alignments = [
|
|
553
532
|
["content-start", { "align-content": "flex-start" }],
|
|
554
533
|
["content-end", { "align-content": "flex-end" }],
|
|
555
534
|
["content-center", { "align-content": "center" }],
|
|
556
535
|
["content-between", { "align-content": "space-between" }],
|
|
557
536
|
["content-around", { "align-content": "space-around" }],
|
|
558
|
-
["content-evenly", { "align-content": "space-evenly" }]
|
|
559
|
-
];
|
|
560
|
-
const alignItems = [
|
|
537
|
+
["content-evenly", { "align-content": "space-evenly" }],
|
|
561
538
|
["items-start", { "align-items": "flex-start" }],
|
|
562
539
|
["items-end", { "align-items": "flex-end" }],
|
|
563
540
|
["items-center", { "align-items": "center" }],
|
|
564
541
|
["items-baseline", { "align-items": "baseline" }],
|
|
565
|
-
["items-stretch", { "align-items": "stretch" }]
|
|
566
|
-
];
|
|
567
|
-
const alignSelfs = [
|
|
542
|
+
["items-stretch", { "align-items": "stretch" }],
|
|
568
543
|
["self-auto", { "align-self": "auto" }],
|
|
569
544
|
["self-start", { "align-self": "flex-start" }],
|
|
570
545
|
["self-end", { "align-self": "flex-end" }],
|
|
571
546
|
["self-center", { "align-self": "center" }],
|
|
572
547
|
["self-stretch", { "align-items": "stretch" }]
|
|
573
548
|
];
|
|
574
|
-
const
|
|
549
|
+
const placements = [
|
|
575
550
|
["place-content-start", { "place-content": "start" }],
|
|
576
551
|
["place-content-end", { "place-content": "end" }],
|
|
577
552
|
["place-content-center", { "place-content": "center" }],
|
|
578
553
|
["place-content-between", { "place-content": "space-between" }],
|
|
579
554
|
["place-content-around", { "place-content": "space-around" }],
|
|
580
555
|
["place-content-evenly", { "place-content": "space-evenly" }],
|
|
581
|
-
["place-content-stretch", { "place-content": "stretch" }]
|
|
556
|
+
["place-content-stretch", { "place-content": "stretch" }],
|
|
557
|
+
...basicSet.map((i) => [`place-items-${i}`, { "place-items": i }]),
|
|
558
|
+
...basicSet.map((i) => [`place-self-${i}`, { "place-self": i }])
|
|
582
559
|
];
|
|
583
|
-
const placeItems = basicSet.map((i) => [`place-items-${i}`, { "place-items": i }]);
|
|
584
|
-
const placeSelfs = basicSet.map((i) => [`place-self-${i}`, { "place-self": i }]);
|
|
585
560
|
function handleInsetValue(v) {
|
|
586
561
|
return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.rem(v);
|
|
587
562
|
}
|
|
@@ -772,17 +747,6 @@ const textTransforms = [
|
|
|
772
747
|
["case-capital", { "text-transform": "capitalize" }],
|
|
773
748
|
["case-normal", { "text-transform": "none" }]
|
|
774
749
|
];
|
|
775
|
-
const textDecorations = [
|
|
776
|
-
["underline", { "text-decoration": "underline" }],
|
|
777
|
-
["line-through", { "text-decoration": "line-through" }],
|
|
778
|
-
["no-underline", { "text-decoration": "none" }]
|
|
779
|
-
];
|
|
780
|
-
const textDecorationStyles = [
|
|
781
|
-
["underline-solid", { "text-decoration-style": "solid" }],
|
|
782
|
-
["underline-double", { "text-decoration-style": "double" }],
|
|
783
|
-
["underline-dotted", { "text-decoration-style": "dotted" }],
|
|
784
|
-
["underline-dashed", { "text-decoration-style": "dashed" }]
|
|
785
|
-
];
|
|
786
750
|
const fontStyles = [
|
|
787
751
|
["italic", { "font-style": "italic" }],
|
|
788
752
|
["not-italic", { "font-style": "normal" }]
|
|
@@ -800,6 +764,14 @@ const fontSmoothings = [
|
|
|
800
764
|
}]
|
|
801
765
|
];
|
|
802
766
|
|
|
767
|
+
const transformGpu = {
|
|
768
|
+
transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
|
|
769
|
+
[CONTROL_BYPASS_PSEUDO]: ""
|
|
770
|
+
};
|
|
771
|
+
const transformCpu = {
|
|
772
|
+
transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z))",
|
|
773
|
+
[CONTROL_BYPASS_PSEUDO]: ""
|
|
774
|
+
};
|
|
803
775
|
const transformBase = {
|
|
804
776
|
"--un-rotate": 0,
|
|
805
777
|
"--un-scale-x": 1,
|
|
@@ -810,12 +782,7 @@ const transformBase = {
|
|
|
810
782
|
"--un-translate-x": 0,
|
|
811
783
|
"--un-translate-y": 0,
|
|
812
784
|
"--un-translate-z": 0,
|
|
813
|
-
|
|
814
|
-
[CONTROL_BYPASS_PSEUDO]: ""
|
|
815
|
-
};
|
|
816
|
-
const transformGpu = {
|
|
817
|
-
transform: "rotate(var(--un-rotate)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) translate3d(var(--un-translate-x), var(--un-translate-y), var(--un-translate-z))",
|
|
818
|
-
[CONTROL_BYPASS_PSEUDO]: ""
|
|
785
|
+
...transformCpu
|
|
819
786
|
};
|
|
820
787
|
const transforms = [
|
|
821
788
|
["transform", transformBase],
|
|
@@ -826,6 +793,8 @@ const transforms = [
|
|
|
826
793
|
[/^scale-([xyz])-([^-]+)$/, handleScale],
|
|
827
794
|
[/^rotate-([^-]+)(?:deg)?$/, handleRotate],
|
|
828
795
|
["transform-gpu", transformGpu],
|
|
796
|
+
["transform-cpu", transformCpu],
|
|
797
|
+
["transform-none", { transform: "none" }],
|
|
829
798
|
["origin-center", { "transform-origin": "center" }],
|
|
830
799
|
["origin-top", { "transform-origin": "top" }],
|
|
831
800
|
["origin-top-right", { "transform-origin": "top right" }],
|
|
@@ -875,19 +844,12 @@ const variablesAbbrMap = {
|
|
|
875
844
|
"backface": "backface-visibility",
|
|
876
845
|
"whitespace": "white-space",
|
|
877
846
|
"break": "word-break",
|
|
847
|
+
"b": "border-color",
|
|
848
|
+
"border": "border-color",
|
|
878
849
|
"color": "color",
|
|
879
850
|
"case": "text-transform",
|
|
880
|
-
"write": "writing-mode",
|
|
881
|
-
"write-orient": "text-orientation",
|
|
882
851
|
"origin": "transform-origin",
|
|
883
852
|
"bg": "background-color",
|
|
884
|
-
"bg-blend": "background-blend-mode",
|
|
885
|
-
"bg-clip": "-webkit-background-clip",
|
|
886
|
-
"bg-gradient": "linear-gradient",
|
|
887
|
-
"bg-origin-border": "background-origin",
|
|
888
|
-
"bg-position": "background-position",
|
|
889
|
-
"bg-repeat": "background-repeat",
|
|
890
|
-
"bg-size": "background-size",
|
|
891
853
|
"bg-opacity": "background-opacity",
|
|
892
854
|
"tab": "tab-size",
|
|
893
855
|
"underline": "text-decoration-thickness",
|
|
@@ -902,21 +864,22 @@ const variablesAbbrMap = {
|
|
|
902
864
|
"content": "align-content",
|
|
903
865
|
"items": "align-items",
|
|
904
866
|
"self": "align-self",
|
|
905
|
-
"object": "object-fit"
|
|
906
|
-
"mix-blend": "mix-blend-mode",
|
|
907
|
-
"animate-speed": "animation-speed"
|
|
867
|
+
"object": "object-fit"
|
|
908
868
|
};
|
|
909
|
-
const cssVariables = [
|
|
910
|
-
/^(.+)-\$(.+)$/,
|
|
911
|
-
([, name, varname]) => {
|
|
869
|
+
const cssVariables = [
|
|
870
|
+
[/^(.+)-\$(.+)$/, ([, name, varname]) => {
|
|
912
871
|
const prop = variablesAbbrMap[name];
|
|
913
872
|
if (prop) {
|
|
914
873
|
return {
|
|
915
874
|
[prop]: `var(--${varname})`
|
|
916
875
|
};
|
|
917
876
|
}
|
|
918
|
-
}
|
|
919
|
-
]]
|
|
877
|
+
}],
|
|
878
|
+
[/^(?:border|b)-([^-]+)-\$(.+)$/, ([, a, v]) => {
|
|
879
|
+
if (a in directionMap)
|
|
880
|
+
return directionMap[a].map((i) => [`border${i}-color`, `var(--${v})`]);
|
|
881
|
+
}]
|
|
882
|
+
];
|
|
920
883
|
|
|
921
884
|
const questionMark = [
|
|
922
885
|
[
|
|
@@ -929,6 +892,33 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
929
892
|
]
|
|
930
893
|
];
|
|
931
894
|
|
|
895
|
+
const textDecorations = [
|
|
896
|
+
["underline", { "text-decoration": "underline" }],
|
|
897
|
+
["line-through", { "text-decoration": "line-through" }],
|
|
898
|
+
["no-underline", { "text-decoration": "none" }],
|
|
899
|
+
["decoration-underline", { "text-decoration": "underline" }],
|
|
900
|
+
["decoration-line-through", { "text-decoration": "line-through" }],
|
|
901
|
+
["decoration-none", { "text-decoration": "none" }],
|
|
902
|
+
[/^(?:underline|decoration)-(solid|double|dotted|dashed|wavy)$/, ([, d]) => ({ "text-decoration-style": d })],
|
|
903
|
+
[/^(?:underline|decoration)-([^-]+)$/, ([, s]) => ({ "text-decoration-thickness": ["auto", "from-font"].includes(s) ? s : handler.bracket.px(s) })],
|
|
904
|
+
[/^decoration-(.*)$/, ([, d]) => ({ "text-decoration-thickness": handler.bracket.px(d) })],
|
|
905
|
+
[/^underline-offset-([^-]+)$/, ([, s]) => {
|
|
906
|
+
const v = s === "auto" ? s : handler.bracket.px(s);
|
|
907
|
+
if (v != null)
|
|
908
|
+
return { "text-underline-offset": v };
|
|
909
|
+
}],
|
|
910
|
+
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
911
|
+
const result = colorResolver$1("text-decoration-color", "line")(match, ctx);
|
|
912
|
+
if (result) {
|
|
913
|
+
return {
|
|
914
|
+
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
915
|
+
...result
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
}],
|
|
919
|
+
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/m, ([, opacity]) => ({ "--un-line-opacity": handler.bracket.percent(opacity) })]
|
|
920
|
+
];
|
|
921
|
+
|
|
932
922
|
const rules = [
|
|
933
923
|
cssVariables,
|
|
934
924
|
paddings,
|
|
@@ -944,12 +934,7 @@ const rules = [
|
|
|
944
934
|
textIndents,
|
|
945
935
|
textOverflows,
|
|
946
936
|
textDecorations,
|
|
947
|
-
|
|
948
|
-
textDecorationColors,
|
|
949
|
-
textDecorationLengths,
|
|
950
|
-
textDecorationOffsets,
|
|
951
|
-
textStrokeWidths,
|
|
952
|
-
textStrokeColors,
|
|
937
|
+
textStrokes,
|
|
953
938
|
textShadows,
|
|
954
939
|
textTransforms,
|
|
955
940
|
textAligns,
|
|
@@ -972,9 +957,6 @@ const rules = [
|
|
|
972
957
|
userSelects,
|
|
973
958
|
whitespaces,
|
|
974
959
|
breaks,
|
|
975
|
-
trackings,
|
|
976
|
-
wordSpacings,
|
|
977
|
-
leadings,
|
|
978
960
|
overflows,
|
|
979
961
|
outline,
|
|
980
962
|
appearance,
|
|
@@ -982,14 +964,8 @@ const rules = [
|
|
|
982
964
|
positions,
|
|
983
965
|
orders,
|
|
984
966
|
justifies,
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
alignContents,
|
|
988
|
-
alignItems,
|
|
989
|
-
alignSelfs,
|
|
990
|
-
placeContents,
|
|
991
|
-
placeItems,
|
|
992
|
-
placeSelfs,
|
|
967
|
+
alignments,
|
|
968
|
+
placements,
|
|
993
969
|
insets,
|
|
994
970
|
floats,
|
|
995
971
|
zIndexes,
|
|
@@ -999,4 +975,4 @@ const rules = [
|
|
|
999
975
|
questionMark
|
|
1000
976
|
].flat(1);
|
|
1001
977
|
|
|
1002
|
-
export {
|
|
978
|
+
export { tabSizes as $, floats as A, zIndexes as B, boxSizing as C, questionMark as D, rings as E, boxShadows as F, sizes as G, aspectRatio as H, paddings as I, margins as J, varEmpty as K, displays as L, appearances as M, cursors as N, pointerEvents as O, resizes as P, userSelects as Q, whitespaces as R, contents as S, breaks as T, textOverflows as U, textTransforms as V, fontStyles as W, fontSmoothings as X, transforms as Y, transitions as Z, fonts as _, appearance as a, textIndents as a0, textStrokes as a1, textShadows as a2, cssVariables as a3, textDecorations as a4, borders as b, parseColorUtil as c, colorResolver$1 as d, opacity as e, textColors as f, bgColors as g, borderColors as h, ringColors as i, ringOffsetColors as j, fillColors as k, flex as l, gaps as m, grids as n, outline as o, placeholder as p, overflows as q, rules as r, positions as s, textAligns as t, justifies as u, verticalAligns as v, orders as w, alignments as x, placements as y, insets as z };
|
package/dist/chunks/index.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const core = require('@unocss/core');
|
|
4
|
+
|
|
3
5
|
const directionMap = {
|
|
4
6
|
"l": ["-left"],
|
|
5
7
|
"r": ["-right"],
|
|
@@ -111,7 +113,7 @@ function global(str) {
|
|
|
111
113
|
return str;
|
|
112
114
|
}
|
|
113
115
|
|
|
114
|
-
const
|
|
116
|
+
const valueHandlers = {
|
|
115
117
|
__proto__: null,
|
|
116
118
|
rem: rem,
|
|
117
119
|
px: px,
|
|
@@ -124,51 +126,17 @@ const handlers = {
|
|
|
124
126
|
global: global
|
|
125
127
|
};
|
|
126
128
|
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
const s = this.__options?.sequence || [];
|
|
130
|
-
this.__options.sequence = [];
|
|
131
|
-
for (const n of s) {
|
|
132
|
-
const res = handlers[n](str);
|
|
133
|
-
if (res != null)
|
|
134
|
-
return res;
|
|
135
|
-
}
|
|
136
|
-
return void 0;
|
|
137
|
-
};
|
|
138
|
-
function addProcessor(that, name) {
|
|
139
|
-
if (!that.__options) {
|
|
140
|
-
that.__options = {
|
|
141
|
-
sequence: []
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
that.__options.sequence.push(name);
|
|
145
|
-
return that;
|
|
146
|
-
}
|
|
147
|
-
handlersNames.forEach((i) => {
|
|
148
|
-
Object.defineProperty(handler, i, {
|
|
149
|
-
enumerable: true,
|
|
150
|
-
get() {
|
|
151
|
-
return addProcessor(this, i);
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
});
|
|
129
|
+
const handler = core.createValueHandler(valueHandlers);
|
|
130
|
+
const h = handler;
|
|
155
131
|
|
|
156
132
|
function capitalize(str) {
|
|
157
133
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
158
134
|
}
|
|
159
135
|
|
|
160
|
-
exports.bracket = bracket;
|
|
161
136
|
exports.capitalize = capitalize;
|
|
162
137
|
exports.cornerMap = cornerMap;
|
|
163
|
-
exports.cssvar = cssvar;
|
|
164
138
|
exports.directionMap = directionMap;
|
|
165
|
-
exports.
|
|
166
|
-
exports.global = global;
|
|
139
|
+
exports.h = h;
|
|
167
140
|
exports.handler = handler;
|
|
168
|
-
exports.
|
|
169
|
-
exports.number = number;
|
|
170
|
-
exports.percent = percent;
|
|
171
|
-
exports.px = px;
|
|
172
|
-
exports.rem = rem;
|
|
173
|
-
exports.time = time;
|
|
141
|
+
exports.valueHandlers = valueHandlers;
|
|
174
142
|
exports.xyzMap = xyzMap;
|