@unocss/preset-wind4 66.6.2 → 66.6.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.mjs CHANGED
@@ -3,7 +3,7 @@ import { H as PRESET_NAME, I as globalKeywords, a as themeTracking, f as compres
3
3
  import { rules } from "./rules.mjs";
4
4
  import { shortcuts } from "./shortcuts.mjs";
5
5
  import { theme } from "./theme.mjs";
6
- import { t as variants } from "./variants-BqQ8LqhD.mjs";
6
+ import { t as variants } from "./variants-gZZHooat.mjs";
7
7
  import { definePreset, escapeSelector, toArray, uniq } from "@unocss/core";
8
8
  import { extractorArbitraryVariants } from "@unocss/extractor-arbitrary-variants";
9
9
  import { alphaPlaceholdersRE } from "@unocss/rule-utils";
package/dist/rules.mjs CHANGED
@@ -841,7 +841,7 @@ function* handlerSpace([m, d, s], { theme, symbols: symbols$1 }) {
841
841
  } else v = theme.spacing?.[s] ?? h.bracket.cssvar.auto.fraction.rem(s || "1");
842
842
  if (v != null) {
843
843
  const results = directionMap[d === "x" ? "inline" : "block"].map((item, index) => {
844
- return [`margin${item}`, ` calc(${v} * ${index === 0 ? `var(--un-space-${d}-reverse)` : `calc(1 - var(--un-space-${d}-reverse))`})`];
844
+ return [`margin${item}`, `calc(${v} * ${index === 0 ? `var(--un-space-${d}-reverse)` : `calc(1 - var(--un-space-${d}-reverse))`})`];
845
845
  });
846
846
  if (results) {
847
847
  yield {
@@ -488,12 +488,24 @@ const variantImplicitGroup = {
488
488
  //#region src/variants/negative.ts
489
489
  const anchoredNumberRE = /^-?[0-9.]+(?:[a-z]+|%)?$/;
490
490
  const numberRE = /-?[0-9.]+(?:[a-z]+|%)?/;
491
+ const spacingMultiplyRE = /var\(--spacing(?:-[\w-]+)?\)\s*\*\s*(-?[0-9.]+(?:[a-z]+|%)?)/;
491
492
  const ignoreProps = [/\b(opacity|color|flex|backdrop-filter|^filter|^scale|transform|mask-image)\b/];
492
493
  function negateMathFunction(value) {
493
494
  const match = value.match(cssMathFnRE) || value.match(cssVarFnRE);
494
495
  if (match) {
495
496
  const [fnBody, rest] = getStringComponent(`(${match[2]})${match[3]}`, "(", ")", " ") ?? [];
496
- if (fnBody) return `calc(${match[1]}${fnBody} * -1)${rest ? ` ${rest}` : ""}`;
497
+ if (fnBody) {
498
+ const spacingMultiplyMatch = fnBody.match(spacingMultiplyRE);
499
+ if (spacingMultiplyMatch) {
500
+ const num = spacingMultiplyMatch[1];
501
+ const nextNum = num.startsWith("-") ? num.slice(1) : `-${num}`;
502
+ const nextFnBody = fnBody.replace(spacingMultiplyRE, (segment) => {
503
+ return segment.replace(num, nextNum);
504
+ });
505
+ return `${match[1]}${nextFnBody}${rest ? ` ${rest}` : ""}`;
506
+ }
507
+ return `calc(${match[1]}${fnBody} * -1)${rest ? ` ${rest}` : ""}`;
508
+ }
497
509
  }
498
510
  }
499
511
  const negateFunctionBodyRE = /\b(hue-rotate)\s*(\(.*)/;
@@ -516,28 +528,17 @@ const variantNegative = {
516
528
  body: (body) => {
517
529
  if (body.find((v) => v[0] === CONTROL_NO_NEGATIVE)) return;
518
530
  let changed = false;
519
- body.forEach((v) => {
520
- if (toArray(v[2]).includes(CONTROL_NO_NEGATIVE)) return;
521
- const value = v[1]?.toString();
522
- if (!value || value === "0") return;
523
- if (ignoreProps.some((i) => i.test(v[0]))) return;
524
- const negatedFn = negateMathFunction(value);
525
- if (negatedFn) {
526
- v[1] = negatedFn;
527
- changed = true;
528
- return;
529
- }
530
- const negatedBody = negateFunctionBody(value);
531
- if (negatedBody) {
532
- v[1] = negatedBody;
533
- changed = true;
534
- return;
535
- }
536
- if (anchoredNumberRE.test(value)) {
537
- v[1] = value.replace(numberRE, (i) => i.startsWith("-") ? i.slice(1) : `-${i}`);
538
- changed = true;
539
- }
540
- });
531
+ for (const v of body) {
532
+ const [prop, rawValue, meta] = v;
533
+ if (typeof rawValue === "object") continue;
534
+ if (meta && toArray(meta).includes(CONTROL_NO_NEGATIVE)) continue;
535
+ const value = rawValue?.toString();
536
+ if (!value || value === "0" || ignoreProps.some((i) => i.test(prop))) continue;
537
+ const nextValue = negateMathFunction(value) ?? negateFunctionBody(value) ?? (anchoredNumberRE.test(value) ? value.replace(numberRE, (i) => i.startsWith("-") ? i.slice(1) : `-${i}`) : void 0);
538
+ if (!nextValue || nextValue === value) continue;
539
+ v[1] = nextValue;
540
+ changed = true;
541
+ }
541
542
  if (changed) return body;
542
543
  return [];
543
544
  }
package/dist/variants.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { A as variantColorsMediaOrClass, C as variantOrientations, D as variantLanguageDirections, E as variantImportant, F as variantChildren, I as variantBreakpoints, L as variantAria, M as variantContainerQuery, N as variantCombinators, O as variantDataAttribute, P as variantSvgCombinators, R as variantTaggedAriaAttributes, S as variantNoscript, T as variantScripting, _ as variantVariables, a as variantPseudoClassFunctions, b as variantForcedColors, c as placeholderModifier, d as variantImplicitGroup, f as variantInternalLayer, g as variantTheme, h as variantStickyHover, i as variantPartClasses, j as variantColorsScheme, k as variantTaggedDataAttributes, l as variantNegative, m as variantSelector, n as variantSupports, o as variantPseudoClassesAndElements, p as variantScope, r as variantStartingStyle, s as variantTaggedPseudoClasses, t as variants, u as variantCssLayer, v as variantContrasts, w as variantPrint, x as variantMotions, y as variantCustomMedia } from "./variants-BqQ8LqhD.mjs";
1
+ import { A as variantColorsMediaOrClass, C as variantOrientations, D as variantLanguageDirections, E as variantImportant, F as variantChildren, I as variantBreakpoints, L as variantAria, M as variantContainerQuery, N as variantCombinators, O as variantDataAttribute, P as variantSvgCombinators, R as variantTaggedAriaAttributes, S as variantNoscript, T as variantScripting, _ as variantVariables, a as variantPseudoClassFunctions, b as variantForcedColors, c as placeholderModifier, d as variantImplicitGroup, f as variantInternalLayer, g as variantTheme, h as variantStickyHover, i as variantPartClasses, j as variantColorsScheme, k as variantTaggedDataAttributes, l as variantNegative, m as variantSelector, n as variantSupports, o as variantPseudoClassesAndElements, p as variantScope, r as variantStartingStyle, s as variantTaggedPseudoClasses, t as variants, u as variantCssLayer, v as variantContrasts, w as variantPrint, x as variantMotions, y as variantCustomMedia } from "./variants-gZZHooat.mjs";
2
2
 
3
3
  export { placeholderModifier, variantAria, variantBreakpoints, variantChildren, variantColorsMediaOrClass, variantColorsScheme, variantCombinators, variantContainerQuery, variantContrasts, variantCssLayer, variantCustomMedia, variantDataAttribute, variantForcedColors, variantImplicitGroup, variantImportant, variantInternalLayer, variantLanguageDirections, variantMotions, variantNegative, variantNoscript, variantOrientations, variantPartClasses, variantPrint, variantPseudoClassFunctions, variantPseudoClassesAndElements, variantScope, variantScripting, variantSelector, variantStartingStyle, variantStickyHover, variantSupports, variantSvgCombinators, variantTaggedAriaAttributes, variantTaggedDataAttributes, variantTaggedPseudoClasses, variantTheme, variantVariables, variants };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind4",
3
3
  "type": "module",
4
- "version": "66.6.2",
4
+ "version": "66.6.3",
5
5
  "description": "Tailwind 4 compact preset for UnoCSS",
6
6
  "authors": [
7
7
  {
@@ -54,9 +54,9 @@
54
54
  "dist"
55
55
  ],
56
56
  "dependencies": {
57
- "@unocss/core": "66.6.2",
58
- "@unocss/extractor-arbitrary-variants": "66.6.2",
59
- "@unocss/rule-utils": "66.6.2"
57
+ "@unocss/core": "66.6.3",
58
+ "@unocss/rule-utils": "66.6.3",
59
+ "@unocss/extractor-arbitrary-variants": "66.6.3"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsdown --config-loader unrun",