@vinicunca/unocss-preset 1.24.0 → 1.26.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.
- package/dist/{akar-DZp5UN-l.js → akar-SLlHrcnC.js} +18 -3
- package/dist/index.js +6 -3
- package/package.json +10 -10
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { compressCSS } from "./utils-DZIu2j5I.js";
|
|
2
|
+
import { isString } from "@vinicunca/perkakas";
|
|
2
3
|
import { theme } from "unocss/preset-wind4";
|
|
3
4
|
|
|
4
5
|
//#region src/presets/akar/akar.brand-preflights.ts
|
|
6
|
+
function isHexColor(value) {
|
|
7
|
+
return /^#([A-F0-9]{6}|[A-F0-9]{3})$/i.test(value);
|
|
8
|
+
}
|
|
5
9
|
function getBrandPreflight(options) {
|
|
6
10
|
return {
|
|
7
11
|
layer: "theme",
|
|
@@ -10,9 +14,20 @@ function getBrandPreflight(options) {
|
|
|
10
14
|
const lightVars = [];
|
|
11
15
|
const darkVars = [];
|
|
12
16
|
Object.entries(brands).forEach(([brandName, value]) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
let lightBrand, darkBrand;
|
|
18
|
+
/**
|
|
19
|
+
* If the value is a hex color, use it directly.
|
|
20
|
+
*/
|
|
21
|
+
if (isString(value) && isHexColor(value)) {
|
|
22
|
+
lightBrand = value;
|
|
23
|
+
darkBrand = value;
|
|
24
|
+
} else {
|
|
25
|
+
const colorValue = theme.colors[value];
|
|
26
|
+
lightBrand = colorValue?.[500];
|
|
27
|
+
darkBrand = colorValue?.[400];
|
|
28
|
+
}
|
|
29
|
+
lightVars.push(`--akar-brand-${brandName}: ${lightBrand};`);
|
|
30
|
+
darkVars.push(`--akar-brand-${brandName}: ${darkBrand};`);
|
|
16
31
|
});
|
|
17
32
|
return compressCSS(`
|
|
18
33
|
:root {
|
package/dist/index.js
CHANGED
|
@@ -613,10 +613,13 @@ const DEFAULT_PRESET_OPTIONS = {
|
|
|
613
613
|
|
|
614
614
|
//#endregion
|
|
615
615
|
//#region src/presets/akar/akar.theme.ts
|
|
616
|
+
function isHexColor(value) {
|
|
617
|
+
return /^#([A-F0-9]{6}|[A-F0-9]{3})$/i.test(value);
|
|
618
|
+
}
|
|
616
619
|
function getAkarTheme(brands = {}) {
|
|
617
620
|
return Object.entries(brands).reduce((acc, [brandKey, brandValue]) => {
|
|
618
|
-
acc[brandKey] =
|
|
619
|
-
|
|
621
|
+
if (isString(brandValue) && isHexColor(brandValue)) acc[brandKey] = { DEFAULT: brandValue };
|
|
622
|
+
else acc[brandKey] = theme.colors[brandValue];
|
|
620
623
|
return acc;
|
|
621
624
|
}, {});
|
|
622
625
|
}
|
|
@@ -667,7 +670,7 @@ async function resolvePresets(options) {
|
|
|
667
670
|
magicCss: import("./magic-css-BxO5zv5z.js").then((mod) => mod.presetMagicss),
|
|
668
671
|
animation: import("./animation-KZDlcVMl.js").then((mod) => mod.presetAnimation),
|
|
669
672
|
fluid: import("./fluid-Ne2qtSnB.js").then((mod) => mod.presetFluid),
|
|
670
|
-
akar: import("./akar-
|
|
673
|
+
akar: import("./akar-SLlHrcnC.js").then((mod) => mod.presetAkar)
|
|
671
674
|
};
|
|
672
675
|
for (const [key, preset] of Object.entries(presetMap)) {
|
|
673
676
|
const option = options[key];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vinicunca/unocss-preset",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.26.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.
|
|
45
|
+
"unocss": "66.5.3"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"registry": "https://registry.npmjs.org/"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@unocss/core": "66.5.
|
|
52
|
-
"@unocss/preset-icons": "66.5.
|
|
53
|
-
"@unocss/preset-mini": "66.5.
|
|
54
|
-
"@unocss/preset-typography": "66.5.
|
|
55
|
-
"@unocss/preset-web-fonts": "66.5.
|
|
56
|
-
"@unocss/preset-wind4": "66.5.
|
|
57
|
-
"@unocss/transformer-directives": "66.5.
|
|
58
|
-
"@unocss/transformer-variant-group": "66.5.
|
|
51
|
+
"@unocss/core": "66.5.3",
|
|
52
|
+
"@unocss/preset-icons": "66.5.3",
|
|
53
|
+
"@unocss/preset-mini": "66.5.3",
|
|
54
|
+
"@unocss/preset-typography": "66.5.3",
|
|
55
|
+
"@unocss/preset-web-fonts": "66.5.3",
|
|
56
|
+
"@unocss/preset-wind4": "66.5.3",
|
|
57
|
+
"@unocss/transformer-directives": "66.5.3",
|
|
58
|
+
"@unocss/transformer-variant-group": "66.5.3",
|
|
59
59
|
"defu": "^6.1.4",
|
|
60
60
|
"postcss": "^8.5.6",
|
|
61
61
|
"postcss-js": "^5.0.1"
|