video-split-screen 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # video-split-screen
2
2
 
3
- > **v1.0.12** - Vue 3 视频分屏组件(VideoSplitScreen)——可发布到 npm 的插件包。
3
+ Vue 3 视频分屏组件(VideoSplitScreen)——可发布到 npm 的插件包。
4
4
 
5
5
  安装(npm)
6
6
 
@@ -39,7 +39,7 @@ import 'video-split-screen/dist/style.css'
39
39
  主要 Props(VideoGridLayout)
40
40
 
41
41
  - `videos: VideoItem[]` — 视频数组(必填)
42
- - `layout?: LayoutType` — 布局类型('1'|'2'|'3'|'4'|'6'|'7'|'8'|'9'|'10'|'13'|'16'|'24'|'32'|'36'|'48'|'64'),默认 `'1'`
42
+ - `layout?: LayoutType` — 布局类型('1'|'2'|'3'|'4'|'6'|'7'|'8'|'9'|'10'|'13'|'16'),默认 `'1'`
43
43
  - `availableLayouts?: LayoutType[]` — 可选显示的布局按钮列表
44
44
  - `showToolbar?: boolean` — 是否显示工具栏,默认 `true`
45
45
  - `width?: string` — 宽度(任意 CSS 长度,例如 `100%`, `800px`)
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),y={1:{type:"1",label:"1分屏",count:1,cols:1,rows:1},2:{type:"2",label:"2分屏",count:2,cols:2,rows:1},3:{type:"3",label:"3分屏",count:3,cols:2,rows:2},4:{type:"4",label:"4分屏",count:4,cols:2,rows:2},6:{type:"6",label:"6分屏",count:6,cols:3,rows:2},7:{type:"7",label:"7分屏",count:7,cols:4,rows:4},8:{type:"8",label:"8分屏",count:8,cols:4,rows:4},9:{type:"9",label:"9分屏",count:9,cols:3,rows:3},10:{type:"10",label:"10分屏",count:10,cols:6,rows:4},13:{type:"13",label:"13分屏",count:13,cols:4,rows:4},16:{type:"16",label:"16分屏",count:16,cols:4,rows:4},24:{type:"24",label:"24分屏",count:24,cols:6,rows:4},32:{type:"32",label:"32分屏",count:32,cols:8,rows:4},36:{type:"36",label:"36分屏",count:36,cols:6,rows:6},48:{type:"48",label:"48分屏",count:48,cols:8,rows:6},64:{type:"64",label:"64分屏",count:64,cols:8,rows:8}},V={};function A(c){if(V[c])return V[c];const o={1:[{col:1,colSpan:1,row:1,rowSpan:1}],2:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1}],3:[{col:1,colSpan:1,row:1,rowSpan:2,isMain:!0},{col:2,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],4:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1}],6:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1}],7:[{col:1,colSpan:2,row:1,rowSpan:2},{col:3,colSpan:2,row:1,rowSpan:2},{col:1,colSpan:2,row:3,rowSpan:2},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],8:[{col:1,colSpan:3,row:1,rowSpan:3,isMain:!0},{col:4,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],9:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1}],10:[{col:1,colSpan:5,row:1,rowSpan:3,isMain:!0},{col:6,colSpan:1,row:1,rowSpan:1},{col:6,colSpan:1,row:2,rowSpan:1},{col:6,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1},{col:5,colSpan:1,row:4,rowSpan:1},{col:6,colSpan:1,row:4,rowSpan:1}],13:[{col:1,colSpan:2,row:1,rowSpan:2,isMain:!0},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],16:[{col:1,colSpan:1,row:1,rowSpan:1},{col:2,colSpan:1,row:1,rowSpan:1},{col:3,colSpan:1,row:1,rowSpan:1},{col:4,colSpan:1,row:1,rowSpan:1},{col:1,colSpan:1,row:2,rowSpan:1},{col:2,colSpan:1,row:2,rowSpan:1},{col:3,colSpan:1,row:2,rowSpan:1},{col:4,colSpan:1,row:2,rowSpan:1},{col:1,colSpan:1,row:3,rowSpan:1},{col:2,colSpan:1,row:3,rowSpan:1},{col:3,colSpan:1,row:3,rowSpan:1},{col:4,colSpan:1,row:3,rowSpan:1},{col:1,colSpan:1,row:4,rowSpan:1},{col:2,colSpan:1,row:4,rowSpan:1},{col:3,colSpan:1,row:4,rowSpan:1},{col:4,colSpan:1,row:4,rowSpan:1}],24:Array.from({length:24},(w,n)=>({col:n%6+1,colSpan:1,row:Math.floor(n/6)+1,rowSpan:1})),32:Array.from({length:32},(w,n)=>({col:n%8+1,colSpan:1,row:Math.floor(n/8)+1,rowSpan:1})),36:Array.from({length:36},(w,n)=>({col:n%6+1,colSpan:1,row:Math.floor(n/6)+1,rowSpan:1})),48:Array.from({length:48},(w,n)=>({col:n%8+1,colSpan:1,row:Math.floor(n/8)+1,rowSpan:1})),64:Array.from({length:64},(w,n)=>({col:n%8+1,colSpan:1,row:Math.floor(n/8)+1,rowSpan:1}))}[c]||[];return o.length>0&&(V[c]=o),o}function D(){return Object.keys(y)}const X={class:"layout-icon"},J={key:0,viewBox:"0 0 48 48",fill:"none"},K={key:1,viewBox:"0 0 48 48",fill:"none"},Q={key:2,viewBox:"0 0 48 48",fill:"none"},W={key:3,viewBox:"0 0 48 48",fill:"none"},Z={key:4,viewBox:"0 0 48 48",fill:"none"},ee={key:5,viewBox:"0 0 48 48",fill:"none"},te={key:6,viewBox:"0 0 48 48",fill:"none"},oe={key:7,viewBox:"0 0 48 48",fill:"none"},re={key:8,viewBox:"0 0 54 48",fill:"none"},ae={key:9,viewBox:"0 0 48 48",fill:"none"},le={key:10,viewBox:"0 0 48 48",fill:"none"},ne=e.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(c){return(k,o)=>(e.openBlock(),e.createElementBlock("div",X,[c.type==="1"?(e.openBlock(),e.createElementBlock("svg",J,[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"4",y:"4",width:"40",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1)])])):c.type==="2"?(e.openBlock(),e.createElementBlock("svg",K,[...o[1]||(o[1]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"40",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):c.type==="3"?(e.openBlock(),e.createElementBlock("svg",Q,[...o[2]||(o[2]=[e.createElementVNode("rect",{x:"4",y:"4",width:"20",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1),e.createElementVNode("rect",{x:"26",y:"4",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"26",y:"25",width:"18",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):c.type==="4"?(e.openBlock(),e.createElementBlock("svg",W,[...o[3]||(o[3]=[e.createElementVNode("rect",{x:"4",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"4",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"4",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"25",y:"25",width:"19",height:"19",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])):c.type==="6"?(e.openBlock(),e.createElementBlock("svg",Z,[...o[4]||(o[4]=[e.createStaticVNode('<rect x="3" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="3" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="24" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',6)])])):c.type==="7"?(e.openBlock(),e.createElementBlock("svg",ee,[...o[5]||(o[5]=[e.createStaticVNode('<rect x="4" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="4" y="25" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="25" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',7)])])):c.type==="8"?(e.openBlock(),e.createElementBlock("svg",te,[...o[6]||(o[6]=[e.createStaticVNode('<rect x="4" y="4" width="28" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="35" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',8)])])):c.type==="9"?(e.openBlock(),e.createElementBlock("svg",oe,[...o[7]||(o[7]=[e.createStaticVNode('<rect x="4" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>',9)])])):c.type==="10"?(e.openBlock(),e.createElementBlock("svg",re,[...o[8]||(o[8]=[e.createStaticVNode('<rect x="3" y="4" width="36" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="41" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="3" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="11" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="19" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="27" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="6" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="42" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',10)])])):c.type==="13"?(e.openBlock(),e.createElementBlock("svg",ae,[...o[9]||(o[9]=[e.createStaticVNode('<rect x="4" y="4" width="18" height="18" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="24" y="4" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="14" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="34" width="10" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>',13)])])):c.type==="16"?(e.openBlock(),e.createElementBlock("svg",le,[...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)]))}}),I=(c,k)=>{const o=c.__vccOpts||c;for(const[w,n]of k)o[w]=n;return o},L=I(ne,[["__scopeId","data-v-31e0404d"]]),ce={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},ie={class:"layout-buttons"},de=["onClick","title","aria-label","aria-pressed"],se={class:"layout-label"},he={class:"video-grid-container",role:"region","aria-label":"视频网格"},we=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],ue={class:"video-placeholder"},pe={class:"placeholder-number"},ve=.5,ke="grabbing",ye="0.8",Se=e.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{},dragAnimation:{default:"scale"}},emits:["layoutChange","videosChange"],setup(c,{emit:k}){const o=c,w=k,n=e.ref(o.layout);e.watch(()=>o.layout,t=>{n.value=t});const T=e.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:D()),p=e.shallowRef([]);function b(t){const r=Array.isArray(t)?t:o.videos||[],l=E.value,a={};p.value.forEach((d,v)=>{d&&d.id!==void 0&&(a[d.id]=d.__labelNumber??v+1)});const i=Array.from({length:l}).map((d,v)=>{const h=r[v];if(h){const H=a[h.id]??h.__labelNumber??v+1;return{...h,__labelNumber:H}}});p.value=i}e.watch(()=>o.videos,t=>{if(!Array.isArray(t)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}b(t)},{flush:"post"}),e.watch(E,()=>{b(o.videos)});let B=!1;e.watch(p,t=>{!B&&Array.isArray(t)&&w("videosChange",t)});const N=e.computed(()=>{const t=y[n.value];return t||(console.warn(`[VideoGridLayout] Invalid layout type: ${n.value}, fallback to '4'`),y[4])}),S=e.computed(()=>A(n.value)),E=e.computed(()=>{var t;return((t=N.value)==null?void 0:t.count)||4}),f=e.computed(()=>p.value.slice(0,E.value).map(t=>t).filter(Boolean));b(o.videos);const _=e.computed(()=>{const t=S.value.map((r,l)=>({p:r,idx:l}));return t.sort((r,l)=>r.p.row===l.p.row?(r.p.col||0)-(l.p.col||0):(r.p.row||0)-(l.p.row||0)),t.map(r=>r.idx)}),u=e.ref(-1),g=e.ref(-1),C=e.shallowRef(null),s=e.shallowRef(null);let m=null;const G=e.computed(()=>{const t=N.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%"}}),M=e.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function O(t){const r=t,l=_.value[r];if(Array.isArray(o.placeholders)&&o.placeholders[l]!==void 0)return String(o.placeholders[l]);if(typeof o.placeholderText=="function")try{return o.placeholderText(r)}catch{return String(r+1)}return o.placeholderText?String(o.placeholderText):String(r+1)}function R(t){const r=S.value[t];return!r||typeof r.col!="number"||typeof r.row!="number"?{}:{gridColumn:`${r.col} / span ${r.colSpan}`,gridRow:`${r.row} / span ${r.rowSpan}`}}function P(t){const r=S.value[t];return(r==null?void 0:r.isMain)||!1}function z(t){n.value=t,w("layoutChange",n.value)}function x(){if(C.value&&document.body.contains(C.value)){try{document.body.removeChild(C.value)}catch(t){console.warn("[VideoGridLayout] Failed to cleanup drag image:",t)}C.value=null}if(s.value&&document.body.contains(s.value)){try{document.body.removeChild(s.value)}catch{}s.value=null}m&&(document.removeEventListener("mousemove",m),m=null)}function F(t,r){if(r<0||r>=p.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(u.value=r,!t.dataTransfer)return;t.dataTransfer.effectAllowed="move";const a=t.target.closest(".video-item");if(a)try{if(x(),t.dataTransfer){const d=new Image;d.src="",t.dataTransfer.setDragImage(d,0,0)}const i=a.cloneNode(!0);i.style.position="fixed",i.style.top="0px",i.style.left="0px",i.style.margin="0",i.style.pointerEvents="none",i.style.opacity=ye,i.style.transform="translate(-50%,-50%)",i.style.zIndex="9999",i.classList.add("drag-preview"),o.dragAnimation&&o.dragAnimation!=="none"&&i.classList.add(o.dragAnimation),document.body.appendChild(i),s.value=i,m=d=>{s.value&&(s.value.style.left=`${d.clientX}px`,s.value.style.top=`${d.clientY}px`)},document.addEventListener("mousemove",m),a.style.opacity=String(ve),a.style.cursor=ke}catch(i){console.error("[VideoGridLayout] Drag start error:",i),x()}}function U(t,r){t.preventDefault(),t.stopPropagation();const l=u.value;if(l===-1||l===r){u.value=-1;return}if(r<0||r>=S.value.length){console.warn("[VideoGridLayout] Invalid drop index:",r),u.value=-1;return}try{const a=[...p.value],i=a[l],d=a[r];a[l]=d,a[r]=i,B=!0,p.value=a,setTimeout(()=>{B=!1,w("videosChange",p.value.filter(Boolean))},0)}catch(a){console.error("[VideoGridLayout] Drop error:",a)}finally{u.value=-1}}function Y(t,r){if(t.preventDefault(),u.value!==-1&&u.value!==r){g.value=r;try{const a=(t.currentTarget||t.target).getBoundingClientRect();s.value&&(s.value.style.width=`${a.width}px`,s.value.style.height=`${a.height}px`,s.value.style.transform="translate(-50%,-50%)")}catch{}}}function j(t,r){t.preventDefault();const l=t.target,a=t.relatedTarget;l.contains(a)||g.value===r&&(g.value=-1)}function q(t){const l=t.target.closest(".video-item");l&&(l.style.opacity="1",l.style.cursor="move"),x(),u.value=-1,g.value=-1}return e.onBeforeUnmount(()=>{x()}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:e.normalizeStyle(M.value)},[c.showToolbar?(e.openBlock(),e.createElementBlock("div",ce,[r[1]||(r[1]=e.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),e.createElementVNode("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,l=>{var a,i,d;return e.openBlock(),e.createElementBlock("button",{key:l,class:e.normalizeClass(["layout-btn",{active:n.value===l}]),onClick:v=>z(l),title:((a=e.unref(y)[l])==null?void 0:a.label)||"","aria-label":`切换到${((i=e.unref(y)[l])==null?void 0:i.label)||""}布局`,"aria-pressed":n.value===l,type:"button"},[e.createVNode(L,{type:l},null,8,["type"]),e.createElementVNode("span",se,e.toDisplayString(((d=e.unref(y)[l])==null?void 0:d.label)||""),1)],10,de)}),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",he,[e.createElementVNode("div",{class:"video-grid",style:e.normalizeStyle(G.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,(l,a)=>{var i,d,v;return e.openBlock(),e.createElementBlock("div",{key:((i=f.value[a])==null?void 0:i.id)??a,class:e.normalizeClass(["video-item",{"main-video":P(a),dragging:u.value===a,"drag-over":g.value===a&&u.value!==a}]),style:e.normalizeStyle(R(a)),draggable:!0,"aria-label":`视频 ${a+1}: ${((d=f.value[a])==null?void 0:d.title)||((v=f.value[a])==null?void 0:v.id)||""}`,role:"article",tabindex:"0",onDragstart:h=>F(h,a),onDragover:r[0]||(r[0]=e.withModifiers(()=>{},["prevent"])),onDragenter:h=>Y(h,a),onDragleave:h=>j(h,a),onDrop:h=>U(h,a),onDragend:q},[e.renderSlot(t.$slots,"video",{video:f.value[a],index:a},()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",pe,e.toDisplayString(O(_.value.indexOf(a))),1)])],!0)],46,we)}),128))],4)])],4))}}),$=I(Se,[["__scopeId","data-v-4813a92a"]]),ge={VideoGridLayout:$,VideoLayoutIcon:L},me={install(c){Object.entries(ge).forEach(([k,o])=>{c.component(k,o)})}};exports.LAYOUT_CONFIGS=y;exports.VideoGridLayout=$;exports.VideoLayoutIcon=L;exports.default=me;exports.getAllLayoutTypes=D;exports.getLayoutPositions=A;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k={1:{type:"1",label:"1分屏",count:1,cols:1,rows:1},2:{type:"2",label:"2分屏",count:2,cols:2,rows:1},3:{type:"3",label:"3分屏",count:3,cols:2,rows:2},4:{type:"4",label:"4分屏",count:4,cols:2,rows:2},6:{type:"6",label:"6分屏",count:6,cols:3,rows:2},7:{type:"7",label:"7分屏",count:7,cols:4,rows:4},8:{type:"8",label:"8分屏",count:8,cols:4,rows:4},9:{type:"9",label:"9分屏",count:9,cols:3,rows:3},10:{type:"10",label:"10分屏",count:10,cols:6,rows:4},13:{type:"13",label:"13分屏",count:13,cols:4,rows:4},16:{type:"16",label:"16分屏",count:16,cols:4,rows:4}},V={};function _(n){if(V[n])return V[n];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}]}[n]||[];return o.length>0&&(V[n]=o),o}function A(){return Object.keys(k)}const X={class:"layout-icon"},J={key:0,viewBox:"0 0 48 48",fill:"none"},K={key:1,viewBox:"0 0 48 48",fill:"none"},Q={key:2,viewBox:"0 0 48 48",fill:"none"},W={key:3,viewBox:"0 0 48 48",fill:"none"},Z={key:4,viewBox:"0 0 48 48",fill:"none"},ee={key:5,viewBox:"0 0 48 48",fill:"none"},te={key:6,viewBox:"0 0 48 48",fill:"none"},oe={key:7,viewBox:"0 0 48 48",fill:"none"},re={key:8,viewBox:"0 0 54 48",fill:"none"},ae={key:9,viewBox:"0 0 48 48",fill:"none"},le={key:10,viewBox:"0 0 48 48",fill:"none"},ne=e.defineComponent({__name:"VideoLayoutIcon",props:{type:{}},setup(n){return(v,o)=>(e.openBlock(),e.createElementBlock("div",X,[n.type==="1"?(e.openBlock(),e.createElementBlock("svg",J,[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"4",y:"4",width:"40",height:"40",stroke:"currentColor","stroke-width":"2"},null,-1)])])):n.type==="2"?(e.openBlock(),e.createElementBlock("svg",K,[...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)])])):n.type==="3"?(e.openBlock(),e.createElementBlock("svg",Q,[...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)])])):n.type==="4"?(e.openBlock(),e.createElementBlock("svg",W,[...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)])])):n.type==="6"?(e.openBlock(),e.createElementBlock("svg",Z,[...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)])])):n.type==="7"?(e.openBlock(),e.createElementBlock("svg",ee,[...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)])])):n.type==="8"?(e.openBlock(),e.createElementBlock("svg",te,[...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)])])):n.type==="9"?(e.openBlock(),e.createElementBlock("svg",oe,[...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)])])):n.type==="10"?(e.openBlock(),e.createElementBlock("svg",re,[...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)])])):n.type==="13"?(e.openBlock(),e.createElementBlock("svg",ae,[...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)])])):n.type==="16"?(e.openBlock(),e.createElementBlock("svg",le,[...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)]))}}),I=(n,v)=>{const o=n.__vccOpts||n;for(const[y,h]of v)o[y]=h;return o},L=I(ne,[["__scopeId","data-v-31e0404d"]]),ce={key:0,class:"layout-toolbar",role:"toolbar","aria-label":"布局切换工具栏"},ie={class:"layout-buttons"},de=["onClick","title","aria-label","aria-pressed"],se={class:"layout-label"},he={class:"video-grid-container",role:"region","aria-label":"视频网格"},we=["aria-label","onDragstart","onDragenter","onDragleave","onDrop"],ue={class:"video-placeholder"},pe={class:"placeholder-number"},ve=.5,ke="grabbing",ye="0.8",ge=e.defineComponent({__name:"VideoGridLayout",props:{videos:{},layout:{default:"1"},availableLayouts:{},showToolbar:{type:Boolean,default:!0},width:{},height:{},placeholderText:{},placeholders:{},dragAnimation:{default:"scale"}},emits:["layoutChange","videosChange"],setup(n,{emit:v}){const o=n,y=v,h=e.ref(o.layout);e.watch(()=>o.layout,t=>{h.value=t});const T=e.computed(()=>o.availableLayouts&&o.availableLayouts.length>0?o.availableLayouts:A()),u=e.shallowRef([]);function b(t){const r=Array.isArray(t)?t:o.videos||[],l=E.value,a={};u.value.forEach((i,p)=>{i&&i.id!==void 0&&(a[i.id]=i.__labelNumber??p+1)});const c=Array.from({length:l}).map((i,p)=>{const s=r[p];if(s){const H=a[s.id]??s.__labelNumber??p+1;return{...s,__labelNumber:H}}});u.value=c}e.watch(()=>o.videos,t=>{if(!Array.isArray(t)){console.warn("[VideoGridLayout] Invalid videos prop, expected array");return}b(t)},{flush:"post"}),e.watch(E,()=>{b(o.videos)});let B=!1;e.watch(u,t=>{!B&&Array.isArray(t)&&y("videosChange",t)});const N=e.computed(()=>{const t=k[h.value];return t||(console.warn(`[VideoGridLayout] Invalid layout type: ${h.value}, fallback to '4'`),k[4])}),g=e.computed(()=>_(h.value)),E=e.computed(()=>{var t;return((t=N.value)==null?void 0:t.count)||4}),C=e.computed(()=>u.value.slice(0,E.value).map(t=>t).filter(Boolean));b(o.videos);const D=e.computed(()=>{const t=g.value.map((r,l)=>({p:r,idx:l}));return t.sort((r,l)=>r.p.row===l.p.row?(r.p.col||0)-(l.p.col||0):(r.p.row||0)-(l.p.row||0)),t.map(r=>r.idx)}),w=e.ref(-1),S=e.ref(-1),f=e.shallowRef(null),d=e.shallowRef(null);let m=null;const G=e.computed(()=>{const t=N.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%"}}),O=e.computed(()=>({width:o.width||"100%",height:o.height||"100%"}));function M(t){const r=t,l=D.value[r];if(Array.isArray(o.placeholders)&&o.placeholders[l]!==void 0)return String(o.placeholders[l]);if(typeof o.placeholderText=="function")try{return o.placeholderText(r)}catch{return String(r+1)}return o.placeholderText?String(o.placeholderText):String(r+1)}function R(t){const r=g.value[t];return!r||typeof r.col!="number"||typeof r.row!="number"?{}:{gridColumn:`${r.col} / span ${r.colSpan}`,gridRow:`${r.row} / span ${r.rowSpan}`}}function P(t){const r=g.value[t];return(r==null?void 0:r.isMain)||!1}function z(t){h.value=t,y("layoutChange",h.value)}function x(){if(f.value&&document.body.contains(f.value)){try{document.body.removeChild(f.value)}catch(t){console.warn("[VideoGridLayout] Failed to cleanup drag image:",t)}f.value=null}if(d.value&&document.body.contains(d.value)){try{document.body.removeChild(d.value)}catch{}d.value=null}m&&(document.removeEventListener("mousemove",m),m=null)}function F(t,r){if(r<0||r>=u.value.length){console.warn("[VideoGridLayout] Invalid drag index:",r);return}if(w.value=r,!t.dataTransfer)return;t.dataTransfer.effectAllowed="move";const a=t.target.closest(".video-item");if(a)try{if(x(),t.dataTransfer){const i=new Image;i.src="",t.dataTransfer.setDragImage(i,0,0)}const c=a.cloneNode(!0);c.style.position="fixed",c.style.top="0px",c.style.left="0px",c.style.margin="0",c.style.pointerEvents="none",c.style.opacity=ye,c.style.transform="translate(-50%,-50%)",c.style.zIndex="9999",c.classList.add("drag-preview"),o.dragAnimation&&o.dragAnimation!=="none"&&c.classList.add(o.dragAnimation),document.body.appendChild(c),d.value=c,m=i=>{d.value&&(d.value.style.left=`${i.clientX}px`,d.value.style.top=`${i.clientY}px`)},document.addEventListener("mousemove",m),a.style.opacity=String(ve),a.style.cursor=ke}catch(c){console.error("[VideoGridLayout] Drag start error:",c),x()}}function U(t,r){t.preventDefault(),t.stopPropagation();const l=w.value;if(l===-1||l===r){w.value=-1;return}if(r<0||r>=g.value.length){console.warn("[VideoGridLayout] Invalid drop index:",r),w.value=-1;return}try{const a=[...u.value],c=a[l],i=a[r];a[l]=i,a[r]=c,B=!0,u.value=a,setTimeout(()=>{B=!1,y("videosChange",u.value.filter(Boolean))},0)}catch(a){console.error("[VideoGridLayout] Drop error:",a)}finally{w.value=-1}}function Y(t,r){if(t.preventDefault(),w.value!==-1&&w.value!==r){S.value=r;try{const a=(t.currentTarget||t.target).getBoundingClientRect();d.value&&(d.value.style.width=`${a.width}px`,d.value.style.height=`${a.height}px`,d.value.style.transform="translate(-50%,-50%)")}catch{}}}function j(t,r){t.preventDefault();const l=t.target,a=t.relatedTarget;l.contains(a)||S.value===r&&(S.value=-1)}function q(t){const l=t.target.closest(".video-item");l&&(l.style.opacity="1",l.style.cursor="move"),x(),w.value=-1,S.value=-1}return e.onBeforeUnmount(()=>{x()}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:"video-grid-layout",role:"application","aria-label":"视频分屏布局",style:e.normalizeStyle(O.value)},[n.showToolbar?(e.openBlock(),e.createElementBlock("div",ce,[r[1]||(r[1]=e.createElementVNode("div",{class:"toolbar-title"},"分屏布局",-1)),e.createElementVNode("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,l=>{var a,c,i;return e.openBlock(),e.createElementBlock("button",{key:l,class:e.normalizeClass(["layout-btn",{active:h.value===l}]),onClick:p=>z(l),title:((a=e.unref(k)[l])==null?void 0:a.label)||"","aria-label":`切换到${((c=e.unref(k)[l])==null?void 0:c.label)||""}布局`,"aria-pressed":h.value===l,type:"button"},[e.createVNode(L,{type:l},null,8,["type"]),e.createElementVNode("span",se,e.toDisplayString(((i=e.unref(k)[l])==null?void 0:i.label)||""),1)],10,de)}),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",he,[e.createElementVNode("div",{class:"video-grid",style:e.normalizeStyle(G.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(l,a)=>{var c,i,p;return e.openBlock(),e.createElementBlock("div",{key:((c=C.value[a])==null?void 0:c.id)??a,class:e.normalizeClass(["video-item",{"main-video":P(a),dragging:w.value===a,"drag-over":S.value===a&&w.value!==a}]),style:e.normalizeStyle(R(a)),draggable:!0,"aria-label":`视频 ${a+1}: ${((i=C.value[a])==null?void 0:i.title)||((p=C.value[a])==null?void 0:p.id)||""}`,role:"article",tabindex:"0",onDragstart:s=>F(s,a),onDragover:r[0]||(r[0]=e.withModifiers(()=>{},["prevent"])),onDragenter:s=>Y(s,a),onDragleave:s=>j(s,a),onDrop:s=>U(s,a),onDragend:q},[e.renderSlot(t.$slots,"video",{video:C.value[a],index:a},()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",pe,e.toDisplayString(M(D.value.indexOf(a))),1)])],!0)],46,we)}),128))],4)])],4))}}),$=I(ge,[["__scopeId","data-v-4813a92a"]]),Se={VideoGridLayout:$,VideoLayoutIcon:L},me={install(n){Object.entries(Se).forEach(([v,o])=>{n.component(v,o)})}};exports.LAYOUT_CONFIGS=k;exports.VideoGridLayout=$;exports.VideoLayoutIcon=L;exports.default=me;exports.getAllLayoutTypes=A;exports.getLayoutPositions=_;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as Y, createElementBlock as s, openBlock as d, createCommentVNode as z, createElementVNode as h, createStaticVNode as f, ref as V, watch as D, computed as S, shallowRef as E, onBeforeUnmount as nt, normalizeStyle as G, Fragment as R, renderList as P, unref as M, normalizeClass as F, createVNode as ct, toDisplayString as U, withModifiers as it, renderSlot as st } from "vue";
1
+ import { defineComponent as Y, createElementBlock as i, openBlock as d, createCommentVNode as z, createElementVNode as s, createStaticVNode as S, ref as V, watch as A, computed as g, shallowRef as E, onBeforeUnmount as nt, normalizeStyle as G, Fragment as R, renderList as P, unref as T, normalizeClass as F, createVNode as ct, toDisplayString as U, withModifiers as it, renderSlot as dt } from "vue";
2
2
  const C = {
3
3
  1: {
4
4
  type: "1",
@@ -76,47 +76,12 @@ const C = {
76
76
  count: 16,
77
77
  cols: 4,
78
78
  rows: 4
79
- },
80
- 24: {
81
- type: "24",
82
- label: "24分屏",
83
- count: 24,
84
- cols: 6,
85
- rows: 4
86
- },
87
- 32: {
88
- type: "32",
89
- label: "32分屏",
90
- count: 32,
91
- cols: 8,
92
- rows: 4
93
- },
94
- 36: {
95
- type: "36",
96
- label: "36分屏",
97
- count: 36,
98
- cols: 6,
99
- rows: 6
100
- },
101
- 48: {
102
- type: "48",
103
- label: "48分屏",
104
- count: 48,
105
- cols: 8,
106
- rows: 6
107
- },
108
- 64: {
109
- type: "64",
110
- label: "64分屏",
111
- count: 64,
112
- cols: 8,
113
- rows: 8
114
79
  }
115
- }, T = {};
116
- function dt(n) {
117
- if (T[n])
118
- return T[n];
119
- const o = {
80
+ }, O = {};
81
+ function st(l) {
82
+ if (O[l])
83
+ return O[l];
84
+ const e = {
120
85
  1: [
121
86
  { col: 1, colSpan: 1, row: 1, rowSpan: 1 }
122
87
  ],
@@ -217,40 +182,9 @@ function dt(n) {
217
182
  { col: 2, colSpan: 1, row: 4, rowSpan: 1 },
218
183
  { col: 3, colSpan: 1, row: 4, rowSpan: 1 },
219
184
  { col: 4, colSpan: 1, row: 4, rowSpan: 1 }
220
- ],
221
- // 新增大尺寸布局配置
222
- 24: Array.from({ length: 24 }, (p, l) => ({
223
- col: l % 6 + 1,
224
- colSpan: 1,
225
- row: Math.floor(l / 6) + 1,
226
- rowSpan: 1
227
- })),
228
- 32: Array.from({ length: 32 }, (p, l) => ({
229
- col: l % 8 + 1,
230
- colSpan: 1,
231
- row: Math.floor(l / 8) + 1,
232
- rowSpan: 1
233
- })),
234
- 36: Array.from({ length: 36 }, (p, l) => ({
235
- col: l % 6 + 1,
236
- colSpan: 1,
237
- row: Math.floor(l / 6) + 1,
238
- rowSpan: 1
239
- })),
240
- 48: Array.from({ length: 48 }, (p, l) => ({
241
- col: l % 8 + 1,
242
- colSpan: 1,
243
- row: Math.floor(l / 8) + 1,
244
- rowSpan: 1
245
- })),
246
- 64: Array.from({ length: 64 }, (p, l) => ({
247
- col: l % 8 + 1,
248
- colSpan: 1,
249
- row: Math.floor(l / 8) + 1,
250
- rowSpan: 1
251
- }))
252
- }[n] || [];
253
- return o.length > 0 && (T[n] = o), o;
185
+ ]
186
+ }[l] || [];
187
+ return e.length > 0 && (O[l] = e), e;
254
188
  }
