@vinicunca/unocss-preset 1.4.1 → 1.6.0

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.
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  const utils = require('@unocss/preset-mini/utils');
4
- const index = require('../shared/unocss-preset.D9iQspZ3.cjs');
4
+ const index = require('../shared/unocss-preset.C98k-urX.cjs');
5
5
  require('@unocss/core');
6
6
  require('@vinicunca/perkakas');
7
+ require('@unocss/preset-mini');
8
+ require('unocss');
7
9
 
8
10
  const CSS_VARIABLE_PREFIX = "--vin";
9
11
  const ENTER_ANIMATION_NAME = "vin-in";
@@ -1,7 +1,9 @@
1
1
  import { h } from '@unocss/preset-mini/utils';
2
- import { l as layerMeta } from '../shared/unocss-preset.Di_kSW6D.mjs';
2
+ import { l as layerMeta } from '../shared/unocss-preset.CCm-GQKu.mjs';
3
3
  import '@unocss/core';
4
4
  import '@vinicunca/perkakas';
5
+ import '@unocss/preset-mini';
6
+ import 'unocss';
5
7
 
6
8
  const CSS_VARIABLE_PREFIX = "--vin";
7
9
  const ENTER_ANIMATION_NAME = "vin-in";
package/dist/index.cjs CHANGED
@@ -1,8 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  require('@unocss/core');
4
- const index = require('./shared/unocss-preset.D9iQspZ3.cjs');
4
+ const index = require('./shared/unocss-preset.C98k-urX.cjs');
5
5
  require('@vinicunca/perkakas');
6
+ require('@unocss/preset-mini');
7
+ require('unocss');
6
8
 
7
9
 
8
10
 
package/dist/index.d.cts CHANGED
@@ -157,6 +157,12 @@ interface PreflightOptions {
157
157
  * @default true
158
158
  */
159
159
  reset: boolean;
160
+ /**
161
+ * Enable mini preflight
162
+ *
163
+ * @default true
164
+ */
165
+ mini?: boolean;
160
166
  }
161
167
  interface PresetVinicuncaOptions {
162
168
  /**
package/dist/index.d.mts CHANGED
@@ -157,6 +157,12 @@ interface PreflightOptions {
157
157
  * @default true
158
158
  */
159
159
  reset: boolean;
160
+ /**
161
+ * Enable mini preflight
162
+ *
163
+ * @default true
164
+ */
165
+ mini?: boolean;
160
166
  }
161
167
  interface PresetVinicuncaOptions {
162
168
  /**
package/dist/index.d.ts CHANGED
@@ -157,6 +157,12 @@ interface PreflightOptions {
157
157
  * @default true
158
158
  */
159
159
  reset: boolean;
160
+ /**
161
+ * Enable mini preflight
162
+ *
163
+ * @default true
164
+ */
165
+ mini?: boolean;
160
166
  }
161
167
  interface PresetVinicuncaOptions {
162
168
  /**
package/dist/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
1
  import '@unocss/core';
2
- export { a as defineConfig, d as defineVinicuncaConfig, p as presetVinicunca } from './shared/unocss-preset.Di_kSW6D.mjs';
2
+ export { a as defineConfig, d as defineVinicuncaConfig, p as presetVinicunca } from './shared/unocss-preset.CCm-GQKu.mjs';
3
3
  import '@vinicunca/perkakas';
4
+ import '@unocss/preset-mini';
5
+ import 'unocss';
@@ -2,6 +2,8 @@
2
2
 
3
3
  const core = require('@unocss/core');
4
4
  const perkakas = require('@vinicunca/perkakas');
5
+ const presetMini = require('@unocss/preset-mini');
6
+ const unocss = require('unocss');
5
7
 
6
8
  const RE_RGB = /rgb\(([\d\s]+?)\s*\/\s*([^)]+)\)/;
7
9
  const RE_RGBA = /rgba\(([\d\s,]+),\s*([^)]+)\)/;
@@ -29,6 +31,10 @@ function postprocessWithUnColor(unColor) {
29
31
  };
30
32
  }
31
33
 
34
+ function compressCSS(css) {
35
+ return css.replace(/\s+/g, " ").replace(/\/\*[\s\S]*?\*\//g, "");
36
+ }
37
+
32
38
  const resetCSS = `
33
39
  /*
34
40
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
@@ -473,24 +479,42 @@ Make sure disabled buttons don't get the pointer cursor.
473
479
  cursor: default;
474
480
  }
475
481
  `.trim();
476
- function compressCSS(css) {
477
- return css.replace(/\s+/g, " ").replace(/\/\*[\s\S]*?\*\//g, "");
478
- }
479
482
  const resetPreflight = {
480
483
  layer: "preflights",
481
484
  getCSS: () => compressCSS(resetCSS)
482
485
  };
483
486
 
484
487
  function getPreflights(options) {
488
+ const miniPreflights = getMiniPreflights();
485
489
  if (perkakas.isBoolean(options.preflights)) {
486
490
  return options.preflights ? [
487
- resetPreflight
491
+ resetPreflight,
492
+ miniPreflights
488
493
  ] : [];
489
494
  }
490
495
  return [
491
- options.preflights.reset ? resetPreflight : void 0
496
+ options.preflights.reset ? resetPreflight : void 0,
497
+ options.preflights.mini ? miniPreflights : void 0
492
498
  ].filter(Boolean);
493
499
  }
500
+ function getMiniPreflights() {
501
+ const entries = Object.entries({
502
+ ...presetMini.theme.preflightBase,
503
+ "--un-shadow-color": " ",
504
+ "--un-inset-shadow": "0 0 rgb(0 0 0 / 0)",
505
+ "--un-inset-shadow-color": " ",
506
+ "--un-ring-shadow": "0 0 rgb(0 0 0 / 0)",
507
+ "--un-inset-ring-color": " ",
508
+ "--un-inset-ring-shadow": "0 0 rgb(0 0 0 / 0)"
509
+ });
510
+ const css = unocss.entriesToCss(entries);
511
+ const roots = ["*,::before,::after", "::backdrop"];
512
+ const cssContent = roots.map((root) => `${root}{${css}}`).join("");
513
+ return {
514
+ layer: "preflights",
515
+ getCSS: () => compressCSS(cssContent)
516
+ };
517
+ }
494
518
 
495
519
  const customShortcuts = [
496
520
  ["flex-center", "flex justify-center items-center"],
@@ -578,9 +602,7 @@ function camelToHyphen(str) {
578
602
  const defaultOptions = {
579
603
  theme: {},
580
604
  enableDefaultShortcuts: true,
581
- preflights: {
582
- reset: true
583
- },
605
+ preflights: true,
584
606
  // presets
585
607
  wind: {
586
608
  reset: false
@@ -1,5 +1,7 @@
1
1
  import { definePreset, mergeConfigs } from '@unocss/core';
2
2
  import { isString, isBoolean, isPlainObject, mergeDeep } from '@vinicunca/perkakas';
3
+ import { theme } from '@unocss/preset-mini';
4
+ import { entriesToCss } from 'unocss';
3
5
 
4
6
  const RE_RGB = /rgb\(([\d\s]+?)\s*\/\s*([^)]+)\)/;
5
7
  const RE_RGBA = /rgba\(([\d\s,]+),\s*([^)]+)\)/;
@@ -27,6 +29,10 @@ function postprocessWithUnColor(unColor) {
27
29
  };
28
30
  }
29
31
 
32
+ function compressCSS(css) {
33
+ return css.replace(/\s+/g, " ").replace(/\/\*[\s\S]*?\*\//g, "");
34
+ }
35
+
30
36
  const resetCSS = `
31
37
  /*
32
38
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
@@ -471,24 +477,42 @@ Make sure disabled buttons don't get the pointer cursor.
471
477
  cursor: default;
472
478
  }
473
479
  `.trim();
474
- function compressCSS(css) {
475
- return css.replace(/\s+/g, " ").replace(/\/\*[\s\S]*?\*\//g, "");
476
- }
477
480
  const resetPreflight = {
478
481
  layer: "preflights",
479
482
  getCSS: () => compressCSS(resetCSS)
480
483
  };
481
484
 
482
485
  function getPreflights(options) {
486
+ const miniPreflights = getMiniPreflights();
483
487
  if (isBoolean(options.preflights)) {
484
488
  return options.preflights ? [
485
- resetPreflight
489
+ resetPreflight,
490
+ miniPreflights
486
491
  ] : [];
487
492
  }
488
493
  return [
489
- options.preflights.reset ? resetPreflight : void 0
494
+ options.preflights.reset ? resetPreflight : void 0,
495
+ options.preflights.mini ? miniPreflights : void 0
490
496
  ].filter(Boolean);
491
497
  }
498
+ function getMiniPreflights() {
499
+ const entries = Object.entries({
500
+ ...theme.preflightBase,
501
+ "--un-shadow-color": " ",
502
+ "--un-inset-shadow": "0 0 rgb(0 0 0 / 0)",
503
+ "--un-inset-shadow-color": " ",
504
+ "--un-ring-shadow": "0 0 rgb(0 0 0 / 0)",
505
+ "--un-inset-ring-color": " ",
506
+ "--un-inset-ring-shadow": "0 0 rgb(0 0 0 / 0)"
507
+ });
508
+ const css = entriesToCss(entries);
509
+ const roots = ["*,::before,::after", "::backdrop"];
510
+ const cssContent = roots.map((root) => `${root}{${css}}`).join("");
511
+ return {
512
+ layer: "preflights",
513
+ getCSS: () => compressCSS(cssContent)
514
+ };
515
+ }
492
516
 
493
517
  const customShortcuts = [
494
518
  ["flex-center", "flex justify-center items-center"],
@@ -576,9 +600,7 @@ function camelToHyphen(str) {
576
600
  const defaultOptions = {
577
601
  theme: {},
578
602
  enableDefaultShortcuts: true,
579
- preflights: {
580
- reset: true
581
- },
603
+ preflights: true,
582
604
  // presets
583
605
  wind: {
584
606
  reset: false
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vinicunca/unocss-preset",
3
3
  "type": "module",
4
- "version": "1.4.1",
4
+ "version": "1.6.0",
5
5
  "description": "Opinionated UnoCSS preset",
6
6
  "author": "praburangki<https://github.com/praburangki>",
7
7
  "license": "MIT",