@geekapps/silo-elements-nextjs 0.2.27 → 0.2.28
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/dist/VideoPlayer.js +164 -99
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +164 -99
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/VideoPlayer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo, useRef, useState, useCallback, useEffect } from 'react';
|
|
2
2
|
import gsap from 'gsap';
|
|
3
|
-
import { Play,
|
|
3
|
+
import { Play, Pause, VolumeX, Volume2, Captions, Settings, Minimize, Maximize } from 'lucide-react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
var AUTO_QUALITY = {
|
|
@@ -742,7 +742,7 @@ function Video({
|
|
|
742
742
|
{
|
|
743
743
|
ref: chromeRef,
|
|
744
744
|
onClick: togglePlay,
|
|
745
|
-
className: `absolute inset-0 z-30 flex flex-col
|
|
745
|
+
className: `absolute inset-0 z-30 flex flex-col transition-opacity duration-200 ${isFullscreen ? "justify-between" : "justify-end"} ${controlsVisible ? "opacity-100" : "opacity-0 pointer-events-none"}`,
|
|
746
746
|
children: [
|
|
747
747
|
isFullscreen && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-x-0 top-0 h-32 bg-linear-to-b from-black/70 to-transparent" }),
|
|
748
748
|
/* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-40 bg-linear-to-t from-black/80 to-transparent" }),
|
|
@@ -753,20 +753,52 @@ function Video({
|
|
|
753
753
|
/* @__PURE__ */ jsxs("footer", { onClick: (e) => e.stopPropagation(), className: "relative z-10 px-4 pb-4 text-white", children: [
|
|
754
754
|
settingsOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
755
755
|
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-40", onClick: () => setSettingsOpen(false) }),
|
|
756
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-full right-0 z-50 mb-
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
756
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-full right-0 z-50 mb-2 w-56 overflow-hidden rounded-2xl bg-[#1c1c1e]/95 shadow-2xl backdrop-blur-xl ring-1 ring-white/10", style: { animation: "spFadeIn 0.15s ease" }, children: [
|
|
757
|
+
settingsTab === "root" && /* @__PURE__ */ jsx("div", { children: [
|
|
758
|
+
{ id: "quality", label: "Qualidade", value: qualities.find((q) => q.id === selectedQuality)?.label ?? "Auto" },
|
|
759
|
+
...parsed.subtitles.length > 0 ? [{ id: "subtitles", label: "Legendas", value: subtitleStyle.track === "off" ? "Desligado" : parsed.subtitles.find((s) => s.srclang === subtitleStyle.track)?.label ?? subtitleStyle.track }] : [],
|
|
760
|
+
...audioTracks.length > 1 ? [{ id: "audio", label: "\xC1udio", value: audioTracks.find((t) => t.id === selectedAudio)?.label ?? "" }] : [],
|
|
761
|
+
{ id: "playback", label: "Velocidade", value: playbackRate === 1 ? "Normal" : `${playbackRate}\xD7` }
|
|
762
|
+
].map((item) => /* @__PURE__ */ jsxs(
|
|
763
|
+
"button",
|
|
764
|
+
{
|
|
765
|
+
type: "button",
|
|
766
|
+
onClick: () => setSettingsTab(item.id),
|
|
767
|
+
className: "flex w-full items-center justify-between gap-3 px-4 py-3 text-sm transition hover:bg-white/8 first:pt-3.5 last:pb-3.5",
|
|
768
|
+
children: [
|
|
769
|
+
/* @__PURE__ */ jsx("span", { className: "text-white/80", children: item.label }),
|
|
770
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-xs text-white/40", children: [
|
|
771
|
+
item.value,
|
|
772
|
+
/* @__PURE__ */ jsx("svg", { className: "size-3 opacity-50", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M4.5 3l3 3-3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
773
|
+
] })
|
|
774
|
+
]
|
|
775
|
+
},
|
|
776
|
+
item.id
|
|
777
|
+
)) }),
|
|
778
|
+
settingsTab === "quality" && /* @__PURE__ */ jsxs("div", { children: [
|
|
779
|
+
/* @__PURE__ */ jsxs(
|
|
780
|
+
"button",
|
|
781
|
+
{
|
|
782
|
+
type: "button",
|
|
783
|
+
onClick: () => setSettingsTab("root"),
|
|
784
|
+
className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
|
|
785
|
+
children: [
|
|
786
|
+
/* @__PURE__ */ jsx("svg", { className: "size-3.5", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M7.5 3L4.5 6l3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
787
|
+
"Qualidade"
|
|
788
|
+
]
|
|
789
|
+
}
|
|
790
|
+
),
|
|
762
791
|
/* @__PURE__ */ jsx("div", { className: "py-1.5", children: [...qualities].reverse().map((quality) => /* @__PURE__ */ jsxs(
|
|
763
792
|
"button",
|
|
764
793
|
{
|
|
765
794
|
type: "button",
|
|
766
|
-
onClick: () =>
|
|
767
|
-
|
|
795
|
+
onClick: () => {
|
|
796
|
+
changeQuality(quality.id);
|
|
797
|
+
setSettingsTab("root");
|
|
798
|
+
},
|
|
799
|
+
className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
|
|
768
800
|
children: [
|
|
769
|
-
/* @__PURE__ */ jsx("
|
|
801
|
+
/* @__PURE__ */ jsx("svg", { className: `size-4 shrink-0 ${selectedQuality === quality.id ? "text-white" : "text-transparent"}`, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 4.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
770
802
|
/* @__PURE__ */ jsxs("span", { className: selectedQuality === quality.id ? "font-semibold text-white" : "text-white/55", children: [
|
|
771
803
|
quality.label,
|
|
772
804
|
quality.id === "auto" ? " (ABR)" : ""
|
|
@@ -776,73 +808,98 @@ function Video({
|
|
|
776
808
|
quality.id
|
|
777
809
|
)) })
|
|
778
810
|
] }),
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
811
|
+
settingsTab === "subtitles" && /* @__PURE__ */ jsxs("div", { children: [
|
|
812
|
+
/* @__PURE__ */ jsxs(
|
|
813
|
+
"button",
|
|
814
|
+
{
|
|
815
|
+
type: "button",
|
|
816
|
+
onClick: () => setSettingsTab("root"),
|
|
817
|
+
className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ jsx("svg", { className: "size-3.5", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M7.5 3L4.5 6l3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
820
|
+
"Legendas"
|
|
821
|
+
]
|
|
822
|
+
}
|
|
823
|
+
),
|
|
824
|
+
/* @__PURE__ */ jsx("div", { className: "py-1.5", children: [{ srclang: "off", label: "Desligado" }, ...parsed.subtitles].map((s) => /* @__PURE__ */ jsxs(
|
|
825
|
+
"button",
|
|
826
|
+
{
|
|
827
|
+
type: "button",
|
|
828
|
+
onClick: () => {
|
|
829
|
+
const next = s.srclang === "off" ? "off" : s.srclang;
|
|
830
|
+
setSubtitleMode(next);
|
|
831
|
+
setSubtitleStyle((st) => ({ ...st, track: next }));
|
|
832
|
+
setSettingsTab("root");
|
|
799
833
|
},
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
834
|
+
className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
|
|
835
|
+
children: [
|
|
836
|
+
/* @__PURE__ */ jsx("svg", { className: `size-4 shrink-0 ${subtitleStyle.track === s.srclang ? "text-white" : "text-transparent"}`, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 4.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
837
|
+
/* @__PURE__ */ jsx("span", { className: subtitleStyle.track === s.srclang ? "font-semibold text-white" : "text-white/55", children: s.label })
|
|
838
|
+
]
|
|
839
|
+
},
|
|
840
|
+
s.srclang
|
|
841
|
+
)) })
|
|
842
|
+
] }),
|
|
843
|
+
settingsTab === "audio" && /* @__PURE__ */ jsxs("div", { children: [
|
|
844
|
+
/* @__PURE__ */ jsxs(
|
|
845
|
+
"button",
|
|
846
|
+
{
|
|
847
|
+
type: "button",
|
|
848
|
+
onClick: () => setSettingsTab("root"),
|
|
849
|
+
className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
|
|
850
|
+
children: [
|
|
851
|
+
/* @__PURE__ */ jsx("svg", { className: "size-3.5", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M7.5 3L4.5 6l3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
852
|
+
"\xC1udio"
|
|
853
|
+
]
|
|
854
|
+
}
|
|
855
|
+
),
|
|
856
|
+
/* @__PURE__ */ jsx("div", { className: "py-1.5", children: audioTracks.map((track) => /* @__PURE__ */ jsxs(
|
|
857
|
+
"button",
|
|
858
|
+
{
|
|
859
|
+
type: "button",
|
|
860
|
+
onClick: () => {
|
|
861
|
+
changeAudio(track.id);
|
|
862
|
+
setSettingsTab("root");
|
|
818
863
|
},
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
"
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
864
|
+
className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
|
|
865
|
+
children: [
|
|
866
|
+
/* @__PURE__ */ jsx("svg", { className: `size-4 shrink-0 ${selectedAudio === track.id ? "text-white" : "text-transparent"}`, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 4.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
867
|
+
/* @__PURE__ */ jsx("span", { className: selectedAudio === track.id ? "font-semibold text-white" : "text-white/55", children: track.label })
|
|
868
|
+
]
|
|
869
|
+
},
|
|
870
|
+
track.id
|
|
871
|
+
)) })
|
|
872
|
+
] }),
|
|
873
|
+
settingsTab === "playback" && /* @__PURE__ */ jsxs("div", { children: [
|
|
874
|
+
/* @__PURE__ */ jsxs(
|
|
875
|
+
"button",
|
|
876
|
+
{
|
|
877
|
+
type: "button",
|
|
878
|
+
onClick: () => setSettingsTab("root"),
|
|
879
|
+
className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
|
|
880
|
+
children: [
|
|
881
|
+
/* @__PURE__ */ jsx("svg", { className: "size-3.5", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M7.5 3L4.5 6l3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
882
|
+
"Velocidade"
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
),
|
|
886
|
+
/* @__PURE__ */ jsx("div", { className: "py-1.5", children: PLAYBACK_SPEEDS.map((speed) => /* @__PURE__ */ jsxs(
|
|
887
|
+
"button",
|
|
888
|
+
{
|
|
889
|
+
type: "button",
|
|
890
|
+
onClick: () => {
|
|
891
|
+
setPlaybackRate(speed);
|
|
892
|
+
setSettingsOpen(false);
|
|
893
|
+
setSettingsTab("root");
|
|
894
|
+
},
|
|
895
|
+
className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
|
|
896
|
+
children: [
|
|
897
|
+
/* @__PURE__ */ jsx("svg", { className: `size-4 shrink-0 ${playbackRate === speed ? "text-white" : "text-transparent"}`, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 4.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
898
|
+
/* @__PURE__ */ jsx("span", { className: playbackRate === speed ? "font-semibold text-white" : "text-white/55", children: speed === 1 ? "Normal" : `${speed}\xD7` })
|
|
899
|
+
]
|
|
900
|
+
},
|
|
901
|
+
speed
|
|
902
|
+
)) })
|
|
846
903
|
] })
|
|
847
904
|
] }),
|
|
848
905
|
/* @__PURE__ */ jsx("style", { children: `@keyframes spFadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}` })
|
|
@@ -856,30 +913,38 @@ function Video({
|
|
|
856
913
|
onPointerDown: handleProgressPointerDown,
|
|
857
914
|
className: "group relative mb-2 h-5 cursor-pointer",
|
|
858
915
|
children: [
|
|
859
|
-
preview &&
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
916
|
+
preview && (() => {
|
|
917
|
+
const srcW = preview.cue.w ?? 160;
|
|
918
|
+
const srcH = preview.cue.h ?? 90;
|
|
919
|
+
const aspect = srcW / srcH;
|
|
920
|
+
const thumbH = Math.max(120, Math.min(playerHeight * 0.25, 300));
|
|
921
|
+
const thumbW = Math.round(thumbH * aspect);
|
|
922
|
+
const scale = thumbH / srcH;
|
|
923
|
+
return /* @__PURE__ */ jsxs(
|
|
924
|
+
"div",
|
|
925
|
+
{
|
|
926
|
+
className: "pointer-events-none absolute bottom-10 z-60 -translate-x-1/2 rounded-xl bg-black/80 p-1.5 shadow-2xl ring-1 ring-white/15 backdrop-blur",
|
|
927
|
+
style: { left: preview.left },
|
|
928
|
+
children: [
|
|
929
|
+
/* @__PURE__ */ jsx(
|
|
930
|
+
"div",
|
|
931
|
+
{
|
|
932
|
+
className: "overflow-hidden rounded-lg bg-neutral-900",
|
|
933
|
+
style: {
|
|
934
|
+
width: thumbW,
|
|
935
|
+
height: thumbH,
|
|
936
|
+
backgroundImage: `url(${preview.cue.image})`,
|
|
937
|
+
backgroundPosition: preview.cue.x != null && preview.cue.y != null ? `-${preview.cue.x * scale}px -${preview.cue.y * scale}px` : "center",
|
|
938
|
+
backgroundSize: preview.cue.x != null ? `auto ${thumbH}px` : "cover",
|
|
939
|
+
backgroundRepeat: "no-repeat"
|
|
940
|
+
}
|
|
876
941
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
),
|
|
942
|
+
),
|
|
943
|
+
/* @__PURE__ */ jsx("div", { className: "pt-1.5 text-center text-xs font-semibold text-white/80", children: formatTime(preview.time) })
|
|
944
|
+
]
|
|
945
|
+
}
|
|
946
|
+
);
|
|
947
|
+
})(),
|
|
883
948
|
/* @__PURE__ */ jsxs("div", { className: "absolute left-0 right-0 top-1/2 -translate-y-1/2 overflow-hidden rounded-full bg-white/22 transition-[height] duration-150 group-hover:h-1", style: { height: "2px" }, children: [
|
|
884
949
|
/* @__PURE__ */ jsx(
|
|
885
950
|
"div",
|