@unocss/preset-wind4 66.1.0-beta.6 → 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.
Files changed (31) hide show
  1. package/dist/index.d.mts +13 -4
  2. package/dist/index.d.ts +13 -4
  3. package/dist/index.mjs +53 -37
  4. package/dist/postprocess.d.mts +7 -5
  5. package/dist/postprocess.d.ts +7 -5
  6. package/dist/postprocess.mjs +2 -42
  7. package/dist/rules.d.mts +2 -2
  8. package/dist/rules.d.ts +2 -2
  9. package/dist/rules.mjs +3 -3
  10. package/dist/shared/{preset-wind4.fVfslvMN.mjs → preset-wind4.-dZRTBz8.mjs} +1 -1
  11. package/dist/shared/{preset-wind4.47ZKbxbU.mjs → preset-wind4.B0q3EwQ3.mjs} +39 -11
  12. package/dist/shared/{preset-wind4.MiZzPO05.d.mts → preset-wind4.BXbWGSRz.d.mts} +3 -1
  13. package/dist/shared/{preset-wind4.MiZzPO05.d.ts → preset-wind4.BXbWGSRz.d.ts} +3 -1
  14. package/dist/shared/{preset-wind4.We0XxImM.mjs → preset-wind4.BfiLVsoA.mjs} +32 -24
  15. package/dist/shared/{preset-wind4.39lqTMpc.mjs → preset-wind4.C100zP13.mjs} +1 -1
  16. package/dist/shared/{preset-wind4.BJEl798_.d.ts → preset-wind4.Ca5oWgxX.d.ts} +1 -1
  17. package/dist/shared/{preset-wind4.DIUjJahF.d.mts → preset-wind4.D71xGC6i.d.mts} +1 -1
  18. package/dist/shared/{preset-wind4.BvXCZB8z.mjs → preset-wind4.DolXDUDJ.mjs} +1 -1
  19. package/dist/shared/preset-wind4.Pg33yPuf.mjs +57 -0
  20. package/dist/shortcuts.d.mts +1 -1
  21. package/dist/shortcuts.d.ts +1 -1
  22. package/dist/shortcuts.mjs +3 -3
  23. package/dist/theme.d.mts +2 -2
  24. package/dist/theme.d.ts +2 -2
  25. package/dist/utils.d.mts +8 -5
  26. package/dist/utils.d.ts +8 -5
  27. package/dist/utils.mjs +11 -1
  28. package/dist/variants.d.mts +2 -2
  29. package/dist/variants.d.ts +2 -2
  30. package/dist/variants.mjs +2 -2
  31. package/package.json +4 -4
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { Postprocessor, Preflight, Variant, PresetOptions } from '@unocss/core';
3
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.mjs';
4
- export { r as rules } from './shared/preset-wind4.DIUjJahF.mjs';
2
+ import { Postprocessor, Preflight, Variant, PresetOptions, Arrayable, CSSEntry, BaseContext } from '@unocss/core';
3
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.mjs';
4
+ export { r as rules } from './shared/preset-wind4.D71xGC6i.mjs';
5
5
  export { shortcuts } from './shortcuts.mjs';
6
6
  export { t as theme } from './shared/preset-wind4.BOe5kxIw.mjs';
7
7
 
@@ -90,7 +90,16 @@ interface PresetWind4Options extends PresetOptions {
90
90
  *
91
91
  * @default 'on-demand'
92
92
  */
93
- themeVariable?: boolean | 'on-demand';
93
+ themePreflight?: boolean | 'on-demand';
94
+ /**
95
+ * Resolve the layer utilits with custom logic.
96
+ *
97
+ * @param utility [key, value] {@link CSSEntry}
98
+ * @param layer Layer name
99
+ * @param ctx base generator context {@link BaseContext<Theme>}
100
+ * @returns
101
+ */
102
+ utilityResolver?: Arrayable<(utility: CSSEntry, layer: string, ctx: BaseContext<Theme>) => void>;
94
103
  }
95
104
  declare const presetWind4: _unocss_core.PresetFactory<Theme, PresetWind4Options>;
96
105
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { Postprocessor, Preflight, Variant, PresetOptions } from '@unocss/core';
3
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.js';
4
- export { r as rules } from './shared/preset-wind4.BJEl798_.js';
2
+ import { Postprocessor, Preflight, Variant, PresetOptions, Arrayable, CSSEntry, BaseContext } from '@unocss/core';
3
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.js';
4
+ export { r as rules } from './shared/preset-wind4.Ca5oWgxX.js';
5
5
  export { shortcuts } from './shortcuts.js';
