@unocss/preset-mini 0.44.1 → 0.44.4

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.
@@ -197,7 +197,7 @@ const transitions = [
197
197
  ],
198
198
  [
199
199
  /^(?:transition-)?property-(.+)$/,
200
- ([, v]) => ({ "transition-property": colors.handler.global(v) || transitionProperty(v) }),
200
+ ([, v]) => ({ "transition-property": colors.handler.bracket.global(v) || transitionProperty(v) }),
201
201
  { autocomplete: [`transition-property-(${[...colors.globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
202
202
  ],
203
203
  ["transition-none", { transition: "none" }],
@@ -213,11 +213,9 @@ const flex = [
213
213
  ["flex-auto", { flex: "1 1 auto" }],
214
214
  ["flex-initial", { flex: "0 1 auto" }],
215
215
  ["flex-none", { flex: "none" }],
216
- [/^(?:flex-)?shrink$/, () => ({ "flex-shrink": 1 })],
217
- [/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
218
- [/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
219
- [/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
220
- [/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? colors.handler.bracket.cssvar.auto.fraction.rem(d) })],
216
+ [/^(?:flex-)?shrink(?:-(.*))?$/, ([, d = ""]) => ({ "flex-shrink": colors.handler.bracket.cssvar.number(d) ?? 1 }), { autocomplete: ["flex-shrink-<num>", "shrink-<num>"] }],
217
+ [/^(?:flex-)?grow(?:-(.*))?$/, ([, d = ""]) => ({ "flex-grow": colors.handler.bracket.cssvar.number(d) ?? 1 }), { autocomplete: ["flex-grow-<num>", "grow-<num>"] }],
218
+ [/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? colors.handler.bracket.cssvar.auto.fraction.rem(d) }), { autocomplete: ["flex-basis-$spacing", "basis-$spacing"] }],
221
219
  ["flex-row", { "flex-direction": "row" }],
222
220
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
223
221
  ["flex-col", { "flex-direction": "column" }],
@@ -195,7 +195,7 @@ const transitions = [
195
195
  ],
196
196
  [
197
197
  /^(?:transition-)?property-(.+)$/,
198
- ([, v]) => ({ "transition-property": handler.global(v) || transitionProperty(v) }),
198
+ ([, v]) => ({ "transition-property": handler.bracket.global(v) || transitionProperty(v) }),
199
199
  { autocomplete: [`transition-property-(${[...globalKeywords, ...Object.keys(transitionPropertyGroup)].join("|")})`] }
200
200
  ],
201
201
  ["transition-none", { transition: "none" }],
@@ -211,11 +211,9 @@ const flex = [
211
211
  ["flex-auto", { flex: "1 1 auto" }],
212
212
  ["flex-initial", { flex: "0 1 auto" }],
213
213
  ["flex-none", { flex: "none" }],
214
- [/^(?:flex-)?shrink$/, () => ({ "flex-shrink": 1 })],
215
- [/^(?:flex-)?shrink-0$/, () => ({ "flex-shrink": 0 })],
216
- [/^(?:flex-)?grow$/, () => ({ "flex-grow": 1 })],
217
- [/^(?:flex-)?grow-0$/, () => ({ "flex-grow": 0 })],
218
- [/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? handler.bracket.cssvar.auto.fraction.rem(d) })],
214
+ [/^(?:flex-)?shrink(?:-(.*))?$/, ([, d = ""]) => ({ "flex-shrink": handler.bracket.cssvar.number(d) ?? 1 }), { autocomplete: ["flex-shrink-<num>", "shrink-<num>"] }],
215
+ [/^(?:flex-)?grow(?:-(.*))?$/, ([, d = ""]) => ({ "flex-grow": handler.bracket.cssvar.number(d) ?? 1 }), { autocomplete: ["flex-grow-<num>", "grow-<num>"] }],
216
+ [/^(?:flex-)?basis-(.+)$/, ([, d], { theme }) => ({ "flex-basis": theme.spacing?.[d] ?? handler.bracket.cssvar.auto.fraction.rem(d) }), { autocomplete: ["flex-basis-$spacing", "basis-$spacing"] }],
219
217
  ["flex-row", { "flex-direction": "row" }],
220
218
  ["flex-row-reverse", { "flex-direction": "row-reverse" }],
221
219
  ["flex-col", { "flex-direction": "column" }],
@@ -112,10 +112,11 @@ const variantCustomMedia = {
112
112
  };
113
113
 
114
114
  const variantColorsMediaOrClass = (options = {}) => {
115
- if (options?.dark === "class") {
115
+ if (options?.dark === "class" || typeof options.dark === "object") {
116
+ const { dark = ".dark", light = ".light" } = typeof options.dark === "string" ? {} : options.dark;
116
117
  return [
117
- variants$1.variantMatcher("dark", (input) => ({ prefix: `.dark $$ ${input.prefix}` })),
118
- variants$1.variantMatcher("light", (input) => ({ prefix: `.light $$ ${input.prefix}` }))
118
+ variants$1.variantMatcher("dark", (input) => ({ prefix: `${dark} $$ ${input.prefix}` })),
119
+ variants$1.variantMatcher("light", (input) => ({ prefix: `${light} $$ ${input.prefix}` }))
119
120
  ];
120
121
  }
121
122
  return [
@@ -110,10 +110,11 @@ const variantCustomMedia = {
110
110
  };
111
111
 
112
112
  const variantColorsMediaOrClass = (options = {}) => {
113
- if (options?.dark === "class") {
113
+ if (options?.dark === "class" || typeof options.dark === "object") {
114
+ const { dark = ".dark", light = ".light" } = typeof options.dark === "string" ? {} : options.dark;
114
115
  return [
115
- variantMatcher("dark", (input) => ({ prefix: `.dark $$ ${input.prefix}` })),
116
- variantMatcher("light", (input) => ({ prefix: `.light $$ ${input.prefix}` }))
116
+ variantMatcher("dark", (input) => ({ prefix: `${dark} $$ ${input.prefix}` })),
117
+ variantMatcher("light", (input) => ({ prefix: `${light} $$ ${input.prefix}` }))
117
118
  ];
118
119
  }
119
120
  return [
package/dist/index.d.ts CHANGED
@@ -7,16 +7,36 @@ export { p as parseColor } from './utilities-00da4436.js';
7
7
 
8
8
  declare const preflights: Preflight[];
9
9
 
10
+ interface DarkModeSelectors {
11
+ /**
12
+ * Selector for light variant.
13
+ *
14
+ * @default '.light'
15
+ */
16
+ light?: string;
17
+ /**
18
+ * Selector for dark variant.
19
+ *
20
+ * @default '.dark'
21
+ */
22
+ dark?: string;
23
+ }
10
24
  interface PresetMiniOptions extends PresetOptions {
11
25
  /**
26
+ * Dark mode options
27
+ *
12
28
  * @default 'class'
13
29
  */
14
- dark?: 'class' | 'media';
30
+ dark?: 'class' | 'media' | DarkModeSelectors;
15
31
  /**
32
+ * Generate pesudo selector as `[group=""]` instead of `.group`
33
+ *
16
34
  * @default false
17
35
  */
18
36
  attributifyPseudo?: Boolean;
19
37
  /**
38
+ * Prefix for CSS variables.
39
+ *
20
40
  * @default 'un-'
21
41
  */
22
42
  variablePrefix?: string;
@@ -29,4 +49,4 @@ interface PresetMiniOptions extends PresetOptions {
29
49
  }
30
50
  declare const presetMini: (options?: PresetMiniOptions) => Preset<Theme>;
31
51
 
32
- export { PresetMiniOptions, presetMini as default, preflights, presetMini };
52
+ export { DarkModeSelectors, PresetMiniOptions, presetMini as default, preflights, presetMini };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.44.1",
3
+ "version": "0.44.4",
4
4
  "description": "The minimal preset for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "*.css"
62
62
  ],
63
63
  "dependencies": {
64
- "@unocss/core": "0.44.1"
64
+ "@unocss/core": "0.44.4"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",