@code-coaching/vuetiful 0.23.0 → 0.23.1
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/types/utils/theme/theme-switcher.vue.d.ts +22 -62
- package/dist/vuetiful.es.mjs +70 -132
- package/dist/vuetiful.umd.js +7 -15
- package/package.json +1 -1
- package/src/utils/theme/theme-switcher.vue +61 -131
package/package.json
CHANGED
|
@@ -1,150 +1,80 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<
|
|
2
|
+
<div class="vuetiful-theme-switcher">
|
|
3
|
+
<v-button
|
|
4
|
+
:class="`vuetiful-theme-switcher__button ${classButton}`"
|
|
5
|
+
@click="showPopup = !showPopup"
|
|
6
|
+
>
|
|
4
7
|
Theme
|
|
5
|
-
</
|
|
8
|
+
</v-button>
|
|
6
9
|
|
|
7
10
|
<div
|
|
8
11
|
v-if="showPopup"
|
|
9
|
-
class="
|
|
10
|
-
:class="
|
|
12
|
+
class="vuetiful-theme-switcher__popup absolute z-10 mt-1 space-y-4 p-4 shadow-xl rounded-container-token"
|
|
13
|
+
:class="`${background} ${text} ${widthPopup} ${classList}`"
|
|
11
14
|
>
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{{ theme.name }}
|
|
31
|
-
</li>
|
|
32
|
-
</ul>
|
|
33
|
-
</nav>
|
|
34
|
-
</div>
|
|
15
|
+
<section class="flex items-center justify-between">
|
|
16
|
+
<div class="text-lg">Mode</div>
|
|
17
|
+
<v-light-switch />
|
|
18
|
+
</section>
|
|
19
|
+
<nav
|
|
20
|
+
class="vuetiful-theme-switcher__popup-list -m-4 flex flex-col gap-4 overflow-y-auto p-4"
|
|
21
|
+
:class="`${heightList} ${classList}`"
|
|
22
|
+
>
|
|
23
|
+
<v-button
|
|
24
|
+
class="vuetiful-theme-switcher__popup-list-item h-full w-full p-2 text-center capitalize hover:cursor-pointer"
|
|
25
|
+
v-for="(theme, index) in themes"
|
|
26
|
+
:class="`${classListItem} ${chosenTheme === theme.name ? 'variant-filled-surface' : ''}`"
|
|
27
|
+
:key="index"
|
|
28
|
+
@click="loadTheme(theme.name)"
|
|
29
|
+
>
|
|
30
|
+
{{ theme.name }}
|
|
31
|
+
</v-button>
|
|
32
|
+
</nav>
|
|
35
33
|
</div>
|
|
36
34
|
</div>
|
|
37
35
|
</template>
|
|
38
36
|
|
|
39
|
-
<script lang="ts">
|
|
40
|
-
import { CssClasses,
|
|
41
|
-
import {
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import { CssClasses, useTheme, VButton, VLightSwitch } from "@/index";
|
|
39
|
+
import { onMounted, ref } from "vue";
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
defineProps({
|
|
42
|
+
background: {
|
|
43
|
+
type: String as () => CssClasses,
|
|
44
|
+
default: "bg-surface-50-900-token",
|
|
47
45
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
default: "bg-surface-50",
|
|
52
|
-
},
|
|
53
|
-
bgDark: {
|
|
54
|
-
type: String as () => CssClasses,
|
|
55
|
-
default: "bg-surface-900",
|
|
56
|
-
},
|
|
57
|
-
textOnLight: {
|
|
58
|
-
type: String as () => CssClasses,
|
|
59
|
-
default: "text-surface-900",
|
|
60
|
-
},
|
|
61
|
-
textOnDark: {
|
|
62
|
-
type: String as () => CssClasses,
|
|
63
|
-
default: "text-surface-50",
|
|
64
|
-
},
|
|
65
|
-
width: {
|
|
66
|
-
type: String as () => CssClasses,
|
|
67
|
-
default: "w-60",
|
|
68
|
-
},
|
|
69
|
-
height: {
|
|
70
|
-
type: String as () => CssClasses,
|
|
71
|
-
default: "max-h-64 lg:max-h-[500px]",
|
|
72
|
-
},
|
|
73
|
-
ring: {
|
|
74
|
-
type: String as () => CssClasses,
|
|
75
|
-
default: "ring-[1px] ring-surface-500/30",
|
|
76
|
-
},
|
|
77
|
-
rounded: {
|
|
78
|
-
type: String as () => CssClasses,
|
|
79
|
-
default: "rounded-token",
|
|
80
|
-
},
|
|
81
|
-
roundedContainer: {
|
|
82
|
-
type: String as () => CssClasses,
|
|
83
|
-
default: "rounded-container-token",
|
|
84
|
-
},
|
|
85
|
-
buttonClasses: {
|
|
86
|
-
type: String as () => CssClasses,
|
|
87
|
-
default: "w-24",
|
|
88
|
-
},
|
|
46
|
+
text: {
|
|
47
|
+
type: String as () => CssClasses,
|
|
48
|
+
default: "text-surface-900-50-token",
|
|
89
49
|
},
|
|
90
|
-
setup(props) {
|
|
91
|
-
const { initializeTheme, loadTheme, themes, chosenTheme } = useTheme();
|
|
92
|
-
const { currentMode, MODE } = useDarkMode();
|
|
93
|
-
|
|
94
|
-
const showPopup = ref(false);
|
|
95
|
-
onMounted(() => {
|
|
96
|
-
initializeTheme();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
const cTransition = `transition-all duration-[200ms]`;
|
|
100
|
-
|
|
101
|
-
type OnKeyDownEvent = KeyboardEvent & { currentTarget: EventTarget & HTMLDivElement };
|
|
102
|
-
function onKeyDown(event: KeyboardEvent): void {
|
|
103
|
-
if (["Enter", "Space"].includes(event.code)) {
|
|
104
|
-
event.preventDefault();
|
|
105
|
-
(event as OnKeyDownEvent).currentTarget.click();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
50
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const classes = computed(() => {
|
|
118
|
-
return `${cTransition}
|
|
119
|
-
${background.value}
|
|
120
|
-
${text.value}
|
|
121
|
-
${props.width}
|
|
122
|
-
${props.ring}
|
|
123
|
-
${props.roundedContainer}`;
|
|
124
|
-
});
|
|
51
|
+
widthPopup: {
|
|
52
|
+
type: String as () => CssClasses,
|
|
53
|
+
default: "w-60",
|
|
54
|
+
},
|
|
55
|
+
heightList: {
|
|
56
|
+
type: String as () => CssClasses,
|
|
57
|
+
default: "max-h-64 lg:max-h-[500px]",
|
|
58
|
+
},
|
|
125
59
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
60
|
+
classButton: {
|
|
61
|
+
type: String as () => CssClasses,
|
|
62
|
+
default: "",
|
|
63
|
+
},
|
|
64
|
+
classList: {
|
|
65
|
+
type: String as () => CssClasses,
|
|
66
|
+
default: "",
|
|
67
|
+
},
|
|
68
|
+
classListItem: {
|
|
69
|
+
type: String as () => CssClasses,
|
|
70
|
+
default: "",
|
|
71
|
+
},
|
|
72
|
+
});
|
|
130
73
|
|
|
131
|
-
|
|
132
|
-
return `${cTransition}
|
|
133
|
-
${props.ring}
|
|
134
|
-
${props.rounded}`;
|
|
135
|
-
});
|
|
74
|
+
const { initializeTheme, loadTheme, themes, chosenTheme } = useTheme();
|
|
136
75
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
currentMode,
|
|
141
|
-
classes,
|
|
142
|
-
chosenTheme,
|
|
143
|
-
themes,
|
|
144
|
-
showPopup,
|
|
145
|
-
listClasses,
|
|
146
|
-
listItemClasses,
|
|
147
|
-
};
|
|
148
|
-
},
|
|
76
|
+
const showPopup = ref(false);
|
|
77
|
+
onMounted(() => {
|
|
78
|
+
initializeTheme();
|
|
149
79
|
});
|
|
150
80
|
</script>
|