vue3-router-tab 1.1.7 → 1.1.8

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 (2) hide show
  1. package/lib/scss/index.scss +36 -190
  2. package/package.json +1 -1
@@ -1,19 +1,14 @@
1
1
  @use "sass:math";
2
2
  @use "sass:string";
3
3
 
4
- // Fallback palette (overridden by Vuetify CSS vars)
4
+ // Fallback palette (overridden by CSS vars when present)
5
5
  $primary-fallback: #635bff;
6
6
  $light-bg: #ffffff;
7
7
  $light-text: #1e293b;
8
8
  $light-border: rgba(15, 23, 42, 0.08);
9
9
 
10
- // Dark mode fallbacks
11
- $dark-bg: #1e1e1e;
12
- $dark-text: #e2e8f0;
13
- $dark-border: rgba(226, 232, 240, 0.12);
14
-
15
10
  $font-size: 14px;
16
- $tab-trans: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
11
+ $tab-trans: all 0.3s ease-in-out;
17
12
  $hd-height: 40px;
18
13
  $tab-padding: 20px;
19
14
  $close-icon-margin: 4px;
@@ -24,30 +19,15 @@ $close-icon-size: 13px;
24
19
  @return string.unquote("var(#{$name}, #{$fallback})");
25
20
  }
26
21
 
