@zhin.js/adapter-sandbox 5.0.1 → 5.0.3
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/CHANGELOG.md +18 -0
- package/dist/index.js +5 -5
- package/lib/sandbox-ws.d.ts +1 -1
- package/lib/sandbox-ws.d.ts.map +1 -1
- package/lib/sandbox-ws.js +4 -1
- package/lib/sandbox-ws.js.map +1 -1
- package/package.json +10 -10
- package/src/sandbox-ws.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @zhin.js/adapter-process
|
|
2
2
|
|
|
3
|
+
## 5.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c4575c9: fix: 输入输出优化,文档优化
|
|
8
|
+
- Updated dependencies [c4575c9]
|
|
9
|
+
- Updated dependencies [c4575c9]
|
|
10
|
+
- @zhin.js/host-router@2.0.1
|
|
11
|
+
- @zhin.js/host-api@2.0.3
|
|
12
|
+
- @zhin.js/core@1.3.2
|
|
13
|
+
|
|
14
|
+
## 5.0.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [384ea11]
|
|
19
|
+
- @zhin.js/host-api@2.0.2
|
|
20
|
+
|
|
3
21
|
## 5.0.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import ze,{useState as g,useEffect as Ie,useRef as we}from"react";import{cn as A,resolveMediaSrc as Pe,pickMediaRawUrl as ye}from"@zhin.js/client";function ta(){let i=localStorage.getItem("zhin_api_base")?.trim();return(i?i.replace(/\/$/,""):null)??window.location.origin}function oa(){return localStorage.getItem("zhin_api_token")?.trim()||localStorage.getItem("HTTP_TOKEN")?.trim()||localStorage.getItem("zhin_http_token")?.trim()||""}function Te(i){let p=(i??ta()).replace(/\/$/,""),I=new URL("/sandbox",`${p}/`);I.protocol=I.protocol==="https:"?"wss:":"ws:";let L=oa();return L&&I.searchParams.set("token",L),I.href}import{forwardRef as sa,createElement as fa}from"react";var Le=(...i)=>i.filter((p,I,L)=>!!p&&p.trim()!==""&&L.indexOf(p)===I).join(" ").trim();var qe=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var Ue=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(p,I,L)=>L?L.toUpperCase():I.toLowerCase());var ke=i=>{let p=Ue(i);return p.charAt(0).toUpperCase()+p.slice(1)};import{forwardRef as ra,createElement as Ne}from"react";var xe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var
|
|
2
|
-
`)}return{text:d,segments:t}},U=d=>{if(!m.current)return;let t=document.createElement("img");t.src=`https://face.viki.moe/apng/${d}.png`,t.alt=`[face:${d}]`,t.dataset.type="face",t.dataset.id=String(d),t.className="editor-face",M(t),R()},_=d=>{if(!m.current||!d.trim())return;let t=document.createElement("img");t.src=d.trim(),t.alt=`[image:${d.trim()}]`,t.dataset.type="image",t.dataset.url=d.trim(),t.className="editor-image",M(t),R()},E=d=>{if(!m.current||!d.trim())return;let t=d.trim(),u=document.createElement("span");u.className="editor-video",u.dataset.url=t,u.contentEditable="false",u.textContent="\u{1F4F9} \u89C6\u9891",M(u),R()},G=d=>{if(!m.current||!d.trim())return;let t=d.trim(),u=document.createElement("span");u.className="editor-audio",u.dataset.url=t,u.contentEditable="false",u.textContent="\u{1F3B5} \u97F3\u9891",M(u),R()},
|
|
3
|
-
`)){L(!1,""),k.current=null;return}k.current=c;let V=document.createRange();V.setStart(c,n),V.setEnd(c,n+1);let v=V.getBoundingClientRect(),b=m.current.getBoundingClientRect();L(!0,y,{top:v.bottom-b.top,left:v.left-b.left})}else L(!1,""),k.current=null},R=()=>{if(me(),I){let{text:d,segments:t}=B();I(d,t)}},Ce=(d,t)=>{if(!k.current)return;let u=k.current,c=u.textContent||"",l=c.lastIndexOf("@");if(l!==-1){let n=c.substring(l+1),y=l+1+n.split(/[\s\n]/)[0].length,V=c.substring(0,l),v=c.substring(y);u.textContent=V+v;let b=window.getSelection();if(b){let T=document.createRange();T.setStart(u,l),T.collapse(!0),b.removeAllRanges(),b.addRange(T)}}k.current=null,
|
|
1
|
+
import ze,{useState as g,useEffect as Ie,useRef as we}from"react";import{cn as A,resolveMediaSrc as Pe,pickMediaRawUrl as ye}from"@zhin.js/client";function ta(){let i=localStorage.getItem("zhin_api_base")?.trim();return(i?i.replace(/\/$/,""):null)??window.location.origin}function oa(){return localStorage.getItem("zhin_api_token")?.trim()||localStorage.getItem("HTTP_TOKEN")?.trim()||localStorage.getItem("zhin_http_token")?.trim()||""}function Te(i){let p=(i??ta()).replace(/\/$/,""),I=new URL("/sandbox",`${p}/`);I.protocol=I.protocol==="https:"?"wss:":"ws:";let L=oa();return L&&I.searchParams.set("token",L),I.href}import{forwardRef as sa,createElement as fa}from"react";var Le=(...i)=>i.filter((p,I,L)=>!!p&&p.trim()!==""&&L.indexOf(p)===I).join(" ").trim();var qe=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var Ue=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(p,I,L)=>L?L.toUpperCase():I.toLowerCase());var ke=i=>{let p=Ue(i);return p.charAt(0).toUpperCase()+p.slice(1)};import{forwardRef as ra,createElement as Ne}from"react";var xe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var Oe=i=>{for(let p in i)if(p.startsWith("aria-")||p==="role"||p==="title")return!0;return!1};import{createContext as da,useContext as ua,useMemo as Va,createElement as za}from"react";var la=da({});var He=()=>ua(la);var Ee=ra(({color:i,size:p,strokeWidth:I,absoluteStrokeWidth:L,className:N="",children:D,iconNode:h,...m},k)=>{let{size:B=24,strokeWidth:U=2,absoluteStrokeWidth:_=!1,color:E="currentColor",className:G=""}=He()??{},O=L??_?Number(I??U)*24/Number(p??B):I??U;return Ne("svg",{ref:k,...xe,width:p??B??xe.width,height:p??B??xe.height,stroke:i??E,strokeWidth:O,className:Le("lucide",G,N),...!D&&!Oe(m)&&{"aria-hidden":"true"},...m},[...h.map(([M,w])=>Ne(M,w)),...Array.isArray(D)?D:[D]])});var r=(i,p)=>{let I=sa(({className:L,...N},D)=>fa(Ee,{ref:D,iconNode:p,className:Le(`lucide-${qe(ke(i))}`,`lucide-${i}`,L),...N}));return I.displayName=ke(i),I};var ia=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],X=r("bell",ia);var ca=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ee=r("bot",ca);var na=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ae=r("check",na);var pa=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],te=r("hash",pa);var ma=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],oe=r("image",ma);var La=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],de=r("info",La);var xa=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],H=r("message-square",xa);var Ia=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],ue=r("music",Ia);var Ca=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],j=r("search",Ca);var ga=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],le=r("send",ga);var ha=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],re=r("smile",ha);var Sa=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],se=r("trash-2",Sa);var ka=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],K=r("user-plus",ka);var wa=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Z=r("user",wa);var Pa=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],fe=r("users",Pa);var ya=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ie=r("video",ya);var Aa=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ce=r("wifi-off",Aa);var Ma=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],ne=r("wifi",Ma);var Ba=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],pe=r("x",Ba);import{useRef as Ge,forwardRef as Fa,useImperativeHandle as Da}from"react";import{jsx as ba}from"react/jsx-runtime";var We=Fa(({placeholder:i="\u8F93\u5165\u6D88\u606F...",onSend:p,onChange:I,onAtTrigger:L,minHeight:N="44px",maxHeight:D="200px"},h)=>{let m=Ge(null),k=Ge(null),B=()=>{if(!m.current)return{text:"",segments:[]};let d="",t=[],u=Array.from(m.current.childNodes);for(let c of u)if(c.nodeType===Node.TEXT_NODE){let l=c.textContent||"";l&&(d+=l,t.push({type:"text",data:{text:l}}))}else if(c.nodeType===Node.ELEMENT_NODE){let l=c;if(l.classList.contains("editor-face")){let n=l.dataset.id;d+=`[face:${n}]`,t.push({type:"face",data:{id:Number(n)}})}else if(l.classList.contains("editor-image")){let n=l.dataset.url;d+=`[image:${n}]`,t.push({type:"image",data:{url:n}})}else if(l.classList.contains("editor-video")){let n=l.dataset.url||"";d+=`[video:${n}]`,t.push({type:"video",data:{url:n}})}else if(l.classList.contains("editor-audio")){let n=l.dataset.url||"";d+=`[audio:${n}]`,t.push({type:"audio",data:{url:n}})}else if(l.classList.contains("editor-at")){let n=l.dataset.name,y=l.dataset.id;d+=`[@${n}]`,t.push({type:"at",data:{name:n,qq:y}})}else l.tagName==="BR"&&(d+=`
|
|
2
|
+
`)}return{text:d,segments:t}},U=d=>{if(!m.current)return;let t=document.createElement("img");t.src=`https://face.viki.moe/apng/${d}.png`,t.alt=`[face:${d}]`,t.dataset.type="face",t.dataset.id=String(d),t.className="editor-face",M(t),R()},_=d=>{if(!m.current||!d.trim())return;let t=document.createElement("img");t.src=d.trim(),t.alt=`[image:${d.trim()}]`,t.dataset.type="image",t.dataset.url=d.trim(),t.className="editor-image",M(t),R()},E=d=>{if(!m.current||!d.trim())return;let t=d.trim(),u=document.createElement("span");u.className="editor-video",u.dataset.url=t,u.contentEditable="false",u.textContent="\u{1F4F9} \u89C6\u9891",M(u),R()},G=d=>{if(!m.current||!d.trim())return;let t=d.trim(),u=document.createElement("span");u.className="editor-audio",u.dataset.url=t,u.contentEditable="false",u.textContent="\u{1F3B5} \u97F3\u9891",M(u),R()},O=(d,t)=>{if(!m.current||!d.trim())return;let u=document.createElement("span");u.dataset.type="at",u.dataset.name=d,t&&(u.dataset.id=t),u.className="editor-at",u.contentEditable="false";let c=document.createElement("span");c.textContent="@",c.className="editor-at-symbol";let l=document.createElement("span");l.textContent=d,l.className="editor-at-name",u.appendChild(c),u.appendChild(l),M(u),R()},M=d=>{if(!m.current)return;m.current.focus();let t=window.getSelection();if(t&&t.rangeCount>0){let u=t.getRangeAt(0);if(m.current.contains(u.commonAncestorContainer))u.deleteContents(),u.insertNode(d),u.collapse(!1),t.removeAllRanges(),t.addRange(u);else{m.current.appendChild(d);let l=document.createRange();l.setStartAfter(d),l.collapse(!0),t.removeAllRanges(),t.addRange(l)}}else{m.current.appendChild(d);let u=window.getSelection();if(u){let c=document.createRange();c.setStartAfter(d),c.collapse(!0),u.removeAllRanges(),u.addRange(c)}}},w=()=>{m.current&&(m.current.innerHTML="",R())},W=()=>{m.current?.focus()},$=()=>B(),me=()=>{if(!m.current||!L)return;let d=window.getSelection();if(!d||d.rangeCount===0){L(!1,""),k.current=null;return}let t=d.getRangeAt(0);if(!m.current.contains(t.commonAncestorContainer)){L(!1,""),k.current=null;return}let u=t.startContainer;if(u.nodeType!==Node.TEXT_NODE){L(!1,""),k.current=null;return}let c=u,l=c.textContent?.substring(0,t.startOffset)||"",n=l.lastIndexOf("@");if(n!==-1){let y=l.substring(n+1);if(y.includes(" ")||y.includes(`
|
|
3
|
+
`)){L(!1,""),k.current=null;return}k.current=c;let V=document.createRange();V.setStart(c,n),V.setEnd(c,n+1);let v=V.getBoundingClientRect(),b=m.current.getBoundingClientRect();L(!0,y,{top:v.bottom-b.top,left:v.left-b.left})}else L(!1,""),k.current=null},R=()=>{if(me(),I){let{text:d,segments:t}=B();I(d,t)}},Ce=(d,t)=>{if(!k.current)return;let u=k.current,c=u.textContent||"",l=c.lastIndexOf("@");if(l!==-1){let n=c.substring(l+1),y=l+1+n.split(/[\s\n]/)[0].length,V=c.substring(0,l),v=c.substring(y);u.textContent=V+v;let b=window.getSelection();if(b){let T=document.createRange();T.setStart(u,l),T.collapse(!0),b.removeAllRanges(),b.addRange(T)}}k.current=null,O(d,t)},Y=d=>{d.preventDefault();let t=d.clipboardData,c=Array.from(t.items).find(n=>n.type.startsWith("image/"));if(c){let n=c.getAsFile();if(n){let y=new FileReader;y.onload=()=>{typeof y.result=="string"&&_(y.result)},y.readAsDataURL(n)}return}let l=t.getData("text/plain");l&&(document.execCommand("insertText",!1,l),R())},Q=d=>{if(d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),p)){let{text:t,segments:u}=B();p(t,u)}};return Da(h,()=>({focus:W,clear:w,insertFace:U,insertImage:_,insertVideo:E,insertAudio:G,insertAt:O,replaceAtTrigger:Ce,getContent:$})),ba("div",{ref:m,contentEditable:!0,suppressContentEditableWarning:!0,onInput:R,onKeyDown:Q,onPaste:Y,"data-placeholder":i,className:"rich-text-editor",style:{width:"100%",minHeight:N,maxHeight:D,padding:"0.5rem 0.75rem",border:"1px solid var(--gray-6)",borderRadius:"6px",backgroundColor:"var(--gray-1)",fontSize:"var(--font-size-2)",outline:"none",overflowY:"auto",lineHeight:"1.5",wordWrap:"break-word",color:"var(--gray-12)"}})});We.displayName="RichTextEditor";var Ve=We;import{Fragment as Ra,jsx as a,jsxs as o}from"react/jsx-runtime";function Ae(){let[i,p]=g([]),[I,L]=g([{id:"user_1001",name:"\u6D4B\u8BD5\u7528\u6237",type:"private",unread:0},{id:"group_2001",name:"\u6D4B\u8BD5\u7FA4\u7EC4",type:"group",unread:0},{id:"channel_3001",name:"\u6D4B\u8BD5\u9891\u9053",type:"channel",unread:0}]),[N,D]=g([]),[h,m]=g(I[0]),[k,B]=g(""),[U,_]=g("ProcessEndpoint"),[E,G]=g(!1),[O,M]=g(!1),[w,W]=g(null),[$,me]=g(""),[R,Ce]=g(!1),[Y,Q]=g(null),[d,t]=g(""),[u,c]=g(""),[l,n]=g(""),[y]=g([{id:"10001",name:"\u5F20\u4E09"},{id:"10002",name:"\u674E\u56DB"},{id:"10003",name:"\u738B\u4E94"},{id:"10004",name:"\u8D75\u516D"},{id:"10005",name:"\u6D4B\u8BD5\u7528\u6237"},{id:"10086",name:"Admin"},{id:"10010",name:"Test User"}]),[V,v]=g([]),[b,T]=g(!1),[J,ge]=g("chat"),Me=we(null),z=we(null),q=we(null),Xe=async()=>{try{let e=await fetch("https://face.viki.moe/metadata.json");D(await e.json())}catch(e){console.error("[Sandbox] Failed to fetch face list:",e)}};Ie(()=>{Xe()},[]);let Ke=e=>{let s=typeof e.content=="string"?he(e.content):Array.isArray(e.content)?e.content:he(String(e.content??"")),x=e.type==="private"?`\u79C1\u804A-${e.bot||U}`:e.type==="group"?`\u7FA4\u7EC4-${e.id}`:`\u9891\u9053-${e.id}`,C=e.type;L(f=>{if(f.some(F=>F.id===e.id))return f;let S={id:e.id,name:x,type:C,unread:0};return m(S),[...f,S]}),p(f=>[...f,{id:`bot_${e.timestamp}`,type:"received",channelType:C,channelId:e.id,channelName:x,senderId:"endpoint",senderName:e.bot||U,content:s,timestamp:e.timestamp}])};Ie(()=>{let e=Te();return z.current=new WebSocket(e),z.current.onopen=()=>G(!0),z.current.onmessage=s=>{try{Ke(JSON.parse(s.data))}catch(x){console.error("[Sandbox] Failed to parse message:",x)}},z.current.onclose=()=>G(!1),()=>{z.current?.close(),z.current=null,G(!1)}},[]),Ie(()=>{Me.current?.scrollIntoView({behavior:"smooth"})},[i]),Ie(()=>{v(k.trim()?he(k):[])},[k]);let he=e=>{let s=[],x=/\[@([^\]]+)\]|\[face:(\d+)\]|\[image:([^\]]+)\]|\[video:([^\]]+)\]|\[audio:([^\]]+)\]/g,C=0,f;for(;(f=x.exec(e))!==null;){if(f.index>C){let S=e.substring(C,f.index);S&&s.push({type:"text",data:{text:S}})}f[1]?s.push({type:"at",data:{qq:f[1],name:f[1]}}):f[2]?s.push({type:"face",data:{id:parseInt(f[2],10)}}):f[3]?s.push({type:"image",data:{url:f[3]}}):f[4]?s.push({type:"video",data:{url:f[4]}}):f[5]&&s.push({type:"audio",data:{url:f[5]}}),C=x.lastIndex}if(C<e.length){let S=e.substring(C);S&&s.push({type:"text",data:{text:S}})}return s.length>0?s:[{type:"text",data:{text:e}}]},Be=e=>e.length===0?!1:e.some(s=>s.type==="text"?!!String(s.data?.text??"").trim():!0),Ze=(e,s)=>{let x=s?"ring-1 ring-primary-foreground/25":"ring-1 ring-border/60";return e.map((C,f)=>{if(typeof C=="string")return a("span",{children:C.split(`
|
|
4
4
|
`).map((F,P)=>o(ze.Fragment,{children:[F,P<C.split(`
|
|
5
5
|
`).length-1&&a("br",{})]},P))},f);let S=C.data;switch(C.type){case"text":return a("span",{children:String(S.text??"").split(`
|
|
6
6
|
`).map((F,P)=>o(ze.Fragment,{children:[F,P<String(S.text??"").split(`
|
|
7
|
-
`).length-1&&a("br",{})]},P))},f);case"at":return o("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded bg-accent text-accent-foreground text-xs mx-0.5",children:["@",String(S.name??S.qq??"")]},f);case"face":return a("img",{src:`https://face.viki.moe/apng/${S.id}.png`,alt:"",className:"w-6 h-6 inline-block align-middle mx-0.5"},f);case"image":{let F=ye(S),P=Pe(F,"image");return P?a("a",{href:P,target:"_blank",rel:"noreferrer",className:"block my-1",children:a("img",{src:P,alt:"",className:A("max-w-[min(320px,88vw)] rounded-lg block",x,"ring-offset-0"),onError:aa=>{aa.target.style.display="none"}})},f):a("span",{className:"text-xs opacity-70",children:"[\u56FE\u7247]"},f)}case"video":{let F=ye(S),P=Pe(F,"video");return P?a("video",{src:P,controls:!0,playsInline:!0,preload:"metadata",className:A("max-w-[min(360px,92vw)] max-h-72 rounded-lg my-1 bg-black/10",x)},f):a("span",{className:"text-xs opacity-70",children:"[\u89C6\u9891\u65E0\u5730\u5740]"},f)}case"audio":case"record":{let F=ye(S),P=Pe(F,"audio");return P?a("audio",{src:P,controls:!0,preload:"metadata",className:A("w-full max-w-sm my-2 h-10",s&&"opacity-95")},f):a("span",{className:"text-xs opacity-70",children:"[\u97F3\u9891\u65E0\u5730\u5740]"},f)}case"file":return o("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-xs mx-0.5",children:["\u{1F4CE} ",String(S.name||"\u6587\u4EF6")]},f);default:return o("span",{className:"text-xs opacity-70",children:["[",C.type,"]"]},f)}})},Fe=(e,s)=>{if(!Be(s))return;let x={id:`msg_${Date.now()}`,type:"sent",channelType:h.type,channelId:h.id,channelName:h.name,senderId:"test_user",senderName:"\u6D4B\u8BD5\u7528\u6237",content:s,timestamp:Date.now()};p(f=>[...f,x]),B(""),v([]),q.current?.clear();let C=JSON.stringify({type:h.type,id:h.id,content:s,timestamp:Date.now()});z.current?.send(C)},_e=()=>{confirm("\u786E\u5B9A\u6E05\u7A7A\u6240\u6709\u6D88\u606F\u8BB0\u5F55\uFF1F")&&p([])},Qe=e=>{ge("chat"),m(e),L(s=>s.map(x=>x.id===e.id?{...x,unread:0}:x)),window.innerWidth<768&&T(!1)},Je=()=>{let e=["private","group","channel"],s=e[Math.floor(Math.random()*e.length)],x=prompt("\u8BF7\u8F93\u5165\u9891\u9053\u540D\u79F0\uFF1A");if(x){let C={id:`${s}_${Date.now()}`,name:x,type:s,unread:0};L(f=>[...f,C]),m(C)}},De=e=>{switch(e){case"private":return a(Z,{size:16});case"group":return a(fe,{size:16});case"channel":return a(te,{size:16});default:return a(O,{size:16})}},je=e=>{q.current?.insertFace(e),M(!1)},be=()=>{let e=$.trim();!e||!w||(w==="image"?q.current?.insertImage(e):w==="video"?q.current?.insertVideo(e):q.current?.insertAudio(e),me(""),W(null))},va=()=>{l.trim()&&(q.current?.insertAt(l.trim()),n(""),Ce(!1))},$e=e=>{q.current?.replaceAtTrigger(e.name,e.id),Q(null),t("")},Ye=(e,s,x)=>{if(h.type==="private"){Q(null),t("");return}e&&x?(Q(x),t(s)):(Q(null),t(""))},Re=y.filter(e=>{if(!d.trim())return!0;let s=d.toLowerCase();return e.name.toLowerCase().includes(s)||e.id.toLowerCase().includes(s)}),ea=(e,s)=>{B(e),v(s)},ve=N.filter(e=>e.name.toLowerCase().includes(u.toLowerCase())||e.describe.toLowerCase().includes(u.toLowerCase())),Se=i.filter(e=>e.channelId===h.id);return o("div",{className:"sandbox-container rounded-xl border border-border/70 bg-card/30 shadow-sm",children:[o("button",{className:"mobile-channel-toggle md:hidden",onClick:()=>T(!b),children:[a(O,{size:20})," \u9891\u9053\u5217\u8868"]}),o("div",{className:A("channel-sidebar rounded-lg border bg-card",b&&"show"),children:[a("div",{className:"p-3 border-b",children:o("div",{className:"flex justify-between items-center",children:[o("div",{className:"flex items-center gap-2",children:[a("div",{className:"p-1 rounded-md bg-secondary",children:a(O,{size:16,className:"text-muted-foreground"})}),a("h3",{className:"font-semibold",children:"\u9891\u9053\u5217\u8868"})]}),o("span",{className:A("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border",E?"bg-emerald-100 text-emerald-800 border-emerald-200 dark:bg-emerald-900/30 dark:text-emerald-400 dark:border-emerald-800":"bg-muted text-muted-foreground"),children:[E?a(ne,{size:12}):a(ce,{size:12}),E?"\u5DF2\u8FDE\u63A5":"\u672A\u8FDE\u63A5"]})]})}),o("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:[I.map(e=>{let s=J==="chat"&&h.id===e.id;return o("div",{className:A("menu-item",s&&"active"),onClick:()=>Qe(e),children:[a("span",{className:"shrink-0",children:De(e.type)}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium truncate",children:e.name}),a("div",{className:"text-xs text-muted-foreground",children:e.type==="private"?"\u79C1\u804A":e.type==="group"?"\u7FA4\u804A":"\u9891\u9053"})]}),e.unread>0&&a("span",{className:"inline-flex items-center justify-center h-5 min-w-5 rounded-full bg-destructive text-destructive-foreground text-[10px] font-medium px-1",children:e.unread})]},e.id)}),o("div",{className:"pt-2 mt-2 border-t space-y-1",children:[o("div",{className:A("menu-item",J==="requests"&&"active"),onClick:()=>{ge("requests"),window.innerWidth<768&&T(!1)},children:[a(K,{size:16,className:"shrink-0"}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium",children:"\u8BF7\u6C42"}),a("div",{className:"text-xs text-muted-foreground",children:"\u597D\u53CB/\u7FA4\u9080\u8BF7\u7B49"})]})]}),o("div",{className:A("menu-item",J==="notices"&&"active"),onClick:()=>{ge("notices"),window.innerWidth<768&&T(!1)},children:[a(X,{size:16,className:"shrink-0"}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium",children:"\u901A\u77E5"}),a("div",{className:"text-xs text-muted-foreground",children:"\u7FA4\u7BA1/\u64A4\u56DE\u7B49"})]})]})]})]}),a("div",{className:"p-2 border-t",children:a("button",{className:"w-full py-2 px-3 rounded-md border border-dashed text-sm text-muted-foreground hover:bg-accent transition-colors",onClick:Je,children:"+ \u6DFB\u52A0\u9891\u9053"})})]}),b&&a("div",{className:"channel-overlay md:hidden",onClick:()=>T(!1)}),o("div",{className:"chat-area",children:[J==="requests"&&o("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0 overflow-hidden",children:[a("div",{className:"p-3 border-b flex-shrink-0",children:o("h2",{className:"text-lg font-bold flex items-center gap-2",children:[a(K,{size:20})," \u8BF7\u6C42"]})}),o("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center gap-3 text-muted-foreground text-center",children:[a(K,{size:48,className:"opacity-30"}),a("span",{children:"\u6C99\u76D2\u4E3A\u6A21\u62DF\u73AF\u5883\uFF0C\u6682\u65E0\u8BF7\u6C42\u6570\u636E"}),o("span",{className:"text-sm",children:["\u5B9E\u9645\u597D\u53CB/\u7FA4\u9080\u8BF7\u7B49\u8BF7\u6C42\u8BF7\u5230\u4FA7\u8FB9\u680F ",a("strong",{children:"\u673A\u5668\u4EBA"})," \u9875\u9762\u8FDB\u5165\u5BF9\u5E94\u673A\u5668\u4EBA\u7BA1\u7406\u67E5\u770B"]})]})]}),J==="notices"&&o("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0 overflow-hidden",children:[a("div",{className:"p-3 border-b flex-shrink-0",children:o("h2",{className:"text-lg font-bold flex items-center gap-2",children:[a(X,{size:20})," \u901A\u77E5"]})}),o("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center gap-3 text-muted-foreground text-center",children:[a(X,{size:48,className:"opacity-30"}),a("span",{children:"\u6C99\u76D2\u4E3A\u6A21\u62DF\u73AF\u5883\uFF0C\u6682\u65E0\u901A\u77E5\u6570\u636E"}),o("span",{className:"text-sm",children:["\u5B9E\u9645\u7FA4\u7BA1\u3001\u64A4\u56DE\u7B49\u901A\u77E5\u8BF7\u5230\u4FA7\u8FB9\u680F ",a("strong",{children:"\u673A\u5668\u4EBA"})," \u9875\u9762\u8FDB\u5165\u5BF9\u5E94\u673A\u5668\u4EBA\u7BA1\u7406\u67E5\u770B"]})]})]}),J==="chat"&&o(Ra,{children:[a("div",{className:"rounded-lg border bg-card p-3 flex-shrink-0",children:o("div",{className:"flex justify-between items-center flex-wrap gap-2",children:[o("div",{className:"flex items-center gap-3",children:[a("div",{className:"p-2 rounded-lg bg-secondary",children:De(h.type)}),o("div",{children:[a("h2",{className:"text-lg font-bold",children:h.name}),o("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a("span",{children:h.id}),a("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-[10px]",children:Se.length}),a("span",{children:"\u6761\u6D88\u606F"})]})]}),a("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-secondary text-secondary-foreground",children:h.type==="private"?"\u79C1\u804A":h.type==="group"?"\u7FA4\u804A":"\u9891\u9053"})]}),o("div",{className:"flex items-center gap-2",children:[a("input",{value:U,onChange:e=>_(e.target.value),placeholder:"\u673A\u5668\u4EBA\u540D\u79F0",className:"h-8 w-28 rounded-md border bg-transparent px-2 text-sm"}),o("button",{className:"inline-flex items-center gap-1 h-8 px-3 rounded-md bg-secondary text-secondary-foreground text-sm hover:bg-secondary/80",onClick:_e,children:[a(se,{size:14})," \u6E05\u7A7A"]})]})]})}),a("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0",children:a("div",{className:"flex-1 overflow-y-auto p-4",children:Se.length===0?o("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a(O,{size:64,className:"text-muted-foreground/20"}),a("span",{className:"text-muted-foreground",children:"\u6682\u65E0\u6D88\u606F\uFF0C\u5F00\u59CB\u5BF9\u8BDD\u5427\uFF01"})]}):o("div",{className:"space-y-2",children:[Se.map(e=>a("div",{className:A("flex",e.type==="sent"?"justify-end":"justify-start"),children:o("div",{className:A("max-w-[70%] p-3 rounded-2xl",e.type==="sent"?"bg-primary text-primary-foreground":"bg-muted"),children:[o("div",{className:"flex items-center gap-2 mb-1",children:[e.type==="received"&&a(ee,{size:14}),e.type==="sent"&&a(Z,{size:14}),a("span",{className:"text-xs font-medium opacity-90",children:e.senderName}),a("span",{className:"text-xs opacity-70",children:new Date(e.timestamp).toLocaleTimeString()})]}),a("div",{className:"text-sm space-y-1",children:Ze(e.content,e.type==="sent")})]})},e.id)),a("div",{ref:Me})]})})}),o("div",{className:"rounded-lg border bg-card p-3 flex-shrink-0 space-y-3",children:[o("div",{className:"flex gap-2 items-center flex-wrap",children:[a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",H?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{M(!H),W(null)},title:"\u63D2\u5165\u8868\u60C5",children:a(re,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",w==="image"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="image"?null:"image"),M(!1)},title:"\u63D2\u5165\u56FE\u7247 URL",children:a(oe,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",w==="video"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="video"?null:"video"),M(!1)},title:"\u63D2\u5165\u89C6\u9891 URL",children:a(ie,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",w==="audio"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="audio"?null:"audio"),M(!1)},title:"\u63D2\u5165\u97F3\u9891 URL",children:a(ue,{size:16})}),a("div",{className:"flex-1 min-w-[1rem]"}),k&&a("button",{className:"h-8 w-8 rounded-md flex items-center justify-center hover:bg-accent transition-colors",onClick:()=>{B(""),v([])},children:a(pe,{size:16})})]}),H&&o("div",{className:"p-3 rounded-md border bg-muted/30 max-h-64 overflow-y-auto space-y-2",children:[a("input",{value:u,onChange:e=>c(e.target.value),placeholder:"\u641C\u7D22\u8868\u60C5...",className:"w-full h-8 rounded-md border bg-transparent px-2 text-sm"}),a("div",{className:"grid grid-cols-8 gap-1",children:ve.slice(0,80).map(e=>a("button",{onClick:()=>je(e.id),title:e.name,className:"w-10 h-10 rounded-md border flex items-center justify-center hover:bg-accent transition-colors",children:a("img",{src:`https://face.viki.moe/apng/${e.id}.png`,alt:e.name,className:"w-8 h-8"})},e.id))}),ve.length===0&&o("div",{className:"flex flex-col items-center gap-2 py-4",children:[a(j,{size:32,className:"text-muted-foreground/30"}),a("span",{className:"text-sm text-muted-foreground",children:"\u672A\u627E\u5230\u5339\u914D\u7684\u8868\u60C5"})]})]}),w&&o("div",{className:"p-3 rounded-md border bg-muted/30 space-y-2",children:[o("p",{className:"text-xs text-muted-foreground",children:[w==="image"&&"\u652F\u6301 http(s) \u56FE\u7247\u94FE\u63A5\u6216 data URL",w==="video"&&"\u652F\u6301\u6D4F\u89C8\u5668\u53EF\u89E3\u7801\u7684\u89C6\u9891\u76F4\u94FE\uFF08\u5982 .mp4\u3001.webm\uFF09",w==="audio"&&"\u652F\u6301 .mp3\u3001.ogg\u3001.wav \u7B49\u97F3\u9891\u76F4\u94FE"]}),a("input",{value:$,onChange:e=>me(e.target.value),placeholder:w==="image"?"\u56FE\u7247 URL\u2026":w==="video"?"\u89C6\u9891 URL\u2026":"\u97F3\u9891 URL\u2026",className:"w-full h-8 rounded-md border border-input bg-background px-2 text-sm",onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),be())}}),o("button",{type:"button",className:"inline-flex items-center gap-1 h-8 px-3 rounded-md bg-primary text-primary-foreground text-sm disabled:opacity-50",onClick:be,disabled:!$.trim(),children:[a(ae,{size:14})," \u63D2\u5165\u5230\u8F93\u5165\u6846"]})]}),o("div",{className:"flex gap-2 items-start",children:[o("div",{className:"flex-1 relative",children:[a(Ve,{ref:q,placeholder:`\u5411 ${h.name} \u53D1\u9001\u6D88\u606F...`,onSend:Fe,onChange:ea,onAtTrigger:Ye,minHeight:"44px",maxHeight:"200px"}),Y&&a("div",{className:"absolute z-50 rounded-lg border bg-popover shadow-md min-w-60 max-h-72 overflow-y-auto p-1",style:{top:`${Y.top}px`,left:`${Y.left}px`},children:Re.length>0?Re.map(e=>o("div",{className:"flex items-center gap-2 p-2 rounded-md cursor-pointer hover:bg-accent transition-colors",onClick:()=>$e(e),children:[a(Z,{size:16,className:"text-muted-foreground"}),o("div",{className:"flex-1",children:[a("div",{className:"text-sm font-medium",children:e.name}),o("div",{className:"text-xs text-muted-foreground",children:["ID: ",e.id]})]})]},e.id)):o("div",{className:"flex flex-col items-center gap-2 p-4",children:[a(j,{size:20,className:"text-muted-foreground/50"}),a("span",{className:"text-xs text-muted-foreground",children:"\u672A\u627E\u5230\u5339\u914D\u7684\u7528\u6237"})]})})]}),o("button",{className:"inline-flex items-center gap-1.5 h-10 px-4 rounded-md bg-primary text-primary-foreground text-sm font-medium disabled:opacity-50 transition-colors hover:bg-primary/90",onClick:()=>{let e=q.current?.getContent();e&&Fe(e.text,e.segments)},disabled:!Be(V),children:[a(le,{size:16})," \u53D1\u9001"]})]}),o("div",{className:"flex items-center gap-2 flex-wrap text-xs text-muted-foreground",children:[a(de,{size:12})," \u5FEB\u6377\u64CD\u4F5C:",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"Enter"})," \u53D1\u9001",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"Shift+Enter"})," \u6362\u884C",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[@\u540D\u79F0]"})," @\u67D0\u4EBA",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[video:URL]"}),a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[audio:URL]"})]})]})]})]})]})}function Po(i){i.addRoute({path:"/console/sandbox",name:"\u6C99\u76D2",element:i.React.createElement(Ae,{hostReact:i.React})}),i.addTool({id:"sandbox",name:"\u6C99\u76D2",path:"/console/sandbox"})}export{Po as register};
|
|
7
|
+
`).length-1&&a("br",{})]},P))},f);case"at":return o("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded bg-accent text-accent-foreground text-xs mx-0.5",children:["@",String(S.name??S.qq??"")]},f);case"face":return a("img",{src:`https://face.viki.moe/apng/${S.id}.png`,alt:"",className:"w-6 h-6 inline-block align-middle mx-0.5"},f);case"image":{let F=ye(S),P=Pe(F,"image");return P?a("a",{href:P,target:"_blank",rel:"noreferrer",className:"block my-1",children:a("img",{src:P,alt:"",className:A("max-w-[min(320px,88vw)] rounded-lg block",x,"ring-offset-0"),onError:aa=>{aa.target.style.display="none"}})},f):a("span",{className:"text-xs opacity-70",children:"[\u56FE\u7247]"},f)}case"video":{let F=ye(S),P=Pe(F,"video");return P?a("video",{src:P,controls:!0,playsInline:!0,preload:"metadata",className:A("max-w-[min(360px,92vw)] max-h-72 rounded-lg my-1 bg-black/10",x)},f):a("span",{className:"text-xs opacity-70",children:"[\u89C6\u9891\u65E0\u5730\u5740]"},f)}case"audio":case"record":{let F=ye(S),P=Pe(F,"audio");return P?a("audio",{src:P,controls:!0,preload:"metadata",className:A("w-full max-w-sm my-2 h-10",s&&"opacity-95")},f):a("span",{className:"text-xs opacity-70",children:"[\u97F3\u9891\u65E0\u5730\u5740]"},f)}case"file":return o("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-xs mx-0.5",children:["\u{1F4CE} ",String(S.name||"\u6587\u4EF6")]},f);default:return o("span",{className:"text-xs opacity-70",children:["[",C.type,"]"]},f)}})},Fe=(e,s)=>{if(!Be(s))return;let x={id:`msg_${Date.now()}`,type:"sent",channelType:h.type,channelId:h.id,channelName:h.name,senderId:"test_user",senderName:"\u6D4B\u8BD5\u7528\u6237",content:s,timestamp:Date.now()};p(f=>[...f,x]),B(""),v([]),q.current?.clear();let C=JSON.stringify({type:h.type,id:h.id,content:s,timestamp:Date.now()});z.current?.send(C)},_e=()=>{confirm("\u786E\u5B9A\u6E05\u7A7A\u6240\u6709\u6D88\u606F\u8BB0\u5F55\uFF1F")&&p([])},Qe=e=>{ge("chat"),m(e),L(s=>s.map(x=>x.id===e.id?{...x,unread:0}:x)),window.innerWidth<768&&T(!1)},Je=()=>{let e=["private","group","channel"],s=e[Math.floor(Math.random()*e.length)],x=prompt("\u8BF7\u8F93\u5165\u9891\u9053\u540D\u79F0\uFF1A");if(x){let C={id:`${s}_${Date.now()}`,name:x,type:s,unread:0};L(f=>[...f,C]),m(C)}},De=e=>{switch(e){case"private":return a(Z,{size:16});case"group":return a(fe,{size:16});case"channel":return a(te,{size:16});default:return a(H,{size:16})}},je=e=>{q.current?.insertFace(e),M(!1)},be=()=>{let e=$.trim();!e||!w||(w==="image"?q.current?.insertImage(e):w==="video"?q.current?.insertVideo(e):q.current?.insertAudio(e),me(""),W(null))},va=()=>{l.trim()&&(q.current?.insertAt(l.trim()),n(""),Ce(!1))},$e=e=>{q.current?.replaceAtTrigger(e.name,e.id),Q(null),t("")},Ye=(e,s,x)=>{if(h.type==="private"){Q(null),t("");return}e&&x?(Q(x),t(s)):(Q(null),t(""))},Re=y.filter(e=>{if(!d.trim())return!0;let s=d.toLowerCase();return e.name.toLowerCase().includes(s)||e.id.toLowerCase().includes(s)}),ea=(e,s)=>{B(e),v(s)},ve=N.filter(e=>e.name.toLowerCase().includes(u.toLowerCase())||e.describe.toLowerCase().includes(u.toLowerCase())),Se=i.filter(e=>e.channelId===h.id);return o("div",{className:"sandbox-container rounded-xl border border-border/70 bg-card/30 shadow-sm",children:[o("button",{className:"mobile-channel-toggle md:hidden",onClick:()=>T(!b),children:[a(H,{size:20})," \u9891\u9053\u5217\u8868"]}),o("div",{className:A("channel-sidebar rounded-lg border bg-card",b&&"show"),children:[a("div",{className:"p-3 border-b",children:o("div",{className:"flex justify-between items-center",children:[o("div",{className:"flex items-center gap-2",children:[a("div",{className:"p-1 rounded-md bg-secondary",children:a(H,{size:16,className:"text-muted-foreground"})}),a("h3",{className:"font-semibold",children:"\u9891\u9053\u5217\u8868"})]}),o("span",{className:A("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border",E?"bg-emerald-100 text-emerald-800 border-emerald-200 dark:bg-emerald-900/30 dark:text-emerald-400 dark:border-emerald-800":"bg-muted text-muted-foreground"),children:[E?a(ne,{size:12}):a(ce,{size:12}),E?"\u5DF2\u8FDE\u63A5":"\u672A\u8FDE\u63A5"]})]})}),o("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:[I.map(e=>{let s=J==="chat"&&h.id===e.id;return o("div",{className:A("menu-item",s&&"active"),onClick:()=>Qe(e),children:[a("span",{className:"shrink-0",children:De(e.type)}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium truncate",children:e.name}),a("div",{className:"text-xs text-muted-foreground",children:e.type==="private"?"\u79C1\u804A":e.type==="group"?"\u7FA4\u804A":"\u9891\u9053"})]}),e.unread>0&&a("span",{className:"inline-flex items-center justify-center h-5 min-w-5 rounded-full bg-destructive text-destructive-foreground text-[10px] font-medium px-1",children:e.unread})]},e.id)}),o("div",{className:"pt-2 mt-2 border-t space-y-1",children:[o("div",{className:A("menu-item",J==="requests"&&"active"),onClick:()=>{ge("requests"),window.innerWidth<768&&T(!1)},children:[a(K,{size:16,className:"shrink-0"}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium",children:"\u8BF7\u6C42"}),a("div",{className:"text-xs text-muted-foreground",children:"\u597D\u53CB/\u7FA4\u9080\u8BF7\u7B49"})]})]}),o("div",{className:A("menu-item",J==="notices"&&"active"),onClick:()=>{ge("notices"),window.innerWidth<768&&T(!1)},children:[a(X,{size:16,className:"shrink-0"}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium",children:"\u901A\u77E5"}),a("div",{className:"text-xs text-muted-foreground",children:"\u7FA4\u7BA1/\u64A4\u56DE\u7B49"})]})]})]})]}),a("div",{className:"p-2 border-t",children:a("button",{className:"w-full py-2 px-3 rounded-md border border-dashed text-sm text-muted-foreground hover:bg-accent transition-colors",onClick:Je,children:"+ \u6DFB\u52A0\u9891\u9053"})})]}),b&&a("div",{className:"channel-overlay md:hidden",onClick:()=>T(!1)}),o("div",{className:"chat-area",children:[J==="requests"&&o("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0 overflow-hidden",children:[a("div",{className:"p-3 border-b flex-shrink-0",children:o("h2",{className:"text-lg font-bold flex items-center gap-2",children:[a(K,{size:20})," \u8BF7\u6C42"]})}),o("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center gap-3 text-muted-foreground text-center",children:[a(K,{size:48,className:"opacity-30"}),a("span",{children:"\u6C99\u76D2\u4E3A\u6A21\u62DF\u73AF\u5883\uFF0C\u6682\u65E0\u8BF7\u6C42\u6570\u636E"}),o("span",{className:"text-sm",children:["\u5B9E\u9645\u597D\u53CB/\u7FA4\u9080\u8BF7\u7B49\u8BF7\u6C42\u8BF7\u5230\u4FA7\u8FB9\u680F ",a("strong",{children:"\u673A\u5668\u4EBA"})," \u9875\u9762\u8FDB\u5165\u5BF9\u5E94\u673A\u5668\u4EBA\u7BA1\u7406\u67E5\u770B"]})]})]}),J==="notices"&&o("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0 overflow-hidden",children:[a("div",{className:"p-3 border-b flex-shrink-0",children:o("h2",{className:"text-lg font-bold flex items-center gap-2",children:[a(X,{size:20})," \u901A\u77E5"]})}),o("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center gap-3 text-muted-foreground text-center",children:[a(X,{size:48,className:"opacity-30"}),a("span",{children:"\u6C99\u76D2\u4E3A\u6A21\u62DF\u73AF\u5883\uFF0C\u6682\u65E0\u901A\u77E5\u6570\u636E"}),o("span",{className:"text-sm",children:["\u5B9E\u9645\u7FA4\u7BA1\u3001\u64A4\u56DE\u7B49\u901A\u77E5\u8BF7\u5230\u4FA7\u8FB9\u680F ",a("strong",{children:"\u673A\u5668\u4EBA"})," \u9875\u9762\u8FDB\u5165\u5BF9\u5E94\u673A\u5668\u4EBA\u7BA1\u7406\u67E5\u770B"]})]})]}),J==="chat"&&o(Ra,{children:[a("div",{className:"rounded-lg border bg-card p-3 flex-shrink-0",children:o("div",{className:"flex justify-between items-center flex-wrap gap-2",children:[o("div",{className:"flex items-center gap-3",children:[a("div",{className:"p-2 rounded-lg bg-secondary",children:De(h.type)}),o("div",{children:[a("h2",{className:"text-lg font-bold",children:h.name}),o("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a("span",{children:h.id}),a("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-[10px]",children:Se.length}),a("span",{children:"\u6761\u6D88\u606F"})]})]}),a("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-secondary text-secondary-foreground",children:h.type==="private"?"\u79C1\u804A":h.type==="group"?"\u7FA4\u804A":"\u9891\u9053"})]}),o("div",{className:"flex items-center gap-2",children:[a("input",{value:U,onChange:e=>_(e.target.value),placeholder:"\u673A\u5668\u4EBA\u540D\u79F0",className:"h-8 w-28 rounded-md border bg-transparent px-2 text-sm"}),o("button",{className:"inline-flex items-center gap-1 h-8 px-3 rounded-md bg-secondary text-secondary-foreground text-sm hover:bg-secondary/80",onClick:_e,children:[a(se,{size:14})," \u6E05\u7A7A"]})]})]})}),a("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0",children:a("div",{className:"flex-1 overflow-y-auto p-4",children:Se.length===0?o("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a(H,{size:64,className:"text-muted-foreground/20"}),a("span",{className:"text-muted-foreground",children:"\u6682\u65E0\u6D88\u606F\uFF0C\u5F00\u59CB\u5BF9\u8BDD\u5427\uFF01"})]}):o("div",{className:"space-y-2",children:[Se.map(e=>a("div",{className:A("flex",e.type==="sent"?"justify-end":"justify-start"),children:o("div",{className:A("max-w-[70%] p-3 rounded-2xl",e.type==="sent"?"bg-primary text-primary-foreground":"bg-muted"),children:[o("div",{className:"flex items-center gap-2 mb-1",children:[e.type==="received"&&a(ee,{size:14}),e.type==="sent"&&a(Z,{size:14}),a("span",{className:"text-xs font-medium opacity-90",children:e.senderName}),a("span",{className:"text-xs opacity-70",children:new Date(e.timestamp).toLocaleTimeString()})]}),a("div",{className:"text-sm space-y-1",children:Ze(e.content,e.type==="sent")})]})},e.id)),a("div",{ref:Me})]})})}),o("div",{className:"rounded-lg border bg-card p-3 flex-shrink-0 space-y-3",children:[o("div",{className:"flex gap-2 items-center flex-wrap",children:[a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",O?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{M(!O),W(null)},title:"\u63D2\u5165\u8868\u60C5",children:a(re,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",w==="image"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="image"?null:"image"),M(!1)},title:"\u63D2\u5165\u56FE\u7247 URL",children:a(oe,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",w==="video"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="video"?null:"video"),M(!1)},title:"\u63D2\u5165\u89C6\u9891 URL",children:a(ie,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",w==="audio"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="audio"?null:"audio"),M(!1)},title:"\u63D2\u5165\u97F3\u9891 URL",children:a(ue,{size:16})}),a("div",{className:"flex-1 min-w-[1rem]"}),k&&a("button",{className:"h-8 w-8 rounded-md flex items-center justify-center hover:bg-accent transition-colors",onClick:()=>{B(""),v([])},children:a(pe,{size:16})})]}),O&&o("div",{className:"p-3 rounded-md border bg-muted/30 max-h-64 overflow-y-auto space-y-2",children:[a("input",{value:u,onChange:e=>c(e.target.value),placeholder:"\u641C\u7D22\u8868\u60C5...",className:"w-full h-8 rounded-md border bg-transparent px-2 text-sm"}),a("div",{className:"grid grid-cols-8 gap-1",children:ve.slice(0,80).map(e=>a("button",{onClick:()=>je(e.id),title:e.name,className:"w-10 h-10 rounded-md border flex items-center justify-center hover:bg-accent transition-colors",children:a("img",{src:`https://face.viki.moe/apng/${e.id}.png`,alt:e.name,className:"w-8 h-8"})},e.id))}),ve.length===0&&o("div",{className:"flex flex-col items-center gap-2 py-4",children:[a(j,{size:32,className:"text-muted-foreground/30"}),a("span",{className:"text-sm text-muted-foreground",children:"\u672A\u627E\u5230\u5339\u914D\u7684\u8868\u60C5"})]})]}),w&&o("div",{className:"p-3 rounded-md border bg-muted/30 space-y-2",children:[o("p",{className:"text-xs text-muted-foreground",children:[w==="image"&&"\u652F\u6301 http(s) \u56FE\u7247\u94FE\u63A5\u6216 data URL",w==="video"&&"\u652F\u6301\u6D4F\u89C8\u5668\u53EF\u89E3\u7801\u7684\u89C6\u9891\u76F4\u94FE\uFF08\u5982 .mp4\u3001.webm\uFF09",w==="audio"&&"\u652F\u6301 .mp3\u3001.ogg\u3001.wav \u7B49\u97F3\u9891\u76F4\u94FE"]}),a("input",{value:$,onChange:e=>me(e.target.value),placeholder:w==="image"?"\u56FE\u7247 URL\u2026":w==="video"?"\u89C6\u9891 URL\u2026":"\u97F3\u9891 URL\u2026",className:"w-full h-8 rounded-md border border-input bg-background px-2 text-sm",onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),be())}}),o("button",{type:"button",className:"inline-flex items-center gap-1 h-8 px-3 rounded-md bg-primary text-primary-foreground text-sm disabled:opacity-50",onClick:be,disabled:!$.trim(),children:[a(ae,{size:14})," \u63D2\u5165\u5230\u8F93\u5165\u6846"]})]}),o("div",{className:"flex gap-2 items-start",children:[o("div",{className:"flex-1 relative",children:[a(Ve,{ref:q,placeholder:`\u5411 ${h.name} \u53D1\u9001\u6D88\u606F...`,onSend:Fe,onChange:ea,onAtTrigger:Ye,minHeight:"44px",maxHeight:"200px"}),Y&&a("div",{className:"absolute z-50 rounded-lg border bg-popover shadow-md min-w-60 max-h-72 overflow-y-auto p-1",style:{top:`${Y.top}px`,left:`${Y.left}px`},children:Re.length>0?Re.map(e=>o("div",{className:"flex items-center gap-2 p-2 rounded-md cursor-pointer hover:bg-accent transition-colors",onClick:()=>$e(e),children:[a(Z,{size:16,className:"text-muted-foreground"}),o("div",{className:"flex-1",children:[a("div",{className:"text-sm font-medium",children:e.name}),o("div",{className:"text-xs text-muted-foreground",children:["ID: ",e.id]})]})]},e.id)):o("div",{className:"flex flex-col items-center gap-2 p-4",children:[a(j,{size:20,className:"text-muted-foreground/50"}),a("span",{className:"text-xs text-muted-foreground",children:"\u672A\u627E\u5230\u5339\u914D\u7684\u7528\u6237"})]})})]}),o("button",{className:"inline-flex items-center gap-1.5 h-10 px-4 rounded-md bg-primary text-primary-foreground text-sm font-medium disabled:opacity-50 transition-colors hover:bg-primary/90",onClick:()=>{let e=q.current?.getContent();e&&Fe(e.text,e.segments)},disabled:!Be(V),children:[a(le,{size:16})," \u53D1\u9001"]})]}),o("div",{className:"flex items-center gap-2 flex-wrap text-xs text-muted-foreground",children:[a(de,{size:12})," \u5FEB\u6377\u64CD\u4F5C:",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"Enter"})," \u53D1\u9001",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"Shift+Enter"})," \u6362\u884C",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[@\u540D\u79F0]"})," @\u67D0\u4EBA",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[video:URL]"}),a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[audio:URL]"})]})]})]})]})]})}function Po(i){i.addRoute({path:"/console/sandbox",name:"\u6C99\u76D2",element:i.React.createElement(Ae,{hostReact:i.React})}),i.addTool({id:"sandbox",name:"\u6C99\u76D2",path:"/console/sandbox"})}export{Po as register};
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs:
|
|
@@ -37,7 +37,7 @@ lucide-react/dist/esm/icons/wifi.mjs:
|
|
|
37
37
|
lucide-react/dist/esm/icons/x.mjs:
|
|
38
38
|
lucide-react/dist/esm/lucide-react.mjs:
|
|
39
39
|
(**
|
|
40
|
-
* @license lucide-react v1.
|
|
40
|
+
* @license lucide-react v1.21.0 - ISC
|
|
41
41
|
*
|
|
42
42
|
* This source code is licensed under the ISC license.
|
|
43
43
|
* See the LICENSE file in the root directory of this source tree.
|
package/lib/sandbox-ws.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Sandbox 传输 — Node WebSocket。 */
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
|
-
import { Adapter, Endpoint, Message, type MessageElement, type MessageType, type Plugin, type SendOptions } from
|
|
3
|
+
import { Adapter, Endpoint, Message, type MessageElement, type MessageType, type Plugin, type SendOptions } from 'zhin.js';
|
|
4
4
|
export interface SandboxWsConfig {
|
|
5
5
|
context: "sandbox";
|
|
6
6
|
ws?: SandboxWsSocket;
|
package/lib/sandbox-ws.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-ws.d.ts","sourceRoot":"","sources":["../src/sandbox-ws.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EAEP,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,MAAM,EAEX,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"sandbox-ws.d.ts","sourceRoot":"","sources":["../src/sandbox-ws.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EAEP,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,MAAM,EAEX,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,SAAS,CAAC;IACnB,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,+CAA+C;AAC/C,wBAAgB,sBAAsB,IAAI,eAAe,CAExD;AAED,6BAA6B;AAC7B,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EA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EAAE,eAAe,EACnB,SAAS,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAC3D,iBAAiB;CAoCrB"}
|
package/lib/sandbox-ws.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Sandbox 传输 — Node WebSocket。 */
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
|
-
import { Adapter, Message, segment, } from
|
|
3
|
+
import { Adapter, Message, segment, } from 'zhin.js';
|
|
4
4
|
/** 无 WS 时的占位 socket(仅用于 endpoint:list,不可收发) */
|
|
5
5
|
export function createOfflineSandboxWs() {
|
|
6
6
|
return { send: () => { }, close: () => { } };
|
|
@@ -178,6 +178,9 @@ export class SandboxWsEndpoint extends EventEmitter {
|
|
|
178
178
|
return message;
|
|
179
179
|
}
|
|
180
180
|
async $sendMessage(options) {
|
|
181
|
+
options = {
|
|
182
|
+
...options,
|
|
183
|
+
};
|
|
181
184
|
if (!this.$connected)
|
|
182
185
|
return "";
|
|
183
186
|
const ws = this.$config.ws;
|
package/lib/sandbox-ws.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-ws.js","sourceRoot":"","sources":["../src/sandbox-ws.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,OAAO,EAEP,OAAO,EACP,OAAO,
|
|
1
|
+
{"version":3,"file":"sandbox-ws.js","sourceRoot":"","sources":["../src/sandbox-ws.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,OAAO,EAEP,OAAO,EACP,OAAO,GAKW,MAAM,SAAS,CAAC;AAWpC,+CAA+C;AAC/C,MAAM,UAAU,sBAAsB;IACpC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE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QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9F,KAAK,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,uBAAuB,EAAE,CAAC;YAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC;gBAClC,IAAI,EAAE,OAAO;gBACb,EAAE,EAAE,KAAK;gBACT,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;4BACJ,IAAI,EAAE;gCACJ,eAAe,IAAI,GAAG;gCACtB,iCAAiC;gCACjC,+BAA+B;6BAChC,CAAC,IAAI,CAAC,IAAI,CAAC;yBACb;qBACF;iBACF;gBACD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACtB,CAAC,CAAC;YACH,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-sandbox",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Zhin.js adapter for local testing and development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -43,25 +43,25 @@
|
|
|
43
43
|
"directory": "plugins/adapters/sandbox"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"lucide-react": "^1.
|
|
46
|
+
"lucide-react": "^1.21.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/react": "^19.2.17",
|
|
50
50
|
"@types/react-dom": "^19.2.3",
|
|
51
51
|
"typescript": "^6.0.3",
|
|
52
|
-
"@zhin.js/cli": "1.0.
|
|
52
|
+
"@zhin.js/cli": "1.0.91",
|
|
53
53
|
"@zhin.js/client": "2.0.3",
|
|
54
|
+
"@zhin.js/core": "1.3.2",
|
|
54
55
|
"@zhin.js/contract": "1.0.1",
|
|
55
|
-
"@zhin.js/
|
|
56
|
-
"@zhin.js/host-
|
|
57
|
-
"
|
|
58
|
-
"zhin.js": "4.0.1"
|
|
56
|
+
"@zhin.js/host-api": "2.0.3",
|
|
57
|
+
"@zhin.js/host-router": "2.0.1",
|
|
58
|
+
"zhin.js": "4.1.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@zhin.js/
|
|
61
|
+
"@zhin.js/host-router": "2.0.1",
|
|
62
|
+
"@zhin.js/core": "1.3.2",
|
|
63
|
+
"@zhin.js/host-api": "2.0.3",
|
|
62
64
|
"@zhin.js/client": "2.0.3",
|
|
63
|
-
"@zhin.js/host-router": "2.0.0",
|
|
64
|
-
"@zhin.js/host-api": "2.0.1",
|
|
65
65
|
"@zhin.js/contract": "1.0.1"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
package/src/sandbox-ws.ts
CHANGED
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
type MessageType,
|
|
10
10
|
type Plugin,
|
|
11
11
|
type SendContent,
|
|
12
|
-
type SendOptions,
|
|
13
|
-
} from "zhin.js";
|
|
12
|
+
type SendOptions,} from 'zhin.js';
|
|
14
13
|
|
|
15
14
|
export interface SandboxWsConfig {
|
|
16
15
|
context: "sandbox";
|
|
@@ -275,6 +274,10 @@ export class SandboxWsEndpoint extends EventEmitter implements Endpoint<SandboxW
|
|
|
275
274
|
}
|
|
276
275
|
|
|
277
276
|
async $sendMessage(options: SendOptions): Promise<string> {
|
|
277
|
+
options = {
|
|
278
|
+
...options,
|
|
279
|
+
|
|
280
|
+
};
|
|
278
281
|
if (!this.$connected) return "";
|
|
279
282
|
const ws = this.$config.ws;
|
|
280
283
|
if (!ws) return "";
|