video-split-screen 1.0.24 → 1.0.25

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.d.ts CHANGED
@@ -2,7 +2,6 @@ export * from './types';
2
2
  export * from './layoutConfig';
3
3
  export { default as VideoGridLayout } from './components/VideoGridLayout.vue';
4
4
  export { default as VideoLayoutIcon } from './components/VideoLayoutIcon.vue';
5
- export { default as VideoSplitScreenExample } from './components/VideoSplitScreenExample.vue';
6
5
  import type { App } from 'vue';
7
6
  declare const _default: {
8
7
  install(app: App): void;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),V={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}},$={};function T(d){if($[d])return $[d];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}]}[d]||[];return o.length>0&&($[d]=o),o}function A(){return Object.keys(V)}const H={class:"layout-icon"},W={key:0,viewBox:"0 0 48 48",fill:"none"},q={key:1,viewBox:"0 0 48 48",fill:"none"},J={key:2,viewBox:"0 0 48 48",fill:"none"},K={key:3,viewBox:"0 0 48 48",fill:"none"},Q={key:4,viewBox:"0 0 48 48",fill:"none"},X={key:5,viewBox:"0 0 48 48",fill:"none"},Z={key:6,viewBox:"0 0 48 48",fill:"none"},ee={key:7,viewBox:"0 0 48 48",fill:"none"},te={key:8,viewBox:"0 0 54 48",fill:"none"},oe={key:9,viewBox:"0 0 48 48",fill:"none"},re={key:10,viewBox:"0 0 48 48",fill:"none"},le=e.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(d){return(u,o)=>(e.openBlock(),e.createElementBlock("div",H,[d.type==="1"?(e.openBlock(),e.createElementBlock("svg",W,[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"4",y:"4",width:"40",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1)])])):d.type==="2"?(e.openBlock(),e.createElementBlock("svg",q,[...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)])])):d.type==="3"?(e.openBlock(),e.createElementBlock("svg",J,[...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)])])):d.type==="4"?(e.openBlock(),e.createElementBlock("svg",K,[...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)])])):d.type==="6"?(e.openBlock(),e.createElementBlock("svg",Q,[...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)])])):d.type==="7"?(e.openBlock(),e.createElementBlock("svg",X,[...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)])])):d.type==="8"?(e.openBlock(),e.createElementBlock("svg",Z,[...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)])])):d.type==="9"?(e.openBlock(),e.createElementBlock("svg",ee,[...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)])])):d.type==="10"?(e.openBlock(),e.createElementBlock("svg",te,[...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)])])):d.type==="13"?(e.openBlock(),e.createElementBlock("svg",oe,[...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)])])):d.type==="16"?(e.openBlock(),e.createElementBlock("svg",re,[...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)]))}}),D=(d,u)=>{const o=d.__vccOpts||d;for(const[p,h]of u)o[p]=h;return o},L=D(le,[["__scopeId","data-v-31e0404d"]]),ae={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},ne={class:"layout-buttons"},ce=["onClick","title","aria-label","aria-pressed"],ie={class:"layout-label"},de={class:"video-grid-container",role:"region","aria-label":"视频网格"},se=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],ue={class:"video-placeholder"},he={class:"placeholder-number"},we=.5,pe="grabbing",ve="0.8",ke=e.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{}},emits:["layoutChange","videosChange"],setup(d,{emit:u}){const o=d,p=u,h=e.ref(o.layout);e.watch(()=>o.layout,t=>{h.value=t});const y=e.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:A()),v=e.shallowRef([]);function E(t){const l=Array.isArray(t)?t:o.videos||[],n=b.value,r={};v.value.forEach((w,x)=>{w&&w.id!==void 0&&(r[w.id]=w.__labelNumber??x+1)});const c=Array.from({length:n}).map((w,x)=>{const m=l[x];if(m){const Y=r[m.id]??m.__labelNumber??x+1;return{...m,__labelNumber:Y}}});v.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 S=!1;e.watch(v,t=>{!S&&Array.isArray(t)&&p("videosChange",t)});const g=e.computed(()=>{const t=V[h.value];return t||(console.warn(`[VideoGridLayout] Invalid layout type: ${h.value}, fallback to '4'`),V[4])}),N=e.computed(()=>T(h.value)),b=e.computed(()=>{var t;return((t=g.value)==null?void 0:t.count)||4}),f=e.computed(()=>v.value.slice(0,b.value).map(t=>t).filter(Boolean));e.computed(()=>{const t={};return f.value.forEach((l,n)=>{const r=v.value.findIndex(c=>c&&c.id===l.id);r!==-1&&(t[n]=r)}),t}),E(o.videos),e.watch(b,()=>{E(o.videos)}),e.computed(()=>{const t=N.value.map((l,n)=>({p:l,idx:n}));return t.sort((l,n)=>l.p.row===n.p.row?(l.p.col||0)-(n.p.col||0):(l.p.row||0)-(n.p.row||0)),t.map(l=>l.idx)});const k=e.ref(-1),C=e.ref(-1),i=e.shallowRef(null),a=e.computed(()=>{const t=g.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%"}}),s=e.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function B(t){const l=f.value[t];return l?v.value.findIndex(r=>r&&r.id===l.id)+1:t+1}function M(t){const l=N.value[t];return!l||typeof l.col!="number"||typeof l.row!="number"?{}:{gridColumn:`${l.col} / span ${l.colSpan}`,gridRow:`${l.row} / span ${l.rowSpan}`}}function O(t){const l=N.value[t];return(l==null?void 0:l.isMain)||!1}function F(t){h.value=t,p("layoutChange",h.value)}function _(){if(i.value&&document.body.contains(i.value)){try{document.body.removeChild(i.value)}catch(t){console.warn("[VideoGridLayout] Failed to cleanup drag image:",t)}i.value=null}}function R(t,l){if(l<0||l>=v.value.length){console.warn("[VideoGridLayout] Invalid drag index:",l);return}if(k.value=l,!t.dataTransfer)return;t.dataTransfer.effectAllowed="move";const r=t.target.closest(".video-item");if(r)try{_();const c=r.cloneNode(!0);c.style.width=`${r.offsetWidth}px`,c.style.height=`${r.offsetHeight}px`,c.style.opacity=ve,c.style.position="absolute",c.style.top="-9999px",c.style.pointerEvents="none",document.body.appendChild(c),i.value=c,t.dataTransfer.setDragImage(c,r.offsetWidth/2,r.offsetHeight/2),setTimeout(()=>{_()},100),r.style.opacity=String(we),r.style.cursor=pe}catch(c){console.error("[VideoGridLayout] Drag start error:",c),_()}}function U(t,l){t.preventDefault(),t.stopPropagation();const n=k.value;if(n===-1||n===l){k.value=-1;return}if(n>=v.value.length){console.warn("[VideoGridLayout] No video at from index:",n),k.value=-1;return}try{const r=t.currentTarget;r&&(r.style.backgroundColor="rgba(66, 184, 131, 0.3)",r.style.borderColor="#42b883",setTimeout(()=>{r.style.backgroundColor="",r.style.borderColor=""},200));const c=[...v.value];if(l>=c.length){const w=c[n];c.splice(n,1),c.push(w)}else{const w=c[n];c[n]=c[l],c[l]=w}S=!0,v.value=c,setTimeout(()=>{S=!1,p("videosChange",v.value.filter(Boolean))},0)}catch(r){console.error("[VideoGridLayout] Drop error:",r)}finally{k.value=-1}}function P(t,l){t.preventDefault(),k.value!==-1&&k.value!==l&&(C.value=l)}function z(t,l){t.preventDefault();const n=t.target,r=t.relatedTarget;n.contains(r)||C.value===l&&(C.value=-1)}function j(t){const n=t.target.closest(".video-item");n&&(n.style.opacity="1",n.style.cursor="move"),_(),k.value=-1,C.value=-1}return e.onBeforeUnmount(()=>{_()}),(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:e.normalizeStyle(s.value)},[d.showToolbar?(e.openBlock(),e.createElementBlock("div",ae,[l[1]||(l[1]=e.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),e.createElementVNode("div",ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,n=>{var r,c,w;return e.openBlock(),e.createElementBlock("button",{key:n,class:e.normalizeClass(["layout-btn",{active:h.value===n}]),onClick:x=>F(n),title:((r=e.unref(V)[n])==null?void 0:r.label)||"","aria-label":`切换到${((c=e.unref(V)[n])==null?void 0:c.label)||""}布局`,"aria-pressed":h.value===n,type:"button"},[e.createVNode(L,{type:n},null,8,["type"]),e.createElementVNode("span",ie,e.toDisplayString(((w=e.unref(V)[n])==null?void 0:w.label)||""),1)],10,ce)}),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",de,[e.createElementVNode("div",{class:"video-grid",style:e.normalizeStyle(a.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,(n,r)=>{var c,w,x;return e.openBlock(),e.createElementBlock("div",{key:((c=f.value[r])==null?void 0:c.id)??r,class:e.normalizeClass(["video-item",{"main-video":O(r),dragging:k.value===r,"drag-over":C.value===r&&k.value!==r}]),style:e.normalizeStyle(M(r)),draggable:!0,"aria-label":`视频 ${r+1}: ${((w=f.value[r])==null?void 0:w.title)||((x=f.value[r])==null?void 0:x.id)||""}`,role:"article",tabindex:"0",onDragstart:m=>R(m,r),onDragover:l[0]||(l[0]=e.withModifiers(()=>{},["prevent"])),onDragenter:m=>P(m,r),onDragleave:m=>z(m,r),onDrop:m=>U(m,r),onDragend:j},[e.renderSlot(t.$slots,"video",{video:f.value[r],index:r},()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",he,e.toDisplayString(B(r)),1)])],!0)],46,se)}),128))],4)])],4))}}),I=D(ke,[["__scopeId","data-v-df2d4d67"]]),me={class:"video-split-screen-example"},ge={class:"example-controls"},ye={class:"control-group"},Se={class:"layout-buttons"},fe=["onClick"],xe={class:"control-group"},Ce={class:"video-buttons"},Ve=["disabled"],Ee=["disabled"],Ne={class:"control-group"},be={class:"placeholder-controls"},Be={class:"example-content"},_e={class:"video-grid-container"},$e={class:"custom-video-item"},De={class:"video-content"},Le={class:"video-info"},Ie={class:"video-title"},Te={class:"video-id"},Ae={class:"example-info"},Ge={class:"info-panel"},Me={class:"info-item"},Oe={class:"info-item"},Fe={class:"info-item"},Re={key:0},Ue={key:1},Pe={key:2},ze={class:"info-panel"},je={class:"info-panel"},Ye={class:"log-list"},He=e.defineComponent({__name:"VideoSplitScreenExample",setup(d){const u=e.ref([{id:1,title:"摄像头 1",url:"rtmp://example1.com/live"},{id:2,title:"摄像头 2",url:"rtmp://example2.com/live"},{id:3,title:"摄像头 3",url:"rtmp://example3.com/live"},{id:4,title:"摄像头 4",url:"rtmp://example4.com/live"}]),o=e.ref("4"),p=e.ref(!1),h=e.ref(!1),y=e.ref(""),v=e.computed(()=>{if(h.value)return i=>`位置 ${i+1}`;if(p.value)return y.value||"自定义占位符"}),E=e.ref([]),S=e.ref([]);function g(i){const s=new Date().toLocaleTimeString();S.value.unshift({time:s,message:i}),S.value.length>10&&(S.value=S.value.slice(0,10))}function N(i){o.value=i,g(`切换到 ${i} 分屏布局`)}function b(){const i=Math.max(...u.value.map(a=>a.id))+1;u.value.push({id:i,title:`摄像头 ${i}`,url:`rtmp://example${i}.com/live`}),g(`添加视频: 摄像头 ${i}`)}function f(){if(u.value.length>1){const i=u.value.pop();g(`移除视频: ${i==null?void 0:i.title}`)}}function k(){u.value=[{id:1,title:"摄像头 1",url:"rtmp://example1.com/live"},{id:2,title:"摄像头 2",url:"rtmp://example2.com/live"},{id:3,title:"摄像头 3",url:"rtmp://example3.com/live"},{id:4,title:"摄像头 4",url:"rtmp://example4.com/live"}],o.value="4",p.value=!1,h.value=!1,y.value="",E.value=[],g("重置所有设置")}function C(i){console.log("Videos changed:",i),u.value=i,g(`视频重新排序: ${i.map(a=>a.title).join(" → ")}`)}return e.watch([p,h],()=>{p.value&&h.value&&(h.value=!1),g("更新占位符配置")}),e.watch(y,()=>{g(`设置占位符文本: "${y.value}"`)}),g("示例组件初始化完成"),(i,a)=>(e.openBlock(),e.createElementBlock("div",me,[a[16]||(a[16]=e.createElementVNode("div",{class:"example-header"},[e.createElementVNode("h1",null,"Video Split Screen 示例"),e.createElementVNode("p",null,"演示所有功能:布局切换、拖拽排序、占位符配置")],-1)),e.createElementVNode("div",ge,[e.createElementVNode("div",ye,[a[3]||(a[3]=e.createElementVNode("h3",null,"布局切换",-1)),e.createElementVNode("div",Se,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(["1","2","3","4","6","7","8","9","10","13","16"],s=>e.createElementVNode("button",{key:s,class:e.normalizeClass(["layout-btn",{active:o.value===s}]),onClick:B=>N(s)},e.toDisplayString(s)+"分屏 ",11,fe)),64))])]),e.createElementVNode("div",xe,[a[4]||(a[4]=e.createElementVNode("h3",null,"视频管理",-1)),e.createElementVNode("div",Ce,[e.createElementVNode("button",{onClick:b,disabled:u.value.length>=16},"添加视频",8,Ve),e.createElementVNode("button",{onClick:f,disabled:u.value.length<=1},"移除视频",8,Ee),e.createElementVNode("button",{onClick:k},"重置")])]),e.createElementVNode("div",Ne,[a[7]||(a[7]=e.createElementVNode("h3",null,"占位符配置",-1)),e.createElementVNode("div",be,[e.createElementVNode("label",null,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=s=>p.value=s),type:"checkbox"},null,512),[[e.vModelCheckbox,p.value]]),a[5]||(a[5]=e.createTextVNode(" 使用自定义文本 ",-1))]),p.value?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":a[1]||(a[1]=s=>y.value=s),type:"text",placeholder:"输入占位符文本"},null,512)),[[e.vModelText,y.value]]):e.createCommentVNode("",!0),e.createElementVNode("label",null,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[2]||(a[2]=s=>h.value=s),type:"checkbox"},null,512),[[e.vModelCheckbox,h.value]]),a[6]||(a[6]=e.createTextVNode(" 使用函数生成 ",-1))])])])]),e.createElementVNode("div",Be,[e.createElementVNode("div",_e,[e.createVNode(I,{videos:u.value,layout:o.value,"placeholder-text":v.value,placeholders:E.value,onVideosChange:C,width:"100%",height:"500px"},{video:e.withCtx(({video:s,index:B})=>[e.createElementVNode("div",$e,[e.createElementVNode("div",De,[a[8]||(a[8]=e.createElementVNode("div",{class:"video-icon"},"📹",-1)),e.createElementVNode("div",Le,[e.createElementVNode("div",Ie,e.toDisplayString(s.title),1),e.createElementVNode("div",Te,"ID: "+e.toDisplayString(s.id),1)])]),a[9]||(a[9]=e.createElementVNode("div",{class:"drag-handle"},"⋮⋮",-1))])]),_:1},8,["videos","layout","placeholder-text","placeholders"])]),e.createElementVNode("div",Ae,[e.createElementVNode("div",Ge,[a[13]||(a[13]=e.createElementVNode("h3",null,"当前状态",-1)),e.createElementVNode("div",Me,[a[10]||(a[10]=e.createElementVNode("strong",null,"布局:",-1)),e.createTextVNode(" "+e.toDisplayString(o.value)+"分屏 ",1)]),e.createElementVNode("div",Oe,[a[11]||(a[11]=e.createElementVNode("strong",null,"视频数量:",-1)),e.createTextVNode(" "+e.toDisplayString(u.value.length),1)]),e.createElementVNode("div",Fe,[a[12]||(a[12]=e.createElementVNode("strong",null,"占位符:",-1)),p.value?(e.openBlock(),e.createElementBlock("span",Re,e.toDisplayString(y.value||"无文本"),1)):h.value?(e.openBlock(),e.createElementBlock("span",Ue,"函数生成")):(e.openBlock(),e.createElementBlock("span",Pe,"默认数字"))])]),e.createElementVNode("div",ze,[a[14]||(a[14]=e.createElementVNode("h3",null,"视频数组 (videos)",-1)),e.createElementVNode("pre",null,e.toDisplayString(JSON.stringify(u.value,null,2)),1)]),e.createElementVNode("div",je,[a[15]||(a[15]=e.createElementVNode("h3",null,"操作日志",-1)),e.createElementVNode("div",Ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,(s,B)=>(e.openBlock(),e.createElementBlock("div",{key:B,class:"log-item"},e.toDisplayString(s.time)+": "+e.toDisplayString(s.message),1))),128))])])])])]))}}),G=D(He,[["__scopeId","data-v-4a52fa65"]]),We={VideoGridLayout:I,VideoLayoutIcon:L,VideoSplitScreenExample:G},qe={install(d){Object.entries(We).forEach(([u,o])=>{d.component(u,o)})}};exports.LAYOUT_CONFIGS=V;exports.VideoGridLayout=I;exports.VideoLayoutIcon=L;exports.VideoSplitScreenExample=G;exports.default=qe;exports.getAllLayoutTypes=A;exports.getLayoutPositions=T;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=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}},B={};function N(n){if(B[n])return B[n];const a={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}]}[n]||[];return a.length>0&&(B[n]=a),a}function L(){return Object.keys(k)}const j={class:"layout-icon"},H={key:0,viewBox:"0 0 48 48",fill:"none"},W={key:1,viewBox:"0 0 48 48",fill:"none"},q={key:2,viewBox:"0 0 48 48",fill:"none"},J={key:3,viewBox:"0 0 48 48",fill:"none"},K={key:4,viewBox:"0 0 48 48",fill:"none"},Q={key:5,viewBox:"0 0 48 48",fill:"none"},X={key:6,viewBox:"0 0 48 48",fill:"none"},Z={key:7,viewBox:"0 0 48 48",fill:"none"},tt={key:8,viewBox:"0 0 54 48",fill:"none"},et={key:9,viewBox:"0 0 48 48",fill:"none"},ot={key:10,viewBox:"0 0 48 48",fill:"none"},rt=t.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(n){return(p,a)=>(t.openBlock(),t.createElementBlock("div",j,[n.type==="1"?(t.openBlock(),t.createElementBlock("svg",H,[...a[0]||(a[0]=[t.createElementVNode("rect",{x:"4",y:"4",width:"40",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1)])])):n.type==="2"?(t.openBlock(),t.createElementBlock("svg",W,[...a[1]||(a[1]=[t.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):n.type==="3"?(t.openBlock(),t.createElementBlock("svg",q,[...a[2]||(a[2]=[t.createElementVNode("rect",{x:"4",y:"4",width:"20",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1),t.createElementVNode("rect",{x:"26",y:"4",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"26",y:"25",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):n.type==="4"?(t.openBlock(),t.createElementBlock("svg",J,[...a[3]||(a[3]=[t.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"4",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),t.createElementVNode("rect",{x:"25",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):n.type==="6"?(t.openBlock(),t.createElementBlock("svg",K,[...a[4]||(a[4]=[t.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)])])):n.type==="7"?(t.openBlock(),t.createElementBlock("svg",Q,[...a[5]||(a[5]=[t.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)])])):n.type==="8"?(t.openBlock(),t.createElementBlock("svg",X,[...a[6]||(a[6]=[t.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)])])):n.type==="9"?(t.openBlock(),t.createElementBlock("svg",Z,[...a[7]||(a[7]=[t.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)])])):n.type==="10"?(t.openBlock(),t.createElementBlock("svg",tt,[...a[8]||(a[8]=[t.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)])])):n.type==="13"?(t.openBlock(),t.createElementBlock("svg",et,[...a[9]||(a[9]=[t.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)])])):n.type==="16"?(t.openBlock(),t.createElementBlock("svg",ot,[...a[10]||(a[10]=[t.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)])])):t.createCommentVNode("",!0)]))}}),D=(n,p)=>{const a=n.__vccOpts||n;for(const[y,h]of p)a[y]=h;return a},E=D(rt,[["__scopeId","data-v-31e0404d"]]),at={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},lt={class:"layout-buttons"},ct=["onClick","title","aria-label","aria-pressed"],nt={class:"layout-label"},it={class:"video-grid-container",role:"region","aria-label":"视频网格"},dt=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],st={class:"video-placeholder"},ht={class:"placeholder-number"},wt=.5,ut="grabbing",pt="0.8",kt=t.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{}},emits:["layoutChange","videosChange"],setup(n,{emit:p}){const a=n,y=p,h=t.ref(a.layout);t.watch(()=>a.layout,e=>{h.value=e});const _=t.computed(()=>a.availableLayouts&&a.availableLayouts.length>0?a.availableLayouts:L()),s=t.shallowRef([]);function f(e){const r=Array.isArray(e)?e:a.videos||[],l=b.value,o={};s.value.forEach((i,u)=>{i&&i.id!==void 0&&(o[i.id]=i.__labelNumber??u+1)});const c=Array.from({length:l}).map((i,u)=>{const d=r[u];if(d){const Y=o[d.id]??d.__labelNumber??u+1;return{...d,__labelNumber:Y}}});s.value=c}t.watch(()=>a.videos,e=>{if(!Array.isArray(e)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}f(e)},{flush:"post"});let x=!1;t.watch(s,e=>{!x&&Array.isArray(e)&&y("videosChange",e)});const V=t.computed(()=>{const e=k[h.value];return e||(console.warn(`[VideoGridLayout] Invalid layout type: ${h.value}, fallback to '4'`),k[4])}),C=t.computed(()=>N(h.value)),b=t.computed(()=>{var e;return((e=V.value)==null?void 0:e.count)||4}),v=t.computed(()=>s.value.slice(0,b.value).map(e=>e).filter(Boolean));t.computed(()=>{const e={};return v.value.forEach((r,l)=>{const o=s.value.findIndex(c=>c&&c.id===r.id);o!==-1&&(e[l]=o)}),e}),f(a.videos),t.watch(b,()=>{f(a.videos)}),t.computed(()=>{const e=C.value.map((r,l)=>({p:r,idx:l}));return e.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)),e.map(r=>r.idx)});const w=t.ref(-1),S=t.ref(-1),g=t.shallowRef(null),$=t.computed(()=>{const e=V.value;return{display:"grid",gridTemplateColumns:(e==null?void 0:e.colTemplate)||`repeat(${(e==null?void 0:e.cols)||2}, 1fr)`,gridTemplateRows:(e==null?void 0:e.rowTemplate)||`repeat(${(e==null?void 0:e.rows)||2}, 1fr)`,gap:"4px",width:a.width||"100%",height:a.height||"100%"}}),A=t.computed(()=>({width:a.width||"100%",height:a.height||"100%"}));function G(e){const r=v.value[e];return r?s.value.findIndex(o=>o&&o.id===r.id)+1:e+1}function T(e){const r=C.value[e];return!r||typeof r.col!="number"||typeof r.row!="number"?{}:{gridColumn:`${r.col} / span ${r.colSpan}`,gridRow:`${r.row} / span ${r.rowSpan}`}}function O(e){const r=C.value[e];return(r==null?void 0:r.isMain)||!1}function M(e){h.value=e,y("layoutChange",h.value)}function m(){if(g.value&&document.body.contains(g.value)){try{document.body.removeChild(g.value)}catch(e){console.warn("[VideoGridLayout] Failed to cleanup drag image:",e)}g.value=null}}function R(e,r){if(r<0||r>=s.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(w.value=r,!e.dataTransfer)return;e.dataTransfer.effectAllowed="move";const o=e.target.closest(".video-item");if(o)try{m();const c=o.cloneNode(!0);c.style.width=`${o.offsetWidth}px`,c.style.height=`${o.offsetHeight}px`,c.style.opacity=pt,c.style.position="absolute",c.style.top="-9999px",c.style.pointerEvents="none",document.body.appendChild(c),g.value=c,e.dataTransfer.setDragImage(c,o.offsetWidth/2,o.offsetHeight/2),setTimeout(()=>{m()},100),o.style.opacity=String(wt),o.style.cursor=ut}catch(c){console.error("[VideoGridLayout] Drag start error:",c),m()}}function P(e,r){e.preventDefault(),e.stopPropagation();const l=w.value;if(l===-1||l===r){w.value=-1;return}if(l>=s.value.length){console.warn("[VideoGridLayout] No video at from index:",l),w.value=-1;return}try{const o=e.currentTarget;o&&(o.style.backgroundColor="rgba(66, 184, 131, 0.3)",o.style.borderColor="#42b883",setTimeout(()=>{o.style.backgroundColor="",o.style.borderColor=""},200));const c=[...s.value];if(r>=c.length){const i=c[l];c.splice(l,1),c.push(i)}else{const i=c[l];c[l]=c[r],c[r]=i}x=!0,s.value=c,setTimeout(()=>{x=!1,y("videosChange",s.value.filter(Boolean))},0)}catch(o){console.error("[VideoGridLayout] Drop error:",o)}finally{w.value=-1}}function F(e,r){e.preventDefault(),w.value!==-1&&w.value!==r&&(S.value=r)}function z(e,r){e.preventDefault();const l=e.target,o=e.relatedTarget;l.contains(o)||S.value===r&&(S.value=-1)}function U(e){const l=e.target.closest(".video-item");l&&(l.style.opacity="1",l.style.cursor="move"),m(),w.value=-1,S.value=-1}return t.onBeforeUnmount(()=>{m()}),(e,r)=>(t.openBlock(),t.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:t.normalizeStyle(A.value)},[n.showToolbar?(t.openBlock(),t.createElementBlock("div",at,[r[1]||(r[1]=t.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),t.createElementVNode("div",lt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,l=>{var o,c,i;return t.openBlock(),t.createElementBlock("button",{key:l,class:t.normalizeClass(["layout-btn",{active:h.value===l}]),onClick:u=>M(l),title:((o=t.unref(k)[l])==null?void 0:o.label)||"","aria-label":`切换到${((c=t.unref(k)[l])==null?void 0:c.label)||""}布局`,"aria-pressed":h.value===l,type:"button"},[t.createVNode(E,{type:l},null,8,["type"]),t.createElementVNode("span",nt,t.toDisplayString(((i=t.unref(k)[l])==null?void 0:i.label)||""),1)],10,ct)}),128))])])):t.createCommentVNode("",!0),t.createElementVNode("div",it,[t.createElementVNode("div",{class:"video-grid",style:t.normalizeStyle($.value)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(C.value,(l,o)=>{var c,i,u;return t.openBlock(),t.createElementBlock("div",{key:((c=v.value[o])==null?void 0:c.id)??o,class:t.normalizeClass(["video-item",{"main-video":O(o),dragging:w.value===o,"drag-over":S.value===o&&w.value!==o}]),style:t.normalizeStyle(T(o)),draggable:!0,"aria-label":`视频 ${o+1}: ${((i=v.value[o])==null?void 0:i.title)||((u=v.value[o])==null?void 0:u.id)||""}`,role:"article",tabindex:"0",onDragstart:d=>R(d,o),onDragover:r[0]||(r[0]=t.withModifiers(()=>{},["prevent"])),onDragenter:d=>F(d,o),onDragleave:d=>z(d,o),onDrop:d=>P(d,o),onDragend:U},[t.renderSlot(e.$slots,"video",{video:v.value[o],index:o},()=>[t.createElementVNode("div",st,[t.createElementVNode("div",ht,t.toDisplayString(G(o)),1)])],!0)],46,dt)}),128))],4)])],4))}}),I=D(kt,[["__scopeId","data-v-df2d4d67"]]),vt={VideoGridLayout:I,VideoLayoutIcon:E},yt={install(n){Object.entries(vt).forEach(([p,a])=>{n.component(p,a)})}};exports.LAYOUT_CONFIGS=k;exports.VideoGridLayout=I;exports.VideoLayoutIcon=E;exports.default=yt;exports.getAllLayoutTypes=L;exports.getLayoutPositions=N;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as z, createElementBlock as c, openBlock as d, createCommentVNode as H, createElementVNode as e, createStaticVNode as I, ref as C, watch as A, computed as f, shallowRef as J, onBeforeUnmount as st, normalizeStyle as U, Fragment as O, renderList as R, unref as F, normalizeClass as Y, createVNode as K, toDisplayString as m, withModifiers as ct, renderSlot as dt, withDirectives as P, createTextVNode as M, vModelCheckbox as q, vModelText as ut, withCtx as ht } from "vue";
2
- const B = {
1
+ import { defineComponent as P, createElementBlock as c, openBlock as i, createCommentVNode as F, createElementVNode as d, createStaticVNode as g, ref as B, watch as I, computed as v, shallowRef as E, onBeforeUnmount as rt, normalizeStyle as V, Fragment as T, renderList as O, unref as A, normalizeClass as M, createVNode as at, toDisplayString as R, withModifiers as lt, renderSlot as nt } from "vue";
2
+ const C = {
3
3
  1: {
4
4
  type: "1",
5
5
  label: "1分屏",
@@ -77,11 +77,11 @@ const B = {
77
77
  cols: 4,
78
78
  rows: 4
79
79
  }
80
- }, j = {};
81
- function wt(u) {
82
- if (j[u])
83
- return j[u];
84
- const o = {
80
+ }, G = {};
81
+ function ct(n) {
82
+ if (G[n])
83
+ return G[n];
84
+ const r = {
85
85
  1: [
86
86
  { col: 1, colSpan: 1, row: 1, rowSpan: 1 }
87
87
  ],
@@ -183,65 +183,65 @@ function wt(u) {
183
183
  { col: 3, colSpan: 1, row: 4, rowSpan: 1 },
184
184
  { col: 4, colSpan: 1, row: 4, rowSpan: 1 }
185
185
  ]
186
- }[u] || [];
187
- return o.length > 0 && (j[u] = o), o;
186
+ }[n] || [];
187
+ return r.length > 0 && (G[n] = r), r;
188
188
  }
189
- function pt() {
190
- return Object.keys(B);
189
+ function it() {
190
+ return Object.keys(C);
191
191
  }
192
- const vt = { class: "layout-icon" }, gt = {
192
+ const dt = { class: "layout-icon" }, st = {
193
193
  key: 0,
194
194
  viewBox: "0 0 48 48",
195
195
  fill: "none"
196
- }, yt = {
196
+ }, ht = {
197
197
  key: 1,
198
198
  viewBox: "0 0 48 48",
199
199
  fill: "none"
200
- }, kt = {
200
+ }, wt = {
201
201
  key: 2,
202
202
  viewBox: "0 0 48 48",
203
203
  fill: "none"
204
- }, St = {
204
+ }, ut = {
205
205
  key: 3,
206
206
  viewBox: "0 0 48 48",
207
207
  fill: "none"
208
- }, xt = {
208
+ }, pt = {
209
209
  key: 4,
210
210
  viewBox: "0 0 48 48",
211
211
  fill: "none"
212
- }, mt = {
212
+ }, vt = {
213
213
  key: 5,
214
214
  viewBox: "0 0 48 48",
215
215
  fill: "none"
216
- }, ft = {
216
+ }, yt = {
217
217
  key: 6,
218
218
  viewBox: "0 0 48 48",
219
219
  fill: "none"
220
- }, Ct = {
220
+ }, kt = {
221
221
  key: 7,
222
222
  viewBox: "0 0 48 48",
223
223
  fill: "none"
224
- }, bt = {
224
+ }, gt = {
225
225
  key: 8,
226
226
  viewBox: "0 0 54 48",
227
227
  fill: "none"
228
- }, _t = {
228
+ }, St = {
229
229
  key: 9,
230
230
  viewBox: "0 0 48 48",
231
231
  fill: "none"
232
- }, $t = {
232
+ }, Ct = {
233
233
  key: 10,
234
234
  viewBox: "0 0 48 48",
235
235
  fill: "none"
236
- }, Dt = /* @__PURE__ */ z({
236
+ }, ft = /* @__PURE__ */ P({
237
237
  __name: "VideoLayoutIcon",
238
238
  props: {
239
239
  type: {}
240
240
  },
241
- setup(u) {
242
- return (w, o) => (d(), c("div", vt, [
243
- u.type === "1" ? (d(), c("svg", gt, [...o[0] || (o[0] = [
244
- e("rect", {
241
+ setup(n) {
242
+ return (k, r) => (i(), c("div", dt, [
243
+ n.type === "1" ? (i(), c("svg", st, [...r[0] || (r[0] = [
244
+ d("rect", {
245
245
  x: "4",
246
246
  y: "4",
247
247
  width: "40",
@@ -249,8 +249,8 @@ const vt = { class: "layout-icon" }, gt = {
249
249
  stroke: "currentColor",
250
250
  "stroke-width": "2"
251
251
  }, null, -1)
252
- ])])) : u.type === "2" ? (d(), c("svg", yt, [...o[1] || (o[1] = [
253
- e("rect", {
252
+ ])])) : n.type === "2" ? (i(), c("svg", ht, [...r[1] || (r[1] = [
253
+ d("rect", {
254
254
  x: "4",
255
255
  y: "4",
256
256
  width: "19",
@@ -258,7 +258,7 @@ const vt = { class: "layout-icon" }, gt = {
258
258
  stroke: "currentColor",
259
259
  "stroke-width": "1.5"
260
260
  }, null, -1),
261
- e("rect", {
261
+ d("rect", {
262
262
  x: "25",
263
263
  y: "4",
264
264
  width: "19",
@@ -266,8 +266,8 @@ const vt = { class: "layout-icon" }, gt = {
266
266
  stroke: "currentColor",
267
267
  "stroke-width": "1.5"
268
268
  }, null, -1)
269
- ])])) : u.type === "3" ? (d(), c("svg", kt, [...o[2] || (o[2] = [
270
- e("rect", {
269
+ ])])) : n.type === "3" ? (i(), c("svg", wt, [...r[2] || (r[2] = [
270
+ d("rect", {
271
271
  x: "4",
272
272
  y: "4",
273
273
  width: "20",
@@ -275,7 +275,7 @@ const vt = { class: "layout-icon" }, gt = {
275
275
  stroke: "currentColor",
276
276
  "stroke-width": "2"
277
277
  }, null, -1),
278
- e("rect", {
278
+ d("rect", {
279
279
  x: "26",
280
280
  y: "4",
281
281
  width: "18",
@@ -283,7 +283,7 @@ const vt = { class: "layout-icon" }, gt = {
283
283
  stroke: "currentColor",
284
284
  "stroke-width": "1.5"
285
285
  }, null, -1),
286
- e("rect", {
286
+ d("rect", {
287
287
  x: "26",
288
288
  y: "25",
289
289
  width: "18",
@@ -291,8 +291,8 @@ const vt = { class: "layout-icon" }, gt = {
291
291
  stroke: "currentColor",
292
292
  "stroke-width": "1.5"
293
293
  }, null, -1)
294
- ])])) : u.type === "4" ? (d(), c("svg", St, [...o[3] || (o[3] = [
295
- e("rect", {
294
+ ])])) : n.type === "4" ? (i(), c("svg", ut, [...r[3] || (r[3] = [
295
+ d("rect", {
296
296
  x: "4",
297
297
  y: "4",
298
298
  width: "19",
@@ -300,7 +300,7 @@ const vt = { class: "layout-icon" }, gt = {
300
300
  stroke: "currentColor",
301
301
  "stroke-width": "1.5"
302
302
  }, null, -1),
303
- e("rect", {
303
+ d("rect", {
304
304
  x: "25",
305
305
  y: "4",
306
306
  width: "19",
@@ -308,7 +308,7 @@ const vt = { class: "layout-icon" }, gt = {
308
308
  stroke: "currentColor",
309
309
  "stroke-width": "1.5"
310
310
  }, null, -1),
311
- e("rect", {
311
+ d("rect", {
312
312
  x: "4",
313
313
  y: "25",
314
314
  width: "19",
@@ -316,7 +316,7 @@ const vt = { class: "layout-icon" }, gt = {
316
316
  stroke: "currentColor",
317
317
  "stroke-width": "1.5"
318
318
  }, null, -1),
319
- e("rect", {
319
+ d("rect", {
320
320
  x: "25",
321
321
  y: "25",
322
322
  width: "19",
@@ -324,38 +324,38 @@ const vt = { class: "layout-icon" }, gt = {
324
324
  stroke: "currentColor",
325
325
  "stroke-width": "1.5"
326
326
  }, null, -1)
327
- ])])) : u.type === "6" ? (d(), c("svg", xt, [...o[4] || (o[4] = [
328
- I('<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
- ])])) : u.type === "7" ? (d(), c("svg", mt, [...o[5] || (o[5] = [
330
- I('<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
- ])])) : u.type === "8" ? (d(), c("svg", ft, [...o[6] || (o[6] = [
332
- I('<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
- ])])) : u.type === "9" ? (d(), c("svg", Ct, [...o[7] || (o[7] = [
334
- I('<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
- ])])) : u.type === "10" ? (d(), c("svg", bt, [...o[8] || (o[8] = [
336
- I('<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
- ])])) : u.type === "13" ? (d(), c("svg", _t, [...o[9] || (o[9] = [
338
- I('<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
- ])])) : u.type === "16" ? (d(), c("svg", $t, [...o[10] || (o[10] = [
340
- I('<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
- ])])) : H("", !0)
327
+ ])])) : n.type === "6" ? (i(), c("svg", pt, [...r[4] || (r[4] = [
328
+ g('<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" ? (i(), c("svg", vt, [...r[5] || (r[5] = [
330
+ g('<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" ? (i(), c("svg", yt, [...r[6] || (r[6] = [
332
+ g('<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" ? (i(), c("svg", kt, [...r[7] || (r[7] = [
334
+ g('<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" ? (i(), c("svg", gt, [...r[8] || (r[8] = [
336
+ g('<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" ? (i(), c("svg", St, [...r[9] || (r[9] = [
338
+ g('<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" ? (i(), c("svg", Ct, [...r[10] || (r[10] = [
340
+ g('<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
+ ])])) : F("", !0)
342
342
  ]));
343
343
  }
344
- }), W = (u, w) => {
345
- const o = u.__vccOpts || u;
346
- for (const [g, p] of w)
347
- o[g] = p;
348
- return o;
349
- }, Q = /* @__PURE__ */ W(Dt, [["__scopeId", "data-v-31e0404d"]]), Lt = {
344
+ }), U = (n, k) => {
345
+ const r = n.__vccOpts || n;
346
+ for (const [f, u] of k)
347
+ r[f] = u;
348
+ return r;
349
+ }, Y = /* @__PURE__ */ U(ft, [["__scopeId", "data-v-31e0404d"]]), xt = {
350
350
  key: 0,
351
351
  class: "layout-toolbar",
352
352
  role: "toolbar",
353
353
  "aria-label": "布局切换工具栏"
354
- }, It = { class: "layout-buttons" }, Vt = ["onClick", "title", "aria-label", "aria-pressed"], Tt = { class: "layout-label" }, Bt = {
354
+ }, mt = { class: "layout-buttons" }, bt = ["onClick", "title", "aria-label", "aria-pressed"], Dt = { class: "layout-label" }, It = {
355
355
  class: "video-grid-container",
356
356
  role: "region",
357
357
  "aria-label": "视频网格"
358
- }, At = ["aria-label", "onDragstart", "onDragenter", "onDragleave", "onDrop"], Gt = { class: "video-placeholder" }, Nt = { class: "placeholder-number" }, Et = 0.5, Mt = "grabbing", Ot = "0.8", Rt = /* @__PURE__ */ z({
358
+ }, Lt = ["aria-label", "onDragstart", "onDragenter", "onDragleave", "onDrop"], _t = { class: "video-placeholder" }, $t = { class: "placeholder-number" }, Bt = 0.5, Vt = "grabbing", At = "0.8", Gt = /* @__PURE__ */ P({
359
359
  __name: "VideoGridLayout",
360
360
  props: {
361
361
  videos: {},
@@ -368,419 +368,246 @@ const vt = { class: "layout-icon" }, gt = {
368
368
  placeholders: {}
369
369
  },
370
370
  emits: ["layoutChange", "videosChange"],
371
- setup(u, { emit: w }) {
372
- const o = u, g = w, p = C(o.layout);
373
- A(() => o.layout, (t) => {
374
- p.value = t;
371
+ setup(n, { emit: k }) {
372
+ const r = n, f = k, u = B(r.layout);
373
+ I(() => r.layout, (t) => {
374
+ u.value = t;
375
375
  });
376
- const b = f(() => o.availableLayouts && o.availableLayouts.length > 0 ? o.availableLayouts : pt()), y = J([]);
377
- function V(t) {
378
- const l = Array.isArray(t) ? t : o.videos || [], n = G.value, r = {};
379
- y.value.forEach((v, D) => {
380
- v && v.id !== void 0 && (r[v.id] = v.__labelNumber ?? D + 1);
376
+ const j = v(() => r.availableLayouts && r.availableLayouts.length > 0 ? r.availableLayouts : it()), w = E([]);
377
+ function L(t) {
378
+ const e = Array.isArray(t) ? t : r.videos || [], a = $.value, o = {};
379
+ w.value.forEach((s, y) => {
380
+ s && s.id !== void 0 && (o[s.id] = s.__labelNumber ?? y + 1);
381
381
  });
382
- const i = Array.from({ length: n }).map((v, D) => {
383
- const S = l[D];
384
- if (S) {
385
- const it = r[S.id] ?? S.__labelNumber ?? D + 1;
386
- return { ...S, __labelNumber: it };
382
+ const l = Array.from({ length: a }).map((s, y) => {
383
+ const h = e[y];
384
+ if (h) {
385
+ const et = o[h.id] ?? h.__labelNumber ?? y + 1;
386
+ return { ...h, __labelNumber: et };
387
387
  }
388
388
  });
389
- y.value = i;
389
+ w.value = l;
390
390
  }
391
- A(() => o.videos, (t) => {
391
+ I(() => r.videos, (t) => {
392
392
  if (!Array.isArray(t)) {
393
393
  console.warn("[VideoGridLayout] Invalid videos prop, expected array");
394
394
  return;
395
395
  }
396
- V(t);
396
+ L(t);
397
397
  }, { flush: "post" });
398
398
  let _ = !1;
399
- A(y, (t) => {
400
- !_ && Array.isArray(t) && g("videosChange", t);
399
+ I(w, (t) => {
400
+ !_ && Array.isArray(t) && f("videosChange", t);
401
401
  });
402
- const x = f(() => {
403
- const t = B[p.value];
404
- return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${p.value}, fallback to '4'`), B[4]);
405
- }), T = f(() => wt(p.value)), G = f(() => {
402
+ const N = v(() => {
403
+ const t = C[u.value];
404
+ return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${u.value}, fallback to '4'`), C[4]);
405
+ }), D = v(() => ct(u.value)), $ = v(() => {
406
406
  var t;
407
- return ((t = x.value) == null ? void 0 : t.count) || 4;
408
- }), $ = f(() => y.value.slice(0, G.value).map((t) => t).filter(Boolean));
409
- f(() => {
407
+ return ((t = N.value) == null ? void 0 : t.count) || 4;
408
+ }), S = v(() => w.value.slice(0, $.value).map((t) => t).filter(Boolean));
409
+ v(() => {
410
410
  const t = {};
411
- return $.value.forEach((l, n) => {
412
- const r = y.value.findIndex((i) => i && i.id === l.id);
413
- r !== -1 && (t[n] = r);
411
+ return S.value.forEach((e, a) => {
412
+ const o = w.value.findIndex((l) => l && l.id === e.id);
413
+ o !== -1 && (t[a] = o);
414
414
  }), t;
415
- }), V(o.videos), A(G, () => {
416
- V(o.videos);
417
- }), f(() => {
418
- const t = T.value.map((l, n) => ({ p: l, idx: n }));
419
- return t.sort((l, n) => l.p.row === n.p.row ? (l.p.col || 0) - (n.p.col || 0) : (l.p.row || 0) - (n.p.row || 0)), t.map((l) => l.idx);
415
+ }), L(r.videos), I($, () => {
416
+ L(r.videos);
417
+ }), v(() => {
418
+ const t = D.value.map((e, a) => ({ p: e, idx: a }));
419
+ return t.sort((e, a) => e.p.row === a.p.row ? (e.p.col || 0) - (a.p.col || 0) : (e.p.row || 0) - (a.p.row || 0)), t.map((e) => e.idx);
420
420
  });
421
- const k = C(-1), L = C(-1), s = J(null), a = f(() => {
422
- const t = x.value;
421
+ const p = B(-1), x = B(-1), m = E(null), z = v(() => {
422
+ const t = N.value;
423
423
  return {
424
424
  display: "grid",
425
425
  gridTemplateColumns: (t == null ? void 0 : t.colTemplate) || `repeat(${(t == null ? void 0 : t.cols) || 2}, 1fr)`,
426
426
  gridTemplateRows: (t == null ? void 0 : t.rowTemplate) || `repeat(${(t == null ? void 0 : t.rows) || 2}, 1fr)`,
427
427
  gap: "4px",
428
- width: o.width || "100%",
429
- height: o.height || "100%"
428
+ width: r.width || "100%",
429
+ height: r.height || "100%"
430
430
  };
431
- }), h = f(() => ({
432
- width: o.width || "100%",
433
- height: o.height || "100%"
431
+ }), H = v(() => ({
432
+ width: r.width || "100%",
433
+ height: r.height || "100%"
434
434
  }));
435
- function N(t) {
436
- const l = $.value[t];
437
- return l ? y.value.findIndex((r) => r && r.id === l.id) + 1 : t + 1;
435
+ function W(t) {
436
+ const e = S.value[t];
437
+ return e ? w.value.findIndex((o) => o && o.id === e.id) + 1 : t + 1;
438
438
  }
439
- function Z(t) {
440
- const l = T.value[t];
441
- return !l || typeof l.col != "number" || typeof l.row != "number" ? {} : {
442
- gridColumn: `${l.col} / span ${l.colSpan}`,
443
- gridRow: `${l.row} / span ${l.rowSpan}`
439
+ function q(t) {
440
+ const e = D.value[t];
441
+ return !e || typeof e.col != "number" || typeof e.row != "number" ? {} : {
442
+ gridColumn: `${e.col} / span ${e.colSpan}`,
443
+ gridRow: `${e.row} / span ${e.rowSpan}`
444
444
  };
445
445
  }
446
- function tt(t) {
447
- const l = T.value[t];
448
- return (l == null ? void 0 : l.isMain) || !1;
446
+ function J(t) {
447
+ const e = D.value[t];
448
+ return (e == null ? void 0 : e.isMain) || !1;
449
449
  }
450
- function et(t) {
451
- p.value = t, g("layoutChange", p.value);
450
+ function K(t) {
451
+ u.value = t, f("layoutChange", u.value);
452
452
  }
453
- function E() {
454
- if (s.value && document.body.contains(s.value)) {
453
+ function b() {
454
+ if (m.value && document.body.contains(m.value)) {
455
455
  try {
456
- document.body.removeChild(s.value);
456
+ document.body.removeChild(m.value);
457
457
  } catch (t) {
458
458
  console.warn("[VideoGridLayout] Failed to cleanup drag image:", t);
459
459
  }
460
- s.value = null;
460
+ m.value = null;
461
461
  }
462
462
  }
463
- function ot(t, l) {
464
- if (l < 0 || l >= y.value.length) {
465
- console.warn("[VideoGridLayout] Invalid drag index:", l);
463
+ function Q(t, e) {
464
+ if (e < 0 || e >= w.value.length) {
465
+ console.warn("[VideoGridLayout] Invalid drag index:", e);
466
466
  return;
467
467
  }
468
- if (k.value = l, !t.dataTransfer) return;
468
+ if (p.value = e, !t.dataTransfer) return;
469
469
  t.dataTransfer.effectAllowed = "move";
470
- const r = t.target.closest(".video-item");
471
- if (r)
470
+ const o = t.target.closest(".video-item");
471
+ if (o)
472
472
  try {
473
- E();
474
- const i = r.cloneNode(!0);
475
- i.style.width = `${r.offsetWidth}px`, i.style.height = `${r.offsetHeight}px`, i.style.opacity = Ot, i.style.position = "absolute", i.style.top = "-9999px", i.style.pointerEvents = "none", document.body.appendChild(i), s.value = i, t.dataTransfer.setDragImage(i, r.offsetWidth / 2, r.offsetHeight / 2), setTimeout(() => {
476
- E();
477
- }, 100), r.style.opacity = String(Et), r.style.cursor = Mt;
478
- } catch (i) {
479
- console.error("[VideoGridLayout] Drag start error:", i), E();
473
+ b();
474
+ const l = o.cloneNode(!0);
475
+ l.style.width = `${o.offsetWidth}px`, l.style.height = `${o.offsetHeight}px`, l.style.opacity = At, l.style.position = "absolute", l.style.top = "-9999px", l.style.pointerEvents = "none", document.body.appendChild(l), m.value = l, t.dataTransfer.setDragImage(l, o.offsetWidth / 2, o.offsetHeight / 2), setTimeout(() => {
476
+ b();
477
+ }, 100), o.style.opacity = String(Bt), o.style.cursor = Vt;
478
+ } catch (l) {
479
+ console.error("[VideoGridLayout] Drag start error:", l), b();
480
480
  }
481
481
  }
482
- function rt(t, l) {
482
+ function X(t, e) {
483
483
  t.preventDefault(), t.stopPropagation();
484
- const n = k.value;
485
- if (n === -1 || n === l) {
486
- k.value = -1;
484
+ const a = p.value;
485
+ if (a === -1 || a === e) {
486
+ p.value = -1;
487
487
  return;
488
488
  }
489
- if (n >= y.value.length) {
490
- console.warn("[VideoGridLayout] No video at from index:", n), k.value = -1;
489
+ if (a >= w.value.length) {
490
+ console.warn("[VideoGridLayout] No video at from index:", a), p.value = -1;
491
491
  return;
492
492
  }
493
493
  try {
494
- const r = t.currentTarget;
495
- r && (r.style.backgroundColor = "rgba(66, 184, 131, 0.3)", r.style.borderColor = "#42b883", setTimeout(() => {
496
- r.style.backgroundColor = "", r.style.borderColor = "";
494
+ const o = t.currentTarget;
495
+ o && (o.style.backgroundColor = "rgba(66, 184, 131, 0.3)", o.style.borderColor = "#42b883", setTimeout(() => {
496
+ o.style.backgroundColor = "", o.style.borderColor = "";
497
497
  }, 200));
498
- const i = [...y.value];
499
- if (l >= i.length) {
500
- const v = i[n];
501
- i.splice(n, 1), i.push(v);
498
+ const l = [...w.value];
499
+ if (e >= l.length) {
500
+ const s = l[a];
501
+ l.splice(a, 1), l.push(s);
502
502
  } else {
503
- const v = i[n];
504
- i[n] = i[l], i[l] = v;
503
+ const s = l[a];
504
+ l[a] = l[e], l[e] = s;
505
505
  }
506
- _ = !0, y.value = i, setTimeout(() => {
507
- _ = !1, g("videosChange", y.value.filter(Boolean));
506
+ _ = !0, w.value = l, setTimeout(() => {
507
+ _ = !1, f("videosChange", w.value.filter(Boolean));
508
508
  }, 0);
509
- } catch (r) {
510
- console.error("[VideoGridLayout] Drop error:", r);
509
+ } catch (o) {
510
+ console.error("[VideoGridLayout] Drop error:", o);
511
511
  } finally {
512
- k.value = -1;
512
+ p.value = -1;
513
513
  }
514
514
  }
515
- function lt(t, l) {
516
- t.preventDefault(), k.value !== -1 && k.value !== l && (L.value = l);
515
+ function Z(t, e) {
516
+ t.preventDefault(), p.value !== -1 && p.value !== e && (x.value = e);
517
517
  }
518
- function at(t, l) {
518
+ function tt(t, e) {
519
519
  t.preventDefault();
520
- const n = t.target, r = t.relatedTarget;
521
- n.contains(r) || L.value === l && (L.value = -1);
520
+ const a = t.target, o = t.relatedTarget;
521
+ a.contains(o) || x.value === e && (x.value = -1);
522
522
  }
523
- function nt(t) {
524
- const n = t.target.closest(".video-item");
525
- n && (n.style.opacity = "1", n.style.cursor = "move"), E(), k.value = -1, L.value = -1;
523
+ function ot(t) {
524
+ const a = t.target.closest(".video-item");
525
+ a && (a.style.opacity = "1", a.style.cursor = "move"), b(), p.value = -1, x.value = -1;
526
526
  }
527
- return st(() => {
528
- E();
529
- }), (t, l) => (d(), c("div", {
527
+ return rt(() => {
528
+ b();
529
+ }), (t, e) => (i(), c("div", {
530
530
  class: "video-grid-layout",
531
531
  role: "application",
532
532
  "aria-label": "视频分屏布局",
533
- style: U(h.value)
533
+ style: V(H.value)
534
534
  }, [
535
- u.showToolbar ? (d(), c("div", Lt, [
536
- l[1] || (l[1] = e("div", { class: "toolbar-title" }, "分屏布局", -1)),
537
- e("div", It, [
538
- (d(!0), c(O, null, R(b.value, (n) => {
539
- var r, i, v;
540
- return d(), c("button", {
541
- key: n,
542
- class: Y(["layout-btn", { active: p.value === n }]),
543
- onClick: (D) => et(n),
544
- title: ((r = F(B)[n]) == null ? void 0 : r.label) || "",
545
- "aria-label": `切换到${((i = F(B)[n]) == null ? void 0 : i.label) || ""}布局`,
546
- "aria-pressed": p.value === n,
535
+ n.showToolbar ? (i(), c("div", xt, [
536
+ e[1] || (e[1] = d("div", { class: "toolbar-title" }, "分屏布局", -1)),
537
+ d("div", mt, [
538
+ (i(!0), c(T, null, O(j.value, (a) => {
539
+ var o, l, s;
540
+ return i(), c("button", {
541
+ key: a,
542
+ class: M(["layout-btn", { active: u.value === a }]),
543
+ onClick: (y) => K(a),
544
+ title: ((o = A(C)[a]) == null ? void 0 : o.label) || "",
545
+ "aria-label": `切换到${((l = A(C)[a]) == null ? void 0 : l.label) || ""}布局`,
546
+ "aria-pressed": u.value === a,
547
547
  type: "button"
548
548
  }, [
549
- K(Q, { type: n }, null, 8, ["type"]),
550
- e("span", Tt, m(((v = F(B)[n]) == null ? void 0 : v.label) || ""), 1)
551
- ], 10, Vt);
549
+ at(Y, { type: a }, null, 8, ["type"]),
550
+ d("span", Dt, R(((s = A(C)[a]) == null ? void 0 : s.label) || ""), 1)
551
+ ], 10, bt);
552
552
  }), 128))
553
553
  ])
554
- ])) : H("", !0),
555
- e("div", Bt, [
556
- e("div", {
554
+ ])) : F("", !0),
555
+ d("div", It, [
556
+ d("div", {
557
557
  class: "video-grid",
558
- style: U(a.value)
558
+ style: V(z.value)
559
559
  }, [
560
- (d(!0), c(O, null, R(T.value, (n, r) => {
561
- var i, v, D;
562
- return d(), c("div", {
563
- key: ((i = $.value[r]) == null ? void 0 : i.id) ?? r,
564
- class: Y(["video-item", {
565
- "main-video": tt(r),
566
- dragging: k.value === r,
567
- "drag-over": L.value === r && k.value !== r
560
+ (i(!0), c(T, null, O(D.value, (a, o) => {
561
+ var l, s, y;
562
+ return i(), c("div", {
563
+ key: ((l = S.value[o]) == null ? void 0 : l.id) ?? o,
564
+ class: M(["video-item", {
565
+ "main-video": J(o),
566
+ dragging: p.value === o,
567
+ "drag-over": x.value === o && p.value !== o
568
568
  }]),
569
- style: U(Z(r)),
569
+ style: V(q(o)),
570
570
  draggable: !0,
571
- "aria-label": `视频 ${r + 1}: ${((v = $.value[r]) == null ? void 0 : v.title) || ((D = $.value[r]) == null ? void 0 : D.id) || ""}`,
571
+ "aria-label": `视频 ${o + 1}: ${((s = S.value[o]) == null ? void 0 : s.title) || ((y = S.value[o]) == null ? void 0 : y.id) || ""}`,
572
572
  role: "article",
573
573
  tabindex: "0",
574
- onDragstart: (S) => ot(S, r),
575
- onDragover: l[0] || (l[0] = ct(() => {
574
+ onDragstart: (h) => Q(h, o),
575
+ onDragover: e[0] || (e[0] = lt(() => {
576
576
  }, ["prevent"])),
577
- onDragenter: (S) => lt(S, r),
578
- onDragleave: (S) => at(S, r),
579
- onDrop: (S) => rt(S, r),
580
- onDragend: nt
577
+ onDragenter: (h) => Z(h, o),
578
+ onDragleave: (h) => tt(h, o),
579
+ onDrop: (h) => X(h, o),
580
+ onDragend: ot
581
581
  }, [
582
- dt(t.$slots, "video", {
583
- video: $.value[r],
584
- index: r
582
+ nt(t.$slots, "video", {
583
+ video: S.value[o],
584
+ index: o
585
585
  }, () => [
586
- e("div", Gt, [
587
- e("div", Nt, m(N(r)), 1)
586
+ d("div", _t, [
587
+ d("div", $t, R(W(o)), 1)
588
588
  ])
589
589
  ], !0)
590
- ], 46, At);
590
+ ], 46, Lt);
591
591
  }), 128))
592
592
  ], 4)
593
593
  ])
594
594
  ], 4));
595
595
  }
596
- }), X = /* @__PURE__ */ W(Rt, [["__scopeId", "data-v-df2d4d67"]]), Ut = { class: "video-split-screen-example" }, Ft = { class: "example-controls" }, Pt = { class: "control-group" }, jt = { class: "layout-buttons" }, Yt = ["onClick"], zt = { class: "control-group" }, Ht = { class: "video-buttons" }, Wt = ["disabled"], Jt = ["disabled"], qt = { class: "control-group" }, Kt = { class: "placeholder-controls" }, Qt = { class: "example-content" }, Xt = { class: "video-grid-container" }, Zt = { class: "custom-video-item" }, te = { class: "video-content" }, ee = { class: "video-info" }, oe = { class: "video-title" }, re = { class: "video-id" }, le = { class: "example-info" }, ae = { class: "info-panel" }, ne = { class: "info-item" }, ie = { class: "info-item" }, se = { class: "info-item" }, ce = { key: 0 }, de = { key: 1 }, ue = { key: 2 }, he = { class: "info-panel" }, we = { class: "info-panel" }, pe = { class: "log-list" }, ve = /* @__PURE__ */ z({
597
- __name: "VideoSplitScreenExample",
598
- setup(u) {
599
- const w = C([
600
- { id: 1, title: "摄像头 1", url: "rtmp://example1.com/live" },
601
- { id: 2, title: "摄像头 2", url: "rtmp://example2.com/live" },
602
- { id: 3, title: "摄像头 3", url: "rtmp://example3.com/live" },
603
- { id: 4, title: "摄像头 4", url: "rtmp://example4.com/live" }
604
- ]), o = C("4"), g = C(!1), p = C(!1), b = C(""), y = f(() => {
605
- if (p.value)
606
- return (s) => `位置 ${s + 1}`;
607
- if (g.value)
608
- return b.value || "自定义占位符";
609
- }), V = C([]), _ = C([]);
610
- function x(s) {
611
- const h = (/* @__PURE__ */ new Date()).toLocaleTimeString();
612
- _.value.unshift({ time: h, message: s }), _.value.length > 10 && (_.value = _.value.slice(0, 10));
613
- }
614
- function T(s) {
615
- o.value = s, x(`切换到 ${s} 分屏布局`);
616
- }
617
- function G() {
618
- const s = Math.max(...w.value.map((a) => a.id)) + 1;
619
- w.value.push({
620
- id: s,
621
- title: `摄像头 ${s}`,
622
- url: `rtmp://example${s}.com/live`
623
- }), x(`添加视频: 摄像头 ${s}`);
624
- }
625
- function $() {
626
- if (w.value.length > 1) {
627
- const s = w.value.pop();
628
- x(`移除视频: ${s == null ? void 0 : s.title}`);
629
- }
630
- }
631
- function k() {
632
- w.value = [
633
- { id: 1, title: "摄像头 1", url: "rtmp://example1.com/live" },
634
- { id: 2, title: "摄像头 2", url: "rtmp://example2.com/live" },
635
- { id: 3, title: "摄像头 3", url: "rtmp://example3.com/live" },
636
- { id: 4, title: "摄像头 4", url: "rtmp://example4.com/live" }
637
- ], o.value = "4", g.value = !1, p.value = !1, b.value = "", V.value = [], x("重置所有设置");
638
- }
639
- function L(s) {
640
- console.log("Videos changed:", s), w.value = s, x(`视频重新排序: ${s.map((a) => a.title).join(" → ")}`);
641
- }
642
- return A([g, p], () => {
643
- g.value && p.value && (p.value = !1), x("更新占位符配置");
644
- }), A(b, () => {
645
- x(`设置占位符文本: "${b.value}"`);
646
- }), x("示例组件初始化完成"), (s, a) => (d(), c("div", Ut, [
647
- a[16] || (a[16] = e("div", { class: "example-header" }, [
648
- e("h1", null, "Video Split Screen 示例"),
649
- e("p", null, "演示所有功能:布局切换、拖拽排序、占位符配置")
650
- ], -1)),
651
- e("div", Ft, [
652
- e("div", Pt, [
653
- a[3] || (a[3] = e("h3", null, "布局切换", -1)),
654
- e("div", jt, [
655
- (d(), c(O, null, R(["1", "2", "3", "4", "6", "7", "8", "9", "10", "13", "16"], (h) => e("button", {
656
- key: h,
657
- class: Y(["layout-btn", { active: o.value === h }]),
658
- onClick: (N) => T(h)
659
- }, m(h) + "分屏 ", 11, Yt)), 64))
660
- ])
661
- ]),
662
- e("div", zt, [
663
- a[4] || (a[4] = e("h3", null, "视频管理", -1)),
664
- e("div", Ht, [
665
- e("button", {
666
- onClick: G,
667
- disabled: w.value.length >= 16
668
- }, "添加视频", 8, Wt),
669
- e("button", {
670
- onClick: $,
671
- disabled: w.value.length <= 1
672
- }, "移除视频", 8, Jt),
673
- e("button", { onClick: k }, "重置")
674
- ])
675
- ]),
676
- e("div", qt, [
677
- a[7] || (a[7] = e("h3", null, "占位符配置", -1)),
678
- e("div", Kt, [
679
- e("label", null, [
680
- P(e("input", {
681
- "onUpdate:modelValue": a[0] || (a[0] = (h) => g.value = h),
682
- type: "checkbox"
683
- }, null, 512), [
684
- [q, g.value]
685
- ]),
686
- a[5] || (a[5] = M(" 使用自定义文本 ", -1))
687
- ]),
688
- g.value ? P((d(), c("input", {
689
- key: 0,
690
- "onUpdate:modelValue": a[1] || (a[1] = (h) => b.value = h),
691
- type: "text",
692
- placeholder: "输入占位符文本"
693
- }, null, 512)), [
694
- [ut, b.value]
695
- ]) : H("", !0),
696
- e("label", null, [
697
- P(e("input", {
698
- "onUpdate:modelValue": a[2] || (a[2] = (h) => p.value = h),
699
- type: "checkbox"
700
- }, null, 512), [
701
- [q, p.value]
702
- ]),
703
- a[6] || (a[6] = M(" 使用函数生成 ", -1))
704
- ])
705
- ])
706
- ])
707
- ]),
708
- e("div", Qt, [
709
- e("div", Xt, [
710
- K(X, {
711
- videos: w.value,
712
- layout: o.value,
713
- "placeholder-text": y.value,
714
- placeholders: V.value,
715
- onVideosChange: L,
716
- width: "100%",
717
- height: "500px"
718
- }, {
719
- video: ht(({ video: h, index: N }) => [
720
- e("div", Zt, [
721
- e("div", te, [
722
- a[8] || (a[8] = e("div", { class: "video-icon" }, "📹", -1)),
723
- e("div", ee, [
724
- e("div", oe, m(h.title), 1),
725
- e("div", re, "ID: " + m(h.id), 1)
726
- ])
727
- ]),
728
- a[9] || (a[9] = e("div", { class: "drag-handle" }, "⋮⋮", -1))
729
- ])
730
- ]),
731
- _: 1
732
- }, 8, ["videos", "layout", "placeholder-text", "placeholders"])
733
- ]),
734
- e("div", le, [
735
- e("div", ae, [
736
- a[13] || (a[13] = e("h3", null, "当前状态", -1)),
737
- e("div", ne, [
738
- a[10] || (a[10] = e("strong", null, "布局:", -1)),
739
- M(" " + m(o.value) + "分屏 ", 1)
740
- ]),
741
- e("div", ie, [
742
- a[11] || (a[11] = e("strong", null, "视频数量:", -1)),
743
- M(" " + m(w.value.length), 1)
744
- ]),
745
- e("div", se, [
746
- a[12] || (a[12] = e("strong", null, "占位符:", -1)),
747
- g.value ? (d(), c("span", ce, m(b.value || "无文本"), 1)) : p.value ? (d(), c("span", de, "函数生成")) : (d(), c("span", ue, "默认数字"))
748
- ])
749
- ]),
750
- e("div", he, [
751
- a[14] || (a[14] = e("h3", null, "视频数组 (videos)", -1)),
752
- e("pre", null, m(JSON.stringify(w.value, null, 2)), 1)
753
- ]),
754
- e("div", we, [
755
- a[15] || (a[15] = e("h3", null, "操作日志", -1)),
756
- e("div", pe, [
757
- (d(!0), c(O, null, R(_.value, (h, N) => (d(), c("div", {
758
- key: N,
759
- class: "log-item"
760
- }, m(h.time) + ": " + m(h.message), 1))), 128))
761
- ])
762
- ])
763
- ])
764
- ])
765
- ]));
766
- }
767
- }), ge = /* @__PURE__ */ W(ve, [["__scopeId", "data-v-4a52fa65"]]), ye = {
768
- VideoGridLayout: X,
769
- VideoLayoutIcon: Q,
770
- VideoSplitScreenExample: ge
771
- }, Se = {
772
- install(u) {
773
- Object.entries(ye).forEach(([w, o]) => {
774
- u.component(w, o);
596
+ }), Nt = /* @__PURE__ */ U(Gt, [["__scopeId", "data-v-df2d4d67"]]), Et = {
597
+ VideoGridLayout: Nt,
598
+ VideoLayoutIcon: Y
599
+ }, Ot = {
600
+ install(n) {
601
+ Object.entries(Et).forEach(([k, r]) => {
602
+ n.component(k, r);
775
603
  });
776
604
  }
777
605
  };
778
606
  export {
779
- B as LAYOUT_CONFIGS,
780
- X as VideoGridLayout,
781
- Q as VideoLayoutIcon,
782
- ge as VideoSplitScreenExample,
783
- Se as default,
784
- pt as getAllLayoutTypes,
785
- wt as getLayoutPositions
607
+ C as LAYOUT_CONFIGS,
608
+ Nt as VideoGridLayout,
609
+ Y as VideoLayoutIcon,
610
+ Ot as default,
611
+ it as getAllLayoutTypes,
612
+ ct as getLayoutPositions
786
613
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .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-df2d4d67]{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar[data-v-df2d4d67]{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title[data-v-df2d4d67]{font-size:14px;font-weight:600;color:#333}.layout-buttons[data-v-df2d4d67]{display:flex;gap:8px;flex-wrap:wrap}.layout-btn[data-v-df2d4d67]{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-df2d4d67]:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active[data-v-df2d4d67]{border-color:#42b883;background:#42b883;color:#fff}.layout-label[data-v-df2d4d67]{font-size:12px}.video-grid-container[data-v-df2d4d67]{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-df2d4d67]{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-df2d4d67]{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[data-v-df2d4d67]{opacity:.5;cursor:grabbing;transform:scale(.98);box-shadow:0 4px 12px #0000004d}.video-item[data-v-df2d4d67]:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over[data-v-df2d4d67]{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item[data-v-df2d4d67]:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video[data-v-df2d4d67]{border-width:1px}.video-item[data-v-df2d4d67]>*{width:100%;height:100%}.video-placeholder[data-v-df2d4d67]{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-df2d4d67]{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-df2d4d67]{flex-direction:column;align-items:flex-start}.layout-label[data-v-df2d4d67]{display:none}}.video-split-screen-example[data-v-4a52fa65]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;max-width:1400px;margin:0 auto;padding:20px;background:#f8f9fa;min-height:100vh}.example-header[data-v-4a52fa65]{text-align:center;margin-bottom:30px;padding:20px;background:#fff;border-radius:8px;box-shadow:0 2px 10px #0000001a}.example-header h1[data-v-4a52fa65]{color:#333;margin:0 0 10px;font-size:2rem}.example-header p[data-v-4a52fa65]{color:#666;margin:0;font-size:1.1rem}.example-controls[data-v-4a52fa65]{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:20px;margin-bottom:30px}.control-group[data-v-4a52fa65]{background:#fff;padding:20px;border-radius:8px;box-shadow:0 2px 10px #0000001a}.control-group h3[data-v-4a52fa65]{margin:0 0 15px;color:#333;font-size:1.1rem}.layout-buttons[data-v-4a52fa65]{display:flex;flex-wrap:wrap;gap:8px}.layout-btn[data-v-4a52fa65]{padding:6px 12px;border:1px solid #ddd;background:#fff;border-radius:4px;cursor:pointer;transition:all .2s;font-size:.9rem}.layout-btn[data-v-4a52fa65]:hover{border-color:#007bff;color:#007bff}.layout-btn.active[data-v-4a52fa65]{background:#007bff;color:#fff;border-color:#007bff}.video-buttons[data-v-4a52fa65]{display:flex;gap:10px}.video-buttons button[data-v-4a52fa65]{padding:8px 16px;border:none;border-radius:4px;background:#28a745;color:#fff;cursor:pointer;transition:background .2s}.video-buttons button[data-v-4a52fa65]:hover:not(:disabled){background:#218838}.video-buttons button[data-v-4a52fa65]:disabled{background:#6c757d;cursor:not-allowed}.placeholder-controls[data-v-4a52fa65]{display:flex;flex-direction:column;gap:10px}.placeholder-controls label[data-v-4a52fa65]{display:flex;align-items:center;gap:8px;cursor:pointer;font-size:.9rem}.placeholder-controls input[type=text][data-v-4a52fa65]{padding:6px 12px;border:1px solid #ddd;border-radius:4px;font-size:.9rem}.example-content[data-v-4a52fa65]{display:grid;grid-template-columns:1fr 300px;gap:20px;align-items:start}.video-grid-container[data-v-4a52fa65]{background:#fff;padding:20px;border-radius:8px;box-shadow:0 2px 10px #0000001a}.custom-video-item[data-v-4a52fa65]{width:100%;height:100%;display:flex;flex-direction:column;background:linear-gradient(135deg,#667eea,#764ba2);border-radius:8px;overflow:hidden;color:#fff;position:relative}.video-content[data-v-4a52fa65]{flex:1;display:flex;align-items:center;padding:15px;gap:12px}.video-icon[data-v-4a52fa65]{font-size:2rem;opacity:.9}.video-info[data-v-4a52fa65]{flex:1}.video-title[data-v-4a52fa65]{font-size:1.1rem;font-weight:600;margin-bottom:4px}.video-id[data-v-4a52fa65]{font-size:.8rem;opacity:.8}.drag-handle[data-v-4a52fa65]{position:absolute;top:8px;right:8px;font-size:1.2rem;opacity:.7;cursor:grab;transition:opacity .2s}.custom-video-item:hover .drag-handle[data-v-4a52fa65]{opacity:1}.example-info[data-v-4a52fa65]{display:flex;flex-direction:column;gap:20px}.info-panel[data-v-4a52fa65]{background:#fff;padding:15px;border-radius:8px;box-shadow:0 2px 10px #0000001a}.info-panel h3[data-v-4a52fa65]{margin:0 0 15px;color:#333;font-size:1rem}.info-item[data-v-4a52fa65]{margin-bottom:8px;font-size:.9rem}.info-item[data-v-4a52fa65]:last-child{margin-bottom:0}.info-panel pre[data-v-4a52fa65]{background:#f8f9fa;padding:10px;border-radius:4px;font-size:.8rem;overflow-x:auto;margin:0;max-height:200px;overflow-y:auto}.log-list[data-v-4a52fa65]{max-height:200px;overflow-y:auto}.log-item[data-v-4a52fa65]{padding:4px 0;border-bottom:1px solid #eee;font-size:.8rem;color:#666}.log-item[data-v-4a52fa65]:last-child{border-bottom:none}@media (max-width: 768px){.example-content[data-v-4a52fa65],.example-controls[data-v-4a52fa65]{grid-template-columns:1fr}}
1
+ .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-df2d4d67]{width:100%;height:100%;display:flex;flex-direction:column;background:#0015294d}.layout-toolbar[data-v-df2d4d67]{padding:12px 16px;background:#fff;border-bottom:1px solid #e0e0e0;display:flex;align-items:center;gap:16px;flex-wrap:wrap}.toolbar-title[data-v-df2d4d67]{font-size:14px;font-weight:600;color:#333}.layout-buttons[data-v-df2d4d67]{display:flex;gap:8px;flex-wrap:wrap}.layout-btn[data-v-df2d4d67]{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-df2d4d67]:hover{border-color:#42b883;color:#42b883;background:#f0fdf4}.layout-btn.active[data-v-df2d4d67]{border-color:#42b883;background:#42b883;color:#fff}.layout-label[data-v-df2d4d67]{font-size:12px}.video-grid-container[data-v-df2d4d67]{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-df2d4d67]{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-df2d4d67]{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[data-v-df2d4d67]{opacity:.5;cursor:grabbing;transform:scale(.98);box-shadow:0 4px 12px #0000004d}.video-item[data-v-df2d4d67]:hover{border-color:#42b883cc;background:#001529cc}.video-item.drag-over[data-v-df2d4d67]{border:1px solid rgba(66,184,131,1)!important;background:#42b88333!important}.video-item[data-v-df2d4d67]:focus{outline:1px solid rgba(66,184,131,1);outline-offset:1px}.video-item.main-video[data-v-df2d4d67]{border-width:1px}.video-item[data-v-df2d4d67]>*{width:100%;height:100%}.video-placeholder[data-v-df2d4d67]{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-df2d4d67]{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-df2d4d67]{flex-direction:column;align-items:flex-start}.layout-label[data-v-df2d4d67]{display:none}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "video-split-screen",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "description": "Vue 3 视频分屏组件(VideoSplitScreen)",
5
5
  "keywords": [
6
6
  "vue",