@unocss/preset-wind 0.23.0 → 0.24.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @unocss/preset-wind
2
2
 
3
- Tailwind / Windi CSS compact preset for UnoCSS, [UnoCSS](https://github.com/antfu/unocss).
3
+ Tailwind / Windi CSS compact preset for UnoCSS, [UnoCSS](https://github.com/unocss/unocss).
4
4
 
5
5
  ## Installation
6
6
 
package/dist/index.cjs CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const variants = require('@unocss/preset-mini/variants');
6
5
  const core = require('@unocss/core');
7
6
  const theme$1 = require('@unocss/preset-mini/theme');
8
7
  const presetMini = require('@unocss/preset-mini');
9
8
  const rules$1 = require('@unocss/preset-mini/rules');
10
9
  const utils = require('@unocss/preset-mini/utils');
10
+ const variants$1 = require('@unocss/preset-mini/variants');
11
11
 
12
12
  const animations = [
13
13
  [/^(?:animate-)?keyframes-(.+)$/, ([, name], { theme, constructCSS }) => {
@@ -42,15 +42,15 @@ const bgGradientColorResolver = (mode) => ([, body], { theme }) => {
42
42
  const data = utils.parseColor(body, theme);
43
43
  if (!data)
44
44
  return;
45
- const { alpha, color, rgba } = data;
45
+ const { alpha, color, cssColor } = data;
46
46
  if (!color)
47
47
  return;
48
48
  let colorString = color;
49
- if (rgba) {
49
+ if (cssColor) {
50
50
  if (alpha != null)
51
- colorString = `rgba(${rgba.join(",")})`;
51
+ colorString = utils.colorToString(cssColor, alpha);
52
52
  else
53
- colorString = `rgba(${rgba.join(",")}, var(--un-${mode}-opacity, 1))`;
53
+ colorString = utils.colorToString(cssColor, `var(--un-${mode}-opacity, ${cssColor.alpha ?? 1})`);
54
54
  }
55
55
  switch (mode) {
56
56
  case "from":
@@ -290,7 +290,7 @@ const toFilter = (varName, resolver) => ([, b, s], { theme }) => {
290
290
  const dropShadowResolver = ([, s], { theme }) => {
291
291
  let v = theme.dropShadow?.[s || "DEFAULT"];
292
292
  if (v != null) {
293
- const shadows = rules$1.colorableShadows(v, "--un-drop-shadow-color");
293
+ const shadows = utils.colorableShadows(v, "--un-drop-shadow-color");
294
294
  return [
295
295
  filterBase,
296
296
  {
@@ -748,6 +748,10 @@ const rules = [
748
748
  rules$1.questionMark
749
749
  ].flat(1);
750
750
 
751
+ const shortcuts = [
752
+ ...containerShortcuts
753
+ ];
754
+
751
755
  const theme = {
752
756
  ...theme$1.theme,
753
757
  animation: {
@@ -902,6 +906,10 @@ const theme = {
902
906
  }
903
907
  };
904
908
 
909
+ const variantCombinators = [
910
+ utils.variantMatcher("svg", (input) => `${input} svg`)
911
+ ];
912
+
905
913
  const variantColorsScheme = [
906
914
  utils.variantMatcher(".dark", (input) => `.dark $$ ${input}`),
907
915
  utils.variantMatcher(".light", (input) => `.light $$ ${input}`),
@@ -941,6 +949,14 @@ function hasOpacityValue(body) {
941
949
  return false;
942
950
  }
943
951
 
952
+ const variants = (options) => [
953
+ placeholderModifier,
954
+ variantSpaceAndDivide,
955
+ ...variants$1.variants(options),
956
+ ...variantCombinators,
957
+ ...variantColorsScheme
958
+ ];
959
+
944
960
  const presetWind = (options = {}) => {
945
961
  options.dark = options.dark ?? "class";
946
962
  options.attributifyPseudo = options.attributifyPseudo ?? false;
@@ -948,15 +964,8 @@ const presetWind = (options = {}) => {
948
964
  name: "@unocss/preset-wind",
949
965
  theme,
950
966
  rules,
951
- shortcuts: [
952
- ...containerShortcuts
953
- ],
954
- variants: [
955
- placeholderModifier,
956
- variantSpaceAndDivide,
957
- ...variants.variants(options),
958
- ...variantColorsScheme
959
- ],
967
+ shortcuts,
968
+ variants: variants(options),
960
969
  options
961
970
  };
962
971
  };
@@ -964,4 +973,7 @@ const presetWind = (options = {}) => {
964
973
  exports.colors = presetMini.colors;
965
974
  exports["default"] = presetWind;
966
975
  exports.presetWind = presetWind;
976
+ exports.rules = rules;
977
+ exports.shortcuts = shortcuts;
967
978
  exports.theme = theme;
979
+ exports.variants = variants;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,19 @@
1
- import { Preset } from '@unocss/core';
1
+ import * as _unocss_core from '@unocss/core';
2
+ import { Rule, Variant, Preset } from '@unocss/core';
3
+ import * as _unocss_preset_mini from '@unocss/preset-mini';
2
4
  import { Theme, PresetMiniOptions } from '@unocss/preset-mini';
3
5
  export { Theme, colors } from '@unocss/preset-mini';
4
6
 
7
+ declare const rules: Rule[];
8
+
9
+ declare const shortcuts: _unocss_core.Shortcut<_unocss_preset_mini.Theme>[];
10
+
5
11
  declare const theme: Theme;
6
12
 
13
+ declare const variants: (options: UnoOptions) => Variant<Theme>[];
14
+
7
15
  interface UnoOptions extends PresetMiniOptions {
8
16
  }
9
17
  declare const presetWind: (options?: UnoOptions) => Preset<Theme>;
10
18
 
11
- export { UnoOptions, presetWind as default, presetWind, theme };
19
+ export { UnoOptions, presetWind as default, presetWind, rules, shortcuts, theme, variants };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { variants } from '@unocss/preset-mini/variants';
2
1
  import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
3
2
  import { theme as theme$1 } from '@unocss/preset-mini/theme';
4
3
  export { colors } from '@unocss/preset-mini';
5
- import { varEmpty, colorableShadows, cssVariables as cssVariables$1, cssProperty, pointerEvents, appearances, positions, insets, zIndexes, orders, grids, floats, margins, boxSizing, displays, aspectRatio, sizes, flex, transforms, cursors, userSelects, resizes, appearance, placements, alignments, justifies, gaps, overflows, textOverflows, whitespaces, breaks, borders, bgColors, svgUtilities, paddings, textAligns, textIndents, verticalAligns, fonts, fontStyles, textColors, textDecorations, fontSmoothings, tabSizes, textStrokes, textShadows, opacity, boxShadows, outline, rings, transitions, willChange, contents, questionMark } from '@unocss/preset-mini/rules';
6
- import { handler, positionMap, parseColor, colorResolver, directionMap, directionSize, variantMatcher, variantParentMatcher } from '@unocss/preset-mini/utils';
4
+ import { varEmpty, cssVariables as cssVariables$1, cssProperty, pointerEvents, appearances, positions, insets, zIndexes, orders, grids, floats, margins, boxSizing, displays, aspectRatio, sizes, flex, transforms, cursors, userSelects, resizes, appearance, placements, alignments, justifies, gaps, overflows, textOverflows, whitespaces, breaks, borders, bgColors, svgUtilities, paddings, textAligns, textIndents, verticalAligns, fonts, fontStyles, textColors, textDecorations, fontSmoothings, tabSizes, textStrokes, textShadows, opacity, boxShadows, outline, rings, transitions, willChange, contents, questionMark } from '@unocss/preset-mini/rules';
5
+ import { handler, positionMap, parseColor, colorToString, colorResolver, colorableShadows, directionMap, directionSize, variantMatcher, variantParentMatcher } from '@unocss/preset-mini/utils';
6
+ import { variants as variants$1 } from '@unocss/preset-mini/variants';
7
7
 
8
8
  const animations = [
9
9
  [/^(?:animate-)?keyframes-(.+)$/, ([, name], { theme, constructCSS }) => {
@@ -38,15 +38,15 @@ const bgGradientColorResolver = (mode) => ([, body], { theme }) => {
38
38
  const data = parseColor(body, theme);
39
39
  if (!data)
40
40
  return;
41
- const { alpha, color, rgba } = data;
41
+ const { alpha, color, cssColor } = data;
42
42
  if (!color)
43
43
  return;
44
44
  let colorString = color;
45
- if (rgba) {
45
+ if (cssColor) {
46
46
  if (alpha != null)
47
- colorString = `rgba(${rgba.join(",")})`;
47
+ colorString = colorToString(cssColor, alpha);
48
48
  else
49
- colorString = `rgba(${rgba.join(",")}, var(--un-${mode}-opacity, 1))`;
49
+ colorString = colorToString(cssColor, `var(--un-${mode}-opacity, ${cssColor.alpha ?? 1})`);
50
50
  }
51
51
  switch (mode) {
52
52
  case "from":
@@ -744,6 +744,10 @@ const rules = [
744
744
  questionMark
745
745
  ].flat(1);
746
746
 
747
+ const shortcuts = [
748
+ ...containerShortcuts
749
+ ];
750
+
747
751
  const theme = {
748
752
  ...theme$1,
749
753
  animation: {
@@ -898,6 +902,10 @@ const theme = {
898
902
  }
899
903
  };
900
904
 
905
+ const variantCombinators = [
906
+ variantMatcher("svg", (input) => `${input} svg`)
907
+ ];
908
+
901
909
  const variantColorsScheme = [
902
910
  variantMatcher(".dark", (input) => `.dark $$ ${input}`),
903
911
  variantMatcher(".light", (input) => `.light $$ ${input}`),
@@ -937,6 +945,14 @@ function hasOpacityValue(body) {
937
945
  return false;
938
946
  }
939
947
 
948
+ const variants = (options) => [
949
+ placeholderModifier,
950
+ variantSpaceAndDivide,
951
+ ...variants$1(options),
952
+ ...variantCombinators,
953
+ ...variantColorsScheme
954
+ ];
955
+
940
956
  const presetWind = (options = {}) => {
941
957
  options.dark = options.dark ?? "class";
942
958
  options.attributifyPseudo = options.attributifyPseudo ?? false;
@@ -944,17 +960,10 @@ const presetWind = (options = {}) => {
944
960
  name: "@unocss/preset-wind",
945
961
  theme,
946
962
  rules,
947
- shortcuts: [
948
- ...containerShortcuts
949
- ],
950
- variants: [
951
- placeholderModifier,
952
- variantSpaceAndDivide,
953
- ...variants(options),
954
- ...variantColorsScheme
955
- ],
963
+ shortcuts,
964
+ variants: variants(options),
956
965
  options
957
966
  };
958
967
  };
959
968
 
960
- export { presetWind as default, presetWind, theme };
969
+ export { presetWind as default, presetWind, rules, shortcuts, theme, variants };
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind",
3
- "version": "0.23.0",
3
+ "version": "0.24.3",
4
4
  "description": "Tailwind / Windi CSS compact preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
7
7
  "unocss-preset"
8
8
  ],
9
- "homepage": "https://github.com/antfu/unocss/tree/main/packages/preset-wind#readme",
9
+ "homepage": "https://github.com/unocss/unocss/tree/main/packages/preset-wind#readme",
10
10
  "bugs": {
11
- "url": "https://github.com/antfu/unocss/issues"
11
+ "url": "https://github.com/unocss/unocss/issues"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/antfu/unocss.git",
15
+ "url": "git+https://github.com/unocss/unocss.git",
16
16
  "directory": "packages/preset-wind"
17
17
  },
18
18
  "funding": "https://github.com/sponsors/antfu",
@@ -35,8 +35,8 @@
35
35
  "*.css"
36
36
  ],
37
37
  "dependencies": {
38
- "@unocss/core": "0.23.0",
39
- "@unocss/preset-mini": "0.23.0"
38
+ "@unocss/core": "0.24.3",
39
+ "@unocss/preset-mini": "0.24.3"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",