srcdev-nuxt-components 0.0.17 → 0.0.18

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 (35) hide show
  1. package/assets/styles/forms/index.css +2 -0
  2. package/assets/styles/forms/themes/_error.css +63 -0
  3. package/assets/styles/forms/themes/_ghost.css +63 -0
  4. package/assets/styles/forms/themes/_primary.css +67 -0
  5. package/assets/styles/forms/themes/_secondary.css +63 -0
  6. package/assets/styles/forms/themes/_success.css +63 -0
  7. package/assets/styles/forms/themes/_tertiary.css +63 -0
  8. package/assets/styles/forms/themes/_warning.css +63 -0
  9. package/assets/styles/forms/themes/index.css +7 -0
  10. package/assets/styles/forms/variables/_theme.css +69 -0
  11. package/assets/styles/forms/variables/index.css +1 -0
  12. package/assets/styles/main.css +4 -0
  13. package/assets/styles/typography/index.css +2 -0
  14. package/assets/styles/typography/utils/_font-classes.css +160 -0
  15. package/assets/styles/typography/utils/_weights.css +69 -0
  16. package/assets/styles/typography/utils/index.css +2 -0
  17. package/assets/styles/typography/variables/_colors.css +14 -0
  18. package/assets/styles/typography/variables/_reponsive-font-size.css +10 -0
  19. package/assets/styles/typography/variables/index.css +2 -0
  20. package/assets/styles/utils/_margin-helpers.css +308 -0
  21. package/assets/styles/utils/_padding-helpers.css +308 -0
  22. package/assets/styles/utils/_page.css +23 -0
  23. package/assets/styles/utils/index.css +3 -0
  24. package/assets/styles/variables/colors/_blue.css +15 -0
  25. package/assets/styles/variables/colors/_gray.css +16 -0
  26. package/assets/styles/variables/colors/_green.css +15 -0
  27. package/assets/styles/variables/colors/_orange.css +15 -0
  28. package/assets/styles/variables/colors/_red.css +15 -0
  29. package/assets/styles/variables/colors/_yellow.css +15 -0
  30. package/assets/styles/variables/colors/colors.css +6 -0
  31. package/assets/styles/variables/index.css +1 -0
  32. package/components/presentation/tabs/Tabs.vue +99 -0
  33. package/composables/useNavDecoration.ts +132 -0
  34. package/nuxt.config.ts +1 -0
  35. package/package.json +3 -2
