@unocss/preset-mini 0.15.2 → 0.15.6
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 +32 -12
- package/dist/chunks/default2.mjs +32 -12
- package/dist/chunks/index.cjs +12 -39
- package/dist/chunks/index.mjs +11 -30
- 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.cjs
CHANGED
|
@@ -25,11 +25,13 @@ const parseColorUtil = (body, theme) => {
|
|
|
25
25
|
if (!name)
|
|
26
26
|
return;
|
|
27
27
|
let color;
|
|
28
|
-
const bracket = index.handler.bracket(main)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
const bracket = index.handler.bracket(main);
|
|
29
|
+
const bracketOrMain = bracket || main;
|
|
30
|
+
if (bracketOrMain.startsWith("#"))
|
|
31
|
+
color = bracketOrMain.slice(1);
|
|
32
|
+
if (bracketOrMain.startsWith("hex-"))
|
|
33
|
+
color = bracketOrMain.slice(4);
|
|
34
|
+
color = color || bracket;
|
|
33
35
|
if (!color) {
|
|
34
36
|
const colorData = theme.colors?.[name];
|
|
35
37
|
if (typeof colorData === "string")
|
|
@@ -352,15 +354,23 @@ const weightMap = {
|
|
|
352
354
|
black: "900"
|
|
353
355
|
};
|
|
354
356
|
const fontSizes = [
|
|
355
|
-
[/^text-(
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
|
|
357
|
+
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
358
|
+
const size = index.handler.bracket.rem(s);
|
|
359
|
+
if (size)
|
|
360
|
+
return { "font-size": size };
|
|
361
|
+
const themed = core.toArray(theme.fontSize?.[s]);
|
|
362
|
+
if (themed?.[0]) {
|
|
363
|
+
const [size2, height] = themed;
|
|
359
364
|
return {
|
|
360
|
-
"font-size":
|
|
365
|
+
"font-size": size2,
|
|
361
366
|
"line-height": height
|
|
362
367
|
};
|
|
363
368
|
}
|
|
369
|
+
}],
|
|
370
|
+
[/^text-size-(.+)$/, ([, s]) => {
|
|
371
|
+
const raw = index.handler.bracket.rem(s);
|
|
372
|
+
if (raw)
|
|
373
|
+
return { "font-size": raw };
|
|
364
374
|
}]
|
|
365
375
|
];
|
|
366
376
|
const fontWeights = [
|
|
@@ -802,6 +812,14 @@ const fontSmoothings = [
|
|
|
802
812
|
}]
|
|
803
813
|
];
|
|
804
814
|
|
|
815
|
+
const transformGpu = {
|
|
816
|
+
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))",
|
|
817
|
+
[pseudo.CONTROL_BYPASS_PSEUDO]: ""
|
|
818
|
+
};
|
|
819
|
+
const transformCpu = {
|
|
820
|
+
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))",
|
|
821
|
+
[pseudo.CONTROL_BYPASS_PSEUDO]: ""
|
|
822
|
+
};
|
|
805
823
|
const transformBase = {
|
|
806
824
|
"--un-rotate": 0,
|
|
807
825
|
"--un-scale-x": 1,
|
|
@@ -812,8 +830,7 @@ const transformBase = {
|
|
|
812
830
|
"--un-translate-x": 0,
|
|
813
831
|
"--un-translate-y": 0,
|
|
814
832
|
"--un-translate-z": 0,
|
|
815
|
-
|
|
816
|
-
[pseudo.CONTROL_BYPASS_PSEUDO]: ""
|
|
833
|
+
...transformCpu
|
|
817
834
|
};
|
|
818
835
|
const transforms = [
|
|
819
836
|
["transform", transformBase],
|
|
@@ -823,6 +840,9 @@ const transforms = [
|
|
|
823
840
|
[/^scale()-([^-]+)$/, handleScale],
|
|
824
841
|
[/^scale-([xyz])-([^-]+)$/, handleScale],
|
|
825
842
|
[/^rotate-([^-]+)(?:deg)?$/, handleRotate],
|
|
843
|
+
["transform-gpu", transformGpu],
|
|
844
|
+
["transform-cpu", transformCpu],
|
|
845
|
+
["transform-none", { transform: "none" }],
|
|
826
846
|
["origin-center", { "transform-origin": "center" }],
|
|
827
847
|
["origin-top", { "transform-origin": "top" }],
|
|
828
848
|
["origin-top-right", { "transform-origin": "top right" }],
|
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")
|
|
@@ -350,15 +352,23 @@ const weightMap = {
|
|
|
350
352
|
black: "900"
|
|
351
353
|
};
|
|
352
354
|
const fontSizes = [
|
|
353
|
-
[/^text-(
|
|
354
|
-
const
|
|
355
|
-
if (
|
|
356
|
-
|
|
355
|
+
[/^text-(.+)$/, ([, s = "base"], { theme }) => {
|
|
356
|
+
const size = handler.bracket.rem(s);
|
|
357
|
+
if (size)
|
|
358
|
+
return { "font-size": size };
|
|
359
|
+
const themed = toArray(theme.fontSize?.[s]);
|
|
360
|
+
if (themed?.[0]) {
|
|
361
|
+
const [size2, height] = themed;
|
|
357
362
|
return {
|
|
358
|
-
"font-size":
|
|
363
|
+
"font-size": size2,
|
|
359
364
|
"line-height": height
|
|
360
365
|
};
|
|
361
366
|
}
|
|
367
|
+
}],
|
|
368
|
+
[/^text-size-(.+)$/, ([, s]) => {
|
|
369
|
+
const raw = handler.bracket.rem(s);
|
|
370
|
+
if (raw)
|
|
371
|
+
return { "font-size": raw };
|
|
362
372
|
}]
|
|
363
373
|
];
|
|
364
374
|
const fontWeights = [
|
|
@@ -800,6 +810,14 @@ const fontSmoothings = [
|
|
|
800
810
|
}]
|
|
801
811
|
];
|
|
802
812
|
|
|
813
|
+
const transformGpu = {
|
|
814
|
+
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))",
|
|
815
|
+
[CONTROL_BYPASS_PSEUDO]: ""
|
|
816
|
+
};
|
|
817
|
+
const transformCpu = {
|
|
818
|
+
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))",
|
|
819
|
+
[CONTROL_BYPASS_PSEUDO]: ""
|
|
820
|
+
};
|
|
803
821
|
const transformBase = {
|
|
804
822
|
"--un-rotate": 0,
|
|
805
823
|
"--un-scale-x": 1,
|
|
@@ -810,8 +828,7 @@ const transformBase = {
|
|
|
810
828
|
"--un-translate-x": 0,
|
|
811
829
|
"--un-translate-y": 0,
|
|
812
830
|
"--un-translate-z": 0,
|
|
813
|
-
|
|
814
|
-
[CONTROL_BYPASS_PSEUDO]: ""
|
|
831
|
+
...transformCpu
|
|
815
832
|
};
|
|
816
833
|
const transforms = [
|
|
817
834
|
["transform", transformBase],
|
|
@@ -821,6 +838,9 @@ const transforms = [
|
|
|
821
838
|
[/^scale()-([^-]+)$/, handleScale],
|
|
822
839
|
[/^scale-([xyz])-([^-]+)$/, handleScale],
|
|
823
840
|
[/^rotate-([^-]+)(?:deg)?$/, handleRotate],
|
|
841
|
+
["transform-gpu", transformGpu],
|
|
842
|
+
["transform-cpu", transformCpu],
|
|
843
|
+
["transform-none", { transform: "none" }],
|
|
824
844
|
["origin-center", { "transform-origin": "center" }],
|
|
825
845
|
["origin-top", { "transform-origin": "top" }],
|
|
826
846
|
["origin-top-right", { "transform-origin": "top right" }],
|
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"],
|
|
@@ -36,9 +38,12 @@ const xyzMap = {
|
|
|
36
38
|
|
|
37
39
|
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
38
40
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
41
|
+
const unitOnlyRE = /^(px)$/i;
|
|
39
42
|
function rem(str) {
|
|
40
43
|
if (str === "auto" || str === "a")
|
|
41
44
|
return "auto";
|
|
45
|
+
if (str.match(unitOnlyRE))
|
|
46
|
+
return `1${str}`;
|
|
42
47
|
const match = str.match(numberWithUnitRE);
|
|
43
48
|
if (!match)
|
|
44
49
|
return;
|
|
@@ -50,6 +55,8 @@ function rem(str) {
|
|
|
50
55
|
return `${num / 4}rem`;
|
|
51
56
|
}
|
|
52
57
|
function px(str) {
|
|
58
|
+
if (str.match(unitOnlyRE))
|
|
59
|
+
return `1${str}`;
|
|
53
60
|
const match = str.match(numberWithUnitRE);
|
|
54
61
|
if (!match)
|
|
55
62
|
return;
|
|
@@ -106,7 +113,7 @@ function global(str) {
|
|
|
106
113
|
return str;
|
|
107
114
|
}
|
|
108
115
|
|
|
109
|
-
const
|
|
116
|
+
const valueHandlers = {
|
|
110
117
|
__proto__: null,
|
|
111
118
|
rem: rem,
|
|
112
119
|
px: px,
|
|
@@ -119,51 +126,17 @@ const handlers = {
|
|
|
119
126
|
global: global
|
|
120
127
|
};
|
|
121
128
|
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
const s = this.__options?.sequence || [];
|
|
125
|
-
this.__options.sequence = [];
|
|
126
|
-
for (const n of s) {
|
|
127
|
-
const res = handlers[n](str);
|
|
128
|
-
if (res != null)
|
|
129
|
-
return res;
|
|
130
|
-
}
|
|
131
|
-
return void 0;
|
|
132
|
-
};
|
|
133
|
-
function addProcessor(that, name) {
|
|
134
|
-
if (!that.__options) {
|
|
135
|
-
that.__options = {
|
|
136
|
-
sequence: []
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
that.__options.sequence.push(name);
|
|
140
|
-
return that;
|
|
141
|
-
}
|
|
142
|
-
handlersNames.forEach((i) => {
|
|
143
|
-
Object.defineProperty(handler, i, {
|
|
144
|
-
enumerable: true,
|
|
145
|
-
get() {
|
|
146
|
-
return addProcessor(this, i);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
129
|
+
const handler = core.createValueHandler(valueHandlers);
|
|
130
|
+
const h = handler;
|
|
150
131
|
|
|
151
132
|
function capitalize(str) {
|
|
152
133
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
153
134
|
}
|
|
154
135
|
|
|
155
|
-
exports.bracket = bracket;
|
|
156
136
|
exports.capitalize = capitalize;
|
|
157
137
|
exports.cornerMap = cornerMap;
|
|
158
|
-
exports.cssvar = cssvar;
|
|
159
138
|
exports.directionMap = directionMap;
|
|
160
|
-
exports.
|
|
161
|
-
exports.global = global;
|
|
139
|
+
exports.h = h;
|
|
162
140
|
exports.handler = handler;
|
|
163
|
-
exports.
|
|
164
|
-
exports.number = number;
|
|
165
|
-
exports.percent = percent;
|
|
166
|
-
exports.px = px;
|
|
167
|
-
exports.rem = rem;
|
|
168
|
-
exports.time = time;
|
|
141
|
+
exports.valueHandlers = valueHandlers;
|
|
169
142
|
exports.xyzMap = xyzMap;
|
package/dist/chunks/index.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createValueHandler } from '@unocss/core';
|
|
2
|
+
|
|
1
3
|
const directionMap = {
|
|
2
4
|
"l": ["-left"],
|
|
3
5
|
"r": ["-right"],
|
|
@@ -34,9 +36,12 @@ const xyzMap = {
|
|
|
34
36
|
|
|
35
37
|
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax)?$/i;
|
|
36
38
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
39
|
+
const unitOnlyRE = /^(px)$/i;
|
|
37
40
|
function rem(str) {
|
|
38
41
|
if (str === "auto" || str === "a")
|
|
39
42
|
return "auto";
|
|
43
|
+
if (str.match(unitOnlyRE))
|
|
44
|
+
return `1${str}`;
|
|
40
45
|
const match = str.match(numberWithUnitRE);
|
|
41
46
|
if (!match)
|
|
42
47
|
return;
|
|
@@ -48,6 +53,8 @@ function rem(str) {
|
|
|
48
53
|
return `${num / 4}rem`;
|
|
49
54
|
}
|
|
50
55
|
function px(str) {
|
|
56
|
+
if (str.match(unitOnlyRE))
|
|
57
|
+
return `1${str}`;
|
|
51
58
|
const match = str.match(numberWithUnitRE);
|
|
52
59
|
if (!match)
|
|
53
60
|
return;
|
|
@@ -104,7 +111,7 @@ function global(str) {
|
|
|
104
111
|
return str;
|
|
105
112
|
}
|
|
106
113
|
|
|
107
|
-
const
|
|
114
|
+
const valueHandlers = {
|
|
108
115
|
__proto__: null,
|
|
109
116
|
rem: rem,
|
|
110
117
|
px: px,
|
|
@@ -117,37 +124,11 @@ const handlers = {
|
|
|
117
124
|
global: global
|
|
118
125
|
};
|
|
119
126
|
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const s = this.__options?.sequence || [];
|
|
123
|
-
this.__options.sequence = [];
|
|
124
|
-
for (const n of s) {
|
|
125
|
-
const res = handlers[n](str);
|
|
126
|
-
if (res != null)
|
|
127
|
-
return res;
|
|
128
|
-
}
|
|
129
|
-
return void 0;
|
|
130
|
-
};
|
|
131
|
-
function addProcessor(that, name) {
|
|
132
|
-
if (!that.__options) {
|
|
133
|
-
that.__options = {
|
|
134
|
-
sequence: []
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
that.__options.sequence.push(name);
|
|
138
|
-
return that;
|
|
139
|
-
}
|
|
140
|
-
handlersNames.forEach((i) => {
|
|
141
|
-
Object.defineProperty(handler, i, {
|
|
142
|
-
enumerable: true,
|
|
143
|
-
get() {
|
|
144
|
-
return addProcessor(this, i);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
});
|
|
127
|
+
const handler = createValueHandler(valueHandlers);
|
|
128
|
+
const h = handler;
|
|
148
129
|
|
|
149
130
|
function capitalize(str) {
|
|
150
131
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
151
132
|
}
|
|
152
133
|
|
|
153
|
-
export { capitalize as a,
|
|
134
|
+
export { capitalize as a, h as b, cornerMap as c, directionMap as d, handler as h, valueHandlers as v, xyzMap as x };
|
package/dist/utils.cjs
CHANGED
|
@@ -4,22 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./chunks/index.cjs');
|
|
6
6
|
const variants = require('./chunks/variants.cjs');
|
|
7
|
+
require('@unocss/core');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
exports.bracket = index.bracket;
|
|
11
11
|
exports.capitalize = index.capitalize;
|
|
12
12
|
exports.cornerMap = index.cornerMap;
|
|
13
|
-
exports.cssvar = index.cssvar;
|
|
14
13
|
exports.directionMap = index.directionMap;
|
|
15
|
-
exports.
|
|
16
|
-
exports.global = index.global;
|
|
14
|
+
exports.h = index.h;
|
|
17
15
|
exports.handler = index.handler;
|
|
18
|
-
exports.
|
|
19
|
-
exports.number = index.number;
|
|
20
|
-
exports.percent = index.percent;
|
|
21
|
-
exports.px = index.px;
|
|
22
|
-
exports.rem = index.rem;
|
|
23
|
-
exports.time = index.time;
|
|
16
|
+
exports.valueHandlers = index.valueHandlers;
|
|
24
17
|
exports.xyzMap = index.xyzMap;
|
|
25
18
|
exports.variantMatcher = variants.variantMatcher;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _unocss_core from '@unocss/core';
|
|
1
2
|
import { VariantHandler } from '@unocss/core';
|
|
2
3
|
|
|
3
4
|
declare const directionMap: Record<string, string[]>;
|
|
@@ -37,20 +38,11 @@ declare namespace handlers {
|
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
declare
|
|
41
|
-
declare const
|
|
42
|
-
declare type Handler = {
|
|
43
|
-
[K in HandlerName]: Handler;
|
|
44
|
-
} & {
|
|
45
|
-
(str: string): string | undefined;
|
|
46
|
-
__options: {
|
|
47
|
-
sequence: HandlerName[];
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
declare const handler: Handler;
|
|
41
|
+
declare const handler: _unocss_core.ValueHandler<"number" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global">;
|
|
42
|
+
declare const h: _unocss_core.ValueHandler<"number" | "rem" | "px" | "percent" | "fraction" | "bracket" | "cssvar" | "time" | "global">;
|
|
51
43
|
|
|
52
44
|
declare const variantMatcher: (name: string, selector?: ((input: string) => string | undefined) | undefined) => (input: string) => VariantHandler | undefined;
|
|
53
45
|
|
|
54
46
|
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
55
47
|
|
|
56
|
-
export {
|
|
48
|
+
export { capitalize, cornerMap, directionMap, h, handler, handlers as valueHandlers, variantMatcher, xyzMap };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a as capitalize, c as cornerMap, d as directionMap, b as h, h as handler, v as valueHandlers, x as xyzMap } from './chunks/index.mjs';
|
|
2
2
|
export { v as variantMatcher } from './chunks/variants.mjs';
|
|
3
|
+
import '@unocss/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.6",
|
|
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.15.
|
|
64
|
+
"@unocss/core": "0.15.6"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|