6
6
  export { t as theme } from './shared/preset-wind4.BOe5kxIw.js';
7
7
 
@@ -90,7 +90,16 @@ interface PresetWind4Options extends PresetOptions {
90
90
  *
91
91
  * @default 'on-demand'
92
92
  */
93
- themeVariable?: boolean | 'on-demand';
93
+ themePreflight?: boolean | 'on-demand';
94
+ /**
95
+ * Resolve the layer utilits with custom logic.
96
+ *
97
+ * @param utility [key, value] {@link CSSEntry}
98
+ * @param layer Layer name
99
+ * @param ctx base generator context {@link BaseContext<Theme>}
100
+ * @returns
101
+ */
102
+ utilityResolver?: Arrayable<(utility: CSSEntry, layer: string, ctx: BaseContext<Theme>) => void>;
94
103
  }
95
104
  declare const presetWind4: _unocss_core.PresetFactory<Theme, PresetWind4Options>;
96
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, I as hyphenate, p as passThemeKey, g as globalKeywords, t as trackedTheme } from './shared/preset-wind4.47ZKbxbU.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.fVfslvMN.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.BvXCZB8z.mjs';
9
- import { r as rules } from './shared/preset-wind4.We0XxImM.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.39lqTMpc.mjs';
11
+ import './shared/preset-wind4.C100zP13.mjs';
12
12
 
