@unocss/preset-wind 0.58.3 → 0.58.4
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 +34 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +34 -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,44 @@ 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
|
+
return `:is(${selector})`;
|
|
1274
|
+
};
|
|
1275
|
+
return [
|
|
1276
|
+
option === true ? (util) => {
|
|
1277
|
+
util.entries.forEach((i) => {
|
|
1278
|
+
if (i[1] != null && !String(i[1]).endsWith("!important"))
|
|
1279
|
+
i[1] += " !important";
|
|
1280
|
+
});
|
|
1281
|
+
} : (util) => {
|
|
1282
|
+
if (!util.selector.startsWith(option))
|
|
1283
|
+
util.selector = `${option} ${wrapWithIs(util.selector)}`;
|
|
1284
|
+
}
|
|
1285
|
+
];
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
function postprocessors(options) {
|
|
1289
|
+
return [
|
|
1290
|
+
...core.toArray(presetMini__default(options).postprocess),
|
|
1291
|
+
...important(options.important)
|
|
1292
|
+
];
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1264
1295
|
const presetWind = core.definePreset((options = {}) => {
|
|
1296
|
+
options.important = options.important ?? false;
|
|
1265
1297
|
return {
|
|
1266
1298
|
...presetMini.presetMini(options),
|
|
1267
1299
|
name: "@unocss/preset-wind",
|
|
1268
1300
|
theme,
|
|
1269
1301
|
rules,
|
|
1270
1302
|
shortcuts,
|
|
1271
|
-
variants: variants(options)
|
|
1303
|
+
variants: variants(options),
|
|
1304
|
+
postprocess: postprocessors(options)
|
|
1272
1305
|
};
|
|
1273
1306
|
});
|
|
1274
1307
|
|
package/dist/index.d.cts
CHANGED
|
@@ -13,6 +13,16 @@ 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 .m-1 { ... }`
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
important?: boolean | string;
|
|
16
26
|
}
|
|
17
27
|
declare const presetWind: _unocss_core.PresetFactory<_unocss_preset_mini.Theme, PresetWindOptions>;
|
|
18
28
|
|
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,16 @@ 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 .m-1 { ... }`
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
important?: boolean | string;
|
|
16
26
|
}
|
|
17
27
|
declare const presetWind: _unocss_core.PresetFactory<_unocss_preset_mini.Theme, PresetWindOptions>;
|
|
18
28
|
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,16 @@ 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 .m-1 { ... }`
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
important?: boolean | string;
|
|
16
26
|
}
|
|
17
27
|
declare const presetWind: _unocss_core.PresetFactory<_unocss_preset_mini.Theme, PresetWindOptions>;
|
|
18
28
|
|
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,44 @@ 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
|
+
return `:is(${selector})`;
|
|
1255
|
+
};
|
|
1256
|
+
return [
|
|
1257
|
+
option === true ? (util) => {
|
|
1258
|
+
util.entries.forEach((i) => {
|
|
1259
|
+
if (i[1] != null && !String(i[1]).endsWith("!important"))
|
|
1260
|
+
i[1] += " !important";
|
|
1261
|
+
});
|
|
1262
|
+
} : (util) => {
|
|
1263
|
+
if (!util.selector.startsWith(option))
|
|
1264
|
+
util.selector = `${option} ${wrapWithIs(util.selector)}`;
|
|
1265
|
+
}
|
|
1266
|
+
];
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
function postprocessors(options) {
|
|
1270
|
+
return [
|
|
1271
|
+
...toArray(presetMini(options).postprocess),
|
|
1272
|
+
...important(options.important)
|
|
1273
|
+
];
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1248
1276
|
const presetWind = definePreset((options = {}) => {
|
|
1277
|
+
options.important = options.important ?? false;
|
|
1249
1278
|
return {
|
|
1250
|
-
...presetMini(options),
|
|
1279
|
+
...presetMini$1(options),
|
|
1251
1280
|
name: "@unocss/preset-wind",
|
|
1252
1281
|
theme,
|
|
1253
1282
|
rules,
|
|
1254
1283
|
shortcuts,
|
|
1255
|
-
variants: variants(options)
|
|
1284
|
+
variants: variants(options),
|
|
1285
|
+
postprocess: postprocessors(options)
|
|
1256
1286
|
};
|
|
1257
1287
|
});
|
|
1258
1288
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/preset-wind",
|
|
3
|
-
"version": "0.58.
|
|
3
|
+
"version": "0.58.4",
|
|
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.4",
|
|
39
|
+
"@unocss/preset-mini": "0.58.4",
|
|
40
|
+
"@unocss/rule-utils": "0.58.4"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "unbuild",
|