@unocss/preset-mini 0.57.6 → 0.58.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/index.cjs +3 -3
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/rules.cjs +128 -92
- package/dist/rules.d.cts +1 -5
- package/dist/rules.d.mts +1 -5
- package/dist/rules.d.ts +1 -5
- package/dist/rules.mjs +130 -93
- package/dist/shared/{preset-mini.dPVVIvNm.mjs → preset-mini.5jRPR_fm.mjs} +15 -5
- package/dist/shared/{preset-mini.XmVozI6N.d.mts → preset-mini.WMGBnRDa.d.mts} +3 -2
- package/dist/shared/{preset-mini.Jpc0QYPj.d.cts → preset-mini.WoiFygE2.d.cts} +3 -2
- package/dist/shared/{preset-mini.MACvs-wn.cjs → preset-mini.qLxuqSG-.cjs} +15 -5
- package/dist/shared/{preset-mini.QW22c5Df.d.ts → preset-mini.zVYE2D2j.d.ts} +3 -2
- package/dist/theme.cjs +2 -2
- package/dist/theme.mjs +2 -2
- package/dist/utils.cjs +545 -28
- package/dist/utils.d.cts +3 -3
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.mjs +524 -2
- package/dist/variants.cjs +62 -31
- package/dist/variants.d.cts +3 -3
- package/dist/variants.d.mts +3 -3
- package/dist/variants.d.ts +3 -3
- package/dist/variants.mjs +62 -31
- package/package.json +4 -4
- package/dist/shared/preset-mini.ImRm63ih.cjs +0 -542
- package/dist/shared/preset-mini.Stl9mkMB.mjs +0 -518
package/dist/index.cjs
CHANGED
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const core = require('@unocss/core');
|
|
6
6
|
const extractorArbitraryVariants = require('@unocss/extractor-arbitrary-variants');
|
|
7
|
-
const utils = require('./
|
|
7
|
+
const utils = require('./utils.cjs');
|
|
8
8
|
const theme = require('./theme.cjs');
|
|
9
9
|
const rules = require('./rules.cjs');
|
|
10
10
|
const variants = require('./variants.cjs');
|
|
11
11
|
const colors = require('./colors.cjs');
|
|
12
12
|
require('@unocss/rule-utils');
|
|
13
|
-
require('./shared/preset-mini.
|
|
13
|
+
require('./shared/preset-mini.qLxuqSG-.cjs');
|
|
14
14
|
|
|
15
15
|
const preflights = [
|
|
16
16
|
{
|
|
@@ -71,7 +71,7 @@ function normalizePreflights(preflights3, variablePrefix) {
|
|
|
71
71
|
if (variablePrefix !== "un-") {
|
|
72
72
|
return preflights3.map((p) => ({
|
|
73
73
|
...p,
|
|
74
|
-
getCSS: (() => async (ctx) => {
|
|
74
|
+
getCSS: /* @__PURE__ */ (() => async (ctx) => {
|
|
75
75
|
const css = await p.getCSS(ctx);
|
|
76
76
|
if (css)
|
|
77
77
|
return css.replace(/--un-/g, `--${variablePrefix}`);
|
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { T as Theme } from './shared/preset-mini.7XoWRZIl.cjs';
|
|
|
4
4
|
export { a as ThemeAnimation } from './shared/preset-mini.7XoWRZIl.cjs';
|
|
5
5
|
export { t as theme } from './shared/preset-mini.5-XKlNyK.cjs';
|
|
6
6
|
export { colors } from './colors.cjs';
|
|
7
|
-
export { p as parseColor } from './shared/preset-mini.
|
|
7
|
+
export { p as parseColor } from './shared/preset-mini.WoiFygE2.cjs';
|
|
8
8
|
|
|
9
9
|
declare const preflights: Preflight<Theme>[];
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@ interface PresetMiniOptions extends PresetOptions {
|
|
|
30
30
|
*/
|
|
31
31
|
dark?: 'class' | 'media' | DarkModeSelectors;
|
|
32
32
|
/**
|
|
33
|
-
* Generate pseudo selector as `[group=""]` instead of `.group`
|
|
33
|
+
* Generate tagged pseudo selector as `[group=""]` instead of `.group`
|
|
34
34
|
*
|
|
35
35
|
* @default false
|
|
36
36
|
*/
|
|
@@ -42,7 +42,7 @@ interface PresetMiniOptions extends PresetOptions {
|
|
|
42
42
|
*/
|
|
43
43
|
variablePrefix?: string;
|
|
44
44
|
/**
|
|
45
|
-
* Utils prefix
|
|
45
|
+
* Utils prefix. When using tagged pseudo selector, only the first truthy prefix will be used.
|
|
46
46
|
*
|
|
47
47
|
* @default undefined
|
|
48
48
|
*/
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { T as Theme } from './shared/preset-mini.7XoWRZIl.mjs';
|
|
|
4
4
|
export { a as ThemeAnimation } from './shared/preset-mini.7XoWRZIl.mjs';
|
|
5
5
|
export { t as theme } from './shared/preset-mini.4DxDu2I8.mjs';
|
|
6
6
|
export { colors } from './colors.mjs';
|
|
7
|
-
export { p as parseColor } from './shared/preset-mini.
|
|
7
|
+
export { p as parseColor } from './shared/preset-mini.WMGBnRDa.mjs';
|
|
8
8
|
|
|
9
9
|
declare const preflights: Preflight<Theme>[];
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@ interface PresetMiniOptions extends PresetOptions {
|
|
|
30
30
|
*/
|
|
31
31
|
dark?: 'class' | 'media' | DarkModeSelectors;
|
|
32
32
|
/**
|
|
33
|
-
* Generate pseudo selector as `[group=""]` instead of `.group`
|
|
33
|
+
* Generate tagged pseudo selector as `[group=""]` instead of `.group`
|
|
34
34
|
*
|
|
35
35
|
* @default false
|
|
36
36
|
*/
|
|
@@ -42,7 +42,7 @@ interface PresetMiniOptions extends PresetOptions {
|
|
|
42
42
|
*/
|
|
43
43
|
variablePrefix?: string;
|
|
44
44
|
/**
|
|
45
|
-
* Utils prefix
|
|
45
|
+
* Utils prefix. When using tagged pseudo selector, only the first truthy prefix will be used.
|
|
46
46
|
*
|
|
47
47
|
* @default undefined
|
|
48
48
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { T as Theme } from './shared/preset-mini.7XoWRZIl.js';
|
|
|
4
4
|
export { a as ThemeAnimation } from './shared/preset-mini.7XoWRZIl.js';
|
|
5
5
|
export { t as theme } from './shared/preset-mini.5daNC9yh.js';
|
|
6
6
|
export { colors } from './colors.js';
|
|
7
|
-
export { p as parseColor } from './shared/preset-mini.
|
|
7
|
+
export { p as parseColor } from './shared/preset-mini.zVYE2D2j.js';
|
|
8
8
|
|
|
9
9
|
declare const preflights: Preflight<Theme>[];
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@ interface PresetMiniOptions extends PresetOptions {
|
|
|
30
30
|
*/
|
|
31
31
|
dark?: 'class' | 'media' | DarkModeSelectors;
|
|
32
32
|
/**
|
|
33
|
-
* Generate pseudo selector as `[group=""]` instead of `.group`
|
|
33
|
+
* Generate tagged pseudo selector as `[group=""]` instead of `.group`
|
|
34
34
|
*
|
|
35
35
|
* @default false
|
|
36
36
|
*/
|
|
@@ -42,7 +42,7 @@ interface PresetMiniOptions extends PresetOptions {
|
|
|
42
42
|
*/
|
|
43
43
|
variablePrefix?: string;
|
|
44
44
|
/**
|
|
45
|
-
* Utils prefix
|
|
45
|
+
* Utils prefix. When using tagged pseudo selector, only the first truthy prefix will be used.
|
|
46
46
|
*
|
|
47
47
|
* @default undefined
|
|
48
48
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { entriesToCss, toArray, definePreset } from '@unocss/core';
|
|
2
2
|
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { globalKeywords } from './utils.mjs';
|
|
4
|
+
export { parseColor } from './utils.mjs';
|
|
5
5
|
import { theme } from './theme.mjs';
|
|
6
6
|
import { rules } from './rules.mjs';
|
|
7
7
|
import { variants } from './variants.mjs';
|
|
8
8
|
export { colors } from './colors.mjs';
|
|
9
9
|
import '@unocss/rule-utils';
|
|
10
|
-
import './shared/preset-mini.
|
|
10
|
+
import './shared/preset-mini.5jRPR_fm.mjs';
|
|
11
11
|
|
|
12
12
|
const preflights = [
|
|
13
13
|
{
|
|
@@ -68,7 +68,7 @@ function normalizePreflights(preflights3, variablePrefix) {
|
|
|
68
68
|
if (variablePrefix !== "un-") {
|
|
69
69
|
return preflights3.map((p) => ({
|
|
70
70
|
...p,
|
|
71
|
-
getCSS: (() => async (ctx) => {
|
|
71
|
+
getCSS: /* @__PURE__ */ (() => async (ctx) => {
|
|
72
72
|
const css = await p.getCSS(ctx);
|
|
73
73
|
if (css)
|
|
74
74
|
return css.replace(/--un-/g, `--${variablePrefix}`);
|
package/dist/rules.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const utils = require('./
|
|
3
|
+
const utils = require('./utils.cjs');
|
|
4
4
|
const ruleUtils = require('@unocss/rule-utils');
|
|
5
5
|
const core = require('@unocss/core');
|
|
6
|
-
const transform = require('./shared/preset-mini.
|
|
6
|
+
const transform = require('./shared/preset-mini.qLxuqSG-.cjs');
|
|
7
7
|
|
|
8
8
|
const verticalAlignAlias = {
|
|
9
9
|
"mid": "middle",
|
|
@@ -37,9 +37,9 @@ const textAligns = ["center", "left", "right", "justify", "start", "end"].map((v
|
|
|
37
37
|
|
|
38
38
|
const outline = [
|
|
39
39
|
// size
|
|
40
|
-
[/^outline-(?:width-|size-)?(.+)$/,
|
|
40
|
+
[/^outline-(?:width-|size-)?(.+)$/, handleWidth$2, { autocomplete: "outline-(width|size)-<num>" }],
|
|
41
41
|
// color
|
|
42
|
-
[/^outline-(?:color-)?(.+)$/,
|
|
42
|
+
[/^outline-(?:color-)?(.+)$/, handleColorOrWidth$2, { autocomplete: "outline-$colors" }],
|
|
43
43
|
// offset
|
|
44
44
|
[/^outline-offset-(.+)$/, ([, d], { theme }) => ({ "outline-offset": theme.lineWidth?.[d] ?? utils.h.bracket.cssvar.global.px(d) }), { autocomplete: "outline-(offset)-<num>" }],
|
|
45
45
|
// style
|
|
@@ -47,6 +47,14 @@ const outline = [
|
|
|
47
47
|
...["auto", "dashed", "dotted", "double", "hidden", "solid", "groove", "ridge", "inset", "outset", ...utils.globalKeywords].map((v) => [`outline-${v}`, { "outline-style": v }]),
|
|
48
48
|
["outline-none", { "outline": "2px solid transparent", "outline-offset": "2px" }]
|
|
49
49
|
];
|
|
50
|
+
function handleWidth$2([, b], { theme }) {
|
|
51
|
+
return { "outline-width": theme.lineWidth?.[b] ?? utils.h.bracket.cssvar.global.px(b) };
|
|
52
|
+
}
|
|
53
|
+
function handleColorOrWidth$2(match, ctx) {
|
|
54
|
+
if (utils.isCSSMathFn(utils.h.bracket(match[1])))
|
|
55
|
+
return handleWidth$2(match, ctx);
|
|
56
|
+
return utils.colorResolver("outline-color", "outline-color", "borderColor")(match, ctx);
|
|
57
|
+
}
|
|
50
58
|
const appearance = [
|
|
51
59
|
["appearance-none", {
|
|
52
60
|
"-webkit-appearance": "none",
|
|
@@ -66,11 +74,11 @@ const willChange = [
|
|
|
66
74
|
const borderStyles = ["solid", "dashed", "dotted", "double", "hidden", "none", "groove", "ridge", "inset", "outset", ...utils.globalKeywords];
|
|
67
75
|
const borders = [
|
|
68
76
|
// compound
|
|
69
|
-
[/^(?:border|b)()(?:-(.+))?$/,
|
|
70
|
-
[/^(?:border|b)-([xy])(?:-(.+))?$/,
|
|
71
|
-
[/^(?:border|b)-([rltbse])(?:-(.+))?$/,
|
|
72
|
-
[/^(?:border|b)-(block|inline)(?:-(.+))?$/,
|
|
73
|
-
[/^(?:border|b)-([bi][se])(?:-(.+))?$/,
|
|
77
|
+
[/^(?:border|b)()(?:-(.+))?$/, handlerBorderSize, { autocomplete: "(border|b)-<directions>" }],
|
|
78
|
+
[/^(?:border|b)-([xy])(?:-(.+))?$/, handlerBorderSize],
|
|
79
|
+
[/^(?:border|b)-([rltbse])(?:-(.+))?$/, handlerBorderSize],
|
|
80
|
+
[/^(?:border|b)-(block|inline)(?:-(.+))?$/, handlerBorderSize],
|
|
81
|
+
[/^(?:border|b)-([bi][se])(?:-(.+))?$/, handlerBorderSize],
|
|
74
82
|
// size
|
|
75
83
|
[/^(?:border|b)-()(?:width|size)-(.+)$/, handlerBorderSize, { autocomplete: ["(border|b)-<num>", "(border|b)-<directions>-<num>"] }],
|
|
76
84
|
[/^(?:border|b)-([xy])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
@@ -78,11 +86,11 @@ const borders = [
|
|
|
78
86
|
[/^(?:border|b)-(block|inline)-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
79
87
|
[/^(?:border|b)-([bi][se])-(?:width|size)-(.+)$/, handlerBorderSize],
|
|
80
88
|
// colors
|
|
81
|
-
[/^(?:border|b)-()(?:color-)?(.+)$/,
|
|
82
|
-
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/,
|
|
83
|
-
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/,
|
|
84
|
-
[/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/,
|
|
85
|
-
[/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/,
|
|
89
|
+
[/^(?:border|b)-()(?:color-)?(.+)$/, handlerBorderColorOrSize, { autocomplete: ["(border|b)-$colors", "(border|b)-<directions>-$colors"] }],
|
|
90
|
+
[/^(?:border|b)-([xy])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
|
|
91
|
+
[/^(?:border|b)-([rltbse])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
|
|
92
|
+
[/^(?:border|b)-(block|inline)-(?:color-)?(.+)$/, handlerBorderColorOrSize],
|
|
93
|
+
[/^(?:border|b)-([bi][se])-(?:color-)?(.+)$/, handlerBorderColorOrSize],
|
|
86
94
|
// opacity
|
|
87
95
|
[/^(?:border|b)-()op(?:acity)?-?(.+)$/, handlerBorderOpacity, { autocomplete: "(border|b)-(op|opacity)-<percent>" }],
|
|
88
96
|
[/^(?:border|b)-([xy])-op(?:acity)?-?(.+)$/, handlerBorderOpacity],
|
|
@@ -128,31 +136,27 @@ function borderColorResolver(direction) {
|
|
|
128
136
|
};
|
|
129
137
|
}
|
|
130
138
|
} else if (color) {
|
|
131
|
-
if (utils.isCSSMathFn(color)) {
|
|
132
|
-
return {
|
|
133
|
-
"border-width": color
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
139
|
return {
|
|
137
140
|
[`border${direction}-color`]: ruleUtils.colorToString(color, alpha)
|
|
138
141
|
};
|
|
139
142
|
}
|
|
140
143
|
};
|
|
141
144
|
}
|
|
142
|
-
function handlerBorder(m, ctx) {
|
|
143
|
-
return handlerBorderSize(m, ctx);
|
|
144
|
-
}
|
|
145
145
|
function handlerBorderSize([, a = "", b], { theme }) {
|
|
146
146
|
const v = theme.lineWidth?.[b || "DEFAULT"] ?? utils.h.bracket.cssvar.global.px(b || "1");
|
|
147
147
|
if (a in utils.directionMap && v != null)
|
|
148
148
|
return utils.directionMap[a].map((i) => [`border${i}-width`, v]);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
if (a in utils.directionMap
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
function handlerBorderColorOrSize([, a = "", b], ctx) {
|
|
151
|
+
if (a in utils.directionMap) {
|
|
152
|
+
if (utils.isCSSMathFn(utils.h.bracket(b)))
|
|
153
|
+
return handlerBorderSize(["", a, b], ctx);
|
|
154
|
+
if (utils.hasParseableColor(b, ctx.theme, "borderColor")) {
|
|
155
|
+
return Object.assign(
|
|
156
|
+
{},
|
|
157
|
+
...utils.directionMap[a].map((i) => borderColorResolver(i)(["", b], ctx.theme))
|
|
158
|
+
);
|
|
159
|
+
}
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
function handlerBorderOpacity([, a = "", opacity]) {
|
|
@@ -173,15 +177,20 @@ function handlerBorderStyle([, a = "", s]) {
|
|
|
173
177
|
const opacity = [
|
|
174
178
|
[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: utils.h.bracket.percent.cssvar(d) })]
|
|
175
179
|
];
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
[/^text-(.+)$/, utils.colorResolver("color", "text", "textColor", (css) => !css.color?.toString().match(utils.numberWithUnitRE)), { autocomplete: "text-$colors" }],
|
|
180
|
-
[/^(?:text|color|c)-(.+)$/, ([, v]) => utils.globalKeywords.includes(v) ? { color: v } : void 0, { autocomplete: `(text|color|c)-(${utils.globalKeywords.join("|")})` }],
|
|
181
|
-
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-text-opacity": utils.h.bracket.percent.cssvar(opacity2) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }]
|
|
182
|
-
];
|
|
180
|
+
const bgUrlRE = /^\[url\(.+\)\]$/;
|
|
181
|
+
const bgLengthRE = /^\[length:.+\]$/;
|
|
182
|
+
const bgPositionRE = /^\[position:.+\]$/;
|
|
183
183
|
const bgColors = [
|
|
184
|
-
[/^bg-(.+)$/, (...args) =>
|
|
184
|
+
[/^bg-(.+)$/, (...args) => {
|
|
185
|
+
const d = args[0][1];
|
|
186
|
+
if (bgUrlRE.test(d))
|
|
187
|
+
return { "--un-url": utils.h.bracket(d), "background-image": "var(--un-url)" };
|
|
188
|
+
if (bgLengthRE.test(d) && utils.h.bracketOfLength(d) != null)
|
|
189
|
+
return { "background-size": utils.h.bracketOfLength(d).split(" ").map((e) => utils.h.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
190
|
+
if ((utils.isSize(d) || bgPositionRE.test(d)) && utils.h.bracketOfPosition(d) != null)
|
|
191
|
+
return { "background-position": utils.h.bracketOfPosition(d).split(" ").map((e) => utils.h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
|
|
192
|
+
return utils.colorResolver("background-color", "bg", "backgroundColor")(...args);
|
|
193
|
+
}],
|
|
185
194
|
[/^bg-op(?:acity)?-?(.+)$/, ([, opacity2]) => ({ "--un-bg-opacity": utils.h.bracket.percent.cssvar(opacity2) }), { autocomplete: "bg-(op|opacity)-<percent>" }]
|
|
186
195
|
];
|
|
187
196
|
const colorScheme = [
|
|
@@ -202,18 +211,10 @@ const decorationStyles = ["solid", "double", "dotted", "dashed", "wavy", ...util
|
|
|
202
211
|
const textDecorations = [
|
|
203
212
|
[/^(?:decoration-)?(underline|overline|line-through)$/, ([, s]) => ({ "text-decoration-line": s }), { autocomplete: "decoration-(underline|overline|line-through)" }],
|
|
204
213
|
// size
|
|
205
|
-
[/^(?:underline|decoration)-(?:size-)?(.+)$/,
|
|
214
|
+
[/^(?:underline|decoration)-(?:size-)?(.+)$/, handleWidth$1, { autocomplete: "(underline|decoration)-<num>" }],
|
|
206
215
|
[/^(?:underline|decoration)-(auto|from-font)$/, ([, s]) => ({ "text-decoration-thickness": s }), { autocomplete: "(underline|decoration)-(auto|from-font)" }],
|
|
207
216
|
// colors
|
|
208
|
-
[/^(?:underline|decoration)-(.+)$/,
|
|
209
|
-
const result = utils.colorResolver("text-decoration-color", "line", "borderColor")(match, ctx);
|
|
210
|
-
if (result) {
|
|
211
|
-
return {
|
|
212
|
-
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
213
|
-
...result
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
}, { autocomplete: "(underline|decoration)-$colors" }],
|
|
217
|
+
[/^(?:underline|decoration)-(.+)$/, handleColorOrWidth$1, { autocomplete: "(underline|decoration)-$colors" }],
|
|
217
218
|
[/^(?:underline|decoration)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-line-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }],
|
|
218
219
|
// offset
|
|
219
220
|
[/^(?:underline|decoration)-offset-(.+)$/, ([, s], { theme }) => ({ "text-underline-offset": theme.lineWidth?.[s] ?? utils.h.auto.bracket.cssvar.global.px(s) }), { autocomplete: "(underline|decoration)-(offset)-<num>" }],
|
|
@@ -223,6 +224,20 @@ const textDecorations = [
|
|
|
223
224
|
["no-underline", { "text-decoration": "none" }],
|
|
224
225
|
["decoration-none", { "text-decoration": "none" }]
|
|
225
226
|
];
|
|
227
|
+
function handleWidth$1([, b], { theme }) {
|
|
228
|
+
return { "text-decoration-thickness": theme.lineWidth?.[b] ?? utils.h.bracket.cssvar.global.px(b) };
|
|
229
|
+
}
|
|
230
|
+
function handleColorOrWidth$1(match, ctx) {
|
|
231
|
+
if (utils.isCSSMathFn(utils.h.bracket(match[1])))
|
|
232
|
+
return handleWidth$1(match, ctx);
|
|
233
|
+
const result = utils.colorResolver("text-decoration-color", "line", "borderColor")(match, ctx);
|
|
234
|
+
if (result) {
|
|
235
|
+
return {
|
|
236
|
+
"-webkit-text-decoration-color": result["text-decoration-color"],
|
|
237
|
+
...result
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
226
241
|
|
|
227
242
|
const transitionPropertyGroup = {
|
|
228
243
|
all: "all",
|
|
@@ -305,48 +320,19 @@ const flex = [
|
|
|
305
320
|
["flex-nowrap", { "flex-wrap": "nowrap" }]
|
|
306
321
|
];
|
|
307
322
|
|
|
308
|
-
function handleThemeByKey(s, theme, key) {
|
|
309
|
-
return theme[key]?.[s] || utils.h.bracket.cssvar.global.rem(s);
|
|
310
|
-
}
|
|
311
323
|
const fonts = [
|
|
312
|
-
//
|
|
313
|
-
[
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
...height
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
return {
|
|
328
|
-
"font-size": fontSize2,
|
|
329
|
-
"line-height": lineHeight ?? height ?? "1",
|
|
330
|
-
"letter-spacing": letterSpacing ? handleThemeByKey(letterSpacing, theme, "letterSpacing") : void 0
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
const fontSize = utils.h.bracketOfLength.rem(size);
|
|
334
|
-
if (lineHeight && fontSize) {
|
|
335
|
-
return {
|
|
336
|
-
"font-size": fontSize,
|
|
337
|
-
"line-height": lineHeight
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
return { "font-size": utils.h.bracketOfLength.rem(s) };
|
|
341
|
-
},
|
|
342
|
-
{ autocomplete: "text-$fontSize" }
|
|
343
|
-
],
|
|
344
|
-
[/^(?:text|font)-size-(.+)$/, ([, s], { theme }) => {
|
|
345
|
-
const themed = core.toArray(theme.fontSize?.[s]);
|
|
346
|
-
const size = themed?.[0] ?? utils.h.bracket.cssvar.global.rem(s);
|
|
347
|
-
if (size != null)
|
|
348
|
-
return { "font-size": size };
|
|
349
|
-
}, { autocomplete: "text-size-$fontSize" }],
|
|
324
|
+
// text
|
|
325
|
+
[/^text-(.+)$/, handleText, { autocomplete: "text-$fontSize" }],
|
|
326
|
+
// text size
|
|
327
|
+
[/^(?:text|font)-size-(.+)$/, handleSize, { autocomplete: "text-size-$fontSize" }],
|
|
328
|
+
// text colors
|
|
329
|
+
[/^text-(?:color-)?(.+)$/, handlerColorOrSize, { autocomplete: "text-$colors" }],
|
|
330
|
+
// colors
|
|
331
|
+
[/^(?:color|c)-(.+)$/, utils.colorResolver("color", "text", "textColor"), { autocomplete: "(color|c)-$colors" }],
|
|
332
|
+
// style
|
|
333
|
+
[/^(?:text|color|c)-(.+)$/, ([, v]) => utils.globalKeywords.includes(v) ? { color: v } : void 0, { autocomplete: `(text|color|c)-(${utils.globalKeywords.join("|")})` }],
|
|
334
|
+
// opacity
|
|
335
|
+
[/^(?:text|color|c)-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }],
|
|
350
336
|
// weights
|
|
351
337
|
[
|
|
352
338
|
/^(?:font|fw)-?([^-]+)$/,
|
|
@@ -426,6 +412,50 @@ const textShadows = [
|
|
|
426
412
|
[/^text-shadow-color-(.+)$/, utils.colorResolver("--un-text-shadow-color", "text-shadow", "shadowColor"), { autocomplete: "text-shadow-color-$colors" }],
|
|
427
413
|
[/^text-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-text-shadow-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "text-shadow-color-(op|opacity)-<percent>" }]
|
|
428
414
|
];
|
|
415
|
+
function handleThemeByKey(s, theme, key) {
|
|
416
|
+
return theme[key]?.[s] || utils.h.bracket.cssvar.global.rem(s);
|
|
417
|
+
}
|
|
418
|
+
function handleSize([, s], { theme }) {
|
|
419
|
+
const themed = core.toArray(theme.fontSize?.[s]);
|
|
420
|
+
const size = themed?.[0] ?? utils.h.bracket.cssvar.global.rem(s);
|
|
421
|
+
if (size != null)
|
|
422
|
+
return { "font-size": size };
|
|
423
|
+
}
|
|
424
|
+
function handlerColorOrSize(match, ctx) {
|
|
425
|
+
if (utils.isCSSMathFn(utils.h.bracket(match[1])))
|
|
426
|
+
return handleSize(match, ctx);
|
|
427
|
+
return utils.colorResolver("color", "text", "textColor")(match, ctx);
|
|
428
|
+
}
|
|
429
|
+
function handleText([, s = "base"], { theme }) {
|
|
430
|
+
const split = utils.splitShorthand(s, "length");
|
|
431
|
+
if (!split)
|
|
432
|
+
return;
|
|
433
|
+
const [size, leading] = split;
|
|
434
|
+
const sizePairs = core.toArray(theme.fontSize?.[size]);
|
|
435
|
+
const lineHeight = leading ? handleThemeByKey(leading, theme, "lineHeight") : void 0;
|
|
436
|
+
if (sizePairs?.[0]) {
|
|
437
|
+
const [fontSize2, height, letterSpacing] = sizePairs;
|
|
438
|
+
if (typeof height === "object") {
|
|
439
|
+
return {
|
|
440
|
+
"font-size": fontSize2,
|
|
441
|
+
...height
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
return {
|
|
445
|
+
"font-size": fontSize2,
|
|
446
|
+
"line-height": lineHeight ?? height ?? "1",
|
|
447
|
+
"letter-spacing": letterSpacing ? handleThemeByKey(letterSpacing, theme, "letterSpacing") : void 0
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
const fontSize = utils.h.bracketOfLength.rem(size);
|
|
451
|
+
if (lineHeight && fontSize) {
|
|
452
|
+
return {
|
|
453
|
+
"font-size": fontSize,
|
|
454
|
+
"line-height": lineHeight
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
return { "font-size": utils.h.bracketOfLength.rem(s) };
|
|
458
|
+
}
|
|
429
459
|
|
|
430
460
|
const directions = {
|
|
431
461
|
"": "",
|
|
@@ -782,7 +812,7 @@ const cssProperty = [
|
|
|
782
812
|
return;
|
|
783
813
|
const [prop, ...rest] = body.split(":");
|
|
784
814
|
const value = rest.join(":");
|
|
785
|
-
if (!isURI(body) &&
|
|
815
|
+
if (!isURI(body) && /^[a-z-]+$/.test(prop) && isValidCSSBody(value)) {
|
|
786
816
|
let parsed;
|
|
787
817
|
if (ruleUtils.hasThemeFn(value))
|
|
788
818
|
parsed = ruleUtils.transformThemeFn(value, theme);
|
|
@@ -845,12 +875,12 @@ const svgUtilities = [
|
|
|
845
875
|
[/^fill-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-fill-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "fill-(op|opacity)-<percent>" }],
|
|
846
876
|
["fill-none", { fill: "none" }],
|
|
847
877
|
// stroke size
|
|
848
|
-
[/^stroke-(?:width-|size-)?(.+)$/,
|
|
878
|
+
[/^stroke-(?:width-|size-)?(.+)$/, handleWidth, { autocomplete: ["stroke-width-$lineWidth", "stroke-size-$lineWidth"] }],
|
|
849
879
|
// stroke dash
|
|
850
880
|
[/^stroke-dash-(.+)$/, ([, s]) => ({ "stroke-dasharray": utils.h.bracket.cssvar.number(s) }), { autocomplete: "stroke-dash-<num>" }],
|
|
851
881
|
[/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": theme.lineWidth?.[s] ?? utils.h.bracket.cssvar.px.numberWithUnit(s) }), { autocomplete: "stroke-offset-$lineWidth" }],
|
|
852
882
|
// stroke colors
|
|
853
|
-
[/^stroke-(.+)$/,
|
|
883
|
+
[/^stroke-(.+)$/, handleColorOrWidth, { autocomplete: "stroke-$colors" }],
|
|
854
884
|
[/^stroke-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-stroke-opacity": utils.h.bracket.percent.cssvar(opacity) }), { autocomplete: "stroke-(op|opacity)-<percent>" }],
|
|
855
885
|
// line cap
|
|
856
886
|
["stroke-cap-square", { "stroke-linecap": "square" }],
|
|
@@ -865,6 +895,14 @@ const svgUtilities = [
|
|
|
865
895
|
// none
|
|
866
896
|
["stroke-none", { stroke: "none" }]
|
|
867
897
|
];
|
|
898
|
+
function handleWidth([, b], { theme }) {
|
|
899
|
+
return { "stroke-width": theme.lineWidth?.[b] ?? utils.h.bracket.cssvar.fraction.px.number(b) };
|
|
900
|
+
}
|
|
901
|
+
function handleColorOrWidth(match, ctx) {
|
|
902
|
+
if (utils.isCSSMathFn(utils.h.bracket(match[1])))
|
|
903
|
+
return handleWidth(match, ctx);
|
|
904
|
+
return utils.colorResolver("stroke", "stroke", "borderColor")(match, ctx);
|
|
905
|
+
}
|
|
868
906
|
|
|
869
907
|
const rules = [
|
|
870
908
|
cssVariables,
|
|
@@ -888,7 +926,6 @@ const rules = [
|
|
|
888
926
|
textShadows,
|
|
889
927
|
transform.textTransforms,
|
|
890
928
|
textAligns,
|
|
891
|
-
textColors,
|
|
892
929
|
transform.fontStyles,
|
|
893
930
|
transform.fontSmoothings,
|
|
894
931
|
transform.boxShadows,
|
|
@@ -986,7 +1023,6 @@ exports.sizes = sizes;
|
|
|
986
1023
|
exports.svgUtilities = svgUtilities;
|
|
987
1024
|
exports.tabSizes = tabSizes;
|
|
988
1025
|
exports.textAligns = textAligns;
|
|
989
|
-
exports.textColors = textColors;
|
|
990
1026
|
exports.textDecorations = textDecorations;
|
|
991
1027
|
exports.textIndents = textIndents;
|
|
992
1028
|
exports.textShadows = textShadows;
|
package/dist/rules.d.cts
CHANGED
|
@@ -16,10 +16,6 @@ declare function handlerBorderStyle([, a, s]: string[]): CSSEntries | undefined;
|
|
|
16
16
|
* @example op10 op-30 opacity-100
|
|
17
17
|
*/
|
|
18
18
|
declare const opacity: Rule[];
|
|
19
|
-
/**
|
|
20
|
-
* @example c-red color-red5 text-red-300
|
|
21
|
-
*/
|
|
22
|
-
declare const textColors: Rule[];
|
|
23
19
|
declare const bgColors: Rule[];
|
|
24
20
|
declare const colorScheme: Rule[];
|
|
25
21
|
|
|
@@ -130,4 +126,4 @@ declare const textShadows: Rule<Theme>[];
|
|
|
130
126
|
declare const cssVariables: Rule[];
|
|
131
127
|
declare const cssProperty: Rule[];
|
|
132
128
|
|
|
133
|
-
export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxShadowsBase, boxSizing, breaks, colorScheme, containerParent, contains, contentVisibility, contents, cssProperty, cssVariables, cursors, displays, flex, flexGridJustifiesAlignments, floats, fontSmoothings, fontStyles, fonts, gaps, grids, handlerBorderStyle, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, ringBase, rings, rules, sizes, svgUtilities, tabSizes, textAligns,
|
|
129
|
+
export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxShadowsBase, boxSizing, breaks, colorScheme, containerParent, contains, contentVisibility, contents, cssProperty, cssVariables, cursors, displays, flex, flexGridJustifiesAlignments, floats, fontSmoothings, fontStyles, fonts, gaps, grids, handlerBorderStyle, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, ringBase, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, textWraps, transformBase, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
|
package/dist/rules.d.mts
CHANGED
|
@@ -16,10 +16,6 @@ declare function handlerBorderStyle([, a, s]: string[]): CSSEntries | undefined;
|
|
|
16
16
|
* @example op10 op-30 opacity-100
|
|
17
17
|
*/
|
|
18
18
|
declare const opacity: Rule[];
|
|
19
|
-
/**
|
|
20
|
-
* @example c-red color-red5 text-red-300
|
|
21
|
-
*/
|
|
22
|
-
declare const textColors: Rule[];
|
|
23
19
|
declare const bgColors: Rule[];
|
|
24
20
|
declare const colorScheme: Rule[];
|
|
25
21
|
|
|
@@ -130,4 +126,4 @@ declare const textShadows: Rule<Theme>[];
|
|
|
130
126
|
declare const cssVariables: Rule[];
|
|
131
127
|
declare const cssProperty: Rule[];
|
|
132
128
|
|
|
133
|
-
export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxShadowsBase, boxSizing, breaks, colorScheme, containerParent, contains, contentVisibility, contents, cssProperty, cssVariables, cursors, displays, flex, flexGridJustifiesAlignments, floats, fontSmoothings, fontStyles, fonts, gaps, grids, handlerBorderStyle, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, ringBase, rings, rules, sizes, svgUtilities, tabSizes, textAligns,
|
|
129
|
+
export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxShadowsBase, boxSizing, breaks, colorScheme, containerParent, contains, contentVisibility, contents, cssProperty, cssVariables, cursors, displays, flex, flexGridJustifiesAlignments, floats, fontSmoothings, fontStyles, fonts, gaps, grids, handlerBorderStyle, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, ringBase, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, textWraps, transformBase, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
|
package/dist/rules.d.ts
CHANGED
|
@@ -16,10 +16,6 @@ declare function handlerBorderStyle([, a, s]: string[]): CSSEntries | undefined;
|
|
|
16
16
|
* @example op10 op-30 opacity-100
|
|
17
17
|
*/
|
|
18
18
|
declare const opacity: Rule[];
|
|
19
|
-
/**
|
|
20
|
-
* @example c-red color-red5 text-red-300
|
|
21
|
-
*/
|
|
22
|
-
declare const textColors: Rule[];
|
|
23
19
|
declare const bgColors: Rule[];
|
|
24
20
|
declare const colorScheme: Rule[];
|
|
25
21
|
|
|
@@ -130,4 +126,4 @@ declare const textShadows: Rule<Theme>[];
|
|
|
130
126
|
declare const cssVariables: Rule[];
|
|
131
127
|
declare const cssProperty: Rule[];
|
|
132
128
|
|
|
133
|
-
export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxShadowsBase, boxSizing, breaks, colorScheme, containerParent, contains, contentVisibility, contents, cssProperty, cssVariables, cursors, displays, flex, flexGridJustifiesAlignments, floats, fontSmoothings, fontStyles, fonts, gaps, grids, handlerBorderStyle, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, ringBase, rings, rules, sizes, svgUtilities, tabSizes, textAligns,
|
|
129
|
+
export { alignments, appearance, appearances, aspectRatio, bgColors, borderStyles, borders, boxShadows, boxShadowsBase, boxSizing, breaks, colorScheme, containerParent, contains, contentVisibility, contents, cssProperty, cssVariables, cursors, displays, flex, flexGridJustifiesAlignments, floats, fontSmoothings, fontStyles, fonts, gaps, grids, handlerBorderStyle, insets, justifies, margins, opacity, orders, outline, overflows, paddings, placements, pointerEvents, positions, questionMark, resizes, ringBase, rings, rules, sizes, svgUtilities, tabSizes, textAligns, textDecorations, textIndents, textOverflows, textShadows, textStrokes, textTransforms, textWraps, transformBase, transforms, transitions, userSelects, varEmpty, verticalAligns, whitespaces, willChange, zIndexes };
|