video-split-screen 1.0.15 → 1.0.16

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/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),y={1:{type:"1",label:"1分屏",count:1,cols:1,rows:1},2:{type:"2",label:"2分屏",count:2,cols:2,rows:1},3:{type:"3",label:"3分屏",count:3,cols:2,rows:2},4:{type:"4",label:"4分屏",count:4,cols:2,rows:2},6:{type:"6",label:"6分屏",count:6,cols:3,rows:2},7:{type:"7",label:"7分屏",count:7,cols:4,rows:4},8:{type:"8",label:"8分屏",count:8,cols:4,rows:4},9:{type:"9",label:"9分屏",count:9,cols:3,rows:3},10:{type:"10",label:"10分屏",count:10,cols:6,rows:4},13:{type:"13",label:"13分屏",count:13,cols:4,rows:4},16:{type:"16",label:"16分屏",count:16,cols:4,rows:4}},I={};function G(i){if(I[i])return I[i];const o={1:[{col:1,colSpan:1,row:1,rowSpan:1}],2:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1}],3:[{col:1,colSpan:1,row:1,rowSpan:2,isMain:!0},{col:2,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],4:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],6:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1}],7:[{col:1,colSpan:2,row:1,rowSpan:2},{col:3,colSpan:2,row:1,rowSpan:2},{col:1,colSpan:2,row:3,rowSpan:2},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],8:[{col:1,colSpan:3,row:1,rowSpan:3,isMain:!0},{col:4,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],9:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1}],10:[{col:1,colSpan:5,row:1,rowSpan:3,isMain:!0},{col:6,colSpan:1,row:1,rowSpan:1},{col:6,colSpan:1,row:2,rowSpan:1},{col:6,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1},{col:5,colSpan:1,row:4,rowSpan:1},{col:6,colSpan:1,row:4,rowSpan:1}],13:[{col:1,colSpan:2,row:1,rowSpan:2,isMain:!0},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],16:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}]}[i]||[];return o.length>0&&(I[i]=o),o}function M(){return Object.keys(y)}const K={class:"layout-icon"},Z={key:0,viewBox:"0 0 48 48",fill:"none"},ee={key:1,viewBox:"0 0 48 48",fill:"none"},te={key:2,viewBox:"0 0 48 48",fill:"none"},oe={key:3,viewBox:"0 0 48 48",fill:"none"},re={key:4,viewBox:"0 0 48 48",fill:"none"},ae={key:5,viewBox:"0 0 48 48",fill:"none"},le={key:6,viewBox:"0 0 48 48",fill:"none"},ne={key:7,viewBox:"0 0 48 48",fill:"none"},ce={key:8,viewBox:"0 0 54 48",fill:"none"},ie={key:9,viewBox:"0 0 48 48",fill:"none"},de={key:10,viewBox:"0 0 48 48",fill:"none"},se=e.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(i){return(v,o)=>(e.openBlock(),e.createElementBlock("div",K,[i.type==="1"?(e.openBlock(),e.createElementBlock("svg",Z,[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"4",y:"4",width:"40",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1)])])):i.type==="2"?(e.openBlock(),e.createElementBlock("svg",ee,[...o[1]||(o[1]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):i.type==="3"?(e.openBlock(),e.createElementBlock("svg",te,[...o[2]||(o[2]=[e.createElementVNode("rect",{x:"4",y:"4",width:"20",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1),e.createElementVNode("rect",{x:"26",y:"4",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"26",y:"25",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):i.type==="4"?(e.openBlock(),e.createElementBlock("svg",oe,[...o[3]||(o[3]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"4",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):i.type==="6"?(e.openBlock(),e.createElementBlock("svg",re,[...o[4]||(o[4]=[e.createStaticVNode('<rect x="3" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="3" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="24" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',6)])])):i.type==="7"?(e.openBlock(),e.createElementBlock("svg",ae,[...o[5]||(o[5]=[e.createStaticVNode('<rect x="4" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="4" y="25" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="25" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',7)])])):i.type==="8"?(e.openBlock(),e.createElementBlock("svg",le,[...o[6]||(o[6]=[e.createStaticVNode('<rect x="4" y="4" width="28" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="35" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',8)])])):i.type==="9"?(e.openBlock(),e.createElementBlock("svg",ne,[...o[7]||(o[7]=[e.createStaticVNode('<rect x="4" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',9)])])):i.type==="10"?(e.openBlock(),e.createElementBlock("svg",ce,[...o[8]||(o[8]=[e.createStaticVNode('<rect x="3" y="4" width="36" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="41" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="3" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="11" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="19" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="27" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="6" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="42" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',10)])])):i.type==="13"?(e.openBlock(),e.createElementBlock("svg",ie,[...o[9]||(o[9]=[e.createStaticVNode('<rect x="4" y="4" width="18" height="18" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="24" y="4" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="14" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="34" width="10" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',13)])])):i.type==="16"?(e.openBlock(),e.createElementBlock("svg",de,[...o[10]||(o[10]=[e.createStaticVNode('<rect x="4" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="4" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="15" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="26" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="37" width="7" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',16)])])):e.createCommentVNode("",!0)]))}}),O=(i,v)=>{const o=i.__vccOpts||i;for(const[g,w]of v)o[g]=w;return o},$=O(se,[["__scopeId","data-v-31e0404d"]]),he={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},we={class:"layout-buttons"},ue=["onClick","title","aria-label","aria-pressed"],pe={class:"layout-label"},ve={class:"video-grid-container",role:"region","aria-label":"视频网格"},ye=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],ke={class:"video-placeholder"},ge={class:"placeholder-number"},Se=.5,me="grabbing",fe="0.8",Ce=e.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{}},emits:["layoutChange","videosChange"],setup(i,{emit:v}){const o=i,g=v,w=e.ref(o.layout);e.watch(()=>o.layout,t=>{w.value=t});const P=e.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:M()),p=e.shallowRef([]);function E(t){const r=Array.isArray(t)?t:o.videos||[],l=V.value,a={};p.value.forEach((s,h)=>{s&&s.id!==void 0&&(a[s.id]=s.__labelNumber??h+1)});const c=Array.from({length:l}).map((s,h)=>{const n=r[h];if(n){const k=a[n.id]??n.__labelNumber??h+1;return{...n,__labelNumber:k}}});p.value=c}e.watch(()=>o.videos,t=>{if(!Array.isArray(t)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}E(t)},{flush:"post"});let A=!1;e.watch(p,t=>{!A&&Array.isArray(t)&&g("videosChange",t)});const _=e.computed(()=>{const t=y[w.value];return t||(console.warn(`[VideoGridLayout] Invalid layout type: ${w.value}, fallback to '4'`),y[4])}),S=e.computed(()=>G(w.value)),V=e.computed(()=>{var t;return((t=_.value)==null?void 0:t.count)||4}),x=e.computed(()=>p.value.slice(0,V.value).map(t=>t).filter(Boolean));E(o.videos),e.watch(V,()=>{E(o.videos)});const T=e.computed(()=>{const t=S.value.map((r,l)=>({p:r,idx:l}));return t.sort((r,l)=>r.p.row===l.p.row?(r.p.col||0)-(l.p.col||0):(r.p.row||0)-(l.p.row||0)),t.map(r=>r.idx)}),u=e.ref(-1),m=e.ref(-1),b=e.shallowRef(null),d=e.shallowRef(null);let f=null,C=null;const z=e.computed(()=>{const t=_.value;return{display:"grid",gridTemplateColumns:(t==null?void 0:t.colTemplate)||`repeat(${(t==null?void 0:t.cols)||2}, 1fr)`,gridTemplateRows:(t==null?void 0:t.rowTemplate)||`repeat(${(t==null?void 0:t.rows)||2}, 1fr)`,gap:"4px",width:o.width||"100%",height:o.height||"100%"}}),F=e.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function Y(t){const r=t,l=T.value[r];if(Array.isArray(o.placeholders)&&o.placeholders[l]!==void 0)return String(o.placeholders[l]);if(typeof o.placeholderText=="function")try{return o.placeholderText(r)}catch{return String(r+1)}return o.placeholderText?String(o.placeholderText):String(r+1)}function H(t){const r=S.value[t];return!r||typeof r.col!="number"||typeof r.row!="number"?{}:{gridColumn:`${r.col} / span ${r.colSpan}`,gridRow:`${r.row} / span ${r.rowSpan}`}}function U(t){const r=S.value[t];return(r==null?void 0:r.isMain)||!1}function j(t){w.value=t,g("layoutChange",w.value)}function B(){if(b.value&&document.body.contains(b.value)){try{document.body.removeChild(b.value)}catch(t){console.warn("[VideoGridLayout] Failed to cleanup drag image:",t)}b.value=null}if(d.value&&document.body.contains(d.value)){try{document.body.removeChild(d.value)}catch{}d.value=null}f&&(document.removeEventListener("mousemove",f),f=null),C&&(document.removeEventListener("drag",C),C=null)}function q(t,r){if(r<0||r>=p.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(u.value=r,!t.dataTransfer)return;t.dataTransfer.effectAllowed="move";const a=t.target.closest(".video-item");if(a)try{if(B(),t.dataTransfer){t.dataTransfer.effectAllowed="move";const n=new Image;n.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",t.dataTransfer.setDragImage(n,0,0)}const c=a.cloneNode(!0);c.querySelectorAll(".progress-bar, .play-button").forEach(n=>n.remove()),c.querySelectorAll('[style*="transition"], [style*="animation"], .video-icon').forEach(n=>{try{n.style.transition="none",n.style.animation="none"}catch{}}),c.style.position="fixed",c.style.margin="0",c.style.pointerEvents="none",c.style.opacity=fe,c.style.zIndex="9999",document.body.appendChild(c),d.value=c;try{const n=a.getBoundingClientRect();c.style.width=`${n.width}px`,c.style.height=`${n.height}px`}catch{}f=n=>{if(!d.value)return;const k=d.value.offsetWidth||0,L=d.value.offsetHeight||0,N=Math.max(0,n.clientX-k/2),D=Math.max(0,n.clientY-L/2);d.value.style.left=`${N}px`,d.value.style.top=`${D}px`},document.addEventListener("mousemove",f),C=n=>{if(!d.value)return;const k=d.value.offsetWidth||0,L=d.value.offsetHeight||0,N=Math.max(0,(n.clientX||0)-k/2),D=Math.max(0,(n.clientY||0)-L/2);d.value.style.left=`${N}px`,d.value.style.top=`${D}px`},document.addEventListener("drag",C),a.style.opacity=String(Se),a.style.cursor=me,a.style.borderColor="#ff6b6b"}catch(c){console.error("[VideoGridLayout] Drag start error:",c),B()}}function W(t,r){t.preventDefault(),t.stopPropagation();const l=u.value;if(l===-1||l===r){u.value=-1;return}if(r<0||r>=S.value.length){console.warn("[VideoGridLayout] Invalid drop index:",r),u.value=-1;return}try{const a=t.currentTarget;a&&(a.style.backgroundColor="rgba(66, 184, 131, 0.3)",a.style.borderColor="#42b883",setTimeout(()=>{a.style.backgroundColor="",a.style.borderColor=""},200));const c=[...p.value],s=c[l],h=c[r];c[l]=h,c[r]=s,A=!0,p.value=c,setTimeout(()=>{A=!1,g("videosChange",p.value.filter(Boolean))},0)}catch(a){console.error("[VideoGridLayout] Drop error:",a)}finally{u.value=-1}}function X(t,r){t.preventDefault(),u.value!==-1&&u.value!==r&&(m.value=r)}function Q(t,r){t.preventDefault();const l=t.target,a=t.relatedTarget;l.contains(a)||m.value===r&&(m.value=-1)}function J(t){const l=t.target.closest(".video-item");l&&(l.style.opacity="1",l.style.cursor="move",l.style.borderColor=""),B(),u.value=-1,m.value=-1}return e.onBeforeUnmount(()=>{B()}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:e.normalizeStyle(F.value)},[i.showToolbar?(e.openBlock(),e.createElementBlock("div",he,[r[1]||(r[1]=e.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),e.createElementVNode("div",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.value,l=>{var a,c,s;return e.openBlock(),e.createElementBlock("button",{key:l,class:e.normalizeClass(["layout-btn",{active:w.value===l}]),onClick:h=>j(l),title:((a=e.unref(y)[l])==null?void 0:a.label)||"","aria-label":`切换到${((c=e.unref(y)[l])==null?void 0:c.label)||""}布局`,"aria-pressed":w.value===l,type:"button"},[e.createVNode($,{type:l},null,8,["type"]),e.createElementVNode("span",pe,e.toDisplayString(((s=e.unref(y)[l])==null?void 0:s.label)||""),1)],10,ue)}),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",ve,[e.createElementVNode("div",{class:"video-grid",style:e.normalizeStyle(z.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,(l,a)=>{var c,s,h;return e.openBlock(),e.createElementBlock("div",{key:((c=x.value[a])==null?void 0:c.id)??a,class:e.normalizeClass(["video-item",{"main-video":U(a),dragging:u.value===a,"drag-over":m.value===a&&u.value!==a}]),style:e.normalizeStyle(H(a)),draggable:!0,"aria-label":`视频 ${a+1}: ${((s=x.value[a])==null?void 0:s.title)||((h=x.value[a])==null?void 0:h.id)||""}`,role:"article",tabindex:"0",onDragstart:n=>q(n,a),onDragover:r[0]||(r[0]=e.withModifiers(()=>{},["prevent"])),onDragenter:n=>X(n,a),onDragleave:n=>Q(n,a),onDrop:n=>W(n,a),onDragend:J},[e.renderSlot(t.$slots,"video",{video:x.value[a],index:a},()=>[e.createElementVNode("div",ke,[e.createElementVNode("div",ge,e.toDisplayString(Y(T.value.indexOf(a))),1)])],!0)],46,ye)}),128))],4)])],4))}}),R=O(Ce,[["__scopeId","data-v-f0958f8e"]]),xe={VideoGridLayout:R,VideoLayoutIcon:$},be={install(i){Object.entries(xe).forEach(([v,o])=>{i.component(v,o)})}};exports.LAYOUT_CONFIGS=y;exports.VideoGridLayout=R;exports.VideoLayoutIcon=$;exports.default=be;exports.getAllLayoutTypes=M;exports.getLayoutPositions=G;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k={1:{type:"1",label:"1分屏",count:1,cols:1,rows:1},2:{type:"2",label:"2分屏",count:2,cols:2,rows:1},3:{type:"3",label:"3分屏",count:3,cols:2,rows:2},4:{type:"4",label:"4分屏",count:4,cols:2,rows:2},6:{type:"6",label:"6分屏",count:6,cols:3,rows:2},7:{type:"7",label:"7分屏",count:7,cols:4,rows:4},8:{type:"8",label:"8分屏",count:8,cols:4,rows:4},9:{type:"9",label:"9分屏",count:9,cols:3,rows:3},10:{type:"10",label:"10分屏",count:10,cols:6,rows:4},13:{type:"13",label:"13分屏",count:13,cols:4,rows:4},16:{type:"16",label:"16分屏",count:16,cols:4,rows:4}},I={};function G(c){if(I[c])return I[c];const o={1:[{col:1,colSpan:1,row:1,rowSpan:1}],2:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1}],3:[{col:1,colSpan:1,row:1,rowSpan:2,isMain:!0},{col:2,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],4:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],6:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1}],7:[{col:1,colSpan:2,row:1,rowSpan:2},{col:3,colSpan:2,row:1,rowSpan:2},{col:1,colSpan:2,row:3,rowSpan:2},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],8:[{col:1,colSpan:3,row:1,rowSpan:3,isMain:!0},{col:4,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],9:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1}],10:[{col:1,colSpan:5,row:1,rowSpan:3,isMain:!0},{col:6,colSpan:1,row:1,rowSpan:1},{col:6,colSpan:1,row:2,rowSpan:1},{col:6,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1},{col:5,colSpan:1,row:4,rowSpan:1},{col:6,colSpan:1,row:4,rowSpan:1}],13:[{col:1,colSpan:2,row:1,rowSpan:2,isMain:!0},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],16:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}]}[c]||[];return o.length>0&&(I[c]=o),o}function O(){return Object.keys(k)}const W={class:"layout-icon"},Z={key:0,viewBox:"0 0 48 48",fill:"none"},ee={key:1,viewBox:"0 0 48 48",fill:"none"},te={key:2,viewBox:"0 0 48 48",fill:"none"},oe={key:3,viewBox:"0 0 48 48",fill:"none"},re={key:4,viewBox:"0 0 48 48",fill:"none"},le={key:5,viewBox:"0 0 48 48",fill:"none"},ae={key:6,viewBox:"0 0 48 48",fill:"none"},ne={key:7,viewBox:"0 0 48 48",fill:"none"},ce={key:8,viewBox:"0 0 54 48",fill:"none"},ie={key:9,viewBox:"0 0 48 48",fill:"none"},de={key:10,viewBox:"0 0 48 48",fill:"none"},se=e.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(c){return(y,o)=>(e.openBlock(),e.createElementBlock("div",W,[c.type==="1"?(e.openBlock(),e.createElementBlock("svg",Z,[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"4",y:"4",width:"40",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1)])])):c.type==="2"?(e.openBlock(),e.createElementBlock("svg",ee,[...o[1]||(o[1]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):c.type==="3"?(e.openBlock(),e.createElementBlock("svg",te,[...o[2]||(o[2]=[e.createElementVNode("rect",{x:"4",y:"4",width:"20",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1),e.createElementVNode("rect",{x:"26",y:"4",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"26",y:"25",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):c.type==="4"?(e.openBlock(),e.createElementBlock("svg",oe,[...o[3]||(o[3]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"4",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):c.type==="6"?(e.openBlock(),e.createElementBlock("svg",re,[...o[4]||(o[4]=[e.createStaticVNode('<rect x="3" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="3" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="24" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',6)])])):c.type==="7"?(e.openBlock(),e.createElementBlock("svg",le,[...o[5]||(o[5]=[e.createStaticVNode('<rect x="4" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="4" y="25" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="25" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',7)])])):c.type==="8"?(e.openBlock(),e.createElementBlock("svg",ae,[...o[6]||(o[6]=[e.createStaticVNode('<rect x="4" y="4" width="28" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="35" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',8)])])):c.type==="9"?(e.openBlock(),e.createElementBlock("svg",ne,[...o[7]||(o[7]=[e.createStaticVNode('<rect x="4" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',9)])])):c.type==="10"?(e.openBlock(),e.createElementBlock("svg",ce,[...o[8]||(o[8]=[e.createStaticVNode('<rect x="3" y="4" width="36" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="41" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="3" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="11" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="19" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="27" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="6" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="42" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',10)])])):c.type==="13"?(e.openBlock(),e.createElementBlock("svg",ie,[...o[9]||(o[9]=[e.createStaticVNode('<rect x="4" y="4" width="18" height="18" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="24" y="4" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="14" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="34" width="10" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',13)])])):c.type==="16"?(e.openBlock(),e.createElementBlock("svg",de,[...o[10]||(o[10]=[e.createStaticVNode('<rect x="4" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="4" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="15" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="26" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="37" width="7" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',16)])])):e.createCommentVNode("",!0)]))}}),R=(c,y)=>{const o=c.__vccOpts||c;for(const[S,u]of y)o[S]=u;return o},$=R(se,[["__scopeId","data-v-31e0404d"]]),he={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},we={class:"layout-buttons"},ue=["onClick","title","aria-label","aria-pressed"],pe={class:"layout-label"},ve={class:"video-grid-container",role:"region","aria-label":"视频网格"},ye=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],ke={class:"video-placeholder"},ge={class:"placeholder-number"},Se=.5,me="grabbing",fe="0.8",Ce=e.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{}},emits:["layoutChange","videosChange"],setup(c,{emit:y}){const o=c,S=y,u=e.ref(o.layout);e.watch(()=>o.layout,t=>{u.value=t});const P=e.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:O()),v=e.shallowRef([]);function V(t){const r=Array.isArray(t)?t:o.videos||[],a=N.value,l={};v.value.forEach((n,w)=>{n&&n.id!==void 0&&(l[n.id]=n.__labelNumber??w+1)});const d=Array.from({length:a}).map((n,w)=>{const s=r[w];if(s){const i=l[s.id]??s.__labelNumber??w+1;return{...s,__labelNumber:i}}});v.value=d}e.watch(()=>o.videos,t=>{if(!Array.isArray(t)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}V(t)},{flush:"post"});let L=!1;e.watch(v,t=>{!L&&Array.isArray(t)&&S("videosChange",t)});const _=e.computed(()=>{const t=k[u.value];return t||(console.warn(`[VideoGridLayout] Invalid layout type: ${u.value}, fallback to '4'`),k[4])}),m=e.computed(()=>G(u.value)),N=e.computed(()=>{var t;return((t=_.value)==null?void 0:t.count)||4}),b=e.computed(()=>v.value.slice(0,N.value).map(t=>t).filter(Boolean));V(o.videos),e.watch(N,()=>{V(o.videos)});const T=e.computed(()=>{const t=m.value.map((r,a)=>({p:r,idx:a}));return t.sort((r,a)=>r.p.row===a.p.row?(r.p.col||0)-(a.p.col||0):(r.p.row||0)-(a.p.row||0)),t.map(r=>r.idx)}),p=e.ref(-1),f=e.ref(-1),B=e.shallowRef(null),h=e.shallowRef(null);let g={x:0,y:0},C=null,x=null;const Y=e.computed(()=>{const t=_.value;return{display:"grid",gridTemplateColumns:(t==null?void 0:t.colTemplate)||`repeat(${(t==null?void 0:t.cols)||2}, 1fr)`,gridTemplateRows:(t==null?void 0:t.rowTemplate)||`repeat(${(t==null?void 0:t.rows)||2}, 1fr)`,gap:"4px",width:o.width||"100%",height:o.height||"100%"}}),z=e.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function F(t){const r=t,a=T.value[r];if(Array.isArray(o.placeholders)&&o.placeholders[a]!==void 0)return String(o.placeholders[a]);if(typeof o.placeholderText=="function")try{return o.placeholderText(r)}catch{return String(r+1)}return o.placeholderText?String(o.placeholderText):String(r+1)}function U(t){const r=m.value[t];return!r||typeof r.col!="number"||typeof r.row!="number"?{}:{gridColumn:`${r.col} / span ${r.colSpan}`,gridRow:`${r.row} / span ${r.rowSpan}`}}function j(t){const r=m.value[t];return(r==null?void 0:r.isMain)||!1}function q(t){u.value=t,S("layoutChange",u.value)}function E(){if(B.value&&document.body.contains(B.value)){try{document.body.removeChild(B.value)}catch(t){console.warn("[VideoGridLayout] Failed to cleanup drag image:",t)}B.value=null}if(h.value&&document.body.contains(h.value)){try{document.body.removeChild(h.value)}catch{}h.value=null}C&&(document.removeEventListener("mousemove",C),C=null),x&&(document.removeEventListener("drag",x),x=null)}function H(t,r){if(r<0||r>=v.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(p.value=r,!t.dataTransfer)return;t.dataTransfer.effectAllowed="move";const l=t.target.closest(".video-item");if(l)try{E();const d=l.getBoundingClientRect();if(g={x:(t.clientX||0)-d.left,y:(t.clientY||0)-d.top},t.dataTransfer){t.dataTransfer.effectAllowed="move";const i=new Image;i.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",t.dataTransfer.setDragImage(i,0,0)}const n=l.cloneNode(!0);n.querySelectorAll(".progress-bar, .play-button").forEach(i=>i.remove()),n.querySelectorAll('[style*="transition"], [style*="animation"], .video-icon').forEach(i=>{try{i.style.transition="none",i.style.animation="none"}catch{}}),n.style.position="fixed",n.style.margin="0",n.style.pointerEvents="none",n.style.opacity=fe,n.style.zIndex="9999",document.body.appendChild(n),h.value=n;try{const i=l.getBoundingClientRect();n.style.width=`${i.width}px`,n.style.height=`${i.height}px`}catch{}C=i=>{if(!h.value)return;const A=i.clientX-g.x,D=i.clientY-g.y;h.value.style.left=`${A}px`,h.value.style.top=`${D}px`},document.addEventListener("mousemove",C),x=i=>{if(!h.value)return;const A=(i.clientX||0)-g.x,D=(i.clientY||0)-g.y;h.value.style.left=`${A}px`,h.value.style.top=`${D}px`},document.addEventListener("drag",x),l.style.opacity=String(Se),l.style.cursor=me,l.style.borderColor="#ff6b6b"}catch(d){console.error("[VideoGridLayout] Drag start error:",d),E()}}function X(t,r){t.preventDefault(),t.stopPropagation();const a=p.value;if(a===-1||a===r){p.value=-1;return}if(r<0||r>=m.value.length){console.warn("[VideoGridLayout] Invalid drop index:",r),p.value=-1;return}try{const l=t.currentTarget;l&&(l.style.backgroundColor="rgba(66, 184, 131, 0.3)",l.style.borderColor="#42b883",setTimeout(()=>{l.style.backgroundColor="",l.style.borderColor=""},200));const d=[...v.value],n=d[a],w=d[r];d[a]=w,d[r]=n,L=!0,v.value=d,setTimeout(()=>{L=!1,S("videosChange",v.value.filter(Boolean))},0)}catch(l){console.error("[VideoGridLayout] Drop error:",l)}finally{p.value=-1}}function Q(t,r){t.preventDefault(),p.value!==-1&&p.value!==r&&(f.value=r)}function J(t,r){t.preventDefault();const a=t.target,l=t.relatedTarget;a.contains(l)||f.value===r&&(f.value=-1)}function K(t){const a=t.target.closest(".video-item");a&&(a.style.opacity="1",a.style.cursor="move",a.style.borderColor=""),E(),p.value=-1,f.value=-1,g={x:0,y:0}}return e.onBeforeUnmount(()=>{E()}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:e.normalizeStyle(z.value)},[c.showToolbar?(e.openBlock(),e.createElementBlock("div",he,[r[1]||(r[1]=e.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),e.createElementVNode("div",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.value,a=>{var l,d,n;return e.openBlock(),e.createElementBlock("button",{key:a,class:e.normalizeClass(["layout-btn",{active:u.value===a}]),onClick:w=>q(a),title:((l=e.unref(k)[a])==null?void 0:l.label)||"","aria-label":`切换到${((d=e.unref(k)[a])==null?void 0:d.label)||""}布局`,"aria-pressed":u.value===a,type:"button"},[e.createVNode($,{type:a},null,8,["type"]),e.createElementVNode("span",pe,e.toDisplayString(((n=e.unref(k)[a])==null?void 0:n.label)||""),1)],10,ue)}),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",ve,[e.createElementVNode("div",{class:"video-grid",style:e.normalizeStyle(Y.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(a,l)=>{var d,n,w;return e.openBlock(),e.createElementBlock("div",{key:((d=b.value[l])==null?void 0:d.id)??l,class:e.normalizeClass(["video-item",{"main-video":j(l),dragging:p.value===l,"drag-over":f.value===l&&p.value!==l}]),style:e.normalizeStyle(U(l)),draggable:!0,"aria-label":`视频 ${l+1}: ${((n=b.value[l])==null?void 0:n.title)||((w=b.value[l])==null?void 0:w.id)||""}`,role:"article",tabindex:"0",onDragstart:s=>H(s,l),onDragover:r[0]||(r[0]=e.withModifiers(()=>{},["prevent"])),onDragenter:s=>Q(s,l),onDragleave:s=>J(s,l),onDrop:s=>X(s,l),onDragend:K},[e.renderSlot(t.$slots,"video",{video:b.value[l],index:l},()=>[e.createElementVNode("div",ke,[e.createElementVNode("div",ge,e.toDisplayString(F(T.value.indexOf(l))),1)])],!0)],46,ye)}),128))],4)])],4))}}),M=R(Ce,[["__scopeId","data-v-13a48217"]]),xe={VideoGridLayout:M,VideoLayoutIcon:$},be={install(c){Object.entries(xe).forEach(([y,o])=>{c.component(y,o)})}};exports.LAYOUT_CONFIGS=k;exports.VideoGridLayout=M;exports.VideoLayoutIcon=$;exports.default=be;exports.getAllLayoutTypes=O;exports.getLayoutPositions=G;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as W, createElementBlock as i, openBlock as s, createCommentVNode as X, createElementVNode as d, createStaticVNode as S, ref as O, watch as I, computed as g, shallowRef as R, onBeforeUnmount as dt, normalizeStyle as N, Fragment as U, renderList as z, unref as P, normalizeClass as j, createVNode as ht, toDisplayString as q, withModifiers as wt, renderSlot as ut } from "vue";
2
- const C = {
1
+ import { defineComponent as q, createElementBlock as s, openBlock as d, createCommentVNode as Q, createElementVNode as h, createStaticVNode as C, ref as R, watch as E, computed as k, shallowRef as M, onBeforeUnmount as dt, normalizeStyle as N, Fragment as z, renderList as H, unref as P, normalizeClass as X, createVNode as ht, toDisplayString as j, withModifiers as wt, renderSlot as ut } from "vue";
2
+ const x = {
3
3
  1: {
4
4
  type: "1",
5
5
  label: "1分屏",
@@ -77,10 +77,10 @@ const C = {
77
77
  cols: 4,
78
78
  rows: 4
79
79
  }
80
- }, H = {};
81
- function pt(c) {
82
- if (H[c])
83
- return H[c];
80
+ }, Y = {};
81
+ function pt(n) {
82
+ if (Y[n])
83
+ return Y[n];
84
84
  const e = {
85
85
  1: [
86
86
  { col: 1, colSpan: 1, row: 1, rowSpan: 1 }
@@ -183,11 +183,11 @@ function pt(c) {
183
183
  { col: 3, colSpan: 1, row: 4, rowSpan: 1 },
184
184
  { col: 4, colSpan: 1, row: 4, rowSpan: 1 }
185
185
  ]
186
- }[c] || [];
187
- return e.length > 0 && (H[c] = e), e;
186
+ }[n] || [];
187
+ return e.length > 0 && (Y[n] = e), e;
188
188
  }
189
189
  function vt() {
190
- return Object.keys(C);
190
+ return Object.keys(x);
191
191
  }
192
192
  const yt = { class: "layout-icon" }, gt = {
193
193
  key: 0,
@@ -201,11 +201,11 @@ const yt = { class: "layout-icon" }, gt = {
201
201
  key: 2,
202
202
  viewBox: "0 0 48 48",
203
203
  fill: "none"
204
- }, ft = {
204
+ }, Ct = {
205
205
  key: 3,
206
206
  viewBox: "0 0 48 48",
207
207
  fill: "none"
208
- }, Ct = {
208
+ }, ft = {
209
209
  key: 4,
210
210
  viewBox: "0 0 48 48",
211
211
  fill: "none"
@@ -233,15 +233,15 @@ const yt = { class: "layout-icon" }, gt = {
233
233
  key: 10,
234
234
  viewBox: "0 0 48 48",
235
235
  fill: "none"
236
- }, $t = /* @__PURE__ */ W({
236
+ }, $t = /* @__PURE__ */ q({
237
237
  __name: "VideoLayoutIcon",
238
238
  props: {
239
239
  type: {}
240
240
  },
241
- setup(c) {
242
- return (k, e) => (s(), i("div", yt, [
243
- c.type === "1" ? (s(), i("svg", gt, [...e[0] || (e[0] = [
244
- d("rect", {
241
+ setup(n) {
242
+ return (S, e) => (d(), s("div", yt, [
243
+ n.type === "1" ? (d(), s("svg", gt, [...e[0] || (e[0] = [
244
+ h("rect", {
245
245
  x: "4",
246
246
  y: "4",
247
247
  width: "40",
@@ -249,8 +249,8 @@ const yt = { class: "layout-icon" }, gt = {
249
249
  stroke: "currentColor",
250
250
  "stroke-width": "2"
251
251
  }, null, -1)
252
- ])])) : c.type === "2" ? (s(), i("svg", kt, [...e[1] || (e[1] = [
253
- d("rect", {
252
+ ])])) : n.type === "2" ? (d(), s("svg", kt, [...e[1] || (e[1] = [
253
+ h("rect", {
254
254
  x: "4",
255
255
  y: "4",
256
256
  width: "19",
@@ -258,7 +258,7 @@ const yt = { class: "layout-icon" }, gt = {
258
258
  stroke: "currentColor",
259
259
  "stroke-width": "1.5"
260
260
  }, null, -1),
261
- d("rect", {
261
+ h("rect", {
262
262
  x: "25",
263
263
  y: "4",
264
264
  width: "19",
@@ -266,8 +266,8 @@ const yt = { class: "layout-icon" }, gt = {
266
266
  stroke: "currentColor",
267
267
  "stroke-width": "1.5"
268
268
  }, null, -1)
269
- ])])) : c.type === "3" ? (s(), i("svg", St, [...e[2] || (e[2] = [
270
- d("rect", {
269
+ ])])) : n.type === "3" ? (d(), s("svg", St, [...e[2] || (e[2] = [
270
+ h("rect", {
271
271
  x: "4",
272
272
  y: "4",
273
273
  width: "20",
@@ -275,7 +275,7 @@ const yt = { class: "layout-icon" }, gt = {
275
275
  stroke: "currentColor",
276
276
  "stroke-width": "2"
277
277
  }, null, -1),
278
- d("rect", {
278
+ h("rect", {
279
279
  x: "26",
280
280
  y: "4",
281
281
  width: "18",
@@ -283,7 +283,7 @@ const yt = { class: "layout-icon" }, gt = {
283
283
  stroke: "currentColor",
284
284
  "stroke-width": "1.5"
285
285
  }, null, -1),
286
- d("rect", {
286
+ h("rect", {
287
287
  x: "26",
288
288
  y: "25",
289
289
  width: "18",
@@ -291,8 +291,8 @@ const yt = { class: "layout-icon" }, gt = {
291
291
  stroke: "currentColor",
292
292
  "stroke-width": "1.5"
293
293
  }, null, -1)
294
- ])])) : c.type === "4" ? (s(), i("svg", ft, [...e[3] || (e[3] = [
295
- d("rect", {
294
+ ])])) : n.type === "4" ? (d(), s("svg", Ct, [...e[3] || (e[3] = [
295
+ h("rect", {
296
296
  x: "4",
297
297
  y: "4",
298
298
  width: "19",
@@ -300,7 +300,7 @@ const yt = { class: "layout-icon" }, gt = {
300
300
  stroke: "currentColor",
301
301
  "stroke-width": "1.5"
302
302
  }, null, -1),
303
- d("rect", {
303
+ h("rect", {
304
304
  x: "25",
305
305
  y: "4",
306
306
  width: "19",
@@ -308,7 +308,7 @@ const yt = { class: "layout-icon" }, gt = {
308
308
  stroke: "currentColor",
309
309
  "stroke-width": "1.5"
310
310
  }, null, -1),
311
- d("rect", {
311
+ h("rect", {
312
312
  x: "4",
313
313
  y: "25",
314
314
  width: "19",
@@ -316,7 +316,7 @@ const yt = { class: "layout-icon" }, gt = {
316
316
  stroke: "currentColor",
317
317
  "stroke-width": "1.5"
318
318
  }, null, -1),
319
- d("rect", {
319
+ h("rect", {
320
320
  x: "25",
321
321
  y: "25",
322
322
  width: "19",
@@ -324,29 +324,29 @@ const yt = { class: "layout-icon" }, gt = {
324
324
  stroke: "currentColor",
325
325
  "stroke-width": "1.5"
326
326
  }, null, -1)
327
- ])])) : c.type === "6" ? (s(), i("svg", Ct, [...e[4] || (e[4] = [
328
- S('<rect x="3" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="3" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="24" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>', 6)
329
- ])])) : c.type === "7" ? (s(), i("svg", xt, [...e[5] || (e[5] = [
330
- S('<rect x="4" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="4" y="25" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="25" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 7)
331
- ])])) : c.type === "8" ? (s(), i("svg", mt, [...e[6] || (e[6] = [
332
- S('<rect x="4" y="4" width="28" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="35" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 8)
333
- ])])) : c.type === "9" ? (s(), i("svg", bt, [...e[7] || (e[7] = [
334
- S('<rect x="4" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>', 9)
335
- ])])) : c.type === "10" ? (s(), i("svg", At, [...e[8] || (e[8] = [
336
- S('<rect x="3" y="4" width="36" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="41" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="3" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="11" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="19" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="27" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="6" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="42" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 10)
337
- ])])) : c.type === "13" ? (s(), i("svg", Lt, [...e[9] || (e[9] = [
338
- S('<rect x="4" y="4" width="18" height="18" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="24" y="4" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="14" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="34" width="10" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 13)
339
- ])])) : c.type === "16" ? (s(), i("svg", Dt, [...e[10] || (e[10] = [
340
- S('<rect x="4" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="4" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="15" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="26" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="37" width="7" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 16)
341
- ])])) : X("", !0)
327
+ ])])) : n.type === "6" ? (d(), s("svg", ft, [...e[4] || (e[4] = [
328
+ C('<rect x="3" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="3" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="24" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>', 6)
329
+ ])])) : n.type === "7" ? (d(), s("svg", xt, [...e[5] || (e[5] = [
330
+ C('<rect x="4" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="4" y="25" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="25" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 7)
331
+ ])])) : n.type === "8" ? (d(), s("svg", mt, [...e[6] || (e[6] = [
332
+ C('<rect x="4" y="4" width="28" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="35" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 8)
333
+ ])])) : n.type === "9" ? (d(), s("svg", bt, [...e[7] || (e[7] = [
334
+ C('<rect x="4" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>', 9)
335
+ ])])) : n.type === "10" ? (d(), s("svg", At, [...e[8] || (e[8] = [
336
+ C('<rect x="3" y="4" width="36" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="41" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="3" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="11" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="19" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="27" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="6" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="42" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 10)
337
+ ])])) : n.type === "13" ? (d(), s("svg", Lt, [...e[9] || (e[9] = [
338
+ C('<rect x="4" y="4" width="18" height="18" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="24" y="4" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="14" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="34" width="10" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 13)
339
+ ])])) : n.type === "16" ? (d(), s("svg", Dt, [...e[10] || (e[10] = [
340
+ C('<rect x="4" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="4" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="15" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="26" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="37" width="7" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 16)
341
+ ])])) : Q("", !0)
342
342
  ]));
343
343
  }
344
- }), Q = (c, k) => {
345
- const e = c.__vccOpts || c;
346
- for (const [x, p] of k)
347
- e[x] = p;
344
+ }), J = (n, S) => {
345
+ const e = n.__vccOpts || n;
346
+ for (const [m, v] of S)
347
+ e[m] = v;
348
348
  return e;
349
- }, J = /* @__PURE__ */ Q($t, [["__scopeId", "data-v-31e0404d"]]), Bt = {
349
+ }, K = /* @__PURE__ */ J($t, [["__scopeId", "data-v-31e0404d"]]), Bt = {
350
350
  key: 0,
351
351
  class: "layout-toolbar",
352
352
  role: "toolbar",
@@ -355,7 +355,7 @@ const yt = { class: "layout-icon" }, gt = {
355
355
  class: "video-grid-container",
356
356
  role: "region",
357
357
  "aria-label": "视频网格"
358
- }, Tt = ["aria-label", "onDragstart", "onDragenter", "onDragleave", "onDrop"], Gt = { class: "video-placeholder" }, Mt = { class: "placeholder-number" }, Ot = 0.5, Rt = "grabbing", Nt = "0.8", Pt = /* @__PURE__ */ W({
358
+ }, Tt = ["aria-label", "onDragstart", "onDragenter", "onDragleave", "onDrop"], Gt = { class: "video-placeholder" }, Ot = { class: "placeholder-number" }, Rt = 0.5, Mt = "grabbing", Nt = "0.8", Pt = /* @__PURE__ */ q({
359
359
  __name: "VideoGridLayout",
360
360
  props: {
361
361
  videos: {},
@@ -368,54 +368,54 @@ const yt = { class: "layout-icon" }, gt = {
368
368
  placeholders: {}
369
369
  },
370
370
  emits: ["layoutChange", "videosChange"],
371
- setup(c, { emit: k }) {
372
- const e = c, x = k, p = O(e.layout);
373
- I(() => e.layout, (t) => {
374
- p.value = t;
371
+ setup(n, { emit: S }) {
372
+ const e = n, m = S, v = R(e.layout);
373
+ E(() => e.layout, (t) => {
374
+ v.value = t;
375
375
  });
376
- const K = g(() => e.availableLayouts && e.availableLayouts.length > 0 ? e.availableLayouts : vt()), y = R([]);
377
- function _(t) {
378
- const o = Array.isArray(t) ? t : e.videos || [], a = V.value, r = {};
379
- y.value.forEach((w, u) => {
380
- w && w.id !== void 0 && (r[w.id] = w.__labelNumber ?? u + 1);
376
+ const W = k(() => e.availableLayouts && e.availableLayouts.length > 0 ? e.availableLayouts : vt()), g = M([]);
377
+ function V(t) {
378
+ const o = Array.isArray(t) ? t : e.videos || [], a = G.value, r = {};
379
+ g.value.forEach((l, p) => {
380
+ l && l.id !== void 0 && (r[l.id] = l.__labelNumber ?? p + 1);
381
381
  });
382
- const n = Array.from({ length: a }).map((w, u) => {
383
- const l = o[u];
384
- if (l) {
385
- const f = r[l.id] ?? l.__labelNumber ?? u + 1;
386
- return { ...l, __labelNumber: f };
382
+ const i = Array.from({ length: a }).map((l, p) => {
383
+ const w = o[p];
384
+ if (w) {
385
+ const c = r[w.id] ?? w.__labelNumber ?? p + 1;
386
+ return { ...w, __labelNumber: c };
387
387
  }
388
388
  });
389
- y.value = n;
389
+ g.value = i;
390
390
  }
391
- I(() => e.videos, (t) => {
391
+ E(() => e.videos, (t) => {
392
392
  if (!Array.isArray(t)) {
393
393
  console.warn("[VideoGridLayout] Invalid videos prop, expected array");
394
394
  return;
395
395
  }
396
- _(t);
396
+ V(t);
397
397
  }, { flush: "post" });
398
- let E = !1;
399
- I(y, (t) => {
400
- !E && Array.isArray(t) && x("videosChange", t);
398
+ let T = !1;
399
+ E(g, (t) => {
400
+ !T && Array.isArray(t) && m("videosChange", t);
401
401
  });
402
- const Y = g(() => {
403
- const t = C[p.value];
404
- return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${p.value}, fallback to '4'`), C[4]);
405
- }), m = g(() => pt(p.value)), V = g(() => {
402
+ const F = k(() => {
403
+ const t = x[v.value];
404
+ return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${v.value}, fallback to '4'`), x[4]);
405
+ }), b = k(() => pt(v.value)), G = k(() => {
406
406
  var t;
407
- return ((t = Y.value) == null ? void 0 : t.count) || 4;
408
- }), D = g(() => y.value.slice(0, V.value).map((t) => t).filter(Boolean));
409
- _(e.videos), I(V, () => {
410
- _(e.videos);
407
+ return ((t = F.value) == null ? void 0 : t.count) || 4;
408
+ }), $ = k(() => g.value.slice(0, G.value).map((t) => t).filter(Boolean));
409
+ V(e.videos), E(G, () => {
410
+ V(e.videos);
411
411
  });
412
- const F = g(() => {
413
- const t = m.value.map((o, a) => ({ p: o, idx: a }));
412
+ const U = k(() => {
413
+ const t = b.value.map((o, a) => ({ p: o, idx: a }));
414
414
  return t.sort((o, a) => o.p.row === a.p.row ? (o.p.col || 0) - (a.p.col || 0) : (o.p.row || 0) - (a.p.row || 0)), t.map((o) => o.idx);
415
- }), v = O(-1), b = O(-1), $ = R(null), h = R(null);
416
- let A = null, L = null;
417
- const Z = g(() => {
418
- const t = Y.value;
415
+ }), y = R(-1), A = R(-1), B = M(null), u = M(null);
416
+ let f = { x: 0, y: 0 }, L = null, D = null;
417
+ const Z = k(() => {
418
+ const t = F.value;
419
419
  return {
420
420
  display: "grid",
421
421
  gridTemplateColumns: (t == null ? void 0 : t.colTemplate) || `repeat(${(t == null ? void 0 : t.cols) || 2}, 1fr)`,
@@ -424,12 +424,12 @@ const yt = { class: "layout-icon" }, gt = {
424
424
  width: e.width || "100%",
425
425
  height: e.height || "100%"
426
426
  };
427
- }), tt = g(() => ({
427
+ }), tt = k(() => ({
428
428
  width: e.width || "100%",
429
429
  height: e.height || "100%"
430
430
  }));
431
431
  function et(t) {
432
- const o = t, a = F.value[o];
432
+ const o = t, a = U.value[o];
433
433
  if (Array.isArray(e.placeholders) && e.placeholders[a] !== void 0)
434
434
  return String(e.placeholders[a]);
435
435
  if (typeof e.placeholderText == "function")
@@ -441,86 +441,91 @@ const yt = { class: "layout-icon" }, gt = {
441
441
  return e.placeholderText ? String(e.placeholderText) : String(o + 1);
442
442
  }
443
443
  function ot(t) {
444
- const o = m.value[t];
444
+ const o = b.value[t];
445
445
  return !o || typeof o.col != "number" || typeof o.row != "number" ? {} : {
446
446
  gridColumn: `${o.col} / span ${o.colSpan}`,
447
447
  gridRow: `${o.row} / span ${o.rowSpan}`
448
448
  };
449
449
  }
450
450
  function rt(t) {
451
- const o = m.value[t];
451
+ const o = b.value[t];
452
452
  return (o == null ? void 0 : o.isMain) || !1;
453
453
  }
454
454
  function at(t) {
455
- p.value = t, x("layoutChange", p.value);
455
+ v.value = t, m("layoutChange", v.value);
456
456
  }
457
- function B() {
458
- if ($.value && document.body.contains($.value)) {
457
+ function I() {
458
+ if (B.value && document.body.contains(B.value)) {
459
459
  try {
460
- document.body.removeChild($.value);
460
+ document.body.removeChild(B.value);
461
461
  } catch (t) {
462
462
  console.warn("[VideoGridLayout] Failed to cleanup drag image:", t);
463
463
  }
464
- $.value = null;
464
+ B.value = null;
465
465
  }
466
- if (h.value && document.body.contains(h.value)) {
466
+ if (u.value && document.body.contains(u.value)) {
467
467
  try {
468
- document.body.removeChild(h.value);
468
+ document.body.removeChild(u.value);
469
469
  } catch {
470
470
  }
471
- h.value = null;
471
+ u.value = null;
472
472
  }
473
- A && (document.removeEventListener("mousemove", A), A = null), L && (document.removeEventListener("drag", L), L = null);
473
+ L && (document.removeEventListener("mousemove", L), L = null), D && (document.removeEventListener("drag", D), D = null);
474
474
  }
475
475
  function lt(t, o) {
476
- if (o < 0 || o >= y.value.length) {
476
+ if (o < 0 || o >= g.value.length) {
477
477
  console.warn("[VideoGridLayout] Invalid drag index:", o);
478
478
  return;
479
479
  }
480
- if (v.value = o, !t.dataTransfer) return;
480
+ if (y.value = o, !t.dataTransfer) return;
481
481
  t.dataTransfer.effectAllowed = "move";
482
482
  const r = t.target.closest(".video-item");
483
483
  if (r)
484
484
  try {
485
- if (B(), t.dataTransfer) {
485
+ I();
486
+ const i = r.getBoundingClientRect();
487
+ if (f = {
488
+ x: (t.clientX || 0) - i.left,
489
+ y: (t.clientY || 0) - i.top
490
+ }, t.dataTransfer) {
486
491
  t.dataTransfer.effectAllowed = "move";
487
- const l = new Image();
488
- l.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", t.dataTransfer.setDragImage(l, 0, 0);
492
+ const c = new Image();
493
+ c.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", t.dataTransfer.setDragImage(c, 0, 0);
489
494
  }
490
- const n = r.cloneNode(!0);
491
- n.querySelectorAll(".progress-bar, .play-button").forEach((l) => l.remove()), n.querySelectorAll('[style*="transition"], [style*="animation"], .video-icon').forEach((l) => {
495
+ const l = r.cloneNode(!0);
496
+ l.querySelectorAll(".progress-bar, .play-button").forEach((c) => c.remove()), l.querySelectorAll('[style*="transition"], [style*="animation"], .video-icon').forEach((c) => {
492
497
  try {
493
- l.style.transition = "none", l.style.animation = "none";
498
+ c.style.transition = "none", c.style.animation = "none";
494
499
  } catch {
495
500
  }
496
- }), n.style.position = "fixed", n.style.margin = "0", n.style.pointerEvents = "none", n.style.opacity = Nt, n.style.zIndex = "9999", document.body.appendChild(n), h.value = n;
501
+ }), l.style.position = "fixed", l.style.margin = "0", l.style.pointerEvents = "none", l.style.opacity = Nt, l.style.zIndex = "9999", document.body.appendChild(l), u.value = l;
497
502
  try {
498
- const l = r.getBoundingClientRect();
499
- n.style.width = `${l.width}px`, n.style.height = `${l.height}px`;
503
+ const c = r.getBoundingClientRect();
504
+ l.style.width = `${c.width}px`, l.style.height = `${c.height}px`;
500
505
  } catch {
501
506
  }
502
- A = (l) => {
503
- if (!h.value) return;
504
- const f = h.value.offsetWidth || 0, T = h.value.offsetHeight || 0, G = Math.max(0, l.clientX - f / 2), M = Math.max(0, l.clientY - T / 2);
505
- h.value.style.left = `${G}px`, h.value.style.top = `${M}px`;
506
- }, document.addEventListener("mousemove", A), L = (l) => {
507
- if (!h.value) return;
508
- const f = h.value.offsetWidth || 0, T = h.value.offsetHeight || 0, G = Math.max(0, (l.clientX || 0) - f / 2), M = Math.max(0, (l.clientY || 0) - T / 2);
509
- h.value.style.left = `${G}px`, h.value.style.top = `${M}px`;
510
- }, document.addEventListener("drag", L), r.style.opacity = String(Ot), r.style.cursor = Rt, r.style.borderColor = "#ff6b6b";
511
- } catch (n) {
512
- console.error("[VideoGridLayout] Drag start error:", n), B();
507
+ L = (c) => {
508
+ if (!u.value) return;
509
+ const _ = c.clientX - f.x, O = c.clientY - f.y;
510
+ u.value.style.left = `${_}px`, u.value.style.top = `${O}px`;
511
+ }, document.addEventListener("mousemove", L), D = (c) => {
512
+ if (!u.value) return;
513
+ const _ = (c.clientX || 0) - f.x, O = (c.clientY || 0) - f.y;
514
+ u.value.style.left = `${_}px`, u.value.style.top = `${O}px`;
515
+ }, document.addEventListener("drag", D), r.style.opacity = String(Rt), r.style.cursor = Mt, r.style.borderColor = "#ff6b6b";
516
+ } catch (i) {
517
+ console.error("[VideoGridLayout] Drag start error:", i), I();
513
518
  }
514
519
  }
515
520
  function nt(t, o) {
516
521
  t.preventDefault(), t.stopPropagation();
517
- const a = v.value;
522
+ const a = y.value;
518
523
  if (a === -1 || a === o) {
519
- v.value = -1;
524
+ y.value = -1;
520
525
  return;
521
526
  }
522
- if (o < 0 || o >= m.value.length) {
523
- console.warn("[VideoGridLayout] Invalid drop index:", o), v.value = -1;
527
+ if (o < 0 || o >= b.value.length) {
528
+ console.warn("[VideoGridLayout] Invalid drop index:", o), y.value = -1;
524
529
  return;
525
530
  }
526
531
  try {
@@ -528,89 +533,89 @@ const yt = { class: "layout-icon" }, gt = {
528
533
  r && (r.style.backgroundColor = "rgba(66, 184, 131, 0.3)", r.style.borderColor = "#42b883", setTimeout(() => {
529
534
  r.style.backgroundColor = "", r.style.borderColor = "";
530
535
  }, 200));
531
- const n = [...y.value], w = n[a], u = n[o];
532
- n[a] = u, n[o] = w, E = !0, y.value = n, setTimeout(() => {
533
- E = !1, x("videosChange", y.value.filter(Boolean));
536
+ const i = [...g.value], l = i[a], p = i[o];
537
+ i[a] = p, i[o] = l, T = !0, g.value = i, setTimeout(() => {
538
+ T = !1, m("videosChange", g.value.filter(Boolean));
534
539
  }, 0);
535
540
  } catch (r) {
536
541
  console.error("[VideoGridLayout] Drop error:", r);
537
542
  } finally {
538
- v.value = -1;
543
+ y.value = -1;
539
544
  }
540
545
  }
541
546
  function ct(t, o) {
542
- t.preventDefault(), v.value !== -1 && v.value !== o && (b.value = o);
547
+ t.preventDefault(), y.value !== -1 && y.value !== o && (A.value = o);
543
548
  }
544
549
  function it(t, o) {
545
550
  t.preventDefault();
546
551
  const a = t.target, r = t.relatedTarget;
547
- a.contains(r) || b.value === o && (b.value = -1);
552
+ a.contains(r) || A.value === o && (A.value = -1);
548
553
  }
549
554
  function st(t) {
550
555
  const a = t.target.closest(".video-item");
551
- a && (a.style.opacity = "1", a.style.cursor = "move", a.style.borderColor = ""), B(), v.value = -1, b.value = -1;
556
+ a && (a.style.opacity = "1", a.style.cursor = "move", a.style.borderColor = ""), I(), y.value = -1, A.value = -1, f = { x: 0, y: 0 };
552
557
  }
553
558
  return dt(() => {
554
- B();
555
- }), (t, o) => (s(), i("div", {
559
+ I();
560
+ }), (t, o) => (d(), s("div", {
556
561
  class: "video-grid-layout",
557
562
  role: "application",
558
563
  "aria-label": "视频分屏布局",
559
564
  style: N(tt.value)
560
565
  }, [
561
- c.showToolbar ? (s(), i("div", Bt, [
562
- o[1] || (o[1] = d("div", { class: "toolbar-title" }, "分屏布局", -1)),
563
- d("div", It, [
564
- (s(!0), i(U, null, z(K.value, (a) => {
565
- var r, n, w;
566
- return s(), i("button", {
566
+ n.showToolbar ? (d(), s("div", Bt, [
567
+ o[1] || (o[1] = h("div", { class: "toolbar-title" }, "分屏布局", -1)),
568
+ h("div", It, [
569
+ (d(!0), s(z, null, H(W.value, (a) => {
570
+ var r, i, l;
571
+ return d(), s("button", {
567
572
  key: a,
568
- class: j(["layout-btn", { active: p.value === a }]),
569
- onClick: (u) => at(a),
570
- title: ((r = P(C)[a]) == null ? void 0 : r.label) || "",
571
- "aria-label": `切换到${((n = P(C)[a]) == null ? void 0 : n.label) || ""}布局`,
572
- "aria-pressed": p.value === a,
573
+ class: X(["layout-btn", { active: v.value === a }]),
574
+ onClick: (p) => at(a),
575
+ title: ((r = P(x)[a]) == null ? void 0 : r.label) || "",
576
+ "aria-label": `切换到${((i = P(x)[a]) == null ? void 0 : i.label) || ""}布局`,
577
+ "aria-pressed": v.value === a,
573
578
  type: "button"
574
579
  }, [
575
- ht(J, { type: a }, null, 8, ["type"]),
576
- d("span", Et, q(((w = P(C)[a]) == null ? void 0 : w.label) || ""), 1)
580
+ ht(K, { type: a }, null, 8, ["type"]),
581
+ h("span", Et, j(((l = P(x)[a]) == null ? void 0 : l.label) || ""), 1)
577
582
  ], 10, _t);
578
583
  }), 128))
579
584
  ])
580
- ])) : X("", !0),
581
- d("div", Vt, [
582
- d("div", {
585
+ ])) : Q("", !0),
586
+ h("div", Vt, [
587
+ h("div", {
583
588
  class: "video-grid",
584
589
  style: N(Z.value)
585
590
  }, [
586
- (s(!0), i(U, null, z(m.value, (a, r) => {
587
- var n, w, u;
588
- return s(), i("div", {
589
- key: ((n = D.value[r]) == null ? void 0 : n.id) ?? r,
590
- class: j(["video-item", {
591
+ (d(!0), s(z, null, H(b.value, (a, r) => {
592
+ var i, l, p;
593
+ return d(), s("div", {
594
+ key: ((i = $.value[r]) == null ? void 0 : i.id) ?? r,
595
+ class: X(["video-item", {
591
596
  "main-video": rt(r),
592
- dragging: v.value === r,
593
- "drag-over": b.value === r && v.value !== r
597
+ dragging: y.value === r,
598
+ "drag-over": A.value === r && y.value !== r
594
599
  }]),
595
600
  style: N(ot(r)),
596
601
  draggable: !0,
597
- "aria-label": `视频 ${r + 1}: ${((w = D.value[r]) == null ? void 0 : w.title) || ((u = D.value[r]) == null ? void 0 : u.id) || ""}`,
602
+ "aria-label": `视频 ${r + 1}: ${((l = $.value[r]) == null ? void 0 : l.title) || ((p = $.value[r]) == null ? void 0 : p.id) || ""}`,
598
603
  role: "article",
599
604
  tabindex: "0",
600
- onDragstart: (l) => lt(l, r),
605
+ onDragstart: (w) => lt(w, r),
601
606
  onDragover: o[0] || (o[0] = wt(() => {
602
607
  }, ["prevent"])),
603
- onDragenter: (l) => ct(l, r),
604
- onDragleave: (l) => it(l, r),
605
- onDrop: (l) => nt(l, r),
608
+ onDragenter: (w) => ct(w, r),
609
+ onDragleave: (w) => it(w, r),
610
+ onDrop: (w) => nt(w, r),
606
611
  onDragend: st
607
612
  }, [
608
613
  ut(t.$slots, "video", {
609
- video: D.value[r],
614
+ video: $.value[r],
610
615
  index: r
611
616
  }, () => [
612
- d("div", Gt, [
613
- d("div", Mt, q(et(F.value.indexOf(r))), 1)
617
+ h("div", Gt, [
618
+ h("div", Ot, j(et(U.value.indexOf(r))), 1)
614
619
  ])
615
620
  ], !0)
616
621
  ], 46, Tt);
@@ -619,21 +624,21 @@ const yt = { class: "layout-icon" }, gt = {
619
624
  ])
620
625
  ], 4));
621
626
  }
622
- }), Ht = /* @__PURE__ */ Q(Pt, [["__scopeId", "data-v-f0958f8e"]]), Yt = {
623
- VideoGridLayout: Ht,
624
- VideoLayoutIcon: J
625
- }, Ut = {
626
- install(c) {
627
- Object.entries(Yt).forEach(([k, e]) => {
628
- c.component(k, e);
627
+ }), Yt = /* @__PURE__ */ J(Pt, [["__scopeId", "data-v-13a48217"]]), Ft = {
628
+ VideoGridLayout: Yt,
629
+ VideoLayoutIcon: K
630
+ }, zt = {
631
+ install(n) {
632
+ Object.entries(Ft).forEach(([S, e]) => {
633
+ n.component(S, e);
629
634
  });
630
635
  }
631
636
  };
632
637
  export {
633
- C as LAYOUT_CONFIGS,
634
- Ht as VideoGridLayout,
635
- J as VideoLayoutIcon,
636
- Ut as default,
638
+ x as LAYOUT_CONFIGS,
639
+ Yt as VideoGridLayout,
640
+ K as VideoLayoutIcon,
641
+ zt as default,
637
642
  vt as getAllLayoutTypes,
638
643
  pt as getLayoutPositions
639
644
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .video-grid-layout{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title{font-size:14px;font-weight:600;color:#333}.layout-buttons{display:flex;gap:8px;flex-wrap:wrap}.layout-btn{display:flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid #d0d0d0;background:#fff;border-radius:4px;cursor:pointer;transition:all .2s;font-size:12px;color:#666}.layout-btn:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active{border-color:#42b883;background:#42b883;color:#fff}.layout-label{font-size:12px}.video-grid-container{flex:1;padding:8px;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;box-sizing:border-box}.video-grid{width:100%;height:100%;max-width:100%;max-height:100%;background:#00409f33;padding:4px;border-radius:4px;box-sizing:border-box}.video-item{position:relative;background:#00152999;border:2px solid rgba(0,64,159,.49);border-radius:4px;overflow:hidden;cursor:move;transition:border-color .2s ease,background .2s ease,box-shadow .2s ease,transform .2s ease;min-height:0;min-width:0;-webkit-user-select:none;user-select:none;-webkit-user-drag:element;will-change:transform}.video-item.dragging{opacity:.5;cursor:grabbing;transform:scale(.98);box-shadow:0 4px 12px #0000004d}.video-item:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video{border-width:1px}.video-item>*{width:100%;height:100%}.video-placeholder{display:flex;align-items:center;justify-content:center;height:100%;color:#3de6ff80;-webkit-user-select:none;user-select:none;background:#00409f4d}.placeholder-number{font-size:48px;font-weight:700;color:#3de6ff99;text-shadow:0 0 10px rgba(61,230,255,.3)}@media (max-width: 768px){.layout-toolbar{flex-direction:column;align-items:flex-start}.layout-label{display:none}}.layout-icon[data-v-31e0404d]{width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center}.layout-icon svg[data-v-31e0404d]{width:100%;height:100%}.video-grid-layout[data-v-f0958f8e]{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar[data-v-f0958f8e]{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title[data-v-f0958f8e]{font-size:14px;font-weight:600;color:#333}.layout-buttons[data-v-f0958f8e]{display:flex;gap:8px;flex-wrap:wrap}.layout-btn[data-v-f0958f8e]{display:flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid #d0d0d0;background:#fff;border-radius:4px;cursor:pointer;transition:all .2s;font-size:12px;color:#666}.layout-btn[data-v-f0958f8e]:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active[data-v-f0958f8e]{border-color:#42b883;background:#42b883;color:#fff}.layout-label[data-v-f0958f8e]{font-size:12px}.video-grid-container[data-v-f0958f8e]{flex:1;padding:8px;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;box-sizing:border-box}.video-grid[data-v-f0958f8e]{width:100%;height:100%;max-width:100%;max-height:100%;background:#00409f33;padding:4px;border-radius:4px;box-sizing:border-box}.video-item[data-v-f0958f8e]{position:relative;background:#00152999;border:2px solid rgba(0,64,159,.49);border-radius:4px;overflow:hidden;cursor:move;min-height:0;min-width:0;-webkit-user-select:none;user-select:none;-webkit-user-drag:element}.video-item.dragging[data-v-f0958f8e]{opacity:.5;cursor:grabbing}.video-item[data-v-f0958f8e]:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over[data-v-f0958f8e]{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item[data-v-f0958f8e]:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video[data-v-f0958f8e]{border-width:1px}.video-item[data-v-f0958f8e]>*{width:100%;height:100%}.video-placeholder[data-v-f0958f8e]{display:flex;align-items:center;justify-content:center;height:100%;color:#3de6ff80;-webkit-user-select:none;user-select:none;background:#00409f4d}.placeholder-number[data-v-f0958f8e]{font-size:48px;font-weight:700;color:#3de6ff99;text-shadow:0 0 10px rgba(61,230,255,.3)}@media (max-width: 768px){.layout-toolbar[data-v-f0958f8e]{flex-direction:column;align-items:flex-start}.layout-label[data-v-f0958f8e]{display:none}}
1
+ .video-grid-layout{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title{font-size:14px;font-weight:600;color:#333}.layout-buttons{display:flex;gap:8px;flex-wrap:wrap}.layout-btn{display:flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid #d0d0d0;background:#fff;border-radius:4px;cursor:pointer;transition:all .2s;font-size:12px;color:#666}.layout-btn:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active{border-color:#42b883;background:#42b883;color:#fff}.layout-label{font-size:12px}.video-grid-container{flex:1;padding:8px;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;box-sizing:border-box}.video-grid{width:100%;height:100%;max-width:100%;max-height:100%;background:#00409f33;padding:4px;border-radius:4px;box-sizing:border-box}.video-item{position:relative;background:#00152999;border:2px solid rgba(0,64,159,.49);border-radius:4px;overflow:hidden;cursor:move;transition:border-color .2s ease,background .2s ease,box-shadow .2s ease,transform .2s ease;min-height:0;min-width:0;-webkit-user-select:none;user-select:none;-webkit-user-drag:element;will-change:transform}.video-item.dragging{opacity:.5;cursor:grabbing;transform:scale(.98);box-shadow:0 4px 12px #0000004d}.video-item:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video{border-width:1px}.video-item>*{width:100%;height:100%}.video-placeholder{display:flex;align-items:center;justify-content:center;height:100%;color:#3de6ff80;-webkit-user-select:none;user-select:none;background:#00409f4d}.placeholder-number{font-size:48px;font-weight:700;color:#3de6ff99;text-shadow:0 0 10px rgba(61,230,255,.3)}@media (max-width: 768px){.layout-toolbar{flex-direction:column;align-items:flex-start}.layout-label{display:none}}.layout-icon[data-v-31e0404d]{width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center}.layout-icon svg[data-v-31e0404d]{width:100%;height:100%}.video-grid-layout[data-v-13a48217]{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar[data-v-13a48217]{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title[data-v-13a48217]{font-size:14px;font-weight:600;color:#333}.layout-buttons[data-v-13a48217]{display:flex;gap:8px;flex-wrap:wrap}.layout-btn[data-v-13a48217]{display:flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid #d0d0d0;background:#fff;border-radius:4px;cursor:pointer;transition:all .2s;font-size:12px;color:#666}.layout-btn[data-v-13a48217]:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active[data-v-13a48217]{border-color:#42b883;background:#42b883;color:#fff}.layout-label[data-v-13a48217]{font-size:12px}.video-grid-container[data-v-13a48217]{flex:1;padding:8px;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;box-sizing:border-box}.video-grid[data-v-13a48217]{width:100%;height:100%;max-width:100%;max-height:100%;background:#00409f33;padding:4px;border-radius:4px;box-sizing:border-box}.video-item[data-v-13a48217]{position:relative;background:#00152999;border:2px solid rgba(0,64,159,.49);border-radius:4px;overflow:hidden;cursor:move;min-height:0;min-width:0;-webkit-user-select:none;user-select:none;-webkit-user-drag:element}.video-item.dragging[data-v-13a48217]{opacity:.5;cursor:grabbing}.video-item[data-v-13a48217]:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over[data-v-13a48217]{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item[data-v-13a48217]:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video[data-v-13a48217]{border-width:1px}.video-item[data-v-13a48217]>*{width:100%;height:100%}.video-placeholder[data-v-13a48217]{display:flex;align-items:center;justify-content:center;height:100%;color:#3de6ff80;-webkit-user-select:none;user-select:none;background:#00409f4d}.placeholder-number[data-v-13a48217]{font-size:48px;font-weight:700;color:#3de6ff99;text-shadow:0 0 10px rgba(61,230,255,.3)}@media (max-width: 768px){.layout-toolbar[data-v-13a48217]{flex-direction:column;align-items:flex-start}.layout-label[data-v-13a48217]{display:none}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "video-split-screen",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Vue 3 视频分屏组件(VideoSplitScreen)",
5
5
  "keywords": [
6
6
  "vue",
@@ -20,9 +20,9 @@
20
20
  ],
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "https://github.com/your-username/video-split-screen"
23
+ "url": "https://github.com/laylwenl/videoSplitScreen.git"
24
24
  },
25
- "homepage": "https://github.com/your-username/video-split-screen#readme",
25
+ "homepage": "https://github.com/laylwenl/videoSplitScreen#readme",
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },