smooth-player 1.0.4 → 2.1.0

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.
@@ -1,9 +1,16 @@
1
+ @use "sass:string";
2
+
3
+ @function sp-rem($px) {
4
+ @return string.unquote("calc(var(--smooth-player-rem) * #{$px})");
5
+ }
6
+
1
7
  .smooth-player {
8
+ --smooth-player-rem: 0.0625rem;
2
9
  --smooth-player-background: #0b1220;
3
10
  --smooth-player-foreground: rgba(243, 245, 249, 0.8);
4
11
  --smooth-player-accent: #2db6c8;
5
12
  --smooth-player-waveform: #f3f5f9;
6
- --smooth-player-radius: 18px;
13
+ --smooth-player-radius: #{sp-rem(18)};
7
14
  --smooth-player-font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
8
15
  --smooth-player-surface: linear-gradient(145deg, #182743, #111a2d 56%, #0e1628);
9
16
  --smooth-player-panel: linear-gradient(190deg, #1a2945 0%, #111a2e 58%, #0c1321 100%);
@@ -11,10 +18,10 @@
11
18
  --smooth-player-progress: 0%;
12
19
 
13
20
  position: relative;
14
- width: min(960px, 92vw);
15
- min-height: 500px;
21
+ width: min(40rem, 92vw);
22
+ min-height: sp-rem(500);
16
23
  border-radius: var(--smooth-player-radius);
17
- border: 1px solid rgba(255, 255, 255, 0.12);
24
+ border: sp-rem(1) solid rgba(255, 255, 255, 0.12);
18
25
  background: var(--smooth-player-surface);
19
26
  color: var(--smooth-player-foreground);
20
27
  font-family: var(--smooth-player-font-family);
@@ -29,40 +36,151 @@
29
36
  opacity: 0;
30
37
  transition: opacity 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
31
38
  }
39
+
40
+ }
41
+
42
+ .smooth-player.is-drag-over {
43
+ border-color: color-mix(in srgb, var(--smooth-player-accent) 44%, #fff 56%);
44
+ box-shadow: 0 0 0 sp-rem(2) color-mix(in srgb, var(--smooth-player-accent) 18%, transparent);
45
+
46
+ &::before {
47
+ opacity: 0.45;
48
+ }
49
+
50
+ .smooth-player__main {
51
+ filter: saturate(1.03);
52
+ }
53
+ }
54
+
55
+ .smooth-player__main::before,
56
+ .smooth-player__main::after {
57
+ content: "";
58
+ position: absolute;
59
+ pointer-events: none;
60
+ opacity: 0;
61
+ transition: opacity 220ms ease, transform 220ms ease;
62
+ }
63
+
64
+ .smooth-player__main::before {
65
+ inset: sp-rem(18);
66
+ border-radius: sp-rem(16);
67
+ border: sp-rem(2) dashed color-mix(in srgb, var(--smooth-player-accent) 52%, #fff 48%);
68
+ background: color-mix(in srgb, var(--smooth-player-accent) 8%, transparent);
69
+ transform: scale(0.985);
70
+ }
71
+
72
+ .smooth-player__main::after {
73
+ width: sp-rem(64);
74
+ height: sp-rem(64);
75
+ left: 50%;
76
+ top: 50%;
77
+ transform: translate(-50%, -50%) scale(0.92);
78
+ background: rgba(255, 255, 255, 0.78);
79
+ -webkit-mask: url("/assets/icons/upload.svg") center / contain no-repeat;
80
+ mask: url("/assets/icons/upload.svg") center / contain no-repeat;
81
+ }
82
+
83
+ .smooth-player.is-drag-over .smooth-player__main::before,
84
+ .smooth-player.is-drag-over .smooth-player__main::after {
85
+ opacity: 1;
86
+ }
87
+
88
+ .smooth-player.is-drag-over .smooth-player__main::before {
89
+ transform: scale(1);
90
+ }
91
+
92
+ .smooth-player.is-drag-over .smooth-player__main::after {
93
+ transform: translate(-50%, -50%) scale(1);
32
94
  }
33
95
 
34
96
  .smooth-player__main {
35
97
  position: relative;
36
98
  z-index: 1;
37
99
  height: 100%;
38
- padding: 20px;
100
+ padding: sp-rem(20);
39
101
  transition: transform 500ms cubic-bezier(0.2, 0.7, 0.2, 1), filter 420ms ease;
40
102
  }
41
103
 
104
+ .smooth-player__notice {
105
+ position: absolute;
106
+ left: 50%;
107
+ bottom: sp-rem(14);
108
+ z-index: 6;
109
+ transform: translate(-50%, sp-rem(8));
110
+ width: min(sp-rem(640), calc(100% - sp-rem(28)));
111
+ padding: sp-rem(10) sp-rem(12);
112
+ border-radius: sp-rem(10);
113
+ border: sp-rem(1) solid rgba(255, 255, 255, 0.24);
114
+ background: rgba(9, 16, 30, 0.84);
115
+ color: rgba(255, 255, 255, 0.9);
116
+ font-size: sp-rem(12);
117
+ line-height: 1.35;
118
+ text-align: center;
119
+ pointer-events: none;
120
+ opacity: 0;
121
+ transition: opacity 180ms ease, transform 180ms ease;
122
+ }
123
+
124
+ .smooth-player__notice.is-visible {
125
+ opacity: 1;
126
+ transform: translate(-50%, 0);
127
+ }
128
+
129
+ .smooth-player__debug {
130
+ width: min(100%, sp-rem(640));
131
+ margin: sp-rem(12) auto 0;
132
+ border: sp-rem(1) solid rgba(255, 255, 255, 0.18);
133
+ border-radius: sp-rem(12);
134
+ background: rgba(7, 12, 22, 0.65);
135
+ padding: sp-rem(10) sp-rem(12);
136
+ font-size: sp-rem(12);
137
+ }
138
+
139
+ .smooth-player__debug h3 {
140
+ margin: 0 0 sp-rem(8);
141
+ font-size: sp-rem(13);
142
+ font-weight: 700;
143
+ }
144
+
145
+ .smooth-player__debug-grid {
146
+ display: grid;
147
+ grid-template-columns: repeat(2, minmax(0, 1fr));
148
+ gap: sp-rem(6) sp-rem(10);
149
+ }
150
+
151
+ .smooth-player__debug-events {
152
+ margin: sp-rem(8) 0 0;
153
+ max-height: sp-rem(140);
154
+ overflow: auto;
155
+ border-radius: sp-rem(8);
156
+ padding: sp-rem(8);
157
+ background: rgba(255, 255, 255, 0.06);
158
+ }
159
+
42
160
  .smooth-player__row {
43
161
  display: flex;
44
162
  flex-wrap: wrap;
45
- gap: 12px;
163
+ gap: sp-rem(12);
46
164
  align-items: center;
47
165
  justify-content: space-between;
48
166
  }
49
167
 
50
168
  .smooth-player__title {
51
169
  margin: 0;
52
- font-size: 22px;
170
+ font-size: sp-rem(22);
53
171
  }
54
172
 
55
173
  .smooth-player__controls {
56
174
  display: flex;
57
- gap: 8px;
175
+ gap: sp-rem(8);
58
176
  }
59
177
 
60
178
  .smooth-player button {
61
179
  border: 0;
62
180
  background: var(--smooth-player-accent);
63
181
  color: #041016;
64
- width: 46px;
65
- height: 46px;
182
+ width: sp-rem(46);
183
+ height: sp-rem(46);
66
184
  display: inline-flex;
67
185
  align-items: center;
68
186
  justify-content: center;
@@ -76,13 +194,13 @@
76
194
  }
77
195
 
78
196
  &:hover {
79
- transform: translateY(-1px);
197
+ transform: translateY(-sp-rem(1));
80
198
  filter: brightness(1.1);
81
199
  }
82
200
 
83
201
  &:focus-visible {
84
- outline: 2px solid #7fe9f5;
85
- outline-offset: 2px;
202
+ outline: sp-rem(2) solid #7fe9f5;
203
+ outline-offset: sp-rem(2);
86
204
  }
87
205
 
88
206
  &.secondary {
@@ -92,24 +210,24 @@
92
210
  }
93
211
 
94
212
  .smooth-player__icon {
95
- width: 22px;
96
- height: 22px;
213
+ width: sp-rem(22);
214
+ height: sp-rem(22);
97
215
  display: block;
98
216
  }
99
217
 
100
218
  .smooth-player__sr-only {
101
219
  position: absolute;
102
- width: 1px;
103
- height: 1px;
220
+ width: sp-rem(1);
221
+ height: sp-rem(1);
104
222
  padding: 0;
105
- margin: -1px;
223
+ margin: -sp-rem(1);
106
224
  overflow: hidden;
107
225
  clip: rect(0, 0, 0, 0);
108
226
  border: 0;
109
227
  }
110
228
 
111
229
  .smooth-player__meta {
112
- margin-top: 14px;
230
+ margin-top: sp-rem(14);
113
231
  opacity: 0.95;
114
232
  }
115
233
 
@@ -124,16 +242,16 @@
124
242
  .smooth-player__ring {
125
243
  --smooth-player-progress-angle: 0deg;
126
244
  position: relative;
127
- width: 230px;
245
+ width: sp-rem(230);
128
246
  aspect-ratio: 1 / 1;
129
247
  border-radius: 50%;
130
- padding: 2px;
248
+ padding: sp-rem(2);
131
249
  background: conic-gradient(
132
250
  var(--smooth-player-accent) var(--smooth-player-progress),
133
251
  rgba(255, 255, 255, 0.16) 0%
134
252
  );
135
253
  cursor: grab;
136
- box-shadow: 0 0 20px color-mix(in srgb, var(--smooth-player-accent) 45%, transparent);
254
+ box-shadow: 0 0 sp-rem(20) color-mix(in srgb, var(--smooth-player-accent) 45%, transparent);
137
255
  }
138
256
 
139
257
  .smooth-player__ring:active {
@@ -155,7 +273,7 @@
155
273
  border-radius: 50%;
156
274
  overflow: hidden;
157
275
  background: var(--smooth-player-background);
158
- box-shadow: 0 16px 28px rgba(0, 0, 0, 0.36), inset 0 1px 1px rgba(255, 255, 255, 0.25);
276
+ box-shadow: 0 sp-rem(16) sp-rem(28) rgba(0, 0, 0, 0.36), inset 0 sp-rem(1) sp-rem(1) rgba(255, 255, 255, 0.25);
159
277
  }
160
278
 
161
279
  .smooth-player__cover-canvas {
@@ -171,27 +289,27 @@
171
289
  }
172
290
 
173
291
  .smooth-player__artist {
174
- margin-top: 2px;
292
+ margin-top: sp-rem(2);
175
293
  color: var(--smooth-player-muted);
176
294
  }
177
295
 
178
296
  .smooth-player__time {
179
- margin-top: 8px;
180
- font-size: 14px;
297
+ margin-top: sp-rem(8);
298
+ font-size: sp-rem(14);
181
299
  color: var(--smooth-player-muted);
182
300
  }
183
301
 
184
302
  .smooth-player__progress-wrap {
185
- margin-top: 10px;
303
+ margin-top: sp-rem(10);
186
304
  display: grid;
187
- gap: 6px;
305
+ gap: sp-rem(6);
188
306
  }
189
307
 
190
308
  .smooth-player__progress-row {
191
309
  display: flex;
192
310
  justify-content: space-between;
193
311
  align-items: center;
194
- font-size: 12px;
312
+ font-size: sp-rem(12);
195
313
  color: var(--smooth-player-muted);
196
314
  }
197
315
 
@@ -199,8 +317,8 @@
199
317
  --smooth-player-progress: 0%;
200
318
  appearance: none;
201
319
  width: 100%;
202
- height: 7px;
203
- border-radius: 999px;
320
+ height: sp-rem(7);
321
+ border-radius: sp-rem(999);
204
322
  background: linear-gradient(
205
323
  to right,
206
324
  var(--smooth-player-accent) 0%,
@@ -212,40 +330,40 @@
212
330
 
213
331
  &::-webkit-slider-thumb {
214
332
  appearance: none;
215
- width: 14px;
216
- height: 14px;
333
+ width: sp-rem(14);
334
+ height: sp-rem(14);
217
335
  border-radius: 50%;
218
336
  border: 0;
219
337
  background: #f4fbff;
220
- box-shadow: 0 0 0 2px rgba(44, 182, 200, 0.35);
338
+ box-shadow: 0 0 0 sp-rem(2) rgba(44, 182, 200, 0.35);
221
339
  }
222
340
 
223
341
  &::-moz-range-thumb {
224
- width: 14px;
225
- height: 14px;
342
+ width: sp-rem(14);
343
+ height: sp-rem(14);
226
344
  border-radius: 50%;
227
345
  border: 0;
228
346
  background: #f4fbff;
229
- box-shadow: 0 0 0 2px rgba(44, 182, 200, 0.35);
347
+ box-shadow: 0 0 0 sp-rem(2) rgba(44, 182, 200, 0.35);
230
348
  }
231
349
  }
232
350
 
233
351
  .smooth-player__canvas {
234
- margin-top: 14px;
352
+ margin-top: sp-rem(14);
235
353
  width: 100%;
236
- border-radius: 10px;
237
- border: 1px solid rgba(255, 255, 255, 0.1);
354
+ border-radius: sp-rem(10);
355
+ border: sp-rem(1) solid rgba(255, 255, 255, 0.1);
238
356
  background: var(--smooth-player-background);
239
357
  }
240
358
 
241
359
  .smooth-player__playlist {
242
360
  position: absolute;
243
361
  inset: 0 0 0 auto;
244
- width: min(350px, 90vw);
362
+ width: min(sp-rem(350), 90vw);
245
363
  height: 100%;
246
- padding: 20px;
364
+ padding: sp-rem(20);
247
365
  background: var(--smooth-player-panel);
248
- border-left: 1px solid rgba(255, 255, 255, 0.12);
366
+ border-left: sp-rem(1) solid rgba(255, 255, 255, 0.12);
249
367
  transform: translateX(105%);
250
368
  opacity: 0;
251
369
  visibility: hidden;
@@ -254,27 +372,34 @@
254
372
  z-index: 3;
255
373
  }
256
374
 
375
+ .smooth-player__playlist.is-open {
376
+ transform: translateX(0);
377
+ opacity: 1;
378
+ visibility: visible;
379
+ pointer-events: auto;
380
+ }
381
+
257
382
  .smooth-player__playlist-head {
258
383
  display: flex;
259
384
  align-items: center;
260
385
  justify-content: space-between;
261
- gap: 12px;
386
+ gap: sp-rem(12);
262
387
 
263
388
  h2 {
264
389
  margin: 0;
265
- font-size: 20px;
390
+ font-size: sp-rem(20);
266
391
  }
267
392
  }
268
393
 
269
394
  .smooth-player__playlist-close {
270
- width: 36px;
271
- height: 36px;
272
- font-size: 22px;
395
+ width: sp-rem(36);
396
+ height: sp-rem(36);
397
+ font-size: sp-rem(22);
273
398
  line-height: 1;
274
399
  }
275
400
 
276
401
  .smooth-player__playlist-switcher {
277
- margin-top: 10px;
402
+ margin-top: sp-rem(10);
278
403
  position: relative;
279
404
  }
280
405
 
@@ -282,30 +407,30 @@
282
407
  width: 100%;
283
408
  height: auto;
284
409
  min-width: 0;
285
- min-height: 36px;
286
- padding: 8px 12px;
287
- border: 1px solid rgba(255, 255, 255, 0.18);
410
+ min-height: sp-rem(36);
411
+ padding: sp-rem(8) sp-rem(12);
412
+ border: sp-rem(1) solid rgba(255, 255, 255, 0.18);
288
413
  background: rgba(255, 255, 255, 0.06);
289
414
  color: #e7eef9;
290
- font-size: 13px;
415
+ font-size: sp-rem(13);
291
416
  line-height: 1.2;
292
417
  text-align: left;
293
418
  white-space: nowrap;
294
419
  overflow: hidden;
295
420
  text-overflow: ellipsis;
296
421
  position: relative;
297
- padding-right: 32px;
422
+ padding-right: sp-rem(32);
298
423
  }
299
424
 
300
425
  .smooth-player__playlist-switcher-trigger::after {
301
426
  content: "";
302
427
  position: absolute;
303
- right: 12px;
428
+ right: sp-rem(12);
304
429
  top: 50%;
305
- width: 8px;
306
- height: 8px;
307
- border-right: 2px solid currentColor;
308
- border-bottom: 2px solid currentColor;
430
+ width: sp-rem(8);
431
+ height: sp-rem(8);
432
+ border-right: sp-rem(2) solid currentColor;
433
+ border-bottom: sp-rem(2) solid currentColor;
309
434
  transform: translateY(-65%) rotate(45deg);
310
435
  opacity: 0.8;
311
436
  }
@@ -316,15 +441,15 @@
316
441
 
317
442
  .smooth-player__playlist-switcher-menu {
318
443
  position: absolute;
319
- top: calc(100% + 6px);
444
+ top: calc(100% + sp-rem(6));
320
445
  left: 0;
321
446
  right: 0;
322
447
  display: grid;
323
- gap: 6px;
324
- padding: 12px;
448
+ gap: sp-rem(6);
449
+ padding: sp-rem(12);
325
450
  background: rgba(10, 18, 35, 0.96);
326
- backdrop-filter: blur(10px);
327
- border-radius: 8px;
451
+ backdrop-filter: blur(sp-rem(10));
452
+ border-radius: sp-rem(8);
328
453
  z-index: 8;
329
454
  }
330
455
 
@@ -336,13 +461,13 @@
336
461
  width: 100%;
337
462
  height: auto;
338
463
  min-width: 0;
339
- min-height: 34px;
340
- padding: 8px 10px;
341
- border-radius: 10px;
342
- border: 1px solid rgba(255, 255, 255, 0.14);
464
+ min-height: sp-rem(34);
465
+ padding: sp-rem(8) sp-rem(10);
466
+ border-radius: sp-rem(10);
467
+ border: sp-rem(1) solid rgba(255, 255, 255, 0.14);
343
468
  background: rgba(255, 255, 255, 0.04);
344
469
  color: #e7eef9;
345
- font-size: 12px;
470
+ font-size: sp-rem(12);
346
471
  line-height: 1.2;
347
472
  text-align: left;
348
473
  white-space: nowrap;
@@ -358,11 +483,11 @@
358
483
 
359
484
  .smooth-player__playlist-list {
360
485
  list-style: none;
361
- margin: 12px 0 0;
486
+ margin: sp-rem(12) 0 0;
362
487
  padding: 0;
363
488
  display: grid;
364
- gap: 8px;
365
- max-height: calc(100% - 108px);
489
+ gap: sp-rem(8);
490
+ max-height: calc(100% - sp-rem(108));
366
491
  overflow: auto;
367
492
  }
368
493
 
@@ -370,18 +495,18 @@
370
495
  width: 100%;
371
496
  height: auto;
372
497
  min-width: 0;
373
- min-height: 48px;
374
- border-radius: 8px;
498
+ min-height: sp-rem(48);
499
+ border-radius: sp-rem(8);
375
500
  border: 0;
376
501
  background: transparent;
377
502
  color: #f1f5fd;
378
- padding: 8px 0;
503
+ padding: sp-rem(8) 0;
379
504
  text-align: left;
380
505
  display: grid;
381
- grid-template-columns: 18px minmax(0, 1fr);
506
+ grid-template-columns: sp-rem(18) minmax(0, 1fr);
382
507
  align-items: center;
383
508
  justify-content: initial;
384
- gap: 10px;
509
+ gap: sp-rem(10);
385
510
  cursor: pointer;
386
511
  }
387
512
 
@@ -389,41 +514,41 @@
389
514
  width: 100%;
390
515
  height: auto;
391
516
  min-width: 0;
392
- min-height: 36px;
393
- border-radius: 6px;
517
+ min-height: sp-rem(36);
518
+ border-radius: sp-rem(6);
394
519
  }
