@hyvor/design 2.1.16 → 2.1.17
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.
|
@@ -126,11 +126,7 @@
|
|
|
126
126
|
</Modal>
|
|
127
127
|
</div>
|
|
128
128
|
|
|
129
|
-
<style>.image-uploader :global(.
|
|
130
|
-
z-index: 1000 !important;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.image-uploader :global(.inner) {
|
|
129
|
+
<style>.image-uploader :global(.inner) {
|
|
134
130
|
height: 100%;
|
|
135
131
|
width: 1100px !important;
|
|
136
132
|
display: flex;
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
let started: boolean[] = $state(reviews.map(() => false));
|
|
42
42
|
let playing: boolean[] = $state(reviews.map(() => false));
|
|
43
43
|
let videoEls: (HTMLVideoElement | undefined)[] = $state([]);
|
|
44
|
+
let currentTime: number[] = $state(reviews.map(() => 0));
|
|
45
|
+
let duration: number[] = $state(reviews.map(() => 0));
|
|
44
46
|
|
|
45
47
|
let rowEl: HTMLDivElement | undefined = $state();
|
|
46
48
|
let activeIndex = $state(0);
|
|
@@ -80,6 +82,32 @@
|
|
|
80
82
|
onCardClick(e as unknown as MouseEvent, i);
|
|
81
83
|
}
|
|
82
84
|
|
|
85
|
+
function seekFromEvent(e: MouseEvent, i: number) {
|
|
86
|
+
const video = videoEls[i];
|
|
87
|
+
if (!video || !duration[i]) return;
|
|
88
|
+
const track = e.currentTarget as HTMLElement;
|
|
89
|
+
const rect = track.getBoundingClientRect();
|
|
90
|
+
const ratio = Math.min(1, Math.max(0, (e.clientX - rect.left) / rect.width));
|
|
91
|
+
video.currentTime = ratio * duration[i];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function onSeekClick(e: MouseEvent, i: number) {
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
seekFromEvent(e, i);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function onSeekKeydown(e: KeyboardEvent, i: number) {
|
|
100
|
+
const video = videoEls[i];
|
|
101
|
+
if (!video) return;
|
|
102
|
+
if (e.key === 'ArrowRight') {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
video.currentTime = Math.min(duration[i], video.currentTime + 5);
|
|
105
|
+
} else if (e.key === 'ArrowLeft') {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
video.currentTime = Math.max(0, video.currentTime - 5);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
83
111
|
function goTo(i: number) {
|
|
84
112
|
if (!rowEl) return;
|
|
85
113
|
const card = rowEl.children[i] as HTMLElement | undefined;
|
|
@@ -187,6 +215,8 @@
|
|
|
187
215
|
poster={review.posterUrl}
|
|
188
216
|
playsinline
|
|
189
217
|
bind:this={videoEls[i]}
|
|
218
|
+
bind:currentTime={currentTime[i]}
|
|
219
|
+
bind:duration={duration[i]}
|
|
190
220
|
use:autoplayVideo
|
|
191
221
|
onplay={() => (playing[i] = true)}
|
|
192
222
|
onpause={(e) => onVideoPause(e, i)}
|
|
@@ -198,6 +228,26 @@
|
|
|
198
228
|
</div>
|
|
199
229
|
{/if}
|
|
200
230
|
|
|
231
|
+
{#if started[i]}
|
|
232
|
+
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
|
233
|
+
<div
|
|
234
|
+
class="progress-track"
|
|
235
|
+
role="slider"
|
|
236
|
+
aria-label="Seek video"
|
|
237
|
+
aria-valuemin={0}
|
|
238
|
+
aria-valuemax={100}
|
|
239
|
+
aria-valuenow={duration[i] ? Math.round((currentTime[i] / duration[i]) * 100) : 0}
|
|
240
|
+
tabindex="0"
|
|
241
|
+
onclick={(e) => onSeekClick(e, i)}
|
|
242
|
+
onkeydown={(e) => onSeekKeydown(e, i)}
|
|
243
|
+
>
|
|
244
|
+
<div
|
|
245
|
+
class="progress-fill"
|
|
246
|
+
style="width: {duration[i] ? (currentTime[i] / duration[i]) * 100 : 0}%"
|
|
247
|
+
></div>
|
|
248
|
+
</div>
|
|
249
|
+
{/if}
|
|
250
|
+
|
|
201
251
|
{#if !playing[i]}
|
|
202
252
|
<div class="poster-scrim"></div>
|
|
203
253
|
|
|
@@ -418,6 +468,11 @@
|
|
|
418
468
|
overflow: hidden;
|
|
419
469
|
padding: 0;
|
|
420
470
|
cursor: pointer;
|
|
471
|
+
transition:
|
|
472
|
+
width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
|
|
473
|
+
height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
|
|
474
|
+
transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
|
|
475
|
+
box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
|
421
476
|
}
|
|
422
477
|
|
|
423
478
|
.video-card:focus-visible {
|
|
@@ -425,6 +480,14 @@
|
|
|
425
480
|
outline-offset: 2px;
|
|
426
481
|
}
|
|
427
482
|
|
|
483
|
+
.video-card.playing {
|
|
484
|
+
z-index: 5;
|
|
485
|
+
transform: scale(1.08);
|
|
486
|
+
box-shadow:
|
|
487
|
+
0 30px 60px -15px rgba(20, 14, 12, 0.4),
|
|
488
|
+
0 12px 24px -12px rgba(20, 14, 12, 0.3);
|
|
489
|
+
}
|
|
490
|
+
|
|
428
491
|
.poster {
|
|
429
492
|
position: absolute;
|
|
430
493
|
inset: 0;
|
|
@@ -497,6 +560,32 @@
|
|
|
497
560
|
background: #000;
|
|
498
561
|
}
|
|
499
562
|
|
|
563
|
+
.progress-track {
|
|
564
|
+
position: absolute;
|
|
565
|
+
left: 0;
|
|
566
|
+
right: 0;
|
|
567
|
+
bottom: 0;
|
|
568
|
+
z-index: 4;
|
|
569
|
+
height: 4px;
|
|
570
|
+
background: rgba(255, 255, 255, 0.25);
|
|
571
|
+
cursor: pointer;
|
|
572
|
+
transition: height 0.15s;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.progress-track:hover,
|
|
576
|
+
.progress-track:focus-visible {
|
|
577
|
+
height: 7px;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.progress-track:focus-visible {
|
|
581
|
+
outline: none;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.progress-fill {
|
|
585
|
+
height: 100%;
|
|
586
|
+
background: #fff;
|
|
587
|
+
}
|
|
588
|
+
|
|
500
589
|
.video-card figcaption {
|
|
501
590
|
position: absolute;
|
|
502
591
|
left: 0;
|