@unocss/preset-wind 0.58.2 → 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 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 = [
@@ -641,6 +644,17 @@ const mixBlendModes = [
641
644
  ["mix-blend-normal", { "mix-blend-mode": "normal" }],
642
645
  ...utils.makeGlobalStaticRules("mix-blend")
643
646
  ];
647
+ const dynamicViewportHeight = [
648
+ ["min-h-dvh", { "min-height": "100dvh" }],
649
+ ["min-h-svh", { "min-height": "100svh" }],
650
+ ["min-h-lvh", { "min-height": "100lvh" }],
651
+ ["h-dvh", { height: "100dvh" }],
652
+ ["h-svh", { height: "100svh" }],
653
+ ["h-lvh", { height: "100lvh" }],
654
+ ["max-h-dvh", { "max-height": "100dvh" }],
655
+ ["max-h-svh", { "max-height": "100svh" }],
656
+ ["max-h-lvh", { "max-height": "100lvh" }]
657
+ ];
644
658
 
645
659
  const borderSpacingBase = {
646
660
  "--un-border-spacing-x": 0,
@@ -955,6 +969,7 @@ const rules = [
955
969
  placeholders,
956
970
  ___namespace.containerParent,
957
971
  viewTransition,
972
+ dynamicViewportHeight,
958
973
  // should be the last
959
974
  ___namespace.questionMark
960
975
  ].flat(1);
@@ -1249,14 +1264,44 @@ function variants(options) {
1249
1264
  ];
1250
1265
  }
1251
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
+
1252
1295
  const presetWind = core.definePreset((options = {}) => {
1296
+ options.important = options.important ?? false;
1253
1297
  return {
1254
1298
  ...presetMini.presetMini(options),
1255
1299
  name: "@unocss/preset-wind",
1256
1300
  theme,
1257
1301
  rules,
1258
1302
  shortcuts,
1259
- variants: variants(options)
1303
+ variants: variants(options),
1304
+ postprocess: postprocessors(options)
1260
1305
  };
1261
1306
  });
1262
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';
@@ -625,6 +625,17 @@ const mixBlendModes = [
625
625
  ["mix-blend-normal", { "mix-blend-mode": "normal" }],
626
626
  ...makeGlobalStaticRules("mix-blend")
627
627
  ];
628
+ const dynamicViewportHeight = [
629
+ ["min-h-dvh", { "min-height": "100dvh" }],
630
+ ["min-h-svh", { "min-height": "100svh" }],
631
+ ["min-h-lvh", { "min-height": "100lvh" }],
632
+ ["h-dvh", { height: "100dvh" }],
633
+ ["h-svh", { height: "100svh" }],
634
+ ["h-lvh", { height: "100lvh" }],
635
+ ["max-h-dvh", { "max-height": "100dvh" }],
636
+ ["max-h-svh", { "max-height": "100svh" }],
637
+ ["max-h-lvh", { "max-height": "100lvh" }]
638
+ ];
628
639
 
629
640
  const borderSpacingBase = {
630
641
  "--un-border-spacing-x": 0,
@@ -939,6 +950,7 @@ const rules = [
939
950
  placeholders,
940
951
  _.containerParent,
941
952
  viewTransition,
953
+ dynamicViewportHeight,
942
954
  // should be the last
943
955
  _.questionMark
944
956
  ].flat(1);
@@ -1233,14 +1245,44 @@ function variants(options) {
1233
1245
  ];
1234
1246
  }
1235
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
+
1236
1276
  const presetWind = definePreset((options = {}) => {
1277
+ options.important = options.important ?? false;
1237
1278
  return {
1238
- ...presetMini(options),
1279
+ ...presetMini$1(options),
1239
1280
  name: "@unocss/preset-wind",
1240
1281
  theme,
1241
1282
  rules,
1242
1283
  shortcuts,
1243
- variants: variants(options)
1284
+ variants: variants(options),
1285
+ postprocess: postprocessors(options)
1244
1286
  };
1245
1287
  });
1246
1288
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind",
3
- "version": "0.58.2",
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.2",
39
- "@unocss/preset-mini": "0.58.2",
40
- "@unocss/rule-utils": "0.58.2"
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",