@unocss/preset-wind 0.50.5 → 0.50.7

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
@@ -2,64 +2,9 @@
2
2
 
3
3
  Tailwind / Windi CSS compact preset for [UnoCSS](https://github.com/unocss/unocss).
4
4
 
5
- > This preset inherits
6
- > - [@unocss/preset-mini](https://github.com/antfu/unocss/tree/main/packages/preset-mini)
5
+ ## Documentation
7
6
 
8
- ## Installation
9
-
10
- ```bash
11
- npm i -D @unocss/preset-wind
12
- ```
13
-
14
- ```ts
15
- import presetWind from '@unocss/preset-wind'
16
-
17
- UnoCSS({
18
- presets: [
19
- presetWind(),
20
- ],
21
- })
22
- ```
23
-
24
- ## Differences from Windi CSS
25
-
26
- ### `<sm` `@lg` Variants
27
-
28
- - `<sm:p-1` -> `lt-sm:p-1`
29
- - `@lg:p-1` -> `at-lg:p-1`
30
- - `>xl:p-1` -> `lg:p-1`
31
-
32
- to have more consistent naming.
33
-
34
- ### Bracket Syntax Spaces
35
-
36
- This preset uses `_` instead of `,` for respecting space in bracket syntax.
37
-
38
- - `grid-cols-[1fr,10px,max-content]` -> `grid-cols-[1fr_10px_max-content]`
39
-
40
- since some CSS rules require `,` as parts of the value, e.g. `grid-cols-[repeat(3,auto)]`
41
-
42
- ## Experimental Features
43
-
44
- This preset includes experimental feature that may be changed in breaking ways at any time.
45
-
46
- ### Media Hover
47
-
48
- Media hover addresses the [sticky hover](https://css-tricks.com/solving-sticky-hover-states-with-media-hover-hover/) problem where tapping target that includes hover style on mobile will persist that hover style until tapping elsewhere.
49
-
50
- Since the regular `:hover` style most probably used so widely, the variant uses `@hover` syntax to distinguish it from the regular `hover` pseudo.
51
-
52
- Example: `@hover-text-red`
53
-
54
- Output:
55
- ```css
56
- @media (hover: hover) and (pointer: fine) {
57
- .\@hover-text-red:hover {
58
- --un-text-opacity: 1;
59
- color: rgba(248, 113, 113, var(--un-text-opacity));
60
- }
61
- }
62
- ```
7
+ Please refer to the [documentation](https://unocss.dev/presets/wind).
63
8
 
64
9
  ## License
65
10
 
package/dist/index.cjs CHANGED
@@ -78,12 +78,12 @@ const animations = [
78
78
  ...utils.makeGlobalStaticRules("animate", "animation")
79
79
  ];
80
80
 
81
- const bgGradientToValue = (cssColor) => {
81
+ function bgGradientToValue(cssColor) {
82
82
  if (cssColor)
83
83
  return utils.colorToString(cssColor, 0);
84
84
  return "rgba(255,255,255,0)";
85
- };
86
- const bgGradientColorValue = (mode, cssColor, color, alpha) => {
85
+ }
86
+ function bgGradientColorValue(mode, cssColor, color, alpha) {
87
87
  if (cssColor) {
88
88
  if (alpha != null)
89
89
  return utils.colorToString(cssColor, alpha);
@@ -91,33 +91,35 @@ const bgGradientColorValue = (mode, cssColor, color, alpha) => {
91
91
  return utils.colorToString(cssColor, `var(--un-${mode}-opacity, ${utils.colorOpacityToString(cssColor)})`);
92
92
  }
93
93
  return utils.colorToString(color, alpha);
94
- };
95
- const bgGradientColorResolver = (mode) => ([, body], { theme }) => {
96
- const data = utils.parseColor(body, theme);
97
- if (!data)
98
- return;
99
- const { alpha, color, cssColor } = data;
100
- if (!color)
101
- return;
102
- const colorString = bgGradientColorValue(mode, cssColor, color, alpha);
103
- switch (mode) {
104
- case "from":
105
- return {
106
- "--un-gradient-from": colorString,
107
- "--un-gradient-to": bgGradientToValue(cssColor),
108
- "--un-gradient-stops": "var(--un-gradient-from), var(--un-gradient-to)"
109
- };
110
- case "via":
111
- return {
112
- "--un-gradient-to": bgGradientToValue(cssColor),
113
- "--un-gradient-stops": `var(--un-gradient-from), ${colorString}, var(--un-gradient-to)`
114
- };
115
- case "to":
116
- return {
117
- "--un-gradient-to": colorString
118
- };
119
- }
120
- };
94
+ }
95
+ function bgGradientColorResolver(mode) {
96
+ return ([, body], { theme }) => {
97
+ const data = utils.parseColor(body, theme);
98
+ if (!data)
99
+ return;
100
+ const { alpha, color, cssColor } = data;
101
+ if (!color)
102
+ return;
103
+ const colorString = bgGradientColorValue(mode, cssColor, color, alpha);
104
+ switch (mode) {
105
+ case "from":
106
+ return {
107
+ "--un-gradient-from": colorString,
108
+ "--un-gradient-to": bgGradientToValue(cssColor),
109
+ "--un-gradient-stops": "var(--un-gradient-from), var(--un-gradient-to)"
110
+ };
111
+ case "via":
112
+ return {
113
+ "--un-gradient-to": bgGradientToValue(cssColor),
114
+ "--un-gradient-stops": `var(--un-gradient-from), ${colorString}, var(--un-gradient-to)`
115
+ };
116
+ case "to":
117
+ return {
118
+ "--un-gradient-to": colorString
119
+ };
120
+ }
121
+ };
122
+ }
121
123
  const bgUrlRE = /^\[url\(.+\)\]$/;
122
124
  const bgLengthRE = /^\[length:.+\]$/;
123
125
  const bgPositionRE = /^\[position:.+\]$/;
@@ -378,32 +380,34 @@ const backdropFilterBase = {
378
380
  "--un-backdrop-sepia": rules$1.varEmpty
379
381
  };
380
382
  const backdropFilterProperty = "var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)";
381
- const percentWithDefault = (str) => {
383
+ function percentWithDefault(str) {
382
384
  let v = utils.handler.bracket.cssvar(str || "");
383
385
  if (v != null)
384
386
  return v;
385
387
  v = str ? utils.handler.percent(str) : "1";
386
388
  if (v != null && parseFloat(v) <= 1)
387
389
  return v;
388
- };
389
- const toFilter = (varName, resolver) => ([, b, s], { theme }) => {
390
- const value = resolver(s, theme) ?? (s === "none" ? "0" : "");
391
- if (value !== "") {
392
- if (b) {
393
- return {
394
- [`--un-${b}${varName}`]: `${varName}(${value})`,
395
- "-webkit-backdrop-filter": backdropFilterProperty,
396
- "backdrop-filter": backdropFilterProperty
397
- };
398
- } else {
399
- return {
400
- [`--un-${varName}`]: `${varName}(${value})`,
401
- filter: filterProperty
402
- };
390
+ }
391
+ function toFilter(varName, resolver) {
392
+ return ([, b, s], { theme }) => {
393
+ const value = resolver(s, theme) ?? (s === "none" ? "0" : "");
394
+ if (value !== "") {
395
+ if (b) {
396
+ return {
397
+ [`--un-${b}${varName}`]: `${varName}(${value})`,
398
+ "-webkit-backdrop-filter": backdropFilterProperty,
399
+ "backdrop-filter": backdropFilterProperty
400
+ };
401
+ } else {
402
+ return {
403
+ [`--un-${varName}`]: `${varName}(${value})`,
404
+ filter: filterProperty
405
+ };
406
+ }
403
407
  }
404
- }
405
- };
406
- const dropShadowResolver = ([, s], { theme }) => {
408
+ };
409
+ }
410
+ function dropShadowResolver([, s], { theme }) {
407
411
  let v = theme.dropShadow?.[s || "DEFAULT"];
408
412
  if (v != null) {
409
413
  const shadows = utils.colorableShadows(v, "--un-drop-shadow-color");
@@ -419,7 +423,7 @@ const dropShadowResolver = ([, s], { theme }) => {
419
423
  "filter": filterProperty
420
424
  };
421
425
  }
422
- };
426
+ }
423
427
  const filters = [
424
428
  [/^(?:(backdrop-)|filter-)?blur(?:-(.+))?$/, toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || utils.handler.bracket.cssvar.px(s)), { autocomplete: ["(backdrop|filter)-blur-$blur", "blur-$blur"] }],
425
429
  [/^(?:(backdrop-)|filter-)?brightness-(.+)$/, toFilter("brightness", (s) => utils.handler.bracket.cssvar.percent(s)), { autocomplete: ["(backdrop|filter)-brightness-<percent>", "brightness-<percent>"] }],
@@ -712,6 +716,9 @@ const lineClamps = [
712
716
  "line-clamp": v
713
717
  }), { autocomplete: ["line-clamp", "line-clamp-<num>"] }],
714
718
  ...["none", ...utils.globalKeywords].map((keyword) => [`line-clamp-${keyword}`, {
719
+ "overflow": "visible",
720
+ "display": "block",
721
+ "-webkit-box-orient": "horizontal",
715
722
  "-webkit-line-clamp": keyword,
716
723
  "line-clamp": keyword
717
724
  }])
@@ -724,10 +731,12 @@ const fontVariantNumericBase = {
724
731
  "--un-numeric-spacing": rules$1.varEmpty,
725
732
  "--un-numeric-fraction": rules$1.varEmpty
726
733
  };
727
- const toEntries = (entry) => ({
728
- ...entry,
729
- "font-variant-numeric": "var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)"
730
- });
734
+ function toEntries(entry) {
735
+ return {
736
+ ...entry,
737
+ "font-variant-numeric": "var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)"
738
+ };
739
+ }
731
740
  const fontVariantNumeric = [
732
741
  [/^ordinal$/, () => toEntries({ "--un-ordinal": "ordinal" }), { autocomplete: "ordinal" }],
733
742
  [/^slashed-zero$/, () => toEntries({ "--un-slashed-zero": "slashed-zero" }), { autocomplete: "slashed-zero" }],
@@ -1171,19 +1180,21 @@ function hasOpacityValue(body) {
1171
1180
  return false;
1172
1181
  }
1173
1182
 
1174
- const variants = (options) => [
1175
- placeholderModifier,
1176
- variantSpaceAndDivide,
1177
- ...variants$1.variants(options),
1178
- ...variantContrasts,
1179
- ...variantOrientations,
1180
- ...variantMotions,
1181
- ...variantCombinators,
1182
- ...variantColorsScheme,
1183
- ...variantStickyHover
1184
- ];
1183
+ function variants(options) {
1184
+ return [
1185
+ placeholderModifier,
1186
+ variantSpaceAndDivide,
1187
+ ...variants$1.variants(options),
1188
+ ...variantContrasts,
1189
+ ...variantOrientations,
1190
+ ...variantMotions,
1191
+ ...variantCombinators,
1192
+ ...variantColorsScheme,
1193
+ ...variantStickyHover
1194
+ ];
1195
+ }
1185
1196
 
1186
- const presetWind = (options = {}) => {
1197
+ function presetWind(options = {}) {
1187
1198
  options.dark = options.dark ?? "class";
1188
1199
  options.attributifyPseudo = options.attributifyPseudo ?? false;
1189
1200
  options.preflight = options.preflight ?? true;
@@ -1199,7 +1210,7 @@ const presetWind = (options = {}) => {
1199
1210
  preflights: options.preflight ? presetMini.normalizePreflights(presetMini.preflights, options.variablePrefix) : [],
1200
1211
  prefix: options.prefix
1201
1212
  };
1202
- };
1213
+ }
1203
1214
 
1204
1215
  exports.colors = presetMini.colors;
1205
1216
  exports.preflights = presetMini.preflights;
package/dist/index.d.ts CHANGED
@@ -10,10 +10,10 @@ declare const shortcuts: _unocss_core.Shortcut<_unocss_preset_mini.Theme>[];
10
10
 
11
11
  declare const theme: Theme;
12
12
 
13
- declare const variants: (options: PresetWindOptions) => Variant<Theme>[];
13
+ declare function variants(options: PresetWindOptions): Variant<Theme>[];
14
14
 
15
15
  interface PresetWindOptions extends PresetMiniOptions {
16
16
  }
17
- declare const presetWind: (options?: PresetWindOptions) => Preset<Theme>;
17
+ declare function presetWind(options?: PresetWindOptions): Preset<Theme>;
18
18
 
19
19
  export { PresetWindOptions, presetWind as default, presetWind, rules, shortcuts, theme, variants };
package/dist/index.mjs CHANGED
@@ -75,12 +75,12 @@ const animations = [
75
75
  ...makeGlobalStaticRules("animate", "animation")
76
76
  ];
77
77
 
78
- const bgGradientToValue = (cssColor) => {
78
+ function bgGradientToValue(cssColor) {
79
79
  if (cssColor)
80
80
  return colorToString(cssColor, 0);
81
81
  return "rgba(255,255,255,0)";
82
- };
83
- const bgGradientColorValue = (mode, cssColor, color, alpha) => {
82
+ }
83
+ function bgGradientColorValue(mode, cssColor, color, alpha) {
84
84
  if (cssColor) {
85
85
  if (alpha != null)
86
86
  return colorToString(cssColor, alpha);
@@ -88,33 +88,35 @@ const bgGradientColorValue = (mode, cssColor, color, alpha) => {
88
88
  return colorToString(cssColor, `var(--un-${mode}-opacity, ${colorOpacityToString(cssColor)})`);
89
89
  }
90
90
  return colorToString(color, alpha);
91
- };
92
- const bgGradientColorResolver = (mode) => ([, body], { theme }) => {
93
- const data = parseColor(body, theme);
94
- if (!data)
95
- return;
96
- const { alpha, color, cssColor } = data;
97
- if (!color)
98
- return;
99
- const colorString = bgGradientColorValue(mode, cssColor, color, alpha);
100
- switch (mode) {
101
- case "from":
102
- return {
103
- "--un-gradient-from": colorString,
104
- "--un-gradient-to": bgGradientToValue(cssColor),
105
- "--un-gradient-stops": "var(--un-gradient-from), var(--un-gradient-to)"
106
- };
107
- case "via":
108
- return {
109
- "--un-gradient-to": bgGradientToValue(cssColor),
110
- "--un-gradient-stops": `var(--un-gradient-from), ${colorString}, var(--un-gradient-to)`
111
- };
112
- case "to":
113
- return {
114
- "--un-gradient-to": colorString
115
- };
116
- }
117
- };
91
+ }
92
+ function bgGradientColorResolver(mode) {
93
+ return ([, body], { theme }) => {
94
+ const data = parseColor(body, theme);
95
+ if (!data)
96
+ return;
97
+ const { alpha, color, cssColor } = data;
98
+ if (!color)
99
+ return;
100
+ const colorString = bgGradientColorValue(mode, cssColor, color, alpha);
101
+ switch (mode) {
102
+ case "from":
103
+ return {
104
+ "--un-gradient-from": colorString,
105
+ "--un-gradient-to": bgGradientToValue(cssColor),
106
+ "--un-gradient-stops": "var(--un-gradient-from), var(--un-gradient-to)"
107
+ };
108
+ case "via":
109
+ return {
110
+ "--un-gradient-to": bgGradientToValue(cssColor),
111
+ "--un-gradient-stops": `var(--un-gradient-from), ${colorString}, var(--un-gradient-to)`
112
+ };
113
+ case "to":
114
+ return {
115
+ "--un-gradient-to": colorString
116
+ };
117
+ }
118
+ };
119
+ }
118
120
  const bgUrlRE = /^\[url\(.+\)\]$/;
119
121
  const bgLengthRE = /^\[length:.+\]$/;
120
122
  const bgPositionRE = /^\[position:.+\]$/;
@@ -375,32 +377,34 @@ const backdropFilterBase = {
375
377
  "--un-backdrop-sepia": varEmpty
376
378
  };
377
379
  const backdropFilterProperty = "var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)";
378
- const percentWithDefault = (str) => {
380
+ function percentWithDefault(str) {
379
381
  let v = handler.bracket.cssvar(str || "");
380
382
  if (v != null)
381
383
  return v;
382
384
  v = str ? handler.percent(str) : "1";
383
385
  if (v != null && parseFloat(v) <= 1)
384
386
  return v;
385
- };
386
- const toFilter = (varName, resolver) => ([, b, s], { theme }) => {
387
- const value = resolver(s, theme) ?? (s === "none" ? "0" : "");
388
- if (value !== "") {
389
- if (b) {
390
- return {
391
- [`--un-${b}${varName}`]: `${varName}(${value})`,
392
- "-webkit-backdrop-filter": backdropFilterProperty,
393
- "backdrop-filter": backdropFilterProperty
394
- };
395
- } else {
396
- return {
397
- [`--un-${varName}`]: `${varName}(${value})`,
398
- filter: filterProperty
399
- };
387
+ }
388
+ function toFilter(varName, resolver) {
389
+ return ([, b, s], { theme }) => {
390
+ const value = resolver(s, theme) ?? (s === "none" ? "0" : "");
391
+ if (value !== "") {
392
+ if (b) {
393
+ return {
394
+ [`--un-${b}${varName}`]: `${varName}(${value})`,
395
+ "-webkit-backdrop-filter": backdropFilterProperty,
396
+ "backdrop-filter": backdropFilterProperty
397
+ };
398
+ } else {
399
+ return {
400
+ [`--un-${varName}`]: `${varName}(${value})`,
401
+ filter: filterProperty
402
+ };
403
+ }
400
404
  }
401
- }
402
- };
403
- const dropShadowResolver = ([, s], { theme }) => {
405
+ };
406
+ }
407
+ function dropShadowResolver([, s], { theme }) {
404
408
  let v = theme.dropShadow?.[s || "DEFAULT"];
405
409
  if (v != null) {
406
410
  const shadows = colorableShadows(v, "--un-drop-shadow-color");
@@ -416,7 +420,7 @@ const dropShadowResolver = ([, s], { theme }) => {
416
420
  "filter": filterProperty
417
421
  };
418
422
  }
419
- };
423
+ }
420
424
  const filters = [
421
425
  [/^(?:(backdrop-)|filter-)?blur(?:-(.+))?$/, toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s)), { autocomplete: ["(backdrop|filter)-blur-$blur", "blur-$blur"] }],
422
426
  [/^(?:(backdrop-)|filter-)?brightness-(.+)$/, toFilter("brightness", (s) => handler.bracket.cssvar.percent(s)), { autocomplete: ["(backdrop|filter)-brightness-<percent>", "brightness-<percent>"] }],
@@ -709,6 +713,9 @@ const lineClamps = [
709
713
  "line-clamp": v
710
714
  }), { autocomplete: ["line-clamp", "line-clamp-<num>"] }],
711
715
  ...["none", ...globalKeywords].map((keyword) => [`line-clamp-${keyword}`, {
716
+ "overflow": "visible",
717
+ "display": "block",
718
+ "-webkit-box-orient": "horizontal",
712
719
  "-webkit-line-clamp": keyword,
713
720
  "line-clamp": keyword
714
721
  }])
@@ -721,10 +728,12 @@ const fontVariantNumericBase = {
721
728
  "--un-numeric-spacing": varEmpty,
722
729
  "--un-numeric-fraction": varEmpty
723
730
  };
724
- const toEntries = (entry) => ({
725
- ...entry,
726
- "font-variant-numeric": "var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)"
727
- });
731
+ function toEntries(entry) {
732
+ return {
733
+ ...entry,
734
+ "font-variant-numeric": "var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)"
735
+ };
736
+ }
728
737
  const fontVariantNumeric = [
729
738
  [/^ordinal$/, () => toEntries({ "--un-ordinal": "ordinal" }), { autocomplete: "ordinal" }],
730
739
  [/^slashed-zero$/, () => toEntries({ "--un-slashed-zero": "slashed-zero" }), { autocomplete: "slashed-zero" }],
@@ -1168,19 +1177,21 @@ function hasOpacityValue(body) {
1168
1177
  return false;
1169
1178
  }
1170
1179
 
1171
- const variants = (options) => [
1172
- placeholderModifier,
1173
- variantSpaceAndDivide,
1174
- ...variants$1(options),
1175
- ...variantContrasts,
1176
- ...variantOrientations,
1177
- ...variantMotions,
1178
- ...variantCombinators,
1179
- ...variantColorsScheme,
1180
- ...variantStickyHover
1181
- ];
1180
+ function variants(options) {
1181
+ return [
1182
+ placeholderModifier,
1183
+ variantSpaceAndDivide,
1184
+ ...variants$1(options),
1185
+ ...variantContrasts,
1186
+ ...variantOrientations,
1187
+ ...variantMotions,
1188
+ ...variantCombinators,
1189
+ ...variantColorsScheme,
1190
+ ...variantStickyHover
1191
+ ];
1192
+ }
1182
1193
 
1183
- const presetWind = (options = {}) => {
1194
+ function presetWind(options = {}) {
1184
1195
  options.dark = options.dark ?? "class";
1185
1196
  options.attributifyPseudo = options.attributifyPseudo ?? false;
1186
1197
  options.preflight = options.preflight ?? true;
@@ -1196,6 +1207,6 @@ const presetWind = (options = {}) => {
1196
1207
  preflights: options.preflight ? normalizePreflights(preflights, options.variablePrefix) : [],
1197
1208
  prefix: options.prefix
1198
1209
  };
1199
- };
1210
+ }
1200
1211
 
1201
1212
  export { presetWind as default, presetWind, rules, shortcuts, theme, variants };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind",
3
- "version": "0.50.5",
3
+ "version": "0.50.7",
4
4
  "description": "Tailwind / Windi CSS compact preset for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -35,8 +35,8 @@
35
35
  "*.css"
36
36
  ],
37
37
  "dependencies": {
38
- "@unocss/core": "0.50.5",
39
- "@unocss/preset-mini": "0.50.5"
38
+ "@unocss/core": "0.50.7",
39
+ "@unocss/preset-mini": "0.50.7"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",