@maudecode/cove 2026.3.2 → 2026.3.13

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.
@@ -1,4 +1,4 @@
1
- import{c as q,A as W,q as $,y as j,i as c,p as k,a as T,H as B,D as A,d as s,b as L,e as Y,M as R,f as G,g as X,h as J,j as ie,k as ce,l as Q,m as V,n as Z,o as ee,r as m,s as ue,t as de,u as ve,v as he,w as t,x as E,I as _,E as te,X as ne,C as ae,z as me,B as oe,F as fe,G as pe,J as we,K as xe,L as re}from"./index-DCS3gRo6.js";const ge=q("grip-horizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);const be=q("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);const ye=q("picture-in-picture-2",[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]);function Me(){const I=W(!1),a=W(!1),d=W({x:0,y:0,panelX:0,panelY:0}),l=W({x:0,y:0,width:0,height:0,panelX:0,panelY:0}),P=W(""),O=$(r=>{if(r.target.closest("button"))return;r.preventDefault(),I.current=!0,X.value=!0;const u=J(r);d.current={x:u.x,y:u.y,panelX:k.value,panelY:T.value},document.body.style.cursor="grabbing",document.body.style.userSelect="none"},[]),U=$((r,u)=>{r.preventDefault(),"stopPropagation"in r&&r.stopPropagation(),a.current=!0,X.value=!0,P.current=u;const v=J(r);l.current={x:v.x,y:v.y,width:L.value,height:Y.value,panelX:k.value,panelY:T.value};const z={n:"n-resize",s:"s-resize",e:"e-resize",w:"w-resize",ne:"ne-resize",nw:"nw-resize",se:"se-resize",sw:"sw-resize"};document.body.style.cursor=z[u]||"nwse-resize",document.body.style.userSelect="none"},[]),K=$(r=>{r.preventDefault(),a.current=!0,X.value=!0,l.current={x:r.clientX,y:r.clientY,width:L.value,height:Y.value,panelX:k.value,panelY:T.value},document.body.style.userSelect="none";const u=window.innerWidth*ie,v=window.innerHeight*ce,z=S=>{if(s.value==="left"){const n=S.clientX-l.current.x;L.value=Math.min(u,Math.max(R,l.current.width+n))}else if(s.value==="right"){const n=l.current.x-S.clientX;L.value=Math.min(u,Math.max(R,l.current.width+n))}else if(s.value==="top"){const n=S.clientY-l.current.y;Y.value=Math.min(v,Math.max(G,l.current.height+n))}},H=()=>{a.current=!1,X.value=!1,document.body.style.userSelect="",document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",H)};document.addEventListener("mousemove",z),document.addEventListener("mouseup",H)},[]);return j(()=>{const r=(n,f)=>{if(I.current){const b=window.innerWidth,e=window.innerHeight;if(c.value){const o=n-d.current.x,y=f-d.current.y,p=d.current.panelX+o,M=d.current.panelY+y,h=200;k.value=Math.max(0,Math.min(p,b-h)),T.value=Math.max(0,Math.min(M,e-B));return}if(n<A)s.value="left";else if(n>b-A)s.value="right";else if(f<A)s.value="top";else{if(s.value!=="floating")k.value=Math.max(0,Math.min(n-L.value/2,b-L.value)),T.value=Math.max(0,Math.min(f-B/2,e-Y.value)),d.current={x:n,y:f,panelX:k.value,panelY:T.value};else{const o=n-d.current.x,y=f-d.current.y,p=d.current.panelX+o,M=d.current.panelY+y;k.value=Math.max(0,Math.min(p,b-L.value)),T.value=Math.max(0,Math.min(M,e-Y.value))}s.value="floating"}}if(a.current&&s.value==="floating"){const b=P.current,{x:e,y:o,width:y,height:p}=l.current,M=window.innerWidth,h=window.innerHeight;let i=y,D=p,C=l.current.panelX,w=l.current.panelY;if(b.includes("e")&&(i=Math.max(R,y+(n-e))),b.includes("w")){const x=e-n,g=y+x;g>=R&&(i=g,C=l.current.panelX-x)}if(b.includes("s")&&(D=Math.max(G,p+(f-o))),b.includes("n")){const x=o-f,g=p+x;g>=G&&(D=g,w=l.current.panelY-x)}C+i>M&&(i=M-C),w+D>h&&(D=h-w),C<0&&(i+=C,C=0),w<0&&(D+=w,w=0),L.value=Math.max(R,i),Y.value=Math.max(G,D),k.value=Math.max(0,C),T.value=Math.max(0,w)}},u=()=>{(I.current||a.current)&&(I.current=!1,a.current=!1,X.value=!1,document.body.style.cursor="",document.body.style.userSelect="")},v=n=>r(n.clientX,n.clientY),z=n=>{if(n.touches.length===1){const f=n.touches[0];r(f.clientX,f.clientY)}},H=()=>u(),S=()=>u();return document.addEventListener("mousemove",v),document.addEventListener("mouseup",H),document.addEventListener("touchmove",z,{passive:!1}),document.addEventListener("touchend",S),()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",H),document.removeEventListener("touchmove",z),document.removeEventListener("touchend",S)}},[]),{handleDragStart:O,handleResizeStart:U,handleDockedResizeStart:K}}function ze(){if(V.value&&!m.value){if(we.value)return;m.value=!0,c.value=!1}else!V.value&&m.value&&(m.value=!1)}const se=xe(typeof window<"u"&&window.innerWidth<re);typeof window<"u"&&window.addEventListener("resize",()=>{se.value=window.innerWidth<re});const Se=100;function Ee(){const{handleDragStart:I,handleResizeStart:a,handleDockedResizeStart:d}=Me(),[l,P]=Q(0),[O,U]=Q(!1),K=W(0),r=W(null),u=W(null);j(()=>V.subscribe(ze),[]),j(()=>Z.subscribe(e=>{if(!e)return;const{js:o,resolve:y,reject:p}=e;Z.value=null;const M=r.current;if(!M?.contentWindow){p("No iframe available for eval");return}try{const h=M.contentWindow.eval(o);y(h)}catch(h){p(String(h))}}),[]),j(()=>ee.subscribe(e=>{if(!e)return;const{maxWidth:o,quality:y,outputFormat:p,resolve:M,reject:h}=e;ee.value=null;try{const i=u.current;if(i&&i.complete){const w=document.createElement("canvas");let x=i.naturalWidth||i.width||100,g=i.naturalHeight||i.height||100;if(x>o||g>o){const N=o/Math.max(x,g);x=Math.round(x*N),g=Math.round(g*N)}w.width=x,w.height=g;const F=w.getContext("2d");if(F){F.drawImage(i,0,0,x,g);const N=p==="png"?"image/png":"image/jpeg",le=w.toDataURL(N,y);M(le);return}}const D=r.current;if(!D?.contentWindow){h("No canvas content available for snapshot (no img or iframe ref)");return}if(!D.contentDocument){h("Cannot access iframe document (cross-origin?)");return}h("HTML snapshot not yet implemented - use images for now")}catch(i){h(`Snapshot failed: ${i}`)}}),[]),j(()=>{const e=o=>{o.key==="Escape"&&m.value&&(m.value=!1),(o.metaKey||o.ctrlKey)&&o.shiftKey&&o.key==="c"&&(o.preventDefault(),m.value=!m.value)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);const v=ue.value,z=de.value,H=ve.value,S=he.value;if(!m.value)return null;const n=e=>{K.current=e.touches[0].clientY,U(!0)},f=e=>{if(!O)return;const o=e.touches[0].clientY-K.current;P(Math.max(0,o))},b=()=>{U(!1),l>Se&&(m.value=!1),P(0)};return se.value?t("div",{class:`fixed inset-x-0 bottom-0 z-50 bg-[var(--color-bg-surface)] rounded-t-2xl border-t border-[var(--color-border)] shadow-soft-xl flex flex-col ${O?"":"transition-transform duration-200"}`,style:{height:"70vh",maxHeight:"70vh",transform:`translateY(${l}px)`},children:[t("div",{class:"flex flex-col items-center pt-2 pb-1 cursor-grab active:cursor-grabbing touch-none",onTouchStart:n,onTouchMove:f,onTouchEnd:b,children:t("div",{class:"w-10 h-1 bg-[var(--color-border)] rounded-full"})}),t("div",{class:"flex items-center justify-between px-4 py-2 border-b border-[var(--color-border)]",children:[t("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:E("common.canvas")}),t("div",{class:"flex items-center gap-1",children:[v&&t(_,{icon:t(te,{}),label:E("canvas.openUrlInNewTab"),size:"sm",onClick:()=>window.open(v,"_blank")}),t(_,{icon:t(ne,{}),label:E("canvas.close"),size:"sm",onClick:()=>m.value=!1})]})]}),t("div",{class:"flex-1 overflow-hidden",children:t(ae,{url:v,blobUrl:z,contentType:H,content:S,iframeRef:r,imgRef:u})})]}):t("div",{class:`
1
+ import{c as q,A as W,q as $,y as j,i as c,p as k,a as T,H as B,D as A,d as s,b as L,e as Y,M as R,f as G,g as X,h as J,j as ie,k as ce,l as Q,m as V,n as Z,o as ee,r as m,s as ue,t as de,u as ve,v as he,w as t,x as E,I as _,E as te,X as ne,C as ae,z as me,B as oe,F as fe,G as pe,J as we,K as xe,L as re}from"./index-CdcxDCeP.js";const ge=q("grip-horizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);const be=q("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);const ye=q("picture-in-picture-2",[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]);function Me(){const I=W(!1),a=W(!1),d=W({x:0,y:0,panelX:0,panelY:0}),l=W({x:0,y:0,width:0,height:0,panelX:0,panelY:0}),P=W(""),O=$(r=>{if(r.target.closest("button"))return;r.preventDefault(),I.current=!0,X.value=!0;const u=J(r);d.current={x:u.x,y:u.y,panelX:k.value,panelY:T.value},document.body.style.cursor="grabbing",document.body.style.userSelect="none"},[]),U=$((r,u)=>{r.preventDefault(),"stopPropagation"in r&&r.stopPropagation(),a.current=!0,X.value=!0,P.current=u;const v=J(r);l.current={x:v.x,y:v.y,width:L.value,height:Y.value,panelX:k.value,panelY:T.value};const z={n:"n-resize",s:"s-resize",e:"e-resize",w:"w-resize",ne:"ne-resize",nw:"nw-resize",se:"se-resize",sw:"sw-resize"};document.body.style.cursor=z[u]||"nwse-resize",document.body.style.userSelect="none"},[]),K=$(r=>{r.preventDefault(),a.current=!0,X.value=!0,l.current={x:r.clientX,y:r.clientY,width:L.value,height:Y.value,panelX:k.value,panelY:T.value},document.body.style.userSelect="none";const u=window.innerWidth*ie,v=window.innerHeight*ce,z=S=>{if(s.value==="left"){const n=S.clientX-l.current.x;L.value=Math.min(u,Math.max(R,l.current.width+n))}else if(s.value==="right"){const n=l.current.x-S.clientX;L.value=Math.min(u,Math.max(R,l.current.width+n))}else if(s.value==="top"){const n=S.clientY-l.current.y;Y.value=Math.min(v,Math.max(G,l.current.height+n))}},H=()=>{a.current=!1,X.value=!1,document.body.style.userSelect="",document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",H)};document.addEventListener("mousemove",z),document.addEventListener("mouseup",H)},[]);return j(()=>{const r=(n,f)=>{if(I.current){const b=window.innerWidth,e=window.innerHeight;if(c.value){const o=n-d.current.x,y=f-d.current.y,p=d.current.panelX+o,M=d.current.panelY+y,h=200;k.value=Math.max(0,Math.min(p,b-h)),T.value=Math.max(0,Math.min(M,e-B));return}if(n<A)s.value="left";else if(n>b-A)s.value="right";else if(f<A)s.value="top";else{if(s.value!=="floating")k.value=Math.max(0,Math.min(n-L.value/2,b-L.value)),T.value=Math.max(0,Math.min(f-B/2,e-Y.value)),d.current={x:n,y:f,panelX:k.value,panelY:T.value};else{const o=n-d.current.x,y=f-d.current.y,p=d.current.panelX+o,M=d.current.panelY+y;k.value=Math.max(0,Math.min(p,b-L.value)),T.value=Math.max(0,Math.min(M,e-Y.value))}s.value="floating"}}if(a.current&&s.value==="floating"){const b=P.current,{x:e,y:o,width:y,height:p}=l.current,M=window.innerWidth,h=window.innerHeight;let i=y,D=p,C=l.current.panelX,w=l.current.panelY;if(b.includes("e")&&(i=Math.max(R,y+(n-e))),b.includes("w")){const x=e-n,g=y+x;g>=R&&(i=g,C=l.current.panelX-x)}if(b.includes("s")&&(D=Math.max(G,p+(f-o))),b.includes("n")){const x=o-f,g=p+x;g>=G&&(D=g,w=l.current.panelY-x)}C+i>M&&(i=M-C),w+D>h&&(D=h-w),C<0&&(i+=C,C=0),w<0&&(D+=w,w=0),L.value=Math.max(R,i),Y.value=Math.max(G,D),k.value=Math.max(0,C),T.value=Math.max(0,w)}},u=()=>{(I.current||a.current)&&(I.current=!1,a.current=!1,X.value=!1,document.body.style.cursor="",document.body.style.userSelect="")},v=n=>r(n.clientX,n.clientY),z=n=>{if(n.touches.length===1){const f=n.touches[0];r(f.clientX,f.clientY)}},H=()=>u(),S=()=>u();return document.addEventListener("mousemove",v),document.addEventListener("mouseup",H),document.addEventListener("touchmove",z,{passive:!1}),document.addEventListener("touchend",S),()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",H),document.removeEventListener("touchmove",z),document.removeEventListener("touchend",S)}},[]),{handleDragStart:O,handleResizeStart:U,handleDockedResizeStart:K}}function ze(){if(V.value&&!m.value){if(we.value)return;m.value=!0,c.value=!1}else!V.value&&m.value&&(m.value=!1)}const se=xe(typeof window<"u"&&window.innerWidth<re);typeof window<"u"&&window.addEventListener("resize",()=>{se.value=window.innerWidth<re});const Se=100;function Ee(){const{handleDragStart:I,handleResizeStart:a,handleDockedResizeStart:d}=Me(),[l,P]=Q(0),[O,U]=Q(!1),K=W(0),r=W(null),u=W(null);j(()=>V.subscribe(ze),[]),j(()=>Z.subscribe(e=>{if(!e)return;const{js:o,resolve:y,reject:p}=e;Z.value=null;const M=r.current;if(!M?.contentWindow){p("No iframe available for eval");return}try{const h=M.contentWindow.eval(o);y(h)}catch(h){p(String(h))}}),[]),j(()=>ee.subscribe(e=>{if(!e)return;const{maxWidth:o,quality:y,outputFormat:p,resolve:M,reject:h}=e;ee.value=null;try{const i=u.current;if(i&&i.complete){const w=document.createElement("canvas");let x=i.naturalWidth||i.width||100,g=i.naturalHeight||i.height||100;if(x>o||g>o){const N=o/Math.max(x,g);x=Math.round(x*N),g=Math.round(g*N)}w.width=x,w.height=g;const F=w.getContext("2d");if(F){F.drawImage(i,0,0,x,g);const N=p==="png"?"image/png":"image/jpeg",le=w.toDataURL(N,y);M(le);return}}const D=r.current;if(!D?.contentWindow){h("No canvas content available for snapshot (no img or iframe ref)");return}if(!D.contentDocument){h("Cannot access iframe document (cross-origin?)");return}h("HTML snapshot not yet implemented - use images for now")}catch(i){h(`Snapshot failed: ${i}`)}}),[]),j(()=>{const e=o=>{o.key==="Escape"&&m.value&&(m.value=!1),(o.metaKey||o.ctrlKey)&&o.shiftKey&&o.key==="c"&&(o.preventDefault(),m.value=!m.value)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]);const v=ue.value,z=de.value,H=ve.value,S=he.value;if(!m.value)return null;const n=e=>{K.current=e.touches[0].clientY,U(!0)},f=e=>{if(!O)return;const o=e.touches[0].clientY-K.current;P(Math.max(0,o))},b=()=>{U(!1),l>Se&&(m.value=!1),P(0)};return se.value?t("div",{class:`fixed inset-x-0 bottom-0 z-50 bg-[var(--color-bg-surface)] rounded-t-2xl border-t border-[var(--color-border)] shadow-soft-xl flex flex-col ${O?"":"transition-transform duration-200"}`,style:{height:"70vh",maxHeight:"70vh",transform:`translateY(${l}px)`},children:[t("div",{class:"flex flex-col items-center pt-2 pb-1 cursor-grab active:cursor-grabbing touch-none",onTouchStart:n,onTouchMove:f,onTouchEnd:b,children:t("div",{class:"w-10 h-1 bg-[var(--color-border)] rounded-full"})}),t("div",{class:"flex items-center justify-between px-4 py-2 border-b border-[var(--color-border)]",children:[t("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:E("common.canvas")}),t("div",{class:"flex items-center gap-1",children:[v&&t(_,{icon:t(te,{}),label:E("canvas.openUrlInNewTab"),size:"sm",onClick:()=>window.open(v,"_blank")}),t(_,{icon:t(ne,{}),label:E("canvas.close"),size:"sm",onClick:()=>m.value=!1})]})]}),t("div",{class:"flex-1 overflow-hidden",children:t(ae,{url:v,blobUrl:z,contentType:H,content:S,iframeRef:r,imgRef:u})})]}):t("div",{class:`
2
2
  fixed z-50
3
3
  bg-[var(--color-bg-surface)]
4
4
  shadow-soft-xl