@@ -0,0 +1,308 @@
1
+ /* Padding */
2
+ .p-0 {
3
+ padding: 0;
4
+ }
5
+ .pbs-0 {
6
+ padding-block-start: 0;
7
+ }
8
+ .pbe-0 {
9
+ padding-block-end: 0;
10
+ }
11
+ .pis-0 {
12
+ padding-inline-start: 0;
13
+ }
14
+ .pie-0 {
15
+ padding-inline-end: 0;
16
+ }
17
+ .pi-0 {
18
+ padding-inline: 0;
19
+ }
20
+ .pb-0 {
21
+ padding-block: 0;
22
+ }
23
+
24
+ .p-1 {
25
+ padding: 1px;
26
+ }
27
+ .pbs-1 {
28
+ padding-block-start: 1px;
29
+ }
30
+ .pbe-1 {
31
+ padding-block-end: 1px;
32
+ }
33
+ .pis-1 {
34
+ padding-inline-start: 1px;
35
+ }
36
+ .pie-1 {
37
+ padding-inline-end: 1px;
38
+ }
39
+ .pi-1 {
40
+ padding-inline: 1px;
41
+ }
42
+ .pb-1 {
43
+ padding-block: 1px;
44
+ }
45
+
46
+ .p-2 {
47
+ padding: 2px;
48
+ }
49
+ .pbs-2 {
50
+ padding-block-start: 2px;
51
+ }
52
+ .pbe-2 {
53
+ padding-block-end: 2px;
54
+ }
55
+ .pis-2 {
56
+ padding-inline-start: 2px;
57
+ }
58
+ .pie-2 {
59
+ padding-inline-end: 2px;
60
+ }
61
+ .pi-2 {
62
+ padding-inline: 2px;
63
+ }
64
+ .pb-2 {
65
+ padding-block: 2px;
66
+ }
67
+
68
+ .p-4 {
69
+ padding: 4px;
70
+ }
71
+ .pbs-4 {
72
+ padding-block-start: 4px;
73
+ }
74
+ .pbe-4 {
75
+ padding-block-end: 4px;
76
+ }
77
+ .pis-4 {
78
+ padding-inline-start: 4px;
79
+ }
80
+ .pie-4 {
81
+ padding-inline-end: 4px;
82
+ }
83
+ .pi-4 {
84
+ padding-inline: 4px;
85
+ }
86
+ .pb-4 {
87
+ padding-block: 4px;
88
+ }
89
+
90
+ .p-6 {
91
+ padding: 6px;
92
+ }
93
+ .pbs-6 {
94
+ padding-block-start: 6px;
95
+ }
96
+ .pbe-6 {
97
+ padding-block-end: 6px;
98
+ }
99
+ .pis-6 {
100
+ padding-inline-start: 6px;
101
+ }
102
+ .pie-6 {
103
+ padding-inline-end: 6px;
104
+ }
105
+ .pi-6 {
106
+ padding-inline: 6px;
107
+ }
108
+ .pb-6 {
109
+ padding-block: 6px;
110
+ }
111
+
112
+ .p-8 {
113
+ padding: 8px;
114
+ }
115
+ .pbs-8 {
116
+ padding-block-start: 8px;
117
+ }
118
+ .pbe-8 {
119
+ padding-block-end: 8px;
120
+ }
121
+ .pis-8 {
122
+ padding-inline-start: 8px;
123
+ }
124
+ .pie-8 {
125
+ padding-inline-end: 8px;
126
+ }
127
+ .pi-8 {
128
+ padding-inline: 8px;
129
+ }
130
+ .pb-8 {
131
+ padding-block: 8px;
132
+ }
133
+
134
+ .p-10 {
135
+ padding: 10px;
136
+ }
137
+ .pbs-10 {
138
+ padding-block-start: 10px;
139
+ }
140
+ .pbe-10 {
141
+ padding-block-end: 10px;
142
+ }
143
+ .pis-10 {
144
+ padding-inline-start: 10px;
145
+ }
146
+ .pie-10 {
147
+ padding-inline-end: 10px;
148
+ }
149
+ .pi-10 {
150
+ padding-inline: 10px;
151
+ }
152
+ .pb-10 {
153
+ padding-block: 10px;
154
+ }
155
+
156
+ .p-12 {
157
+ padding: 12px;
158
+ }
159
+ .pbs-12 {
160
+ padding-block-start: 12px;
161
+ }
162
+ .pbe-12 {
163
+ padding-block-end: 12px;
164
+ }
165
+ .pis-12 {
166
+ padding-inline-start: 12px;
167
+ }
168
+ .pie-12 {
169
+ padding-inline-end: 12px;
170
+ }
171
+ .pi-12 {
172
+ padding-inline: 12px;
173
+ }
174
+ .pb-12 {
175
+ padding-block: 12px;
176
+ }
177
+
178
+ .p-18 {
179
+ padding: 18px;
180
+ }
181
+ .pbs-18 {
182
+ padding-block-start: 18px;
183
+ }
184
+ .pbe-18 {
185
+ padding-block-end: 18px;
186
+ }
187
+ .pis-18 {
188
+ padding-inline-start: 18px;
189
+ }
190
+ .pie-18 {
191
+ padding-inline-end: 18px;
192
+ }
193
+ .pi-18 {
194
+ padding-inline: 18px;
195
+ }
196
+ .pb-18 {
197
+ padding-block: 18px;
198
+ }
199
+
200
+ .p-20 {
201
+ padding: 20px;
202
+ }
203
+ .pbs-20 {
204
+ padding-block-start: 20px;
205
+ }
206
+ .pbe-20 {
207
+ padding-block-end: 20px;
208
+ }
209
+ .pis-20 {
210
+ padding-inline-start: 20px;
211
+ }
212
+ .pie-20 {
213
+ padding-inline-end: 20px;
214
+ }
215
+ .pi-20 {
216
+ padding-inline: 20px;
217
+ }
218
+ .pb-20 {
219
+ padding-block: 20px;
220
+ }
221
+
222
+ .p-24 {
223
+ padding: 24px;
224
+ }
225
+ .pbs-24 {
226
+ padding-block-start: 24px;
227
+ }
228
+ .pbe-24 {
229
+ padding-block-end: 24px;
230
+ }
231
+ .pis-24 {
232
+ padding-inline-start: 24px;
233
+ }
234
+ .pie-24 {
235
+ padding-inline-end: 24px;
236
+ }
237
+ .pi-24 {
238
+ padding-inline: 24px;
239
+ }
240
+ .pb-24 {
241
+ padding-block: 24px;
242
+ }
243
+
244
+ .p-32 {
245
+ padding: 32px;
246
+ }
247
+ .pbs-32 {
248
+ padding-block-start: 32px;
249
+ }
250
+ .pbe-32 {
251
+ padding-block-end: 32px;
252
+ }
253
+ .pis-32 {
254
+ padding-inline-start: 32px;
255
+ }
256
+ .pie-32 {
257
+ padding-inline-end: 32px;
258
+ }
259
+ .pi-32 {
260
+ padding-inline: 32px;
261
+ }
262
+ .pb-32 {
263
+ padding-block: 32px;
264
+ }
265
+
266
+ .p-40 {
267
+ padding: 40px;
268
+ }
269
+ .pbs-40 {
270
+ padding-block-start: 40px;
271
+ }
272
+ .pbe-40 {
273
+ padding-block-end: 40px;
274
+ }
275
+ .pis-40 {
276
+ padding-inline-start: 40px;
277
+ }
278
+ .pie-40 {
279
+ padding-inline-end: 40px;
280
+ }
281
+ .pi-40 {
282
+ padding-inline: 40px;
283
+ }
284
+ .pb-40 {
285
+ padding-block: 40px;
286
+ }
287
+
288
+ .p-60 {
289
+ padding: 60px;
290
+ }
291
+ .pbs-60 {
292
+ padding-block-start: 60px;
293
+ }
294
+ .pbe-60 {
295
+ padding-block-end: 60px;
296
+ }
297
+ .pis-60 {
298
+ padding-inline-start: 60px;
299
+ }
300
+ .pie-60 {
301
+ padding-inline-end: 60px;
302
+ }
303
+ .pi-60 {
304
+ padding-inline: 60px;
305
+ }
306
+ .pb-60 {
307
+ padding-block: 60px;
308
+ }
@@ -0,0 +1,23 @@
1
+ :root {
2
+ color-scheme: light dark;
3
+ }
4
+
5
+ html {
6
+ /* background-color: var(--body-background-color); */
7
+ background-color: var(--page-bg);
8
+
9
+ font-size: 62.5%;
10
+ }
11
+ body,
12
+ p,
13
+ pre,
14
+ code,
15
+ div,
16
+ fieldset,
17
+ legend,
18
+ li,
19
+ a {
20
+ color: var(--grayscale-text-body);
21
+ font-family: var(--font-family);
22
+ font-size: var(--step-1);
23
+ }
@@ -0,0 +1,3 @@
1
+ @import './_page.css';
2
+ @import './_margin-helpers.css';
3
+ @import './_padding-helpers.css';
@@ -0,0 +1,15 @@
1
+ :root {
2
+ --blue-0: #e7f5ff;
3
+ --blue-1: #d0ebff;
4
+ --blue-2: #a5d8ff;
5
+ --blue-3: #74c0fc;
6
+ --blue-4: #4dabf7;
7
+ --blue-5: #339af0;
8
+ --blue-6: #228be6;
9
+ --blue-7: #1c7ed6;
10
+ --blue-8: #1971c2;
11
+ --blue-9: #1864ab;
12
+ --blue-10: #145591;
13
+ --blue-11: #114678;
14
+ --blue-12: #0e01cd;
15
+ }
@@ -0,0 +1,16 @@
1
+ :root {
2
+ --gray-00: #ffffff;
3
+ --gray-0: #f8f9fa;
4
+ --gray-1: #f1f3f5;
5
+ --gray-2: #e9ecef;
6
+ --gray-3: #dee2e6;
7
+ --gray-4: #ced4da;
8
+ --gray-5: #adb5bd;
9
+ --gray-6: #868e96;
10
+ --gray-7: #495057;
11
+ --gray-8: #343a40;
12
+ --gray-9: #212529;
13
+ --gray-10: #16191d;
14
+ --gray-11: #0d0f12;
15
+ --gray-12: #030507;
16
+ }
@@ -0,0 +1,15 @@
1
+ :root {
2
+ --green-0: #ebfbee;
3
+ --green-1: #d3f9d8;
4
+ --green-2: #b2f2bb;
5
+ --green-3: #8ce99a;
6
+ --green-4: #69db7c;
7
+ --green-5: #51cf66;
8
+ --green-6: #40c057;
9
+ --green-7: #37b24d;
10
+ --green-8: #2f9e44;
11
+ --green-9: #2b8a3e;
12
+ --green-10: #237032;
13
+ --green-11: #1b5727;
14
+ --green-12: #017f18;
15
+ }
@@ -0,0 +1,15 @@
1
+ :root {
2
+ --orange-0: #fff4e6;
3
+ --orange-1: #ffe8cc;
4
+ --orange-2: #ffd8a8;
5
+ --orange-3: #ffc078;
6
+ --orange-4: #ffa94d;
7
+ --orange-5: #ff922b;
8
+ --orange-6: #ff7400;
9
+ --orange-7: #f76707;
10
+ --orange-8: #e8590c;
11
+ --orange-9: #d9480f;
12
+ --orange-10: #bf400d;
13
+ --orange-11: #99330b;
14
+ --orange-12: #c23903;
15
+ }
@@ -0,0 +1,15 @@
1
+ :root {
2
+ --red-0: #fff5f5;
3
+ --red-1: #ffe3e3;
4
+ --red-2: #ffc9c9;
5
+ --red-3: #ffa8a8;
6
+ --red-4: #ff8787;
7
+ --red-5: #ff6b6b;
8
+ --red-6: #fa5252;
9
+ --red-7: #f03e3e;
10
+ --red-8: #e03131;
11
+ --red-9: #ff0b0b;
12
+ --red-10: #b02525;
13
+ --red-11: #962020;
14
+ --red-12: #cc0000;
15
+ }
@@ -0,0 +1,15 @@
1
+ :root {
2
+ --yellow-0: #fff9db;
3
+ --yellow-1: #fff3bf;
4
+ --yellow-2: #ffec99;
5
+ --yellow-3: #ffe066;
6
+ --yellow-4: #ffd43b;
7
+ --yellow-5: #fcc419;
8
+ --yellow-6: #fab005;
9
+ --yellow-7: #f59f00;
10
+ --yellow-8: #f08c00;
11
+ --yellow-9: #e67700;
12
+ --yellow-10: #b35c00;
13
+ --yellow-11: #804200;
14
+ --yellow-12: #663500;
15
+ }
@@ -0,0 +1,6 @@
1
+ @import './_red.css';
2
+ @import './_green.css';
3
+ @import './_blue.css';
4
+ @import './_orange.css';
5
+ @import './_gray.css';
6
+ @import './_yellow.css';
@@ -0,0 +1 @@
1
+ @import './colors/colors.css';
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <div role="tablist" aria-labelledby="channel-name" ref="navContainerRef" @mouseleave="resetHoverToActivePosition()">
3
+ <button @click.prevent="navItemClicked($event)" @mouseover="navItemHovered($event)" data-tab-index="1" data-nav-item role="tab" aria-selected="true">Home</button>
4
+ <button @click.prevent="navItemClicked($event)" @mouseover="navItemHovered($event)" data-tab-index="2" data-nav-item role="tab" aria-selected="false">Functional Components</button>
5
+ <button @click.prevent="navItemClicked($event)" @mouseover="navItemHovered($event)" data-tab-index="3" data-nav-item role="tab" aria-selected="false">Static UI Components</button>
6
+ <button @click.prevent="navItemClicked($event)" @mouseover="navItemHovered($event)" data-tab-index="4" data-nav-item role="tab" aria-selected="false">Example Form</button>
7
+ <button @click.prevent="navItemClicked($event)" @mouseover="navItemHovered($event)" data-tab-index="5" data-nav-item role="tab" aria-selected="false">Buttons</button>
8
+ <button @click.prevent="navItemClicked($event)" @mouseover="navItemHovered($event)" data-tab-index="6" data-nav-item role="tab" aria-selected="false">Typography</button>
9
+ </div>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ const navContainerRef = ref<HTMLElement | null>(null);
14
+
15
+ const { initNavDecorators, navItemClicked, navItemHovered, resetHoverToActivePosition } = useNavDecoration(navContainerRef);
16
+
17
+ onMounted(() => {
18
+ initNavDecorators();
19
+ });
20
+ </script>
21
+
22
+ <style lang="css">
23
+ [role='tablist'] {
24
+ position: relative;
25
+ display: flex;
26
+ width: fit-content;
27
+ border-bottom: 1px solid hsl(0 0% 30%);
28
+ margin-block: 3rem;
29
+ z-index: 1;
30
+ }
31
+
32
+ [role='tablist'] .nav__hovered {
33
+ content: '';
34
+ position: absolute;
35
+ left: 0;
36
+ right: 0;
37
+ bottom: 0;
38
+ top: 0;
39
+ scale: var(--_width-hovered, 0.125) 1;
40
+ translate: var(--_left-hovered, 0) 0;
41
+ transform-origin: left;
42
+ transition: scale var(--_transition-duration), translate var(--_transition-duration);
43
+ background: green;
44
+ z-index: 1;
45
+ }
46
+
47
+ [role='tablist'] .nav__active {
48
+ content: '';
49
+ position: absolute;
50
+ left: 0;
51
+ right: 0;
52
+ bottom: 0;
53
+ top: 0;
54
+ scale: var(--_width-active, 0.125) 1;
55
+ translate: var(--_left-active, 0) 0;
56
+ transform-origin: left;
57
+ transition: scale var(--_transition-duration), translate var(--_transition-duration);
58
+ background: lightseagreen;
59
+ z-index: 2;
60
+ }
61
+
62
+ [role='tablist'] .nav__active-indicator {
63
+ content: '';
64
+ position: absolute;
65
+ left: 0;
66
+ right: 0;
67
+ bottom: 0;
68
+ height: 4px;
69
+ scale: var(--_width-active, 0.125) 1;
70
+ translate: var(--_left-active, 0) 0;
71
+ transform-origin: left;
72
+ transition: scale var(--_transition-duration), translate var(--_transition-duration);
73
+ background: white;
74
+ z-index: 3;
75
+ }
76
+
77
+ [role='tab'] {
78
+ color: #fff;
79
+ background: lightblue;
80
+ background: transparent;
81
+ padding: 1em 2em;
82
+ border: 0;
83
+ font: inherit;
84
+ text-transform: uppercase;
85
+ font-weight: 500;
86
+ opacity: 0.7;
87
+ cursor: pointer;
88
+ position: relative;
89
+ z-index: 4;
90
+ }
91
+
92
+ [role='tab']:hover {
93
+ opacity: 1;
94
+ }
95
+
96
+ [role='tab'][aria-selected='true'] {
97
+ opacity: 1;
98
+ }
99
+ </style>
@@ -0,0 +1,132 @@
1
+ import { useResizeObserver } from '@vueuse/core';
2
+
3
+ const useNavDecoration = (navContainerRef: Ref<HTMLElement | null>, duration: number = 200) => {
4
+ const navItems = ref<HTMLElement[] | null>(null);
5
+ const previousActiveTab = ref<HTMLElement>();
6
+ const currentActiveTab = ref<HTMLElement>();
7
+
8
+ const previousHoveredTab = ref<HTMLElement>();
9
+ const currentHoveredTab = ref<HTMLElement>();
10
+
11
+ const initNavDecorators = () => {
12
+ navItems.value = navContainerRef.value ? (Array.from(navContainerRef.value.querySelectorAll('[data-nav-item')) as HTMLElement[]) : [];
13
+ previousActiveTab.value = navItems.value[0];
14
+ currentActiveTab.value = navItems.value[0];
15
+ previousHoveredTab.value = navItems.value[0];
16
+ currentHoveredTab.value = navItems.value[0];
17
+
18
+ addNavDecorators();
19
+ };
20
+
21
+ const addNavDecorators = () => {
22
+ const elementClasses = ['nav__active-indicator', 'nav__active', 'nav__hovered'];
23
+ if (navContainerRef.value) {
24
+ for (let i = 0; i < 3; i++) {
25
+ const div = document.createElement('div');
26
+ div.classList.add(elementClasses[i]);
27
+ navContainerRef.value.appendChild(div);
28
+ }
29
+ }
30
+ };
31
+
32
+ const navItemHovered = (event: Event) => {
33
+ const target = event.target as HTMLElement;
34
+ const newTabPosition = currentHoveredTab.value ? currentHoveredTab.value.compareDocumentPosition(target) : 0;
35
+
36
+ if (newTabPosition !== 0) {
37
+ previousHoveredTab.value = currentHoveredTab.value;
38
+ currentHoveredTab.value = target;
39
+ moveHoveredIndicator();
40
+ }
41
+ };
42
+
43
+ const resetHoverToActivePosition = () => {
44
+ previousHoveredTab.value = currentHoveredTab.value;
45
+ currentHoveredTab.value = currentActiveTab.value;
46
+ moveHoveredIndicator();
47
+ };
48
+
49
+ const navItemClicked = (event: Event) => {
50
+ const target = event.target as HTMLElement;
51
+
52
+ previousActiveTab.value = currentActiveTab.value;
53
+ currentActiveTab.value = target;
54
+
55
+ navItems.value?.forEach((tab) => {
56
+ tab.setAttribute('aria-selected', currentActiveTab.value === tab ? 'true' : 'false');
57
+ });
58
+
59
+ moveActiveIndicator();
60
+ };
61
+
62
+ const setFinalHoveredPositions = (resized: boolean = false) => {
63
+ const setDuration = resized ? 0 : duration;
64
+ const newTabWidth = currentHoveredTab.value && navContainerRef.value ? currentHoveredTab.value.offsetWidth / navContainerRef.value.offsetWidth : 0;
65
+ navContainerRef.value?.style.setProperty('--_transition-duration', setDuration + 'ms');
66
+ navContainerRef.value?.style.setProperty('--_left-hovered', currentHoveredTab.value?.offsetLeft + 'px');
67
+ navContainerRef.value?.style.setProperty('--_width-hovered', newTabWidth?.toString());
68
+ };
69
+
70
+ const setFinalActivePositions = (resized: boolean = false) => {
71
+ const setDuration = resized ? 0 : duration;
72
+ const newTabWidth = currentActiveTab.value && navContainerRef.value ? currentActiveTab.value.offsetWidth / navContainerRef.value.offsetWidth : 0;
73
+ navContainerRef.value?.style.setProperty('--_transition-duration', setDuration + 'ms');
74
+ navContainerRef.value?.style.setProperty('--_left-active', currentActiveTab.value?.offsetLeft + 'px');
75
+ navContainerRef.value?.style.setProperty('--_width-active', newTabWidth?.toString());
76
+ };
77
+
78
+ const moveActiveIndicator = () => {
79
+ navContainerRef.value?.style.setProperty('--_transition-duration', duration + 'ms');
80
+
81
+ const newTabPosition = previousActiveTab.value && currentActiveTab.value ? previousActiveTab.value.compareDocumentPosition(currentActiveTab.value) : 0;
82
+ let transitionWidth;
83
+
84
+ if (newTabPosition === 4) {
85
+ transitionWidth = currentActiveTab.value && previousActiveTab.value ? currentActiveTab.value.offsetLeft + currentActiveTab.value.offsetWidth - previousActiveTab.value.offsetLeft : 0;
86
+ } else {
87
+ transitionWidth = previousActiveTab.value && currentActiveTab.value ? previousActiveTab.value.offsetLeft + previousActiveTab.value.offsetWidth - currentActiveTab.value.offsetLeft : 0;
88
+ navContainerRef.value?.style.setProperty('--_left-active', currentActiveTab.value ? currentActiveTab.value.offsetLeft + 'px' : '0');
89
+ }
90
+
91
+ navContainerRef.value?.style.setProperty('--_width-active', String(transitionWidth / navContainerRef.value.offsetWidth));
92
+
93
+ setTimeout(() => {
94
+ setFinalActivePositions();
95
+ }, Math.floor(duration + 20));
96
+ };
97
+
98
+ const moveHoveredIndicator = () => {
99
+ navContainerRef.value?.style.setProperty('--_transition-duration', duration + 'ms');
100
+
101
+ const newTabPosition = previousHoveredTab.value && currentHoveredTab.value ? previousHoveredTab.value.compareDocumentPosition(currentHoveredTab.value) : 0;
102
+ let transitionWidth;
103
+
104
+ if (newTabPosition === 4) {
105
+ transitionWidth = currentHoveredTab.value && previousHoveredTab.value ? currentHoveredTab.value.offsetLeft + currentHoveredTab.value.offsetWidth - previousHoveredTab.value.offsetLeft : 0;
106
+ } else {
107
+ transitionWidth = previousHoveredTab.value && currentHoveredTab.value ? previousHoveredTab.value.offsetLeft + previousHoveredTab.value.offsetWidth - currentHoveredTab.value.offsetLeft : 0;
108
+ navContainerRef.value?.style.setProperty('--_left-hovered', currentHoveredTab.value ? currentHoveredTab.value.offsetLeft + 'px' : '0');
109
+ }
110
+
111
+ navContainerRef.value?.style.setProperty('--_width-hovered', String(transitionWidth / navContainerRef.value.offsetWidth));
112
+
113
+ setTimeout(() => {
114
+ setFinalHoveredPositions();
115
+ }, Math.floor(duration + 20));
116
+ };
117
+
118
+ useResizeObserver(navContainerRef, () => {
119
+ setFinalActivePositions(true);
120
+ setFinalHoveredPositions(true);
121
+ });
122
+
123
+ return {
124
+ initNavDecorators,
125
+ navContainerRef,
126
+ navItemClicked,
127
+ navItemHovered,
128
+ resetHoverToActivePosition,
129
+ };
130
+ };
131
+
132
+ export default useNavDecoration;
package/nuxt.config.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // https://nuxt.com/docs/api/configuration/nuxt-config
2
2
  export default defineNuxtConfig({
3
3
  devtools: { enabled: true },
4
+ css: ['modern-normalize', './assets/styles/main.css'],
4
5
  app: {
5
6
  head: {
6
7
  htmlAttrs: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "0.0.17",
4
+ "version": "0.0.18",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",
@@ -25,6 +25,7 @@
25
25
  "devDependencies": {
26
26
  "@nuxt/eslint-config": "0.7.1",
27
27
  "@oddbird/css-anchor-positioning": "0.4.0",
28
+ "@vueuse/core": "^12.0.0",
28
29
  "eslint": "9.15.0",
29
30
  "nuxt": "3.14.1592",
30
31
  "release-it": "17.10.0",
@@ -42,6 +43,6 @@
42
43
  },
43
44
  "dependencies": {
44
45
  "focus-trap-vue": "^4.0.3",
45
- "modern-normalize": "3.0.1"
46
+ "modern-normalize": "^3.0.1"
46
47
  }
47
48
  }