@unocss/preset-wind 0.41.1 → 0.42.1

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
@@ -40,8 +40,8 @@ const animations = [
40
40
  [/^animate-delay-(.+)$/, ([, d], { theme }) => ({ "animation-delay": theme.duration?.[d || "DEFAULT"] ?? utils.handler.bracket.cssvar.time(d) }), { autocomplete: ["animate-delay", "animate-delay-$duration"] }],
41
41
  [/^animate-ease(?:-(.+))?$/, ([, d], { theme }) => ({ "animation-timing-function": theme.easing?.[d || "DEFAULT"] ?? utils.handler.bracket.cssvar(d) }), { autocomplete: "animate-delay-$easing" }],
42
42
  [
43
- /^animate-(?:fill-|mode-|fill-mode-)?(none|forwards|backwards|both|inherit|initial|revert|revert-layer|unset)$/,
44
- ([, d]) => ({ "animation-fill-mode": d }),
43
+ /^animate-(fill-mode-|fill-|mode-)?(.+)$/,
44
+ ([, t, d]) => ["none", "forwards", "backwards", "both", ...[t ? utils.globalKeywords : []]].includes(d) ? { "animation-fill-mode": d } : void 0,
45
45
  {
46
46
  autocomplete: [
47
47
  "animate-(fill|mode|fill-mode)",
@@ -51,8 +51,8 @@ const animations = [
51
51
  }
52
52
  ],
53
53
  [
54
- /^animate-(?:direction-)?(normal|reverse|alternate|alternate-reverse|inherit|initial|revert|revert-layer|unset)$/,
55
- ([, d]) => ({ "animation-direction": d }),
54
+ /^animate-(direction-)?(.+)$/,
55
+ ([, t, d]) => ["normal", "reverse", "alternate", "alternate-reverse", ...[t ? utils.globalKeywords : []]].includes(d) ? { "animation-direction": d } : void 0,
56
56
  {
57
57
  autocomplete: [
58
58
  "animate-direction",
@@ -63,8 +63,8 @@ const animations = [
63
63
  ],
64
64
  [/^animate-(?:iteration-|count-|iteration-count-)(.+)$/, ([, d]) => ({ "animation-iteration-count": utils.handler.bracket.cssvar(d) ?? d.replace(/\-/g, ",") }), { autocomplete: ["animate-(iteration|count|iteration-count)", "animate-(iteration|count|iteration-count)-<num>"] }],
65
65
  [
66
- /^animate-(?:play-|state-|play-state-)?(paused|running|inherit|initial|revert|revert-layer|unset)$/,
67
- ([, d]) => ({ "animation-play-state": d }),
66
+ /^animate-(play-state-|play-|state-)?(.+)$/,
67
+ ([, t, d]) => ["paused", "running", ...[t ? utils.globalKeywords : []]].includes(d) ? { "animation-play-state": d } : void 0,
68
68
  {
69
69
  autocomplete: [
70
70
  "animate-(play|state|play-state)",
@@ -73,7 +73,8 @@ const animations = [
73
73
  ]
74
74
  }
75
75
  ],
76
- ["animate-none", { animation: "none" }]
76
+ ["animate-none", { animation: "none" }],
77
+ ...utils.makeGlobalStaticRules("animate", "animation")
77
78
  ];
78
79
 
79
80
  const bgGradientToValue = (cssColor) => {
@@ -206,19 +207,22 @@ const listStyles = {
206
207
  "upper-latin": "upper-latin"
207
208
  };
208
209
  const listStyle = [
209
- [/^list-(.+)(?:-(outside|inside))?$/, ([, style, position]) => {
210
- if (position != null) {
211
- return {
212
- "list-style-position": position,
213
- "list-style-type": listStyles[style]
214
- };
210
+ [/^list-(.+?)(?:-(outside|inside))?$/, ([, alias, position]) => {
211
+ const style = listStyles[alias];
212
+ if (style) {
213
+ if (position) {
214
+ return {
215
+ "list-style-position": position,
216
+ "list-style-type": style
217
+ };
218
+ }
219
+ return { "list-style-type": style };
215
220
  }
216
- return { "list-style-type": listStyles[style] };
217
221
  }, { autocomplete: [`list-(${Object.keys(listStyles).join("|")})`, `list-(${Object.keys(listStyles).join("|")})-(outside|inside)`] }],
218
222
  ["list-outside", { "list-style-position": "outside" }],
219
223
  ["list-inside", { "list-style-position": "inside" }],
220
224
  ["list-none", { "list-style-type": "none" }],
221
- ...utils.makeGlobalStaticRules("list", "list-style")
225
+ ...utils.makeGlobalStaticRules("list", "list-style-type")
222
226
  ];
223
227
  const accents = [
224
228
  [/^accent-(.+)$/, utils.colorResolver("accent-color", "accent"), { autocomplete: "accent-$colors" }],
@@ -290,7 +294,7 @@ const queryMatcher = /@media \(min-width: (.+)\)/;
290
294
  const container = [
291
295
  [
292
296
  /^__container$/,
293
- (m, { variantHandlers }) => {
297
+ (m, { theme, variantHandlers }) => {
294
298
  let width = "100%";
295
299
  for (const v of variantHandlers) {
296
300
  const query = v.handle?.({}, (x) => x)?.parent;
@@ -300,6 +304,13 @@ const container = [
300
304
  width = match;
301
305
  }
302
306
  }
307
+ if (theme.container?.center) {
308
+ return {
309
+ "max-width": width,
310
+ "margin-left": "auto",
311
+ "margin-right": "auto"
312
+ };
313
+ }
303
314
  return { "max-width": width };
304
315
  },
305
316
  { internal: true }
@@ -644,11 +655,7 @@ const divides = [
644
655
  [/^divide-(block|inline)-reverse$/, ([, d]) => ({ [`--un-divide-${d}-reverse`]: 1 })],
645
656
  [/^divide-(.+)$/, utils.colorResolver("border-color", "divide"), { autocomplete: "divide-$colors" }],
646
657
  [/^divide-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-divide-opacity": utils.handler.bracket.percent(opacity) }), { autocomplete: ["divide-(op|opacity)", "divide-(op|opacity)-<percent>"] }],
647
- ["divide-solid", { "border-style": "solid" }],
648
- ["divide-dashed", { "border-style": "dashed" }],
649
- ["divide-dotted", { "border-style": "dotted" }],
650
- ["divide-double", { "border-style": "double" }],
651
- ["divide-none", { "border-style": "none" }]
658
+ ...rules$1.borderStyles.map((style) => [`divide-${style}`, { "border-style": style }])
652
659
  ];
653
660
  function handlerDivide([, d, s], { theme }) {
654
661
  const v = theme.lineWidth?.[s || "DEFAULT"] ?? utils.handler.bracket.cssvar.px(s || "1");
@@ -675,10 +682,10 @@ const lineClamps = [
675
682
  "-webkit-line-clamp": v,
676
683
  "line-clamp": v
677
684
  }), { autocomplete: ["line-clamp", "line-clamp-<num>"] }],
678
- ["line-clamp-none", {
679
- "-webkit-line-clamp": "unset",
680
- "line-clamp": "unset"
681
- }]
685
+ ...["none", ...utils.globalKeywords].map((keyword) => [`line-clamp-${keyword}`, {
686
+ "-webkit-line-clamp": keyword,
687
+ "line-clamp": keyword
688
+ }])
682
689
  ];
683
690
 
684
691
  const fontVariantNumericBase = {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { preflights } from '@unocss/preset-mini';
2
2
  export { colors, preflights } from '@unocss/preset-mini';
3
- import { handler, positionMap, makeGlobalStaticRules, globalKeywords, parseColor, colorToString, colorOpacityToString, colorResolver, resolveBreakpoints, colorableShadows, directionMap, directionSize, variantMatcher, variantParentMatcher, hasParseableColor } 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, textTransforms as textTransforms$1, fontStyles, textColors, textDecorations, fontSmoothings, tabSizes, textStrokes, textShadows, opacity, boxShadows, outline, rings, transitions, willChange, contents, questionMark, transformBase, boxShadowsBase, ringBase } from '@unocss/preset-mini/rules';
3
+ import { handler, globalKeywords, makeGlobalStaticRules, positionMap, parseColor, colorToString, colorOpacityToString, colorResolver, resolveBreakpoints, colorableShadows, directionMap, directionSize, variantMatcher, variantParentMatcher, hasParseableColor } from '@unocss/preset-mini/utils';
4
+ import { varEmpty, borderStyles, 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, textTransforms as textTransforms$1, fontStyles, textColors, textDecorations, fontSmoothings, tabSizes, textStrokes, textShadows, opacity, boxShadows, outline, rings, transitions, willChange, contents, questionMark, transformBase, boxShadowsBase, ringBase } from '@unocss/preset-mini/rules';
5
5
  import { theme as theme$1 } from '@unocss/preset-mini/theme';
6
6
  import { variants as variants$1 } from '@unocss/preset-mini/variants';
7
7
 
@@ -37,8 +37,8 @@ const animations = [
37
37
  [/^animate-delay-(.+)$/, ([, d], { theme }) => ({ "animation-delay": theme.duration?.[d || "DEFAULT"] ?? handler.bracket.cssvar.time(d) }), { autocomplete: ["animate-delay", "animate-delay-$duration"] }],
38
38
  [/^animate-ease(?:-(.+))?$/, ([, d], { theme }) => ({ "animation-timing-function": theme.easing?.[d || "DEFAULT"] ?? handler.bracket.cssvar(d) }), { autocomplete: "animate-delay-$easing" }],
39
39
  [
40
- /^animate-(?:fill-|mode-|fill-mode-)?(none|forwards|backwards|both|inherit|initial|revert|revert-layer|unset)$/,
41
- ([, d]) => ({ "animation-fill-mode": d }),
40
+ /^animate-(fill-mode-|fill-|mode-)?(.+)$/,
41
+ ([, t, d]) => ["none", "forwards", "backwards", "both", ...[t ? globalKeywords : []]].includes(d) ? { "animation-fill-mode": d } : void 0,
42
42
  {
43
43
  autocomplete: [
44
44
  "animate-(fill|mode|fill-mode)",
@@ -48,8 +48,8 @@ const animations = [
48
48
  }
49
49
  ],
50
50
  [
51
- /^animate-(?:direction-)?(normal|reverse|alternate|alternate-reverse|inherit|initial|revert|revert-layer|unset)$/,
52
- ([, d]) => ({ "animation-direction": d }),
51
+ /^animate-(direction-)?(.+)$/,
52
+ ([, t, d]) => ["normal", "reverse", "alternate", "alternate-reverse", ...[t ? globalKeywords : []]].includes(d) ? { "animation-direction": d } : void 0,
53
53
  {
54
54
  autocomplete: [
55
55
  "animate-direction",
@@ -60,8 +60,8 @@ const animations = [
60
60
  ],
61
61
  [/^animate-(?:iteration-|count-|iteration-count-)(.+)$/, ([, d]) => ({ "animation-iteration-count": handler.bracket.cssvar(d) ?? d.replace(/\-/g, ",") }), { autocomplete: ["animate-(iteration|count|iteration-count)", "animate-(iteration|count|iteration-count)-<num>"] }],
62
62
  [
63
- /^animate-(?:play-|state-|play-state-)?(paused|running|inherit|initial|revert|revert-layer|unset)$/,
64
- ([, d]) => ({ "animation-play-state": d }),
63
+ /^animate-(play-state-|play-|state-)?(.+)$/,
64
+ ([, t, d]) => ["paused", "running", ...[t ? globalKeywords : []]].includes(d) ? { "animation-play-state": d } : void 0,
65
65
  {
66
66
  autocomplete: [
67
67
  "animate-(play|state|play-state)",
@@ -70,7 +70,8 @@ const animations = [
70
70
  ]
71
71
  }
72
72
  ],
73
- ["animate-none", { animation: "none" }]
73
+ ["animate-none", { animation: "none" }],
74
+ ...makeGlobalStaticRules("animate", "animation")
74
75
  ];
75
76
 
76
77
  const bgGradientToValue = (cssColor) => {
@@ -203,19 +204,22 @@ const listStyles = {
203
204
  "upper-latin": "upper-latin"
204
205
  };
205
206
  const listStyle = [
206
- [/^list-(.+)(?:-(outside|inside))?$/, ([, style, position]) => {
207
- if (position != null) {
208
- return {
209
- "list-style-position": position,
210
- "list-style-type": listStyles[style]
211
- };
207
+ [/^list-(.+?)(?:-(outside|inside))?$/, ([, alias, position]) => {
208
+ const style = listStyles[alias];
209
+ if (style) {
210
+ if (position) {
211
+ return {
212
+ "list-style-position": position,
213
+ "list-style-type": style
214
+ };
215
+ }
216
+ return { "list-style-type": style };
212
217
  }
213
- return { "list-style-type": listStyles[style] };
214
218
  }, { autocomplete: [`list-(${Object.keys(listStyles).join("|")})`, `list-(${Object.keys(listStyles).join("|")})-(outside|inside)`] }],
215
219
  ["list-outside", { "list-style-position": "outside" }],
216
220
  ["list-inside", { "list-style-position": "inside" }],
217
221
  ["list-none", { "list-style-type": "none" }],
218
- ...makeGlobalStaticRules("list", "list-style")
222
+ ...makeGlobalStaticRules("list", "list-style-type")
219
223
  ];
220
224
  const accents = [
221
225
  [/^accent-(.+)$/, colorResolver("accent-color", "accent"), { autocomplete: "accent-$colors" }],
@@ -287,7 +291,7 @@ const queryMatcher = /@media \(min-width: (.+)\)/;
287
291
  const container = [
288
292
  [
289
293
  /^__container$/,
290
- (m, { variantHandlers }) => {
294
+ (m, { theme, variantHandlers }) => {
291
295
  let width = "100%";
292
296
  for (const v of variantHandlers) {
293
297
  const query = v.handle?.({}, (x) => x)?.parent;
@@ -297,6 +301,13 @@ const container = [
297
301
  width = match;
298
302
  }
299
303
  }
304
+ if (theme.container?.center) {
305
+ return {
306
+ "max-width": width,
307
+ "margin-left": "auto",
308
+ "margin-right": "auto"
309
+ };
310
+ }
300
311
  return { "max-width": width };
301
312
  },
302
313
  { internal: true }
@@ -641,11 +652,7 @@ const divides = [
641
652
  [/^divide-(block|inline)-reverse$/, ([, d]) => ({ [`--un-divide-${d}-reverse`]: 1 })],
642
653
  [/^divide-(.+)$/, colorResolver("border-color", "divide"), { autocomplete: "divide-$colors" }],
643
654
  [/^divide-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-divide-opacity": handler.bracket.percent(opacity) }), { autocomplete: ["divide-(op|opacity)", "divide-(op|opacity)-<percent>"] }],
644
- ["divide-solid", { "border-style": "solid" }],
645
- ["divide-dashed", { "border-style": "dashed" }],
646
- ["divide-dotted", { "border-style": "dotted" }],
647
- ["divide-double", { "border-style": "double" }],
648
- ["divide-none", { "border-style": "none" }]
655
+ ...borderStyles.map((style) => [`divide-${style}`, { "border-style": style }])
649
656
  ];
650
657
  function handlerDivide([, d, s], { theme }) {
651
658
  const v = theme.lineWidth?.[s || "DEFAULT"] ?? handler.bracket.cssvar.px(s || "1");
@@ -672,10 +679,10 @@ const lineClamps = [
672
679
  "-webkit-line-clamp": v,
673
680
  "line-clamp": v
674
681
  }), { autocomplete: ["line-clamp", "line-clamp-<num>"] }],
675
- ["line-clamp-none", {
676
- "-webkit-line-clamp": "unset",
677
- "line-clamp": "unset"
678
- }]
682
+ ...["none", ...globalKeywords].map((keyword) => [`line-clamp-${keyword}`, {
683
+ "-webkit-line-clamp": keyword,
684
+ "line-clamp": keyword
685
+ }])
679
686
  ];
680
687
 
681
688
  const fontVariantNumericBase = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind",
3
- "version": "0.41.1",
3
+ "version": "0.42.1",
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.41.1",
39
- "@unocss/preset-mini": "0.41.1"
38
+ "@unocss/core": "0.42.1",
39
+ "@unocss/preset-mini": "0.42.1"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",