@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.
Files changed (107) hide show
  1. package/README.md +1 -1
  2. package/dist/style.css +2 -2
  3. package/dist/types/components/VBootstrap.vue.d.ts +15 -0
  4. package/dist/types/components/atoms/VAvatar.vue.d.ts +37 -10
  5. package/dist/types/components/atoms/VBadge.vue.d.ts +22 -1
  6. package/dist/types/components/atoms/VButton.vue.d.ts +27 -0
  7. package/dist/types/components/atoms/VChip.vue.d.ts +22 -1
  8. package/dist/types/components/atoms/VRadio/VRadioGroup.vue.d.ts +10 -1
  9. package/dist/types/components/atoms/VRadio/VRadioItem.vue.d.ts +2 -2
  10. package/dist/types/components/atoms/VSwitch/VSwitch.vue.d.ts +24 -15
  11. package/dist/types/components/atoms/index.d.ts +1 -2
  12. package/dist/types/components/molecules/VAccordion/VAccordion.vue.d.ts +15 -6
  13. package/dist/types/components/molecules/VAccordion/VAccordionItem.vue.d.ts +11 -1
  14. package/dist/types/components/molecules/VAlert.vue.d.ts +39 -3
  15. package/dist/types/components/molecules/VCard/VCard.vue.d.ts +5 -5
  16. package/dist/types/components/molecules/VCard/VCardBody.vue.d.ts +13 -1
  17. package/dist/types/components/molecules/VCard/VCardFooter.vue.d.ts +22 -1
  18. package/dist/types/components/molecules/VCard/VCardHeader.vue.d.ts +22 -1
  19. package/dist/types/components/{atoms → molecules}/VCodeBlock.vue.d.ts +36 -9
  20. package/dist/types/components/molecules/VListbox/VListbox.vue.d.ts +51 -14
  21. package/dist/types/components/molecules/VListbox/VListboxItem.vue.d.ts +13 -3
  22. package/dist/types/components/molecules/VListbox/VListboxItems.vue.d.ts +9 -0
  23. package/dist/types/components/molecules/VTabs/VTab.vue.d.ts +9 -0
  24. package/dist/types/components/molecules/VTabs/VTabs.vue.d.ts +18 -0
  25. package/dist/types/components/molecules/index.d.ts +4 -3
  26. package/dist/types/props/index.d.ts +1 -0
  27. package/dist/types/props/props.d.ts +14 -0
  28. package/dist/types/services/index.d.ts +5 -3
  29. package/dist/types/services/settings.service.d.ts +132 -0
  30. package/dist/types/services/settings.service.test.d.ts +1 -0
  31. package/dist/types/types/index.d.ts +53 -0
  32. package/dist/types/utils/theme/theme-switcher.vue.d.ts +22 -62
  33. package/dist/vuetiful.es.mjs +981 -680
  34. package/dist/vuetiful.umd.js +21 -16
  35. package/package.json +1 -1
  36. package/src/components/VBootstrap.vue +62 -0
  37. package/src/components/atoms/VAvatar.test.ts +98 -28
  38. package/src/components/atoms/VAvatar.vue +46 -13
  39. package/src/components/atoms/VBadge.test.ts +10 -0
  40. package/src/components/atoms/VBadge.vue +13 -1
  41. package/src/components/atoms/VButton.test.ts +58 -0
  42. package/src/components/atoms/VButton.vue +31 -2
  43. package/src/components/atoms/VChip.test.ts +26 -11
  44. package/src/components/atoms/VChip.vue +13 -1
  45. package/src/components/atoms/VRadio/VRadioDescription.vue +1 -1
  46. package/src/components/atoms/VRadio/VRadioGroup.test.ts +7 -7
  47. package/src/components/atoms/VRadio/VRadioGroup.vue +16 -5
  48. package/src/components/atoms/VRadio/VRadioItem.vue +12 -8
  49. package/src/components/atoms/VRadio/VRadioLabel.vue +1 -1
  50. package/src/components/atoms/VSwitch/VSwitch.test.ts +20 -18
  51. package/src/components/atoms/VSwitch/VSwitch.vue +29 -17
  52. package/src/components/atoms/VSwitch/VSwitchDescription.vue +1 -1
  53. package/src/components/atoms/VSwitch/VSwitchGroup.vue +2 -2
  54. package/src/components/atoms/VSwitch/VSwitchLabel.vue +1 -1
  55. package/src/components/atoms/index.ts +0 -2
  56. package/src/components/molecules/VAccordion/VAccordion.test.ts +11 -0
  57. package/src/components/molecules/VAccordion/VAccordion.vue +16 -7
  58. package/src/components/molecules/VAccordion/VAccordionItem.test.ts +65 -16
  59. package/src/components/molecules/VAccordion/VAccordionItem.vue +53 -32
  60. package/src/components/molecules/VAlert.test.ts +11 -1
  61. package/src/components/molecules/VAlert.vue +33 -7
  62. package/src/components/molecules/VCard/VCard.test.ts +1 -1
  63. package/src/components/molecules/VCard/VCard.vue +12 -7
  64. package/src/components/molecules/VCard/VCardBody.test.ts +18 -0
  65. package/src/components/molecules/VCard/VCardBody.vue +16 -1
  66. package/src/components/molecules/VCard/VCardFooter.test.ts +18 -0
  67. package/src/components/molecules/VCard/VCardFooter.vue +21 -3
  68. package/src/components/molecules/VCard/VCardHeader.test.ts +18 -0
  69. package/src/components/molecules/VCard/VCardHeader.vue +26 -5
  70. package/src/components/molecules/VCodeBlock.test.ts +133 -0
  71. package/src/components/molecules/VCodeBlock.vue +120 -0
  72. package/src/components/molecules/VListbox/VListbox.test.ts +42 -15
  73. package/src/components/molecules/VListbox/VListbox.vue +44 -15
  74. package/src/components/molecules/VListbox/VListboxButton.test.ts +15 -6
  75. package/src/components/molecules/VListbox/VListboxButton.vue +10 -1
  76. package/src/components/molecules/VListbox/VListboxItem.test.ts +2 -2
  77. package/src/components/molecules/VListbox/VListboxItem.vue +18 -7
  78. package/src/components/molecules/VListbox/VListboxItems.test.ts +2 -2
  79. package/src/components/molecules/VListbox/VListboxItems.vue +18 -5
  80. package/src/components/molecules/VListbox/VListboxLabel.test.ts +1 -2
  81. package/src/components/molecules/VListbox/VListboxLabel.vue +1 -1
  82. package/src/components/molecules/VPreview.vue +9 -5
  83. package/src/components/molecules/{VRail.test.ts → VRail/VRail.test.ts} +1 -1
  84. package/src/components/molecules/{VRail.vue → VRail/VRail.vue} +6 -6
  85. package/src/components/molecules/VRail/VRailTile.test.ts +99 -0
  86. package/src/components/molecules/{VRailTile.vue → VRail/VRailTile.vue} +4 -6
  87. package/src/components/molecules/VTabs/VTab.test.ts +7 -3
  88. package/src/components/molecules/VTabs/VTab.vue +20 -5
  89. package/src/components/molecules/VTabs/VTabPanel.vue +2 -2
  90. package/src/components/molecules/VTabs/VTabs.test.ts +4 -2
  91. package/src/components/molecules/VTabs/VTabs.vue +32 -8
  92. package/src/components/molecules/index.ts +5 -2
  93. package/src/props/index.ts +1 -0
  94. package/src/props/props.ts +62 -0
  95. package/src/services/index.ts +5 -3
  96. package/src/services/settings.service.test.ts +17 -0
  97. package/src/services/settings.service.ts +136 -0
  98. package/src/types/index.ts +58 -0
  99. package/src/utils/theme/theme-switcher.vue +61 -131
  100. package/src/components/atoms/VCodeBlock.test.ts +0 -14
  101. package/src/components/atoms/VCodeBlock.vue +0 -92
  102. package/src/components/molecules/VRailTile.test.ts +0 -14
  103. /package/dist/types/components/{atoms → molecules}/VCodeBlock.test.d.ts +0 -0
  104. /package/dist/types/components/molecules/{VRail.test.d.ts → VRail/VRail.test.d.ts} +0 -0
  105. /package/dist/types/components/molecules/{VRail.vue.d.ts → VRail/VRail.vue.d.ts} +0 -0
  106. /package/dist/types/components/molecules/{VRailTile.test.d.ts → VRail/VRailTile.test.d.ts} +0 -0
  107. /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="cc-theme-switcher">
