vueless 0.0.675 → 0.0.677
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/composables/useUI.ts +12 -1
- package/constants.js +1 -0
- package/package.json +1 -1
- package/types.ts +1 -1
- package/ui.boilerplate/types.ts +1 -1
- package/ui.button/UButton.vue +9 -6
- package/ui.button/types.ts +1 -1
- package/ui.button-link/ULink.vue +37 -62
- package/ui.button-link/config.ts +8 -35
- package/ui.button-link/storybook/stories.ts +0 -22
- package/ui.button-link/types.ts +1 -11
- package/ui.button-toggle/types.ts +1 -1
- package/ui.button-toggle-item/types.ts +1 -1
- package/ui.container-accordion/types.ts +1 -1
- package/ui.container-card/types.ts +1 -1
- package/ui.container-col/types.ts +1 -1
- package/ui.container-divider/types.ts +1 -1
- package/ui.container-group/types.ts +1 -1
- package/ui.container-groups/types.ts +1 -1
- package/ui.container-modal/UModal.vue +21 -20
- package/ui.container-modal/config.ts +3 -2
- package/ui.container-modal/types.ts +1 -1
- package/ui.container-modal-confirm/types.ts +1 -1
- package/ui.container-page/UPage.vue +31 -19
- package/ui.container-page/config.ts +1 -0
- package/ui.container-page/types.ts +1 -1
- package/ui.container-row/types.ts +1 -1
- package/ui.data-list/types.ts +1 -1
- package/ui.data-table/types.ts +1 -1
- package/ui.dropdown-badge/types.ts +1 -1
- package/ui.dropdown-button/types.ts +1 -1
- package/ui.dropdown-link/UDropdownLink.vue +29 -33
- package/ui.dropdown-link/config.ts +3 -3
- package/ui.dropdown-link/types.ts +1 -1
- package/ui.dropdown-list/types.ts +1 -1
- package/ui.form-calendar/types.ts +1 -1
- package/ui.form-checkbox/types.ts +1 -1
- package/ui.form-checkbox-group/types.ts +1 -1
- package/ui.form-checkbox-multi-state/types.ts +1 -1
- package/ui.form-color-picker/UColorPicker.vue +68 -0
- package/ui.form-color-picker/config.ts +29 -0
- package/ui.form-color-picker/constants.ts +5 -0
- package/ui.form-color-picker/storybook/docs.mdx +16 -0
- package/ui.form-color-picker/storybook/stories.ts +97 -0
- package/ui.form-color-picker/types.ts +42 -0
- package/ui.form-date-picker/types.ts +1 -1
- package/ui.form-date-picker-range/types.ts +1 -1
- package/ui.form-input/types.ts +1 -1
- package/ui.form-input-file/storybook/stories.ts +1 -1
- package/ui.form-input-file/types.ts +1 -1
- package/ui.form-input-money/types.ts +1 -1
- package/ui.form-input-number/types.ts +1 -1
- package/ui.form-input-rating/types.ts +1 -1
- package/ui.form-input-search/types.ts +1 -1
- package/ui.form-label/storybook/stories.ts +1 -1
- package/ui.form-label/types.ts +1 -1
- package/ui.form-radio/types.ts +1 -1
- package/ui.form-radio-group/types.ts +1 -1
- package/ui.form-select/USelect.vue +8 -6
- package/ui.form-select/types.ts +1 -1
- package/ui.form-switch/types.ts +1 -1
- package/ui.form-textarea/types.ts +1 -1
- package/ui.image-avatar/types.ts +1 -1
- package/ui.image-icon/UIcon.vue +2 -18
- package/ui.image-icon/storybook/stories.ts +0 -3
- package/ui.image-icon/types.ts +1 -13
- package/ui.loader/types.ts +1 -1
- package/ui.loader-overlay/types.ts +1 -1
- package/ui.loader-progress/types.ts +1 -1
- package/ui.navigation-pagination/types.ts +1 -1
- package/ui.navigation-progress/types.ts +2 -2
- package/ui.navigation-tab/types.ts +1 -1
- package/ui.navigation-tabs/types.ts +1 -1
- package/ui.other-dot/types.ts +1 -1
- package/ui.other-theme-color-toggle/UThemeColorToggle.vue +44 -70
- package/ui.other-theme-color-toggle/config.ts +2 -23
- package/ui.other-theme-color-toggle/storybook/stories.ts +6 -5
- package/ui.other-theme-color-toggle/types.ts +8 -3
- package/ui.text-alert/types.ts +1 -1
- package/ui.text-badge/types.ts +1 -1
- package/ui.text-block/types.ts +1 -1
- package/ui.text-empty/types.ts +1 -1
- package/ui.text-file/types.ts +1 -1
- package/ui.text-files/types.ts +1 -1
- package/ui.text-header/types.ts +1 -1
- package/ui.text-money/types.ts +1 -1
- package/ui.text-notify/types.ts +1 -1
- package/ui.text-number/types.ts +1 -1
- package/utils/theme.ts +8 -4
package/ui.image-icon/UIcon.vue
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { computed, defineAsyncComponent } from "vue";
|
|
3
3
|
|
|
4
4
|
import useUI from "../composables/useUI.ts";
|
|
5
|
-
import { vTooltip } from "../directives";
|
|
6
5
|
import { getDefaults } from "../utils/ui.ts";
|
|
7
6
|
import { isSSR } from "../utils/helper.ts";
|
|
8
7
|
import { VUELESS_ICONS_CACHED_DIR, VUELESS_LIBRARY } from "../constants.js";
|
|
@@ -12,13 +11,11 @@ import defaultConfig from "./config.ts";
|
|
|
12
11
|
|
|
13
12
|
import type { AsyncComponentLoader } from "vue";
|
|
14
13
|
import type { Props, Config, IconLibraries } from "./types.ts";
|
|
15
|
-
import type { Props as TippyProps, Instance as TippyInstance } from "tippy.js";
|
|
16
14
|
|
|
17
15
|
defineOptions({ inheritAttrs: false });
|
|
18
16
|
|
|
19
17
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
18
|
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
21
|
-
tooltipSettings: () => ({}) as TippyProps,
|
|
22
19
|
});
|
|
23
20
|
|
|
24
21
|
const emit = defineEmits([
|
|
@@ -128,18 +125,6 @@ const dynamicComponent = computed(() => {
|
|
|
128
125
|
return defineAsyncComponent(libraries[library] as AsyncComponentLoader);
|
|
129
126
|
});
|
|
130
127
|
|
|
131
|
-
const tooltipConfig = computed(() => ({
|
|
132
|
-
...props.tooltipSettings,
|
|
133
|
-
content: props.tooltip,
|
|
134
|
-
onShow: (instance: TippyInstance) => {
|
|
135
|
-
const userOnShow = props.tooltipSettings?.onShow;
|
|
136
|
-
|
|
137
|
-
userOnShow && userOnShow(instance);
|
|
138
|
-
|
|
139
|
-
return !!props.tooltip;
|
|
140
|
-
},
|
|
141
|
-
}));
|
|
142
|
-
|
|
143
128
|
function onClick(event: MouseEvent) {
|
|
144
129
|
emit("click", event);
|
|
145
130
|
}
|
|
@@ -148,16 +133,15 @@ function onClick(event: MouseEvent) {
|
|
|
148
133
|
* Get element / nested component attributes for each config token ✨
|
|
149
134
|
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
150
135
|
*/
|
|
151
|
-
const { config, iconAttrs } = useUI<Config>(defaultConfig);
|
|
136
|
+
const { getDataTest, config, iconAttrs } = useUI<Config>(defaultConfig);
|
|
152
137
|
</script>
|
|
153
138
|
|
|
154
139
|
<template>
|
|
155
140
|
<component
|
|
156
141
|
:is="dynamicComponent"
|
|
157
|
-
v-tooltip="tooltipConfig"
|
|
158
142
|
tabindex="-1"
|
|
159
143
|
v-bind="iconAttrs"
|
|
160
|
-
:data-test="
|
|
144
|
+
:data-test="getDataTest()"
|
|
161
145
|
@click="onClick"
|
|
162
146
|
/>
|
|
163
147
|
</template>
|
|
@@ -79,8 +79,5 @@ Sizes.args = { enum: "size" };
|
|
|
79
79
|
export const Variants = EnumVariantTemplate.bind({});
|
|
80
80
|
Variants.args = { enum: "variant", color: "red" };
|
|
81
81
|
|
|
82
|
-
export const Tooltip = DefaultTemplate.bind({});
|
|
83
|
-
Tooltip.args = { tooltip: "Some text" };
|
|
84
|
-
|
|
85
82
|
export const Interactive = DefaultTemplate.bind({});
|
|
86
83
|
Interactive.args = { interactive: true };
|
package/ui.image-icon/types.ts
CHANGED
|
@@ -3,7 +3,6 @@ import defaultConfig from "./config.ts";
|
|
|
3
3
|
import type { DefineComponent, SVGAttributes } from "vue";
|
|
4
4
|
|
|
5
5
|
import type { ComponentConfig } from "../types.ts";
|
|
6
|
-
import type { Props as TippyProps } from "tippy.js";
|
|
7
6
|
|
|
8
7
|
export type Config = typeof defaultConfig;
|
|
9
8
|
|
|
@@ -68,17 +67,6 @@ export interface Props {
|
|
|
68
67
|
*/
|
|
69
68
|
interactive?: boolean;
|
|
70
69
|
|
|
71
|
-
/**
|
|
72
|
-
* Add tooltip text on hover.
|
|
73
|
-
*/
|
|
74
|
-
tooltip?: string;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Tooltip settings.
|
|
78
|
-
* [See all settings here](https://kabbouchi.github.io/vue-tippy/4.0/features/placement.html).
|
|
79
|
-
*/
|
|
80
|
-
tooltipSettings?: TippyProps;
|
|
81
|
-
|
|
82
70
|
/**
|
|
83
71
|
* Mark that Icon used inside Vueless components (used to get icons from vueless library).
|
|
84
72
|
*/
|
|
@@ -92,5 +80,5 @@ export interface Props {
|
|
|
92
80
|
/**
|
|
93
81
|
* Data-test attribute for automated testing.
|
|
94
82
|
*/
|
|
95
|
-
dataTest?: string;
|
|
83
|
+
dataTest?: string | null;
|
|
96
84
|
}
|
package/ui.loader/types.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface UProgressProps {
|
|
|
63
63
|
/**
|
|
64
64
|
* Data-test attribute for automated testing.
|
|
65
65
|
*/
|
|
66
|
-
dataTest?: string;
|
|
66
|
+
dataTest?: string | null;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export interface StepperProgressProps {
|
|
@@ -90,5 +90,5 @@ export interface StepperProgressProps {
|
|
|
90
90
|
/**
|
|
91
91
|
* Data-test attribute for automated testing.
|
|
92
92
|
*/
|
|
93
|
-
dataTest?: string;
|
|
93
|
+
dataTest?: string | null;
|
|
94
94
|
}
|
package/ui.other-dot/types.ts
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, useId
|
|
2
|
+
import { computed, useId } from "vue";
|
|
3
3
|
|
|
4
|
-
import { vTooltip } from "../directives";
|
|
5
4
|
import useUI from "../composables/useUI.ts";
|
|
6
5
|
import { getDefaults } from "../utils/ui.ts";
|
|
7
6
|
import { setTheme, getSelectedBrandColor, getSelectedGrayColor } from "../utils/theme.ts";
|
|
8
7
|
import { GRAYSCALE_COLOR } from "../constants.js";
|
|
9
8
|
|
|
10
9
|
import UDivider from "../ui.container-divider/UDivider.vue";
|
|
11
|
-
import
|
|
10
|
+
import UColorPicker from "../ui.form-color-picker/UColorPicker.vue";
|
|
12
11
|
|
|
13
12
|
import { COMPONENT_NAME } from "./constants.ts";
|
|
14
13
|
import defaultConfig from "./config.ts";
|
|
15
14
|
|
|
16
|
-
import type { BrandColors, GrayColors } from "../types.ts";
|
|
17
15
|
import type { Props, Config } from "./types.ts";
|
|
18
16
|
|
|
19
17
|
defineOptions({ inheritAttrs: false });
|
|
20
18
|
|
|
21
19
|
const props = withDefaults(defineProps<Props>(), {
|
|
22
20
|
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
23
|
-
|
|
21
|
+
brand: "",
|
|
22
|
+
gray: "",
|
|
24
23
|
brandColors: () => ({}),
|
|
25
24
|
grayColors: () => ({}),
|
|
26
25
|
brandLabels: () => ({}),
|
|
@@ -29,78 +28,61 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
29
28
|
|
|
30
29
|
const emit = defineEmits([
|
|
31
30
|
/**
|
|
32
|
-
* Triggers when color
|
|
31
|
+
* Triggers when the brand color changes.
|
|
33
32
|
* @property {string} value
|
|
34
33
|
*/
|
|
35
|
-
"update:
|
|
34
|
+
"update:brand",
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Triggers when the gray color changes.
|
|
38
|
+
* @property {string} value
|
|
39
|
+
*/
|
|
40
|
+
"update:gray",
|
|
36
41
|
]);
|
|
37
42
|
|
|
38
43
|
const elementId = props.id || useId();
|
|
39
44
|
|
|
40
|
-
const
|
|
41
|
-
|
|
45
|
+
const selectedBrandColor = computed({
|
|
46
|
+
get: () => props.brand || getSelectedBrandColor(),
|
|
47
|
+
set: (brand: string) => {
|
|
48
|
+
const prevBrand = getSelectedBrandColor();
|
|
49
|
+
const isBrandGrayscale = brand === GRAYSCALE_COLOR;
|
|
50
|
+
const isPrevBrandGrayscale = prevBrand === GRAYSCALE_COLOR;
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
if (brand !== prevBrand && (isBrandGrayscale || isPrevBrandGrayscale)) {
|
|
53
|
+
window.location.reload();
|
|
54
|
+
}
|
|
46
55
|
|
|
47
|
-
|
|
56
|
+
setTheme({ brand });
|
|
57
|
+
emit("update:brand", brand);
|
|
48
58
|
},
|
|
49
|
-
set: (value) => emit("update:modelValue", value),
|
|
50
59
|
});
|
|
51
60
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
setTheme({ brand, gray });
|
|
61
|
-
|
|
62
|
-
if (oldBrand !== brand && (brand === GRAYSCALE_COLOR || oldBrand === GRAYSCALE_COLOR)) {
|
|
63
|
-
window.location.reload();
|
|
64
|
-
}
|
|
61
|
+
const selectedGrayColor = computed({
|
|
62
|
+
get: () => props.gray || getSelectedGrayColor(),
|
|
63
|
+
set: (value: string) => {
|
|
64
|
+
setTheme({ gray: value });
|
|
65
|
+
emit("update:gray", value);
|
|
66
|
+
},
|
|
65
67
|
});
|
|
66
68
|
|
|
67
|
-
function onClickBrandColor(brand: BrandColors) {
|
|
68
|
-
const [, gray] = selectedItem.value;
|
|
69
|
-
|
|
70
|
-
selectedItem.value = [brand, gray];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function onClickGrayColor(gray: GrayColors) {
|
|
74
|
-
const [brand] = selectedItem.value;
|
|
75
|
-
|
|
76
|
-
selectedItem.value = [brand, gray];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
69
|
/**
|
|
80
70
|
* Get element / nested component attributes for each config token ✨
|
|
81
71
|
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
82
72
|
*/
|
|
83
|
-
const { listAttrs,
|
|
73
|
+
const { listAttrs, colorDividerAttrs, brandColorPickerAttrs, grayColorPickerAttrs } =
|
|
84
74
|
useUI<Config>(defaultConfig);
|
|
85
75
|
</script>
|
|
86
76
|
|
|
87
77
|
<template>
|
|
88
78
|
<div :id="elementId" v-bind="listAttrs">
|
|
89
|
-
<
|
|
90
|
-
v-
|
|
91
|
-
:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
color="grayscale"
|
|
97
|
-
variant="thirdary"
|
|
98
|
-
:filled="selectedItem[0] === color"
|
|
99
|
-
v-bind="colorButtonAttrs"
|
|
100
|
-
@click="onClickBrandColor(color)"
|
|
101
|
-
>
|
|
102
|
-
<div :class="brandColorClass" v-bind="circleAttrs" />
|
|
103
|
-
</UButton>
|
|
79
|
+
<UColorPicker
|
|
80
|
+
v-model="selectedBrandColor"
|
|
81
|
+
:size="size"
|
|
82
|
+
:colors="brandColors"
|
|
83
|
+
:labels="brandLabels"
|
|
84
|
+
v-bind="brandColorPickerAttrs"
|
|
85
|
+
/>
|
|
104
86
|
|
|
105
87
|
<UDivider
|
|
106
88
|
v-if="Object.keys(brandColors).length && Object.keys(grayColors).length"
|
|
@@ -108,20 +90,12 @@ const { listAttrs, colorButtonAttrs, circleAttrs, colorDividerAttrs } =
|
|
|
108
90
|
v-bind="colorDividerAttrs"
|
|
109
91
|
/>
|
|
110
92
|
|
|
111
|
-
<
|
|
112
|
-
v-
|
|
113
|
-
:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
color="grayscale"
|
|
119
|
-
variant="thirdary"
|
|
120
|
-
:filled="selectedItem[1] === color"
|
|
121
|
-
v-bind="colorButtonAttrs"
|
|
122
|
-
@click="onClickGrayColor(color)"
|
|
123
|
-
>
|
|
124
|
-
<div :class="grayColorClass" v-bind="circleAttrs" />
|
|
125
|
-
</UButton>
|
|
93
|
+
<UColorPicker
|
|
94
|
+
v-model="selectedGrayColor"
|
|
95
|
+
:size="size"
|
|
96
|
+
:colors="grayColors"
|
|
97
|
+
:labels="grayLabels"
|
|
98
|
+
v-bind="grayColorPickerAttrs"
|
|
99
|
+
/>
|
|
126
100
|
</div>
|
|
127
101
|
</template>
|
|
@@ -1,28 +1,7 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
list: "flex flex-wrap gap-0.5",
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
button: {
|
|
6
|
-
compoundVariants: [
|
|
7
|
-
{
|
|
8
|
-
filled: true,
|
|
9
|
-
variant: "thirdary",
|
|
10
|
-
color: "grayscale",
|
|
11
|
-
class: "bg-gray-800/10 dark:bg-gray-200/10",
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
circle: {
|
|
17
|
-
base: "rounded-full",
|
|
18
|
-
variants: {
|
|
19
|
-
size: {
|
|
20
|
-
sm: "size-4",
|
|
21
|
-
md: "size-5",
|
|
22
|
-
lg: "size-6",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
3
|
+
brandColorPicker: "{UColorPicker}",
|
|
4
|
+
grayColorPicker: "{UColorPicker}",
|
|
26
5
|
colorDivider: "{UDivider}",
|
|
27
6
|
defaults: {
|
|
28
7
|
size: "md",
|
|
@@ -19,13 +19,13 @@ interface UThemeColorToggleArgs extends Props {
|
|
|
19
19
|
|
|
20
20
|
export default {
|
|
21
21
|
id: "100020",
|
|
22
|
-
title: "Other / Theme Color
|
|
22
|
+
title: "Other / Theme Color Toggle",
|
|
23
23
|
component: UThemeColorToggle,
|
|
24
24
|
args: {
|
|
25
|
-
|
|
25
|
+
brand: "",
|
|
26
|
+
gray: "",
|
|
26
27
|
brandColors: {
|
|
27
28
|
grayscale: "bg-gray-900",
|
|
28
|
-
gray: "bg-gray-600",
|
|
29
29
|
red: "bg-red-600",
|
|
30
30
|
orange: "bg-orange-600",
|
|
31
31
|
amber: "bg-amber-600",
|
|
@@ -71,7 +71,7 @@ const DefaultTemplate: StoryFn<UThemeColorToggleArgs> = (args: UThemeColorToggle
|
|
|
71
71
|
},
|
|
72
72
|
template: `
|
|
73
73
|
<UCol>
|
|
74
|
-
<UThemeColorToggle v-bind="args" v-model="args.
|
|
74
|
+
<UThemeColorToggle v-bind="args" v-model:brand="args.brand" v-model:gray="args.gray">
|
|
75
75
|
${args.slotTemplate || getSlotsFragment("")}
|
|
76
76
|
</UThemeColorToggle>
|
|
77
77
|
|
|
@@ -97,7 +97,8 @@ const EnumVariantTemplate: StoryFn<UThemeColorToggleArgs> = (
|
|
|
97
97
|
v-for="(option, index) in options"
|
|
98
98
|
:key="index"
|
|
99
99
|
v-bind="args"
|
|
100
|
-
v-model="args.
|
|
100
|
+
v-model:brand="args.brand"
|
|
101
|
+
v-model:gray="args.gray"
|
|
101
102
|
:[args.enum]="option"
|
|
102
103
|
/>
|
|
103
104
|
</UCol>
|
|
@@ -6,9 +6,14 @@ export type Config = typeof defaultConfig;
|
|
|
6
6
|
|
|
7
7
|
export interface Props {
|
|
8
8
|
/**
|
|
9
|
-
* Selected
|
|
9
|
+
* Selected brand color (v-model).
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
brand: BrandColors;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Selected gray color (v-model).
|
|
15
|
+
*/
|
|
16
|
+
gray: GrayColors;
|
|
12
17
|
|
|
13
18
|
/**
|
|
14
19
|
* Component size.
|
|
@@ -48,5 +53,5 @@ export interface Props {
|
|
|
48
53
|
/**
|
|
49
54
|
* Data-test attribute for automated testing.
|
|
50
55
|
*/
|
|
51
|
-
dataTest?: string;
|
|
56
|
+
dataTest?: string | null;
|
|
52
57
|
}
|
package/ui.text-alert/types.ts
CHANGED
package/ui.text-badge/types.ts
CHANGED
package/ui.text-block/types.ts
CHANGED
package/ui.text-empty/types.ts
CHANGED
package/ui.text-file/types.ts
CHANGED
package/ui.text-files/types.ts
CHANGED
package/ui.text-header/types.ts
CHANGED
package/ui.text-money/types.ts
CHANGED
package/ui.text-notify/types.ts
CHANGED
package/ui.text-number/types.ts
CHANGED
package/utils/theme.ts
CHANGED
|
@@ -115,7 +115,7 @@ export function setTheme(config: Config = {}) {
|
|
|
115
115
|
const roundingLg = config.roundingLg ?? vuelessConfig.roundingLg ?? rounding * 2;
|
|
116
116
|
const isDarkMode = isCSR && document.documentElement.classList.contains(DARK_MODE_SELECTOR);
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
let brand: BrandColors =
|
|
119
119
|
config.brand ?? getSelectedBrandColor() ?? vuelessConfig.brand ?? DEFAULT_BRAND_COLOR;
|
|
120
120
|
|
|
121
121
|
let gray: GrayColors =
|
|
@@ -138,10 +138,17 @@ export function setTheme(config: Config = {}) {
|
|
|
138
138
|
const defaultGrayShade = isDarkMode ? 400 : 600;
|
|
139
139
|
const defaultRingOffsetColor = isDarkMode ? ringOffsetColorDark : ringOffsetColorLight;
|
|
140
140
|
|
|
141
|
+
localStorage.setItem("brand", brand);
|
|
142
|
+
localStorage.setItem("gray", gray);
|
|
143
|
+
|
|
141
144
|
if (gray === COOL_COLOR) {
|
|
142
145
|
gray = GRAY_COLOR;
|
|
143
146
|
}
|
|
144
147
|
|
|
148
|
+
if (brand === GRAYSCALE_COLOR) {
|
|
149
|
+
brand = gray;
|
|
150
|
+
}
|
|
151
|
+
|
|
145
152
|
/* Remove deprecated color aliases. */
|
|
146
153
|
delete (tailwindColors as Partial<DefaultColors>).lightBlue;
|
|
147
154
|
delete (tailwindColors as Partial<DefaultColors>).warmGray;
|
|
@@ -169,9 +176,6 @@ export function setTheme(config: Config = {}) {
|
|
|
169
176
|
console.warn(`The gray color '${gray}' is missing in your palette.`);
|
|
170
177
|
}
|
|
171
178
|
|
|
172
|
-
localStorage.setItem("brand", brand);
|
|
173
|
-
localStorage.setItem("gray", gray);
|
|
174
|
-
|
|
175
179
|
const variables: Partial<VuelessCssVariables> = {
|
|
176
180
|
"--vl-rounding-sm": `${Number(roundingSm) / PX_IN_REM}rem`,
|
|
177
181
|
"--vl-rounding": `${Number(rounding) / PX_IN_REM}rem`,
|