playron 1.0.12 → 1.0.14
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/context/SubtitleStyleContext.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/playron.cjs.js +2 -2
- package/dist/playron.es.js +35 -27
- package/dist/ui/Overlay/ContextMenu.d.ts +19 -1
- package/dist/ui/Overlay/ContextMenu.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export type { CastState, ChromecastManagerOptions } from './core/cast/Chromecast
|
|
|
34
34
|
export { default as EndCard } from './ui/Overlay/EndCard';
|
|
35
35
|
export { default as KeyboardShortcutsOverlay } from './ui/Overlay/KeyboardShortcutsOverlay';
|
|
36
36
|
export { default as ContextMenu } from './ui/Overlay/ContextMenu';
|
|
37
|
-
export type { ContextMenuAction } from './ui/Overlay/ContextMenu';
|
|
37
|
+
export type { ContextMenuAction, ContextMenuTheme } from './ui/Overlay/ContextMenu';
|
|
38
38
|
export { default as GestureHintOverlay } from './ui/Overlay/GestureHintOverlay';
|
|
39
39
|
export { ThumbnailManager } from './core/streaming/ThumbnailManager';
|
|
40
40
|
export type { ThumbnailCue } from './core/streaming/ThumbnailManager';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE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,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI;IAKtF,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,KAAK,IAAI,IAAI;IAIb,UAAU,IAAI,IAAI;IAIlB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B,QAAQ,IAAI,WAAW,GAAG,IAAI;IAI9B;;OAEG;IACG,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1B;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAInC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIpE;;OAEG;IACH,OAAO,IAAI,IAAI;CAYhB;AAGD,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/playron.cjs.js
CHANGED
|
@@ -67,7 +67,7 @@ Char: `+L[G])}return G+1&&(G+=1),U}if(L.charCodeAt(G+1)===M){G=L.indexOf(de,G),G
|
|
|
67
67
|
from { opacity: 0; transform: scale(0.96) translateY(8px); }
|
|
68
68
|
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
69
69
|
}
|
|
70
|
-
`})]}):null}function Rm({x:u,y:e,isOpen:t,onClose:n,actions:r}){const i=yt.useRef(null);return yt.useEffect(()=>{if(!t)return;const
|
|
70
|
+
`})]}):null}function Rm({x:u,y:e,isOpen:t,onClose:n,actions:r,theme:i}){const o={background:i?.background??"rgba(12, 12, 20, 0.97)",borderColor:i?.borderColor??"rgba(255,255,255,0.1)",textColor:i?.textColor??"#fff",dangerColor:i?.dangerColor??"#f87171",hoverBackground:i?.hoverBackground??"rgba(255,255,255,0.07)",iconBackground:i?.iconBackground??"rgba(255,255,255,0.08)",dividerColor:i?.dividerColor??"rgba(255,255,255,0.07)"},l=yt.useRef(null);return yt.useEffect(()=>{if(!t)return;const d=c=>{if("key"in c){c.key==="Escape"&&n();return}l.current&&!l.current.contains(c.target)&&n()};return document.addEventListener("mousedown",d),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",d)}},[t,n]),t?fe.jsxs(fe.Fragment,{children:[fe.jsx("div",{ref:l,role:"menu","aria-label":"Video options",style:{position:"absolute",left:u,top:e,zIndex:99998,background:o.background,backdropFilter:"blur(16px)",border:`1px solid ${o.borderColor}`,borderRadius:"14px",boxShadow:`0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px ${o.borderColor}`,minWidth:"240px",padding:"4px 0",fontFamily:"system-ui, -apple-system, sans-serif",animation:"ctxFadeIn 0.14s ease-out",overflow:"hidden"},children:r.map((d,c)=>fe.jsxs("div",{children:[fe.jsxs("button",{role:"menuitem",onClick:()=>{d.onClick(),n()},style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",padding:"9px 14px",background:"transparent",border:"none",color:d.danger?o.dangerColor:o.textColor,fontSize:"13.5px",textAlign:"left",cursor:"pointer",transition:"background 0.1s"},onMouseEnter:g=>{g.currentTarget.style.background=d.danger?"rgba(239,68,68,0.12)":o.hoverBackground},onMouseLeave:g=>{g.currentTarget.style.background="transparent"},children:[d.icon!==void 0&&fe.jsx("span",{style:{width:"28px",height:"28px",borderRadius:"7px",background:d.danger?"rgba(239,68,68,0.15)":o.iconBackground,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:d.danger?o.dangerColor:o.textColor,fontSize:"13px",lineHeight:1},children:d.icon}),fe.jsx("span",{style:{flex:1},children:d.label})]}),d.dividerAfter&&fe.jsx("div",{style:{height:"1px",background:o.dividerColor,margin:"3px 0"}})]},c))}),fe.jsx("style",{children:`
|
|
71
71
|
@keyframes ctxFadeIn {
|
|
72
72
|
from { opacity: 0; transform: scale(0.96) translateY(-4px); }
|
|
73
73
|
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
@@ -177,7 +177,7 @@ Char: `+L[G])}return G+1&&(G+=1),U}if(L.charCodeAt(G+1)===M){G=L.indexOf(de,G),G
|
|
|
177
177
|
0% { transform: rotate(0deg); }
|
|
178
178
|
100% { transform: rotate(360deg); }
|
|
179
179
|
}
|
|
180
|
-
`,document.head.appendChild(n)}t.appendChild(this.loadingContainer),console.log("[AdManager] Loading spinner shown")}}hideAdLoading(){if(this.onLoadingChange){this.onLoadingChange(!1),console.log("[AdManager] External loading callback triggered (false)");return}this.loadingContainer&&(this.loadingContainer.remove(),this.loadingContainer=null,console.log("[AdManager] Loading spinner hidden"))}destroy(){this.hideAdLoading(),this.adPlayer.destroy(),this.preRollPlayed=!1,this.midRollsPlayed.clear(),this.postRollPlayed=!1,this.vmapData=null,console.log("[AdManager] Destroyed")}}const Dm={bottomOffset:
|
|
180
|
+
`,document.head.appendChild(n)}t.appendChild(this.loadingContainer),console.log("[AdManager] Loading spinner shown")}}hideAdLoading(){if(this.onLoadingChange){this.onLoadingChange(!1),console.log("[AdManager] External loading callback triggered (false)");return}this.loadingContainer&&(this.loadingContainer.remove(),this.loadingContainer=null,console.log("[AdManager] Loading spinner hidden"))}destroy(){this.hideAdLoading(),this.adPlayer.destroy(),this.preRollPlayed=!1,this.midRollsPlayed.clear(),this.postRollPlayed=!1,this.vmapData=null,console.log("[AdManager] Destroyed")}}const Dm={bottomOffset:80,fontSize:18,color:"#ffffff",background:"rgba(0,0,0,0.75)"},Pm=yt.createContext({style:Dm,setStyle:()=>{}});function W_({children:u}){const[e,t]=yt.useState(Dm),n=r=>t(i=>({...i,...r}));return fe.jsx(Pm.Provider,{value:{style:e,setStyle:n},children:u})}function Nm(){return yt.useContext(Pm)}function X_({videoElement:u}){const{style:e}=Nm(),[t,n]=yt.useState([]),r=yt.useRef(""),i=yt.useRef(0);return yt.useEffect(()=>{if(!u)return;const o=()=>{const l=u.textTracks,d=[];for(let g=0;g<l.length;g++){const f=l[g];if(f.kind!=="subtitles"&&f.kind!=="captions"||f.mode==="disabled")continue;f.mode==="showing"&&(f.mode="hidden");const h=f.activeCues;if(h)for(let y=0;y<h.length;y++){const E=h[y];E.text&&d.push(E.text)}}const c=d.join("\0");c!==r.current&&(r.current=c,n(d)),i.current=requestAnimationFrame(o)};return i.current=requestAnimationFrame(o),()=>{cancelAnimationFrame(i.current)}},[u]),t.length===0?null:fe.jsx("div",{"aria-live":"polite",style:{position:"absolute",bottom:e.bottomOffset,left:"50%",transform:"translateX(-50%)",textAlign:"center",pointerEvents:"none",zIndex:200,maxWidth:"85%",display:"flex",flexDirection:"column",alignItems:"center",gap:"2px"},children:t.map((o,l)=>fe.jsx("span",{style:{display:"inline-block",fontSize:e.fontSize,lineHeight:1.4,color:e.color,background:e.background||"transparent",padding:e.background?"2px 10px":"0",borderRadius:4,whiteSpace:"pre-wrap",wordBreak:"break-word",textShadow:e.background?"none":"0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.8)"},dangerouslySetInnerHTML:{__html:o}},l))})}const yo=yt.createContext(!0);function Mm({src:u="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",defaultControls:e=!1,autoplay:t=!1,muted:n=!1,poster:r,className:i,children:o,config:l,onAdLoading:d,onNextEpisode:c,nextEpisodeTitle:g,nextEpisodeThumbnail:f,endCardCountdown:h=5}){const y=yt.useRef(null),E=yt.useRef(null),[S,C]=yt.useState(null),K=yt.useRef(null),[J,re]=yt.useState(!1),[ye,Ie]=yt.useState(!1),we=yt.useCallback(()=>Ie(!0),[]),$=yt.useCallback(()=>Ie(!1),[]),[Z,pe]=yt.useState(!1),[be,Ce]=yt.useState({x:0,y:0,open:!1}),Qe=yt.useCallback(()=>Ce(st=>({...st,open:!1})),[]),xe=yt.useCallback(st=>{st.preventDefault();const jt=y.current?.getBoundingClientRect();if(!jt)return;const Qt=st.clientX-jt.left,Ne=st.clientY-jt.top;Ce({x:Qt,y:Ne,open:!0})},[]),Je=yt.useMemo(()=>{if(!S)return[];const st=S.getVideoElement(),jt=st?.loop??!1;return[{label:jt?"Loop: On":"Loop: Off",icon:fe.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[fe.jsx("polyline",{points:"17 1 21 5 17 9"}),fe.jsx("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),fe.jsx("polyline",{points:"7 23 3 19 7 15"}),fe.jsx("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"}),jt&&fe.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",stroke:"none"})]}),onClick:()=>{if(st){const Qt=!st.loop;S.setLoop(Qt)}},dividerAfter:!1},{label:`Copy Speed (${st?.playbackRate??1}×)`,icon:fe.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[fe.jsx("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0 1 1 0 0 0-2 0"}),fe.jsx("path",{d:"M12 2a10 10 0 0 1 7.39 16.74M12 2A10 10 0 0 0 4.61 18.74"}),fe.jsx("path",{d:"m16.24 7.76-2.12 2.12"})]}),onClick:()=>{const Qt=st?.playbackRate??1;navigator.clipboard?.writeText(String(Qt)).catch(()=>{})},dividerAfter:!1},{label:"Copy Video URL",icon:fe.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[fe.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),fe.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),onClick:()=>{const Qt=st?.currentSrc??u??"";navigator.clipboard?.writeText(Qt).catch(()=>{})},dividerAfter:!0},{label:"Keyboard Shortcuts",icon:fe.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[fe.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),fe.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),onClick:()=>Ie(!0),dividerAfter:!1}]},[S,u]),{onTouchStart:Oe,onTouchMove:Me,onTouchEnd:Ve,gestureHint:ct}=Lm({player:S,skipSec:10}),{isActive:at}=q_({timeout:3e3,initialVisible:!0});G_({player:S,seekStep:10,enabled:!0,onShowShortcuts:we});const vt=yt.useMemo(()=>!l?.ads?.enabled||!l.ads.vastUrl&&!l.ads.vmapUrl?null:{enabled:!0,vastUrl:l.ads.vastUrl,vmapUrl:l.ads.vmapUrl,skipAfter:l.ads.skipAfter,timeout:l.ads.timeout,maxWrapperDepth:l.ads.maxWrapperDepth},[l?.ads?.enabled,l?.ads?.vastUrl,l?.ads?.vmapUrl,l?.ads?.skipAfter,l?.ads?.timeout,l?.ads?.maxWrapperDepth]);yt.useEffect(()=>{if(!E.current||!y.current)return;console.log("[Player] Initializing PlayerCore");const st=new Da(E.current);return st.container=y.current,C(st),()=>{console.log("[Player] Cleanup called - destroying PlayerCore"),K.current&&(console.log("[Player] Destroying AdManager"),K.current.destroy(),K.current=null),st.destroy(),C(null)}},[]),yt.useEffect(()=>{if(!S||!vt)return;console.log("[Player] Setting up ads");const st=Qt=>{re(Qt),d?.(Qt)},jt=new Y_(S,vt,st);return K.current=jt,jt.setup().catch(Qt=>{console.error("[Player] Failed to setup ads:",Qt)}),()=>{K.current&&(console.log("[Player] Cleaning up ads"),K.current.destroy(),K.current=null)}},[S,vt]);const nt=yt.useMemo(()=>l?.drm??null,[l?.drm]);return yt.useEffect(()=>{!S||!nt?.enabled||S.setupDrm(nt)},[S,nt]),yt.useEffect(()=>{S&&u&&(console.log("[Player] Setting source:",u),S.setSource(u).catch(st=>{console.error("[Player] setSource failed:",st)}))},[S,u]),yt.useEffect(()=>{if(!S||!c)return;const st=S.getVideoElement();if(!st)return;const jt=()=>pe(!0);return st.addEventListener("ended",jt),()=>st.removeEventListener("ended",jt)},[S,c]),fe.jsxs(W_,{children:[fe.jsxs("div",{ref:y,role:"region","aria-label":"Video Player",className:`playron-wrapper ${i||""}`,onContextMenu:xe,onTouchStart:Oe,onTouchMove:Me,onTouchEnd:Ve,style:{position:"relative",backgroundColor:"#000",overflow:"hidden",cursor:at?"default":"none"},children:[fe.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0}}),fe.jsx("video",{ref:E,className:`virtus-video-element ${i||""}`,style:{width:"100%",height:"100%",display:"block",aspectRatio:"16/9",objectFit:"cover",objectPosition:"center"},autoPlay:t,muted:n,controls:e,poster:r,crossOrigin:"anonymous",tabIndex:e?0:-1}),S?fe.jsx(Im,{playerInstance:S,children:fe.jsxs(yo.Provider,{value:at,children:[fe.jsx(X_,{videoElement:E.current}),fe.jsx(E_,{config:l,isAdLoading:J}),fe.jsx(Cm,{type:ct?.type??null,value:ct?.value??""}),fe.jsx(z_,{drmConfig:l?.drm}),fe.jsx(wm,{isOpen:ye,onClose:$}),c&&fe.jsx(km,{isVisible:Z,onNextEpisode:()=>{pe(!1),c()},onDismiss:()=>pe(!1),countdownSec:h,nextTitle:g,thumbnail:f}),fe.jsx(Rm,{x:be.x,y:be.y,isOpen:be.open,onClose:Qe,actions:Je}),o]})}):null]}),fe.jsx("style",{children:`
|
|
181
181
|
@keyframes gestureHintFade {
|
|
182
182
|
0% { opacity: 1; }
|
|
183
183
|
60% { opacity: 1; }
|
package/dist/playron.es.js
CHANGED
|
@@ -43942,25 +43942,33 @@ function C_({ isOpen: u, onClose: e }) {
|
|
|
43942
43942
|
}
|
|
43943
43943
|
) : null;
|
|
43944
43944
|
}
|
|
43945
|
-
function L_({ x: u, y: e, isOpen: t, onClose: n, actions: r }) {
|
|
43946
|
-
const
|
|
43945
|
+
function L_({ x: u, y: e, isOpen: t, onClose: n, actions: r, theme: i }) {
|
|
43946
|
+
const o = {
|
|
43947
|
+
background: i?.background ?? "rgba(12, 12, 20, 0.97)",
|
|
43948
|
+
borderColor: i?.borderColor ?? "rgba(255,255,255,0.1)",
|
|
43949
|
+
textColor: i?.textColor ?? "#fff",
|
|
43950
|
+
dangerColor: i?.dangerColor ?? "#f87171",
|
|
43951
|
+
hoverBackground: i?.hoverBackground ?? "rgba(255,255,255,0.07)",
|
|
43952
|
+
iconBackground: i?.iconBackground ?? "rgba(255,255,255,0.08)",
|
|
43953
|
+
dividerColor: i?.dividerColor ?? "rgba(255,255,255,0.07)"
|
|
43954
|
+
}, l = yr(null);
|
|
43947
43955
|
return Fn(() => {
|
|
43948
43956
|
if (!t) return;
|
|
43949
|
-
const
|
|
43950
|
-
if ("key" in
|
|
43951
|
-
|
|
43957
|
+
const d = (c) => {
|
|
43958
|
+
if ("key" in c) {
|
|
43959
|
+
c.key === "Escape" && n();
|
|
43952
43960
|
return;
|
|
43953
43961
|
}
|
|
43954
|
-
|
|
43962
|
+
l.current && !l.current.contains(c.target) && n();
|
|
43955
43963
|
};
|
|
43956
|
-
return document.addEventListener("mousedown",
|
|
43957
|
-
document.removeEventListener("mousedown",
|
|
43964
|
+
return document.addEventListener("mousedown", d), document.addEventListener("keydown", d), () => {
|
|
43965
|
+
document.removeEventListener("mousedown", d), document.removeEventListener("keydown", d);
|
|
43958
43966
|
};
|
|
43959
43967
|
}, [t, n]), t ? /* @__PURE__ */ Bt(Oi, { children: [
|
|
43960
43968
|
/* @__PURE__ */ ke(
|
|
43961
43969
|
"div",
|
|
43962
43970
|
{
|
|
43963
|
-
ref:
|
|
43971
|
+
ref: l,
|
|
43964
43972
|
role: "menu",
|
|
43965
43973
|
"aria-label": "Video options",
|
|
43966
43974
|
style: {
|
|
@@ -43968,24 +43976,24 @@ function L_({ x: u, y: e, isOpen: t, onClose: n, actions: r }) {
|
|
|
43968
43976
|
left: u,
|
|
43969
43977
|
top: e,
|
|
43970
43978
|
zIndex: 99998,
|
|
43971
|
-
background:
|
|
43979
|
+
background: o.background,
|
|
43972
43980
|
backdropFilter: "blur(16px)",
|
|
43973
|
-
border:
|
|
43981
|
+
border: `1px solid ${o.borderColor}`,
|
|
43974
43982
|
borderRadius: "14px",
|
|
43975
|
-
boxShadow:
|
|
43983
|
+
boxShadow: `0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px ${o.borderColor}`,
|
|
43976
43984
|
minWidth: "240px",
|
|
43977
43985
|
padding: "4px 0",
|
|
43978
43986
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
43979
43987
|
animation: "ctxFadeIn 0.14s ease-out",
|
|
43980
43988
|
overflow: "hidden"
|
|
43981
43989
|
},
|
|
43982
|
-
children: r.map((
|
|
43990
|
+
children: r.map((d, c) => /* @__PURE__ */ Bt("div", { children: [
|
|
43983
43991
|
/* @__PURE__ */ Bt(
|
|
43984
43992
|
"button",
|
|
43985
43993
|
{
|
|
43986
43994
|
role: "menuitem",
|
|
43987
43995
|
onClick: () => {
|
|
43988
|
-
|
|
43996
|
+
d.onClick(), n();
|
|
43989
43997
|
},
|
|
43990
43998
|
style: {
|
|
43991
43999
|
display: "flex",
|
|
@@ -43995,38 +44003,38 @@ function L_({ x: u, y: e, isOpen: t, onClose: n, actions: r }) {
|
|
|
43995
44003
|
padding: "9px 14px",
|
|
43996
44004
|
background: "transparent",
|
|
43997
44005
|
border: "none",
|
|
43998
|
-
color:
|
|
44006
|
+
color: d.danger ? o.dangerColor : o.textColor,
|
|
43999
44007
|
fontSize: "13.5px",
|
|
44000
44008
|
textAlign: "left",
|
|
44001
44009
|
cursor: "pointer",
|
|
44002
44010
|
transition: "background 0.1s"
|
|
44003
44011
|
},
|
|
44004
|
-
onMouseEnter: (
|
|
44005
|
-
|
|
44012
|
+
onMouseEnter: (g) => {
|
|
44013
|
+
g.currentTarget.style.background = d.danger ? "rgba(239,68,68,0.12)" : o.hoverBackground;
|
|
44006
44014
|
},
|
|
44007
|
-
onMouseLeave: (
|
|
44008
|
-
|
|
44015
|
+
onMouseLeave: (g) => {
|
|
44016
|
+
g.currentTarget.style.background = "transparent";
|
|
44009
44017
|
},
|
|
44010
44018
|
children: [
|
|
44011
|
-
|
|
44019
|
+
d.icon !== void 0 && /* @__PURE__ */ ke("span", { style: {
|
|
44012
44020
|
width: "28px",
|
|
44013
44021
|
height: "28px",
|
|
44014
44022
|
borderRadius: "7px",
|
|
44015
|
-
background:
|
|
44023
|
+
background: d.danger ? "rgba(239,68,68,0.15)" : o.iconBackground,
|
|
44016
44024
|
display: "flex",
|
|
44017
44025
|
alignItems: "center",
|
|
44018
44026
|
justifyContent: "center",
|
|
44019
44027
|
flexShrink: 0,
|
|
44020
|
-
color:
|
|
44028
|
+
color: d.danger ? o.dangerColor : o.textColor,
|
|
44021
44029
|
fontSize: "13px",
|
|
44022
44030
|
lineHeight: 1
|
|
44023
|
-
}, children:
|
|
44024
|
-
/* @__PURE__ */ ke("span", { style: { flex: 1 }, children:
|
|
44031
|
+
}, children: d.icon }),
|
|
44032
|
+
/* @__PURE__ */ ke("span", { style: { flex: 1 }, children: d.label })
|
|
44025
44033
|
]
|
|
44026
44034
|
}
|
|
44027
44035
|
),
|
|
44028
|
-
|
|
44029
|
-
] },
|
|
44036
|
+
d.dividerAfter && /* @__PURE__ */ ke("div", { style: { height: "1px", background: o.dividerColor, margin: "3px 0" } })
|
|
44037
|
+
] }, c))
|
|
44030
44038
|
}
|
|
44031
44039
|
),
|
|
44032
44040
|
/* @__PURE__ */ ke("style", { children: `
|
|
@@ -45484,7 +45492,7 @@ class q_ {
|
|
|
45484
45492
|
}
|
|
45485
45493
|
}
|
|
45486
45494
|
const Rm = {
|
|
45487
|
-
bottomOffset:
|
|
45495
|
+
bottomOffset: 80,
|
|
45488
45496
|
fontSize: 18,
|
|
45489
45497
|
color: "#ffffff",
|
|
45490
45498
|
background: "rgba(0,0,0,0.75)"
|
|
@@ -5,13 +5,31 @@ export interface ContextMenuAction {
|
|
|
5
5
|
dividerAfter?: boolean;
|
|
6
6
|
danger?: boolean;
|
|
7
7
|
}
|
|
8
|
+
/** Customize the visual appearance of the ContextMenu. */
|
|
9
|
+
export interface ContextMenuTheme {
|
|
10
|
+
/** Panel background. Default: 'rgba(12, 12, 20, 0.97)' */
|
|
11
|
+
background?: string;
|
|
12
|
+
/** Panel border color. Default: 'rgba(255,255,255,0.1)' */
|
|
13
|
+
borderColor?: string;
|
|
14
|
+
/** Normal item text color. Default: '#fff' */
|
|
15
|
+
textColor?: string;
|
|
16
|
+
/** Danger item color. Default: '#f87171' */
|
|
17
|
+
dangerColor?: string;
|
|
18
|
+
/** Row hover background. Default: 'rgba(255,255,255,0.07)' */
|
|
19
|
+
hoverBackground?: string;
|
|
20
|
+
/** Icon pill background. Default: 'rgba(255,255,255,0.08)' */
|
|
21
|
+
iconBackground?: string;
|
|
22
|
+
/** Divider line color. Default: 'rgba(255,255,255,0.07)' */
|
|
23
|
+
dividerColor?: string;
|
|
24
|
+
}
|
|
8
25
|
interface ContextMenuProps {
|
|
9
26
|
x: number;
|
|
10
27
|
y: number;
|
|
11
28
|
isOpen: boolean;
|
|
12
29
|
onClose: () => void;
|
|
13
30
|
actions: ContextMenuAction[];
|
|
31
|
+
theme?: ContextMenuTheme;
|
|
14
32
|
}
|
|
15
|
-
export default function ContextMenu({ x, y, isOpen, onClose, actions }: ContextMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
export default function ContextMenu({ x, y, isOpen, onClose, actions, theme }: ContextMenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
34
|
export {};
|
|
17
35
|
//# sourceMappingURL=ContextMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/ui/Overlay/ContextMenu.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,gBAAgB;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,iBAAiB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/ui/Overlay/ContextMenu.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,CA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