vueless 0.0.74 → 0.0.75
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/package.json +1 -1
- package/preset.tailwind/index.js +4 -3
- package/service.ui/index.js +12 -7
- package/web-types.json +1 -1
package/package.json
CHANGED
package/preset.tailwind/index.js
CHANGED
|
@@ -3,9 +3,10 @@ import forms from "@tailwindcss/forms";
|
|
|
3
3
|
import vuelessConfig from "../../../vueless.config.js";
|
|
4
4
|
|
|
5
5
|
export const GRAY_COLORS = ["slate", "gray", "zinc", "neutral", "stone"];
|
|
6
|
-
export const
|
|
6
|
+
export const GRAYSCALE_COLOR = "grayscale";
|
|
7
|
+
export const BRAND_COLOR = "brand";
|
|
7
8
|
export const BRAND_COLORS = [
|
|
8
|
-
|
|
9
|
+
BRAND_COLOR,
|
|
9
10
|
"red",
|
|
10
11
|
"orange",
|
|
11
12
|
"amber",
|
|
@@ -37,7 +38,7 @@ export function vuelessPreset() {
|
|
|
37
38
|
let brandPalette = BRAND_COLORS.includes(brand) ? colors[brand] : colors.green;
|
|
38
39
|
let grayPalette = GRAY_COLORS.includes(gray) ? colors[gray] : colors.zinc;
|
|
39
40
|
|
|
40
|
-
if (brand ===
|
|
41
|
+
if (brand === GRAYSCALE_COLOR) {
|
|
41
42
|
brandPalette = grayPalette;
|
|
42
43
|
}
|
|
43
44
|
|
package/service.ui/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { merge } from "lodash-es";
|
|
|
2
2
|
import { defineConfig } from "cva";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
4
|
import colors from "tailwindcss/colors";
|
|
5
|
-
import { BRAND_COLORS, GRAY_COLORS,
|
|
5
|
+
import { BRAND_COLORS, GRAY_COLORS, GRAYSCALE_COLOR, BRAND_COLOR } from "../preset.tailwind";
|
|
6
6
|
import vuelessConfig from "../../../vueless.config.js";
|
|
7
7
|
|
|
8
8
|
/*
|
|
@@ -105,7 +105,7 @@ export default class UIServiceDefault {
|
|
|
105
105
|
// TODO: This should be rewrote to support all set of brand colors (not only one).
|
|
106
106
|
setBrandColor(brandColor) {
|
|
107
107
|
function getBrandColor(color, grayColor, brandColors) {
|
|
108
|
-
if (color ===
|
|
108
|
+
if (color === GRAYSCALE_COLOR) {
|
|
109
109
|
return grayColor;
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -166,12 +166,17 @@ export default class UIServiceDefault {
|
|
|
166
166
|
@returns { Object }
|
|
167
167
|
*/
|
|
168
168
|
static get(defaultConfig, name) {
|
|
169
|
+
const defaultVariants = merge(
|
|
170
|
+
defaultConfig.defaultVariants,
|
|
171
|
+
globalComponentConfig[name]?.defaultVariants,
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
if (brand === GRAYSCALE_COLOR && defaultVariants.color === BRAND_COLOR) {
|
|
175
|
+
defaultVariants.color = GRAYSCALE_COLOR;
|
|
176
|
+
}
|
|
177
|
+
|
|
169
178
|
return {
|
|
170
|
-
default:
|
|
171
|
-
defaultConfig.defaultVariants,
|
|
172
|
-
brand === GRAYSCALE_BRAND_COLOR && { color: GRAYSCALE_BRAND_COLOR },
|
|
173
|
-
globalComponentConfig[name]?.defaultVariants,
|
|
174
|
-
),
|
|
179
|
+
default: defaultVariants,
|
|
175
180
|
};
|
|
176
181
|
}
|
|
177
182
|
}
|