@unocss/preset-wind 0.22.5 → 0.22.6

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,7 +10,7 @@ const rules$1 = require('@unocss/preset-mini/rules');
10
10
  const utils = require('@unocss/preset-mini/utils');
11
11
 
12
12
  const animations = [
13
- [/^keyframes-(.+)$/, ([, name], { theme, constructCSS }) => {
13
+ [/^(?:animate-)?keyframes-(.+)$/, ([, name], { theme, constructCSS }) => {
14
14
  const kf = theme.animation?.keyframes?.[name];
15
15
  if (kf)
16
16
  return `@keyframes ${name}${kf}
@@ -25,18 +25,18 @@ ${constructCSS({ animation: `${name}` })}`;
25
25
  return `@keyframes ${name}${kf}
26
26
  ${constructCSS(Object.assign({ animation: `${name} ${duration} ${timing} infinite` }, props))}`;
27
27
  }
28
+ return { animate: utils.handler.bracket.cssvar(name) };
28
29
  }],
29
- [/^animate-(?:duration-)?(.+)$/, ([, d]) => ({ "animation-duration": utils.handler.bracket.cssvar.time(d) })],
30
+ [/^animate-name-(.+)/, ([, d]) => ({ "animation-name": utils.handler.bracket.cssvar(d) ?? d })],
31
+ [/^animate-duration-(.+)$/, ([, d]) => ({ "animation-duration": utils.handler.bracket.cssvar.time(d) })],
30
32
  [/^animate-delay-(.+)$/, ([, d]) => ({ "animation-delay": utils.handler.bracket.cssvar.time(d) })],
31
- [/^animate-(?:fill-)?mode-(forwards|backwards|both|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-fill-mode": d })],
32
- ["animate-mode-none", { "animation-fill-mode": "none" }],
33
- ["animate-fill-mode-none", { "animation-fill-mode": "none" }],
33
+ [/^animate-ease(?:-(.+))?$/, ([, d], { theme }) => ({ "animation-timing-function": theme.easing?.[d || "DEFAULT"] ?? utils.handler.bracket.cssvar(d) })],
34
+ [/^animate-(?:fill-|mode-|fill-mode-)?(forwards|backwards|both|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-fill-mode": d })],
35
+ [/^animate-(?:fill-|mode-|fill-mode-)none$/, () => ({ "animation-fill-mode": "none" })],
34
36
  [/^animate-(?:direction-)?(reverse|alternate|alternate-reverse|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-direction": d })],
35
- ["animate-normal", { "animation-direction": "normal" }],
36
- ["animate-direction-normal", { "animation-direction": "normal" }],
37
- [/^animate-(?:iteration-)?count-(.+)$/, ([, d]) => ({ "animation-iteration-count": utils.handler.bracket.cssvar(d) ?? d.replace(/\-/g, ",") })],
38
- [/^animate-name-(.+)/, ([, d]) => ({ "animation-name": d })],
39
- [/^animate-play-(?:state-)?(paused|running|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-play-state": d })],
37
+ [/^animate-(?:direction-)?normal$/, () => ({ "animation-direction": "normal" })],
38
+ [/^animate-(?:iteration-|count-|iteration-count-)(.+)$/, ([, d]) => ({ "animation-iteration-count": utils.handler.bracket.cssvar(d) ?? d.replace(/\-/g, ",") })],
39
+ [/^animate-(?:play-|state-|play-state-)?(paused|running|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-play-state": d })],
40
40
  ["animate-none", { animation: "none" }]
41
41
  ];
42
42
 
@@ -354,17 +354,20 @@ const spaces = [
354
354
  [/^space-(block|inline)-(-?.+)$/, handlerSpace],
355
355
  [/^space-(block|inline)-reverse$/, ([, d]) => ({ [`--un-space-${d}-reverse`]: 1 })]
356
356
  ];
357
- function handlerSpace(match) {
358
- const [, direction] = match;
359
- const results = utils.directionSize("margin")(match)?.map((item) => {
360
- const value = item[0].endsWith("right") || item[0].endsWith("bottom") ? `calc(${item[1]} * var(--un-space-${direction}-reverse))` : `calc(${item[1]} * calc(1 - var(--un-space-${direction}-reverse)))`;
361
- return [item[0], value];
362
- });
363
- if (results) {
364
- return [
365
- [`--un-space-${direction}-reverse`, 0],
366
- ...results
367
- ];
357
+ function handlerSpace([, d, s = "1"]) {
358
+ const v = utils.handler.bracket.cssvar.auto.fraction.rem(s);
359
+ if (v != null) {
360
+ const results = utils.directionMap[d].map((item) => {
361
+ const key = `margin${item}`;
362
+ const value = item.endsWith("right") || item.endsWith("bottom") ? `calc(${v} * var(--un-space-${d}-reverse))` : `calc(${v} * calc(1 - var(--un-space-${d}-reverse)))`;
363
+ return [key, value];
364
+ });
365
+ if (results) {
366
+ return [
367
+ [`--un-space-${d}-reverse`, 0],
368
+ ...results
369
+ ];
370
+ }
368
371
  }
369
372
  }
370
373
 
@@ -517,10 +520,10 @@ const variablesAbbrMap = {
517
520
  "write-orient": "text-orientation"
518
521
  };
519
522
  const cssVariables = [
520
- [/^(.+?)-\$(.+)$/, ([, name, varname]) => {
523
+ [/^(.+?)-(\$.+)$/, ([, name, varname]) => {
521
524
  const prop = variablesAbbrMap[name];
522
525
  if (prop)
523
- return { [prop]: `var(--${varname})` };
526
+ return { [prop]: utils.handler.cssvar(varname) };
524
527
  }]
525
528
  ];
526
529
 
@@ -547,8 +550,12 @@ function handlerDivide([, d, s = "1"]) {
547
550
  const value = item.endsWith("right") || item.endsWith("bottom") ? `calc(${v} * var(--un-divide-${d}-reverse))` : `calc(${v} * calc(1 - var(--un-divide-${d}-reverse)))`;
548
551
  return [key, value];
549
552
  });
550
- if (results)
551
- return [[`--un-divide-${d}-reverse`, 0], ...results];
553
+ if (results) {
554
+ return [
555
+ [`--un-divide-${d}-reverse`, 0],
556
+ ...results
557
+ ];
558
+ }
552
559
  }
553
560
  }
554
561
 
package/dist/index.mjs CHANGED
@@ -3,10 +3,10 @@ import { toArray, CONTROL_SHORTCUT_NO_MERGE } from '@unocss/core';
3
3
  import { theme as theme$1 } from '@unocss/preset-mini/theme';
4
4
  export { colors } from '@unocss/preset-mini';
5
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, directionSize, directionMap, variantMatcher, variantParentMatcher } from '@unocss/preset-mini/utils';
6
+ import { handler, positionMap, parseColor, colorResolver, directionMap, directionSize, variantMatcher, variantParentMatcher } from '@unocss/preset-mini/utils';
7
7
 
8
8
  const animations = [
9
- [/^keyframes-(.+)$/, ([, name], { theme, constructCSS }) => {
9
+ [/^(?:animate-)?keyframes-(.+)$/, ([, name], { theme, constructCSS }) => {
10
10
  const kf = theme.animation?.keyframes?.[name];
11
11
  if (kf)
12
12
  return `@keyframes ${name}${kf}
@@ -21,18 +21,18 @@ ${constructCSS({ animation: `${name}` })}`;
21
21
  return `@keyframes ${name}${kf}
22
22
  ${constructCSS(Object.assign({ animation: `${name} ${duration} ${timing} infinite` }, props))}`;
23
23
  }
24
+ return { animate: handler.bracket.cssvar(name) };
24
25
  }],
25
- [/^animate-(?:duration-)?(.+)$/, ([, d]) => ({ "animation-duration": handler.bracket.cssvar.time(d) })],
26
+ [/^animate-name-(.+)/, ([, d]) => ({ "animation-name": handler.bracket.cssvar(d) ?? d })],
27
+ [/^animate-duration-(.+)$/, ([, d]) => ({ "animation-duration": handler.bracket.cssvar.time(d) })],
26
28
  [/^animate-delay-(.+)$/, ([, d]) => ({ "animation-delay": handler.bracket.cssvar.time(d) })],
27
- [/^animate-(?:fill-)?mode-(forwards|backwards|both|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-fill-mode": d })],
28
- ["animate-mode-none", { "animation-fill-mode": "none" }],
29
- ["animate-fill-mode-none", { "animation-fill-mode": "none" }],
29
+ [/^animate-ease(?:-(.+))?$/, ([, d], { theme }) => ({ "animation-timing-function": theme.easing?.[d || "DEFAULT"] ?? handler.bracket.cssvar(d) })],
30
+ [/^animate-(?:fill-|mode-|fill-mode-)?(forwards|backwards|both|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-fill-mode": d })],
31
+ [/^animate-(?:fill-|mode-|fill-mode-)none$/, () => ({ "animation-fill-mode": "none" })],
30
32
  [/^animate-(?:direction-)?(reverse|alternate|alternate-reverse|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-direction": d })],
31
- ["animate-normal", { "animation-direction": "normal" }],
32
- ["animate-direction-normal", { "animation-direction": "normal" }],
33
- [/^animate-(?:iteration-)?count-(.+)$/, ([, d]) => ({ "animation-iteration-count": handler.bracket.cssvar(d) ?? d.replace(/\-/g, ",") })],
34
- [/^animate-name-(.+)/, ([, d]) => ({ "animation-name": d })],
35
- [/^animate-play-(?:state-)?(paused|running|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-play-state": d })],
33
+ [/^animate-(?:direction-)?normal$/, () => ({ "animation-direction": "normal" })],
34
+ [/^animate-(?:iteration-|count-|iteration-count-)(.+)$/, ([, d]) => ({ "animation-iteration-count": handler.bracket.cssvar(d) ?? d.replace(/\-/g, ",") })],
35
+ [/^animate-(?:play-|state-|play-state-)?(paused|running|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-play-state": d })],
36
36
  ["animate-none", { animation: "none" }]
37
37
  ];
38
38
 
@@ -350,17 +350,20 @@ const spaces = [
350
350
  [/^space-(block|inline)-(-?.+)$/, handlerSpace],
351
351
  [/^space-(block|inline)-reverse$/, ([, d]) => ({ [`--un-space-${d}-reverse`]: 1 })]
352
352
  ];
353
- function handlerSpace(match) {
354
- const [, direction] = match;
355
- const results = directionSize("margin")(match)?.map((item) => {
356
- const value = item[0].endsWith("right") || item[0].endsWith("bottom") ? `calc(${item[1]} * var(--un-space-${direction}-reverse))` : `calc(${item[1]} * calc(1 - var(--un-space-${direction}-reverse)))`;
357
- return [item[0], value];
358
- });
359
- if (results) {
360
- return [
361
- [`--un-space-${direction}-reverse`, 0],
362
- ...results
363
- ];
353
+ function handlerSpace([, d, s = "1"]) {
354
+ const v = handler.bracket.cssvar.auto.fraction.rem(s);
355
+ if (v != null) {
356
+ const results = directionMap[d].map((item) => {
357
+ const key = `margin${item}`;
358
+ const value = item.endsWith("right") || item.endsWith("bottom") ? `calc(${v} * var(--un-space-${d}-reverse))` : `calc(${v} * calc(1 - var(--un-space-${d}-reverse)))`;
359
+ return [key, value];
360
+ });
361
+ if (results) {
362
+ return [
363
+ [`--un-space-${d}-reverse`, 0],
364
+ ...results
365
+ ];
366
+ }
364
367
  }
365
368
  }
366
369
 
@@ -513,10 +516,10 @@ const variablesAbbrMap = {
513
516
  "write-orient": "text-orientation"
514
517
  };
515
518
  const cssVariables = [
516
- [/^(.+?)-\$(.+)$/, ([, name, varname]) => {
519
+ [/^(.+?)-(\$.+)$/, ([, name, varname]) => {
517
520
  const prop = variablesAbbrMap[name];
518
521
  if (prop)
519
- return { [prop]: `var(--${varname})` };
522
+ return { [prop]: handler.cssvar(varname) };
520
523
  }]
521
524
  ];
522
525
 
@@ -543,8 +546,12 @@ function handlerDivide([, d, s = "1"]) {
543
546
  const value = item.endsWith("right") || item.endsWith("bottom") ? `calc(${v} * var(--un-divide-${d}-reverse))` : `calc(${v} * calc(1 - var(--un-divide-${d}-reverse)))`;
544
547
  return [key, value];
545
548
  });
546
- if (results)
547
- return [[`--un-divide-${d}-reverse`, 0], ...results];
549
+ if (results) {
550
+ return [
551
+ [`--un-divide-${d}-reverse`, 0],
552
+ ...results
553
+ ];
554
+ }
548
555
  }
549
556
  }
550
557
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind",
3
- "version": "0.22.5",
3
+ "version": "0.22.6",
4
4
  "description": "Tailwind / Windi CSS compact preset for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -35,8 +35,8 @@
35
35
  "*.css"
36
36
  ],
37
37
  "dependencies": {
38
- "@unocss/core": "0.22.5",
39
- "@unocss/preset-mini": "0.22.5"
38
+ "@unocss/core": "0.22.6",
39
+ "@unocss/preset-mini": "0.22.6"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",