@unocss/preset-mini 0.48.4 → 0.48.5

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/README.md CHANGED
@@ -11,7 +11,7 @@ npm i -D @unocss/preset-mini
11
11
  ```ts
12
12
  import presetMini from '@unocss/preset-mini'
13
13
 
14
- Unocss({
14
+ UnoCSS({
15
15
  presets: [
16
16
  presetMini(),
17
17
  ],
package/dist/index.cjs CHANGED
@@ -35,7 +35,7 @@ const presetMini = (options = {}) => {
35
35
  variants: _default$2.variants(options),
36
36
  options,
37
37
  postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0,
38
- preflights: options.preflight ? preflights : [],
38
+ preflights: options.preflight ? normalizePreflights(preflights, options.variablePrefix) : [],
39
39
  prefix: options.prefix
40
40
  };
41
41
  };
@@ -48,11 +48,25 @@ function VarPrefixPostprocessor(prefix) {
48
48
  });
49
49
  };
50
50
  }
51
+ function normalizePreflights(preflights3, variablePrefix) {
52
+ if (variablePrefix && variablePrefix !== "un-") {
53
+ return preflights3.map((p) => ({
54
+ ...p,
55
+ getCSS: (() => async (ctx) => {
56
+ const css = await p.getCSS(ctx);
57
+ if (css)
58
+ return css.replace(/--un-/g, `--${variablePrefix}`);
59
+ })()
60
+ }));
61
+ }
62
+ return preflights3;
63
+ }
51
64
 
52
65
  exports.parseColor = colors$1.parseColor;
53
66
  exports.colors = colors.colors;
54
67
  exports.theme = _default.theme;
55
68
  exports.VarPrefixPostprocessor = VarPrefixPostprocessor;
56
69
  exports["default"] = presetMini;
70
+ exports.normalizePreflights = normalizePreflights;
57
71
  exports.preflights = preflights;
58
72
  exports.presetMini = presetMini;
package/dist/index.d.ts CHANGED
@@ -56,5 +56,6 @@ interface PresetMiniOptions extends PresetOptions {
56
56
  declare const presetMini: (options?: PresetMiniOptions) => Preset<Theme>;
57
57
 
58
58
  declare function VarPrefixPostprocessor(prefix: string): Postprocessor;
59
+ declare function normalizePreflights(preflights: Preflight[], variablePrefix?: string): Preflight<{}>[];
59
60
 
60
- export { DarkModeSelectors, PresetMiniOptions, VarPrefixPostprocessor, presetMini as default, preflights, presetMini };
61
+ export { DarkModeSelectors, PresetMiniOptions, VarPrefixPostprocessor, presetMini as default, normalizePreflights, preflights, presetMini };
package/dist/index.mjs CHANGED
@@ -32,7 +32,7 @@ const presetMini = (options = {}) => {
32
32
  variants: variants(options),
33
33
  options,
34
34
  postprocess: options.variablePrefix && options.variablePrefix !== "un-" ? VarPrefixPostprocessor(options.variablePrefix) : void 0,
35
- preflights: options.preflight ? preflights : [],
35
+ preflights: options.preflight ? normalizePreflights(preflights, options.variablePrefix) : [],
36
36
  prefix: options.prefix
37
37
  };
38
38
  };
@@ -45,5 +45,18 @@ function VarPrefixPostprocessor(prefix) {
45
45
  });
46
46
  };
47
47
  }
48
+ function normalizePreflights(preflights3, variablePrefix) {
49
+ if (variablePrefix && variablePrefix !== "un-") {
50
+ return preflights3.map((p) => ({
51
+ ...p,
52
+ getCSS: (() => async (ctx) => {
53
+ const css = await p.getCSS(ctx);
54
+ if (css)
55
+ return css.replace(/--un-/g, `--${variablePrefix}`);
56
+ })()
57
+ }));
58
+ }
59
+ return preflights3;
60
+ }
48
61
 
49
- export { VarPrefixPostprocessor, presetMini as default, preflights, presetMini };
62
+ export { VarPrefixPostprocessor, presetMini as default, normalizePreflights, preflights, presetMini };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/preset-mini",
3
- "version": "0.48.4",
3
+ "version": "0.48.5",
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.48.4"
64
+ "@unocss/core": "0.48.5"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "unbuild",