@unocss/preset-mini 0.20.2 → 0.20.4
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 +102 -71
- package/dist/chunks/default2.mjs +103 -72
- package/dist/chunks/default3.cjs +0 -12
- package/dist/chunks/default3.mjs +1 -12
- package/dist/chunks/pseudo.cjs +9 -6
- package/dist/chunks/pseudo.mjs +9 -6
- package/dist/chunks/utilities.cjs +44 -19
- package/dist/chunks/utilities.mjs +44 -20
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +3 -2
- package/dist/utils.mjs +1 -1
- package/dist/variants.cjs +0 -1
- package/dist/variants.d.ts +1 -2
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
package/dist/chunks/default2.cjs
CHANGED
|
@@ -38,27 +38,27 @@ const willChange = [
|
|
|
38
38
|
];
|
|
39
39
|
|
|
40
40
|
const borders = [
|
|
41
|
-
[/^border
|
|
42
|
-
[/^(?:border|b)()
|
|
43
|
-
[/^(?:border|b)-([
|
|
44
|
-
[/^(?:border|b)()
|
|
45
|
-
[/^(?:border|b)-([
|
|
46
|
-
[/^(?:border|b)()-(.+)$/,
|
|
47
|
-
[/^(?:border|b)-(
|
|
48
|
-
[/^(?:border|b)-
|
|
49
|
-
[/^(?:border|b)-([
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
[/^(?:border-)?(?:rounded|rd)
|
|
56
|
-
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
57
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
|
|
41
|
+
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
|
|
42
|
+
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
43
|
+
[/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
|
|
44
|
+
[/^(?:border|b)-()size-(.+)$/, handlerBorderSize],
|
|
45
|
+
[/^(?:border|b)-([xy])-size-(.+)$/, handlerBorderSize],
|
|
46
|
+
[/^(?:border|b)-([rltbse])-size-(.+)$/, handlerBorderSize],
|
|
47
|
+
[/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
|
|
48
|
+
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
49
|
+
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
50
|
+
[/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
51
|
+
[/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
52
|
+
[/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
53
|
+
[/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
|
|
54
|
+
[/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
|
|
55
|
+
[/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
|
|
56
|
+
[/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
|
|
58
57
|
["border-solid", { "border-style": "solid" }],
|
|
59
58
|
["border-dashed", { "border-style": "dashed" }],
|
|
60
59
|
["border-dotted", { "border-style": "dotted" }],
|
|
61
60
|
["border-double", { "border-style": "double" }],
|
|
61
|
+
["border-hidden", { "border-style": "hidden" }],
|
|
62
62
|
["border-none", { "border-style": "none" }]
|
|
63
63
|
];
|
|
64
64
|
const borderHasColor = (color, { theme }) => {
|
|
@@ -105,22 +105,25 @@ function handlerBorder(m) {
|
|
|
105
105
|
];
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function handlerBorderSize([, a, b]) {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return utilities.directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
108
|
+
function handlerBorderSize([, a = "", b = "1"]) {
|
|
109
|
+
const v = utilities.handler.bracket.px(b);
|
|
110
|
+
if (a in utilities.directionMap && v != null)
|
|
111
|
+
return utilities.directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
113
112
|
}
|
|
114
|
-
function handlerBorderColor([, a, c], ctx) {
|
|
115
|
-
if (borderHasColor(c, ctx)) {
|
|
116
|
-
return Object.assign({}, ...utilities.directionMap[
|
|
113
|
+
function handlerBorderColor([, a = "", c], ctx) {
|
|
114
|
+
if (a in utilities.directionMap && borderHasColor(c, ctx)) {
|
|
115
|
+
return Object.assign({}, ...utilities.directionMap[a].map((i) => borderColorResolver(i)(["", c], ctx)));
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
function
|
|
120
|
-
const
|
|
118
|
+
function handlerBorderOpacity([, a = "", opacity]) {
|
|
119
|
+
const v = utilities.handler.bracket.percent(opacity);
|
|
120
|
+
if (a in utilities.directionMap && v != null)
|
|
121
|
+
return utilities.directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
|
|
122
|
+
}
|
|
123
|
+
function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
|
|
121
124
|
const v = theme.borderRadius?.[s] || utilities.handler.auto.rem.fraction.bracket.cssvar(s);
|
|
122
|
-
if (v
|
|
123
|
-
return utilities.cornerMap[
|
|
125
|
+
if (a in utilities.cornerMap && v != null)
|
|
126
|
+
return utilities.cornerMap[a].map((i) => [`border${i}-radius`, v]);
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
const opacity = [
|
|
@@ -135,12 +138,19 @@ const bgColors = [
|
|
|
135
138
|
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utilities.handler.bracket.percent(opacity2) })]
|
|
136
139
|
];
|
|
137
140
|
|
|
141
|
+
const transitionPropertyGroup = {
|
|
142
|
+
all: "all",
|
|
143
|
+
colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
|
|
144
|
+
opacity: "opacity",
|
|
145
|
+
shadow: "box-shadow",
|
|
146
|
+
transform: "transform"
|
|
147
|
+
};
|
|
138
148
|
const transitionProperty = (prop) => {
|
|
139
|
-
return utilities.handler.properties(prop)
|
|
149
|
+
return utilities.handler.properties(prop) ?? transitionPropertyGroup[prop];
|
|
140
150
|
};
|
|
141
151
|
const transitions = [
|
|
142
|
-
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop
|
|
143
|
-
const p = transitionProperty(prop);
|
|
152
|
+
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
|
|
153
|
+
const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
|
|
144
154
|
if (p) {
|
|
145
155
|
return {
|
|
146
156
|
"transition-property": p,
|
|
@@ -149,14 +159,14 @@ const transitions = [
|
|
|
149
159
|
};
|
|
150
160
|
}
|
|
151
161
|
}],
|
|
152
|
-
[/^
|
|
162
|
+
[/^(?:transition-)?delay-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-delay": utilities.handler.bracket.time(d) })],
|
|
163
|
+
[/^(?:transition-)?duration-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-duration": utilities.handler.bracket.time(d) })],
|
|
164
|
+
[/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": utilities.handler.bracket(d) })],
|
|
153
165
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
154
166
|
["ease-linear", { "transition-timing-function": "linear" }],
|
|
155
167
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
156
168
|
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
157
169
|
["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
158
|
-
[/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
|
|
159
|
-
[/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
|
|
160
170
|
[/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": utilities.handler.global(v) || transitionProperty(v) })],
|
|
161
171
|
["transition-property-none", { "transition-property": "none" }],
|
|
162
172
|
["property-none", { "transition-property": "none" }],
|
|
@@ -176,6 +186,7 @@ const flex = [
|
|
|
176
186
|
["flex-shrink-0", { "flex-shrink": 0 }],
|
|
177
187
|
["flex-grow", { "flex-grow": 1 }],
|
|
178
188
|
["flex-grow-0", { "flex-grow": 0 }],
|
|
189
|
+
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": utilities.handler.bracket.fraction.auto.rem(d) })],
|
|
179
190
|
["flex-row", { "flex-direction": "row" }],
|
|
180
191
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
181
192
|
["flex-col", { "flex-direction": "column" }],
|
|
@@ -243,19 +254,21 @@ const textShadows = [
|
|
|
243
254
|
|
|
244
255
|
const directions = {
|
|
245
256
|
"": "",
|
|
246
|
-
"x
|
|
247
|
-
"y
|
|
257
|
+
"x": "column-",
|
|
258
|
+
"y": "row-"
|
|
259
|
+
};
|
|
260
|
+
const handleGap = ([, d = "", s]) => {
|
|
261
|
+
const v = utilities.handler.bracket.auto.rem(s);
|
|
262
|
+
if (v != null) {
|
|
263
|
+
return {
|
|
264
|
+
[`grid-${directions[d]}gap`]: v,
|
|
265
|
+
[`${directions[d]}gap`]: v
|
|
266
|
+
};
|
|
267
|
+
}
|
|
248
268
|
};
|
|
249
269
|
const gaps = [
|
|
250
|
-
[/^(?:flex-|grid-)?gap-(
|
|
251
|
-
|
|
252
|
-
if (v != null) {
|
|
253
|
-
return {
|
|
254
|
-
[`grid-${directions[d]}gap`]: v,
|
|
255
|
-
[`${directions[d]}gap`]: v
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
}]
|
|
270
|
+
[/^(?:flex-|grid-)?gap-()([^-]+)$/, handleGap],
|
|
271
|
+
[/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
|
|
259
272
|
];
|
|
260
273
|
|
|
261
274
|
const calSize = (s, theme) => core.toArray(theme.fontSize?.[s] || utilities.handler.bracket.auto.rem(s))[0];
|
|
@@ -313,7 +326,6 @@ const overflows = [
|
|
|
313
326
|
[/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
|
|
314
327
|
];
|
|
315
328
|
|
|
316
|
-
const basicSet = ["auto", "start", "end", "center", "stretch"];
|
|
317
329
|
const positions = [
|
|
318
330
|
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
|
|
319
331
|
[/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
|
|
@@ -325,8 +337,15 @@ const justifies = [
|
|
|
325
337
|
["justify-between", { "justify-content": "space-between" }],
|
|
326
338
|
["justify-around", { "justify-content": "space-around" }],
|
|
327
339
|
["justify-evenly", { "justify-content": "space-evenly" }],
|
|
328
|
-
|
|
329
|
-
|
|
340
|
+
["justify-items-start", { "justify-items": "start" }],
|
|
341
|
+
["justify-items-end", { "justify-items": "end" }],
|
|
342
|
+
["justify-items-center", { "justify-items": "center" }],
|
|
343
|
+
["justify-items-stretch", { "justify-items": "stretch" }],
|
|
344
|
+
["justify-self-auto", { "justify-self": "auto" }],
|
|
345
|
+
["justify-self-start", { "justify-self": "start" }],
|
|
346
|
+
["justify-self-end", { "justify-self": "end" }],
|
|
347
|
+
["justify-self-center", { "justify-self": "center" }],
|
|
348
|
+
["justify-self-stretch", { "justify-self": "stretch" }]
|
|
330
349
|
];
|
|
331
350
|
const orders = [
|
|
332
351
|
[/^order-(.+)$/, ([, v]) => ({ order: utilities.handler.bracket.number(v) })],
|
|
@@ -335,9 +354,9 @@ const orders = [
|
|
|
335
354
|
["order-none", { order: "0" }]
|
|
336
355
|
];
|
|
337
356
|
const alignments = [
|
|
357
|
+
["content-center", { "align-content": "center" }],
|
|
338
358
|
["content-start", { "align-content": "flex-start" }],
|
|
339
359
|
["content-end", { "align-content": "flex-end" }],
|
|
340
|
-
["content-center", { "align-content": "center" }],
|
|
341
360
|
["content-between", { "align-content": "space-between" }],
|
|
342
361
|
["content-around", { "align-content": "space-around" }],
|
|
343
362
|
["content-evenly", { "align-content": "space-evenly" }],
|
|
@@ -350,29 +369,39 @@ const alignments = [
|
|
|
350
369
|
["self-start", { "align-self": "flex-start" }],
|
|
351
370
|
["self-end", { "align-self": "flex-end" }],
|
|
352
371
|
["self-center", { "align-self": "center" }],
|
|
353
|
-
["self-stretch", { "align-self": "stretch" }]
|
|
372
|
+
["self-stretch", { "align-self": "stretch" }],
|
|
373
|
+
["self-baseline", { "align-self": "baseline" }]
|
|
354
374
|
];
|
|
355
375
|
const placements = [
|
|
376
|
+
["place-content-center", { "place-content": "center" }],
|
|
356
377
|
["place-content-start", { "place-content": "start" }],
|
|
357
378
|
["place-content-end", { "place-content": "end" }],
|
|
358
|
-
["place-content-center", { "place-content": "center" }],
|
|
359
379
|
["place-content-between", { "place-content": "space-between" }],
|
|
360
380
|
["place-content-around", { "place-content": "space-around" }],
|
|
361
381
|
["place-content-evenly", { "place-content": "space-evenly" }],
|
|
362
382
|
["place-content-stretch", { "place-content": "stretch" }],
|
|
363
|
-
|
|
364
|
-
|
|
383
|
+
["place-items-start", { "place-items": "start" }],
|
|
384
|
+
["place-items-end", { "place-items": "end" }],
|
|
385
|
+
["place-items-center", { "place-items": "center" }],
|
|
386
|
+
["place-items-stretch", { "place-items": "stretch" }],
|
|
387
|
+
["place-self-auto", { "place-self": "auto" }],
|
|
388
|
+
["place-self-start", { "place-self": "start" }],
|
|
389
|
+
["place-self-end", { "place-self": "end" }],
|
|
390
|
+
["place-self-center", { "place-self": "center" }],
|
|
391
|
+
["place-self-stretch", { "place-self": "stretch" }]
|
|
365
392
|
];
|
|
366
393
|
function handleInsetValue(v) {
|
|
367
394
|
return { auto: "auto", full: "100%" }[v] ?? utilities.handler.bracket.fraction.cssvar.auto.rem(v);
|
|
368
395
|
}
|
|
396
|
+
function handleInsetValues([, d, v]) {
|
|
397
|
+
const r = handleInsetValue(v);
|
|
398
|
+
if (r != null && d in utilities.directionMap)
|
|
399
|
+
return utilities.directionMap[d].map((i) => [i.slice(1), r]);
|
|
400
|
+
}
|
|
369
401
|
const insets = [
|
|
370
|
-
[/^(?:position-|pos-)?
|
|
371
|
-
[/^(?:position-|pos-)?inset-([xy])-(.+)$/,
|
|
372
|
-
|
|
373
|
-
if (r != null && d in utilities.directionMap)
|
|
374
|
-
return utilities.directionMap[d].map((i) => [i.slice(1), r]);
|
|
375
|
-
}]
|
|
402
|
+
[/^(?:position-|pos-)?inset-()(.+)$/, handleInsetValues],
|
|
403
|
+
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
404
|
+
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
376
405
|
];
|
|
377
406
|
const floats = [
|
|
378
407
|
["float-left", { float: "left" }],
|
|
@@ -545,8 +574,18 @@ const sizes = [
|
|
|
545
574
|
}]
|
|
546
575
|
];
|
|
547
576
|
const aspectRatio = [
|
|
548
|
-
[
|
|
549
|
-
|
|
577
|
+
[/^aspect-(?:ratio-)?(.+)$/, ([, d]) => {
|
|
578
|
+
if (/^\d+\/\d+$/.test(d))
|
|
579
|
+
return { "aspect-ratio": d };
|
|
580
|
+
const v = {
|
|
581
|
+
auto: "auto",
|
|
582
|
+
square: "1/1",
|
|
583
|
+
video: "16/9"
|
|
584
|
+
}[d];
|
|
585
|
+
if (v != null)
|
|
586
|
+
return { "aspect-ratio": v };
|
|
587
|
+
return { "aspect-ratio": utilities.handler.bracket.cssvar.number(d) };
|
|
588
|
+
}]
|
|
550
589
|
];
|
|
551
590
|
|
|
552
591
|
const paddings = [
|
|
@@ -594,15 +633,7 @@ const transforms = [
|
|
|
594
633
|
["transform-gpu", transformGpu],
|
|
595
634
|
["transform-cpu", transformCpu],
|
|
596
635
|
["transform-none", { transform: "none" }],
|
|
597
|
-
[
|
|
598
|
-
["origin-top", { "transform-origin": "top" }],
|
|
599
|
-
["origin-top-right", { "transform-origin": "top right" }],
|
|
600
|
-
["origin-right", { "transform-origin": "right" }],
|
|
601
|
-
["origin-bottom-right", { "transform-origin": "bottom right" }],
|
|
602
|
-
["origin-bottom", { "transform-origin": "bottom" }],
|
|
603
|
-
["origin-bottom-left", { "transform-origin": "bottom left" }],
|
|
604
|
-
["origin-left", { "transform-origin": "left" }],
|
|
605
|
-
["origin-top-left", { "transform-origin": "top left" }]
|
|
636
|
+
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": utilities.positionMap[s] })]
|
|
606
637
|
];
|
|
607
638
|
function handleTranslate([, d, b]) {
|
|
608
639
|
const v = utilities.handler.bracket.fraction.auto.rem(b);
|
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap, b as capitalize, e as directionSize, x as xyzMap } from './utilities.mjs';
|
|
1
|
+
import { h as handler, c as colorResolver, d as directionMap, p as parseColor, a as cornerMap, b as capitalize, e as directionSize, f as positionMap, x as xyzMap } from './utilities.mjs';
|
|
2
2
|
import { toArray } from '@unocss/core';
|
|
3
3
|
import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
|
|
4
4
|
|
|
@@ -36,27 +36,27 @@ const willChange = [
|
|
|
36
36
|
];
|
|
37
37
|
|
|
38
38
|
const borders = [
|
|
39
|
-
[/^border
|
|
40
|
-
[/^(?:border|b)()
|
|
41
|
-
[/^(?:border|b)-([
|
|
42
|
-
[/^(?:border|b)()
|
|
43
|
-
[/^(?:border|b)-([
|
|
44
|
-
[/^(?:border|b)()-(.+)$/,
|
|
45
|
-
[/^(?:border|b)-(
|
|
46
|
-
[/^(?:border|b)-
|
|
47
|
-
[/^(?:border|b)-([
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
[/^(?:border-)?(?:rounded|rd)
|
|
54
|
-
[/^(?:border-)?(?:rounded|rd)(?:-(.+))?$/, handlerRounded],
|
|
55
|
-
[/^(?:border-)?(?:rounded|rd)(?:-([^-]+))?(?:-(.+))?$/, handlerRounded],
|
|
39
|
+
[/^(?:border|b)()(?:-(.+))?$/, handlerBorder],
|
|
40
|
+
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorder],
|
|
41
|
+
[/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorder],
|
|
42
|
+
[/^(?:border|b)-()size-(.+)$/, handlerBorderSize],
|
|
43
|
+
[/^(?:border|b)-([xy])-size-(.+)$/, handlerBorderSize],
|
|
44
|
+
[/^(?:border|b)-([rltbse])-size-(.+)$/, handlerBorderSize],
|
|
45
|
+
[/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColor],
|
|
46
|
+
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
47
|
+
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColor],
|
|
48
|
+
[/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
49
|
+
[/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
50
|
+
[/^(?:border|b)-([rltbse])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
51
|
+
[/^(?:border-)?(?:rounded|rd)()(?:-(.+))?$/, handlerRounded],
|
|
52
|
+
[/^(?:border-)?(?:rounded|rd)-([xy])(?:-(.+))?$/, handlerRounded],
|
|
53
|
+
[/^(?:border-)?(?:rounded|rd)-([rltb])(?:-(.+))?$/, handlerRounded],
|
|
54
|
+
[/^(?:border-)?(?:rounded|rd)-([rltb]{2})(?:-(.+))?$/, handlerRounded],
|
|
56
55
|
["border-solid", { "border-style": "solid" }],
|
|
57
56
|
["border-dashed", { "border-style": "dashed" }],
|
|
58
57
|
["border-dotted", { "border-style": "dotted" }],
|
|
59
58
|
["border-double", { "border-style": "double" }],
|
|
59
|
+
["border-hidden", { "border-style": "hidden" }],
|
|
60
60
|
["border-none", { "border-style": "none" }]
|
|
61
61
|
];
|
|
62
62
|
const borderHasColor = (color, { theme }) => {
|
|
@@ -103,22 +103,25 @@ function handlerBorder(m) {
|
|
|
103
103
|
];
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function handlerBorderSize([, a, b]) {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return directionMap[d].map((i) => [`border${i}-width`, v]);
|
|
106
|
+
function handlerBorderSize([, a = "", b = "1"]) {
|
|
107
|
+
const v = handler.bracket.px(b);
|
|
108
|
+
if (a in directionMap && v != null)
|
|
109
|
+
return directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
111
110
|
}
|
|
112
|
-
function handlerBorderColor([, a, c], ctx) {
|
|
113
|
-
if (borderHasColor(c, ctx)) {
|
|
114
|
-
return Object.assign({}, ...directionMap[
|
|
111
|
+
function handlerBorderColor([, a = "", c], ctx) {
|
|
112
|
+
if (a in directionMap && borderHasColor(c, ctx)) {
|
|
113
|
+
return Object.assign({}, ...directionMap[a].map((i) => borderColorResolver(i)(["", c], ctx)));
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
|
-
function
|
|
118
|
-
const
|
|
116
|
+
function handlerBorderOpacity([, a = "", opacity]) {
|
|
117
|
+
const v = handler.bracket.percent(opacity);
|
|
118
|
+
if (a in directionMap && v != null)
|
|
119
|
+
return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
|
|
120
|
+
}
|
|
121
|
+
function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
|
|
119
122
|
const v = theme.borderRadius?.[s] || handler.auto.rem.fraction.bracket.cssvar(s);
|
|
120
|
-
if (v
|
|
121
|
-
return cornerMap[
|
|
123
|
+
if (a in cornerMap && v != null)
|
|
124
|
+
return cornerMap[a].map((i) => [`border${i}-radius`, v]);
|
|
122
125
|
}
|
|
123
126
|
|
|
124
127
|
const opacity = [
|
|
@@ -133,12 +136,19 @@ const bgColors = [
|
|
|
133
136
|
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": handler.bracket.percent(opacity2) })]
|
|
134
137
|
];
|
|
135
138
|
|
|
139
|
+
const transitionPropertyGroup = {
|
|
140
|
+
all: "all",
|
|
141
|
+
colors: ["color", "background-color", "border-color", "text-decoration-color", "fill", "stroke"].join(","),
|
|
142
|
+
opacity: "opacity",
|
|
143
|
+
shadow: "box-shadow",
|
|
144
|
+
transform: "transform"
|
|
145
|
+
};
|
|
136
146
|
const transitionProperty = (prop) => {
|
|
137
|
-
return handler.properties(prop)
|
|
147
|
+
return handler.properties(prop) ?? transitionPropertyGroup[prop];
|
|
138
148
|
};
|
|
139
149
|
const transitions = [
|
|
140
|
-
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop
|
|
141
|
-
const p = transitionProperty(prop);
|
|
150
|
+
[/^transition(?:-([a-z-]+(?:,[a-z-]+)*))?(?:-(\d+))?$/, ([, prop, duration = "150"]) => {
|
|
151
|
+
const p = prop != null ? transitionProperty(prop) : [transitionPropertyGroup.colors, "opacity", "box-shadow", "transform", "filter", "backdrop-filter"].join(",");
|
|
142
152
|
if (p) {
|
|
143
153
|
return {
|
|
144
154
|
"transition-property": p,
|
|
@@ -147,14 +157,14 @@ const transitions = [
|
|
|
147
157
|
};
|
|
148
158
|
}
|
|
149
159
|
}],
|
|
150
|
-
[/^
|
|
160
|
+
[/^(?:transition-)?delay-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-delay": handler.bracket.time(d) })],
|
|
161
|
+
[/^(?:transition-)?duration-(.+)(?:s|ms)?$/, ([, d]) => ({ "transition-duration": handler.bracket.time(d) })],
|
|
162
|
+
[/^ease-(.+)$/, ([, d]) => ({ "transition-timing-function": handler.bracket(d) })],
|
|
151
163
|
["ease", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
152
164
|
["ease-linear", { "transition-timing-function": "linear" }],
|
|
153
165
|
["ease-in", { "transition-timing-function": "cubic-bezier(0.4, 0, 1, 1)" }],
|
|
154
166
|
["ease-out", { "transition-timing-function": "cubic-bezier(0, 0, 0.2, 1)" }],
|
|
155
167
|
["ease-in-out", { "transition-timing-function": "cubic-bezier(0.4, 0, 0.2, 1)" }],
|
|
156
|
-
[/^transition-delay-(\d+)$/, ([, v]) => ({ "transition-delay": `${v}ms` })],
|
|
157
|
-
[/^transition-duration-(\d+)$/, ([, v]) => ({ "transition-duration": `${v}ms` })],
|
|
158
168
|
[/^(?:transition-)?property-(.+)$/, ([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) })],
|
|
159
169
|
["transition-property-none", { "transition-property": "none" }],
|
|
160
170
|
["property-none", { "transition-property": "none" }],
|
|
@@ -174,6 +184,7 @@ const flex = [
|
|
|
174
184
|
["flex-shrink-0", { "flex-shrink": 0 }],
|
|
175
185
|
["flex-grow", { "flex-grow": 1 }],
|
|
176
186
|
["flex-grow-0", { "flex-grow": 0 }],
|
|
187
|
+
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.fraction.auto.rem(d) })],
|
|
177
188
|
["flex-row", { "flex-direction": "row" }],
|
|
178
189
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
179
190
|
["flex-col", { "flex-direction": "column" }],
|
|
@@ -241,19 +252,21 @@ const textShadows = [
|
|
|
241
252
|
|
|
242
253
|
const directions = {
|
|
243
254
|
"": "",
|
|
244
|
-
"x
|
|
245
|
-
"y
|
|
255
|
+
"x": "column-",
|
|
256
|
+
"y": "row-"
|
|
257
|
+
};
|
|
258
|
+
const handleGap = ([, d = "", s]) => {
|
|
259
|
+
const v = handler.bracket.auto.rem(s);
|
|
260
|
+
if (v != null) {
|
|
261
|
+
return {
|
|
262
|
+
[`grid-${directions[d]}gap`]: v,
|
|
263
|
+
[`${directions[d]}gap`]: v
|
|
264
|
+
};
|
|
265
|
+
}
|
|
246
266
|
};
|
|
247
267
|
const gaps = [
|
|
248
|
-
[/^(?:flex-|grid-)?gap-(
|
|
249
|
-
|
|
250
|
-
if (v != null) {
|
|
251
|
-
return {
|
|
252
|
-
[`grid-${directions[d]}gap`]: v,
|
|
253
|
-
[`${directions[d]}gap`]: v
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
}]
|
|
268
|
+
[/^(?:flex-|grid-)?gap-()([^-]+)$/, handleGap],
|
|
269
|
+
[/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
|
|
257
270
|
];
|
|
258
271
|
|
|
259
272
|
const calSize = (s, theme) => toArray(theme.fontSize?.[s] || handler.bracket.auto.rem(s))[0];
|
|
@@ -311,7 +324,6 @@ const overflows = [
|
|
|
311
324
|
[/^(?:overflow|of)-([xy])-(.+)$/, ([, d, v]) => overflowValues.includes(v) ? { [`overflow-${d}`]: v } : void 0]
|
|
312
325
|
];
|
|
313
326
|
|
|
314
|
-
const basicSet = ["auto", "start", "end", "center", "stretch"];
|
|
315
327
|
const positions = [
|
|
316
328
|
[/^(?:position-|pos-)?(relative|absolute|fixed|sticky)$/, ([, v]) => ({ position: v })],
|
|
317
329
|
[/^(?:position-|pos-)?(static)$/, ([, v]) => ({ position: v })]
|
|
@@ -323,8 +335,15 @@ const justifies = [
|
|
|
323
335
|
["justify-between", { "justify-content": "space-between" }],
|
|
324
336
|
["justify-around", { "justify-content": "space-around" }],
|
|
325
337
|
["justify-evenly", { "justify-content": "space-evenly" }],
|
|
326
|
-
|
|
327
|
-
|
|
338
|
+
["justify-items-start", { "justify-items": "start" }],
|
|
339
|
+
["justify-items-end", { "justify-items": "end" }],
|
|
340
|
+
["justify-items-center", { "justify-items": "center" }],
|
|
341
|
+
["justify-items-stretch", { "justify-items": "stretch" }],
|
|
342
|
+
["justify-self-auto", { "justify-self": "auto" }],
|
|
343
|
+
["justify-self-start", { "justify-self": "start" }],
|
|
344
|
+
["justify-self-end", { "justify-self": "end" }],
|
|
345
|
+
["justify-self-center", { "justify-self": "center" }],
|
|
346
|
+
["justify-self-stretch", { "justify-self": "stretch" }]
|
|
328
347
|
];
|
|
329
348
|
const orders = [
|
|
330
349
|
[/^order-(.+)$/, ([, v]) => ({ order: handler.bracket.number(v) })],
|
|
@@ -333,9 +352,9 @@ const orders = [
|
|
|
333
352
|
["order-none", { order: "0" }]
|
|
334
353
|
];
|
|
335
354
|
const alignments = [
|
|
355
|
+
["content-center", { "align-content": "center" }],
|
|
336
356
|
["content-start", { "align-content": "flex-start" }],
|
|
337
357
|
["content-end", { "align-content": "flex-end" }],
|
|
338
|
-
["content-center", { "align-content": "center" }],
|
|
339
358
|
["content-between", { "align-content": "space-between" }],
|
|
340
359
|
["content-around", { "align-content": "space-around" }],
|
|
341
360
|
["content-evenly", { "align-content": "space-evenly" }],
|
|
@@ -348,29 +367,39 @@ const alignments = [
|
|
|
348
367
|
["self-start", { "align-self": "flex-start" }],
|
|
349
368
|
["self-end", { "align-self": "flex-end" }],
|
|
350
369
|
["self-center", { "align-self": "center" }],
|
|
351
|
-
["self-stretch", { "align-self": "stretch" }]
|
|
370
|
+
["self-stretch", { "align-self": "stretch" }],
|
|
371
|
+
["self-baseline", { "align-self": "baseline" }]
|
|
352
372
|
];
|
|
353
373
|
const placements = [
|
|
374
|
+
["place-content-center", { "place-content": "center" }],
|
|
354
375
|
["place-content-start", { "place-content": "start" }],
|
|
355
376
|
["place-content-end", { "place-content": "end" }],
|
|
356
|
-
["place-content-center", { "place-content": "center" }],
|
|
357
377
|
["place-content-between", { "place-content": "space-between" }],
|
|
358
378
|
["place-content-around", { "place-content": "space-around" }],
|
|
359
379
|
["place-content-evenly", { "place-content": "space-evenly" }],
|
|
360
380
|
["place-content-stretch", { "place-content": "stretch" }],
|
|
361
|
-
|
|
362
|
-
|
|
381
|
+
["place-items-start", { "place-items": "start" }],
|
|
382
|
+
["place-items-end", { "place-items": "end" }],
|
|
383
|
+
["place-items-center", { "place-items": "center" }],
|
|
384
|
+
["place-items-stretch", { "place-items": "stretch" }],
|
|
385
|
+
["place-self-auto", { "place-self": "auto" }],
|
|
386
|
+
["place-self-start", { "place-self": "start" }],
|
|
387
|
+
["place-self-end", { "place-self": "end" }],
|
|
388
|
+
["place-self-center", { "place-self": "center" }],
|
|
389
|
+
["place-self-stretch", { "place-self": "stretch" }]
|
|
363
390
|
];
|
|
364
391
|
function handleInsetValue(v) {
|
|
365
392
|
return { auto: "auto", full: "100%" }[v] ?? handler.bracket.fraction.cssvar.auto.rem(v);
|
|
366
393
|
}
|
|
394
|
+
function handleInsetValues([, d, v]) {
|
|
395
|
+
const r = handleInsetValue(v);
|
|
396
|
+
if (r != null && d in directionMap)
|
|
397
|
+
return directionMap[d].map((i) => [i.slice(1), r]);
|
|
398
|
+
}
|
|
367
399
|
const insets = [
|
|
368
|
-
[/^(?:position-|pos-)?
|
|
369
|
-
[/^(?:position-|pos-)?inset-([xy])-(.+)$/,
|
|
370
|
-
|
|
371
|
-
if (r != null && d in directionMap)
|
|
372
|
-
return directionMap[d].map((i) => [i.slice(1), r]);
|
|
373
|
-
}]
|
|
400
|
+
[/^(?:position-|pos-)?inset-()(.+)$/, handleInsetValues],
|
|
401
|
+
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
402
|
+
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
374
403
|
];
|
|
375
404
|
const floats = [
|
|
376
405
|
["float-left", { float: "left" }],
|
|
@@ -543,8 +572,18 @@ const sizes = [
|
|
|
543
572
|
}]
|
|
544
573
|
];
|
|
545
574
|
const aspectRatio = [
|
|
546
|
-
[
|
|
547
|
-
|
|
575
|
+
[/^aspect-(?:ratio-)?(.+)$/, ([, d]) => {
|
|
576
|
+
if (/^\d+\/\d+$/.test(d))
|
|
577
|
+
return { "aspect-ratio": d };
|
|
578
|
+
const v = {
|
|
579
|
+
auto: "auto",
|
|
580
|
+
square: "1/1",
|
|
581
|
+
video: "16/9"
|
|
582
|
+
}[d];
|
|
583
|
+
if (v != null)
|
|
584
|
+
return { "aspect-ratio": v };
|
|
585
|
+
return { "aspect-ratio": handler.bracket.cssvar.number(d) };
|
|
586
|
+
}]
|
|
548
587
|
];
|
|
549
588
|
|
|
550
589
|
const paddings = [
|
|
@@ -592,15 +631,7 @@ const transforms = [
|
|
|
592
631
|
["transform-gpu", transformGpu],
|
|
593
632
|
["transform-cpu", transformCpu],
|
|
594
633
|
["transform-none", { transform: "none" }],
|
|
595
|
-
[
|
|
596
|
-
["origin-top", { "transform-origin": "top" }],
|
|
597
|
-
["origin-top-right", { "transform-origin": "top right" }],
|
|
598
|
-
["origin-right", { "transform-origin": "right" }],
|
|
599
|
-
["origin-bottom-right", { "transform-origin": "bottom right" }],
|
|
600
|
-
["origin-bottom", { "transform-origin": "bottom" }],
|
|
601
|
-
["origin-bottom-left", { "transform-origin": "bottom left" }],
|
|
602
|
-
["origin-left", { "transform-origin": "left" }],
|
|
603
|
-
["origin-top-left", { "transform-origin": "top left" }]
|
|
634
|
+
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })]
|
|
604
635
|
];
|
|
605
636
|
function handleTranslate([, d, b]) {
|
|
606
637
|
const v = handler.bracket.fraction.auto.rem(b);
|
package/dist/chunks/default3.cjs
CHANGED
|
@@ -103,16 +103,6 @@ const variantNegative = {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
const variantSpace = (matcher) => {
|
|
107
|
-
if (/^space-?([xy])-?(-?.+)$/.test(matcher) || /^divide-/.test(matcher)) {
|
|
108
|
-
return {
|
|
109
|
-
matcher,
|
|
110
|
-
selector: (input) => {
|
|
111
|
-
return `${input}>:not([hidden])~:not([hidden])`;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
106
|
|
|
117
107
|
const variantMotions = [
|
|
118
108
|
variants$1.variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
|
|
@@ -127,7 +117,6 @@ const variantOrientations = [
|
|
|
127
117
|
const variantPrint = variants$1.variantParentMatcher("print", "@media print");
|
|
128
118
|
|
|
129
119
|
const variants = [
|
|
130
|
-
variantSpace,
|
|
131
120
|
variantNegative,
|
|
132
121
|
variantImportant,
|
|
133
122
|
variantPrint,
|
|
@@ -153,5 +142,4 @@ exports.variantMotions = variantMotions;
|
|
|
153
142
|
exports.variantNegative = variantNegative;
|
|
154
143
|
exports.variantOrientations = variantOrientations;
|
|
155
144
|
exports.variantPrint = variantPrint;
|
|
156
|
-
exports.variantSpace = variantSpace;
|
|
157
145
|
exports.variants = variants;
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -101,16 +101,6 @@ const variantNegative = {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
const variantSpace = (matcher) => {
|
|
105
|
-
if (/^space-?([xy])-?(-?.+)$/.test(matcher) || /^divide-/.test(matcher)) {
|
|
106
|
-
return {
|
|
107
|
-
matcher,
|
|
108
|
-
selector: (input) => {
|
|
109
|
-
return `${input}>:not([hidden])~:not([hidden])`;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
104
|
|
|
115
105
|
const variantMotions = [
|
|
116
106
|
variantParentMatcher("motion-reduce", "@media (prefers-reduced-motion: reduce)"),
|
|
@@ -125,7 +115,6 @@ const variantOrientations = [
|
|
|
125
115
|
const variantPrint = variantParentMatcher("print", "@media print");
|
|
126
116
|
|
|
127
117
|
const variants = [
|
|
128
|
-
variantSpace,
|
|
129
118
|
variantNegative,
|
|
130
119
|
variantImportant,
|
|
131
120
|
variantPrint,
|
|
@@ -142,4 +131,4 @@ const variants = [
|
|
|
142
131
|
...variantLanguageDirections
|
|
143
132
|
];
|
|
144
133
|
|
|
145
|
-
export { variantBreakpoints as a, variantCombinators as b, variantColorsMediaOrClass as c, variantLanguageDirections as d, variantImportant as e, variantNegative as f,
|
|
134
|
+
export { variantBreakpoints as a, variantCombinators as b, variantColorsMediaOrClass as c, variantLanguageDirections as d, variantImportant as e, variantNegative as f, variantMotions as g, variantOrientations as h, variantPrint as i, variants as v };
|
package/dist/chunks/pseudo.cjs
CHANGED
|
@@ -42,25 +42,27 @@ const PseudoClasses = Object.fromEntries([
|
|
|
42
42
|
"only-child",
|
|
43
43
|
"only-of-type"
|
|
44
44
|
].map(core.toArray));
|
|
45
|
-
const PseudoElements = [
|
|
45
|
+
const PseudoElements = Object.fromEntries([
|
|
46
46
|
"placeholder",
|
|
47
47
|
"before",
|
|
48
48
|
"after",
|
|
49
49
|
"first-letter",
|
|
50
50
|
"first-line",
|
|
51
51
|
"selection",
|
|
52
|
-
"marker"
|
|
53
|
-
]
|
|
52
|
+
"marker",
|
|
53
|
+
["file", "::file-selector-button"]
|
|
54
|
+
].map(core.toArray));
|
|
54
55
|
const PseudoClassFunctions = [
|
|
55
56
|
"not",
|
|
56
57
|
"is",
|
|
57
58
|
"where",
|
|
58
59
|
"has"
|
|
59
60
|
];
|
|
60
|
-
const
|
|
61
|
-
const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
|
|
61
|
+
const PseudoElementsStr = Object.keys(PseudoElements).join("|");
|
|
62
62
|
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
63
63
|
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
64
|
+
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
65
|
+
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
64
66
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
65
67
|
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
66
68
|
function shouldAdd(entires) {
|
|
@@ -87,9 +89,10 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
87
89
|
const variantPseudoElements = (input) => {
|
|
88
90
|
const match = input.match(PseudoElementsRE);
|
|
89
91
|
if (match) {
|
|
92
|
+
const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
|
|
90
93
|
return {
|
|
91
94
|
matcher: input.slice(match[1].length + 1),
|
|
92
|
-
selector: (s) => `${s}
|
|
95
|
+
selector: (s) => `${s}${pseudo}`
|
|
93
96
|
};
|
|
94
97
|
}
|
|
95
98
|
};
|
package/dist/chunks/pseudo.mjs
CHANGED
|
@@ -40,25 +40,27 @@ const PseudoClasses = Object.fromEntries([
|
|
|
40
40
|
"only-child",
|
|
41
41
|
"only-of-type"
|
|
42
42
|
].map(toArray));
|
|
43
|
-
const PseudoElements = [
|
|
43
|
+
const PseudoElements = Object.fromEntries([
|
|
44
44
|
"placeholder",
|
|
45
45
|
"before",
|
|
46
46
|
"after",
|
|
47
47
|
"first-letter",
|
|
48
48
|
"first-line",
|
|
49
49
|
"selection",
|
|
50
|
-
"marker"
|
|
51
|
-
]
|
|
50
|
+
"marker",
|
|
51
|
+
["file", "::file-selector-button"]
|
|
52
|
+
].map(toArray));
|
|
52
53
|
const PseudoClassFunctions = [
|
|
53
54
|
"not",
|
|
54
55
|
"is",
|
|
55
56
|
"where",
|
|
56
57
|
"has"
|
|
57
58
|
];
|
|
58
|
-
const
|
|
59
|
-
const PseudoElementsRE = new RegExp(`^(${PseudoElements.join("|")})[:-]`);
|
|
59
|
+
const PseudoElementsStr = Object.keys(PseudoElements).join("|");
|
|
60
60
|
const PseudoClassesStr = Object.keys(PseudoClasses).join("|");
|
|
61
61
|
const PseudoClassFunctionsStr = PseudoClassFunctions.join("|");
|
|
62
|
+
const PartClassesRE = /(part-\[(.+)]:)(.+)/;
|
|
63
|
+
const PseudoElementsRE = new RegExp(`^(${PseudoElementsStr})[:-]`);
|
|
62
64
|
const PseudoClassesRE = new RegExp(`^(${PseudoClassesStr})[:-]`);
|
|
63
65
|
const PseudoClassFunctionsRE = new RegExp(`^(${PseudoClassFunctionsStr})-(${PseudoClassesStr})[:-]`);
|
|
64
66
|
function shouldAdd(entires) {
|
|
@@ -85,9 +87,10 @@ const taggedPseudoClassMatcher = (tag, parent, combinator) => {
|
|
|
85
87
|
const variantPseudoElements = (input) => {
|
|
86
88
|
const match = input.match(PseudoElementsRE);
|
|
87
89
|
if (match) {
|
|
90
|
+
const pseudo = PseudoElements[match[1]] || `::${match[1]}`;
|
|
88
91
|
return {
|
|
89
92
|
matcher: input.slice(match[1].length + 1),
|
|
90
|
-
selector: (s) => `${s}
|
|
93
|
+
selector: (s) => `${s}${pseudo}`
|
|
91
94
|
};
|
|
92
95
|
}
|
|
93
96
|
};
|
|
@@ -35,6 +35,31 @@ const xyzMap = {
|
|
|
35
35
|
"z": ["-z"],
|
|
36
36
|
"": ["-x", "-y"]
|
|
37
37
|
};
|
|
38
|
+
const basePositionMap = [
|
|
39
|
+
"top",
|
|
40
|
+
"top center",
|
|
41
|
+
"top left",
|
|
42
|
+
"top right",
|
|
43
|
+
"bottom",
|
|
44
|
+
"bottom center",
|
|
45
|
+
"bottom left",
|
|
46
|
+
"bottom right",
|
|
47
|
+
"left",
|
|
48
|
+
"left center",
|
|
49
|
+
"left top",
|
|
50
|
+
"left bottom",
|
|
51
|
+
"right",
|
|
52
|
+
"right center",
|
|
53
|
+
"right top",
|
|
54
|
+
"right bottom",
|
|
55
|
+
"center",
|
|
56
|
+
"center top",
|
|
57
|
+
"center bottom",
|
|
58
|
+
"center left",
|
|
59
|
+
"center right",
|
|
60
|
+
"center center"
|
|
61
|
+
];
|
|
62
|
+
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
38
63
|
|
|
39
64
|
const cssBasicProps = [
|
|
40
65
|
"color",
|
|
@@ -93,13 +118,17 @@ const cssProps = [
|
|
|
93
118
|
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
94
119
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
95
120
|
const unitOnlyRE = /^(px)$/i;
|
|
121
|
+
function round(n) {
|
|
122
|
+
return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
|
|
123
|
+
}
|
|
96
124
|
function numberWithUnit(str) {
|
|
97
125
|
const match = str.match(numberWithUnitRE);
|
|
98
126
|
if (!match)
|
|
99
127
|
return;
|
|
100
|
-
const [, , unit] = match;
|
|
101
|
-
|
|
102
|
-
|
|
128
|
+
const [, n, unit] = match;
|
|
129
|
+
const num = parseFloat(n);
|
|
130
|
+
if (unit && !Number.isNaN(num))
|
|
131
|
+
return `${round(num)}${unit}`;
|
|
103
132
|
}
|
|
104
133
|
function auto(str) {
|
|
105
134
|
if (str === "auto" || str === "a")
|
|
@@ -112,11 +141,9 @@ function rem(str) {
|
|
|
112
141
|
if (!match)
|
|
113
142
|
return;
|
|
114
143
|
const [, n, unit] = match;
|
|
115
|
-
if (unit)
|
|
116
|
-
return str;
|
|
117
144
|
const num = parseFloat(n);
|
|
118
145
|
if (!Number.isNaN(num))
|
|
119
|
-
return `${num / 4}rem`;
|
|
146
|
+
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
120
147
|
}
|
|
121
148
|
function px(str) {
|
|
122
149
|
if (str.match(unitOnlyRE))
|
|
@@ -125,25 +152,23 @@ function px(str) {
|
|
|
125
152
|
if (!match)
|
|
126
153
|
return;
|
|
127
154
|
const [, n, unit] = match;
|
|
128
|
-
if (unit)
|
|
129
|
-
return str;
|
|
130
155
|
const num = parseFloat(n);
|
|
131
156
|
if (!Number.isNaN(num))
|
|
132
|
-
return `${num}px`;
|
|
157
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
133
158
|
}
|
|
134
159
|
function number(str) {
|
|
135
160
|
if (!numberRE.test(str))
|
|
136
161
|
return;
|
|
137
162
|
const num = parseFloat(str);
|
|
138
163
|
if (!Number.isNaN(num))
|
|
139
|
-
return num;
|
|
164
|
+
return round(num);
|
|
140
165
|
}
|
|
141
166
|
function percent(str) {
|
|
142
167
|
if (str.endsWith("%"))
|
|
143
168
|
str = str.slice(0, -1);
|
|
144
169
|
const num = parseFloat(str);
|
|
145
170
|
if (!Number.isNaN(num))
|
|
146
|
-
return `${num / 100}`;
|
|
171
|
+
return `${round(num / 100)}`;
|
|
147
172
|
}
|
|
148
173
|
function fraction(str) {
|
|
149
174
|
if (str === "full")
|
|
@@ -151,7 +176,7 @@ function fraction(str) {
|
|
|
151
176
|
const [left, right] = str.split("/");
|
|
152
177
|
const num = parseFloat(left) / parseFloat(right);
|
|
153
178
|
if (!Number.isNaN(num))
|
|
154
|
-
return `${num * 100}%`;
|
|
179
|
+
return `${round(num * 100)}%`;
|
|
155
180
|
}
|
|
156
181
|
function bracket(str) {
|
|
157
182
|
if (str && str[0] === "[" && str[str.length - 1] === "]") {
|
|
@@ -165,20 +190,19 @@ function cssvar(str) {
|
|
|
165
190
|
return `var(--${str.slice(1)})`;
|
|
166
191
|
}
|
|
167
192
|
function time(str) {
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
193
|
+
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
194
|
+
if (!match)
|
|
170
195
|
return;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
196
|
+
const [, n, unit] = match;
|
|
197
|
+
const num = parseFloat(n);
|
|
198
|
+
if (!Number.isNaN(num))
|
|
199
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
174
200
|
}
|
|
175
201
|
function global(str) {
|
|
176
202
|
if (["inherit", "initial", "revert", "unset"].includes(str))
|
|
177
203
|
return str;
|
|
178
204
|
}
|
|
179
205
|
function properties(str) {
|
|
180
|
-
if (str === void 0)
|
|
181
|
-
return;
|
|
182
206
|
for (const prop of str.split(",")) {
|
|
183
207
|
if (!cssProps.includes(prop))
|
|
184
208
|
return;
|
|
@@ -301,5 +325,6 @@ exports.directionSize = directionSize;
|
|
|
301
325
|
exports.h = h;
|
|
302
326
|
exports.handler = handler;
|
|
303
327
|
exports.parseColor = parseColor;
|
|
328
|
+
exports.positionMap = positionMap;
|
|
304
329
|
exports.valueHandlers = valueHandlers;
|
|
305
330
|
exports.xyzMap = xyzMap;
|
|
@@ -33,6 +33,31 @@ const xyzMap = {
|
|
|
33
33
|
"z": ["-z"],
|
|
34
34
|
"": ["-x", "-y"]
|
|
35
35
|
};
|
|
36
|
+
const basePositionMap = [
|
|
37
|
+
"top",
|
|
38
|
+
"top center",
|
|
39
|
+
"top left",
|
|
40
|
+
"top right",
|
|
41
|
+
"bottom",
|
|
42
|
+
"bottom center",
|
|
43
|
+
"bottom left",
|
|
44
|
+
"bottom right",
|
|
45
|
+
"left",
|
|
46
|
+
"left center",
|
|
47
|
+
"left top",
|
|
48
|
+
"left bottom",
|
|
49
|
+
"right",
|
|
50
|
+
"right center",
|
|
51
|
+
"right top",
|
|
52
|
+
"right bottom",
|
|
53
|
+
"center",
|
|
54
|
+
"center top",
|
|
55
|
+
"center bottom",
|
|
56
|
+
"center left",
|
|
57
|
+
"center right",
|
|
58
|
+
"center center"
|
|
59
|
+
];
|
|
60
|
+
const positionMap = Object.assign({}, ...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), ...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })));
|
|
36
61
|
|
|
37
62
|
const cssBasicProps = [
|
|
38
63
|
"color",
|
|
@@ -91,13 +116,17 @@ const cssProps = [
|
|
|
91
116
|
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
92
117
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
93
118
|
const unitOnlyRE = /^(px)$/i;
|
|
119
|
+
function round(n) {
|
|
120
|
+
return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
|
|
121
|
+
}
|
|
94
122
|
function numberWithUnit(str) {
|
|
95
123
|
const match = str.match(numberWithUnitRE);
|
|
96
124
|
if (!match)
|
|
97
125
|
return;
|
|
98
|
-
const [, , unit] = match;
|
|
99
|
-
|
|
100
|
-
|
|
126
|
+
const [, n, unit] = match;
|
|
127
|
+
const num = parseFloat(n);
|
|
128
|
+
if (unit && !Number.isNaN(num))
|
|
129
|
+
return `${round(num)}${unit}`;
|
|
101
130
|
}
|
|
102
131
|
function auto(str) {
|
|
103
132
|
if (str === "auto" || str === "a")
|
|
@@ -110,11 +139,9 @@ function rem(str) {
|
|
|
110
139
|
if (!match)
|
|
111
140
|
return;
|
|
112
141
|
const [, n, unit] = match;
|
|
113
|
-
if (unit)
|
|
114
|
-
return str;
|
|
115
142
|
const num = parseFloat(n);
|
|
116
143
|
if (!Number.isNaN(num))
|
|
117
|
-
return `${num / 4}rem`;
|
|
144
|
+
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
118
145
|
}
|
|
119
146
|
function px(str) {
|
|
120
147
|
if (str.match(unitOnlyRE))
|
|
@@ -123,25 +150,23 @@ function px(str) {
|
|
|
123
150
|
if (!match)
|
|
124
151
|
return;
|
|
125
152
|
const [, n, unit] = match;
|
|
126
|
-
if (unit)
|
|
127
|
-
return str;
|
|
128
153
|
const num = parseFloat(n);
|
|
129
154
|
if (!Number.isNaN(num))
|
|
130
|
-
return `${num}px`;
|
|
155
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
131
156
|
}
|
|
132
157
|
function number(str) {
|
|
133
158
|
if (!numberRE.test(str))
|
|
134
159
|
return;
|
|
135
160
|
const num = parseFloat(str);
|
|
136
161
|
if (!Number.isNaN(num))
|
|
137
|
-
return num;
|
|
162
|
+
return round(num);
|
|
138
163
|
}
|
|
139
164
|
function percent(str) {
|
|
140
165
|
if (str.endsWith("%"))
|
|
141
166
|
str = str.slice(0, -1);
|
|
142
167
|
const num = parseFloat(str);
|
|
143
168
|
if (!Number.isNaN(num))
|
|
144
|
-
return `${num / 100}`;
|
|
169
|
+
return `${round(num / 100)}`;
|
|
145
170
|
}
|
|
146
171
|
function fraction(str) {
|
|
147
172
|
if (str === "full")
|
|
@@ -149,7 +174,7 @@ function fraction(str) {
|
|
|
149
174
|
const [left, right] = str.split("/");
|
|
150
175
|
const num = parseFloat(left) / parseFloat(right);
|
|
151
176
|
if (!Number.isNaN(num))
|
|
152
|
-
return `${num * 100}%`;
|
|
177
|
+
return `${round(num * 100)}%`;
|
|
153
178
|
}
|
|
154
179
|
function bracket(str) {
|
|
155
180
|
if (str && str[0] === "[" && str[str.length - 1] === "]") {
|
|
@@ -163,20 +188,19 @@ function cssvar(str) {
|
|
|
163
188
|
return `var(--${str.slice(1)})`;
|
|
164
189
|
}
|
|
165
190
|
function time(str) {
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
191
|
+
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
192
|
+
if (!match)
|
|
168
193
|
return;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
194
|
+
const [, n, unit] = match;
|
|
195
|
+
const num = parseFloat(n);
|
|
196
|
+
if (!Number.isNaN(num))
|
|
197
|
+
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
172
198
|
}
|
|
173
199
|
function global(str) {
|
|
174
200
|
if (["inherit", "initial", "revert", "unset"].includes(str))
|
|
175
201
|
return str;
|
|
176
202
|
}
|
|
177
203
|
function properties(str) {
|
|
178
|
-
if (str === void 0)
|
|
179
|
-
return;
|
|
180
204
|
for (const prop of str.split(",")) {
|
|
181
205
|
if (!cssProps.includes(prop))
|
|
182
206
|
return;
|
|
@@ -291,4 +315,4 @@ const colorResolver = (property, varName) => ([, body], { theme }) => {
|
|
|
291
315
|
}
|
|
292
316
|
};
|
|
293
317
|
|
|
294
|
-
export { cornerMap as a, capitalize as b, colorResolver as c, directionMap as d, directionSize as e,
|
|
318
|
+
export { cornerMap as a, capitalize as b, colorResolver as c, directionMap as d, directionSize as e, positionMap as f, h as g, handler as h, parseColor as p, valueHandlers as v, xyzMap as x };
|
package/dist/utils.cjs
CHANGED
|
@@ -16,6 +16,7 @@ exports.directionSize = utilities.directionSize;
|
|
|
16
16
|
exports.h = utilities.h;
|
|
17
17
|
exports.handler = utilities.handler;
|
|
18
18
|
exports.parseColor = utilities.parseColor;
|
|
19
|
+
exports.positionMap = utilities.positionMap;
|
|
19
20
|
exports.valueHandlers = utilities.valueHandlers;
|
|
20
21
|
exports.xyzMap = utilities.xyzMap;
|
|
21
22
|
exports.variantMatcher = variants.variantMatcher;
|
package/dist/utils.d.ts
CHANGED
|
@@ -5,12 +5,13 @@ import { T as Theme } from './types-a2d2b52f';
|
|
|
5
5
|
declare const directionMap: Record<string, string[]>;
|
|
6
6
|
declare const cornerMap: Record<string, string[]>;
|
|
7
7
|
declare const xyzMap: Record<string, string[]>;
|
|
8
|
+
declare const positionMap: Record<string, string>;
|
|
8
9
|
|
|
9
10
|
declare function numberWithUnit(str: string): string | undefined;
|
|
10
11
|
declare function auto(str: string): "auto" | undefined;
|
|
11
12
|
declare function rem(str: string): string | undefined;
|
|
12
13
|
declare function px(str: string): string | undefined;
|
|
13
|
-
declare function number(str: string):
|
|
14
|
+
declare function number(str: string): string | undefined;
|
|
14
15
|
declare function percent(str: string): string | undefined;
|
|
15
16
|
declare function fraction(str: string): string | undefined;
|
|
16
17
|
declare function bracket(str: string): string | undefined;
|
|
@@ -106,4 +107,4 @@ declare const parseColor: (body: string, theme: Theme) => ParsedColorValue | und
|
|
|
106
107
|
*/
|
|
107
108
|
declare const colorResolver: (property: string, varName: string) => DynamicMatcher;
|
|
108
109
|
|
|
109
|
-
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
|
110
|
+
export { capitalize, colorResolver, cornerMap, directionMap, directionSize, h, handler, parseColor, positionMap, handlers as valueHandlers, variantMatcher, variantParentMatcher, xyzMap };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { b as capitalize, c as colorResolver, a as cornerMap, d as directionMap, e as directionSize,
|
|
1
|
+
export { b as capitalize, c as colorResolver, a as cornerMap, d as directionMap, e as directionSize, g as h, h as handler, p as parseColor, f as positionMap, v as valueHandlers, x as xyzMap } from './chunks/utilities.mjs';
|
|
2
2
|
export { v as variantMatcher, a as variantParentMatcher } from './chunks/variants.mjs';
|
|
3
3
|
import '@unocss/core';
|
package/dist/variants.cjs
CHANGED
|
@@ -18,7 +18,6 @@ exports.variantMotions = _default.variantMotions;
|
|
|
18
18
|
exports.variantNegative = _default.variantNegative;
|
|
19
19
|
exports.variantOrientations = _default.variantOrientations;
|
|
20
20
|
exports.variantPrint = _default.variantPrint;
|
|
21
|
-
exports.variantSpace = _default.variantSpace;
|
|
22
21
|
exports.variants = _default.variants;
|
|
23
22
|
exports.CONTROL_BYPASS_PSEUDO_CLASS = pseudo.CONTROL_BYPASS_PSEUDO_CLASS;
|
|
24
23
|
exports.partClasses = pseudo.partClasses;
|
package/dist/variants.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ declare const variants: Variant<Theme>[];
|
|
|
14
14
|
|
|
15
15
|
declare const variantImportant: Variant;
|
|
16
16
|
declare const variantNegative: Variant;
|
|
17
|
-
declare const variantSpace: Variant;
|
|
18
17
|
|
|
19
18
|
declare const variantMotions: Variant[];
|
|
20
19
|
|
|
@@ -29,4 +28,4 @@ declare const variantPseudoClassFunctions: VariantObject;
|
|
|
29
28
|
declare const variantTaggedPseudoClasses: VariantObject;
|
|
30
29
|
declare const partClasses: VariantObject;
|
|
31
30
|
|
|
32
|
-
export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantLanguageDirections, variantMotions, variantNegative, variantOrientations, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements,
|
|
31
|
+
export { CONTROL_BYPASS_PSEUDO_CLASS, partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantImportant, variantLanguageDirections, variantMotions, variantNegative, variantOrientations, variantPrint, variantPseudoClassFunctions, variantPseudoClasses, variantPseudoElements, variantTaggedPseudoClasses, variants };
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, e as variantImportant, d as variantLanguageDirections,
|
|
1
|
+
export { a as variantBreakpoints, c as variantColorsMediaOrClass, b as variantCombinators, e as variantImportant, d as variantLanguageDirections, g as variantMotions, f as variantNegative, h as variantOrientations, i as variantPrint, v as variants } from './chunks/default3.mjs';
|
|
2
2
|
export { C as CONTROL_BYPASS_PSEUDO_CLASS, p as partClasses, a as variantPseudoClassFunctions, v as variantPseudoClasses, c as variantPseudoElements, b as variantTaggedPseudoClasses } from './chunks/pseudo.mjs';
|
|
3
3
|
import './chunks/variants.mjs';
|
|
4
4
|
import '@unocss/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.4",
|
|
4
4
|
"description": "The minimal preset for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"*.css"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@unocss/core": "0.20.
|
|
64
|
+
"@unocss/core": "0.20.4"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|