13
13
  const resetCSS = `
14
14
  /*
@@ -399,7 +399,7 @@ function reset(options) {
399
399
  if (options.reset === false)
400
400
  return void 0;
401
401
  return {
402
- getCSS: () => {
402
+ getCSS: ({ generator }) => {
403
403
  themeTracking("font", "sans");
404
404
  themeTracking("font", "mono");
405
405
  themeTracking("defaults", ["font", "family"]);
@@ -408,7 +408,7 @@ function reset(options) {
408
408
  themeTracking("defaults", ["monoFont", "family"]);
409
409
  themeTracking("defaults", ["monoFont", "featureSettings"]);
410
410
  themeTracking("defaults", ["monoFont", "variationSettings"]);
411
- return compressCSS(resetCSS);
411
+ return compressCSS(resetCSS, generator.config.envMode === "dev");
412
412
  },
413
413
  layer: LAYER_PREFLIGHTS
414
414
  };
@@ -428,24 +428,23 @@ const ExcludeCssVarKeys = [
428
428
  "media",
429
429
  "supports"
430
430
  ];
431
- function themeToCSSVars(theme2, keys) {
432
- let cssVariables = "";
431
+ function getThemeVarsMap(theme2, keys) {
432
+ const themeMap = /* @__PURE__ */ new Map([
433
+ ["--spacing", theme2.spacing.DEFAULT]
434
+ ]);
433
435
  function process(obj, prefix) {
434
436
  for (const key in obj) {
435
437
  if (key === "DEFAULT" && Object.keys(obj).length === 1) {
436
- cssVariables += `${hyphenate(`--${prefix}`)}: ${obj[key].replace(alphaPlaceholdersRE, "1")};
437
- `;
438
+ themeMap.set(hyphenate(`--${prefix}`), obj[key].replace(alphaPlaceholdersRE, "1"));
438
439
  }
439
440
  if (passThemeKey.includes(key))
440
441
  continue;
441
442
  if (Array.isArray(obj[key])) {
442
- cssVariables += `${hyphenate(`--${prefix}-${key}`)}: ${obj[key].join(",").replace(alphaPlaceholdersRE, "1")};
443
- `;
443
+ themeMap.set(hyphenate(`--${prefix}-${key}`), obj[key].join(",").replace(alphaPlaceholdersRE, "1"));
444
444
  } else if (typeof obj[key] === "object") {
445
445
  process(obj[key], `${prefix}-${key}`);
446
446
  } else {
447
- cssVariables += `${hyphenate(`--${prefix}-${key}`)}: ${obj[key].replace(alphaPlaceholdersRE, "1")};
448
- `;
447
+ themeMap.set(hyphenate(`--${prefix}-${key}`), obj[key].replace(alphaPlaceholdersRE, "1"));
449
448
  }
450
449
  }
451
450
  }
@@ -454,39 +453,56 @@ function themeToCSSVars(theme2, keys) {
454
453
  continue;
455
454
  process(theme2[key], key);
456
455
  }
457
- return cssVariables;
456
+ return themeMap;
458
457
  }
459
458
  function theme(options) {
460
459
  return {
461
460
  layer: "theme",
462
- getCSS({ theme: theme2, generator }) {
463
- if (options.themeVariable === false) {
461
+ getCSS(ctx) {
462
+ const { theme: theme2, generator } = ctx;
463
+ if (options.themePreflight === false) {
464
464
  return void 0;
465
- } else if (options.themeVariable === "on-demand") {
465
+ }
466
+ let deps;
467
+ const generateCSS = (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
+ }
475
+ }
476
+ const resovledDeps = deps2.map(([key, value]) => key && value ? `${key}: ${value};` : void 0).filter(Boolean);
477
+ if (resovledDeps.length === 0) {
478
+ return void 0;
479
+ }
480
+ const depCSS = resovledDeps.join("\n");
481
+ return compressCSS(`
482
+ :root, :host {
483
+ ${depCSS}
484
+ }`, generator.config.envMode === "dev");
485
+ };
486
+ if (options.themePreflight === "on-demand") {
466
487
  const self = generator.config.presets.find((p) => p.name === PRESET_NAME);
467
488
  if (!self || self.meta.themeDeps.size === 0)
468
- return;
469
- const depCSS = Array.from(self.meta.themeDeps).map((k) => {
489
+ return void 0;
490
+ deps = Array.from(self.meta.themeDeps).map((k) => {
470
491
  const [key, prop] = k.split(":");
471
- const props = prop.split("-");
472
- const v = props.reduce((o, p) => o?.[p], theme2[key]);
492
+ let v = getThemeByKey(theme2, key, prop.split("-")) ?? getThemeByKey(theme2, key, [prop]);
493
+ if (typeof v === "object") {
494
+ v = v.DEFAULT;
495
+ }
473
496
  if (v) {
474
- return `--${hyphenate(`${key}${prop !== "DEFAULT" ? `-${prop}` : ""}`)}: ${v};`;
497
+ return [`--${hyphenate(`${key}${prop !== "DEFAULT" ? `-${prop}` : ""}`)}`, v];
475
498
  }
476
499
  return void 0;
477
- });
478
- return compressCSS(`
479
- :root {
480
- ${depCSS.filter(Boolean).join("\n")}
481
- }`);
500
+ }).filter(Boolean);
482
501
  } else {
483
502
  const keys = Object.keys(theme2).filter((k) => !ExcludeCssVarKeys.includes(k));
484
- return compressCSS(`
485
- :root {
486
- --spacing: ${theme2.spacing.DEFAULT};
487
- ${themeToCSSVars(theme2, keys).trim()}
488
- }`);
503
+ deps = Array.from(getThemeVarsMap(theme2, keys));
489
504
  }
505
+ return generateCSS(deps);
490
506
  }
491
507
  };
492
508
  }
@@ -514,7 +530,7 @@ const presetWind4 = definePreset((options = {}) => {
514
530
  options.attributifyPseudo = options.attributifyPseudo ?? false;
515
531
  options.variablePrefix = options.variablePrefix ?? "un-";
516
532
  options.important = options.important ?? false;
517
- options.themeVariable = options.themeVariable ?? "on-demand";
533
+ options.themePreflight = options.themePreflight ?? "on-demand";
518
534
  return {
519
535
  name: PRESET_NAME,
520
536
  rules,
@@ -1,13 +1,15 @@
1
1
  import { PresetWind4Options } from './index.mjs';
2
2
  export { postprocessors } from './index.mjs';
3
3
  import { Postprocessor } from '@unocss/core';
4
- import './shared/preset-wind4.MiZzPO05.mjs';
5
- import './shared/preset-wind4.DIUjJahF.mjs';
4
+ import './shared/preset-wind4.BXbWGSRz.mjs';
5
+ 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 };
@@ -1,13 +1,15 @@
1
1
  import { PresetWind4Options } from './index.js';
2
2
  export { postprocessors } from './index.js';
3
3
  import { Postprocessor } from '@unocss/core';
4
- import './shared/preset-wind4.MiZzPO05.js';
5
- import './shared/preset-wind4.BJEl798_.js';
4
+ import './shared/preset-wind4.BXbWGSRz.js';
5
+ 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.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Rule, CSSEntries, Shortcut, StaticRule } from '@unocss/core';
2
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.mjs';
3
- export { r as rules } from './shared/preset-wind4.DIUjJahF.mjs';
2
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.mjs';
3
+ export { r as rules } from './shared/preset-wind4.D71xGC6i.mjs';
4
4
 
5
5
  declare const verticalAligns: Rule<Theme>[];
6
6
  declare const textAligns: Rule<Theme>[];
package/dist/rules.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Rule, CSSEntries, Shortcut, StaticRule } from '@unocss/core';
2
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.js';
3
- export { r as rules } from './shared/preset-wind4.BJEl798_.js';
2
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.js';
3
+ export { r as rules } from './shared/preset-wind4.Ca5oWgxX.js';
4
4
 
5
5
  declare const verticalAligns: Rule<Theme>[];
6
6
  declare const textAligns: Rule<Theme>[];
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.We0XxImM.mjs';
2
- export { a as container, c as containerParent, b as containerShortcuts } from './shared/preset-wind4.39lqTMpc.mjs';
3
- import './shared/preset-wind4.47ZKbxbU.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.47ZKbxbU.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
@@ -505,12 +506,15 @@ function colorCSSGenerator(data, property, varName, ctx) {
505
506
  } else {
506
507
  const alphaKey = `--un-${varName}-opacity`;
507
508
  const value = key ? `var(--colors-${key})` : color;
508
- if (key) {
509
- themeTracking(`colors`, key);
510
- }
511
509
  css[alphaKey] = alpha;
512
510
  css[property] = `color-mix(in oklch, ${value} var(${alphaKey}), transparent)${rawColorComment}`;
513
511
  result.push(defineProperty(alphaKey, { syntax: "<percentage>", initialValue: "100%" }));
512
+ if (key) {
513
+ themeTracking(`colors`, key);
514
+ }
515
+ if (ctx?.theme) {
516
+ detectThemeValue(color, ctx.theme);
517
+ }
514
518
  }
515
519
  return result;
516
520
  }
@@ -571,10 +575,16 @@ function parseThemeColor(theme, keys) {
571
575
  no = scale;
572
576
  _keys = keys.slice(0, -1);
573
577
  }
574
- const colorData = getThemeColor(theme, _keys);
578
+ const colorData = getThemeByKey(theme, "colors", _keys);
575
579
  if (typeof colorData === "object") {
576
- color = colorData[no ?? "400"];
577
- key = [..._keys, no ?? "400"].join("-");
580
+ if (no && colorData[no]) {
581
+ color = colorData[no];
582
+ key = [..._keys, no].join("-");
583
+ } else if (!no && colorData.DEFAULT) {
584
+ color = colorData.DEFAULT;
585
+ no = "DEFAULT";
586
+ key = _keys.join("-");
587
+ }
578
588
  } else if (typeof colorData === "string" && !no) {
579
589
  color = colorData;
580
590
  key = _keys.join("-");
@@ -587,15 +597,18 @@ function parseThemeColor(theme, keys) {
587
597
  key
588
598
  };
589
599
  }
590
- function getThemeColor(theme, keys) {
591
- let obj = theme.colors;
600
+ function getThemeByKey(theme, themeKey, keys) {
601
+ let obj = theme[themeKey];
592
602
  let index = -1;
593
603
  for (const k of keys) {
594
604
  index += 1;
595
605
  if (obj && typeof obj !== "string") {
596
- const camel = keys.slice(index).join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase());
606
+ const camel = camelize(keys.slice(index).join("-"));
597
607
  if (obj[camel])
598
608
  return obj[camel];
609
+ const hyphen = keys.slice(index).join("-");
610
+ if (obj[hyphen])
611
+ return obj[hyphen];
599
612
  if (obj[k]) {
600
613
  obj = obj[k];
601
614
  continue;
@@ -650,7 +663,9 @@ function camelize(str) {
650
663
  function hyphenate(str) {
651
664
  return str.replace(/(?:^|\B)([A-Z])/g, "-$1").toLowerCase();
652
665
  }
653
- function compressCSS(css) {
666
+ function compressCSS(css, isDev = false) {
667
+ if (isDev)
668
+ return css.trim();
654
669
  return css.trim().replace(/\s+/g, " ").replace(/\/\*[\s\S]*?\*\//g, "");
655
670
  }
656
671
  function defineProperty(property, options = {}) {
@@ -661,5 +676,18 @@ function defineProperty(property, options = {}) {
661
676
  } = options;
662
677
  return `@property ${property} {syntax: "${syntax}";inherits: ${inherits};${initialValue != null ? `initial-value: ${initialValue};` : ""}}`;
663
678
  }
679
+ function detectThemeValue(value, theme) {
680
+ if (value.startsWith("var(")) {
681
+ const variable = value.match(/var\(--([\w-]+)(?:,.*)?\)/)?.[1];
682
+ if (variable) {
683
+ const [key, ...path] = variable.split("-");
684
+ const themeValue = getThemeByKey(theme, key, path);
685
+ if (themeValue != null) {
686
+ themeTracking(key, path);
687
+ detectThemeValue(themeValue, theme);
688
+ }
689
+ }
690
+ }
691
+ }
664
692
 
665
- 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, bracketTypeRe as L, 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, getThemeColor 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,5 +1,7 @@
1
1
  interface Colors {
2
- [key: string]: Colors | string;
2
+ [key: string]: Colors & {
3
+ DEFAULT?: string;
4
+ } | string;
3
5
  }
4
6
  interface ThemeAnimation {
5
7
  keyframes?: Record<string, string>;
@@ -1,5 +1,7 @@
1
1
  interface Colors {
2
- [key: string]: Colors | string;
2
+ [key: string]: Colors & {
3
+ DEFAULT?: string;
4
+ } | string;
3
5
  }
4
6
  interface ThemeAnimation {
5
7
  keyframes?: Record<string, string>;
@@ -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, q as colorResolver, E as isCSSMathFn, d as directionMap, z as hasParseableColor, c as cornerMap, p as passThemeKey, a as themeTracking, 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, L as bracketTypeRe } from './preset-wind4.47ZKbxbU.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.39lqTMpc.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 = {
@@ -138,13 +138,21 @@ function bgGradientColorResolver() {
138
138
  const data = parseColor(body, theme);
139
139
  if (data) {
140
140
  const { color, key, alpha } = data;
141
- if (Object.values(SpecialColorKey).includes(color)) {
142
- css[`--un-gradient-${position}`] = color;
143
- } else {
144
- css[`--un-${position}-opacity`] = alpha;
145
- const value = key ? `var(--colors-${key})` : color;
146
- css[`--un-gradient-${position}`] = `color-mix(in oklab, ${value} var(--un-${position}-opacity), transparent)`;
147
- yield defineProperty(`--un-${position}-opacity`, { syntax: "<percentage>", initialValue: "100%" });
141
+ if (color) {
142
+ if (Object.values(SpecialColorKey).includes(color)) {
143
+ css[`--un-gradient-${position}`] = color;
144
+ } else {
145
+ css[`--un-${position}-opacity`] = alpha;
146
+ const value = key ? `var(--colors-${key})` : color;
147
+ css[`--un-gradient-${position}`] = `color-mix(in oklab, ${value} var(--un-${position}-opacity), transparent)`;
148
+ yield defineProperty(`--un-${position}-opacity`, { syntax: "<percentage>", initialValue: "100%" });
149
+ }
150
+ if (key) {
151
+ themeTracking(`colors`, key);
152
+ }
153
+ if (theme) {
154
+ detectThemeValue(color, theme);
155
+ }
148
156
  }
149
157
  } else {
150
158
  css[`--un-gradient-${position}`] = h.bracket.cssvar(body);
@@ -428,9 +436,9 @@ const borders = [
428
436
  [/^(?:border|b)-([bi][se])-(?:style-)?(.+)$/, handlerBorderStyle]
429
437
  ];
430
438
  function borderColorResolver(direction) {
431
- return ([, body], theme) => {
432
- const data = parseColor(body, theme);
433
- 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);
434
442
  if (result) {
435
443
  const css = result[0];
436
444
  if (data?.color && !Object.values(SpecialColorKey).includes(data.color) && direction && direction !== "") {
@@ -450,7 +458,7 @@ function handlerBorderColorOrSize([, a = "", b], ctx) {
450
458
  if (isCSSMathFn(h.bracket(b)))
451
459
  return handlerBorderSize(["", a, b]);
452
460
  if (hasParseableColor(b, ctx.theme)) {
453
- 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) => {
454
462
  Object.assign(acc[0], item[0]);
455
463
  acc[1] = uniq([acc[1], item[1]]).join("");
456
464
  return acc.filter(Boolean);
@@ -715,7 +723,7 @@ const filterBaseKeys = [
715
723
  "drop-shadow"
716
724
  ];
717
725
  const filterProperties = filterBaseKeys.map((i) => defineProperty(`--un-${i}`)).join("\n");
718
- const filterCSS = filterBaseKeys.map((i) => `var(--un-${i})`).join(" ");
726
+ const filterCSS = filterBaseKeys.map((i) => `var(--un-${i},)`).join(" ");
719
727
  const backdropBaseKeys = [
720
728
  "backdrop-blur",
721
729
  "backdrop-brightness",
@@ -728,7 +736,7 @@ const backdropBaseKeys = [
728
736
  "backdrop-sepia"
729
737
  ];
730
738
  const backdropProperties = backdropBaseKeys.map((i) => defineProperty(`--un-${i}`)).join("\n");
731
- const backdropCSS = backdropBaseKeys.map((i) => `var(--un-${i})`).join(" ");
739
+ const backdropCSS = backdropBaseKeys.map((i) => `var(--un-${i},)`).join(" ");
732
740
  function percentWithDefault(str) {
733
741
  let v = h.bracket.cssvar(str || "");
734
742
  if (v != null)
@@ -1163,19 +1171,19 @@ const shadowProperties = {
1163
1171
  insetRingColor: defineProperty("--un-inset-ring-color"),
1164
1172
  insetRingShadow: defineProperty("--un-inset-ring-shadow", { initialValue: "0 0 #0000" }),
1165
1173
  ringInset: defineProperty("--un-ring-inset"),
1166
- ringOffsetWidth: defineProperty("--un-ring-offset-width", { syntax: '"<length>"', initialValue: "0px" }),
1174
+ ringOffsetWidth: defineProperty("--un-ring-offset-width", { syntax: "<length>", initialValue: "0px" }),
1167
1175
  ringOffsetColor: defineProperty("--un-ring-offset-color"),
1168
1176
  ringOffsetShadow: defineProperty("--un-ring-offset-shadow", { initialValue: "0 0 #0000" })
1169
1177
  };
1170
1178
  const boxShadows = [
1171
1179
  // shadow
1172
- [/^shadow(?:-(.+))?$/, hanldeShadow("shadow"), { autocomplete: ["shadow-$colors", "shadow-$shadow"] }],
1180
+ [/^shadow(?:-(.+))?$/, handleShadow("shadow"), { autocomplete: ["shadow-$colors", "shadow-$shadow"] }],
1173
1181
  [/^shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }],
1174
1182
  // inset shadow
1175
- [/^inset-shadow(?:-(.+))?$/, hanldeShadow("insetShadow"), { autocomplete: ["inset-shadow-$colors", "inset-shadow-$insetShadow"] }],
1183
+ [/^inset-shadow(?:-(.+))?$/, handleShadow("insetShadow"), { autocomplete: ["inset-shadow-$colors", "inset-shadow-$insetShadow"] }],
1176
1184
  [/^inset-shadow-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-inset-shadow-opacity": h.bracket.percent.cssvar(opacity) }), { autocomplete: "shadow-(op|opacity)-<percent>" }]
1177
1185
  ];
1178
- function hanldeShadow(themeKey) {
1186
+ function handleShadow(themeKey) {
1179
1187
  return (match, ctx) => {
1180
1188
  const [, d] = match;
1181
1189
  const { theme } = ctx;
@@ -1188,7 +1196,7 @@ function hanldeShadow(themeKey) {
1188
1196
  "--un-shadow": colorableShadows(v || c, `--un-${colorVar}-color`).join(","),
1189
1197
  "box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
1190
1198
  },
1191
- Object.values(shadowProperties).join("\n")
1199
+ ...Object.values(shadowProperties)
1192
1200
  ];
1193
1201
  }
1194
1202
  return colorResolver(`--un-${colorVar}-color`, colorVar)(match, ctx);
@@ -1202,7 +1210,7 @@ const rings = [
1202
1210
  if (v != null) {
1203
1211
  return [
1204
1212
  {
1205
- "--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)`,
1206
1214
  "box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
