@unocss/preset-wind4 66.1.0-beta.7 → 66.1.0-beta.8

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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { Postprocessor, Preflight, Variant, PresetOptions, PreflightContext } from '@unocss/core';
2
+ import { Postprocessor, Preflight, Variant, PresetOptions, Arrayable, CSSEntry, BaseContext } from '@unocss/core';
3
3
  import { T as Theme } from './shared/preset-wind4.BXbWGSRz.mjs';
4
4
  export { r as rules } from './shared/preset-wind4.D71xGC6i.mjs';
5
5
  export { shortcuts } from './shortcuts.mjs';
@@ -92,13 +92,14 @@ interface PresetWind4Options extends PresetOptions {
92
92
  */
93
93
  themePreflight?: boolean | 'on-demand';
94
94
  /**
95
- * Process theme variables before generating CSS variables.
95
+ * Resolve the layer utilits with custom logic.
96
96
  *
97
- * @param vars [key, value][]
98
- * @param ctx {@link PreflightContext}
97
+ * @param utility [key, value] {@link CSSEntry}
98
+ * @param layer Layer name
99
+ * @param ctx base generator context {@link BaseContext<Theme>}
99
100
  * @returns
100
101
  */
101
- processThemeVars?: (vars: [string, string][], ctx: PreflightContext) => void | [string, string][];
102
+ utilityResolver?: Arrayable<(utility: CSSEntry, layer: string, ctx: BaseContext<Theme>) => void>;
102
103
  }
103
104
  declare const presetWind4: _unocss_core.PresetFactory<Theme, PresetWind4Options>;
104
105
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { Postprocessor, Preflight, Variant, PresetOptions, PreflightContext } from '@unocss/core';
2
+ import { Postprocessor, Preflight, Variant, PresetOptions, Arrayable, CSSEntry, BaseContext } from '@unocss/core';
3
3
  import { T as Theme } from './shared/preset-wind4.BXbWGSRz.js';
4
4
  export { r as rules } from './shared/preset-wind4.Ca5oWgxX.js';
5
5
  export { shortcuts } from './shortcuts.js';
@@ -92,13 +92,14 @@ interface PresetWind4Options extends PresetOptions {
92
92
  */
93
93
  themePreflight?: boolean | 'on-demand';
94
94
  /**
95
- * Process theme variables before generating CSS variables.
95
+ * Resolve the layer utilits with custom logic.
96
96
  *
97
- * @param vars [key, value][]
98
- * @param ctx {@link PreflightContext}
97
+ * @param utility [key, value] {@link CSSEntry}
98
+ * @param layer Layer name
99
+ * @param ctx base generator context {@link BaseContext<Theme>}
99
100
  * @returns
100
101
  */
101
- processThemeVars?: (vars: [string, string][], ctx: PreflightContext) => void | [string, string][];
102
+ utilityResolver?: Arrayable<(utility: CSSEntry, layer: string, ctx: BaseContext<Theme>) => void>;
102
103
  }
103
104
  declare const presetWind4: _unocss_core.PresetFactory<Theme, PresetWind4Options>;
104
105
 
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- import { LAYER_PREFLIGHTS, definePreset } from '@unocss/core';
1
+ import { LAYER_PREFLIGHTS, toArray, definePreset } from '@unocss/core';
2
2
  import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants';
3
- import { a as themeTracking, J as compressCSS, P as PRESET_NAME, w as getThemeByKey, I as hyphenate, p as passThemeKey, g as globalKeywords, t as trackedTheme } from './shared/preset-wind4.CkxnR6p3.mjs';
3
+ import { b as themeTracking, K as compressCSS, P as PRESET_NAME, z as getThemeByKey, J as hyphenate, p as passThemeKey, j as globalKeywords, t as trackedTheme } from './shared/preset-wind4.B0q3EwQ3.mjs';
4
4
  import { alphaPlaceholdersRE } from '@unocss/rule-utils';
5
- import { postprocessors } from './postprocess.mjs';
6
- import { l as variants } from './shared/preset-wind4.DXr6hHdY.mjs';
5
+ import { p as postprocessors } from './shared/preset-wind4.Pg33yPuf.mjs';
6
+ import { l as variants } from './shared/preset-wind4.-dZRTBz8.mjs';
7
7
  import { theme as theme$1 } from './theme.mjs';
8
- import { s as shortcuts } from './shared/preset-wind4.BwU-POWl.mjs';
9
- import { r as rules } from './shared/preset-wind4.CJ98Gjkm.mjs';
8
+ import { s as shortcuts } from './shared/preset-wind4.DolXDUDJ.mjs';
9
+ import { r as rules } from './shared/preset-wind4.BfiLVsoA.mjs';
10
10
  import './colors.mjs';