3
- <VButton :class="`cc-theme-switcher__button ${buttonClasses}`" @click="showPopup = !showPopup">
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
- </VButton>
8
+ </v-button>
6
9
 
7
10
  <div
8
11
  v-if="showPopup"
9
- class="cc-theme-switcher__popup absolute z-10 mt-1 p-4 shadow-xl"
10
- :class="classes"
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
- <div class="space-y-4">
13
- <section class="flex items-center justify-between">
14
- <h6>Mode</h6>
15
- <v-light-switch />
16
- </section>
17
- <nav class="list-nav -m-4 overflow-y-auto p-4" :class="listClasses">
18
- <ul class="flex flex-col gap-4">
19
- <li
20
- class="h-full w-full p-2 text-center capitalize hover:cursor-pointer hover:bg-primary-100 hover:text-primary-900"
21
- :class="`${listItemClasses} ${
22
- chosenTheme === theme.name
23
- ? 'bg-primary-50 text-primary-900'
24
- : 'bg-surface-200 text-surface-900'
25
- }`"
26
- v-for="(theme, index) in themes"
27
- :key="index"
28
- @click="loadTheme(theme.name)"
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, useDarkMode, useTheme, VButton, VLightSwitch } from "@/index";
41
- import { computed, defineComponent, onMounted, ref } from "vue";
37
+ <script setup lang="ts">
38
+ import { CssClasses, useTheme, VButton, VLightSwitch } from "@/index";
39
+ import { onMounted, ref } from "vue";
42
40
 
43
- export default defineComponent({
44
- components: {
45
- VLightSwitch,
46
- VButton,
41
+ defineProps({
42
+ background: {
43
+ type: String as () => CssClasses,
44
+ default: "bg-surface-50-900-token",
47
45
  },
48
- props: {
49
- bgLight: {
50
- type: String as () => CssClasses,
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
- const background = computed(() => {
110
- return currentMode.value === MODE.LIGHT ? props.bgLight : props.bgDark;
111
- });
112
-
113
- const text = computed(() => {
114
- return currentMode.value === MODE.LIGHT ? props.textOnLight : props.textOnDark;
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
- const listClasses = computed(() => {
127
- return `${cTransition}
128
- ${props.height}`;
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
- const listItemClasses = computed(() => {
132
- return `${cTransition}
133
- ${props.ring}
134
- ${props.rounded}`;
135
- });
74
+ const { initializeTheme, loadTheme, themes, chosenTheme } = useTheme();
136
75
 
137
- return {
138
- onKeyDown,
139
- loadTheme,
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
- });