@unocss/preset-mini 0.38.1 → 0.39.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/chunks/default3.cjs +31 -19
- package/dist/chunks/default3.mjs +32 -20
- package/dist/chunks/transform.cjs +2 -4
- package/dist/chunks/transform.mjs +2 -4
- package/dist/chunks/utilities.cjs +5 -3
- package/dist/chunks/utilities.mjs +6 -4
- package/dist/variants.d.ts +4 -2
- package/dist/variants.mjs +1 -1
- package/package.json +2 -2
package/dist/chunks/default3.cjs
CHANGED
|
@@ -159,26 +159,11 @@ const variantScope = {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
|
-
|
|
163
|
-
name: "important",
|
|
164
|
-
match(matcher) {
|
|
165
|
-
const match = matcher.match(/^(important[:-]|!)/);
|
|
166
|
-
if (match) {
|
|
167
|
-
return {
|
|
168
|
-
matcher: matcher.slice(match[0].length),
|
|
169
|
-
body: (body) => {
|
|
170
|
-
body.forEach((v) => {
|
|
171
|
-
if (v[1])
|
|
172
|
-
v[1] += " !important";
|
|
173
|
-
});
|
|
174
|
-
return body;
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
autocomplete: "(important)"
|
|
180
|
-
};
|
|
162
|
+
|
|
181
163
|
const numberRE = /[0-9.]+(?:[a-z]+|%)?/;
|
|
164
|
+
const ignoreProps = [
|
|
165
|
+
/opacity|color|flex/
|
|
166
|
+
];
|
|
182
167
|
const variantNegative = {
|
|
183
168
|
name: "negative",
|
|
184
169
|
match(matcher) {
|
|
@@ -194,6 +179,8 @@ const variantNegative = {
|
|
|
194
179
|
const value = v[1]?.toString();
|
|
195
180
|
if (!value || value === "0")
|
|
196
181
|
return;
|
|
182
|
+
if (ignoreProps.some((i) => v[0].match(i)))
|
|
183
|
+
return;
|
|
197
184
|
if (numberRE.test(value)) {
|
|
198
185
|
v[1] = value.replace(numberRE, (i) => `-${i}`);
|
|
199
186
|
changed = true;
|
|
@@ -201,11 +188,36 @@ const variantNegative = {
|
|
|
201
188
|
});
|
|
202
189
|
if (changed)
|
|
203
190
|
return body;
|
|
191
|
+
return [];
|
|
204
192
|
}
|
|
205
193
|
};
|
|
206
194
|
}
|
|
207
195
|
};
|
|
208
196
|
|
|
197
|
+
const variantImportant = {
|
|
198
|
+
name: "important",
|
|
199
|
+
match(matcher) {
|
|
200
|
+
let base;
|
|
201
|
+
const match = matcher.match(/^(important[:-]|!)/);
|
|
202
|
+
if (match)
|
|
203
|
+
base = matcher.slice(match[0].length);
|
|
204
|
+
else if (matcher.endsWith("!"))
|
|
205
|
+
base = matcher.slice(0, -1);
|
|
206
|
+
if (base) {
|
|
207
|
+
return {
|
|
208
|
+
matcher: base,
|
|
209
|
+
body: (body) => {
|
|
210
|
+
body.forEach((v) => {
|
|
211
|
+
if (v[1])
|
|
212
|
+
v[1] += " !important";
|
|
213
|
+
});
|
|
214
|
+
return body;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
209
221
|
const PseudoClasses = Object.fromEntries([
|
|
210
222
|
["first-letter", "::first-letter"],
|
|
211
223
|
["first-line", "::first-line"],
|
package/dist/chunks/default3.mjs
CHANGED
|
@@ -157,26 +157,11 @@ const variantScope = {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
|
-
|
|
161
|
-
name: "important",
|
|
162
|
-
match(matcher) {
|
|
163
|
-
const match = matcher.match(/^(important[:-]|!)/);
|
|
164
|
-
if (match) {
|
|
165
|
-
return {
|
|
166
|
-
matcher: matcher.slice(match[0].length),
|
|
167
|
-
body: (body) => {
|
|
168
|
-
body.forEach((v) => {
|
|
169
|
-
if (v[1])
|
|
170
|
-
v[1] += " !important";
|
|
171
|
-
});
|
|
172
|
-
return body;
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
autocomplete: "(important)"
|
|
178
|
-
};
|
|
160
|
+
|
|
179
161
|
const numberRE = /[0-9.]+(?:[a-z]+|%)?/;
|
|
162
|
+
const ignoreProps = [
|
|
163
|
+
/opacity|color|flex/
|
|
164
|
+
];
|
|
180
165
|
const variantNegative = {
|
|
181
166
|
name: "negative",
|
|
182
167
|
match(matcher) {
|
|
@@ -192,6 +177,8 @@ const variantNegative = {
|
|
|
192
177
|
const value = v[1]?.toString();
|
|
193
178
|
if (!value || value === "0")
|
|
194
179
|
return;
|
|
180
|
+
if (ignoreProps.some((i) => v[0].match(i)))
|
|
181
|
+
return;
|
|
195
182
|
if (numberRE.test(value)) {
|
|
196
183
|
v[1] = value.replace(numberRE, (i) => `-${i}`);
|
|
197
184
|
changed = true;
|
|
@@ -199,11 +186,36 @@ const variantNegative = {
|
|
|
199
186
|
});
|
|
200
187
|
if (changed)
|
|
201
188
|
return body;
|
|
189
|
+
return [];
|
|
202
190
|
}
|
|
203
191
|
};
|
|
204
192
|
}
|
|
205
193
|
};
|
|
206
194
|
|
|
195
|
+
const variantImportant = {
|
|
196
|
+
name: "important",
|
|
197
|
+
match(matcher) {
|
|
198
|
+
let base;
|
|
199
|
+
const match = matcher.match(/^(important[:-]|!)/);
|
|
200
|
+
if (match)
|
|
201
|
+
base = matcher.slice(match[0].length);
|
|
202
|
+
else if (matcher.endsWith("!"))
|
|
203
|
+
base = matcher.slice(0, -1);
|
|
204
|
+
if (base) {
|
|
205
|
+
return {
|
|
206
|
+
matcher: base,
|
|
207
|
+
body: (body) => {
|
|
208
|
+
body.forEach((v) => {
|
|
209
|
+
if (v[1])
|
|
210
|
+
v[1] += " !important";
|
|
211
|
+
});
|
|
212
|
+
return body;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
207
219
|
const PseudoClasses = Object.fromEntries([
|
|
208
220
|
["first-letter", "::first-letter"],
|
|
209
221
|
["first-line", "::first-line"],
|
|
@@ -380,4 +392,4 @@ const variants = (options) => [
|
|
|
380
392
|
variantScope
|
|
381
393
|
];
|
|
382
394
|
|
|
383
|
-
export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g, variantCssLayer as h, variantInternalLayer as i, variantScope as j,
|
|
395
|
+
export { variantBreakpoints as a, variantCombinators as b, variantPrint as c, variantCustomMedia as d, variantColorsMediaOrClass as e, variantLanguageDirections as f, variantSelector as g, variantCssLayer as h, variantInternalLayer as i, variantScope as j, variantPseudoClassesAndElements as k, variantPseudoClassFunctions as l, variantTaggedPseudoClasses as m, variantImportant as n, variantNegative as o, partClasses as p, variants as v };
|
|
@@ -42,10 +42,8 @@ const whitespaces = [
|
|
|
42
42
|
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)$/, ([, v]) => ({ "white-space": v }), { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }]
|
|
43
43
|
];
|
|
44
44
|
const contents = [
|
|
45
|
-
[/^content
|
|
46
|
-
|
|
47
|
-
return { content: c == null ? `"${v}"` : c };
|
|
48
|
-
}],
|
|
45
|
+
[/^content-\[(.+)\]$/, ([, v]) => ({ content: `"${v}"` })],
|
|
46
|
+
[/^content-(\$.+)]$/, ([, v]) => ({ content: utilities.handler.cssvar(v) })],
|
|
49
47
|
["content-empty", { content: '""' }],
|
|
50
48
|
["content-none", { content: '""' }]
|
|
51
49
|
];
|
|
@@ -40,10 +40,8 @@ const whitespaces = [
|
|
|
40
40
|
[/^(?:whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)$/, ([, v]) => ({ "white-space": v }), { autocomplete: "(whitespace|ws)-(normal|nowrap|pre|pre-line|pre-wrap|break-spaces)" }]
|
|
41
41
|
];
|
|
42
42
|
const contents = [
|
|
43
|
-
[/^content
|
|
44
|
-
|
|
45
|
-
return { content: c == null ? `"${v}"` : c };
|
|
46
|
-
}],
|
|
43
|
+
[/^content-\[(.+)\]$/, ([, v]) => ({ content: `"${v}"` })],
|
|
44
|
+
[/^content-(\$.+)]$/, ([, v]) => ({ content: handler.cssvar(v) })],
|
|
47
45
|
["content-empty", { content: '""' }],
|
|
48
46
|
["content-none", { content: '""' }]
|
|
49
47
|
];
|
|
@@ -97,6 +97,8 @@ const globalKeywords = [
|
|
|
97
97
|
];
|
|
98
98
|
|
|
99
99
|
const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
|
|
100
|
+
const alphaPlaceholders = ["%alpha", "<alpha-value>"];
|
|
101
|
+
const alphaPlaceholdersRE = new RegExp(alphaPlaceholders.map((v) => core.escapeRegExp(v)).join("|"));
|
|
100
102
|
function hex2rgba(hex = "") {
|
|
101
103
|
const color = parseHexColor(hex);
|
|
102
104
|
if (color != null) {
|
|
@@ -122,11 +124,11 @@ function parseCssColor(str = "") {
|
|
|
122
124
|
}
|
|
123
125
|
function colorOpacityToString(color) {
|
|
124
126
|
const alpha = color.alpha ?? 1;
|
|
125
|
-
return alpha === "
|
|
127
|
+
return typeof alpha === "string" && alphaPlaceholders.includes(alpha) ? 1 : alpha;
|
|
126
128
|
}
|
|
127
129
|
function colorToString(color, alphaOverride) {
|
|
128
130
|
if (typeof color === "string")
|
|
129
|
-
return color.replace(
|
|
131
|
+
return color.replace(alphaPlaceholdersRE, `${alphaOverride ?? 1}`);
|
|
130
132
|
const { components } = color;
|
|
131
133
|
let { alpha, type } = color;
|
|
132
134
|
alpha = alphaOverride ?? alpha;
|
|
@@ -374,7 +376,7 @@ const cssProps = [
|
|
|
374
376
|
"clip",
|
|
375
377
|
"border-radius"
|
|
376
378
|
];
|
|
377
|
-
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|rpx)?$/i;
|
|
379
|
+
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|rpx)?$/i;
|
|
378
380
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
379
381
|
const unitOnlyRE = /^(px)$/i;
|
|
380
382
|
function round(n) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { escapeSelector, createValueHandler, toArray } from '@unocss/core';
|
|
1
|
+
import { escapeRegExp, escapeSelector, createValueHandler, toArray } from '@unocss/core';
|
|
2
2
|
|
|
3
3
|
const directionMap = {
|
|
4
4
|
"l": ["-left"],
|
|
@@ -95,6 +95,8 @@ const globalKeywords = [
|
|
|
95
95
|
];
|
|
96
96
|
|
|
97
97
|
const cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"];
|
|
98
|
+
const alphaPlaceholders = ["%alpha", "<alpha-value>"];
|
|
99
|
+
const alphaPlaceholdersRE = new RegExp(alphaPlaceholders.map((v) => escapeRegExp(v)).join("|"));
|
|
98
100
|
function hex2rgba(hex = "") {
|
|
99
101
|
const color = parseHexColor(hex);
|
|
100
102
|
if (color != null) {
|
|
@@ -120,11 +122,11 @@ function parseCssColor(str = "") {
|
|
|
120
122
|
}
|
|
121
123
|
function colorOpacityToString(color) {
|
|
122
124
|
const alpha = color.alpha ?? 1;
|
|
123
|
-
return alpha === "
|
|
125
|
+
return typeof alpha === "string" && alphaPlaceholders.includes(alpha) ? 1 : alpha;
|
|
124
126
|
}
|
|
125
127
|
function colorToString(color, alphaOverride) {
|
|
126
128
|
if (typeof color === "string")
|
|
127
|
-
return color.replace(
|
|
129
|
+
return color.replace(alphaPlaceholdersRE, `${alphaOverride ?? 1}`);
|
|
128
130
|
const { components } = color;
|
|
129
131
|
let { alpha, type } = color;
|
|
130
132
|
alpha = alphaOverride ?? alpha;
|
|
@@ -372,7 +374,7 @@ const cssProps = [
|
|
|
372
374
|
"clip",
|
|
373
375
|
"border-radius"
|
|
374
376
|
];
|
|
375
|
-
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|rpx)?$/i;
|
|
377
|
+
const numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|rpx)?$/i;
|
|
376
378
|
const numberRE = /^(-?[0-9.]+)$/i;
|
|
377
379
|
const unitOnlyRE = /^(px)$/i;
|
|
378
380
|
function round(n) {
|
package/dist/variants.d.ts
CHANGED
|
@@ -22,12 +22,14 @@ declare const variantSelector: Variant;
|
|
|
22
22
|
declare const variantCssLayer: Variant;
|
|
23
23
|
declare const variantInternalLayer: Variant;
|
|
24
24
|
declare const variantScope: Variant;
|
|
25
|
-
declare const variantImportant: Variant;
|
|
26
|
-
declare const variantNegative: Variant;
|
|
27
25
|
|
|
28
26
|
declare const variantPseudoClassesAndElements: VariantObject;
|
|
29
27
|
declare const variantPseudoClassFunctions: VariantObject;
|
|
30
28
|
declare const variantTaggedPseudoClasses: (options?: PresetMiniOptions) => VariantObject[];
|
|
31
29
|
declare const partClasses: VariantObject;
|
|
32
30
|
|
|
31
|
+
declare const variantImportant: Variant;
|
|
32
|
+
|
|
33
|
+
declare const variantNegative: Variant;
|
|
34
|
+
|
|
33
35
|
export { partClasses, variantBreakpoints, variantColorsMediaOrClass, variantCombinators, variantCssLayer, variantCustomMedia, variantImportant, variantInternalLayer, variantLanguageDirections, variantNegative, variantPrint, variantPseudoClassFunctions, variantPseudoClassesAndElements, variantScope, variantSelector, variantTaggedPseudoClasses, variants };
|
package/dist/variants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { p as partClasses, a as variantBreakpoints, e as variantColorsMediaOrClass, b as variantCombinators, h as variantCssLayer, d as variantCustomMedia,
|
|
1
|
+
export { p as partClasses, a as variantBreakpoints, e as variantColorsMediaOrClass, b as variantCombinators, h as variantCssLayer, d as variantCustomMedia, n as variantImportant, i as variantInternalLayer, f as variantLanguageDirections, o as variantNegative, c as variantPrint, l as variantPseudoClassFunctions, k as variantPseudoClassesAndElements, j as variantScope, g as variantSelector, m as variantTaggedPseudoClasses, v as variants } from './chunks/default3.mjs';
|
|
2
2
|
import './chunks/utilities.mjs';
|
|
3
3
|
import '@unocss/core';
|
|
4
4
|
import './chunks/variants.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-mini",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.1",
|
|
4
4
|
"description": "The minimal preset for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"*.css"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@unocss/core": "0.
|
|
64
|
+
"@unocss/core": "0.39.1"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "unbuild",
|