395
520
 
396
521
  .smooth-player .smooth-player__playlist-switcher-item {
397
522
  width: 100%;
398
523
  height: auto;
399
524
  min-width: 0;
400
- min-height: 34px;
401
- border-radius: 4px;
525
+ min-height: sp-rem(34);
526
+ border-radius: sp-rem(4);
402
527
  }
403
528
 
404
529
  .smooth-player .smooth-player__playlist-item {
405
530
  width: 100%;
406
531
  height: auto;
407
532
  min-width: 0;
408
- min-height: 48px;
409
- border-bottom: rgba(255, 255, 255, 0.1) 1px solid;
533
+ min-height: sp-rem(48);
534
+ border-bottom: rgba(255, 255, 255, 0.1) sp-rem(1) solid;
410
535
  border-radius: 0;
411
536
  }
412
537
 
413
538
  .smooth-player__playlist-note {
414
- width: 18px;
415
- height: 18px;
539
+ width: sp-rem(18);
540
+ height: sp-rem(18);
416
541
  color: rgba(243, 245, 249, 0.52);
417
542
  background: currentColor;
418
543
  display: block;
419
- -webkit-mask: url("/assets/icons/note.svg") center / 15px 15px no-repeat;
420
- mask: url("/assets/icons/note.svg") center / 15px 15px no-repeat;
544
+ -webkit-mask: url("/assets/icons/note.svg") center / sp-rem(15) sp-rem(15) no-repeat;
545
+ mask: url("/assets/icons/note.svg") center / sp-rem(15) sp-rem(15) no-repeat;
421
546
  }
