@vinicunca/unocss-preset 1.22.0 → 1.23.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.
@@ -65,8 +65,7 @@ function toRem(value, config) {
65
65
  * The result of this value is used to calculate the min and max values in rem when the viewport are extended.
66
66
  */
67
67
  function calculateRelativeSize({ originalViewPortMin, originalMinSize, originalMaxSize, originalViewPortMax, newViewPortSize }) {
68
- const slope = (originalMaxSize - originalMinSize) / (originalViewPortMax - originalViewPortMin);
69
- return slope * (newViewPortSize - originalViewPortMin) + originalMinSize;
68
+ return (originalMaxSize - originalMinSize) / (originalViewPortMax - originalViewPortMin) * (newViewPortSize - originalViewPortMin) + originalMinSize;
70
69
  }
71
70
  /**
72
71
  * Returns the min and max values in rem for the given match.
@@ -150,12 +149,11 @@ function getIntersection({ min, slope, minWidth }) {
150
149
  * @returns The slope value as a percentage for use in the 'clamp' function.
151
150
  */
152
151
  function getSlopePercentage({ min, max, config }) {
153
- const slope = getSlope({
152
+ return getSlope({
154
153
  min,
155
154
  max,
156
155
  config
157
- });
158
- return slope * 100;
156
+ }) * 100;
159
157
  }
160
158
  /**
161
159
  * Generates a CSS 'clamp' function value for fluid.
package/dist/index.js CHANGED
@@ -614,12 +614,11 @@ const DEFAULT_PRESET_OPTIONS = {
614
614
  //#endregion
615
615
  //#region src/presets/akar/akar.theme.ts
616
616
  function getAkarTheme(brands = {}) {
617
- const brandTheme = Object.entries(brands).reduce((acc, [brandKey, brandValue]) => {
617
+ return Object.entries(brands).reduce((acc, [brandKey, brandValue]) => {
618
618
  acc[brandKey] = theme.colors[brandValue];
619
619
  if (isObjectType(acc[brandKey])) acc[brandKey].DEFAULT = `var(--akar-brand-${brandKey})`;
620
620
  return acc;
621
621
  }, {});
622
- return brandTheme;
623
622
  }
624
623
 
625
624
  //#endregion
@@ -665,10 +664,10 @@ async function resolvePresets(options) {
665
664
  typography: import("@unocss/preset-typography").then((mod) => mod.presetTypography),
666
665
  wind3: import("unocss").then((m) => m.presetWind3),
667
666
  wind4: import("unocss").then((m) => m.presetWind4),
668
- scrollbar: import("./scrollbar-DGguyrXf.js").then((mod) => mod.presetScrollbar),
667
+ scrollbar: import("./scrollbar-CeS4p1zr.js").then((mod) => mod.presetScrollbar),
669
668
  magicCss: import("./magic-css-BxO5zv5z.js").then((mod) => mod.presetMagicss),
670
669
  animation: import("./animation-KZDlcVMl.js").then((mod) => mod.presetAnimation),
671
- fluid: import("./fluid-7LHAeN3X.js").then((mod) => mod.presetFluid),
670
+ fluid: import("./fluid-DcYIfKcC.js").then((mod) => mod.presetFluid),
672
671
  akar: import("./akar-CcA2NVpg.js").then((mod) => mod.presetAkar)
673
672
  };
674
673
  for (const [key, preset] of Object.entries(presetMap)) {
@@ -702,11 +701,10 @@ function resolveExtend(options) {
702
701
  const shortcuts_ = [];
703
702
  let { animation = {}, keyframes = {} } = options.theme.extend ?? {};
704
703
  const safelist = [];
705
- const enableAkar = Boolean(options.akar);
706
704
  /**
707
705
  * If akar is enabled we want to safelist all default animations
708
706
  */
709
- if (enableAkar) {
707
+ if (Boolean(options.akar)) {
710
708
  animation = mergeDeep(animation, DEFAULT_AKAR_OPTIONS.animation ?? {});
711
709
  keyframes = mergeDeep(keyframes, DEFAULT_AKAR_OPTIONS.keyframes ?? {});
712
710
  let akarAnimation = DEFAULT_AKAR_OPTIONS.animation ?? {};
@@ -716,8 +714,7 @@ function resolveExtend(options) {
716
714
  akarKeyframes = mergeDeep(akarKeyframes, options.akar.keyframes ?? {});
717
715
  }
718
716
  const animationKeys = Object.keys(akarAnimation);
719
- const keyframesKeys = Object.keys(akarKeyframes);
720
- keyframesKeys.forEach((frameKey) => {
717
+ Object.keys(akarKeyframes).forEach((frameKey) => {
721
718
  if (!animationKeys.includes(frameKey)) safelist.push(`animate-${frameKey}`);
722
719
  });
723
720
  }
@@ -28,8 +28,7 @@ function presetScrollbar(option) {
28
28
  };
29
29
  function resolveVar(name) {
30
30
  const prefix = config.varPrefix;
31
- const prefixStr = prefix ? `${prefix}-` : "";
32
- return `--${prefixStr}scrollbar-${name}`;
31
+ return `--${prefix ? `${prefix}-` : ""}scrollbar-${name}`;
33
32
  }
34
33
  const variantsRE = /^(scrollbar(-track|-thumb)?):.+$/;
35
34
  return {
@@ -105,8 +104,7 @@ function presetScrollbar(option) {
105
104
  numberVarRegex,
106
105
  ([_, type, value, unit]) => {
107
106
  const val = unit ? value + unit : config.numberToUnit(Number.parseInt(value));
108
- const vars = customRules[type].map((v) => resolveVar(v));
109
- return vars.reduce((acc, v) => {
107
+ return customRules[type].map((v) => resolveVar(v)).reduce((acc, v) => {
110
108
  acc[v] = val;
111
109
  return acc;
112
110
  }, {});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vinicunca/unocss-preset",
3
3
  "type": "module",
4
- "version": "1.22.0",
4
+ "version": "1.23.0",
5
5
  "description": "Opinionated UnoCSS preset",
6
6
  "author": "praburangki<https://github.com/praburangki>",
7
7
  "license": "MIT",
@@ -42,20 +42,20 @@
42
42
  ],
43
43
  "peerDependencies": {
44
44
  "@vinicunca/perkakas": "^1.7.1",
45
- "unocss": "66.5.0"
45
+ "unocss": "66.5.1"
46
46
  },
47
47
  "publishConfig": {
48
48
  "registry": "https://registry.npmjs.org/"
49
49
  },
50
50
  "dependencies": {
51
- "@unocss/core": "66.5.0",
52
- "@unocss/preset-icons": "66.5.0",
53
- "@unocss/preset-mini": "66.5.0",
54
- "@unocss/preset-typography": "66.5.0",
55
- "@unocss/preset-web-fonts": "66.5.0",
56
- "@unocss/preset-wind4": "66.5.0",
57
- "@unocss/transformer-directives": "66.5.0",
58
- "@unocss/transformer-variant-group": "66.5.0",
51
+ "@unocss/core": "66.5.1",
52
+ "@unocss/preset-icons": "66.5.1",
53
+ "@unocss/preset-mini": "66.5.1",
54
+ "@unocss/preset-typography": "66.5.1",
55
+ "@unocss/preset-web-fonts": "66.5.1",
56
+ "@unocss/preset-wind4": "66.5.1",
57
+ "@unocss/transformer-directives": "66.5.1",
58
+ "@unocss/transformer-variant-group": "66.5.1",
59
59
  "defu": "^6.1.4",
60
60
  "postcss": "^8.5.6",
61
61
  "postcss-js": "^4.0.1"