smooth-player 1.0.1 → 2.0.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;
@@ -258,23 +376,23 @@
258
376
  display: flex;
259
377
  align-items: center;
260
378
  justify-content: space-between;
261
- gap: 12px;
379
+ gap: sp-rem(12);
262
380
 
263
381
  h2 {
264
382
  margin: 0;
265
- font-size: 20px;
383
+ font-size: sp-rem(20);
266
384
  }
267
385
  }
268
386
 
269
387
  .smooth-player__playlist-close {
270
- width: 36px;
271
- height: 36px;
272
- font-size: 22px;
388
+ width: sp-rem(36);
389
+ height: sp-rem(36);
390
+ font-size: sp-rem(22);
273
391
  line-height: 1;
274
392
  }
275
393
 
276
394
  .smooth-player__playlist-switcher {
277
- margin-top: 10px;
395
+ margin-top: sp-rem(10);
278
396
  position: relative;
279
397
  }
280
398
 
@@ -282,30 +400,30 @@
282
400
  width: 100%;
283
401
  height: auto;
284
402
  min-width: 0;
285
- min-height: 36px;
286
- padding: 8px 12px;
287
- border: 1px solid rgba(255, 255, 255, 0.18);
403
+ min-height: sp-rem(36);
404
+ padding: sp-rem(8) sp-rem(12);
405
+ border: sp-rem(1) solid rgba(255, 255, 255, 0.18);
288
406
  background: rgba(255, 255, 255, 0.06);
289
407
  color: #e7eef9;
290
- font-size: 13px;
408
+ font-size: sp-rem(13);
291
409
  line-height: 1.2;
292
410
  text-align: left;
293
411
  white-space: nowrap;
294
412
  overflow: hidden;
295
413
  text-overflow: ellipsis;
296
414
  position: relative;
297
- padding-right: 32px;
415
+ padding-right: sp-rem(32);
298
416
  }
299
417
 
300
418
  .smooth-player__playlist-switcher-trigger::after {
301
419
  content: "";
302
420
  position: absolute;
303
- right: 12px;
421
+ right: sp-rem(12);
304
422
  top: 50%;
305
- width: 8px;
306
- height: 8px;
307
- border-right: 2px solid currentColor;
308
- border-bottom: 2px solid currentColor;
423
+ width: sp-rem(8);
424
+ height: sp-rem(8);
425
+ border-right: sp-rem(2) solid currentColor;
426
+ border-bottom: sp-rem(2) solid currentColor;
309
427
  transform: translateY(-65%) rotate(45deg);
310
428
  opacity: 0.8;
311
429
  }
@@ -316,15 +434,15 @@
316
434
 
317
435
  .smooth-player__playlist-switcher-menu {
318
436
  position: absolute;
319
- top: calc(100% + 6px);
437
+ top: calc(100% + sp-rem(6));
320
438
  left: 0;
321
439
  right: 0;
322
440
  display: grid;
323
- gap: 6px;
324
- padding: 12px;
441
+ gap: sp-rem(6);
442
+ padding: sp-rem(12);
325
443
  background: rgba(10, 18, 35, 0.96);
326
- backdrop-filter: blur(10px);
327
- border-radius: 8px;
444
+ backdrop-filter: blur(sp-rem(10));
445
+ border-radius: sp-rem(8);
328
446
  z-index: 8;
329
447
  }
330
448
 
@@ -336,13 +454,13 @@
336
454
  width: 100%;
337
455
  height: auto;
338
456
  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);
457
+ min-height: sp-rem(34);
458
+ padding: sp-rem(8) sp-rem(10);
459
+ border-radius: sp-rem(10);
460
+ border: sp-rem(1) solid rgba(255, 255, 255, 0.14);
343
461
  background: rgba(255, 255, 255, 0.04);
344
462
  color: #e7eef9;
345
- font-size: 12px;
463
+ font-size: sp-rem(12);
346
464
  line-height: 1.2;
347
465
  text-align: left;
348
466
  white-space: nowrap;
@@ -358,11 +476,11 @@
358
476
 
359
477
  .smooth-player__playlist-list {
360
478
  list-style: none;
361
- margin: 12px 0 0;
479
+ margin: sp-rem(12) 0 0;
362
480
  padding: 0;
363
481
  display: grid;
364
- gap: 8px;
365
- max-height: calc(100% - 108px);
482
+ gap: sp-rem(8);
483
+ max-height: calc(100% - sp-rem(108));
366
484
  overflow: auto;
367
485
  }
