@unocss/preset-mini 0.20.4 → 0.22.0
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/default.cjs +8 -10
- package/dist/chunks/default.mjs +8 -10
- package/dist/chunks/default2.cjs +147 -123
- package/dist/chunks/default2.mjs +148 -124
- package/dist/chunks/default3.cjs +175 -25
- package/dist/chunks/default3.mjs +166 -22
- package/dist/chunks/utilities.cjs +23 -15
- package/dist/chunks/utilities.mjs +23 -15
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +2 -3
- package/dist/rules.cjs +0 -1
- package/dist/rules.mjs +0 -1
- package/dist/theme.d.ts +0 -10
- package/dist/utilities-22a522e2.d.ts +56 -0
- package/dist/utils.d.ts +9 -57
- package/dist/variants.cjs +6 -7
- package/dist/variants.d.ts +7 -3
- package/dist/variants.mjs +1 -2
- package/package.json +2 -2
- package/dist/chunks/pseudo.cjs +0 -158
- package/dist/chunks/pseudo.mjs +0 -151
package/dist/chunks/default2.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
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
|
-
import { toArray } from '@unocss/core';
|
|
3
|
-
import { C as CONTROL_BYPASS_PSEUDO_CLASS } from './pseudo.mjs';
|
|
2
|
+
import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
|
|
4
3
|
|
|
5
4
|
const verticalAlignAlias = {
|
|
6
5
|
mid: "middle",
|
|
@@ -8,7 +7,7 @@ const verticalAlignAlias = {
|
|
|
8
7
|
btm: "bottom"
|
|
9
8
|
};
|
|
10
9
|
const verticalAligns = [
|
|
11
|
-
[/^(?:vertical|align|v)-(baseline|top|bottom|
|
|
10
|
+
[/^(?:vertical|align|v)-(baseline|top|middle|bottom|text-top|text-bottom|sub|super|mid|base|btm)$/, ([, v]) => ({ "vertical-align": verticalAlignAlias[v] || v })]
|
|
12
11
|
];
|
|
13
12
|
const textAligns = [
|
|
14
13
|
["text-center", { "text-align": "center" }],
|
|
@@ -22,7 +21,7 @@ const outline = [
|
|
|
22
21
|
[/^outline-(?:color-)?(.+)$/, colorResolver("outline-color", "outline-color")],
|
|
23
22
|
[/^outline-offset-(.+)$/, ([, d]) => ({ "outline-offset": handler.bracket.fraction.auto.rem(d) })],
|
|
24
23
|
["outline", { "outline-style": "solid" }],
|
|
25
|
-
[/^outline-(auto|dotted|
|
|
24
|
+
[/^outline-(auto|dashed|dotted|double|hidden|solid|groove|ridge|inset|outset|inherit|initial|revert|unset)$/, ([, c]) => ({ "outline-style": c })],
|
|
26
25
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
27
26
|
];
|
|
28
27
|
const appearance = [
|
|
@@ -31,8 +30,14 @@ const appearance = [
|
|
|
31
30
|
"-webkit-appearance": "none"
|
|
32
31
|
}]
|
|
33
32
|
];
|
|
33
|
+
const willChangeProperty = (prop) => {
|
|
34
|
+
return handler.properties.auto.global(prop) ?? {
|
|
35
|
+
contents: "contents",
|
|
36
|
+
scroll: "scroll-position"
|
|
37
|
+
}[prop];
|
|
38
|
+
};
|
|
34
39
|
const willChange = [
|
|
35
|
-
[/^will-change-(.+)/, ([, p]) => ({ "will-change":
|
|
40
|
+
[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]
|
|
36
41
|
];
|
|
37
42
|
|
|
38
43
|
const borders = [
|
|
@@ -180,10 +185,10 @@ const flex = [
|
|
|
180
185
|
["flex-initial", { flex: "0 1 auto" }],
|
|
181
186
|
["flex-none", { flex: "none" }],
|
|
182
187
|
[/^flex-(\[.+\])$/, ([, d]) => ({ flex: handler.bracket(d).replace(/\d+\/\d+/, ($1) => handler.fraction($1)) })],
|
|
183
|
-
[
|
|
184
|
-
[
|
|
185
|
-
[
|
|
186
|
-
[
|
|
188
|
+
[/^(?:flex-)?shrink$/, () => ({ "flex-shrink": 1 })],
|
|
189
|
+
[/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
|
|
190
|
+
[/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
|
|
191
|
+
[/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
|
|
187
192
|
[/^(?:flex-)?basis-(.+)$/, ([, d]) => ({ "flex-basis": handler.bracket.fraction.auto.rem(d) })],
|
|
188
193
|
["flex-row", { "flex-direction": "row" }],
|
|
189
194
|
["flex-row-reverse", { "flex-direction": "row-reverse" }],
|
|
@@ -208,17 +213,15 @@ const weightMap = {
|
|
|
208
213
|
const fonts = [
|
|
209
214
|
[/^font-(\w+)$/, ([, d], { theme }) => ({ "font-family": theme.fontFamily?.[d] })],
|
|
210
215
|
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
211
|
-
const size = handler.bracket.auto.rem(s);
|
|
212
|
-
if (size)
|
|
213
|
-
return { "font-size": size };
|
|
214
216
|
const themed = toArray(theme.fontSize?.[s]);
|
|
215
217
|
if (themed?.[0]) {
|
|
216
|
-
const [
|
|
218
|
+
const [size, height = "1"] = themed;
|
|
217
219
|
return {
|
|
218
|
-
"font-size":
|
|
220
|
+
"font-size": size,
|
|
219
221
|
"line-height": height
|
|
220
222
|
};
|
|
221
223
|
}
|
|
224
|
+
return { "font-size": handler.bracket.auto.rem(s) };
|
|
222
225
|
}],
|
|
223
226
|
[/^text-size-(.+)$/, ([, s]) => ({ "font-size": handler.bracket.auto.rem(s) })],
|
|
224
227
|
[/^(?:font|fw)-?([^-]+)$/, ([, s]) => ({ "font-weight": weightMap[s] || handler.number(s) })],
|
|
@@ -227,7 +230,7 @@ const fonts = [
|
|
|
227
230
|
[/^word-spacing-([^-]+)$/, ([, s], { theme }) => ({ "word-spacing": theme.wordSpacing?.[s] || handler.bracket.auto.rem(s) })]
|
|
228
231
|
];
|
|
229
232
|
const tabSizes = [
|
|
230
|
-
[/^tab
|
|
233
|
+
[/^tab(?:-([^-]+))?$/, ([, s]) => {
|
|
231
234
|
const v = handler.bracket.global.number(s || "4");
|
|
232
235
|
if (v != null) {
|
|
233
236
|
return {
|
|
@@ -269,53 +272,47 @@ const gaps = [
|
|
|
269
272
|
[/^(?:flex-|grid-)?gap-([xy])-([^-]+)$/, handleGap]
|
|
270
273
|
];
|
|
271
274
|
|
|
272
|
-
const
|
|
275
|
+
const rowCol = (s) => s.replace("col", "column");
|
|
273
276
|
const autoDirection = (selector, theme) => {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
277
|
+
const v = theme.fontSize?.[selector];
|
|
278
|
+
if (v != null)
|
|
279
|
+
return toArray(v)[0];
|
|
280
|
+
switch (selector) {
|
|
281
|
+
case "min":
|
|
282
|
+
return "min-content";
|
|
283
|
+
case "max":
|
|
284
|
+
return "max-content";
|
|
285
|
+
case "fr":
|
|
286
|
+
return "minmax(0,1fr)";
|
|
287
|
+
}
|
|
288
|
+
return handler.bracket.auto.rem(selector);
|
|
281
289
|
};
|
|
282
290
|
const grids = [
|
|
283
291
|
["grid", { display: "grid" }],
|
|
284
292
|
["inline-grid", { display: "inline-grid" }],
|
|
285
|
-
[/^(?:grid-)?col-
|
|
286
|
-
[/^(?:grid-)?col-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
if (raw)
|
|
293
|
-
return { [key]: raw };
|
|
294
|
-
const parts = v.split("-");
|
|
295
|
-
if (parts.length === 1 && parts[0] === "auto")
|
|
296
|
-
return { [key]: parts[0] };
|
|
297
|
-
if (parts[0] === "span") {
|
|
298
|
-
if (parts[1] === "full")
|
|
299
|
-
return { [key]: "1/-1" };
|
|
300
|
-
raw = handler.number.bracket(parts[1]);
|
|
301
|
-
if (raw)
|
|
302
|
-
return { [key]: `span ${raw}/span ${raw}` };
|
|
303
|
-
}
|
|
293
|
+
[/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: handler.bracket.auto(v) })],
|
|
294
|
+
[/^(?:grid-)?(row|col)-span-(.+)$/, ([, c, s]) => {
|
|
295
|
+
if (s === "full")
|
|
296
|
+
return { [`grid-${rowCol(c)}`]: "1/-1" };
|
|
297
|
+
const v = handler.bracket.number(s);
|
|
298
|
+
if (v != null)
|
|
299
|
+
return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
|
|
304
300
|
}],
|
|
305
|
-
[/^(?:grid-)?
|
|
306
|
-
[/^(?:grid-)?
|
|
307
|
-
[/^(?:grid-)?auto-rows-([\w.-]+)$/, ([, v], { theme }) => ({
|
|
308
|
-
[/^grid-
|
|
309
|
-
[/^grid-rows-(
|
|
310
|
-
[/^grid-cols-minmax-([\w.-]+)$/, ([, d]) => ({
|
|
311
|
-
[/^grid-rows-
|
|
312
|
-
[
|
|
313
|
-
[
|
|
301
|
+
[/^(?:grid-)?(row|col)-start-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: v })],
|
|
302
|
+
[/^(?:grid-)?(row|col)-end-([\w.-]+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: v })],
|
|
303
|
+
[/^(?:grid-)?auto-(rows|cols)-([\w.-]+)$/, ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) })],
|
|
304
|
+
[/^(?:grid-auto-flow|auto-flow|grid-flow)-((?:row|col)(?:-dense)?)$/, ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") })],
|
|
305
|
+
[/^grid-(rows|cols)-(\[.+\])$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: handler.bracket(v) })],
|
|
306
|
+
[/^grid-(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
|
|
307
|
+
[/^grid-(rows|cols)-(\d+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` })],
|
|
308
|
+
["grid-rows-none", { "grid-template-rows": "none" }],
|
|
309
|
+
["grid-cols-none", { "grid-template-columns": "none" }]
|
|
314
310
|
];
|
|
315
311
|
|
|
316
312
|
const overflowValues = [
|
|
317
313
|
"auto",
|
|
318
314
|
"hidden",
|
|
315
|
+
"clip",
|
|
319
316
|
"visible",
|
|
320
317
|
"scroll"
|
|
321
318
|
];
|
|
@@ -397,7 +394,7 @@ function handleInsetValues([, d, v]) {
|
|
|
397
394
|
return directionMap[d].map((i) => [i.slice(1), r]);
|
|
398
395
|
}
|
|
399
396
|
const insets = [
|
|
400
|
-
[/^(?:position-|pos-)?inset-(
|
|
397
|
+
[/^(?:position-|pos-)?inset-(.+)$/, ([, v]) => ({ inset: handleInsetValue(v) })],
|
|
401
398
|
[/^(?:position-|pos-)?inset-([xy])-(.+)$/, handleInsetValues],
|
|
402
399
|
[/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
|
|
403
400
|
];
|
|
@@ -458,11 +455,12 @@ const whitespaces = [
|
|
|
458
455
|
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap)$/, ([, v]) => ({ "white-space": v })]
|
|
459
456
|
];
|
|
460
457
|
const contents = [
|
|
461
|
-
["content-empty", { content: '""' }]
|
|
458
|
+
["content-empty", { content: '""' }],
|
|
459
|
+
["content-none", { content: '""' }]
|
|
462
460
|
];
|
|
463
461
|
const breaks = [
|
|
464
462
|
["break-normal", { "overflow-wrap": "normal", "word-break": "normal" }],
|
|
465
|
-
["break-
|
|
463
|
+
["break-words", { "overflow-wrap": "break-word" }],
|
|
466
464
|
["break-all", { "word-break": "break-all" }]
|
|
467
465
|
];
|
|
468
466
|
const textOverflows = [
|
|
@@ -494,14 +492,14 @@ const fontSmoothings = [
|
|
|
494
492
|
];
|
|
495
493
|
|
|
496
494
|
const rings = [
|
|
497
|
-
[/^ring
|
|
495
|
+
[/^ring(?:-(.+))?$/, ([, d]) => {
|
|
498
496
|
const value = handler.px(d || "1");
|
|
499
497
|
if (value) {
|
|
500
498
|
return {
|
|
501
499
|
"--un-ring-inset": varEmpty,
|
|
502
500
|
"--un-ring-offset-width": "0px",
|
|
503
501
|
"--un-ring-offset-color": "#fff",
|
|
504
|
-
"--un-ring-color": "rgba(
|
|
502
|
+
"--un-ring-color": "rgba(147, 197, 253, .5)",
|
|
505
503
|
"--un-ring-offset-shadow": "var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)",
|
|
506
504
|
"--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${value} + var(--un-ring-offset-width)) var(--un-ring-color)`,
|
|
507
505
|
"box-shadow": "var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow, 0 0 #0000)"
|
|
@@ -535,7 +533,7 @@ const shadowColorResolver = (body, theme) => {
|
|
|
535
533
|
}
|
|
536
534
|
};
|
|
537
535
|
const boxShadows = [
|
|
538
|
-
[/^shadow
|
|
536
|
+
[/^shadow(?:-(.+))?$/, ([, d], { theme }) => {
|
|
539
537
|
const value = theme.boxShadow?.[d || "DEFAULT"];
|
|
540
538
|
if (value) {
|
|
541
539
|
return {
|
|
@@ -553,37 +551,38 @@ const boxShadows = [
|
|
|
553
551
|
function getPropName(minmax, hw) {
|
|
554
552
|
return `${minmax ? `${minmax}-` : ""}${hw === "h" ? "height" : "width"}`;
|
|
555
553
|
}
|
|
556
|
-
function
|
|
554
|
+
function getSizeValue(minmax, hw, theme, prop) {
|
|
557
555
|
let str = `${hw === "h" ? "height" : "width"}`;
|
|
558
556
|
if (minmax)
|
|
559
557
|
str = `${minmax}${capitalize(str)}`;
|
|
560
|
-
|
|
558
|
+
const v = theme[str]?.[prop];
|
|
559
|
+
if (v != null)
|
|
560
|
+
return v;
|
|
561
|
+
switch (prop) {
|
|
562
|
+
case "fit":
|
|
563
|
+
case "max":
|
|
564
|
+
case "min":
|
|
565
|
+
return `${prop}-content`;
|
|
566
|
+
}
|
|
567
|
+
return handler.bracket.cssvar.fraction.auto.rem(prop);
|
|
561
568
|
}
|
|
562
569
|
const sizes = [
|
|
563
|
-
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
return
|
|
572
|
-
|
|
573
|
-
|
|
570
|
+
[/^(?:(min|max)-)?(w|h)-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: getSizeValue(m, w, theme, s) })],
|
|
571
|
+
[/^(?:(min|max)-)?(w)-screen-(.+)$/, ([, m, w, s], { theme }) => ({ [getPropName(m, w)]: theme.breakpoints?.[s] })]
|
|
572
|
+
];
|
|
573
|
+
function getAspectRatio(prop) {
|
|
574
|
+
if (/^\d+\/\d+$/.test(prop))
|
|
575
|
+
return prop;
|
|
576
|
+
switch (prop) {
|
|
577
|
+
case "square":
|
|
578
|
+
return "1/1";
|
|
579
|
+
case "video":
|
|
580
|
+
return "16/9";
|
|
581
|
+
}
|
|
582
|
+
return handler.bracket.cssvar.auto.number(prop);
|
|
583
|
+
}
|
|
574
584
|
const aspectRatio = [
|
|
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
|
-
}]
|
|
585
|
+
[/^aspect-(?:ratio-)?(.+)$/, ([, d]) => ({ "aspect-ratio": getAspectRatio(d) })]
|
|
587
586
|
];
|
|
588
587
|
|
|
589
588
|
const paddings = [
|
|
@@ -598,12 +597,10 @@ const margins = [
|
|
|
598
597
|
];
|
|
599
598
|
|
|
600
599
|
const transformGpu = {
|
|
601
|
-
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))"
|
|
602
|
-
[CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
600
|
+
"--un-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))"
|
|
603
601
|
};
|
|
604
602
|
const transformCpu = {
|
|
605
|
-
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))"
|
|
606
|
-
[CONTROL_BYPASS_PSEUDO_CLASS]: ""
|
|
603
|
+
"--un-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))"
|
|
607
604
|
};
|
|
608
605
|
const transformBase = {
|
|
609
606
|
"--un-rotate": 0,
|
|
@@ -615,30 +612,55 @@ const transformBase = {
|
|
|
615
612
|
"--un-translate-x": 0,
|
|
616
613
|
"--un-translate-y": 0,
|
|
617
614
|
"--un-translate-z": 0,
|
|
618
|
-
...transformCpu
|
|
615
|
+
...transformCpu,
|
|
616
|
+
[CONTROL_SHORTCUT_NO_MERGE]: ""
|
|
619
617
|
};
|
|
620
618
|
const transforms = [
|
|
621
|
-
["transform"
|
|
622
|
-
[/^
|
|
623
|
-
|
|
619
|
+
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })],
|
|
620
|
+
[/^perspect-(.+)$/, ([, s]) => {
|
|
621
|
+
const v = handler.px.numberWithUnit(s);
|
|
622
|
+
if (v != null) {
|
|
623
|
+
return {
|
|
624
|
+
"-webkit-perspective": v,
|
|
625
|
+
"perspective": v
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
}],
|
|
629
|
+
[/^perspect-origin-(.+)$/, ([, s]) => {
|
|
630
|
+
const v = handler.bracket(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
|
|
631
|
+
if (v != null) {
|
|
632
|
+
return {
|
|
633
|
+
"-webkit-perspective-origin": v,
|
|
634
|
+
"perspective-origin": v
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
}],
|
|
638
|
+
[/^translate-()(.+)$/, handleTranslate],
|
|
624
639
|
[/^translate-([xyz])-(.+)$/, handleTranslate],
|
|
625
|
-
[/^scale()-(.+)$/, handleScale],
|
|
626
|
-
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
627
640
|
[/^rotate-(.+)$/, handleRotate],
|
|
628
|
-
[/^
|
|
641
|
+
[/^skew-()(.+)$/, handleSkew],
|
|
629
642
|
[/^skew-([xy])-(.+)$/, handleSkew],
|
|
630
|
-
[/^
|
|
643
|
+
[/^scale-()(.+)$/, handleScale],
|
|
644
|
+
[/^scale-([xyz])-(.+)$/, handleScale],
|
|
645
|
+
["preserve-3d", { "transform-style": "preserve-3d" }],
|
|
646
|
+
["preserve-flat", { "transform-style": "flat" }],
|
|
647
|
+
[/^transform$/, () => [
|
|
648
|
+
transformBase,
|
|
649
|
+
{ transform: "var(--un-transform)" }
|
|
650
|
+
]],
|
|
631
651
|
["transform-gpu", transformGpu],
|
|
632
652
|
["transform-cpu", transformCpu],
|
|
633
|
-
["transform-none", { transform: "none" }]
|
|
634
|
-
[/^origin-([-\w]{3,})$/, ([, s]) => ({ "transform-origin": positionMap[s] })]
|
|
653
|
+
["transform-none", { transform: "none" }]
|
|
635
654
|
];
|
|
636
655
|
function handleTranslate([, d, b]) {
|
|
637
656
|
const v = handler.bracket.fraction.auto.rem(b);
|
|
638
657
|
if (v != null) {
|
|
639
658
|
return [
|
|
640
659
|
transformBase,
|
|
641
|
-
|
|
660
|
+
[
|
|
661
|
+
...xyzMap[d].map((i) => [`--un-translate${i}`, v]),
|
|
662
|
+
["transform", "var(--un-transform)"]
|
|
663
|
+
]
|
|
642
664
|
];
|
|
643
665
|
}
|
|
644
666
|
}
|
|
@@ -647,43 +669,34 @@ function handleScale([, d, b]) {
|
|
|
647
669
|
if (v != null) {
|
|
648
670
|
return [
|
|
649
671
|
transformBase,
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
function handleRotateWithUnit([, b]) {
|
|
655
|
-
const v = handler.bracket.number(b);
|
|
656
|
-
if (v != null) {
|
|
657
|
-
return [
|
|
658
|
-
transformBase,
|
|
659
|
-
{ "--un-rotate": `${v}deg` }
|
|
672
|
+
[
|
|
673
|
+
...xyzMap[d].map((i) => [`--un-scale${i}`, v]),
|
|
674
|
+
["transform", "var(--un-transform)"]
|
|
675
|
+
]
|
|
660
676
|
];
|
|
661
677
|
}
|
|
662
678
|
}
|
|
663
679
|
function handleRotate([, b]) {
|
|
664
|
-
const v = handler.bracket(b);
|
|
665
|
-
if (v != null) {
|
|
666
|
-
return [
|
|
667
|
-
transformBase,
|
|
668
|
-
{ "--un-rotate": v }
|
|
669
|
-
];
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
function handleSkewWithUnit([, d, b]) {
|
|
673
|
-
const v = handler.bracket.number(b);
|
|
680
|
+
const v = handler.bracket.degree(b);
|
|
674
681
|
if (v != null) {
|
|
675
682
|
return [
|
|
676
683
|
transformBase,
|
|
677
|
-
{
|
|
684
|
+
{
|
|
685
|
+
"--un-rotate": v,
|
|
686
|
+
"transform": "var(--un-transform)"
|
|
687
|
+
}
|
|
678
688
|
];
|
|
679
689
|
}
|
|
680
690
|
}
|
|
681
691
|
function handleSkew([, d, b]) {
|
|
682
|
-
const v = handler.bracket(b);
|
|
692
|
+
const v = handler.bracket.degree(b);
|
|
683
693
|
if (v != null) {
|
|
684
694
|
return [
|
|
685
695
|
transformBase,
|
|
686
|
-
{
|
|
696
|
+
{
|
|
697
|
+
[`--un-skew-${d}`]: v,
|
|
698
|
+
transform: "var(--un-transform)"
|
|
699
|
+
}
|
|
687
700
|
];
|
|
688
701
|
}
|
|
689
702
|
}
|
|
@@ -732,10 +745,11 @@ ${constructCSS({ animation: "__un_qm 0.5s ease-in-out alternate infinite" })}`;
|
|
|
732
745
|
];
|
|
733
746
|
|
|
734
747
|
const textDecorations = [
|
|
735
|
-
["underline", { "text-decoration": "underline" }],
|
|
736
|
-
["
|
|
737
|
-
["
|
|
738
|
-
["decoration-
|
|
748
|
+
["underline", { "text-decoration-line": "underline" }],
|
|
749
|
+
["overline", { "text-decoration-line": "overline" }],
|
|
750
|
+
["line-through", { "text-decoration-line": "line-through" }],
|
|
751
|
+
["decoration-underline", { "text-decoration-line": "underline" }],
|
|
752
|
+
["decoration-line-through", { "text-decoration-line": "line-through" }],
|
|
739
753
|
[/^(?:underline|decoration)-(?:size-)?(.+)$/, ([, s]) => ({ "text-decoration-thickness": handler.bracket.px(s) })],
|
|
740
754
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s })],
|
|
741
755
|
[/^(?:underline|decoration)-(.+)$/, (match, ctx) => {
|
|
@@ -759,8 +773,18 @@ const svgUtilities = [
|
|
|
759
773
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": handler.bracket.percent(opacity) })],
|
|
760
774
|
["fill-none", { fill: "none" }],
|
|
761
775
|
[/^stroke-(?:size-|width-)?(.+)$/, ([, s]) => ({ "stroke-width": handler.bracket.fraction.px.number(s) })],
|
|
776
|
+
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": handler.bracket.number(s) })],
|
|
777
|
+
[/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": handler.bracket.px.numberWithUnit(s) })],
|
|
762
778
|
[/^stroke-(.+)$/, colorResolver("stroke", "stroke")],
|
|
763
779
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": handler.bracket.percent(opacity) })],
|
|
780
|
+
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
781
|
+
["stroke-cap-round", { "stroke-linecap": "round" }],
|
|
782
|
+
["stroke-cap-auto", { "stroke-linecap": "butt" }],
|
|
783
|
+
["stroke-join-arcs", { "stroke-linejoin": "arcs" }],
|
|
784
|
+
["stroke-join-bevel", { "stroke-linejoin": "bevel" }],
|
|
785
|
+
["stroke-join-clip", { "stroke-linejoin": "miter-clip" }],
|
|
786
|
+
["stroke-join-round", { "stroke-linejoin": "round" }],
|
|
787
|
+
["stroke-join-auto", { "stroke-linejoin": "miter" }],
|
|
764
788
|
["stroke-none", { stroke: "none" }]
|
|
765
789
|
];
|
|
766
790
|
|