@unocss/preset-wind 0.58.3 → 0.58.5
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 +36 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.mjs +36 -4
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -10,6 +10,8 @@ const theme$1 = require('@unocss/preset-mini/theme');
|
|
|
10
10
|
const ruleUtils = require('@unocss/rule-utils');
|
|
11
11
|
const variants$1 = require('@unocss/preset-mini/variants');
|
|
12
12
|
|
|
13
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
14
|
+
|
|
13
15
|
function _interopNamespaceCompat(e) {
|
|
14
16
|
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
15
17
|
const n = Object.create(null);
|
|
@@ -22,6 +24,7 @@ function _interopNamespaceCompat(e) {
|
|
|
22
24
|
return n;
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
const presetMini__default = /*#__PURE__*/_interopDefaultCompat(presetMini);
|
|
25
28
|
const ___namespace = /*#__PURE__*/_interopNamespaceCompat(_);
|
|
26
29
|
|
|
27
30
|
const animations = [
|
|
@@ -1261,14 +1264,46 @@ function variants(options) {
|
|
|
1261
1264
|
];
|
|
1262
1265
|
}
|
|
1263
1266
|
|
|
1267
|
+
function important(option) {
|
|
1268
|
+
if (option == null || option === false)
|
|
1269
|
+
return [];
|
|
1270
|
+
const wrapWithIs = (selector) => {
|
|
1271
|
+
if (selector.startsWith(":is(") && selector.endsWith(")"))
|
|
1272
|
+
return selector;
|
|
1273
|
+
if (selector.includes("::"))
|
|
1274
|
+
return selector.replace(/(.*)(::.*)/, ":is($1)$2");
|
|
1275
|
+
return `:is(${selector})`;
|
|
1276
|
+
};
|
|
1277
|
+
return [
|
|
1278
|
+
option === true ? (util) => {
|
|
1279
|
+
util.entries.forEach((i) => {
|
|
1280
|
+
if (i[1] != null && !String(i[1]).endsWith("!important"))
|
|
1281
|
+
i[1] += " !important";
|
|
1282
|
+
});
|
|
1283
|
+
} : (util) => {
|
|
1284
|
+
if (!util.selector.startsWith(option))
|
|
1285
|
+
util.selector = `${option} ${wrapWithIs(util.selector)}`;
|
|
1286
|
+
}
|
|
1287
|
+
];
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
function postprocessors(options) {
|
|
1291
|
+
return [
|
|
1292
|
+
...core.toArray(presetMini__default(options).postprocess),
|
|
1293
|
+
...important(options.important)
|
|
1294
|
+
];
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1264
1297
|
const presetWind = core.definePreset((options = {}) => {
|
|
1298
|
+
options.important = options.important ?? false;
|
|
1265
1299
|
return {
|
|
1266
1300
|
...presetMini.presetMini(options),
|
|
1267
1301
|
name: "@unocss/preset-wind",
|
|
1268
1302
|
theme,
|
|
1269
1303
|
rules,
|
|
1270
1304
|
shortcuts,
|
|
1271
|
-
variants: variants(options)
|
|
1305
|
+
variants: variants(options),
|
|
1306
|
+
postprocess: postprocessors(options)
|
|
1272
1307
|
};
|
|
1273
1308
|
});
|
|
1274
1309
|
|
package/dist/index.d.cts
CHANGED
|
@@ -13,6 +13,18 @@ declare const theme: Theme;
|
|
|
13
13
|
declare function variants(options: PresetWindOptions): Variant<Theme>[];
|
|
14
14
|
|
|
15
15
|
interface PresetWindOptions extends PresetMiniOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The important option lets you control whether UnoCSS’s utilities should be marked with `!important`.
|
|
18
|
+
*
|
|
19
|
+
* This can be really useful when using UnoCSS with existing CSS that has high specificity selectors.
|
|
20
|
+
*
|
|
21
|
+
* You can also set `important` to a selector like `#app` instead, which will generate `#app :is(.m-1) { ... }`
|
|
22
|
+
*
|
|
23
|
+
* Also check out the compatibility with [:is()](https://caniuse.com/?search=%3Ais())
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
important?: boolean | string;
|
|
16
28
|
}
|
|
17
29
|
declare const presetWind: _unocss_core.PresetFactory<_unocss_preset_mini.Theme, PresetWindOptions>;
|
|
18
30
|
|
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,18 @@ declare const theme: Theme;
|
|
|
13
13
|
declare function variants(options: PresetWindOptions): Variant<Theme>[];
|
|
14
14
|
|
|
15
15
|
interface PresetWindOptions extends PresetMiniOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The important option lets you control whether UnoCSS’s utilities should be marked with `!important`.
|
|
18
|
+
*
|
|
19
|
+
* This can be really useful when using UnoCSS with existing CSS that has high specificity selectors.
|
|
20
|
+
*
|
|
21
|
+
* You can also set `important` to a selector like `#app` instead, which will generate `#app :is(.m-1) { ... }`
|
|
22
|
+
*
|
|
23
|
+
* Also check out the compatibility with [:is()](https://caniuse.com/?search=%3Ais())
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
important?: boolean | string;
|
|
16
28
|
}
|
|
17
29
|
declare const presetWind: _unocss_core.PresetFactory<_unocss_preset_mini.Theme, PresetWindOptions>;
|
|
18
30
|
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,18 @@ declare const theme: Theme;
|
|
|
13
13
|
declare function variants(options: PresetWindOptions): Variant<Theme>[];
|
|
14
14
|
|
|
15
15
|
interface PresetWindOptions extends PresetMiniOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The important option lets you control whether UnoCSS’s utilities should be marked with `!important`.
|
|
18
|
+
*
|
|
19
|
+
* This can be really useful when using UnoCSS with existing CSS that has high specificity selectors.
|
|
20
|
+
*
|
|
21
|
+
* You can also set `important` to a selector like `#app` instead, which will generate `#app :is(.m-1) { ... }`
|
|
22
|
+
*
|
|
23
|
+
* Also check out the compatibility with [:is()](https://caniuse.com/?search=%3Ais())
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
important?: boolean | string;
|
|
16
28
|
}
|
|
17
29
|
declare const presetWind: _unocss_core.PresetFactory<_unocss_preset_mini.Theme, PresetWindOptions>;
|
|
18
30
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isString, definePreset } from '@unocss/core';
|
|
2
|
-
import { presetMini } from '@unocss/preset-mini';
|
|
1
|
+
import { isString, toArray, definePreset } from '@unocss/core';
|
|
2
|
+
import presetMini, { presetMini as presetMini$1 } from '@unocss/preset-mini';
|
|
3
3
|
export { colors, preflights } from '@unocss/preset-mini';
|
|
4
4
|
import { h, globalKeywords, makeGlobalStaticRules, positionMap, parseColor, colorResolver, resolveBreakpoints, colorableShadows, directionMap, directionSize, variantMatcher, variantParentMatcher, hasParseableColor } from '@unocss/preset-mini/utils';
|
|
5
5
|
import * as _ from '@unocss/preset-mini/rules';
|
|
@@ -1245,14 +1245,46 @@ function variants(options) {
|
|
|
1245
1245
|
];
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
|
+
function important(option) {
|
|
1249
|
+
if (option == null || option === false)
|
|
1250
|
+
return [];
|
|
1251
|
+
const wrapWithIs = (selector) => {
|
|
1252
|
+
if (selector.startsWith(":is(") && selector.endsWith(")"))
|
|
1253
|
+
return selector;
|
|
1254
|
+
if (selector.includes("::"))
|
|
1255
|
+
return selector.replace(/(.*)(::.*)/, ":is($1)$2");
|
|
1256
|
+
return `:is(${selector})`;
|
|
1257
|
+
};
|
|
1258
|
+
return [
|
|
1259
|
+
option === true ? (util) => {
|
|
1260
|
+
util.entries.forEach((i) => {
|
|
1261
|
+
if (i[1] != null && !String(i[1]).endsWith("!important"))
|
|
1262
|
+
i[1] += " !important";
|
|
1263
|
+
});
|
|
1264
|
+
} : (util) => {
|
|
1265
|
+
if (!util.selector.startsWith(option))
|
|
1266
|
+
util.selector = `${option} ${wrapWithIs(util.selector)}`;
|
|
1267
|
+
}
|
|
1268
|
+
];
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
function postprocessors(options) {
|
|
1272
|
+
return [
|
|
1273
|
+
...toArray(presetMini(options).postprocess),
|
|
1274
|
+
...important(options.important)
|
|
1275
|
+
];
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1248
1278
|
const presetWind = definePreset((options = {}) => {
|
|
1279
|
+
options.important = options.important ?? false;
|
|
1249
1280
|
return {
|
|
1250
|
-
...presetMini(options),
|
|
1281
|
+
...presetMini$1(options),
|
|
1251
1282
|
name: "@unocss/preset-wind",
|
|
1252
1283
|
theme,
|
|
1253
1284
|
rules,
|
|
1254
1285
|
shortcuts,
|
|
1255
|
-
variants: variants(options)
|
|
1286
|
+
variants: variants(options),
|
|
1287
|
+
postprocess: postprocessors(options)
|
|
1256
1288
|
};
|
|
1257
1289
|
});
|
|
1258
1290
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-wind",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.5",
|
|
4
4
|
"description": "Tailwind / Windi CSS compact preset for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@unocss/core": "0.58.
|
|
39
|
-
"@unocss/preset-mini": "0.58.
|
|
40
|
-
"@unocss/rule-utils": "0.58.
|
|
38
|
+
"@unocss/core": "0.58.5",
|
|
39
|
+
"@unocss/preset-mini": "0.58.5",
|
|
40
|
+
"@unocss/rule-utils": "0.58.5"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "unbuild",
|