368
486
 
@@ -370,18 +488,18 @@
370
488
  width: 100%;
371
489
  height: auto;
372
490
  min-width: 0;
373
- min-height: 48px;
374
- border-radius: 8px;
491
+ min-height: sp-rem(48);
492
+ border-radius: sp-rem(8);
375
493
  border: 0;
376
494
  background: transparent;
377
495
  color: #f1f5fd;
378
- padding: 8px 0;
496
+ padding: sp-rem(8) 0;
379
497
  text-align: left;
380
498
  display: grid;
381
- grid-template-columns: 18px minmax(0, 1fr);
499
+ grid-template-columns: sp-rem(18) minmax(0, 1fr);
382
500
  align-items: center;
383
501
  justify-content: initial;
384
- gap: 10px;
502
+ gap: sp-rem(10);
385
503
  cursor: pointer;
386
504
  }
387
505
 
@@ -389,41 +507,41 @@
389
507
  width: 100%;
390
508
  height: auto;
391
509
  min-width: 0;
392
- min-height: 36px;
393
- border-radius: 6px;
510
+ min-height: sp-rem(36);
511
+ border-radius: sp-rem(6);
394
512
  }
395
513
 
396
514
  .smooth-player .smooth-player__playlist-switcher-item {
397
515
  width: 100%;
398
516
  height: auto;
399
517
  min-width: 0;
400
- min-height: 34px;
401
- border-radius: 4px;
518
+ min-height: sp-rem(34);
519
+ border-radius: sp-rem(4);
402
520
  }
403
521
 
404
522
  .smooth-player .smooth-player__playlist-item {
405
523
  width: 100%;
406
524
  height: auto;
407
525
  min-width: 0;
408
- min-height: 48px;
409
- border-bottom: rgba(255, 255, 255, 0.1) 1px solid;
526
+ min-height: sp-rem(48);
527
+ border-bottom: rgba(255, 255, 255, 0.1) sp-rem(1) solid;
410
528
  border-radius: 0;
411
529
  }
412
530
 
413
531
  .smooth-player__playlist-note {
414
- width: 18px;
415
- height: 18px;
532
+ width: sp-rem(18);
533
+ height: sp-rem(18);
416
534
  color: rgba(243, 245, 249, 0.52);
417
535
  background: currentColor;
418
536
  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;
537
+ -webkit-mask: url("/assets/icons/note.svg") center / sp-rem(15) sp-rem(15) no-repeat;
538
+ mask: url("/assets/icons/note.svg") center / sp-rem(15) sp-rem(15) no-repeat;
421
539
  }
422
540
 
423
541
  .smooth-player__playlist-content {
424
542
  min-width: 0;
425
543
  display: grid;
426
- gap: 2px;
544
+ gap: sp-rem(2);
427
545
  }
428
546
 
429
547
  .smooth-player__playlist-title {
@@ -448,9 +566,9 @@
448
566
  }
449
567
 
450
568
  .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;
569
+ outline: sp-rem(2) solid color-mix(in srgb, var(--smooth-player-accent) 55%, #fff 45%);
570
+ outline-offset: sp-rem(3);
571
+ border-radius: sp-rem(8);
454
572
  }
455
573
 
456
574
  .smooth-player--playlist-open {
@@ -459,7 +577,7 @@
459
577
  }
460
578
 
461
579
  .smooth-player__main {
462
- transform: translateX(-18px) scale(0.992);
580
+ transform: translateX(-sp-rem(18)) scale(0.992);
463
581
  filter: saturate(0.9);
464
582
  }
465
583
 
@@ -471,13 +589,16 @@
471
589
  }
472
590
  }
473
591
 
474
- @media (max-width: 700px) {
592
+ @media (max-width: 560px) {
475
593
  .smooth-player {
476
- min-height: 540px;
594
+ width: 100%;
595
+ min-height: 100dvh;
596
+ border-radius: 0;
597
+ margin: 0;
477
598
  }
478
599
 
479
600
  .smooth-player__main {
480
- padding: 14px;
601
+ padding: sp-rem(14);
481
602
  }
482
603
 
483
604
  .smooth-player__playlist {