@code-coaching/vuetiful 0.22.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/README.md +1 -1
- package/dist/style.css +2 -2
- package/dist/types/components/VBootstrap.vue.d.ts +15 -0
- package/dist/types/components/atoms/VAvatar.vue.d.ts +37 -10
- package/dist/types/components/atoms/VBadge.vue.d.ts +22 -1
- package/dist/types/components/atoms/VButton.vue.d.ts +27 -0
- package/dist/types/components/atoms/VChip.vue.d.ts +22 -1
- package/dist/types/components/atoms/VRadio/VRadioGroup.vue.d.ts +10 -1
- package/dist/types/components/atoms/VRadio/VRadioItem.vue.d.ts +2 -2
- package/dist/types/components/atoms/VSwitch/VSwitch.vue.d.ts +24 -15
- package/dist/types/components/atoms/index.d.ts +1 -2
- package/dist/types/components/molecules/VAccordion/VAccordion.vue.d.ts +15 -6
- package/dist/types/components/molecules/VAccordion/VAccordionItem.vue.d.ts +11 -1
- package/dist/types/components/molecules/VAlert.vue.d.ts +39 -3
- package/dist/types/components/molecules/VCard/VCard.vue.d.ts +5 -5
- package/dist/types/components/molecules/VCard/VCardBody.vue.d.ts +13 -1
- package/dist/types/components/molecules/VCard/VCardFooter.vue.d.ts +22 -1
- package/dist/types/components/molecules/VCard/VCardHeader.vue.d.ts +22 -1
- package/dist/types/components/{atoms → molecules}/VCodeBlock.vue.d.ts +36 -9
- package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +51 -14
- package/dist/types/components/molecules/VListbox/VListboxItem.vue.d.ts +13 -3
- package/dist/types/components/molecules/VListbox/VListboxItems.vue.d.ts +9 -0
- package/dist/types/components/molecules/VTabs/VTab.vue.d.ts +9 -0
- package/dist/types/components/molecules/VTabs/VTabs.vue.d.ts +18 -0
- package/dist/types/components/molecules/index.d.ts +4 -3
- package/dist/types/props/index.d.ts +1 -0
- package/dist/types/props/props.d.ts +14 -0
- package/dist/types/services/index.d.ts +5 -3
- package/dist/types/services/settings.service.d.ts +132 -0
- package/dist/types/services/settings.service.test.d.ts +1 -0
- package/dist/types/types/index.d.ts +53 -0
- package/dist/types/utils/theme/theme-switcher.vue.d.ts +22 -62
- package/dist/vuetiful.es.mjs +981 -680
- package/dist/vuetiful.umd.js +21 -16
- package/package.json +1 -1
- package/src/components/VBootstrap.vue +62 -0
- package/src/components/atoms/VAvatar.test.ts +98 -28
- package/src/components/atoms/VAvatar.vue +46 -13
- package/src/components/atoms/VBadge.test.ts +10 -0
- package/src/components/atoms/VBadge.vue +13 -1
- package/src/components/atoms/VButton.test.ts +58 -0
- package/src/components/atoms/VButton.vue +31 -2
- package/src/components/atoms/VChip.test.ts +26 -11
- package/src/components/atoms/VChip.vue +13 -1
- package/src/components/atoms/VRadio/VRadioDescription.vue +1 -1
- package/src/components/atoms/VRadio/VRadioGroup.test.ts +7 -7
- package/src/components/atoms/VRadio/VRadioGroup.vue +16 -5
- package/src/components/atoms/VRadio/VRadioItem.vue +12 -8
- package/src/components/atoms/VRadio/VRadioLabel.vue +1 -1
- package/src/components/atoms/VSwitch/VSwitch.test.ts +20 -18
- package/src/components/atoms/VSwitch/VSwitch.vue +29 -17
- package/src/components/atoms/VSwitch/VSwitchDescription.vue +1 -1
- package/src/components/atoms/VSwitch/VSwitchGroup.vue +2 -2
- package/src/components/atoms/VSwitch/VSwitchLabel.vue +1 -1
- package/src/components/atoms/index.ts +0 -2
- package/src/components/molecules/VAccordion/VAccordion.test.ts +11 -0
- package/src/components/molecules/VAccordion/VAccordion.vue +16 -7
- package/src/components/molecules/VAccordion/VAccordionItem.test.ts +65 -16
- package/src/components/molecules/VAccordion/VAccordionItem.vue +53 -32
- package/src/components/molecules/VAlert.test.ts +11 -1
- package/src/components/molecules/VAlert.vue +33 -7
- package/src/components/molecules/VCard/VCard.test.ts +1 -1
- package/src/components/molecules/VCard/VCard.vue +12 -7
- package/src/components/molecules/VCard/VCardBody.test.ts +18 -0
- package/src/components/molecules/VCard/VCardBody.vue +16 -1
- package/src/components/molecules/VCard/VCardFooter.test.ts +18 -0
- package/src/components/molecules/VCard/VCardFooter.vue +21 -3
- package/src/components/molecules/VCard/VCardHeader.test.ts +18 -0
- package/src/components/molecules/VCard/VCardHeader.vue +26 -5
- package/src/components/molecules/VCodeBlock.test.ts +133 -0
- package/src/components/molecules/VCodeBlock.vue +120 -0
- package/src/components/molecules/VListbox/VListbox.test.ts +42 -15
- package/src/components/molecules/VListbox/VListbox.vue +44 -15
- package/src/components/molecules/VListbox/VListboxButton.test.ts +15 -6
- package/src/components/molecules/VListbox/VListboxButton.vue +10 -1
- package/src/components/molecules/VListbox/VListboxItem.test.ts +2 -2
- package/src/components/molecules/VListbox/VListboxItem.vue +18 -7
- package/src/components/molecules/VListbox/VListboxItems.test.ts +2 -2
- package/src/components/molecules/VListbox/VListboxItems.vue +18 -5
- package/src/components/molecules/VListbox/VListboxLabel.test.ts +1 -2
- package/src/components/molecules/VListbox/VListboxLabel.vue +1 -1
- package/src/components/molecules/VPreview.vue +9 -5
- package/src/components/molecules/{VRail.test.ts → VRail/VRail.test.ts} +1 -1
- package/src/components/molecules/{VRail.vue → VRail/VRail.vue} +6 -6
- package/src/components/molecules/VRail/VRailTile.test.ts +99 -0
- package/src/components/molecules/{VRailTile.vue → VRail/VRailTile.vue} +4 -6
- package/src/components/molecules/VTabs/VTab.test.ts +7 -3
- package/src/components/molecules/VTabs/VTab.vue +20 -5
- package/src/components/molecules/VTabs/VTabPanel.vue +2 -2
- package/src/components/molecules/VTabs/VTabs.test.ts +4 -2
- package/src/components/molecules/VTabs/VTabs.vue +32 -8
- package/src/components/molecules/index.ts +5 -2
- package/src/props/index.ts +1 -0
- package/src/props/props.ts +62 -0
- package/src/services/index.ts +5 -3
- package/src/services/settings.service.test.ts +17 -0
- package/src/services/settings.service.ts +136 -0
- package/src/types/index.ts +58 -0
- package/src/utils/theme/theme-switcher.vue +61 -131
- package/src/components/atoms/VCodeBlock.test.ts +0 -14
- package/src/components/atoms/VCodeBlock.vue +0 -92
- package/src/components/molecules/VRailTile.test.ts +0 -14
- /package/dist/types/components/{atoms → molecules}/VCodeBlock.test.d.ts +0 -0
- /package/dist/types/components/molecules/{VRail.test.d.ts → VRail/VRail.test.d.ts} +0 -0
- /package/dist/types/components/molecules/{VRail.vue.d.ts → VRail/VRail.vue.d.ts} +0 -0
- /package/dist/types/components/molecules/{VRailTile.test.d.ts → VRail/VRailTile.test.d.ts} +0 -0
- /package/dist/types/components/molecules/{VRailTile.vue.d.ts → VRail/VRailTile.vue.d.ts} +0 -0
|
@@ -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>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { expect, test } from "vitest";
|
|
3
|
-
import { VCodeBlock } from ".";
|
|
4
|
-
|
|
5
|
-
test("VCodeBlock", () => {
|
|
6
|
-
expect(VCodeBlock).toBeTruthy();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// TODO: add tests
|
|
10
|
-
test("VCodeBlock using slot", () => {
|
|
11
|
-
const wrapper = mount(VCodeBlock);
|
|
12
|
-
|
|
13
|
-
expect(wrapper).toBeTruthy();
|
|
14
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { CssClasses, VButton, vClipboard } from "@/index";
|
|
3
|
-
import { useHighlight } from "@/services/highlight.service";
|
|
4
|
-
import "highlight.js/styles/github-dark.css";
|
|
5
|
-
import { ref } from "vue";
|
|
6
|
-
|
|
7
|
-
const { highlight } = useHighlight();
|
|
8
|
-
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
language: {
|
|
11
|
-
type: String,
|
|
12
|
-
default: "plaintext",
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: String,
|
|
16
|
-
default: "",
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
preventOverflow: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: false,
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
headerClass: {
|
|
25
|
-
type: String as () => CssClasses,
|
|
26
|
-
default: "",
|
|
27
|
-
},
|
|
28
|
-
preClass: {
|
|
29
|
-
type: String as () => CssClasses,
|
|
30
|
-
default: "",
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
buttonClass: {
|
|
34
|
-
type: String as () => CssClasses,
|
|
35
|
-
default: "btn-sm",
|
|
36
|
-
},
|
|
37
|
-
buttonText: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "Copy",
|
|
40
|
-
},
|
|
41
|
-
buttonCopiedText: {
|
|
42
|
-
type: String,
|
|
43
|
-
default: "👍",
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const emit = defineEmits<{
|
|
48
|
-
(event: "copy"): void;
|
|
49
|
-
}>();
|
|
50
|
-
|
|
51
|
-
const copyState = ref(false);
|
|
52
|
-
|
|
53
|
-
// Allow shorthand alias, but show full text in UI
|
|
54
|
-
function languageFormatter(lang: string): string {
|
|
55
|
-
if (lang === "js") return "javascript";
|
|
56
|
-
if (lang === "ts") return "typescript";
|
|
57
|
-
if (["sh", "bash", "zsh", "shell"].includes(lang)) return "console";
|
|
58
|
-
return lang;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function onCopyClick() {
|
|
62
|
-
copyState.value = true;
|
|
63
|
-
setTimeout(() => {
|
|
64
|
-
copyState.value = false;
|
|
65
|
-
}, 2000);
|
|
66
|
-
emit("copy");
|
|
67
|
-
}
|
|
68
|
-
</script>
|
|
69
|
-
|
|
70
|
-
<template v-if="language && code">
|
|
71
|
-
<div
|
|
72
|
-
class="code-block max-w-full bg-neutral-900/90 text-sm text-white shadow rounded-container-token"
|
|
73
|
-
>
|
|
74
|
-
<header
|
|
75
|
-
:class="`code-block-header flex items-center justify-between p-2 pb-0 pl-4 text-xs uppercase text-white/50 ${headerClass}`"
|
|
76
|
-
>
|
|
77
|
-
<span :class="`code-block-language`">{{ languageFormatter(language) }}</span>
|
|
78
|
-
<v-button
|
|
79
|
-
:class="`code-block-btn ${buttonClass}`"
|
|
80
|
-
@click="onCopyClick()"
|
|
81
|
-
v-clipboard="props.code"
|
|
82
|
-
>
|
|
83
|
-
{{ !copyState ? buttonText : buttonCopiedText }}
|
|
84
|
-
</v-button>
|
|
85
|
-
</header>
|
|
86
|
-
<pre
|
|
87
|
-
:class="`code-block-pre ${
|
|
88
|
-
preventOverflow ? 'whitespace-pre-wrap break-all' : 'overflow-auto'
|
|
89
|
-
} p-4 pt-1 ${preClass}`"
|
|
90
|
-
><code :class="`code-block-code language-${language}`" v-html="highlight(props.code, props.language)"></code></pre>
|
|
91
|
-
</div>
|
|
92
|
-
</template>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { expect, test } from "vitest";
|
|
3
|
-
import { VRailTile } from ".";
|
|
4
|
-
|
|
5
|
-
test("VRailTile", () => {
|
|
6
|
-
expect(VRailTile).toBeTruthy();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// TODO: add tests
|
|
10
|
-
test("VRailTile using slot", () => {
|
|
11
|
-
const wrapper = mount(VRailTile);
|
|
12
|
-
|
|
13
|
-
expect(wrapper).toBeTruthy();
|
|
14
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|