1207
1215
  },
1208
1216
  Object.values(shadowProperties).join("\n")
@@ -1965,12 +1973,12 @@ const transitions = [
1965
1973
  ([, d]) => ({ "transition-delay": h.bracket.cssvar.time(d) })
1966
1974
  ],
1967
1975
  [
1968
- /^(?:transition-)?ease-(.+)$/,
1969
- ([, d], { theme }) => {
1976
+ /^(?:transition-)?ease(?:-(.+))?$/,
1977
+ ([, d = "DEFAULT"], { theme }) => {
1970
1978
  let v;
1971
1979
  if (theme.ease?.[d]) {
1972
1980
  themeTracking("ease", d);
1973
- v = `var(--ease-${d})`;
1981
+ v = `var(--ease${d === "DEFAULT" ? "" : `-${d}`})`;
1974
1982
  } else {
1975
1983
  v = h.bracket.cssvar(d);
1976
1984
  }
@@ -1,5 +1,5 @@
1
1
  import { isString } from '@unocss/core';
2
- import { A as resolveBreakpoints } from './preset-wind4.47ZKbxbU.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,5 +1,5 @@
1
1
  import { Rule } from '@unocss/core';
2
- import { T as Theme } from './preset-wind4.MiZzPO05.js';
2
+ import { T as Theme } from './preset-wind4.BXbWGSRz.js';
3
3
 
4
4
  declare const rules: Rule<Theme>[];
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { Rule } from '@unocss/core';
2
- import { T as Theme } from './preset-wind4.MiZzPO05.mjs';
2
+ import { T as Theme } from './preset-wind4.BXbWGSRz.mjs';
3
3
 
4
4
  declare const rules: Rule<Theme>[];
5
5
 
@@ -1,4 +1,4 @@
1
- import { b as containerShortcuts } from './preset-wind4.39lqTMpc.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
1
  import * as _unocss_core from '@unocss/core';
2
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.mjs';
2
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.mjs';
3
3
 
4
4
  declare const shortcuts: _unocss_core.Shortcut<Theme>[];
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as _unocss_core from '@unocss/core';
2
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.js';
2
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.js';
3
3
 
4
4
  declare const shortcuts: _unocss_core.Shortcut<Theme>[];
5
5
 
@@ -1,5 +1,5 @@
1
- export { s as shortcuts } from './shared/preset-wind4.BvXCZB8z.mjs';
2
- import './shared/preset-wind4.39lqTMpc.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.47ZKbxbU.mjs';
4
+ import './shared/preset-wind4.B0q3EwQ3.mjs';
5
5
  import '@unocss/rule-utils';
package/dist/theme.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { colors } from './colors.mjs';
2
2
  export { t as theme } from './shared/preset-wind4.BOe5kxIw.mjs';
3
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.mjs';
4
- export { C as Colors, a as ThemeAnimation } from './shared/preset-wind4.MiZzPO05.mjs';
3
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.mjs';
4
+ export { C as Colors, a as ThemeAnimation } from './shared/preset-wind4.BXbWGSRz.mjs';
5
5
 
6
6
  declare const animation: {
7
7
  keyframes: {
package/dist/theme.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { colors } from './colors.js';
2
2
  export { t as theme } from './shared/preset-wind4.BOe5kxIw.js';
3
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.js';
4
- export { C as Colors, a as ThemeAnimation } from './shared/preset-wind4.MiZzPO05.js';
3
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.js';
4
+ export { C as Colors, a as ThemeAnimation } from './shared/preset-wind4.BXbWGSRz.js';
5
5
 
6
6
  declare const animation: {
7
7
  keyframes: {
package/dist/utils.d.mts CHANGED
@@ -1,7 +1,7 @@
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
- import { T as Theme, C as Colors } from './shared/preset-wind4.MiZzPO05.mjs';
4
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.mjs';
5
5
 
6
6
  declare const PRESET_NAME = "@unocss/preset-wind4";
7
7
  /** Keys will not appear in the theme variable. */
@@ -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;
@@ -121,7 +123,7 @@ declare function parseThemeColor(theme: Theme, keys: string[]): {
121
123
  no: string | undefined;
122
124
  key: string | undefined;
123
125
  } | undefined;
124
- declare function getThemeColor(theme: Theme, keys: string[]): string | Colors | undefined;
126
+ declare function getThemeByKey(theme: Theme, themeKey: keyof Theme, keys: string[]): any;
125
127
  declare function colorVariable(str: string, varName: string): string;
126
128
  declare function hasParseableColor(color: string | undefined, theme: Theme): boolean;
127
129
  declare function resolveBreakpoints({ theme, generator }: Readonly<VariantContext<Theme>>, key?: 'breakpoint' | 'verticalBreakpoint'): {
@@ -138,11 +140,12 @@ declare function isSize(str: string): boolean;
138
140
  declare function transformXYZ(d: string, v: string, name: string): [string, string][];
139
141
  declare function camelize(str: string): string;
140
142
  declare function hyphenate(str: string): string;
141
- declare function compressCSS(css: string): string;
143
+ declare function compressCSS(css: string, isDev?: boolean): string;
142
144
  declare function defineProperty(property: string, options?: {
143
145
  syntax?: string;
144
146
  inherits?: boolean;
145
147
  initialValue?: unknown;
146
148
  }): string;
149
+ declare function detectThemeValue(value: string, theme: Theme): void;
147
150
 
148
- export { CONTROL_MINI_NO_NEGATIVE, PRESET_NAME, SpecialColorKey, camelize, colorCSSGenerator, colorResolver, colorVariable, colorableShadows, compressCSS, cornerMap, cssMathFnRE, cssVarFnRE, defineProperty, directionMap, directionSize, getThemeColor, 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,7 +1,7 @@
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
- import { T as Theme, C as Colors } from './shared/preset-wind4.MiZzPO05.js';
4
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.js';
5
5
 
6
6
  declare const PRESET_NAME = "@unocss/preset-wind4";
7
7
  /** Keys will not appear in the theme variable. */
@@ -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;
@@ -121,7 +123,7 @@ declare function parseThemeColor(theme: Theme, keys: string[]): {
121
123
  no: string | undefined;
122
124
  key: string | undefined;
123
125
  } | undefined;
124
- declare function getThemeColor(theme: Theme, keys: string[]): string | Colors | undefined;
126
+ declare function getThemeByKey(theme: Theme, themeKey: keyof Theme, keys: string[]): any;
125
127
  declare function colorVariable(str: string, varName: string): string;
126
128
  declare function hasParseableColor(color: string | undefined, theme: Theme): boolean;
127
129
  declare function resolveBreakpoints({ theme, generator }: Readonly<VariantContext<Theme>>, key?: 'breakpoint' | 'verticalBreakpoint'): {
@@ -138,11 +140,12 @@ declare function isSize(str: string): boolean;
138
140
  declare function transformXYZ(d: string, v: string, name: string): [string, string][];
139
141
  declare function camelize(str: string): string;
140
142
  declare function hyphenate(str: string): string;
141
- declare function compressCSS(css: string): string;
143
+ declare function compressCSS(css: string, isDev?: boolean): string;
142
144
  declare function defineProperty(property: string, options?: {
143
145
  syntax?: string;
144
146
  inherits?: boolean;
145
147
  initialValue?: unknown;
146
148
  }): string;
149
+ declare function detectThemeValue(value: string, theme: Theme): void;
147
150
 
148
- export { CONTROL_MINI_NO_NEGATIVE, PRESET_NAME, SpecialColorKey, camelize, colorCSSGenerator, colorResolver, colorVariable, colorableShadows, compressCSS, cornerMap, cssMathFnRE, cssVarFnRE, defineProperty, directionMap, directionSize, getThemeColor, 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, d as directionMap, l as directionSize, w as getThemeColor, 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.47ZKbxbU.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 };
@@ -1,8 +1,8 @@
1
1
  import { VariantObject, Variant, VariantFunction } from '@unocss/core';
2
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.mjs';
2
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.mjs';
3
3
  import { PresetWind4Options } from './index.mjs';
4
4
  export { variants } from './index.mjs';
5
- import './shared/preset-wind4.DIUjJahF.mjs';
5
+ import './shared/preset-wind4.D71xGC6i.mjs';
6
6
  import './shortcuts.mjs';
7
7
  import './shared/preset-wind4.BOe5kxIw.mjs';
8
8
 
@@ -1,8 +1,8 @@
1
1
  import { VariantObject, Variant, VariantFunction } from '@unocss/core';
2
- import { T as Theme } from './shared/preset-wind4.MiZzPO05.js';
2
+ import { T as Theme } from './shared/preset-wind4.BXbWGSRz.js';
3
3
  import { PresetWind4Options } from './index.js';
4
4
  export { variants } from './index.js';
5
- import './shared/preset-wind4.BJEl798_.js';
5
+ import './shared/preset-wind4.Ca5oWgxX.js';
6
6
  import './shortcuts.js';
7
7
  import './shared/preset-wind4.BOe5kxIw.js';
8
8
 
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.fVfslvMN.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.47ZKbxbU.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.6",
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.6",
69
- "@unocss/extractor-arbitrary-variants": "66.1.0-beta.6",
70
- "@unocss/rule-utils": "66.1.0-beta.6"
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",