11
- import './shared/preset-wind4.DhDf1e1c.mjs';
11
+ import './shared/preset-wind4.C100zP13.mjs';
12
12
 
13
13
  const resetCSS = `
14
14
  /*
@@ -465,12 +465,19 @@ function theme(options) {
465
465
  }
466
466
  let deps;
467
467
  const generateCSS = (deps2) => {
468
- if (options.processThemeVars) {
469
- deps2 = options.processThemeVars(deps2, ctx) ?? deps2;
468
+ if (options.utilityResolver) {
469
+ const resolver = toArray(options.utilityResolver);
470
+ for (const utility of deps2) {
471
+ for (const r of resolver) {
472
+ r(utility, "theme", ctx);
473
+ }
474
+ }
470
475
  }
471
- if (deps2.length === 0)
476
+ const resovledDeps = deps2.map(([key, value]) => key && value ? `${key}: ${value};` : void 0).filter(Boolean);
477
+ if (resovledDeps.length === 0) {
472
478
  return void 0;
473
- const depCSS = deps2.map(([key, value]) => `${key}: ${value};`).join("\n");
479
+ }
480
+ const depCSS = resovledDeps.join("\n");
474
481
  return compressCSS(`
475
482
  :root, :host {
476
483
  ${depCSS}
@@ -6,8 +6,10 @@ import './shared/preset-wind4.D71xGC6i.mjs';
6
6
  import './shortcuts.mjs';
7
7
  import './shared/preset-wind4.BOe5kxIw.mjs';
8
8
 
9
- declare function important(option: PresetWind4Options['important']): Postprocessor[];
9
+ declare function important({ important: option }: PresetWind4Options): Postprocessor[];
10
10
 
11
- declare function varPrefix(prefix: PresetWind4Options['variablePrefix']): Postprocessor[];
11
+ declare function utility({ utilityResolver }: PresetWind4Options): Postprocessor[];
12
12
 
13
- export { important, varPrefix };
13
+ declare function varPrefix({ variablePrefix: prefix }: PresetWind4Options): Postprocessor[];
14
+
15
+ export { important, utility, varPrefix };
@@ -6,8 +6,10 @@ import './shared/preset-wind4.Ca5oWgxX.js';
6
6
  import './shortcuts.js';
7
7
  import './shared/preset-wind4.BOe5kxIw.js';
8
8
 
9
- declare function important(option: PresetWind4Options['important']): Postprocessor[];
9
+ declare function important({ important: option }: PresetWind4Options): Postprocessor[];
10
10
 
11
- declare function varPrefix(prefix: PresetWind4Options['variablePrefix']): Postprocessor[];
11
+ declare function utility({ utilityResolver }: PresetWind4Options): Postprocessor[];
12
12
 
13
- export { important, varPrefix };
13
+ declare function varPrefix({ variablePrefix: prefix }: PresetWind4Options): Postprocessor[];
14
+
15
+ export { important, utility, varPrefix };
@@ -1,42 +1,2 @@
1
- function important(option) {
2
- if (option == null || option === false)
3
- return [];
4
- const wrapWithIs = (selector) => {
5
- if (selector.startsWith(":is(") && selector.endsWith(")"))
6
- return selector;
7
- if (selector.includes("::"))
8
- return selector.replace(/(.*?)((?:\s\*)?::.*)/, ":is($1)$2");
9
- return `:is(${selector})`;
10
- };
11
- return [
12
- option === true ? (util) => {
13
- util.entries.forEach((i) => {
14
- if (i[1] != null && !String(i[1]).endsWith("!important"))
15
- i[1] += " !important";
16
- });
17
- } : (util) => {
18
- if (!util.selector.startsWith(option))
19
- util.selector = `${option} ${wrapWithIs(util.selector)}`;
20
- }
21
- ];
22
- }
23
-
24
- function varPrefix(prefix) {
25
- const processor = (obj) => {
26
- obj.entries.forEach((i) => {
27
- i[0] = i[0].replace(/^--un-/, `--${prefix}`);
28
- if (typeof i[1] === "string")
29
- i[1] = i[1].replace(/var\(--un-/g, `var(--${prefix}`);
30
- });
31
- };
32
- return prefix !== "un-" ? [processor] : [];
33
- }
34
-
35
- function postprocessors(options) {
36
- return [
37
- ...important(options.important),
38
- ...varPrefix(options.variablePrefix)
39
- ];
40
- }
41
-
42
- export { important, postprocessors, varPrefix };
1
+ export { i as important, p as postprocessors, u as utility, v as varPrefix } from './shared/preset-wind4.Pg33yPuf.mjs';
2
+ import '@unocss/core';
package/dist/rules.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { d as accents, am as accessibility, H as alignments, a as animations, c as appearance, _ as appearances, U as aspectRatio, aj as backgroundBlendModes, b as backgroundStyles, m as bgColors, g as borderStyles, h as borders, S as boxShadows, N as boxSizing, a7 as breaks, e as carets, n as colorScheme, p as columns, a0 as contains, a5 as contentVisibility, a6 as contents, aB as cssProperty, aA as cssVariables, $ as cursors, Z as displays, u as divides, al as dynamicViewportHeight, x as filters, y as flex, J as flexGridJustifiesAlignments, L as floats, ac as fontSmoothings, ab as fontStyles, ay as fontVariantNumeric, at as fonts, z as gaps, A as grids, j as handlerBorderStyle, ad as hyphens, i as imageRenderings, K as insets, ah as isolations, F as justifies, C as lineClamps, l as listStyle, W as margins, ak as mixBlendModes, Y as notLastChildSelector, ai as objectPositions, k as opacity, G as orders, o as outline, B as overflows, f as overscrolls, V as paddings, D as placeholders, I as placements, a1 as pointerEvents, E as positions, O as questionMark, a2 as resizes, P as rings, r as rules, ag as screenReadersAccess, s as scrollBehaviors, Q as scrolls, R as shadowProperties, T as sizes, X as spaces, az as splitShorthand, an as svgUtilities, au as tabSizes, ao as tables, t as textAligns, q as textDecorations, av as textIndents, a9 as textOverflows, ax as textShadows, aw as textStrokes, aa as textTransforms, a8 as textWraps, ap as touchActions, aq as transformBase, ar as transforms, as as transitions, a3 as userSelects, v as verticalAligns, aC as viewTransition, a4 as whitespaces, w as willChange, ae as writingModes, af as writingOrientations, M as zIndexes } from './shared/preset-wind4.CJ98Gjkm.mjs';
2
- export { a as container, c as containerParent, b as containerShortcuts } from './shared/preset-wind4.DhDf1e1c.mjs';
3
- import './shared/preset-wind4.CkxnR6p3.mjs';
1
+ export { d as accents, am as accessibility, H as alignments, a as animations, c as appearance, _ as appearances, U as aspectRatio, aj as backgroundBlendModes, b as backgroundStyles, m as bgColors, g as borderStyles, h as borders, S as boxShadows, N as boxSizing, a7 as breaks, e as carets, n as colorScheme, p as columns, a0 as contains, a5 as contentVisibility, a6 as contents, aB as cssProperty, aA as cssVariables, $ as cursors, Z as displays, u as divides, al as dynamicViewportHeight, x as filters, y as flex, J as flexGridJustifiesAlignments, L as floats, ac as fontSmoothings, ab as fontStyles, ay as fontVariantNumeric, at as fonts, z as gaps, A as grids, j as handlerBorderStyle, ad as hyphens, i as imageRenderings, K as insets, ah as isolations, F as justifies, C as lineClamps, l as listStyle, W as margins, ak as mixBlendModes, Y as notLastChildSelector, ai as objectPositions, k as opacity, G as orders, o as outline, B as overflows, f as overscrolls, V as paddings, D as placeholders, I as placements, a1 as pointerEvents, E as positions, O as questionMark, a2 as resizes, P as rings, r as rules, ag as screenReadersAccess, s as scrollBehaviors, Q as scrolls, R as shadowProperties, T as sizes, X as spaces, az as splitShorthand, an as svgUtilities, au as tabSizes, ao as tables, t as textAligns, q as textDecorations, av as textIndents, a9 as textOverflows, ax as textShadows, aw as textStrokes, aa as textTransforms, a8 as textWraps, ap as touchActions, aq as transformBase, ar as transforms, as as transitions, a3 as userSelects, v as verticalAligns, aC as viewTransition, a4 as whitespaces, w as willChange, ae as writingModes, af as writingOrientations, M as zIndexes } from './shared/preset-wind4.BfiLVsoA.mjs';
2
+ export { a as container, c as containerParent, b as containerShortcuts } from './shared/preset-wind4.C100zP13.mjs';
3
+ import './shared/preset-wind4.B0q3EwQ3.mjs';
4
4
  import '@unocss/core';
5
5
  import '@unocss/rule-utils';
@@ -1,5 +1,5 @@
1
1
  import { variantGetParameter, variantMatcher, variantGetBracket, variantParentMatcher, getBracket, hasThemeFn, transformThemeFn, getStringComponent } from '@unocss/rule-utils';
2
- import { b as h, A as resolveBreakpoints, C as CONTROL_MINI_NO_NEGATIVE, j as cssMathFnRE, k as cssVarFnRE, z as hasParseableColor } from './preset-wind4.CkxnR6p3.mjs';
2
+ import { c as h, r as resolveBreakpoints, C as CONTROL_MINI_NO_NEGATIVE, k as cssMathFnRE, l as cssVarFnRE, B as hasParseableColor } from './preset-wind4.B0q3EwQ3.mjs';
3
3
  import { escapeRegExp, escapeSelector } from '@unocss/core';
4
4
 
5
5
  const variantAria = {
@@ -140,6 +140,7 @@ const unitOnlyMap = {
140
140
  };
141
141
  const bracketTypeRe = /^\[(color|image|length|size|position|quoted|string):/i;
142
142
  const splitComma = /,(?![^()]*\))/g;
143
+ const remRE = /(-?[.\d]+)rem/g;
143
144
 
144
145
  const cssProps = [
145
146
  // basic props
@@ -689,4 +690,4 @@ function detectThemeValue(value, theme) {
689
690
  }
690
691
  }
691
692
 
692
- export { resolveBreakpoints as A, resolveVerticalBreakpoints as B, CONTROL_MINI_NO_NEGATIVE as C, makeGlobalStaticRules as D, isCSSMathFn as E, isSize as F, transformXYZ as G, camelize as H, hyphenate as I, compressCSS as J, defineProperty as K, detectThemeValue as L, bracketTypeRe as M, PRESET_NAME as P, SpecialColorKey as S, themeTracking as a, h as b, cornerMap as c, directionMap as d, xyzArray as e, positionMap as f, globalKeywords as g, handler as h, insetMap as i, cssMathFnRE as j, cssVarFnRE as k, directionSize as l, colorableShadows as m, numberResolver as n, colorCSSGenerator as o, passThemeKey as p, colorResolver as q, parseColor as r, splitShorthand as s, trackedTheme as t, parseThemeColor as u, valueHandlers as v, getThemeByKey as w, xyzMap as x, colorVariable as y, hasParseableColor as z };
693
+ export { colorVariable as A, hasParseableColor as B, CONTROL_MINI_NO_NEGATIVE as C, resolveVerticalBreakpoints as D, makeGlobalStaticRules as E, isCSSMathFn as F, isSize as G, transformXYZ as H, camelize as I, hyphenate as J, compressCSS as K, defineProperty as L, detectThemeValue as M, bracketTypeRe as N, PRESET_NAME as P, SpecialColorKey as S, remRE as a, themeTracking as b, h as c, directionMap as d, cornerMap as e, xyzArray as f, positionMap as g, handler as h, insetMap as i, globalKeywords as j, cssMathFnRE as k, cssVarFnRE as l, directionSize as m, numberResolver as n, colorableShadows as o, passThemeKey as p, colorCSSGenerator as q, resolveBreakpoints as r, splitShorthand as s, trackedTheme as t, colorResolver as u, valueHandlers as v, parseColor as w, xyzMap as x, parseThemeColor as y, getThemeByKey as z };
@@ -1,6 +1,6 @@
1
- import { g as globalKeywords, b as h, D as makeGlobalStaticRules, f as positionMap, r as parseColor, S as SpecialColorKey, K as defineProperty, a as themeTracking, L as detectThemeValue, q as colorResolver, E as isCSSMathFn, d as directionMap, z as hasParseableColor, c as cornerMap, p as passThemeKey, o as colorCSSGenerator, F as isSize, l as directionSize, n as numberResolver, m as colorableShadows, i as insetMap, I as hyphenate, A as resolveBreakpoints, G as transformXYZ, x as xyzMap, M as bracketTypeRe } from './preset-wind4.CkxnR6p3.mjs';
1
+ import { j as globalKeywords, c as h, E as makeGlobalStaticRules, g as positionMap, w as parseColor, S as SpecialColorKey, L as defineProperty, b as themeTracking, M as detectThemeValue, u as colorResolver, F as isCSSMathFn, d as directionMap, B as hasParseableColor, e as cornerMap, p as passThemeKey, q as colorCSSGenerator, G as isSize, m as directionSize, n as numberResolver, o as colorableShadows, i as insetMap, J as hyphenate, r as resolveBreakpoints, H as transformXYZ, x as xyzMap, N as bracketTypeRe } from './preset-wind4.B0q3EwQ3.mjs';
2
2
  import { notNull, uniq } from '@unocss/core';
3
- import { a as container, c as containerParent } from './preset-wind4.DhDf1e1c.mjs';
3
+ import { a as container, c as containerParent } from './preset-wind4.C100zP13.mjs';
4
4
  import { getStringComponent } from '@unocss/rule-utils';
5
5
 
6
6
  const verticalAlignAlias = {
@@ -436,9 +436,9 @@ const borders = [
436
436
  [/^(?:border|b)-([bi][se])-(?:style-)?(.+)$/, handlerBorderStyle]
437
437
  ];
438
438
  function borderColorResolver(direction) {
439
- return ([, body], theme) => {
440
- const data = parseColor(body, theme);
441
- const result = colorCSSGenerator(data, `border${direction}-color`, "border");
439
+ return ([, body], ctx) => {
440
+ const data = parseColor(body, ctx.theme);
441
+ const result = colorCSSGenerator(data, `border${direction}-color`, "border", ctx);
442
442
  if (result) {
443
443
  const css = result[0];
444
444
  if (data?.color && !Object.values(SpecialColorKey).includes(data.color) && direction && direction !== "") {
@@ -458,7 +458,7 @@ function handlerBorderColorOrSize([, a = "", b], ctx) {
458
458
  if (isCSSMathFn(h.bracket(b)))
459
459
  return handlerBorderSize(["", a, b]);
460
460
  if (hasParseableColor(b, ctx.theme)) {
461
- return directionMap[a].map((i) => borderColorResolver(i)(["", b], ctx.theme)).filter(notNull).reduce((acc, item) => {
461
+ return directionMap[a].map((i) => borderColorResolver(i)(["", b], ctx)).filter(notNull).reduce((acc, item) => {
462
462
  Object.assign(acc[0], item[0]);
463
463
  acc[1] = uniq([acc[1], item[1]]).join("");
464
464
  return acc.filter(Boolean);
@@ -1171,19 +1171,19 @@ const shadowProperties = {
1171
1171
  insetRingColor: defineProperty("--un-inset-ring-color"),
1172
1172
  insetRingShadow: defineProperty("--un-inset-ring-shadow", { initialValue: "0 0 #0000" }),
1173
1173
  ringInset: defineProperty("--un-ring-inset"),
1174
- ringOffsetWidth: defineProperty("--un-ring-offset-width", { syntax: '"<length>"', initialValue: "0px" }),
1174
+ ringOffsetWidth: defineProperty("--un-ring-offset-width", { syntax: "<length>", initialValue: "0px" }),
1175
1175
  ringOffsetColor: defineProperty("--un-ring-offset-color"),
1176
1176
  ringOffsetShadow: defineProperty("--un-ring-offset-shadow", { initialValue: "0 0 #0000" })
1177
1177
  };
1178
1178
  const boxShadows = [
1179
1179
  // shadow
1180
- [/^shadow(?:-(.+))?$/, hanldeShadow("shadow"), { autocomplete: ["shadow-$colors", "shadow-$shadow"] }],
1180
+ [/^shadow(?:-(.+))?$/, handleShadow("shadow"), { autocomplete: ["shadow-$colors", "shadow-$shadow"] }],
1181
1181
  [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
1182
1182
  // inset shadow
1183
- [/^inset-shadow(?:-(.+))?$/, hanldeShadow("insetShadow"), { autocomplete: ["inset-shadow-$colors", "inset-shadow-$insetShadow"] }],
1183
+ [/^inset-shadow(?:-(.+))?$/, handleShadow("insetShadow"), { autocomplete: ["inset-shadow-$colors", "inset-shadow-$insetShadow"] }],
1184
1184
  [/^inset-shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-inset-shadow-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }]
1185
1185
  ];
1186
- function hanldeShadow(themeKey) {
1186
+ function handleShadow(themeKey) {
1187
1187
  return (match, ctx) => {
1188
1188
  const [, d] = match;
1189
1189
  const { theme } = ctx;
@@ -1196,7 +1196,7 @@ function hanldeShadow(themeKey) {
1196
1196
  "--un-shadow": colorableShadows(v || c, `--un-${colorVar}-color`).join(","),
1197
1197
  "box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
1198
1198
  },
1199
- Object.values(shadowProperties).join("\n")
1199
+ ...Object.values(shadowProperties)
1200
1200
  ];
1201
1201
  }
1202
1202
  return colorResolver(`--un-${colorVar}-color`, colorVar)(match, ctx);
@@ -1210,7 +1210,7 @@ const rings = [
1210
1210
  if (v != null) {
1211
1211
  return [
1212
1212
  {
1213
- "--un-ring-shadow": `var(--un-ring-inset) 0 0 0 calc(${v} + var(--un-ring-offset-width)) var(--un-ring-color, currentColor)`,
1213
+ "--un-ring-shadow": `var(--un-ring-inset,) 0 0 0 calc(${v} + var(--un-ring-offset-width)) var(--un-ring-color, currentColor)`,
1214
1214
  "box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
1215
1215
  },
1216
1216
  Object.values(shadowProperties).join("\n")
@@ -1,5 +1,5 @@
1
1
  import { isString } from '@unocss/core';
2
- import { A as resolveBreakpoints } from './preset-wind4.CkxnR6p3.mjs';
2
+ import { r as resolveBreakpoints } from './preset-wind4.B0q3EwQ3.mjs';
3
3
 
4
4
  const containerParent = [
5
5
  [/^@container(?:\/(\w+))?(?:-(normal))?$/, ([, l, v]) => {
@@ -1,4 +1,4 @@
1
- import { b as containerShortcuts } from './preset-wind4.DhDf1e1c.mjs';
1
+ import { b as containerShortcuts } from './preset-wind4.C100zP13.mjs';
2
2
 
3
3
  const shortcuts = [
4
4
  ...containerShortcuts
@@ -0,0 +1,57 @@
1
+ import { toArray } from '@unocss/core';
2
+
3
+ function important({ important: option }) {
4
+ if (option == null || option === false)
5
+ return [];
6
+ const wrapWithIs = (selector) => {
7
+ if (selector.startsWith(":is(") && selector.endsWith(")"))
8
+ return selector;
9
+ if (selector.includes("::"))
10
+ return selector.replace(/(.*?)((?:\s\*)?::.*)/, ":is($1)$2");
11
+ return `:is(${selector})`;
12
+ };
13
+ return [
14
+ option === true ? (util) => {
15
+ util.entries.forEach((i) => {
16
+ if (i[1] != null && !String(i[1]).endsWith("!important"))
17
+ i[1] += " !important";
18
+ });
19
+ } : (util) => {
20
+ if (!util.selector.startsWith(option))
21
+ util.selector = `${option} ${wrapWithIs(util.selector)}`;
22
+ }
23
+ ];
24
+ }
25
+
26
+ function utility({ utilityResolver }) {
27
+ const processor = (util) => {
28
+ const resolvers = toArray(utilityResolver);
29
+ util.entries.forEach((i) => {
30
+ for (const resolver of resolvers) {
31
+ resolver(i, "default", {});
32
+ }
33
+ });
34
+ };
35
+ return utilityResolver ? [processor] : [];
36
+ }
37
+
38
+ function varPrefix({ variablePrefix: prefix }) {
39
+ const processor = (obj) => {
40
+ obj.entries.forEach((i) => {
41
+ i[0] = i[0].replace(/^--un-/, `--${prefix}`);
42
+ if (typeof i[1] === "string")
43
+ i[1] = i[1].replace(/var\(--un-/g, `var(--${prefix}`);
44
+ });
45
+ };
46
+ return prefix !== "un-" ? [processor] : [];
47
+ }
48
+
49
+ function postprocessors(options) {
50
+ return [
51
+ important,
52
+ varPrefix,
53
+ utility
54
+ ].flatMap((i) => i(options));
55
+ }
56
+
57
+ export { important as i, postprocessors as p, utility as u, varPrefix as v };
@@ -1,5 +1,5 @@
1
- export { s as shortcuts } from './shared/preset-wind4.BwU-POWl.mjs';
2
- import './shared/preset-wind4.DhDf1e1c.mjs';
1
+ export { s as shortcuts } from './shared/preset-wind4.DolXDUDJ.mjs';
2
+ import './shared/preset-wind4.C100zP13.mjs';
3
3
  import '@unocss/core';
4
- import './shared/preset-wind4.CkxnR6p3.mjs';
4
+ import './shared/preset-wind4.B0q3EwQ3.mjs';
5
5
  import '@unocss/rule-utils';
package/dist/utils.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Arrayable, DynamicMatcher, RuleContext, CSSObject, CSSValueInput, VariantContext, StaticRule } from '@unocss/core';
1
+ import { Arrayable, CSSEntry, DynamicMatcher, RuleContext, CSSObject, CSSValueInput, VariantContext, StaticRule } from '@unocss/core';
2
2
  import * as _unocss_rule_utils from '@unocss/rule-utils';
3
3
  export * from '@unocss/rule-utils';
4
4
  import { T as Theme } from './shared/preset-wind4.BXbWGSRz.mjs';
@@ -70,6 +70,8 @@ declare const globalKeywords: string[];
70
70
  declare const cssMathFnRE: RegExp;
71
71
  declare const cssVarFnRE: RegExp;
72
72
 
73
+ declare function createRemToPxResolver(base?: number): (utility: CSSEntry) => void;
74
+
73
75
  declare const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
74
76
  declare const SpecialColorKey: {
75
77
  transparent: string;
@@ -146,4 +148,4 @@ declare function defineProperty(property: string, options?: {
146
148
  }): string;
147
149
  declare function detectThemeValue(value: string, theme: Theme): void;
148
150
 
149
- export { CONTROL_MINI_NO_NEGATIVE, PRESET_NAME, SpecialColorKey, camelize, colorCSSGenerator, colorResolver, colorVariable, colorableShadows, compressCSS, cornerMap, cssMathFnRE, cssVarFnRE, defineProperty, detectThemeValue, directionMap, directionSize, getThemeByKey, globalKeywords, h, handler, hasParseableColor, hyphenate, insetMap, isCSSMathFn, isSize, makeGlobalStaticRules, numberResolver, parseColor, parseThemeColor, passThemeKey, positionMap, resolveBreakpoints, resolveVerticalBreakpoints, splitShorthand, themeTracking, trackedTheme, transformXYZ, handlers as valueHandlers, xyzArray, xyzMap };
151
+ export { CONTROL_MINI_NO_NEGATIVE, PRESET_NAME, SpecialColorKey, camelize, colorCSSGenerator, colorResolver, colorVariable, colorableShadows, compressCSS, cornerMap, createRemToPxResolver, cssMathFnRE, cssVarFnRE, defineProperty, detectThemeValue, directionMap, directionSize, getThemeByKey, globalKeywords, h, handler, hasParseableColor, hyphenate, insetMap, isCSSMathFn, isSize, makeGlobalStaticRules, numberResolver, parseColor, parseThemeColor, passThemeKey, positionMap, resolveBreakpoints, resolveVerticalBreakpoints, splitShorthand, themeTracking, trackedTheme, transformXYZ, handlers as valueHandlers, xyzArray, xyzMap };
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Arrayable, DynamicMatcher, RuleContext, CSSObject, CSSValueInput, VariantContext, StaticRule } from '@unocss/core';
1
+ import { Arrayable, CSSEntry, DynamicMatcher, RuleContext, CSSObject, CSSValueInput, VariantContext, StaticRule } from '@unocss/core';
2
2
  import * as _unocss_rule_utils from '@unocss/rule-utils';
3
3
  export * from '@unocss/rule-utils';
4
4
  import { T as Theme } from './shared/preset-wind4.BXbWGSRz.js';
@@ -70,6 +70,8 @@ declare const globalKeywords: string[];
70
70
  declare const cssMathFnRE: RegExp;
71
71
  declare const cssVarFnRE: RegExp;
72
72
 
73
+ declare function createRemToPxResolver(base?: number): (utility: CSSEntry) => void;
74
+
73
75
  declare const CONTROL_MINI_NO_NEGATIVE = "$$mini-no-negative";
74
76
  declare const SpecialColorKey: {
75
77
  transparent: string;
@@ -146,4 +148,4 @@ declare function defineProperty(property: string, options?: {
146
148
  }): string;
147
149
  declare function detectThemeValue(value: string, theme: Theme): void;
148
150
 
149
- export { CONTROL_MINI_NO_NEGATIVE, PRESET_NAME, SpecialColorKey, camelize, colorCSSGenerator, colorResolver, colorVariable, colorableShadows, compressCSS, cornerMap, cssMathFnRE, cssVarFnRE, defineProperty, detectThemeValue, directionMap, directionSize, getThemeByKey, globalKeywords, h, handler, hasParseableColor, hyphenate, insetMap, isCSSMathFn, isSize, makeGlobalStaticRules, numberResolver, parseColor, parseThemeColor, passThemeKey, positionMap, resolveBreakpoints, resolveVerticalBreakpoints, splitShorthand, themeTracking, trackedTheme, transformXYZ, handlers as valueHandlers, xyzArray, xyzMap };
151
+ export { CONTROL_MINI_NO_NEGATIVE, PRESET_NAME, SpecialColorKey, camelize, colorCSSGenerator, colorResolver, colorVariable, colorableShadows, compressCSS, cornerMap, createRemToPxResolver, cssMathFnRE, cssVarFnRE, defineProperty, detectThemeValue, directionMap, directionSize, getThemeByKey, globalKeywords, h, handler, hasParseableColor, hyphenate, insetMap, isCSSMathFn, isSize, makeGlobalStaticRules, numberResolver, parseColor, parseThemeColor, passThemeKey, positionMap, resolveBreakpoints, resolveVerticalBreakpoints, splitShorthand, themeTracking, trackedTheme, transformXYZ, handlers as valueHandlers, xyzArray, xyzMap };
package/dist/utils.mjs CHANGED
@@ -1,3 +1,13 @@
1
- export { C as CONTROL_MINI_NO_NEGATIVE, P as PRESET_NAME, S as SpecialColorKey, H as camelize, o as colorCSSGenerator, q as colorResolver, y as colorVariable, m as colorableShadows, J as compressCSS, c as cornerMap, j as cssMathFnRE, k as cssVarFnRE, K as defineProperty, L as detectThemeValue, d as directionMap, l as directionSize, w as getThemeByKey, g as globalKeywords, b as h, h as handler, z as hasParseableColor, I as hyphenate, i as insetMap, E as isCSSMathFn, F as isSize, D as makeGlobalStaticRules, n as numberResolver, r as parseColor, u as parseThemeColor, p as passThemeKey, f as positionMap, A as resolveBreakpoints, B as resolveVerticalBreakpoints, s as splitShorthand, a as themeTracking, t as trackedTheme, G as transformXYZ, v as valueHandlers, e as xyzArray, x as xyzMap } from './shared/preset-wind4.CkxnR6p3.mjs';
1
+ import { a as remRE } from './shared/preset-wind4.B0q3EwQ3.mjs';
2
+ export { C as CONTROL_MINI_NO_NEGATIVE, P as PRESET_NAME, S as SpecialColorKey, I as camelize, q as colorCSSGenerator, u as colorResolver, A as colorVariable, o as colorableShadows, K as compressCSS, e as cornerMap, k as cssMathFnRE, l as cssVarFnRE, L as defineProperty, M as detectThemeValue, d as directionMap, m as directionSize, z as getThemeByKey, j as globalKeywords, c as h, h as handler, B as hasParseableColor, J as hyphenate, i as insetMap, F as isCSSMathFn, G as isSize, E as makeGlobalStaticRules, n as numberResolver, w as parseColor, y as parseThemeColor, p as passThemeKey, g as positionMap, r as resolveBreakpoints, D as resolveVerticalBreakpoints, s as splitShorthand, b as themeTracking, t as trackedTheme, H as transformXYZ, v as valueHandlers, f as xyzArray, x as xyzMap } from './shared/preset-wind4.B0q3EwQ3.mjs';
2
3
  export * from '@unocss/rule-utils';
3
4
  import '@unocss/core';
5
+
6
+ function createRemToPxResolver(base = 16) {
7
+ return (utility) => {
8
+ if (typeof utility[1] === "string" && remRE.test(utility[1]))
9
+ utility[1] = utility[1].replace(remRE, (_, p1) => `${p1 * base}px`);
10
+ };
11
+ }
12
+
13
+ export { createRemToPxResolver };
package/dist/variants.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as calcMaxWidthBySize, D as placeholderModifier, v as variantAria, b as variantBreakpoints, d as variantChildren, h as variantColorsMediaOrClass, i as variantColorsScheme, e as variantCombinators, g as variantContainerQuery, q as variantContrasts, w as variantCssLayer, p as variantCustomMedia, j as variantDataAttribute, t as variantForcedColors, n as variantImportant, x as variantInternalLayer, m as variantLanguageDirections, r as variantMotions, C as variantNegative, s as variantOrientations, H as variantPartClasses, o as variantPrint, F as variantPseudoClassFunctions, E as variantPseudoClassesAndElements, y as variantScope, u as variantSelector, I as variantStartingStyle, B as variantStickyHover, J as variantSupports, f as variantSvgCombinators, a as variantTaggedAriaAttributes, k as variantTaggedDataAttributes, G as variantTaggedPseudoClasses, A as variantTheme, z as variantVariables, l as variants } from './shared/preset-wind4.DXr6hHdY.mjs';
1
+ export { c as calcMaxWidthBySize, D as placeholderModifier, v as variantAria, b as variantBreakpoints, d as variantChildren, h as variantColorsMediaOrClass, i as variantColorsScheme, e as variantCombinators, g as variantContainerQuery, q as variantContrasts, w as variantCssLayer, p as variantCustomMedia, j as variantDataAttribute, t as variantForcedColors, n as variantImportant, x as variantInternalLayer, m as variantLanguageDirections, r as variantMotions, C as variantNegative, s as variantOrientations, H as variantPartClasses, o as variantPrint, F as variantPseudoClassFunctions, E as variantPseudoClassesAndElements, y as variantScope, u as variantSelector, I as variantStartingStyle, B as variantStickyHover, J as variantSupports, f as variantSvgCombinators, a as variantTaggedAriaAttributes, k as variantTaggedDataAttributes, G as variantTaggedPseudoClasses, A as variantTheme, z as variantVariables, l as variants } from './shared/preset-wind4.-dZRTBz8.mjs';
2
2
  import '@unocss/rule-utils';
3
- import './shared/preset-wind4.CkxnR6p3.mjs';
3
+ import './shared/preset-wind4.B0q3EwQ3.mjs';
4
4
  import '@unocss/core';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/preset-wind4",
3
3
  "type": "module",
4
- "version": "66.1.0-beta.7",
4
+ "version": "66.1.0-beta.8",
5
5
  "description": "Tailwind 4 compact preset for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -65,9 +65,9 @@
65
65
  "dist"
66
66
  ],
67
67
  "dependencies": {
68
- "@unocss/core": "66.1.0-beta.7",
69
- "@unocss/extractor-arbitrary-variants": "66.1.0-beta.7",
70
- "@unocss/rule-utils": "66.1.0-beta.7"
68
+ "@unocss/core": "66.1.0-beta.8",
69
+ "@unocss/extractor-arbitrary-variants": "66.1.0-beta.8",
70
+ "@unocss/rule-utils": "66.1.0-beta.8"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "unbuild",