422
547
 
423
548
  .smooth-player__playlist-content {
424
549
  min-width: 0;
425
550
  display: grid;
426
- gap: 2px;
551
+ gap: sp-rem(2);
427
552
  }
428
553
 
429
554
  .smooth-player__playlist-title {
@@ -448,9 +573,9 @@
448
573
  }
449
574
 
450
575
  .smooth-player__playlist-item:focus-visible {
451
- outline: 2px solid color-mix(in srgb, var(--smooth-player-accent) 55%, #fff 45%);
452
- outline-offset: 3px;
453
- border-radius: 8px;
576
+ outline: sp-rem(2) solid color-mix(in srgb, var(--smooth-player-accent) 55%, #fff 45%);
577
+ outline-offset: sp-rem(3);
578
+ border-radius: sp-rem(8);
454
579
  }
455
580
 
456
581
  .smooth-player--playlist-open {
@@ -459,7 +584,7 @@
459
584
  }
460
585
 
461
586
  .smooth-player__main {
462
- transform: translateX(-18px) scale(0.992);
587
+ transform: translateX(-sp-rem(18)) scale(0.992);
463
588
  filter: saturate(0.9);
464
589
  }
465
590
 
@@ -471,13 +596,16 @@
471
596
  }
472
597
  }
473
598
 
474
- @media (max-width: 700px) {
599
+ @media (max-width: 560px) {
475
600
  .smooth-player {
476
- min-height: 540px;
601
+ width: 100%;
602
+ min-height: 100dvh;
603
+ border-radius: 0;
604
+ margin: 0;
477
605
  }
478
606
 
479
607
  .smooth-player__main {
480
- padding: 14px;
608
+ padding: sp-rem(14);
481
609
  }
482
610
 
483
611
  .smooth-player__playlist {