@lucaismyname/ginger 0.0.17 → 0.0.21
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.
- package/README.md +76 -0
- package/dist/client.cjs +1 -1
- package/dist/client.js +2 -2
- package/dist/client.test.d.ts +2 -0
- package/dist/client.test.d.ts.map +1 -0
- package/dist/components/controls/Controls.d.ts +26 -13
- package/dist/components/controls/Controls.d.ts.map +1 -1
- package/dist/experimental-gapless/index.cjs.map +1 -1
- package/dist/experimental-gapless/index.d.ts +3 -1
- package/dist/experimental-gapless/index.d.ts.map +1 -1
- package/dist/experimental-gapless/index.js.map +1 -1
- package/dist/{ginger-F4UDi2Qf.js → ginger-8x4WzVmw.js} +196 -144
- package/dist/ginger-8x4WzVmw.js.map +1 -0
- package/dist/ginger-CMbd3s8C.cjs +2 -0
- package/dist/ginger-CMbd3s8C.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +44 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/testing/helpers.d.ts +29 -0
- package/dist/testing/helpers.d.ts.map +1 -1
- package/dist/testing/helpers.test.d.ts +2 -0
- package/dist/testing/helpers.test.d.ts.map +1 -0
- package/dist/testing/index.cjs +48 -43
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6888 -3749
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/index.test.d.ts +2 -0
- package/dist/testing/index.test.d.ts.map +1 -0
- package/dist/testing/renderGinger.d.ts.map +1 -1
- package/dist/{useNextTrackPrefetch-BeAKS3SR.cjs → useNextTrackPrefetch-CFoUynDv.cjs} +2 -2
- package/dist/{useNextTrackPrefetch-BeAKS3SR.cjs.map → useNextTrackPrefetch-CFoUynDv.cjs.map} +1 -1
- package/dist/{useNextTrackPrefetch-gKls_h_N.js → useNextTrackPrefetch-CV1khU0h.js} +2 -2
- package/dist/{useNextTrackPrefetch-gKls_h_N.js.map → useNextTrackPrefetch-CV1khU0h.js.map} +1 -1
- package/package.json +9 -1
- package/dist/ginger-DWOyCog6.cjs +0 -2
- package/dist/ginger-DWOyCog6.cjs.map +0 -1
- package/dist/ginger-F4UDi2Qf.js.map +0 -1
|
@@ -23,7 +23,7 @@ function Fr({
|
|
|
23
23
|
currentTime: -1,
|
|
24
24
|
duration: -1,
|
|
25
25
|
bufferedFraction: -1
|
|
26
|
-
}), m = O(""), [
|
|
26
|
+
}), m = O(""), [y, k] = Nr(!1);
|
|
27
27
|
E(() => {
|
|
28
28
|
if (!t || typeof window > "u") return;
|
|
29
29
|
const p = window.matchMedia("(prefers-reduced-motion: reduce)"), T = () => k(p.matches);
|
|
@@ -34,7 +34,7 @@ function Fr({
|
|
|
34
34
|
currentTime: p.currentTime,
|
|
35
35
|
duration: p.duration,
|
|
36
36
|
bufferedFraction: Ue(p)
|
|
37
|
-
}, w = g.current, Se =
|
|
37
|
+
}, w = g.current, Se = y ? 0.5 : 0.25, K = Math.abs(R.currentTime - w.currentTime) >= Se || Math.abs(R.duration - w.duration) >= 0.01 || Math.abs(R.bufferedFraction - w.bufferedFraction) >= 0.01;
|
|
38
38
|
!T && !K || (g.current = R, o({
|
|
39
39
|
type: "MEDIA_TIME_UPDATE",
|
|
40
40
|
payload: R
|
|
@@ -206,8 +206,8 @@ function B(e, r) {
|
|
|
206
206
|
function n(a) {
|
|
207
207
|
const t = I(), o = (r(t) ?? "").trim(), { className: u, style: s, fallback: c, empty: g, children: m } = a;
|
|
208
208
|
if (!o) {
|
|
209
|
-
const
|
|
210
|
-
return
|
|
209
|
+
const y = g ?? c ?? null;
|
|
210
|
+
return y ? /* @__PURE__ */ d("span", { className: u, style: s, children: y }) : null;
|
|
211
211
|
}
|
|
212
212
|
return m ? /* @__PURE__ */ d("span", { className: u, style: s, children: m(o, t) }) : /* @__PURE__ */ d("span", { className: u, style: s, children: o });
|
|
213
213
|
}
|
|
@@ -284,8 +284,8 @@ function ze({
|
|
|
284
284
|
}) {
|
|
285
285
|
const s = I(), { lines: c, activeIndex: g } = un();
|
|
286
286
|
if (c.length === 0) {
|
|
287
|
-
const
|
|
288
|
-
return
|
|
287
|
+
const y = a ?? n ?? null;
|
|
288
|
+
return y ? /* @__PURE__ */ d("span", { className: e, style: r, children: y }) : null;
|
|
289
289
|
}
|
|
290
290
|
return /* @__PURE__ */ d("ul", { className: e, style: { ...t ? {} : {
|
|
291
291
|
listStyle: "none",
|
|
@@ -294,7 +294,7 @@ function ze({
|
|
|
294
294
|
fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
|
|
295
295
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
296
296
|
color: "var(--ginger-primary-color, #111827)"
|
|
297
|
-
}, ...r }, "aria-label": "Synced lyrics", children: c.map((
|
|
297
|
+
}, ...r }, "aria-label": "Synced lyrics", children: c.map((y, k) => {
|
|
298
298
|
const b = k === g;
|
|
299
299
|
return /* @__PURE__ */ d(
|
|
300
300
|
"li",
|
|
@@ -307,9 +307,9 @@ function ze({
|
|
|
307
307
|
fontWeight: b ? 600 : 400,
|
|
308
308
|
opacity: b ? 1 : 0.75
|
|
309
309
|
},
|
|
310
|
-
children: u ? u(
|
|
310
|
+
children: u ? u(y, k, b, s) : y.text
|
|
311
311
|
},
|
|
312
|
-
`${
|
|
312
|
+
`${y.time}-${k}`
|
|
313
313
|
);
|
|
314
314
|
}) });
|
|
315
315
|
}
|
|
@@ -350,8 +350,8 @@ function We({
|
|
|
350
350
|
}) {
|
|
351
351
|
const u = I(), { list: s, activeIndex: c, seekTo: g } = sn();
|
|
352
352
|
if (s.length === 0) {
|
|
353
|
-
const
|
|
354
|
-
return
|
|
353
|
+
const y = a ?? n ?? null;
|
|
354
|
+
return y ? /* @__PURE__ */ d("span", { className: e, style: r, children: y }) : null;
|
|
355
355
|
}
|
|
356
356
|
return /* @__PURE__ */ d("ul", { className: e, style: { ...t ? {} : {
|
|
357
357
|
listStyle: "none",
|
|
@@ -360,7 +360,7 @@ function We({
|
|
|
360
360
|
fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
|
|
361
361
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
362
362
|
color: "var(--ginger-primary-color, #111827)"
|
|
363
|
-
}, ...r }, "aria-label": "Chapters", children: s.map((
|
|
363
|
+
}, ...r }, "aria-label": "Chapters", children: s.map((y, k) => {
|
|
364
364
|
const b = k === c;
|
|
365
365
|
return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d(
|
|
366
366
|
"button",
|
|
@@ -379,12 +379,12 @@ function We({
|
|
|
379
379
|
cursor: t ? void 0 : "pointer",
|
|
380
380
|
padding: t ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)"
|
|
381
381
|
},
|
|
382
|
-
children: o ? o(
|
|
383
|
-
/* @__PURE__ */ d("span", { style: { opacity: 0.75, marginRight: "0.35em" }, children: i(
|
|
384
|
-
|
|
382
|
+
children: o ? o(y, k, b, u) : /* @__PURE__ */ Ae("span", { children: [
|
|
383
|
+
/* @__PURE__ */ d("span", { style: { opacity: 0.75, marginRight: "0.35em" }, children: i(y.startSeconds) }),
|
|
384
|
+
y.title
|
|
385
385
|
] })
|
|
386
386
|
}
|
|
387
|
-
) }, `${
|
|
387
|
+
) }, `${y.startSeconds}-${y.title}`);
|
|
388
388
|
}) });
|
|
389
389
|
}
|
|
390
390
|
We.displayName = "Ginger.Current.Chapters";
|
|
@@ -412,8 +412,8 @@ function Je({
|
|
|
412
412
|
unstyled: s = !1,
|
|
413
413
|
imgStyle: c
|
|
414
414
|
}) {
|
|
415
|
-
const g = I(), m = V(g),
|
|
416
|
-
if (!
|
|
415
|
+
const g = I(), m = V(g), y = Xr(g);
|
|
416
|
+
if (!y) {
|
|
417
417
|
const b = a ?? n ?? null;
|
|
418
418
|
return b ? /* @__PURE__ */ d("span", { className: e, style: r, children: b }) : null;
|
|
419
419
|
}
|
|
@@ -431,7 +431,7 @@ function Je({
|
|
|
431
431
|
children: /* @__PURE__ */ d(
|
|
432
432
|
"img",
|
|
433
433
|
{
|
|
434
|
-
src:
|
|
434
|
+
src: y,
|
|
435
435
|
alt: k,
|
|
436
436
|
sizes: t,
|
|
437
437
|
loading: i,
|
|
@@ -480,8 +480,8 @@ function rr({
|
|
|
480
480
|
}) {
|
|
481
481
|
const u = I(), s = u.tracks.length;
|
|
482
482
|
if (s === 0) {
|
|
483
|
-
const
|
|
484
|
-
return
|
|
483
|
+
const y = i ?? t ?? null;
|
|
484
|
+
return y ? /* @__PURE__ */ d("span", { className: n, style: a, children: y }) : null;
|
|
485
485
|
}
|
|
486
486
|
const c = String(u.currentIndex + e), g = String(s), m = `${c}${r}${g}`;
|
|
487
487
|
return o ? /* @__PURE__ */ d("span", { className: n, style: a, children: o({ index: c, length: g, label: m }, u) }) : /* @__PURE__ */ d("span", { className: n, style: a, children: m });
|
|
@@ -697,144 +697,196 @@ function dr({
|
|
|
697
697
|
pauseLabel: r = "Pause",
|
|
698
698
|
playAriaLabel: n,
|
|
699
699
|
pauseAriaLabel: a,
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
700
|
+
children: t,
|
|
701
|
+
type: i = "button",
|
|
702
|
+
onClick: o,
|
|
703
|
+
...u
|
|
703
704
|
}) {
|
|
704
|
-
const
|
|
705
|
-
playAriaLabel: n ??
|
|
706
|
-
pauseAriaLabel: a ??
|
|
705
|
+
const s = N(), c = typeof e == "string" ? e : s.play, g = typeof r == "string" ? r : s.pause, m = pn({
|
|
706
|
+
playAriaLabel: n ?? c,
|
|
707
|
+
pauseAriaLabel: a ?? g
|
|
707
708
|
});
|
|
708
709
|
return /* @__PURE__ */ d(
|
|
709
710
|
"button",
|
|
710
711
|
{
|
|
711
|
-
...
|
|
712
|
-
type:
|
|
713
|
-
"aria-label":
|
|
714
|
-
onClick: (
|
|
715
|
-
|
|
712
|
+
...u,
|
|
713
|
+
type: i,
|
|
714
|
+
"aria-label": m.ariaLabel,
|
|
715
|
+
onClick: (y) => {
|
|
716
|
+
m.toggle(), o == null || o(y);
|
|
716
717
|
},
|
|
717
|
-
children:
|
|
718
|
+
children: t ?? (m.isPaused ? e : r)
|
|
718
719
|
}
|
|
719
720
|
);
|
|
720
721
|
}
|
|
721
722
|
dr.displayName = "Ginger.Control.PlayPause";
|
|
722
|
-
function fr({ type: e = "button",
|
|
723
|
-
const { repeatMode:
|
|
724
|
-
return /* @__PURE__ */ d(
|
|
725
|
-
|
|
726
|
-
|
|
723
|
+
function fr({ type: e = "button", ariaLabel: r, onClick: n, ...a }) {
|
|
724
|
+
const { repeatMode: t, cycleRepeat: i } = _(), u = N().repeat[t];
|
|
725
|
+
return /* @__PURE__ */ d(
|
|
726
|
+
"button",
|
|
727
|
+
{
|
|
728
|
+
...a,
|
|
729
|
+
type: e,
|
|
730
|
+
"aria-label": r ?? u,
|
|
731
|
+
onClick: (s) => {
|
|
732
|
+
i(), n == null || n(s);
|
|
733
|
+
},
|
|
734
|
+
children: u
|
|
735
|
+
}
|
|
736
|
+
);
|
|
727
737
|
}
|
|
728
738
|
fr.displayName = "Ginger.Control.Repeat";
|
|
729
|
-
function pr({
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
739
|
+
function pr({
|
|
740
|
+
type: e = "button",
|
|
741
|
+
children: r = "Next",
|
|
742
|
+
ariaLabel: n,
|
|
743
|
+
onClick: a,
|
|
744
|
+
...t
|
|
745
|
+
}) {
|
|
746
|
+
const { next: i } = _(), o = N();
|
|
747
|
+
return /* @__PURE__ */ d(
|
|
748
|
+
"button",
|
|
749
|
+
{
|
|
750
|
+
...t,
|
|
751
|
+
type: e,
|
|
752
|
+
"aria-label": n ?? o.nextTrack,
|
|
753
|
+
onClick: (u) => {
|
|
754
|
+
i(), a == null || a(u);
|
|
755
|
+
},
|
|
756
|
+
children: r
|
|
757
|
+
}
|
|
758
|
+
);
|
|
734
759
|
}
|
|
735
760
|
pr.displayName = "Ginger.Control.Next";
|
|
736
|
-
function gr({
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
761
|
+
function gr({
|
|
762
|
+
type: e = "button",
|
|
763
|
+
children: r = "Previous",
|
|
764
|
+
ariaLabel: n,
|
|
765
|
+
onClick: a,
|
|
766
|
+
...t
|
|
767
|
+
}) {
|
|
768
|
+
const { prev: i } = _(), o = N();
|
|
769
|
+
return /* @__PURE__ */ d(
|
|
770
|
+
"button",
|
|
771
|
+
{
|
|
772
|
+
...t,
|
|
773
|
+
type: e,
|
|
774
|
+
"aria-label": n ?? o.previousTrack,
|
|
775
|
+
onClick: (u) => {
|
|
776
|
+
i(), a == null || a(u);
|
|
777
|
+
},
|
|
778
|
+
children: r
|
|
779
|
+
}
|
|
780
|
+
);
|
|
741
781
|
}
|
|
742
782
|
gr.displayName = "Ginger.Control.Previous";
|
|
743
|
-
function mr({
|
|
744
|
-
|
|
783
|
+
function mr({
|
|
784
|
+
type: e = "button",
|
|
785
|
+
children: r = "Shuffle",
|
|
786
|
+
ariaLabel: n,
|
|
787
|
+
onClick: a,
|
|
788
|
+
...t
|
|
789
|
+
}) {
|
|
790
|
+
const { isShuffled: i, toggleShuffle: o } = _(), u = N();
|
|
745
791
|
return /* @__PURE__ */ d(
|
|
746
792
|
"button",
|
|
747
793
|
{
|
|
748
|
-
...
|
|
794
|
+
...t,
|
|
749
795
|
type: e,
|
|
750
|
-
"aria-pressed":
|
|
751
|
-
"aria-label":
|
|
752
|
-
onClick: (
|
|
753
|
-
|
|
796
|
+
"aria-pressed": i,
|
|
797
|
+
"aria-label": n ?? u.shuffle,
|
|
798
|
+
onClick: (s) => {
|
|
799
|
+
o(), a == null || a(s);
|
|
754
800
|
},
|
|
755
801
|
children: r
|
|
756
802
|
}
|
|
757
803
|
);
|
|
758
804
|
}
|
|
759
805
|
mr.displayName = "Ginger.Control.Shuffle";
|
|
760
|
-
function yr({ inputStyle: e, style: r, unstyled: n = !1,
|
|
761
|
-
const
|
|
806
|
+
function yr({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: a, ...t }) {
|
|
807
|
+
const i = dn(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
762
808
|
return /* @__PURE__ */ d(
|
|
763
809
|
"input",
|
|
764
810
|
{
|
|
765
|
-
...
|
|
811
|
+
...t,
|
|
766
812
|
type: "range",
|
|
767
|
-
min:
|
|
768
|
-
max:
|
|
769
|
-
step:
|
|
770
|
-
value:
|
|
771
|
-
"aria-label":
|
|
772
|
-
"aria-valuetext":
|
|
773
|
-
onInput:
|
|
774
|
-
onChange:
|
|
775
|
-
style:
|
|
813
|
+
min: i.min,
|
|
814
|
+
max: i.max,
|
|
815
|
+
step: i.step,
|
|
816
|
+
value: i.value,
|
|
817
|
+
"aria-label": a ?? i.ariaLabel,
|
|
818
|
+
"aria-valuetext": i.ariaValueText,
|
|
819
|
+
onInput: i.onSeekInput,
|
|
820
|
+
onChange: i.onSeekChange,
|
|
821
|
+
style: o
|
|
776
822
|
}
|
|
777
823
|
);
|
|
778
824
|
}
|
|
779
825
|
yr.displayName = "Ginger.Control.SeekBar";
|
|
780
|
-
function hr({ inputStyle: e, style: r, unstyled: n = !1,
|
|
781
|
-
const
|
|
826
|
+
function hr({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: a, ...t }) {
|
|
827
|
+
const i = fn(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
782
828
|
return /* @__PURE__ */ d(
|
|
783
829
|
"input",
|
|
784
830
|
{
|
|
785
|
-
...
|
|
831
|
+
...t,
|
|
786
832
|
type: "range",
|
|
787
|
-
min:
|
|
788
|
-
max:
|
|
789
|
-
step:
|
|
790
|
-
value:
|
|
791
|
-
"aria-label":
|
|
792
|
-
"aria-valuetext":
|
|
793
|
-
onInput:
|
|
794
|
-
onChange:
|
|
795
|
-
style:
|
|
833
|
+
min: i.min,
|
|
834
|
+
max: i.max,
|
|
835
|
+
step: i.step,
|
|
836
|
+
value: i.value,
|
|
837
|
+
"aria-label": a ?? i.ariaLabel,
|
|
838
|
+
"aria-valuetext": i.ariaValueText,
|
|
839
|
+
onInput: i.onVolumeInput,
|
|
840
|
+
onChange: i.onVolumeChange,
|
|
841
|
+
style: o
|
|
796
842
|
}
|
|
797
843
|
);
|
|
798
844
|
}
|
|
799
845
|
hr.displayName = "Ginger.Control.Volume";
|
|
800
846
|
function br({
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
847
|
+
ariaLabel: e,
|
|
848
|
+
muteLabel: r,
|
|
849
|
+
unmuteLabel: n,
|
|
850
|
+
type: a = "button",
|
|
851
|
+
onClick: t,
|
|
852
|
+
...i
|
|
806
853
|
}) {
|
|
807
|
-
const { muted:
|
|
854
|
+
const { muted: o, toggleMute: u } = j(), s = N(), c = r ?? s.mute, g = n ?? s.unmute;
|
|
808
855
|
return /* @__PURE__ */ d(
|
|
809
856
|
"button",
|
|
810
857
|
{
|
|
811
|
-
...
|
|
812
|
-
type:
|
|
813
|
-
"aria-pressed":
|
|
814
|
-
"aria-label":
|
|
815
|
-
onClick: (
|
|
816
|
-
|
|
858
|
+
...i,
|
|
859
|
+
type: a,
|
|
860
|
+
"aria-pressed": o,
|
|
861
|
+
"aria-label": e ?? (o ? s.unmute : s.mute),
|
|
862
|
+
onClick: (m) => {
|
|
863
|
+
u(), t == null || t(m);
|
|
817
864
|
},
|
|
818
|
-
children:
|
|
865
|
+
children: o ? g : c
|
|
819
866
|
}
|
|
820
867
|
);
|
|
821
868
|
}
|
|
822
869
|
br.displayName = "Ginger.Control.Mute";
|
|
823
870
|
const gn = [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
824
|
-
function vr({
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
871
|
+
function vr({
|
|
872
|
+
rates: e = gn,
|
|
873
|
+
style: r,
|
|
874
|
+
ariaLabel: n,
|
|
875
|
+
...a
|
|
876
|
+
}) {
|
|
877
|
+
const { playbackRate: t, setPlaybackRate: i } = j(), o = N(), u = P(
|
|
878
|
+
() => Array.from(/* @__PURE__ */ new Set([...e, t])).sort((s, c) => s - c),
|
|
879
|
+
[e, t]
|
|
828
880
|
);
|
|
829
881
|
return /* @__PURE__ */ d(
|
|
830
882
|
"select",
|
|
831
883
|
{
|
|
832
|
-
...
|
|
833
|
-
"aria-label":
|
|
834
|
-
value: String(
|
|
884
|
+
...a,
|
|
885
|
+
"aria-label": n ?? o.playbackSpeed,
|
|
886
|
+
value: String(t),
|
|
835
887
|
style: r,
|
|
836
|
-
onChange: (
|
|
837
|
-
children:
|
|
888
|
+
onChange: (s) => i(Number(s.currentTarget.value)),
|
|
889
|
+
children: u.map((s) => /* @__PURE__ */ d("option", { value: String(s), children: s === 1 ? o.playbackRateNormal : o.playbackRateTimes(s) }, s))
|
|
838
890
|
}
|
|
839
891
|
);
|
|
840
892
|
}
|
|
@@ -903,7 +955,7 @@ function Mr({
|
|
|
903
955
|
onClick: o,
|
|
904
956
|
...u
|
|
905
957
|
}) {
|
|
906
|
-
const { playOnSelect: s } = mn(), { tracks: c, currentIndex: g, playTrackAt: m, selectTrackAt:
|
|
958
|
+
const { playOnSelect: s } = mn(), { tracks: c, currentIndex: g, playTrackAt: m, selectTrackAt: y } = _(), k = e === g, b = c[e], S = b != null ? /* @__PURE__ */ Ae("span", { children: [
|
|
907
959
|
b.title,
|
|
908
960
|
b.artist ? ` — ${b.artist}` : ""
|
|
909
961
|
] }) : null;
|
|
@@ -927,7 +979,7 @@ function Mr({
|
|
|
927
979
|
},
|
|
928
980
|
...u,
|
|
929
981
|
onClick: (p) => {
|
|
930
|
-
o == null || o(p), !p.defaultPrevented && (s ? m(e) :
|
|
982
|
+
o == null || o(p), !p.defaultPrevented && (s ? m(e) : y(e));
|
|
931
983
|
},
|
|
932
984
|
children: t ?? S
|
|
933
985
|
}
|
|
@@ -1287,7 +1339,7 @@ function En({
|
|
|
1287
1339
|
initialMuted: c = !1,
|
|
1288
1340
|
initialPlaybackRate: g = 1,
|
|
1289
1341
|
initialStateKey: m,
|
|
1290
|
-
locale:
|
|
1342
|
+
locale: y,
|
|
1291
1343
|
mediaSession: k = !1,
|
|
1292
1344
|
beforePlay: b,
|
|
1293
1345
|
onPlayBlocked: S,
|
|
@@ -1304,7 +1356,7 @@ function En({
|
|
|
1304
1356
|
onError: ne
|
|
1305
1357
|
}) {
|
|
1306
1358
|
var Fe;
|
|
1307
|
-
const $ = O(null), [l,
|
|
1359
|
+
const $ = O(null), [l, h] = wr(
|
|
1308
1360
|
xn,
|
|
1309
1361
|
void 0,
|
|
1310
1362
|
() => Tr({
|
|
@@ -1356,7 +1408,7 @@ function En({
|
|
|
1356
1408
|
if (X.current === m) return;
|
|
1357
1409
|
X.current = m;
|
|
1358
1410
|
const f = Pe.current;
|
|
1359
|
-
|
|
1411
|
+
h({
|
|
1360
1412
|
type: "INIT",
|
|
1361
1413
|
payload: {
|
|
1362
1414
|
tracks: f.tracks,
|
|
@@ -1371,7 +1423,7 @@ function En({
|
|
|
1371
1423
|
playbackRate: f.playbackRate
|
|
1372
1424
|
}
|
|
1373
1425
|
});
|
|
1374
|
-
}, [m,
|
|
1426
|
+
}, [m, h]), E(() => {
|
|
1375
1427
|
Le.current = l;
|
|
1376
1428
|
}, [l]);
|
|
1377
1429
|
const De = l.tracks[l.currentIndex] ?? null;
|
|
@@ -1389,58 +1441,58 @@ function En({
|
|
|
1389
1441
|
te.current !== l.isPaused && (l.isPaused ? ee == null || ee() : Z == null || Z()), te.current = l.isPaused;
|
|
1390
1442
|
}, [l.isPaused, ee, Z]);
|
|
1391
1443
|
const L = v(() => {
|
|
1392
|
-
|
|
1444
|
+
h({ type: "PLAY" });
|
|
1393
1445
|
}, []), D = v(() => {
|
|
1394
1446
|
var f;
|
|
1395
|
-
|
|
1447
|
+
h({ type: "PAUSE" }), (f = $.current) == null || f.pause();
|
|
1396
1448
|
}, []), ae = v(() => {
|
|
1397
1449
|
l.isPaused ? L() : D();
|
|
1398
1450
|
}, [D, L, l.isPaused]), F = v((f) => {
|
|
1399
1451
|
const M = $.current;
|
|
1400
1452
|
M && Number.isFinite(f) && (M.currentTime = Math.max(0, f));
|
|
1401
1453
|
}, []), ie = v((f) => {
|
|
1402
|
-
|
|
1454
|
+
h({ type: "SET_VOLUME", payload: Ee(f) });
|
|
1403
1455
|
}, []), oe = v((f) => {
|
|
1404
|
-
|
|
1456
|
+
h({ type: "SET_MUTED", payload: f });
|
|
1405
1457
|
}, []), ue = v(() => {
|
|
1406
|
-
|
|
1458
|
+
h({ type: "TOGGLE_MUTE" });
|
|
1407
1459
|
}, []), se = v((f) => {
|
|
1408
|
-
|
|
1460
|
+
h({ type: "SET_PLAYBACK_RATE", payload: Ce(f) });
|
|
1409
1461
|
}, []), Q = v(() => {
|
|
1410
|
-
|
|
1462
|
+
h({ type: "NEXT" });
|
|
1411
1463
|
}, []), H = v(() => {
|
|
1412
|
-
|
|
1464
|
+
h({ type: "PREV" });
|
|
1413
1465
|
}, []), le = v((f) => {
|
|
1414
|
-
|
|
1466
|
+
h({ type: "SET_REPEAT", payload: f });
|
|
1415
1467
|
}, []), ce = v(() => {
|
|
1416
|
-
|
|
1468
|
+
h({ type: "CYCLE_REPEAT" });
|
|
1417
1469
|
}, []), de = v(() => {
|
|
1418
|
-
|
|
1470
|
+
h({ type: "TOGGLE_SHUFFLE" });
|
|
1419
1471
|
}, []), fe = v((f, M) => {
|
|
1420
|
-
|
|
1472
|
+
h({ type: "SET_QUEUE", payload: { tracks: f, currentIndex: M } });
|
|
1421
1473
|
}, []), pe = v((f, M, x) => {
|
|
1422
|
-
|
|
1474
|
+
h({ type: "INSERT_TRACK", payload: { track: f, index: M, autoPlay: x } });
|
|
1423
1475
|
}, []), ge = v((f) => {
|
|
1424
|
-
|
|
1476
|
+
h({ type: "REMOVE_TRACK", payload: { index: f } });
|
|
1425
1477
|
}, []), me = v((f, M) => {
|
|
1426
|
-
|
|
1478
|
+
h({ type: "MOVE_TRACK", payload: { fromIndex: f, toIndex: M } });
|
|
1427
1479
|
}, []), ye = v((f) => {
|
|
1428
|
-
|
|
1480
|
+
h({ type: "ADD_NEXT", payload: { track: f } });
|
|
1429
1481
|
}, []), he = v((f) => {
|
|
1430
|
-
|
|
1482
|
+
h({ type: "SET_INDEX", payload: { index: f, autoPlay: !0 } });
|
|
1431
1483
|
}, []), be = v((f) => {
|
|
1432
|
-
|
|
1484
|
+
h({ type: "SET_INDEX", payload: { index: f, autoPlay: !1 } });
|
|
1433
1485
|
}, []), ve = v((f) => {
|
|
1434
|
-
|
|
1486
|
+
h({ type: "SET_PLAYLIST_META", payload: f });
|
|
1435
1487
|
}, []), ke = v((f) => {
|
|
1436
|
-
|
|
1488
|
+
h({ type: "SET_PLAYBACK_MODE", payload: f });
|
|
1437
1489
|
}, []), Me = v((f) => {
|
|
1438
|
-
|
|
1490
|
+
h({ type: "INIT", payload: f });
|
|
1439
1491
|
}, []);
|
|
1440
1492
|
E(() => {
|
|
1441
1493
|
if (!p || !T) return;
|
|
1442
1494
|
const f = p.get("ginger:volume"), M = p.get("ginger:muted"), x = p.get("ginger:playbackRate"), C = p.get("ginger:repeatMode"), Te = p.get("ginger:currentIndex"), G = Pe.current;
|
|
1443
|
-
|
|
1495
|
+
h({
|
|
1444
1496
|
type: "INIT",
|
|
1445
1497
|
payload: {
|
|
1446
1498
|
tracks: G.tracks,
|
|
@@ -1486,17 +1538,17 @@ function En({
|
|
|
1486
1538
|
x = await b();
|
|
1487
1539
|
} catch (C) {
|
|
1488
1540
|
const Te = C instanceof Error ? C.message : "beforePlay rejected";
|
|
1489
|
-
|
|
1541
|
+
h({ type: "MEDIA_ERROR", payload: { message: Te } });
|
|
1490
1542
|
return;
|
|
1491
1543
|
}
|
|
1492
1544
|
if (!x) {
|
|
1493
|
-
M || (
|
|
1545
|
+
M || (h({ type: "PAUSE" }), S == null || S());
|
|
1494
1546
|
return;
|
|
1495
1547
|
}
|
|
1496
1548
|
}
|
|
1497
1549
|
M || f.play().catch((x) => {
|
|
1498
1550
|
const C = x instanceof Error ? x.message : typeof x == "string" ? x : "Playback failed (e.g. autoplay blocked or unavailable source)";
|
|
1499
|
-
|
|
1551
|
+
h({ type: "MEDIA_ERROR", payload: { message: C } });
|
|
1500
1552
|
});
|
|
1501
1553
|
})(), () => {
|
|
1502
1554
|
M = !0;
|
|
@@ -1506,24 +1558,24 @@ function En({
|
|
|
1506
1558
|
const f = Br(Le.current);
|
|
1507
1559
|
if (f.kind === "replay_same") {
|
|
1508
1560
|
const x = $.current;
|
|
1509
|
-
x && (x.currentTime = 0),
|
|
1561
|
+
x && (x.currentTime = 0), h({ type: "PLAY" });
|
|
1510
1562
|
return;
|
|
1511
1563
|
}
|
|
1512
1564
|
if (f.kind === "stop") {
|
|
1513
|
-
|
|
1565
|
+
h({ type: "PAUSE" }), re == null || re();
|
|
1514
1566
|
return;
|
|
1515
1567
|
}
|
|
1516
1568
|
const M = f.nextIndex;
|
|
1517
|
-
|
|
1569
|
+
h({ type: "SET_INDEX", payload: { index: M, autoPlay: !0 } });
|
|
1518
1570
|
}, [re]), Er = P(
|
|
1519
1571
|
() => ({ play: L, pause: D, next: Q, prev: H, seek: F }),
|
|
1520
1572
|
[L, D, Q, H, F]
|
|
1521
1573
|
);
|
|
1522
1574
|
Tn(!!k, l, Er);
|
|
1523
|
-
const Ar =
|
|
1575
|
+
const Ar = y != null && y.seek && /[\u0590-\u08FF]/.test(y.seek) ? "rtl" : "ltr", Sr = P(
|
|
1524
1576
|
() => ({
|
|
1525
1577
|
state: l,
|
|
1526
|
-
dispatch:
|
|
1578
|
+
dispatch: h,
|
|
1527
1579
|
audioRef: $,
|
|
1528
1580
|
notifyEnded: xe,
|
|
1529
1581
|
init: Me,
|
|
@@ -1552,7 +1604,7 @@ function En({
|
|
|
1552
1604
|
}),
|
|
1553
1605
|
[
|
|
1554
1606
|
ce,
|
|
1555
|
-
|
|
1607
|
+
h,
|
|
1556
1608
|
Me,
|
|
1557
1609
|
Q,
|
|
1558
1610
|
xe,
|
|
@@ -1606,7 +1658,7 @@ function En({
|
|
|
1606
1658
|
selectTrackAt: be,
|
|
1607
1659
|
setPlaylistMeta: ve,
|
|
1608
1660
|
setPlaybackMode: ke,
|
|
1609
|
-
dispatch:
|
|
1661
|
+
dispatch: h
|
|
1610
1662
|
}),
|
|
1611
1663
|
[
|
|
1612
1664
|
l.tracks,
|
|
@@ -1635,7 +1687,7 @@ function En({
|
|
|
1635
1687
|
be,
|
|
1636
1688
|
ve,
|
|
1637
1689
|
ke,
|
|
1638
|
-
|
|
1690
|
+
h
|
|
1639
1691
|
]
|
|
1640
1692
|
), Rr = P(
|
|
1641
1693
|
() => ({
|
|
@@ -1654,7 +1706,7 @@ function En({
|
|
|
1654
1706
|
setPlaybackRate: se,
|
|
1655
1707
|
audioRef: $,
|
|
1656
1708
|
notifyEnded: xe,
|
|
1657
|
-
dispatch:
|
|
1709
|
+
dispatch: h
|
|
1658
1710
|
}),
|
|
1659
1711
|
[
|
|
1660
1712
|
l.currentTime,
|
|
@@ -1672,13 +1724,13 @@ function En({
|
|
|
1672
1724
|
se,
|
|
1673
1725
|
$,
|
|
1674
1726
|
xe,
|
|
1675
|
-
|
|
1727
|
+
h
|
|
1676
1728
|
]
|
|
1677
1729
|
), _r = He(l), Gr = P(
|
|
1678
1730
|
() => w ? K : { ...In, ...K },
|
|
1679
1731
|
[K, w]
|
|
1680
1732
|
);
|
|
1681
|
-
return /* @__PURE__ */ d(cn, { locale:
|
|
1733
|
+
return /* @__PURE__ */ d(cn, { locale: y, children: /* @__PURE__ */ d(Cr.Provider, { value: Pr, children: /* @__PURE__ */ d(Lr.Provider, { value: Rr, children: /* @__PURE__ */ d(Oe.Provider, { value: Sr, children: /* @__PURE__ */ d(
|
|
1682
1734
|
"div",
|
|
1683
1735
|
{
|
|
1684
1736
|
className: Se,
|
|
@@ -1763,4 +1815,4 @@ export {
|
|
|
1763
1815
|
zr as r,
|
|
1764
1816
|
sn as u
|
|
1765
1817
|
};
|
|
1766
|
-
//# sourceMappingURL=ginger-
|
|
1818
|
+
//# sourceMappingURL=ginger-8x4WzVmw.js.map
|