@unocss/preset-wind 0.22.2 → 0.22.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/dist/index.cjs CHANGED
@@ -26,17 +26,17 @@ ${constructCSS({ animation: `${name}` })}`;
26
26
  ${constructCSS(Object.assign({ animation: `${name} ${duration} ${timing} infinite` }, props))}`;
27
27
  }
28
28
  }],
29
- [/^animate-(?:duration-)?(.+)$/, ([, d]) => ({ "animation-duration": utils.handler.bracket.time(d) })],
30
- [/^animate-delay-(.+)$/, ([, d]) => ({ "animation-delay": utils.handler.bracket.time(d) })],
29
+ [/^animate-(?:duration-)?(.+)$/, ([, d]) => ({ "animation-duration": utils.handler.bracket.cssvar.time(d) })],
30
+ [/^animate-delay-(.+)$/, ([, d]) => ({ "animation-delay": utils.handler.bracket.cssvar.time(d) })],
31
31
  [/^animate-(?:fill-)?mode-(forwards|backwards|both|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-fill-mode": d })],
32
32
  ["animate-mode-none", { "animation-fill-mode": "none" }],
33
33
  ["animate-fill-mode-none", { "animation-fill-mode": "none" }],
34
34
  [/^animate-(?:direction-)?(reverse|alternate|alternate-reverse|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-direction": d })],
35
35
  ["animate-normal", { "animation-direction": "normal" }],
36
36
  ["animate-direction-normal", { "animation-direction": "normal" }],
37
- [/^animate-(?:iteration-)?count-(.+)$/, ([, d]) => ({ "animation-iteration-count": utils.handler.bracket(d) ?? d.replace(/\-/g, ",") })],
37
+ [/^animate-(?:iteration-)?count-(.+)$/, ([, d]) => ({ "animation-iteration-count": utils.handler.bracket.cssvar(d) ?? d.replace(/\-/g, ",") })],
38
38
  [/^animate-name-(.+)/, ([, d]) => ({ "animation-name": d })],
39
- [/^animate-play(?:-state)?-(paused|running|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-play-state": d })],
39
+ [/^animate-play-(?:state-)?(paused|running|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-play-state": d })],
40
40
  ["animate-none", { animation: "none" }]
41
41
  ];
42
42
 
@@ -259,7 +259,7 @@ const backdropFilterBase = {
259
259
  [core.CONTROL_SHORTCUT_NO_MERGE]: ""
260
260
  };
261
261
  const percentWithDefault = (str) => {
262
- let v = utils.handler.bracket(str || "");
262
+ let v = utils.handler.bracket.cssvar(str || "");
263
263
  if (v != null)
264
264
  return v;
265
265
  v = str ? utils.handler.percent(str) : "1";
@@ -301,7 +301,7 @@ const dropShadowResolver = ([, s], { theme }) => {
301
301
  }
302
302
  ];
303
303
  }
304
- v = utils.handler.bracket(s);
304
+ v = utils.handler.bracket.cssvar(s);
305
305
  if (v != null) {
306
306
  return [
307
307
  filterBase,
@@ -313,17 +313,17 @@ const dropShadowResolver = ([, s], { theme }) => {
313
313
  }
314
314
  };
315
315
  const filters = [
316
- [/^(?:(backdrop-)|filter-)?blur(?:-(.+))?$/, toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || utils.handler.bracket.px(s))],
317
- [/^(?:(backdrop-)|filter-)?brightness-(.+)$/, toFilter("brightness", (s) => utils.handler.bracket.percent(s))],
318
- [/^(?:(backdrop-)|filter-)?contrast-(.+)$/, toFilter("contrast", (s) => utils.handler.bracket.percent(s))],
316
+ [/^(?:(backdrop-)|filter-)?blur(?:-(.+))?$/, toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || utils.handler.bracket.cssvar.px(s))],
317
+ [/^(?:(backdrop-)|filter-)?brightness-(.+)$/, toFilter("brightness", (s) => utils.handler.bracket.cssvar.percent(s))],
318
+ [/^(?:(backdrop-)|filter-)?contrast-(.+)$/, toFilter("contrast", (s) => utils.handler.bracket.cssvar.percent(s))],
319
319
  [/^(?:filter-)?drop-shadow(?:-(.+))?$/, dropShadowResolver],
320
320
  [/^(?:filter-)?drop-shadow-color-(.+)$/, utils.colorResolver("--un-drop-shadow-color", "drop-shadow")],
321
- [/^(?:filter-)?drop-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-drop-shadow-opacity": utils.handler.bracket.percent.cssvar(opacity) })],
321
+ [/^(?:filter-)?drop-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-drop-shadow-opacity": utils.handler.bracket.percent(opacity) })],
322
322
  [/^(?:(backdrop-)|filter-)?grayscale(?:-(.+))?$/, toFilter("grayscale", percentWithDefault)],
323
- [/^(?:(backdrop-)|filter-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s) => utils.handler.bracket.degree(s))],
323
+ [/^(?:(backdrop-)|filter-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s) => utils.handler.bracket.cssvar.degree(s))],
324
324
  [/^(?:(backdrop-)|filter-)?invert(?:-(.+))?$/, toFilter("invert", percentWithDefault)],
325
- [/^(backdrop-)opacity-(.+)$/, toFilter("opacity", (s) => utils.handler.bracket.percent(s))],
326
- [/^(?:(backdrop-)|filter-)?saturate-(.+)$/, toFilter("saturate", (s) => utils.handler.bracket.percent(s))],
325
+ [/^(backdrop-)opacity-(.+)$/, toFilter("opacity", (s) => utils.handler.bracket.cssvar.percent(s))],
326
+ [/^(?:(backdrop-)|filter-)?saturate-(.+)$/, toFilter("saturate", (s) => utils.handler.bracket.cssvar.percent(s))],
327
327
  [/^(?:(backdrop-)|filter-)?sepia(?:-(.+))?$/, toFilter("sepia", percentWithDefault)],
328
328
  [/^filter$/, () => [
329
329
  filterBase,
@@ -502,26 +502,27 @@ const tables = [
502
502
  ];
503
503
 
504
504
  const variablesAbbrMap = {
505
- "write": "writing-mode",
506
- "write-orient": "text-orientation",
507
505
  "bg-blend": "background-blend-mode",
508
506
  "bg-clip": "-webkit-background-clip",
509
507
  "bg-gradient": "linear-gradient",
510
- "bg-origin-border": "background-origin",
508
+ "bg-image": "background-image",
509
+ "bg-origin": "background-origin",
511
510
  "bg-position": "background-position",
512
511
  "bg-repeat": "background-repeat",
513
512
  "bg-size": "background-size",
514
513
  "mix-blend": "mix-blend-mode",
515
- "animate-speed": "animation-speed"
514
+ "object": "object-fit",
515
+ "object-position": "object-position",
516
+ "write": "writing-mode",
517
+ "write-orient": "text-orientation"
516
518
  };
517
- const cssVariables = [[
518
- /^(.+)-\$(.+)$/,
519
- ([, name, varname]) => {
520
- const prop = variablesAbbrMap[name];
519
+ const cssVariables = [
520
+ [/^([^$]+)(?<=-)\$(.+)$/, ([, name, varname]) => {
521
+ const prop = variablesAbbrMap[name.slice(0, -1)];
521
522
  if (prop)
522
523
  return { [prop]: `var(--${varname})` };
523
- }
524
- ]];
524
+ }]
525
+ ];
525
526
 
526
527
  const divides = [
527
528
  [/^divide-?([xy])$/, handlerDivide],
@@ -539,7 +540,7 @@ const divides = [
539
540
  ["divide-none", { "border-style": "none" }]
540
541
  ];
541
542
  function handlerDivide([, d, s = "1"]) {
542
- const v = utils.handler.bracket.px(s);
543
+ const v = utils.handler.bracket.cssvar.px(s);
543
544
  if (v != null) {
544
545
  const results = utils.directionMap[d].map((item) => {
545
546
  const key = `border${item}-width`;
@@ -660,7 +661,7 @@ const scrolls = [
660
661
 
661
662
  const placeholders = [
662
663
  [/^\$ placeholder-(.+)$/, utils.colorResolver("color", "placeholder")],
663
- [/^\$ placeholder-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-placeholder-opacity": utils.handler.bracket.percent.cssvar(opacity) })]
664
+ [/^\$ placeholder-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-placeholder-opacity": utils.handler.bracket.percent(opacity) })]
664
665
  ];
665
666
 
666
667
  const rules = [
@@ -920,7 +921,7 @@ const variantSpaceAndDivide = (matcher) => {
920
921
  };
921
922
 
922
923
  const placeholderModifier = (input, { theme }) => {
923
- const m = input.match(/^(.*)\b(placeholder-)(.+?)$/);
924
+ const m = input.match(/^(.*)\b(placeholder-)(.+)$/);
924
925
  if (m) {
925
926
  const [, pre = "", p, body] = m;
926
927
  if (hasColorValue(body, theme) || hasOpacityValue(body)) {
@@ -936,7 +937,7 @@ function hasColorValue(body, theme) {
936
937
  function hasOpacityValue(body) {
937
938
  const match = body.match(/^op(?:acity)?-?(.+)$/);
938
939
  if (match && match[1] != null)
939
- return utils.handler.bracket.percent.cssvar(match[1]) != null;
940
+ return utils.handler.bracket.percent(match[1]) != null;
940
941
  return false;
941
942
  }
942
943
 
package/dist/index.mjs CHANGED
@@ -22,17 +22,17 @@ ${constructCSS({ animation: `${name}` })}`;
22
22
  ${constructCSS(Object.assign({ animation: `${name} ${duration} ${timing} infinite` }, props))}`;
23
23
  }
24
24
  }],
25
- [/^animate-(?:duration-)?(.+)$/, ([, d]) => ({ "animation-duration": handler.bracket.time(d) })],
26
- [/^animate-delay-(.+)$/, ([, d]) => ({ "animation-delay": handler.bracket.time(d) })],
25
+ [/^animate-(?:duration-)?(.+)$/, ([, d]) => ({ "animation-duration": handler.bracket.cssvar.time(d) })],
26
+ [/^animate-delay-(.+)$/, ([, d]) => ({ "animation-delay": handler.bracket.cssvar.time(d) })],
27
27
  [/^animate-(?:fill-)?mode-(forwards|backwards|both|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-fill-mode": d })],
28
28
  ["animate-mode-none", { "animation-fill-mode": "none" }],
29
29
  ["animate-fill-mode-none", { "animation-fill-mode": "none" }],
30
30
  [/^animate-(?:direction-)?(reverse|alternate|alternate-reverse|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-direction": d })],
31
31
  ["animate-normal", { "animation-direction": "normal" }],
32
32
  ["animate-direction-normal", { "animation-direction": "normal" }],
33
- [/^animate-(?:iteration-)?count-(.+)$/, ([, d]) => ({ "animation-iteration-count": handler.bracket(d) ?? d.replace(/\-/g, ",") })],
33
+ [/^animate-(?:iteration-)?count-(.+)$/, ([, d]) => ({ "animation-iteration-count": handler.bracket.cssvar(d) ?? d.replace(/\-/g, ",") })],
34
34
  [/^animate-name-(.+)/, ([, d]) => ({ "animation-name": d })],
35
- [/^animate-play(?:-state)?-(paused|running|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-play-state": d })],
35
+ [/^animate-play-(?:state-)?(paused|running|inherit|initial|revert|unset)$/, ([, d]) => ({ "animation-play-state": d })],
36
36
  ["animate-none", { animation: "none" }]
37
37
  ];
38
38
 
@@ -255,7 +255,7 @@ const backdropFilterBase = {
255
255
  [CONTROL_SHORTCUT_NO_MERGE]: ""
256
256
  };
257
257
  const percentWithDefault = (str) => {
258
- let v = handler.bracket(str || "");
258
+ let v = handler.bracket.cssvar(str || "");
259
259
  if (v != null)
260
260
  return v;
261
261
  v = str ? handler.percent(str) : "1";
@@ -297,7 +297,7 @@ const dropShadowResolver = ([, s], { theme }) => {
297
297
  }
298
298
  ];
299
299
  }
300
- v = handler.bracket(s);
300
+ v = handler.bracket.cssvar(s);
301
301
  if (v != null) {
302
302
  return [
303
303
  filterBase,
@@ -309,17 +309,17 @@ const dropShadowResolver = ([, s], { theme }) => {
309
309
  }
310
310
  };
311
311
  const filters = [
312
- [/^(?:(backdrop-)|filter-)?blur(?:-(.+))?$/, toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || handler.bracket.px(s))],
313
- [/^(?:(backdrop-)|filter-)?brightness-(.+)$/, toFilter("brightness", (s) => handler.bracket.percent(s))],
314
- [/^(?:(backdrop-)|filter-)?contrast-(.+)$/, toFilter("contrast", (s) => handler.bracket.percent(s))],
312
+ [/^(?:(backdrop-)|filter-)?blur(?:-(.+))?$/, toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || handler.bracket.cssvar.px(s))],
313
+ [/^(?:(backdrop-)|filter-)?brightness-(.+)$/, toFilter("brightness", (s) => handler.bracket.cssvar.percent(s))],
314
+ [/^(?:(backdrop-)|filter-)?contrast-(.+)$/, toFilter("contrast", (s) => handler.bracket.cssvar.percent(s))],
315
315
  [/^(?:filter-)?drop-shadow(?:-(.+))?$/, dropShadowResolver],
316
316
  [/^(?:filter-)?drop-shadow-color-(.+)$/, colorResolver("--un-drop-shadow-color", "drop-shadow")],
317
- [/^(?:filter-)?drop-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-drop-shadow-opacity": handler.bracket.percent.cssvar(opacity) })],
317
+ [/^(?:filter-)?drop-shadow-color-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-drop-shadow-opacity": handler.bracket.percent(opacity) })],
318
318
  [/^(?:(backdrop-)|filter-)?grayscale(?:-(.+))?$/, toFilter("grayscale", percentWithDefault)],
319
- [/^(?:(backdrop-)|filter-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s) => handler.bracket.degree(s))],
319
+ [/^(?:(backdrop-)|filter-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s) => handler.bracket.cssvar.degree(s))],
320
320
  [/^(?:(backdrop-)|filter-)?invert(?:-(.+))?$/, toFilter("invert", percentWithDefault)],
321
- [/^(backdrop-)opacity-(.+)$/, toFilter("opacity", (s) => handler.bracket.percent(s))],
322
- [/^(?:(backdrop-)|filter-)?saturate-(.+)$/, toFilter("saturate", (s) => handler.bracket.percent(s))],
321
+ [/^(backdrop-)opacity-(.+)$/, toFilter("opacity", (s) => handler.bracket.cssvar.percent(s))],
322
+ [/^(?:(backdrop-)|filter-)?saturate-(.+)$/, toFilter("saturate", (s) => handler.bracket.cssvar.percent(s))],
323
323
  [/^(?:(backdrop-)|filter-)?sepia(?:-(.+))?$/, toFilter("sepia", percentWithDefault)],
324
324
  [/^filter$/, () => [
325
325
  filterBase,
@@ -498,26 +498,27 @@ const tables = [
498
498
  ];
499
499
 
500
500
  const variablesAbbrMap = {
501
- "write": "writing-mode",
502
- "write-orient": "text-orientation",
503
501
  "bg-blend": "background-blend-mode",
504
502
  "bg-clip": "-webkit-background-clip",
505
503
  "bg-gradient": "linear-gradient",
506
- "bg-origin-border": "background-origin",
504
+ "bg-image": "background-image",
505
+ "bg-origin": "background-origin",
507
506
  "bg-position": "background-position",
508
507
  "bg-repeat": "background-repeat",
509
508
  "bg-size": "background-size",
510
509
  "mix-blend": "mix-blend-mode",
511
- "animate-speed": "animation-speed"
510
+ "object": "object-fit",
511
+ "object-position": "object-position",
512
+ "write": "writing-mode",
513
+ "write-orient": "text-orientation"
512
514
  };
513
- const cssVariables = [[
514
- /^(.+)-\$(.+)$/,
515
- ([, name, varname]) => {
516
- const prop = variablesAbbrMap[name];
515
+ const cssVariables = [
516
+ [/^([^$]+)(?<=-)\$(.+)$/, ([, name, varname]) => {
517
+ const prop = variablesAbbrMap[name.slice(0, -1)];
517
518
  if (prop)
518
519
  return { [prop]: `var(--${varname})` };
519
- }
520
- ]];
520
+ }]
521
+ ];
521
522
 
522
523
  const divides = [
523
524
  [/^divide-?([xy])$/, handlerDivide],
@@ -535,7 +536,7 @@ const divides = [
535
536
  ["divide-none", { "border-style": "none" }]
536
537
  ];
537
538
  function handlerDivide([, d, s = "1"]) {
538
- const v = handler.bracket.px(s);
539
+ const v = handler.bracket.cssvar.px(s);
539
540
  if (v != null) {
540
541
  const results = directionMap[d].map((item) => {
541
542
  const key = `border${item}-width`;
@@ -656,7 +657,7 @@ const scrolls = [
656
657
 
657
658
  const placeholders = [
658
659
  [/^\$ placeholder-(.+)$/, colorResolver("color", "placeholder")],
659
- [/^\$ placeholder-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-placeholder-opacity": handler.bracket.percent.cssvar(opacity) })]
660
+ [/^\$ placeholder-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-placeholder-opacity": handler.bracket.percent(opacity) })]
660
661
  ];
661
662
 
662
663
  const rules = [
@@ -916,7 +917,7 @@ const variantSpaceAndDivide = (matcher) => {
916
917
  };
917
918
 
918
919
  const placeholderModifier = (input, { theme }) => {
919
- const m = input.match(/^(.*)\b(placeholder-)(.+?)$/);
920
+ const m = input.match(/^(.*)\b(placeholder-)(.+)$/);
920
921
  if (m) {
921
922
  const [, pre = "", p, body] = m;
922
923
  if (hasColorValue(body, theme) || hasOpacityValue(body)) {
@@ -932,7 +933,7 @@ function hasColorValue(body, theme) {
932
933
  function hasOpacityValue(body) {
933
934
  const match = body.match(/^op(?:acity)?-?(.+)$/);
934
935
  if (match && match[1] != null)
935
- return handler.bracket.percent.cssvar(match[1]) != null;
936
+ return handler.bracket.percent(match[1]) != null;
936
937
  return false;
937
938
  }
938
939
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind",
3
- "version": "0.22.2",
3
+ "version": "0.22.3",
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.2",
39
- "@unocss/preset-mini": "0.22.2"
38
+ "@unocss/core": "0.22.3",
39
+ "@unocss/preset-mini": "0.22.3"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",