255
189
  function ht() {
256
190
  return Object.keys(C);
@@ -275,19 +209,19 @@ const wt = { class: "layout-icon" }, ut = {
275
209
  key: 4,
276
210
  viewBox: "0 0 48 48",
277
211
  fill: "none"
278
- }, St = {
212
+ }, kt = {
279
213
  key: 5,
280
214
  viewBox: "0 0 48 48",
281
215
  fill: "none"
282
- }, kt = {
216
+ }, St = {
283
217
  key: 6,
284
218
  viewBox: "0 0 48 48",
285
219
  fill: "none"
286
- }, ft = {
220
+ }, Ct = {
287
221
  key: 7,
288
222
  viewBox: "0 0 48 48",
289
223
  fill: "none"
290
- }, Ct = {
224
+ }, ft = {
291
225
  key: 8,
292
226
  viewBox: "0 0 54 48",
293
227
  fill: "none"
@@ -304,10 +238,10 @@ const wt = { class: "layout-icon" }, ut = {
304
238
  props: {
305
239
  type: {}
306
240
  },
307
- setup(n) {
308
- return (k, o) => (d(), s("div", wt, [
309
- n.type === "1" ? (d(), s("svg", ut, [...o[0] || (o[0] = [
310
- h("rect", {
241
+ setup(l) {
242
+ return (k, e) => (d(), i("div", wt, [
243
+ l.type === "1" ? (d(), i("svg", ut, [...e[0] || (e[0] = [
244
+ s("rect", {
311
245
  x: "4",
312
246
  y: "4",
313
247
  width: "40",
@@ -315,8 +249,8 @@ const wt = { class: "layout-icon" }, ut = {
315
249
  stroke: "currentColor",
316
250
  "stroke-width": "2"
317
251
  }, null, -1)
318
- ])])) : n.type === "2" ? (d(), s("svg", pt, [...o[1] || (o[1] = [
319
- h("rect", {
252
+ ])])) : l.type === "2" ? (d(), i("svg", pt, [...e[1] || (e[1] = [
253
+ s("rect", {
320
254
  x: "4",
321
255
  y: "4",
322
256
  width: "19",
@@ -324,7 +258,7 @@ const wt = { class: "layout-icon" }, ut = {
324
258
  stroke: "currentColor",
325
259
  "stroke-width": "1.5"
326
260
  }, null, -1),
327
- h("rect", {
261
+ s("rect", {
328
262
  x: "25",
329
263
  y: "4",
330
264
  width: "19",
@@ -332,8 +266,8 @@ const wt = { class: "layout-icon" }, ut = {
332
266
  stroke: "currentColor",
333
267
  "stroke-width": "1.5"
334
268
  }, null, -1)
335
- ])])) : n.type === "3" ? (d(), s("svg", vt, [...o[2] || (o[2] = [
336
- h("rect", {
269
+ ])])) : l.type === "3" ? (d(), i("svg", vt, [...e[2] || (e[2] = [
270
+ s("rect", {
337
271
  x: "4",
338
272
  y: "4",
339
273
  width: "20",
@@ -341,7 +275,7 @@ const wt = { class: "layout-icon" }, ut = {
341
275
  stroke: "currentColor",
342
276
  "stroke-width": "2"
343
277
  }, null, -1),
344
- h("rect", {
278
+ s("rect", {
345
279
  x: "26",
346
280
  y: "4",
347
281
  width: "18",
@@ -349,7 +283,7 @@ const wt = { class: "layout-icon" }, ut = {
349
283
  stroke: "currentColor",
350
284
  "stroke-width": "1.5"
351
285
  }, null, -1),
352
- h("rect", {
286
+ s("rect", {
353
287
  x: "26",
354
288
  y: "25",
355
289
  width: "18",
@@ -357,8 +291,8 @@ const wt = { class: "layout-icon" }, ut = {
357
291
  stroke: "currentColor",
358
292
  "stroke-width": "1.5"
359
293
  }, null, -1)
360
- ])])) : n.type === "4" ? (d(), s("svg", yt, [...o[3] || (o[3] = [
361
- h("rect", {
294
+ ])])) : l.type === "4" ? (d(), i("svg", yt, [...e[3] || (e[3] = [
295
+ s("rect", {
362
296
  x: "4",
363
297
  y: "4",
364
298
  width: "19",
@@ -366,7 +300,7 @@ const wt = { class: "layout-icon" }, ut = {
366
300
  stroke: "currentColor",
367
301
  "stroke-width": "1.5"
368
302
  }, null, -1),
369
- h("rect", {
303
+ s("rect", {
370
304
  x: "25",
371
305
  y: "4",
372
306
  width: "19",
@@ -374,7 +308,7 @@ const wt = { class: "layout-icon" }, ut = {
374
308
  stroke: "currentColor",
375
309
  "stroke-width": "1.5"
376
310
  }, null, -1),
377
- h("rect", {
311
+ s("rect", {
378
312
  x: "4",
379
313
  y: "25",
380
314
  width: "19",
@@ -382,7 +316,7 @@ const wt = { class: "layout-icon" }, ut = {
382
316
  stroke: "currentColor",
383
317
  "stroke-width": "1.5"
384
318
  }, null, -1),
385
- h("rect", {
319
+ s("rect", {
386
320
  x: "25",
387
321
  y: "25",
388
322
  width: "19",
@@ -390,38 +324,38 @@ const wt = { class: "layout-icon" }, ut = {
390
324
  stroke: "currentColor",
391
325
  "stroke-width": "1.5"
392
326
  }, null, -1)
393
- ])])) : n.type === "6" ? (d(), s("svg", gt, [...o[4] || (o[4] = [
394
- f('<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)
395
- ])])) : n.type === "7" ? (d(), s("svg", St, [...o[5] || (o[5] = [
396
- f('<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)
397
- ])])) : n.type === "8" ? (d(), s("svg", kt, [...o[6] || (o[6] = [
398
- f('<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)
399
- ])])) : n.type === "9" ? (d(), s("svg", ft, [...o[7] || (o[7] = [
400
- f('<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)
401
- ])])) : n.type === "10" ? (d(), s("svg", Ct, [...o[8] || (o[8] = [
402
- f('<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)
403
- ])])) : n.type === "13" ? (d(), s("svg", xt, [...o[9] || (o[9] = [
404
- f('<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)
405
- ])])) : n.type === "16" ? (d(), s("svg", mt, [...o[10] || (o[10] = [
406
- f('<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)
327
+ ])])) : l.type === "6" ? (d(), i("svg", gt, [...e[4] || (e[4] = [
328
+ S('<rect x="3" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="3" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="24" width="12" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="24" width="13" height="18" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>', 6)
329
+ ])])) : l.type === "7" ? (d(), i("svg", kt, [...e[5] || (e[5] = [
330
+ S('<rect x="4" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="4" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="4" y="25" width="19" height="19" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="25" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="25" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="25" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 7)
331
+ ])])) : l.type === "8" ? (d(), i("svg", St, [...e[6] || (e[6] = [
332
+ S('<rect x="4" y="4" width="28" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="35" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 8)
333
+ ])])) : l.type === "9" ? (d(), i("svg", Ct, [...e[7] || (e[7] = [
334
+ S('<rect x="4" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="4" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="18" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="4" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="18" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect><rect x="32" y="32" width="12" height="12" stroke="currentColor" stroke-width="1.5" data-v-31e0404d></rect>', 9)
335
+ ])])) : l.type === "10" ? (d(), i("svg", ft, [...e[8] || (e[8] = [
336
+ S('<rect x="3" y="4" width="36" height="29" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="41" y="4" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="14.5" width="10" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="41" y="24.5" width="10" height="8.5" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="3" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="11" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="19" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="27" y="35" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="35" y="35" width="6" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="42" y="35" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 10)
337
+ ])])) : l.type === "13" ? (d(), i("svg", xt, [...e[9] || (e[9] = [
338
+ S('<rect x="4" y="4" width="18" height="18" stroke="currentColor" stroke-width="2" data-v-31e0404d></rect><rect x="24" y="4" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="4" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="14" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="14" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="24" width="8" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="24" width="10" height="8" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="14" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="24" y="34" width="8" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="34" y="34" width="10" height="10" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 13)
339
+ ])])) : l.type === "16" ? (d(), i("svg", mt, [...e[10] || (e[10] = [
340
+ S('<rect x="4" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="4" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="4" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="15" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="15" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="26" width="9" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="26" width="7" height="9" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="4" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="15" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="26" y="37" width="9" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect><rect x="37" y="37" width="7" height="7" stroke="currentColor" stroke-width="1.2" data-v-31e0404d></rect>', 16)
407
341
  ])])) : z("", !0)
408
342
  ]));
409
343
  }
410
- }), j = (n, k) => {
411
- const o = n.__vccOpts || n;
412
- for (const [p, l] of k)
413
- o[p] = l;
414
- return o;
344
+ }), j = (l, k) => {
345
+ const e = l.__vccOpts || l;
346
+ for (const [f, u] of k)
347
+ e[f] = u;
348
+ return e;
415
349
  }, H = /* @__PURE__ */ j(bt, [["__scopeId", "data-v-31e0404d"]]), Lt = {
416
350
  key: 0,
417
351
  class: "layout-toolbar",
418
352
  role: "toolbar",
419
353
  "aria-label": "布局切换工具栏"
420
- }, At = { class: "layout-buttons" }, _t = ["onClick", "title", "aria-label", "aria-pressed"], Dt = { class: "layout-label" }, $t = {
354
+ }, Dt = { class: "layout-buttons" }, $t = ["onClick", "title", "aria-label", "aria-pressed"], At = { class: "layout-label" }, It = {
421
355
  class: "video-grid-container",
422
356
  role: "region",
423
357
  "aria-label": "视频网格"
424
- }, It = ["aria-label", "onDragstart", "onDragenter", "onDragleave", "onDrop"], Bt = { class: "video-placeholder" }, Vt = { class: "placeholder-number" }, Et = 0.5, Gt = "grabbing", Mt = "0.8", Tt = /* @__PURE__ */ Y({
358
+ }, _t = ["aria-label", "onDragstart", "onDragenter", "onDragleave", "onDrop"], Bt = { class: "video-placeholder" }, Vt = { class: "placeholder-number" }, Et = 0.5, Gt = "grabbing", Tt = "0.8", Ot = /* @__PURE__ */ Y({
425
359
  __name: "VideoGridLayout",
426
360
  props: {
427
361
  videos: {},
@@ -435,257 +369,257 @@ const wt = { class: "layout-icon" }, ut = {
435
369
  dragAnimation: { default: "scale" }
436
370
  },
437
371
  emits: ["layoutChange", "videosChange"],
438
- setup(n, { emit: k }) {
439
- const o = n, p = k, l = V(o.layout);
440
- D(() => o.layout, (t) => {
441
- l.value = t;
372
+ setup(l, { emit: k }) {
373
+ const e = l, f = k, u = V(e.layout);
374
+ A(() => e.layout, (t) => {
375
+ u.value = t;
442
376
  });
443
- const X = S(() => o.availableLayouts && o.availableLayouts.length > 0 ? o.availableLayouts : ht()), y = E([]);
444
- function $(t) {
445
- const e = Array.isArray(t) ? t : o.videos || [], a = B.value, r = {};
446
- y.value.forEach((i, g) => {
447
- i && i.id !== void 0 && (r[i.id] = i.__labelNumber ?? g + 1);
377
+ const X = g(() => e.availableLayouts && e.availableLayouts.length > 0 ? e.availableLayouts : ht()), v = E([]);
378
+ function I(t) {
379
+ const o = Array.isArray(t) ? t : e.videos || [], a = B.value, r = {};
380
+ v.value.forEach((c, y) => {
381
+ c && c.id !== void 0 && (r[c.id] = c.__labelNumber ?? y + 1);
448
382
  });
449
- const c = Array.from({ length: a }).map((i, g) => {
450
- const u = e[g];
451
- if (u) {
452
- const lt = r[u.id] ?? u.__labelNumber ?? g + 1;
453
- return { ...u, __labelNumber: lt };
383
+ const n = Array.from({ length: a }).map((c, y) => {
384
+ const w = o[y];
385
+ if (w) {
386
+ const lt = r[w.id] ?? w.__labelNumber ?? y + 1;
387
+ return { ...w, __labelNumber: lt };
454
388
  }
455
389
  });
456
- y.value = c;
390
+ v.value = n;
457
391
  }
458
- D(() => o.videos, (t) => {
392
+ A(() => e.videos, (t) => {
459
393
  if (!Array.isArray(t)) {
460
394
  console.warn("[VideoGridLayout] Invalid videos prop, expected array");
461
395
  return;
462
396
  }
463
- $(t);
464
- }, { flush: "post" }), D(B, () => {
465
- $(o.videos);
397
+ I(t);
398
+ }, { flush: "post" }), A(B, () => {
399
+ I(e.videos);
466
400
  });
467
- let I = !1;
468
- D(y, (t) => {
469
- !I && Array.isArray(t) && p("videosChange", t);
401
+ let _ = !1;
402
+ A(v, (t) => {
403
+ !_ && Array.isArray(t) && f("videosChange", t);
470
404
  });
471
- const O = S(() => {
472
- const t = C[l.value];
473
- return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${l.value}, fallback to '4'`), C[4]);
474
- }), x = S(() => dt(l.value)), B = S(() => {
405
+ const N = g(() => {
406
+ const t = C[u.value];
407
+ return t || (console.warn(`[VideoGridLayout] Invalid layout type: ${u.value}, fallback to '4'`), C[4]);
408
+ }), x = g(() => st(u.value)), B = g(() => {
475
409
  var t;
476
- return ((t = O.value) == null ? void 0 : t.count) || 4;
477
- }), L = S(() => y.value.slice(0, B.value).map((t) => t).filter(Boolean));
478
- $(o.videos);
479
- const N = S(() => {
480
- const t = x.value.map((e, a) => ({ p: e, idx: a }));
481
- 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);
482
- }), v = V(-1), m = V(-1), A = E(null), w = E(null);
410
+ return ((t = N.value) == null ? void 0 : t.count) || 4;
411
+ }), L = g(() => v.value.slice(0, B.value).map((t) => t).filter(Boolean));
412
+ I(e.videos);
413
+ const M = g(() => {
414
+ const t = x.value.map((o, a) => ({ p: o, idx: a }));
415
+ return t.sort((o, a) => o.p.row === a.p.row ? (o.p.col || 0) - (a.p.col || 0) : (o.p.row || 0) - (a.p.row || 0)), t.map((o) => o.idx);
416
+ }), p = V(-1), m = V(-1), D = E(null), h = E(null);
483
417
  let b = null;
484
- const q = S(() => {
485
- const t = O.value;
418
+ const q = g(() => {
419
+ const t = N.value;
486
420
  return {
487
421
  display: "grid",
488
422
  gridTemplateColumns: (t == null ? void 0 : t.colTemplate) || `repeat(${(t == null ? void 0 : t.cols) || 2}, 1fr)`,
489
423
  gridTemplateRows: (t == null ? void 0 : t.rowTemplate) || `repeat(${(t == null ? void 0 : t.rows) || 2}, 1fr)`,
490
424
  gap: "4px",
491
- width: o.width || "100%",
492
- height: o.height || "100%"
425
+ width: e.width || "100%",
426
+ height: e.height || "100%"
493
427
  };
494
- }), J = S(() => ({
495
- width: o.width || "100%",
496
- height: o.height || "100%"
428
+ }), J = g(() => ({
429
+ width: e.width || "100%",
430
+ height: e.height || "100%"
497
431
  }));
498
432
  function K(t) {
499
- const e = t, a = N.value[e];
500
- if (Array.isArray(o.placeholders) && o.placeholders[a] !== void 0)
501
- return String(o.placeholders[a]);
502
- if (typeof o.placeholderText == "function")
433
+ const o = t, a = M.value[o];
434
+ if (Array.isArray(e.placeholders) && e.placeholders[a] !== void 0)
435
+ return String(e.placeholders[a]);
436
+ if (typeof e.placeholderText == "function")
503
437
  try {
504
- return o.placeholderText(e);
438
+ return e.placeholderText(o);
505
439
  } catch {
506
- return String(e + 1);
440
+ return String(o + 1);
507
441
  }
508
- return o.placeholderText ? String(o.placeholderText) : String(e + 1);
442
+ return e.placeholderText ? String(e.placeholderText) : String(o + 1);
509
443
  }
510
444
  function Q(t) {
511
- const e = x.value[t];
512
- return !e || typeof e.col != "number" || typeof e.row != "number" ? {} : {
513
- gridColumn: `${e.col} / span ${e.colSpan}`,
514
- gridRow: `${e.row} / span ${e.rowSpan}`
445
+ const o = x.value[t];
446
+ return !o || typeof o.col != "number" || typeof o.row != "number" ? {} : {
447
+ gridColumn: `${o.col} / span ${o.colSpan}`,
448
+ gridRow: `${o.row} / span ${o.rowSpan}`
515
449
  };
516
450
  }
517
451
  function W(t) {
518
- const e = x.value[t];
519
- return (e == null ? void 0 : e.isMain) || !1;
452
+ const o = x.value[t];
453
+ return (o == null ? void 0 : o.isMain) || !1;
520
454
  }
521
455
  function Z(t) {
522
- l.value = t, p("layoutChange", l.value);
456
+ u.value = t, f("layoutChange", u.value);
523
457
  }
524
- function _() {
525
- if (A.value && document.body.contains(A.value)) {
458
+ function $() {
459
+ if (D.value && document.body.contains(D.value)) {
526
460
  try {
527
- document.body.removeChild(A.value);
461
+ document.body.removeChild(D.value);
528
462
  } catch (t) {
529
463
  console.warn("[VideoGridLayout] Failed to cleanup drag image:", t);
530
464
  }
531
- A.value = null;
465
+ D.value = null;
532
466
  }
533
- if (w.value && document.body.contains(w.value)) {
467
+ if (h.value && document.body.contains(h.value)) {
534
468
  try {
535
- document.body.removeChild(w.value);
469
+ document.body.removeChild(h.value);
536
470
  } catch {
537
471
  }
538
- w.value = null;
472
+ h.value = null;
539
473
  }
540
474
  b && (document.removeEventListener("mousemove", b), b = null);
541
475
  }
542
- function tt(t, e) {
543
- if (e < 0 || e >= y.value.length) {
544
- console.warn("[VideoGridLayout] Invalid drag index:", e);
476
+ function tt(t, o) {
477
+ if (o < 0 || o >= v.value.length) {
478
+ console.warn("[VideoGridLayout] Invalid drag index:", o);
545
479
  return;
546
480
  }
547
- if (v.value = e, !t.dataTransfer) return;
481
+ if (p.value = o, !t.dataTransfer) return;
548
482
  t.dataTransfer.effectAllowed = "move";
549
483
  const r = t.target.closest(".video-item");
550
484
  if (r)
551
485
  try {
552
- if (_(), t.dataTransfer) {
553
- const i = new Image();
554
- i.src = "", t.dataTransfer.setDragImage(i, 0, 0);
486
+ if ($(), t.dataTransfer) {
487
+ const c = new Image();
488
+ c.src = "", t.dataTransfer.setDragImage(c, 0, 0);
555
489
  }
556
- const c = r.cloneNode(!0);
557
- c.style.position = "fixed", c.style.top = "0px", c.style.left = "0px", c.style.margin = "0", c.style.pointerEvents = "none", c.style.opacity = Mt, c.style.transform = "translate(-50%,-50%)", c.style.zIndex = "9999", c.classList.add("drag-preview"), o.dragAnimation && o.dragAnimation !== "none" && c.classList.add(o.dragAnimation), document.body.appendChild(c), w.value = c, b = (i) => {
558
- w.value && (w.value.style.left = `${i.clientX}px`, w.value.style.top = `${i.clientY}px`);
490
+ const n = r.cloneNode(!0);
491
+ n.style.position = "fixed", n.style.top = "0px", n.style.left = "0px", n.style.margin = "0", n.style.pointerEvents = "none", n.style.opacity = Tt, n.style.transform = "translate(-50%,-50%)", n.style.zIndex = "9999", n.classList.add("drag-preview"), e.dragAnimation && e.dragAnimation !== "none" && n.classList.add(e.dragAnimation), document.body.appendChild(n), h.value = n, b = (c) => {
492
+ h.value && (h.value.style.left = `${c.clientX}px`, h.value.style.top = `${c.clientY}px`);
559
493
  }, document.addEventListener("mousemove", b), r.style.opacity = String(Et), r.style.cursor = Gt;
560
- } catch (c) {
561
- console.error("[VideoGridLayout] Drag start error:", c), _();
494
+ } catch (n) {
495
+ console.error("[VideoGridLayout] Drag start error:", n), $();
562
496
  }
563
497
  }
564
- function ot(t, e) {
498
+ function et(t, o) {
565
499
  t.preventDefault(), t.stopPropagation();
566
- const a = v.value;
567
- if (a === -1 || a === e) {
568
- v.value = -1;
500
+ const a = p.value;
501
+ if (a === -1 || a === o) {
502
+ p.value = -1;
569
503
  return;
570
504
  }
571
- if (e < 0 || e >= x.value.length) {
572
- console.warn("[VideoGridLayout] Invalid drop index:", e), v.value = -1;
505
+ if (o < 0 || o >= x.value.length) {
506
+ console.warn("[VideoGridLayout] Invalid drop index:", o), p.value = -1;
573
507
  return;
574
508
  }
575
509
  try {
576
- const r = [...y.value], c = r[a], i = r[e];
577
- r[a] = i, r[e] = c, I = !0, y.value = r, setTimeout(() => {
578
- I = !1, p("videosChange", y.value.filter(Boolean));
510
+ const r = [...v.value], n = r[a], c = r[o];
511
+ r[a] = c, r[o] = n, _ = !0, v.value = r, setTimeout(() => {
512
+ _ = !1, f("videosChange", v.value.filter(Boolean));
579
513
  }, 0);
580
514
  } catch (r) {
581
515
  console.error("[VideoGridLayout] Drop error:", r);
582
516
  } finally {
583
- v.value = -1;
517
+ p.value = -1;
584
518
  }
585
519
  }
586
- function et(t, e) {
587
- if (t.preventDefault(), v.value !== -1 && v.value !== e) {
588
- m.value = e;
520
+ function ot(t, o) {
521
+ if (t.preventDefault(), p.value !== -1 && p.value !== o) {
522
+ m.value = o;
589
523
  try {
590
524
  const r = (t.currentTarget || t.target).getBoundingClientRect();
591
- w.value && (w.value.style.width = `${r.width}px`, w.value.style.height = `${r.height}px`, w.value.style.transform = "translate(-50%,-50%)");
525
+ h.value && (h.value.style.width = `${r.width}px`, h.value.style.height = `${r.height}px`, h.value.style.transform = "translate(-50%,-50%)");
592
526
  } catch {
593
527
  }
594
528
  }
595
529
  }
596
- function rt(t, e) {
530
+ function rt(t, o) {
597
531
  t.preventDefault();
598
532
  const a = t.target, r = t.relatedTarget;
599
- a.contains(r) || m.value === e && (m.value = -1);
533
+ a.contains(r) || m.value === o && (m.value = -1);
600
534
  }
601
535
  function at(t) {
602
536
  const a = t.target.closest(".video-item");
603
- a && (a.style.opacity = "1", a.style.cursor = "move"), _(), v.value = -1, m.value = -1;
537
+ a && (a.style.opacity = "1", a.style.cursor = "move"), $(), p.value = -1, m.value = -1;
604
538
  }
605
539
  return nt(() => {
606
- _();
607
- }), (t, e) => (d(), s("div", {
540
+ $();
541
+ }), (t, o) => (d(), i("div", {
608
542
  class: "video-grid-layout",
609
543
  role: "application",
610
544
  "aria-label": "视频分屏布局",
611
545
  style: G(J.value)
612
546
  }, [
613
- n.showToolbar ? (d(), s("div", Lt, [
614
- e[1] || (e[1] = h("div", { class: "toolbar-title" }, "分屏布局", -1)),
615
- h("div", At, [
616
- (d(!0), s(R, null, P(X.value, (a) => {
617
- var r, c, i;
618
- return d(), s("button", {
547
+ l.showToolbar ? (d(), i("div", Lt, [
548
+ o[1] || (o[1] = s("div", { class: "toolbar-title" }, "分屏布局", -1)),
549
+ s("div", Dt, [
550
+ (d(!0), i(R, null, P(X.value, (a) => {
551
+ var r, n, c;
552
+ return d(), i("button", {
619
553
  key: a,
620
- class: F(["layout-btn", { active: l.value === a }]),
621
- onClick: (g) => Z(a),
622
- title: ((r = M(C)[a]) == null ? void 0 : r.label) || "",
623
- "aria-label": `切换到${((c = M(C)[a]) == null ? void 0 : c.label) || ""}布局`,
624
- "aria-pressed": l.value === a,
554
+ class: F(["layout-btn", { active: u.value === a }]),
555
+ onClick: (y) => Z(a),
556
+ title: ((r = T(C)[a]) == null ? void 0 : r.label) || "",
557
+ "aria-label": `切换到${((n = T(C)[a]) == null ? void 0 : n.label) || ""}布局`,
558
+ "aria-pressed": u.value === a,
625
559
  type: "button"
626
560
  }, [
627
561
  ct(H, { type: a }, null, 8, ["type"]),
628
- h("span", Dt, U(((i = M(C)[a]) == null ? void 0 : i.label) || ""), 1)
629
- ], 10, _t);
562
+ s("span", At, U(((c = T(C)[a]) == null ? void 0 : c.label) || ""), 1)
563
+ ], 10, $t);
630
564
  }), 128))
631
565
  ])
632
566
  ])) : z("", !0),
633
- h("div", $t, [
634
- h("div", {
567
+ s("div", It, [
568
+ s("div", {
635
569
  class: "video-grid",
636
570
  style: G(q.value)
637
571
  }, [
638
- (d(!0), s(R, null, P(x.value, (a, r) => {
639
- var c, i, g;
640
- return d(), s("div", {
641
- key: ((c = L.value[r]) == null ? void 0 : c.id) ?? r,
572
+ (d(!0), i(R, null, P(x.value, (a, r) => {
573
+ var n, c, y;
574
+ return d(), i("div", {
575
+ key: ((n = L.value[r]) == null ? void 0 : n.id) ?? r,
642
576
  class: F(["video-item", {
643
577
  "main-video": W(r),
644
- dragging: v.value === r,
645
- "drag-over": m.value === r && v.value !== r
578
+ dragging: p.value === r,
579
+ "drag-over": m.value === r && p.value !== r
646
580
  }]),
647
581
  style: G(Q(r)),
648
582
  draggable: !0,
649
- "aria-label": `视频 ${r + 1}: ${((i = L.value[r]) == null ? void 0 : i.title) || ((g = L.value[r]) == null ? void 0 : g.id) || ""}`,
583
+ "aria-label": `视频 ${r + 1}: ${((c = L.value[r]) == null ? void 0 : c.title) || ((y = L.value[r]) == null ? void 0 : y.id) || ""}`,
650
584
  role: "article",
651
585
  tabindex: "0",
652
- onDragstart: (u) => tt(u, r),
653
- onDragover: e[0] || (e[0] = it(() => {
586
+ onDragstart: (w) => tt(w, r),
587
+ onDragover: o[0] || (o[0] = it(() => {
654
588
  }, ["prevent"])),
655
- onDragenter: (u) => et(u, r),
656
- onDragleave: (u) => rt(u, r),
657
- onDrop: (u) => ot(u, r),
589
+ onDragenter: (w) => ot(w, r),
590
+ onDragleave: (w) => rt(w, r),
591
+ onDrop: (w) => et(w, r),
658
592
  onDragend: at
659
593
  }, [
660
- st(t.$slots, "video", {
594
+ dt(t.$slots, "video", {
661
595
  video: L.value[r],
662
596
  index: r
663
597
  }, () => [
664
- h("div", Bt, [
665
- h("div", Vt, U(K(N.value.indexOf(r))), 1)
598
+ s("div", Bt, [
599
+ s("div", Vt, U(K(M.value.indexOf(r))), 1)
666
600
  ])
667
601
  ], !0)
668
- ], 46, It);
602
+ ], 46, _t);
669
603
  }), 128))
670
604
  ], 4)
671
605
  ])
672
606
  ], 4));
673
607
  }
674
- }), Ot = /* @__PURE__ */ j(Tt, [["__scopeId", "data-v-4813a92a"]]), Nt = {
675
- VideoGridLayout: Ot,
608
+ }), Nt = /* @__PURE__ */ j(Ot, [["__scopeId", "data-v-4813a92a"]]), Mt = {
609
+ VideoGridLayout: Nt,
676
610
  VideoLayoutIcon: H
677
611
  }, Pt = {
678
- install(n) {
679
- Object.entries(Nt).forEach(([k, o]) => {
680
- n.component(k, o);
612
+ install(l) {
613
+ Object.entries(Mt).forEach(([k, e]) => {
614
+ l.component(k, e);
681
615
  });
682
616
  }
683
617
  };
684
618
  export {
685
619
  C as LAYOUT_CONFIGS,
686
- Ot as VideoGridLayout,
620
+ Nt as VideoGridLayout,
687
621
  H as VideoLayoutIcon,
688
622
  Pt as default,
689
623
  ht as getAllLayoutTypes,
690
- dt as getLayoutPositions
624
+ st as getLayoutPositions
691
625
  };
package/dist/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * 布局类型定义
3
- * 支持的分屏数量:1/2/3/4/6/7/8/9/10/13/16/24/32/36/48/64
3
+ * 支持的分屏数量:1/2/3/4/6/7/8/9/10/13/16
4
4
  */
5
- export type LayoutType = '1' | '2' | '3' | '4' | '6' | '7' | '8' | '9' | '10' | '13' | '16' | '24' | '32' | '36' | '48' | '64';
5
+ export type LayoutType = '1' | '2' | '3' | '4' | '6' | '7' | '8' | '9' | '10' | '13' | '16';
6
6
  /**
7
7
  * 视频项基础接口
8
8
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "video-split-screen",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Vue 3 视频分屏组件(VideoSplitScreen)",
5
5
  "keywords": [
6
6
  "vue",