27
- /// Mixin for reduced motion preferences
28
- @mixin reduced-motion {
29
- @media (prefers-reduced-motion: reduce) {
30
- @content;
31
- }
32
- }
33
-
34
- /// Mixin for dark theme styles - works with data-theme="dark"
35
- @mixin dark-theme {
36
- :root[data-theme="dark"] & {
37
- @content;
38
- }
39
- }
40
-
41
22
  .router-tab {
42
- // Use Vuetify theme colors with fallbacks
43
- $bg: css-var(--router-tab-background, css-var(--v-theme-surface, css-var(--theme-background, $light-bg)));
44
- $fg: css-var(--router-tab-foreground, css-var(--v-theme-on-surface, css-var(--theme-foreground, $light-text)));
45
- $border: css-var(--router-tab-border, css-var(--v-border-color, css-var(--theme-border, $light-border)));
46
- $primary: css-var(--router-tab-primary, css-var(--v-theme-primary, css-var(--theme-primary, $primary-fallback)));
23
+ $bg: css-var(--router-tab-background, css-var(--theme-background, $light-bg));
24
+ $fg: css-var(--router-tab-foreground, css-var(--theme-foreground, $light-text));
25
+ $border: css-var(--router-tab-border, css-var(--theme-border, $light-border));
26
+ $primary: css-var(--router-tab-primary, css-var(--theme-primary, $primary-fallback));
47
27
  $header-bg: css-var(--router-tab-header-bg, $bg);
48
- $tooltip-bg: css-var(--router-tab-tooltip-background, rgba(var(--v-theme-on-surface), 0.9));
49
- $tooltip-fg: css-var(--router-tab-tooltip-foreground, css-var(--v-theme-surface, #ffffff));
50
- $tooltip-shadow: css-var(--router-tab-tooltip-shadow, 0 8px 24px rgba(0, 0, 0, 0.18));
28
+ $tooltip-bg: css-var(--router-tab-tooltip-background, rgba(15, 23, 42, 0.88));
29
+ $tooltip-fg: css-var(--router-tab-tooltip-foreground, #ffffff);
30
+ $tooltip-shadow: css-var(--router-tab-tooltip-shadow, 0 8px 24px rgba(15, 23, 42, 0.18));
51
31
 
52
32
  display: flex;
53
33
  flex-direction: column;
@@ -55,11 +35,6 @@ $close-icon-size: 13px;
55
35
  background-color: transparent;
56
36
  color: inherit;
57
37
 
58
- // Dark theme default values
59
- @include dark-theme {
60
- --router-tab-tooltip-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
61
- }
62
-
63
38
  &__header {
64
39
  position: relative;
65
40
  z-index: 9;
@@ -69,12 +44,7 @@ $close-icon-size: 13px;
69
44
  height: $hd-height;
70
45
  border-bottom: 1px solid $border;
71
46
  background-color: $header-bg;
72
- transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
73
- background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
74
-
75
- @include reduced-motion {
76
- transition: none;
77
- }
47
+ transition: all 0.2s ease-in-out;
78
48
  }
79
49
 
80
50
  &__scroll {
@@ -91,7 +61,6 @@ $close-icon-size: 13px;
91
61
  &.is-mobile {
92
62
  overflow-x: auto;
93
63
  overflow-y: hidden;
94
- -webkit-overflow-scrolling: touch;
95
64
  }
96
65
  }
97
66
  }
@@ -104,14 +73,10 @@ $close-icon-size: 13px;
104
73
  bottom: 0;
105
74
  left: 0;
106
75
  height: $h;
107
- background-color: rgba(var(--v-theme-on-surface, 0, 0, 0), 0.1);
76
+ background-color: rgba(0, 0, 0, 0.1);
108
77
  border-radius: $h;
109
78
  opacity: 0;
110
- transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
111
-
112
- @include reduced-motion {
113
- transition: none;
114
- }
79
+ transition: opacity 0.3s ease-in-out;
115
80
 
116
81
  .router-tab__scroll:hover &,
117
82
  &.is-dragging {
@@ -123,17 +88,13 @@ $close-icon-size: 13px;
123
88
  top: 0;
124
89
  left: 0;
125
90
  height: 100%;
126
- background-color: rgba(var(--v-theme-on-surface, 0, 0, 0), 0.15);
91
+ background-color: rgba(0, 0, 0, 0.1);
127
92
  border-radius: $h;
128
- transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
129
-
130
- @include reduced-motion {
131
- transition: none;
132
- }
93
+ transition: background-color 0.3s ease-in-out;
133
94
 
134
95
  &:hover,
135
96
  .router-tab__scrollbar.is-dragging & {
136
- background-color: rgba(var(--v-theme-on-surface, 0, 0, 0), 0.25);
97
+ background-color: rgba(0, 0, 0, 0.2);
137
98
  }
138
99
  }
139
100
  }
@@ -164,28 +125,17 @@ $close-icon-size: 13px;
164
125
  user-select: none;
165
126
  background-color: transparent;
166
127
 
167
- @include reduced-motion {
168
- transition: none;
169
- }
170
-
171
128
  &:first-child {
172
129
  border-left: 1px solid $border;
173
130
  }
174
131
 
175
- // Keyboard focus styles using Vuetify primary color
176
- &:focus-visible {
177
- outline: 2px solid $primary;
178
- outline-offset: -2px;
179
- z-index: 1;
180
- }
181
-
182
132
  &.is-contextmenu {
183
133
  color: $primary;
184
134
  }
185
135
 
186
136
  &.is-drag-over {
187
- background: rgba(var(--v-theme-on-surface, 0, 0, 0), 0.05);
188
- transition: background 0.15s cubic-bezier(0.4, 0, 0.2, 1);
137
+ background: rgba(0, 0, 0, 0.05);
138
+ transition: background 0.15s ease;
189
139
  }
190
140
 
191
141
  &-title {
@@ -202,17 +152,11 @@ $close-icon-size: 13px;
202
152
  overflow: hidden;
203
153
  white-space: nowrap;
204
154
  text-overflow: ellipsis;
205
- transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
206
-
207
- @include reduced-motion {
208
- transition: none;
209
- }
210
155
  }
211
156
 
212
157
  &-icon {
213
158
  margin-right: 5px;
214
159
  font-size: 16px;
215
- flex-shrink: 0;
216
160
  }
217
161
 
218
162
  &:hover,
@@ -242,15 +186,9 @@ $close-icon-size: 13px;
242
186
 
243
187
  &.is-active {
244
188
  border-bottom-color: $bg;
245
- // Use rgba with Vuetify primary color variable
246
- background: rgba(var(--v-theme-primary, 99, 91, 255), 0.08);
247
- box-shadow: inset 0 -2px 0 rgba(var(--v-theme-primary, 99, 91, 255), 0.5);
248
-
249
- // Fallback for browsers with color-mix support
250
- @supports (background: color-mix(in srgb, red 50%, blue)) {
251
- background: color-mix(in srgb, $primary 8%, $bg 92%);
252
- box-shadow: inset 0 -2px 0 color-mix(in srgb, $primary 50%, transparent);
253
- }
189
+ background: color-mix(in srgb, $primary 12%, $bg 88%);
190
+ box-shadow: inset 0 -2px 0 color-mix(in srgb, $primary 65%, transparent);
191
+ color: color-mix(in srgb, $primary 80%, $fg 20%);
254
192
 
255
193
  &::after {
256
194
  content: '';
@@ -261,7 +199,7 @@ $close-icon-size: 13px;
261
199
  height: 2px;
262
200
  border-radius: 999px;
263
201
  background: $primary;
264
- opacity: 0.7;
202
+ opacity: 0.6;
265
203
  pointer-events: none;
266
204
  }
267
205
  }
@@ -274,12 +212,12 @@ $close-icon-size: 13px;
274
212
  bottom: calc(100% + 8px);
275
213
  display: inline-block;
276
214
  max-width: 320px;
277
- padding: 6px 12px;
215
+ padding: 4px 10px;
278
216
  border-radius: 6px;
279
217
  background: $tooltip-bg;
280
218
  color: $tooltip-fg;
281
219
  font-size: 12px;
282
- line-height: 1.4;
220
+ line-height: 1.3;
283
221
  text-align: center;
284
222
  white-space: normal;
285
223
  word-break: break-word;
@@ -287,14 +225,7 @@ $close-icon-size: 13px;
287
225
  box-shadow: $tooltip-shadow;
288
226
  opacity: 0;
289
227
  pointer-events: none;
290
- transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
291
- transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
292
- z-index: 10;
293
-
294
- @include reduced-motion {
295
- transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
296
- transform: translate(-50%, 0);
297
- }
228
+ transition: opacity 0.2s ease, transform 0.2s ease;
298
229
  }
299
230
 
300
231
  &::before {
@@ -308,14 +239,7 @@ $close-icon-size: 13px;
308
239
  transform: translate(-50%, 6px) rotate(45deg);
309
240
  opacity: 0;
310
241
  pointer-events: none;
311
- transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
312
- transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
313
- z-index: 9;
314
-
315
- @include reduced-motion {
316
- transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
317
- transform: translate(-50%, 0) rotate(45deg);
318
- }
242
+ transition: opacity 0.2s ease, transform 0.2s ease;
319
243
  }
320
244
 
321
245
  &:hover::after {
@@ -343,17 +267,6 @@ $close-icon-size: 13px;
343
267
  transition: $tab-trans;
344
268
  background: transparent;
345
269
  border: none;
346
- flex-shrink: 0;
347
-
348
- @include reduced-motion {
349
- transition: none;
350
- }
351
-
352
- // Keyboard focus
353
- &:focus-visible {
354
- outline: 2px solid $primary;
355
- outline-offset: 2px;
356
- }
357
270
 
358
271
  &::before,
359
272
  &::after {
@@ -365,12 +278,8 @@ $close-icon-size: 13px;
365
278
  height: 1px;
366
279
  margin-left: math.div(-$inner, 2);
367
280
  background-color: currentColor;
368
- transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
281
+ transition: background-color 0.2s ease-in-out;
369
282
  content: '';
370
-
371
- @include reduced-motion {
372
- transition: none;
373
- }
374
283
  }
375
284
 
376
285
  &::before {
@@ -382,17 +291,11 @@ $close-icon-size: 13px;
382
291
  }
383
292
 
384
293
  &:hover {
385
- // Use Vuetify primary color with rgba
386
- background-color: rgba(var(--v-theme-primary, 99, 91, 255), 0.15);
387
-
388
- // Fallback for browsers with color-mix support
389
- @supports (background: color-mix(in srgb, red 50%, blue)) {
390
- background-color: color-mix(in srgb, $primary 15%, transparent);
391
- }
294
+ background-color: color-mix(in srgb, $primary 40%, #ffffff 60%);
392
295
 
393
296
  &::before,
394
297
  &::after {
395
- background-color: $primary;
298
+ background-color: #fff;
396
299
  }
397
300
  }
398
301
  }
@@ -406,9 +309,7 @@ $close-icon-size: 13px;
406
309
  font-size: $font-size;
407
310
  background: $bg;
408
311
  border: 1px solid $border;
409
- box-shadow: 0 5px 15px -3px rgba(var(--v-shadow-key-umbra-opacity, 0, 0, 0), 0.2),
410
- 0 8px 20px 1px rgba(var(--v-shadow-key-penumbra-opacity, 0, 0, 0), 0.14),
411
- 0 3px 24px 2px rgba(var(--v-shadow-key-ambient-opacity, 0, 0, 0), 0.12);
312
+ box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
412
313
  border-radius: 8px;
413
314
 
414
315
  a,
@@ -416,40 +317,24 @@ $close-icon-size: 13px;
416
317
  display: block;
417
318
  width: 100%;
418
319
  padding: 0 16px;
419
- line-height: 32px;
320
+ line-height: 30px;
420
321
  text-align: left;
421
322
  background: transparent;
422
323
  border: none;
423
324
  color: inherit;
424
325
  cursor: pointer;
425
326
  font: inherit;
426
- transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
427
- color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
428
-
429
- @include reduced-motion {
430
- transition: none;
431
- }
432
-
433
- // Keyboard focus
434
- &:focus-visible {
435
- outline: 2px solid $primary;
436
- outline-offset: -2px;
437
- }
327
+ transition: background-color 0.2s ease-in-out;
438
328
 
439
329
  &[aria-disabled='true'] {
440
- color: rgba(var(--v-theme-on-surface, 148, 163, 184), 0.4);
330
+ color: rgba(148, 163, 184, 0.6);
441
331
  pointer-events: none;
442
- cursor: not-allowed;
443
332
  }
444
333
 
445
- &:hover:not([aria-disabled='true']),
446
- &:focus-visible:not([aria-disabled='true']) {
447
- background: rgba(var(--v-theme-primary, 99, 91, 255), 0.08);
334
+ &:hover,
335
+ &:focus-visible {
336
+ background: color-mix(in srgb, $primary 20%, #ffffff 80%);
448
337
  color: $primary;
449
-
450
- @supports (background: color-mix(in srgb, red 50%, blue)) {
451
- background: color-mix(in srgb, $primary 8%, transparent);
452
- }
453
338
  }
454
339
  }
455
340
  }
@@ -463,44 +348,5 @@ $close-icon-size: 13px;
463
348
  }
464
349
 
465
350
  .router-tab__item.is-active + .router-tab__item {
466
- border-left-color: css-var(--router-tab-border, css-var(--v-border-color, css-var(--theme-border, $light-border)));
351
+ border-left-color: css-var(--router-tab-border, css-var(--theme-border, $light-border));
467
352
  }
468
-
469
- // Container query support (progressive enhancement)
470
- @supports (container-type: inline-size) {
471
- .router-tab {
472
- container-type: inline-size;
473
- container-name: router-tab;
474
- }
475
-
476
- @container router-tab (max-width: 600px) {
477
- .router-tab__item {
478
- padding: 0 12px;
479
-
480
- &-title {
481
- max-width: var(--router-tab-title-max-width, 80px);
482
- }
483
-
484
- &:hover .router-tab__item-title {
485
- max-width: var(--router-tab-title-hover-max-width, 150px);
486
- }
487
- }
488
- }
489
- }
490
-
491
- // High contrast mode support
492
- @media (prefers-contrast: high) {
493
- .router-tab {
494
- &__item {
495
- border-width: 2px;
496
-
497
- &.is-active {
498
- border-bottom-width: 3px;
499
- }
500
-
501
- &:focus-visible {
502
- outline-width: 3px;
503
- }
504
- }
505
- }
506
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue3-router-tab",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",