@unocss/preset-mini 0.58.8 → 0.59.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +6 -6
- package/dist/rules.mjs +3 -3
- package/dist/shared/{preset-mini.DLBE_qKL.mjs → preset-mini.BLqeNSHq.mjs} +1 -1
- package/dist/shared/{preset-mini.D4T3hEuN.mjs → preset-mini.BkfCAdS7.mjs} +2 -2
- package/dist/shared/{preset-mini.Cr9SAx7D.mjs → preset-mini.CWuOZAHF.mjs} +14 -3
- package/dist/shared/{preset-mini.CPzuJ4uB.mjs → preset-mini.Cn7UNwSE.mjs} +1 -1
- package/dist/shared/{preset-mini.zoN9eE0Q.mjs → preset-mini.DeOzy57x.mjs} +1 -1
- package/dist/theme.mjs +3 -3
- package/dist/utils.d.mts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.mjs +1 -1
- package/dist/variants.mjs +2 -2
- package/package.json +18 -23
- package/dist/colors.cjs +0 -363
- package/dist/colors.d.cts +0 -354
- package/dist/index.cjs +0 -91
- package/dist/index.d.cts +0 -75
- package/dist/rules.cjs +0 -75
- package/dist/rules.d.cts +0 -129
- package/dist/shared/preset-mini.BCYTcd-i.cjs +0 -582
- package/dist/shared/preset-mini.BP7cviYW.d.cts +0 -75
- package/dist/shared/preset-mini.Bl8k7GEB.cjs +0 -796
- package/dist/shared/preset-mini.CxmMzOLj.cjs +0 -1033
- package/dist/shared/preset-mini.DLRoYX1Y.cjs +0 -322
- package/dist/shared/preset-mini.P5Rzuhf5.d.cts +0 -77
- package/dist/shared/preset-mini.bn9iWcrm.d.cts +0 -728
- package/dist/shared/preset-mini.hSTXklYn.cjs +0 -352
- package/dist/theme.cjs +0 -42
- package/dist/theme.d.cts +0 -270
- package/dist/utils.cjs +0 -42
- package/dist/utils.d.cts +0 -58
- package/dist/variants.cjs +0 -34
- package/dist/variants.d.cts +0 -47
package/dist/rules.d.cts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { Rule, CSSEntries, StaticRule } from '@unocss/core';
|
|
2
|
-
import { T as Theme } from './shared/preset-mini.P5Rzuhf5.cjs';
|
|
3
|
-
|
|
4
|
-
declare const verticalAligns: Rule[];
|
|
5
|
-
declare const textAligns: Rule[];
|
|
6
|
-
|
|
7
|
-
declare const outline: Rule<Theme>[];
|
|
8
|
-
declare const appearance: Rule[];
|
|
9
|
-
declare const willChange: Rule[];
|
|
10
|
-
|
|
11
|
-
declare const borderStyles: string[];
|
|
12
|
-
declare const borders: Rule[];
|
|
13
|
-
declare function handlerBorderStyle([, a, s]: string[]): CSSEntries | undefined;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @example op10 op-30 opacity-100
|
|
17
|
-
*/
|
|
18
|
-
declare const opacity: Rule[];
|
|
19
|
-
declare const bgColors: Rule[];
|
|
20
|
-
declare const colorScheme: Rule[];
|
|
21
|
-
|
|
22
|
-
declare const containerParent: Rule[];
|
|
23
|
-
|
|
24
|
-
declare const textDecorations: Rule<Theme>[];
|
|
25
|
-
|
|
26
|
-
declare const rules: Rule<Theme>[];
|
|
27
|
-
|
|
28
|
-
declare const flex: Rule<Theme>[];
|
|
29
|
-
|
|
30
|
-
declare const gaps: Rule[];
|
|
31
|
-
|
|
32
|
-
declare const grids: Rule<Theme>[];
|
|
33
|
-
|
|
34
|
-
declare const overflows: Rule[];
|
|
35
|
-
|
|
36
|
-
declare const positions: Rule[];
|
|
37
|
-
declare const justifies: StaticRule[];
|
|
38
|
-
declare const orders: Rule[];
|
|
39
|
-
declare const alignments: StaticRule[];
|
|
40
|
-
declare const placements: StaticRule[];
|
|
41
|
-
/**
|
|
42
|
-
* This is to add `flex-` and `grid-` prefix to the alignment rules,
|
|
43
|
-
* supporting `flex="~ items-center"` in attributify mode.
|
|
44
|
-
*/
|
|
45
|
-
declare const flexGridJustifiesAlignments: StaticRule[];
|
|
46
|
-
declare const insets: Rule[];
|
|
47
|
-
declare const floats: Rule[];
|
|
48
|
-
declare const zIndexes: Rule[];
|
|
49
|
-
declare const boxSizing: Rule[];
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Used for debugging, only available in development mode.
|
|
53
|
-
*
|
|
54
|
-
* @example `?` / `where`
|
|
55
|
-
*/
|
|
56
|
-
declare const questionMark: Rule[];
|
|
57
|
-
|
|
58
|
-
declare const ringBase: {
|
|
59
|
-
'--un-ring-inset': string;
|
|
60
|
-
'--un-ring-offset-width': string;
|
|
61
|
-
'--un-ring-offset-color': string;
|
|
62
|
-
'--un-ring-width': string;
|
|
63
|
-
'--un-ring-color': string;
|
|
64
|
-
'--un-shadow': string;
|
|
65
|
-
};
|
|
66
|
-
declare const rings: Rule<Theme>[];
|
|
67
|
-
|
|
68
|
-
declare const boxShadowsBase: {
|
|
69
|
-
'--un-ring-offset-shadow': string;
|
|
70
|
-
'--un-ring-shadow': string;
|
|
71
|
-
'--un-shadow-inset': string;
|
|
72
|
-
'--un-shadow': string;
|
|
73
|
-
};
|
|
74
|
-
declare const boxShadows: Rule<Theme>[];
|
|
75
|
-
|
|
76
|
-
declare const sizes: Rule<Theme>[];
|
|
77
|
-
declare const aspectRatio: Rule[];
|
|
78
|
-
|
|
79
|
-
declare const paddings: Rule[];
|
|
80
|
-
declare const margins: Rule[];
|
|
81
|
-
|
|
82
|
-
declare const varEmpty = " ";
|
|
83
|
-
declare const displays: Rule[];
|
|
84
|
-
declare const appearances: Rule[];
|
|
85
|
-
declare const cursors: Rule[];
|
|
86
|
-
declare const contains: Rule[];
|
|
87
|
-
declare const pointerEvents: Rule[];
|
|
88
|
-
declare const resizes: Rule[];
|
|
89
|
-
declare const userSelects: Rule[];
|
|
90
|
-
declare const whitespaces: Rule[];
|
|
91
|
-
declare const contentVisibility: Rule[];
|
|
92
|
-
declare const contents: Rule[];
|
|
93
|
-
declare const breaks: Rule[];
|
|
94
|
-
declare const textWraps: Rule[];
|
|
95
|
-
declare const textOverflows: Rule[];
|
|
96
|
-
declare const textTransforms: Rule[];
|
|
97
|
-
declare const fontStyles: Rule[];
|
|
98
|
-
declare const fontSmoothings: Rule[];
|
|
99
|
-
|
|
100
|
-
declare const svgUtilities: Rule<Theme>[];
|
|
101
|
-
|
|
102
|
-
declare const transformBase: {
|
|
103
|
-
'--un-rotate': number;
|
|
104
|
-
'--un-rotate-x': number;
|
|
105
|
-
'--un-rotate-y': number;
|
|
106
|
-
'--un-rotate-z': number;
|
|
107
|
-
'--un-scale-x': number;
|
|
108
|
-
'--un-scale-y': number;
|
|
109
|
-
'--un-scale-z': number;
|
|
110
|
-
'--un-skew-x': number;
|
|
111
|
-
'--un-skew-y': number;
|
|
112
|
-
'--un-translate-x': number;
|
|
113
|
-
'--un-translate-y': number;
|
|
114
|
-
'--un-translate-z': number;
|
|
115
|
-
};
|
|
116
|
-
declare const transforms: Rule[];
|
|
117
|
-
|
|
118
|
-
declare const transitions: Rule<Theme>[];
|
|
119
|
-
|
|
120
|
-
declare const fonts: Rule<Theme>[];
|
|
121
|
-
declare const tabSizes: Rule<Theme>[];
|
|
122
|
-
declare const textIndents: Rule<Theme>[];
|
|
123
|
-
declare const textStrokes: Rule<Theme>[];
|
|
124
|
-
declare const textShadows: Rule<Theme>[];
|
|
125
|
-
|
|
126
|
-
declare const cssVariables: Rule[];
|
|
127
|
-
declare const cssProperty: Rule[];
|
|
128
|
-
|
|
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 };
|
|
@@ -1,582 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const core = require('@unocss/core');
|
|
4
|
-
const ruleUtils = require('@unocss/rule-utils');
|
|
5
|
-
|
|
6
|
-
const directionMap = {
|
|
7
|
-
"l": ["-left"],
|
|
8
|
-
"r": ["-right"],
|
|
9
|
-
"t": ["-top"],
|
|
10
|
-
"b": ["-bottom"],
|
|
11
|
-
"s": ["-inline-start"],
|
|
12
|
-
"e": ["-inline-end"],
|
|
13
|
-
"x": ["-left", "-right"],
|
|
14
|
-
"y": ["-top", "-bottom"],
|
|
15
|
-
"": [""],
|
|
16
|
-
"bs": ["-block-start"],
|
|
17
|
-
"be": ["-block-end"],
|
|
18
|
-
"is": ["-inline-start"],
|
|
19
|
-
"ie": ["-inline-end"],
|
|
20
|
-
"block": ["-block-start", "-block-end"],
|
|
21
|
-
"inline": ["-inline-start", "-inline-end"]
|
|
22
|
-
};
|
|
23
|
-
const insetMap = {
|
|
24
|
-
...directionMap,
|
|
25
|
-
s: ["-inset-inline-start"],
|
|
26
|
-
start: ["-inset-inline-start"],
|
|
27
|
-
e: ["-inset-inline-end"],
|
|
28
|
-
end: ["-inset-inline-end"],
|
|
29
|
-
bs: ["-inset-block-start"],
|
|
30
|
-
be: ["-inset-block-end"],
|
|
31
|
-
is: ["-inset-inline-start"],
|
|
32
|
-
ie: ["-inset-inline-end"],
|
|
33
|
-
block: ["-inset-block-start", "-inset-block-end"],
|
|
34
|
-
inline: ["-inset-inline-start", "-inset-inline-end"]
|
|
35
|
-
};
|
|
36
|
-
const cornerMap = {
|
|
37
|
-
"l": ["-top-left", "-bottom-left"],
|
|
38
|
-
"r": ["-top-right", "-bottom-right"],
|
|
39
|
-
"t": ["-top-left", "-top-right"],
|
|
40
|
-
"b": ["-bottom-left", "-bottom-right"],
|
|
41
|
-
"tl": ["-top-left"],
|
|
42
|
-
"lt": ["-top-left"],
|
|
43
|
-
"tr": ["-top-right"],
|
|
44
|
-
"rt": ["-top-right"],
|
|
45
|
-
"bl": ["-bottom-left"],
|
|
46
|
-
"lb": ["-bottom-left"],
|
|
47
|
-
"br": ["-bottom-right"],
|
|
48
|
-
"rb": ["-bottom-right"],
|
|
49
|
-
"": [""],
|
|
50
|
-
"bs": ["-start-start", "-start-end"],
|
|
51
|
-
"be": ["-end-start", "-end-end"],
|
|
52
|
-
"s": ["-end-start", "-start-start"],
|
|
53
|
-
"is": ["-end-start", "-start-start"],
|
|
54
|
-
"e": ["-start-end", "-end-end"],
|
|
55
|
-
"ie": ["-start-end", "-end-end"],
|
|
56
|
-
"ss": ["-start-start"],
|
|
57
|
-
"bs-is": ["-start-start"],
|
|
58
|
-
"is-bs": ["-start-start"],
|
|
59
|
-
"se": ["-start-end"],
|
|
60
|
-
"bs-ie": ["-start-end"],
|
|
61
|
-
"ie-bs": ["-start-end"],
|
|
62
|
-
"es": ["-end-start"],
|
|
63
|
-
"be-is": ["-end-start"],
|
|
64
|
-
"is-be": ["-end-start"],
|
|
65
|
-
"ee": ["-end-end"],
|
|
66
|
-
"be-ie": ["-end-end"],
|
|
67
|
-
"ie-be": ["-end-end"]
|
|
68
|
-
};
|
|
69
|
-
const xyzMap = {
|
|
70
|
-
"x": ["-x"],
|
|
71
|
-
"y": ["-y"],
|
|
72
|
-
"z": ["-z"],
|
|
73
|
-
"": ["-x", "-y"]
|
|
74
|
-
};
|
|
75
|
-
const xyzArray = ["x", "y", "z"];
|
|
76
|
-
const basePositionMap = [
|
|
77
|
-
"top",
|
|
78
|
-
"top center",
|
|
79
|
-
"top left",
|
|
80
|
-
"top right",
|
|
81
|
-
"bottom",
|
|
82
|
-
"bottom center",
|
|
83
|
-
"bottom left",
|
|
84
|
-
"bottom right",
|
|
85
|
-
"left",
|
|
86
|
-
"left center",
|
|
87
|
-
"left top",
|
|
88
|
-
"left bottom",
|
|
89
|
-
"right",
|
|
90
|
-
"right center",
|
|
91
|
-
"right top",
|
|
92
|
-
"right bottom",
|
|
93
|
-
"center",
|
|
94
|
-
"center top",
|
|
95
|
-
"center bottom",
|
|
96
|
-
"center left",
|
|
97
|
-
"center right",
|
|
98
|
-
"center center"
|
|
99
|
-
];
|
|
100
|
-
const positionMap = Object.assign(
|
|
101
|
-
{},
|
|
102
|
-
...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })),
|
|
103
|
-
...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p }))
|
|
104
|
-
);
|
|
105
|
-
const globalKeywords = [
|
|
106
|
-
"inherit",
|
|
107
|
-
"initial",
|
|
108
|
-
"revert",
|
|
109
|
-
"revert-layer",
|
|
110
|
-
"unset"
|
|
111
|
-
];
|
|
112
|
-
const cssMathFnRE = /^(calc|clamp|min|max)\s*\((.+)\)(.*)/;
|
|
113
|
-
|
|
114
|
-
const numberWithUnitRE = /^(-?\d*(?:\.\d+)?)(px|pt|pc|%|r?(?:em|ex|lh|cap|ch|ic)|(?:[sld]?v|cq)(?:[whib]|min|max)|in|cm|mm|rpx)?$/i;
|
|
115
|
-
const numberRE = /^(-?\d*(?:\.\d+)?)$/i;
|
|
116
|
-
const unitOnlyRE = /^(px)$/i;
|
|
117
|
-
const bracketTypeRe = /^\[(color|length|size|position|quoted|string):/i;
|
|
118
|
-
const splitComma = /,(?![^()]*\))/g;
|
|
119
|
-
|
|
120
|
-
const cssProps = [
|
|
121
|
-
// basic props
|
|
122
|
-
"color",
|
|
123
|
-
"border-color",
|
|
124
|
-
"background-color",
|
|
125
|
-
"flex-grow",
|
|
126
|
-
"flex",
|
|
127
|
-
"flex-shrink",
|
|
128
|
-
"caret-color",
|
|
129
|
-
"font",
|
|
130
|
-
"gap",
|
|
131
|
-
"opacity",
|
|
132
|
-
"visibility",
|
|
133
|
-
"z-index",
|
|
134
|
-
"font-weight",
|
|
135
|
-
"zoom",
|
|
136
|
-
"text-shadow",
|
|
137
|
-
"transform",
|
|
138
|
-
"box-shadow",
|
|
139
|
-
// positions
|
|
140
|
-
"background-position",
|
|
141
|
-
"left",
|
|
142
|
-
"right",
|
|
143
|
-
"top",
|
|
144
|
-
"bottom",
|
|
145
|
-
"object-position",
|
|
146
|
-
// sizes
|
|
147
|
-
"max-height",
|
|
148
|
-
"min-height",
|
|
149
|
-
"max-width",
|
|
150
|
-
"min-width",
|
|
151
|
-
"height",
|
|
152
|
-
"width",
|
|
153
|
-
"border-width",
|
|
154
|
-
"margin",
|
|
155
|
-
"padding",
|
|
156
|
-
"outline-width",
|
|
157
|
-
"outline-offset",
|
|
158
|
-
"font-size",
|
|
159
|
-
"line-height",
|
|
160
|
-
"text-indent",
|
|
161
|
-
"vertical-align",
|
|
162
|
-
"border-spacing",
|
|
163
|
-
"letter-spacing",
|
|
164
|
-
"word-spacing",
|
|
165
|
-
// enhances
|
|
166
|
-
"stroke",
|
|
167
|
-
"filter",
|
|
168
|
-
"backdrop-filter",
|
|
169
|
-
"fill",
|
|
170
|
-
"mask",
|
|
171
|
-
"mask-size",
|
|
172
|
-
"mask-border",
|
|
173
|
-
"clip-path",
|
|
174
|
-
"clip",
|
|
175
|
-
"border-radius"
|
|
176
|
-
];
|
|
177
|
-
function round(n) {
|
|
178
|
-
return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1");
|
|
179
|
-
}
|
|
180
|
-
function numberWithUnit(str) {
|
|
181
|
-
const match = str.match(numberWithUnitRE);
|
|
182
|
-
if (!match)
|
|
183
|
-
return;
|
|
184
|
-
const [, n, unit] = match;
|
|
185
|
-
const num = Number.parseFloat(n);
|
|
186
|
-
if (unit && !Number.isNaN(num))
|
|
187
|
-
return `${round(num)}${unit}`;
|
|
188
|
-
}
|
|
189
|
-
function auto(str) {
|
|
190
|
-
if (str === "auto" || str === "a")
|
|
191
|
-
return "auto";
|
|
192
|
-
}
|
|
193
|
-
function rem(str) {
|
|
194
|
-
if (!str)
|
|
195
|
-
return;
|
|
196
|
-
if (unitOnlyRE.test(str))
|
|
197
|
-
return `1${str}`;
|
|
198
|
-
const match = str.match(numberWithUnitRE);
|
|
199
|
-
if (!match)
|
|
200
|
-
return;
|
|
201
|
-
const [, n, unit] = match;
|
|
202
|
-
const num = Number.parseFloat(n);
|
|
203
|
-
if (!Number.isNaN(num)) {
|
|
204
|
-
if (num === 0)
|
|
205
|
-
return "0";
|
|
206
|
-
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
function px(str) {
|
|
210
|
-
if (unitOnlyRE.test(str))
|
|
211
|
-
return `1${str}`;
|
|
212
|
-
const match = str.match(numberWithUnitRE);
|
|
213
|
-
if (!match)
|
|
214
|
-
return;
|
|
215
|
-
const [, n, unit] = match;
|
|
216
|
-
const num = Number.parseFloat(n);
|
|
217
|
-
if (!Number.isNaN(num))
|
|
218
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}px`;
|
|
219
|
-
}
|
|
220
|
-
function number(str) {
|
|
221
|
-
if (!numberRE.test(str))
|
|
222
|
-
return;
|
|
223
|
-
const num = Number.parseFloat(str);
|
|
224
|
-
if (!Number.isNaN(num))
|
|
225
|
-
return round(num);
|
|
226
|
-
}
|
|
227
|
-
function percent(str) {
|
|
228
|
-
if (str.endsWith("%"))
|
|
229
|
-
str = str.slice(0, -1);
|
|
230
|
-
if (!numberRE.test(str))
|
|
231
|
-
return;
|
|
232
|
-
const num = Number.parseFloat(str);
|
|
233
|
-
if (!Number.isNaN(num))
|
|
234
|
-
return `${round(num / 100)}`;
|
|
235
|
-
}
|
|
236
|
-
function fraction(str) {
|
|
237
|
-
if (!str)
|
|
238
|
-
return;
|
|
239
|
-
if (str === "full")
|
|
240
|
-
return "100%";
|
|
241
|
-
const [left, right] = str.split("/");
|
|
242
|
-
const num = Number.parseFloat(left) / Number.parseFloat(right);
|
|
243
|
-
if (!Number.isNaN(num)) {
|
|
244
|
-
if (num === 0)
|
|
245
|
-
return "0";
|
|
246
|
-
return `${round(num * 100)}%`;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
function bracketWithType(str, requiredType) {
|
|
250
|
-
if (str && str.startsWith("[") && str.endsWith("]")) {
|
|
251
|
-
let base;
|
|
252
|
-
let hintedType;
|
|
253
|
-
const match = str.match(bracketTypeRe);
|
|
254
|
-
if (!match) {
|
|
255
|
-
base = str.slice(1, -1);
|
|
256
|
-
} else {
|
|
257
|
-
if (!requiredType)
|
|
258
|
-
hintedType = match[1];
|
|
259
|
-
base = str.slice(match[0].length, -1);
|
|
260
|
-
}
|
|
261
|
-
if (!base)
|
|
262
|
-
return;
|
|
263
|
-
if (base === '=""')
|
|
264
|
-
return;
|
|
265
|
-
if (base.startsWith("--"))
|
|
266
|
-
base = `var(${base})`;
|
|
267
|
-
let curly = 0;
|
|
268
|
-
for (const i of base) {
|
|
269
|
-
if (i === "[") {
|
|
270
|
-
curly += 1;
|
|
271
|
-
} else if (i === "]") {
|
|
272
|
-
curly -= 1;
|
|
273
|
-
if (curly < 0)
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
if (curly)
|
|
278
|
-
return;
|
|
279
|
-
switch (hintedType) {
|
|
280
|
-
case "string":
|
|
281
|
-
return base.replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_");
|
|
282
|
-
case "quoted":
|
|
283
|
-
return base.replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_").replace(/(["\\])/g, "\\$1").replace(/^(.+)$/, '"$1"');
|
|
284
|
-
}
|
|
285
|
-
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/(^|[^\\])_/g, "$1 ").replace(/\\_/g, "_").replace(/(?:calc|clamp|max|min)\((.*)/g, (match2) => {
|
|
286
|
-
const vars = [];
|
|
287
|
-
return match2.replace(/var\((--.+?)[,)]/g, (match3, g1) => {
|
|
288
|
-
vars.push(g1);
|
|
289
|
-
return match3.replace(g1, "--un-calc");
|
|
290
|
-
}).replace(/(-?\d*\.?\d(?!\b-\d.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ").replace(/--un-calc/g, () => vars.shift());
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
function bracket(str) {
|
|
295
|
-
return bracketWithType(str);
|
|
296
|
-
}
|
|
297
|
-
function bracketOfColor(str) {
|
|
298
|
-
return bracketWithType(str, "color");
|
|
299
|
-
}
|
|
300
|
-
function bracketOfLength(str) {
|
|
301
|
-
return bracketWithType(str, "length");
|
|
302
|
-
}
|
|
303
|
-
function bracketOfPosition(str) {
|
|
304
|
-
return bracketWithType(str, "position");
|
|
305
|
-
}
|
|
306
|
-
function cssvar(str) {
|
|
307
|
-
if (/^\$[^\s'"`;{}]/.test(str)) {
|
|
308
|
-
const [name, defaultValue] = str.slice(1).split(",");
|
|
309
|
-
return `var(--${core.escapeSelector(name)}${defaultValue ? `, ${defaultValue}` : ""})`;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
function time(str) {
|
|
313
|
-
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i);
|
|
314
|
-
if (!match)
|
|
315
|
-
return;
|
|
316
|
-
const [, n, unit] = match;
|
|
317
|
-
const num = Number.parseFloat(n);
|
|
318
|
-
if (!Number.isNaN(num)) {
|
|
319
|
-
if (num === 0 && !unit)
|
|
320
|
-
return "0s";
|
|
321
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}ms`;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
function degree(str) {
|
|
325
|
-
const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);
|
|
326
|
-
if (!match)
|
|
327
|
-
return;
|
|
328
|
-
const [, n, unit] = match;
|
|
329
|
-
const num = Number.parseFloat(n);
|
|
330
|
-
if (!Number.isNaN(num)) {
|
|
331
|
-
if (num === 0)
|
|
332
|
-
return "0";
|
|
333
|
-
return unit ? `${round(num)}${unit}` : `${round(num)}deg`;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
function global(str) {
|
|
337
|
-
if (globalKeywords.includes(str))
|
|
338
|
-
return str;
|
|
339
|
-
}
|
|
340
|
-
function properties(str) {
|
|
341
|
-
if (str.split(",").every((prop) => cssProps.includes(prop)))
|
|
342
|
-
return str;
|
|
343
|
-
}
|
|
344
|
-
function position(str) {
|
|
345
|
-
if (["top", "left", "right", "bottom", "center"].includes(str))
|
|
346
|
-
return str;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const valueHandlers = {
|
|
350
|
-
__proto__: null,
|
|
351
|
-
auto: auto,
|
|
352
|
-
bracket: bracket,
|
|
353
|
-
bracketOfColor: bracketOfColor,
|
|
354
|
-
bracketOfLength: bracketOfLength,
|
|
355
|
-
bracketOfPosition: bracketOfPosition,
|
|
356
|
-
cssvar: cssvar,
|
|
357
|
-
degree: degree,
|
|
358
|
-
fraction: fraction,
|
|
359
|
-
global: global,
|
|
360
|
-
number: number,
|
|
361
|
-
numberWithUnit: numberWithUnit,
|
|
362
|
-
percent: percent,
|
|
363
|
-
position: position,
|
|
364
|
-
properties: properties,
|
|
365
|
-
px: px,
|
|
366
|
-
rem: rem,
|
|
367
|
-
time: time
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
const handler = ruleUtils.createValueHandler(valueHandlers);
|
|
371
|
-
const h = handler;
|
|
372
|
-
|
|
373
|
-
const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
|
|
374
|
-
function directionSize(propertyPrefix) {
|
|
375
|
-
return ([_, direction, size], { theme }) => {
|
|
376
|
-
const v = theme.spacing?.[size || "DEFAULT"] ?? h.bracket.cssvar.global.auto.fraction.rem(size);
|
|
377
|
-
if (v != null)
|
|
378
|
-
return directionMap[direction].map((i) => [`${propertyPrefix}${i}`, v]);
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
function getThemeColorForKey(theme, colors, key = "colors") {
|
|
382
|
-
let obj = theme[key];
|
|
383
|
-
let index = -1;
|
|
384
|
-
for (const c of colors) {
|
|
385
|
-
index += 1;
|
|
386
|
-
if (obj && typeof obj !== "string") {
|
|
387
|
-
const camel = colors.slice(index).join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase());
|
|
388
|
-
if (obj[camel])
|
|
389
|
-
return obj[camel];
|
|
390
|
-
if (obj[c]) {
|
|
391
|
-
obj = obj[c];
|
|
392
|
-
continue;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
return void 0;
|
|
396
|
-
}
|
|
397
|
-
return obj;
|
|
398
|
-
}
|
|
399
|
-
function getThemeColor(theme, colors, key) {
|
|
400
|
-
return getThemeColorForKey(theme, colors, key) || getThemeColorForKey(theme, colors, "colors");
|
|
401
|
-
}
|
|
402
|
-
function splitShorthand(body, type) {
|
|
403
|
-
const [front, rest] = ruleUtils.getStringComponent(body, "[", "]", ["/", ":"]) ?? [];
|
|
404
|
-
if (front != null) {
|
|
405
|
-
const match = (front.match(bracketTypeRe) ?? [])[1];
|
|
406
|
-
if (match == null || match === type)
|
|
407
|
-
return [front, rest];
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
function parseColor(body, theme, key) {
|
|
411
|
-
const split = splitShorthand(body, "color");
|
|
412
|
-
if (!split)
|
|
413
|
-
return;
|
|
414
|
-
const [main, opacity] = split;
|
|
415
|
-
const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g);
|
|
416
|
-
const [name] = colors;
|
|
417
|
-
if (!name)
|
|
418
|
-
return;
|
|
419
|
-
let color;
|
|
420
|
-
const bracket = h.bracketOfColor(main);
|
|
421
|
-
const bracketOrMain = bracket || main;
|
|
422
|
-
if (h.numberWithUnit(bracketOrMain))
|
|
423
|
-
return;
|
|
424
|
-
if (/^#[\da-fA-F]+$/.test(bracketOrMain))
|
|
425
|
-
color = bracketOrMain;
|
|
426
|
-
else if (/^hex-[\da-fA-F]+$/.test(bracketOrMain))
|
|
427
|
-
color = `#${bracketOrMain.slice(4)}`;
|
|
428
|
-
else if (main.startsWith("$"))
|
|
429
|
-
color = h.cssvar(main);
|
|
430
|
-
color = color || bracket;
|
|
431
|
-
if (!color) {
|
|
432
|
-
const colorData = getThemeColor(theme, [main], key);
|
|
433
|
-
if (typeof colorData === "string")
|
|
434
|
-
color = colorData;
|
|
435
|
-
}
|
|
436
|
-
let no = "DEFAULT";
|
|
437
|
-
if (!color) {
|
|
438
|
-
let colorData;
|
|
439
|
-
const [scale] = colors.slice(-1);
|
|
440
|
-
if (/^\d+$/.test(scale)) {
|
|
441
|
-
no = scale;
|
|
442
|
-
colorData = getThemeColor(theme, colors.slice(0, -1), key);
|
|
443
|
-
if (!colorData || typeof colorData === "string")
|
|
444
|
-
color = void 0;
|
|
445
|
-
else
|
|
446
|
-
color = colorData[no];
|
|
447
|
-
} else {
|
|
448
|
-
colorData = getThemeColor(theme, colors, key);
|
|
449
|
-
if (!colorData && colors.length <= 2) {
|
|
450
|
-
[, no = no] = colors;
|
|
451
|
-
colorData = getThemeColor(theme, [name], key);
|
|
452
|
-
}
|
|
453
|
-
if (typeof colorData === "string")
|
|
454
|
-
color = colorData;
|
|
455
|
-
else if (no && colorData)
|
|
456
|
-
color = colorData[no];
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
return {
|
|
460
|
-
opacity,
|
|
461
|
-
name,
|
|
462
|
-
no,
|
|
463
|
-
color,
|
|
464
|
-
cssColor: ruleUtils.parseCssColor(color),
|
|
465
|
-
alpha: h.bracket.cssvar.percent(opacity ?? "")
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
function colorResolver(property, varName, key, shouldPass) {
|
|
469
|
-
return ([, body], { theme }) => {
|
|
470
|
-
const data = parseColor(body, theme, key);
|
|
471
|
-
if (!data)
|
|
472
|
-
return;
|
|
473
|
-
const { alpha, color, cssColor } = data;
|
|
474
|
-
const css = {};
|
|
475
|
-
if (cssColor) {
|
|
476
|
-
if (alpha != null) {
|
|
477
|
-
css[property] = ruleUtils.colorToString(cssColor, alpha);
|
|
478
|
-
} else {
|
|
479
|
-
const opacityVar = `--un-${varName}-opacity`;
|
|
480
|
-
const result = ruleUtils.colorToString(cssColor, `var(${opacityVar})`);
|
|
481
|
-
if (result.includes(opacityVar))
|
|
482
|
-
css[opacityVar] = ruleUtils.colorOpacityToString(cssColor);
|
|
483
|
-
css[property] = result;
|
|
484
|
-
}
|
|
485
|
-
} else if (color) {
|
|
486
|
-
if (alpha != null) {
|
|
487
|
-
css[property] = ruleUtils.colorToString(color, alpha);
|
|
488
|
-
} else {
|
|
489
|
-
const opacityVar = `--un-${varName}-opacity`;
|
|
490
|
-
const result = ruleUtils.colorToString(color, `var(${opacityVar})`);
|
|
491
|
-
if (result.includes(opacityVar))
|
|
492
|
-
css[opacityVar] = 1;
|
|
493
|
-
css[property] = result;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
if (shouldPass?.(css) !== false)
|
|
497
|
-
return css;
|
|
498
|
-
};
|
|
499
|
-
}
|
|
500
|
-
function colorableShadows(shadows, colorVar) {
|
|
501
|
-
const colored = [];
|
|
502
|
-
shadows = core.toArray(shadows);
|
|
503
|
-
for (let i = 0; i < shadows.length; i++) {
|
|
504
|
-
const components = ruleUtils.getStringComponents(shadows[i], " ", 6);
|
|
505
|
-
if (!components || components.length < 3)
|
|
506
|
-
return shadows;
|
|
507
|
-
let isInset = false;
|
|
508
|
-
const pos = components.indexOf("inset");
|
|
509
|
-
if (pos !== -1) {
|
|
510
|
-
components.splice(pos, 1);
|
|
511
|
-
isInset = true;
|
|
512
|
-
}
|
|
513
|
-
let colorVarValue = "";
|
|
514
|
-
if (ruleUtils.parseCssColor(components.at(0))) {
|
|
515
|
-
const color = ruleUtils.parseCssColor(components.shift());
|
|
516
|
-
if (color)
|
|
517
|
-
colorVarValue = `, ${ruleUtils.colorToString(color)}`;
|
|
518
|
-
} else if (ruleUtils.parseCssColor(components.at(-1))) {
|
|
519
|
-
const color = ruleUtils.parseCssColor(components.pop());
|
|
520
|
-
if (color)
|
|
521
|
-
colorVarValue = `, ${ruleUtils.colorToString(color)}`;
|
|
522
|
-
}
|
|
523
|
-
colored.push(`${isInset ? "inset " : ""}${components.join(" ")} var(${colorVar}${colorVarValue})`);
|
|
524
|
-
}
|
|
525
|
-
return colored;
|
|
526
|
-
}
|
|
527
|
-
function hasParseableColor(color, theme, key) {
|
|
528
|
-
return color != null && !!parseColor(color, theme, key)?.color;
|
|
529
|
-
}
|
|
530
|
-
function resolveBreakpoints({ theme, generator }, key = "breakpoints") {
|
|
531
|
-
let breakpoints;
|
|
532
|
-
if (generator.userConfig && generator.userConfig.theme)
|
|
533
|
-
breakpoints = generator.userConfig.theme[key];
|
|
534
|
-
if (!breakpoints)
|
|
535
|
-
breakpoints = theme[key];
|
|
536
|
-
return breakpoints ? Object.entries(breakpoints).sort((a, b) => Number.parseInt(a[1].replace(/[a-z]+/gi, "")) - Number.parseInt(b[1].replace(/[a-z]+/gi, ""))).map(([point, size]) => ({ point, size })) : void 0;
|
|
537
|
-
}
|
|
538
|
-
function resolveVerticalBreakpoints(context) {
|
|
539
|
-
return resolveBreakpoints(context, "verticalBreakpoints");
|
|
540
|
-
}
|
|
541
|
-
function makeGlobalStaticRules(prefix, property) {
|
|
542
|
-
return globalKeywords.map((keyword) => [`${prefix}-${keyword}`, { [property ?? prefix]: keyword }]);
|
|
543
|
-
}
|
|
544
|
-
function isCSSMathFn(value) {
|
|
545
|
-
return value != null && cssMathFnRE.test(value);
|
|
546
|
-
}
|
|
547
|
-
function isSize(str) {
|
|
548
|
-
if (str[0] === "[" && str.slice(-1) === "]")
|
|
549
|
-
str = str.slice(1, -1);
|
|
550
|
-
return cssMathFnRE.test(str) || numberWithUnitRE.test(str);
|
|
551
|
-
}
|
|
552
|
-
function transformXYZ(d, v, name) {
|
|
553
|
-
const values = v.split(splitComma);
|
|
554
|
-
if (d || !d && values.length === 1)
|
|
555
|
-
return xyzMap[d].map((i) => [`--un-${name}${i}`, v]);
|
|
556
|
-
return values.map((v2, i) => [`--un-${name}-${xyzArray[i]}`, v2]);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
exports.CONTROL_MINI_NO_NEGATIVE = CONTROL_MINI_NO_NEGATIVE;
|
|
560
|
-
exports.colorResolver = colorResolver;
|
|
561
|
-
exports.colorableShadows = colorableShadows;
|
|
562
|
-
exports.cornerMap = cornerMap;
|
|
563
|
-
exports.cssMathFnRE = cssMathFnRE;
|
|
564
|
-
exports.directionMap = directionMap;
|
|
565
|
-
exports.directionSize = directionSize;
|
|
566
|
-
exports.globalKeywords = globalKeywords;
|
|
567
|
-
exports.h = h;
|
|
568
|
-
exports.handler = handler;
|
|
569
|
-
exports.hasParseableColor = hasParseableColor;
|
|
570
|
-
exports.insetMap = insetMap;
|
|
571
|
-
exports.isCSSMathFn = isCSSMathFn;
|
|
572
|
-
exports.isSize = isSize;
|
|
573
|
-
exports.makeGlobalStaticRules = makeGlobalStaticRules;
|
|
574
|
-
exports.parseColor = parseColor;
|
|
575
|
-
exports.positionMap = positionMap;
|
|
576
|
-
exports.resolveBreakpoints = resolveBreakpoints;
|
|
577
|
-
exports.resolveVerticalBreakpoints = resolveVerticalBreakpoints;
|
|
578
|
-
exports.splitShorthand = splitShorthand;
|
|
579
|
-
exports.transformXYZ = transformXYZ;
|
|
580
|
-
exports.valueHandlers = valueHandlers;
|
|
581
|
-
exports.xyzArray = xyzArray;
|
|
582
|
-
exports.xyzMap = xyzMap;
|