@alwith/module-device 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-30kbebc6.js +2 -0
- package/dist/preview/device-panel.js +1 -1
- package/dist/preview/index.js +1 -1
- package/native/darwin-arm64/THIRD_PARTY_NOTICES.md +7 -7
- package/native/darwin-arm64/alwith-device-helper +0 -0
- package/native/darwin-arm64/artifact.json +2 -2
- package/native/darwin-arm64/libalwith_native_device.dylib +0 -0
- package/native/win32-x64/THIRD_PARTY_NOTICES.md +7 -7
- package/native/win32-x64/alwith_native_device.dll +0 -0
- package/native/win32-x64/artifact.json +1 -1
- package/package.json +3 -3
- package/dist/chunk-36wzsv9q.js +0 -2
- /package/native/darwin-arm64/licenses/{bytes-1.12.1 → bytes-1.12.2}/LICENSE +0 -0
- /package/native/darwin-arm64/licenses/{form_urlencoded-1.2.2 → form_urlencoded-1.2.3}/LICENSE-APACHE +0 -0
- /package/native/darwin-arm64/licenses/{form_urlencoded-1.2.2 → form_urlencoded-1.2.3}/LICENSE-MIT +0 -0
- /package/native/darwin-arm64/licenses/{hashbrown-0.17.1 → hashbrown-0.17.2}/LICENSE-APACHE +0 -0
- /package/native/darwin-arm64/licenses/{hashbrown-0.17.1 → hashbrown-0.17.2}/LICENSE-MIT +0 -0
- /package/native/darwin-arm64/licenses/{pin-project-lite-0.2.17 → pin-project-lite-0.2.18}/LICENSE-APACHE +0 -0
- /package/native/darwin-arm64/licenses/{pin-project-lite-0.2.17 → pin-project-lite-0.2.18}/LICENSE-MIT +0 -0
- /package/native/darwin-arm64/licenses/{smallvec-1.16.5 → smallvec-1.16.6}/LICENSE-APACHE +0 -0
- /package/native/darwin-arm64/licenses/{smallvec-1.16.5 → smallvec-1.16.6}/LICENSE-MIT +0 -0
- /package/native/darwin-arm64/licenses/{url-2.5.8 → url-2.5.9}/LICENSE-APACHE +0 -0
- /package/native/darwin-arm64/licenses/{url-2.5.8 → url-2.5.9}/LICENSE-MIT +0 -0
- /package/native/darwin-arm64/licenses/{uuid-1.29.2 → uuid-1.29.3}/LICENSE-APACHE +0 -0
- /package/native/darwin-arm64/licenses/{uuid-1.29.2 → uuid-1.29.3}/LICENSE-MIT +0 -0
- /package/native/win32-x64/licenses/{bytes-1.12.1 → bytes-1.12.2}/LICENSE +0 -0
- /package/native/win32-x64/licenses/{form_urlencoded-1.2.2 → form_urlencoded-1.2.3}/LICENSE-APACHE +0 -0
- /package/native/win32-x64/licenses/{form_urlencoded-1.2.2 → form_urlencoded-1.2.3}/LICENSE-MIT +0 -0
- /package/native/win32-x64/licenses/{hashbrown-0.17.1 → hashbrown-0.17.2}/LICENSE-APACHE +0 -0
- /package/native/win32-x64/licenses/{hashbrown-0.17.1 → hashbrown-0.17.2}/LICENSE-MIT +0 -0
- /package/native/win32-x64/licenses/{pin-project-lite-0.2.17 → pin-project-lite-0.2.18}/LICENSE-APACHE +0 -0
- /package/native/win32-x64/licenses/{pin-project-lite-0.2.17 → pin-project-lite-0.2.18}/LICENSE-MIT +0 -0
- /package/native/win32-x64/licenses/{smallvec-1.16.5 → smallvec-1.16.6}/LICENSE-APACHE +0 -0
- /package/native/win32-x64/licenses/{smallvec-1.16.5 → smallvec-1.16.6}/LICENSE-MIT +0 -0
- /package/native/win32-x64/licenses/{url-2.5.8 → url-2.5.9}/LICENSE-APACHE +0 -0
- /package/native/win32-x64/licenses/{url-2.5.8 → url-2.5.9}/LICENSE-MIT +0 -0
- /package/native/win32-x64/licenses/{uuid-1.29.2 → uuid-1.29.3}/LICENSE-APACHE +0 -0
- /package/native/win32-x64/licenses/{uuid-1.29.2 → uuid-1.29.3}/LICENSE-MIT +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{k}from"./chunk-bryvgfbf.js";import{i,l,c}from"./chunk-kza0t2p3.js";import{r}from"./chunk-34h0m6pp.js";import{D}from"./chunk-kr39jn06.js";import{u,d,p,m}from"./chunk-a68z39dh.js";import{b,w,x}from"./chunk-z6e1m5r3.js";import{g,y}from"./chunk-1r5rvxr9.js";import{h}from"./chunk-dv7gz9ee.js";import{s,t}from"./chunk-zsk39eje.js";import{n}from"./chunk-arw91r4t.js";import{A,C}from"./chunk-jdmxpq93.js";import{Camera as Dt,ChevronDown as ot,History as Nt,Home as Pt,Images as Tt,Maximize2 as Et,Minimize2 as Ct,RotateCw as Mt,ScanSearch as Rt,Square as zt,SquareTerminal as At,Video as Bt,X as dt}from"lucide-react";import{useCallback as ae,useEffect as X,useMemo as Le,useRef as Ee,useState as E}from"react";import{toast as Ve}from"sonner";import{Button as ut}from"@nyssance/shadcn/vega/components/ui/button";import{Tooltip as Lt,TooltipContent as Ot,TooltipProvider as It,TooltipTrigger as Ft}from"@nyssance/shadcn/vega/components/ui/tooltip";import{jsx as f,jsxs as Y,Fragment as qt}from"react/jsx-runtime";var ve=[25,33,50,66,75,100,125,150,200],lt=(e)=>`alwith-device:consent:${e}`,$t={read:(e)=>Promise.resolve(rt(()=>localStorage.getItem(lt(e))==="granted")??!1),write:(e,T)=>Promise.resolve(rt(()=>localStorage.setItem(lt(e),T?"granted":"denied"))??void 0)};function rt(e){try{return e()}catch{return null}}function ne(e){let T=typeof e==="object"&&e!==null&&"message"in e&&typeof e.message==="string"?e.message:String(e);try{let M=JSON.parse(T);if(typeof M==="object"&&M!==null&&"message"in M&&typeof M.message==="string")return M.message}catch{}return T}function R({bridge:e,onAddContext:T,onAddCapture:M,platform:U="ios",udid:j,initialDeviceId:I,onDeviceChange:W,language:B,agentName:O="AI",pollFps:z=60,maximized:G=!1,onMaximize:F,windowAction:V,windowGrip:ie,onClose:ce,className:se}){let S=Le(()=>s(B),[B]),[q,Z]=E(U),[Q,_]=E(I??null),[ye,pe]=E([]);X(()=>e.subscribe(pe,(a)=>te(ne(a))),[e]);let o=Le(()=>ye.find((a)=>a.udid===(j??Q))??(j?void 0:ye.reduce((a,v)=>!a||v.attachedAt>a.attachedAt?v:a,void 0)),[ye,j,Q]);X(()=>{if(o?.platform==="ios"||o?.platform==="android")Z(o.platform)},[o?.platform]);let[ee,ge]=E(null);X(()=>{let a=!1;if(ge(null),o&&e.capabilities)e.capabilities(o.udid).then((v)=>{if(!a)ge(v)}).catch((v)=>{if(!a)te(ne(v))});return()=>{a=!0}},[o?.udid,e]);let[de,oe]=E("fit"),[K,le]=E(!1),[Ce,Me]=E(null);X(()=>{if(!e.monitorDensity)return;let a=!1,v,P=async()=>{try{let H=await e.monitorDensity();if(!a)Me(H)}catch(H){if(!a)Me(null),te(ne(H))}if(!a)v=setTimeout(()=>void P(),1000)};return P(),()=>{a=!0,clearTimeout(v)}},[e]);let be=ee?.densityDpi&&Ce&&o?.pointWidth&&o?.pixelWidth?100*Ce*o.pixelWidth/o.pointWidth/ee.densityDpi:null,N=K&&be?be:de,[L,J]=E(z),[ke,Oe]=E(0),[me,we]=E(!1),[Ie,je]=E(!1),[Ge,xe]=E(!1),[_e,Se]=E(!1),[Xe,De]=E(!1),[mt,Je]=E(0),[fe,he]=E(!1),[Fe,$e]=E([]),[Re,Ne]=E(null),[Pe,ze]=E([]),[He,Ye]=E(!1),[ft,Qe]=E(null),[ht,vt]=E(0);X(()=>{he(!1),Ne(null),$e([]),ze([])},[o?.udid]),X(()=>{if(!fe||!o||!e.inspect)return;let a=!1;Ye(!0),Qe(null),Ne(null),ze([]);let v=setTimeout(()=>{e.inspect(o.udid).then((P)=>{if(a)return;$e(b(P,o.platform))}).catch((P)=>{if(!a)$e([]),Qe(ne(P))}).finally(()=>{if(!a)Ye(!1)})},150);return()=>{a=!0,clearTimeout(v)}},[fe,o?.udid,o?.platform,o?.inputRevision,o?.rotation,e,ht]);let yt=ae((a)=>{if(He)return;let v=w(Fe,a);ze(v),Ne(v[0]??null)},[Fe,He]),[et,te]=E(null);X(()=>te(null),[o?.udid]),X(()=>{W?.(o?.udid)},[o?.udid,W]);let[We,Ae]=E(null),[Te,qe]=E(null),[gt,tt]=E(null),[nt,Ze]=E(null),[at,it]=E("live"),Ke=e.consent??$t,ue=ae((a)=>{te(null),a().catch((v)=>te(ne(v)))},[]),Be=ae(async(a)=>{Ae(a&&!a.running?"booting":"attaching"),te(null);try{let v=await e.attach(a?.id,a?.platform??q);return _(v.udid),pe((P)=>[...P.filter((H)=>H.udid!==v.udid),v]),tt(null),v}catch(v){let P=ne(v);if(a&&/no simulator|not available|不可用|No device/i.test(P))tt(a.name);return te(P),null}finally{Ae(null)}},[e,q]),Ue=ae(async(a)=>{let v=a;if(!v){let P=await e.listDevices(q).catch((H)=>(te(ne(H)),null));if(!P)return;if(v=P.find((H)=>H.running)??P[0],!v){te(S.noSimulators);return}}if(await Ke.read(v.id))await Be(v);else qe(v)},[e,q,Ke,Be,S.noSimulators]);X(()=>{if(!o||!e.appearance)return;let a=!1;return e.appearance(o.udid).then((v)=>{if(!a)Ze(v)}).catch(()=>{return}),()=>{a=!0}},[e,o]);let bt=f(ct,{bridge:e,platform:q,labels:S,current:o?.udid,currentName:o?.deviceName,onPlatformChange:Z,disabled:We!==null,onPick:(a)=>{if(o&&a.id!==o.udid)ue(async()=>{if(await Be(a))await e.detach(o.udid)});else if(!o)ue(()=>Ue(a))}}),kt=[{kind:"item",label:S.undo,disabled:!0,hint:S.inputUnavailable},{kind:"item",label:S.redo,disabled:!0},{kind:"separator"},{kind:"item",label:S.cut,disabled:!0},{kind:"item",label:S.copy,disabled:!0},{kind:"item",label:S.paste,disabled:!0},{kind:"item",label:S.selectAll,disabled:!0},{kind:"item",label:S.delete,disabled:!0}],wt=()=>{let a=o,v=(P)=>()=>{if(a)ue(()=>P(a))};return[{kind:"section",label:S.appearance},{kind:"item",label:S.light,checked:nt==="light",disabled:!a||!e.setAppearance,onSelect:v(async(P)=>{await e.setAppearance?.(P.udid,"light"),Ze("light")})},{kind:"item",label:S.dark,checked:nt==="dark",disabled:!a||!e.setAppearance,onSelect:v(async(P)=>{await e.setAppearance?.(P.udid,"dark"),Ze("dark")})},...ee?.hingeAngle!=null?[{kind:"section",label:B?.startsWith("zh")?"折叠角度":"Hinge angle"},...[0,90,180].map((P)=>({kind:"item",label:`${P}°`,checked:Math.abs(ee.hingeAngle-P)<0.5,onSelect:v(async(H)=>{await e.gesture(H.udid,{type:"hinge",angle:P}),ge(await e.capabilities(H.udid))})}))]:[],{kind:"section",label:S.statusBar},{kind:"item",label:S.statusLive,checked:at==="live",disabled:!a||!e.setStatusBar,onSelect:v(async(P)=>{await e.setStatusBar?.(P.udid,"live"),it("live")})},{kind:"item",label:S.statusShowcase,checked:at==="showcase",disabled:!a||!e.setStatusBar,onSelect:v(async(P)=>{await e.setStatusBar?.(P.udid,"showcase"),it("showcase")})},{kind:"separator"},{kind:"item",label:S.restart,disabled:!a||!e.restart,onSelect:v(async(P)=>{Ae("booting");try{await e.restart?.(P.udid),await e.attach(P.udid,P.platform)}finally{Ae(null)}})},{kind:"item",label:S.shutdown,disabled:!a||!e.shutdown,onSelect:v((P)=>e.shutdown(P.udid))},{kind:"separator"},{kind:"item",label:S.detach,disabled:!a,onSelect:v((P)=>e.detach(P.udid))}]},st=(a)=>(le(!1),oe((v)=>{let P=v==="fit"?100:v,H=ve.findIndex((St)=>St>=P);return(a>0?ve[Math.min(ve.length-1,(H===-1?ve.length-1:H)+1)]:ve[Math.max(0,(H===-1?ve.length:H)-1)])??v})),xt=()=>[...V?[{kind:"item",...V}]:[],{kind:"item",label:S.zoomIn,onSelect:()=>st(1),hint:"⌘+"},{kind:"item",label:S.zoomOut,onSelect:()=>st(-1),hint:"⌘−"},{kind:"item",label:S.zoomFit,checked:!K&&de==="fit",onSelect:()=>{le(!1),oe("fit")}},{kind:"item",label:S.actualSize,checked:!K&&de===100,onSelect:()=>{le(!1),oe(100)},hint:"⌘0"},{kind:"item",label:B?.startsWith("zh")?"物理尺寸":"Physical size",disabled:be===null,checked:K,onSelect:()=>le(!0)},{kind:"section",label:S.frameRate},...[15,30,60].map((a)=>({kind:"item",label:`${a} FPS`,checked:L===a,onSelect:()=>J(a)}))],re=(a,v,P,H)=>Y(Lt,{children:[f(Ft,{render:f(ut,{variant:"ghost",size:"icon-sm","aria-label":a,"aria-pressed":H?.pressed,disabled:H?.disabled,onClick:P,className:"aria-pressed:bg-muted"}),children:v}),f(Ot,{children:a})]});return f(It,{children:Y("div",{"data-device-panel":!0,className:`bg-background text-foreground flex h-full min-h-0 flex-col ${se??""}`,children:[Y("div",{"data-device-menubar":!0,className:"border-border flex h-10 shrink-0 items-center gap-0.5 overflow-x-auto border-b px-2 whitespace-nowrap",children:[ie,bt,f(n,{label:S.menuEdit,entries:kt}),f(n,{label:S.menuDevice,entries:wt}),f(n,{label:S.menuView,entries:xt}),f("span",{className:"flex-1"}),o&&f("span",{className:"text-muted-foreground mx-1 text-xs tabular-nums",children:ke>0?t(S.fpsValue,{fps:ke}):S.fpsIdle}),F&&re(G?S.collapse:S.expand,G?f(Ct,{}):f(Et,{}),F,{pressed:G}),ce&&re(S.close,f(dt,{}),ce)]}),et&&f("p",{role:"alert",className:"border-border text-destructive shrink-0 border-b px-3 py-1.5 text-xs",children:et}),Y("div",{className:"flex min-h-0 min-w-0 flex-1",children:[f("div",{"data-device-stage":!0,className:`[container-type:size] flex min-h-0 min-w-0 flex-1 items-start justify-start p-4 ${de==="fit"?"overflow-hidden":"overflow-auto"}`,children:o?f(Ht,{bridge:e,attachment:o,labels:S,fps:L,zoom:N,onError:te,onFps:Oe,onInspect:fe?yt:void 0,selectedElement:fe?Re:null},o.udid):f(pt,{kind:i(q,Te?.name??"iPhone"),zoom:N,children:Te?f(C,{labels:S,agent:O,deviceName:Te.name,systemVersion:Te.systemVersion,onCancel:()=>qe(null),onContinue:()=>{let a=Te;qe(null),ue(async()=>{await Ke.write(a.id,!0),await Be(a)})}}):f(A,{labels:S,agent:O,unavailableDevice:gt,busy:We,error:null,onAttach:()=>void Ue(void 0),picker:f(ct,{bridge:e,platform:q,labels:S,disabled:We!==null,compact:!0,onPick:(a)=>void Ue(a)})})})}),Xe&&e.listCaptures&&e.captureUrl&&f(D,{bridge:e,language:B,revision:mt,onClose:()=>De(!1),onAdd:M}),fe&&o&&f(y,{elements:Fe,selected:Re,loading:He,error:ft,language:B,onSelect:(a)=>{Ne(a),ze([a])},onRefresh:()=>vt((a)=>a+1),onClose:()=>he(!1),onCycle:(a)=>{if(Pe.length&&Re)Ne(Pe[(Pe.indexOf(Re)+a+Pe.length)%Pe.length])},onCopy:(a)=>e.copyText?e.copyText(a):navigator.clipboard.writeText(a),onAdd:T?async(a,v)=>{await T(x(o.deviceName,o.platform,a,v))}:void 0},o.udid)]}),f("div",{"data-device-toolbar":!0,className:"flex shrink-0 justify-center py-3",children:Y("div",{className:"inline-flex items-center gap-0.5",children:[re(S.home,f(Pt,{className:"size-4"}),()=>o&&ue(()=>e.gesture(o.udid,{type:"button",name:"HOME"})),{disabled:!o}),re(S.rotate,f(Mt,{className:"size-4"}),()=>o&&ue(()=>e.gesture(o.udid,{type:"rotate",direction:"right"})),{disabled:!o}),re(S.screenshot,f(Dt,{className:"size-4"}),()=>o&&ue(async()=>{je(!0);try{let a;if(e.saveScreenshot)a=await e.saveScreenshot(o.udid,"");else{let v=await e.captureFrame(o.udid);if(!v)throw Error("Device did not produce a frame");let P=document.createElement("a");P.href=v,P.download=`${o.deviceName}-${Date.now()}.${v.startsWith("data:image/jpeg")?"jpg":"png"}`,P.click(),a=P.download}if(a)Je((v)=>v+1),Ve.success(t(S.screenshotSaved,{path:a}))}finally{je(!1)}}),{disabled:!o||Ie}),re(o?.recordingPath?S.stopRecording:S.record,o?.recordingPath?f(zt,{className:"size-4"}):f(Bt,{className:"size-4"}),()=>o&&ue(async()=>{we(!0);try{if(o.recordingPath){let a=await e.stopRecording(o.udid);Je((v)=>v+1),Ve.success(t(S.recordingSaved,{path:a}))}else await e.startRecording(o.udid),Ve.success(S.recordingStarted)}finally{we(!1)}}),{disabled:!o||me||!e.startRecording||!e.stopRecording,pressed:!!o?.recordingPath}),re(g(B).inspect,f(Rt,{}),()=>{he((a)=>!a),xe(!1),Se(!1),De(!1)},{disabled:!o||!e.inspect||!!o.recordingPath,pressed:fe}),re(B?.startsWith("zh")?"操作历史":"Activity",f(Nt,{}),()=>{Se((a)=>!a),xe(!1),he(!1),De(!1)},{disabled:!e.readActivity,pressed:_e}),re(B?.startsWith("zh")?"设备素材":"Captures",f(Tt,{}),()=>{De((a)=>!a),xe(!1),he(!1),Se(!1)},{disabled:!e.listCaptures||!e.captureUrl,pressed:Xe}),re(S.logs,f(At,{className:"size-4"}),()=>{xe((a)=>!a),he(!1),Se(!1),De(!1)},{disabled:!o||!e.readLogs,pressed:Ge})]})}),_e&&e.readActivity&&f(k,{bridge:e,language:B,onClose:()=>Se(!1)}),Ge&&o&&e.readLogs&&f(Wt,{bridge:e,udid:o.udid,labels:S,onClose:()=>xe(!1)})]})})}function ct({bridge:e,platform:T,labels:M,current:U,currentName:j,onPlatformChange:I,disabled:W,compact:B,onPick:O}){let[z,G]=E(null),[F,V]=E(null),ie=ae(()=>{G(null),V(null),e.listDevices(T).then(G).catch((q)=>V(ne(q)))},[e,T]);X(()=>{ie()},[ie]);let ce=()=>{if(F)return[{kind:"item",label:F,disabled:!0}];if(z===null)return[{kind:"item",label:M.loadingDevices,disabled:!0}];if(z.length===0)return[{kind:"item",label:M.noSimulators,disabled:!0}];let q=z.filter((_)=>_.running),Z=z.filter((_)=>!_.running),Q=(_)=>({kind:"item",label:_.name,hint:_.systemVersion,checked:U===void 0?void 0:_.id===U,onSelect:()=>O(_)});return[...q.length>0?[{kind:"section",label:M.booted},...q.map(Q)]:[],...Z.length>0?[{kind:"section",label:M.willBoot},...Z.map(Q)]:[]]},se=()=>[...I?[{kind:"item",label:"iOS",checked:T==="ios",onSelect:()=>I("ios")},{kind:"item",label:"Android",checked:T==="android",onSelect:()=>I("android")},{kind:"separator"}]:[],...ce()],S=(q)=>{if(q)ie()};if(B)return f(n,{ariaLabel:M.chooseDevice,entries:se,disabled:W,caret:!1,align:"end",variant:"default",size:"lg",className:"border-s-primary-foreground/20 rounded-s-none border-s px-3",onOpenChange:S,children:f(ot,{className:"size-4","aria-hidden":!0})});return Y(n,{ariaLabel:M.chooseDevice,entries:se,disabled:W,caret:!1,size:"default",className:"h-8 max-w-48 justify-start px-2 text-left",onOpenChange:S,children:[f("span",{className:"flex min-w-0 items-center gap-2",children:f("span",{className:"truncate text-[15px] font-medium",children:j??M.chooseDevice})}),f(ot,{className:"size-4 shrink-0 opacity-60","aria-hidden":!0})]})}function pt({kind:e,zoom:T,pixelWidth:M,pixelHeight:U,rotation:j,deviceRotation:I,scale:W=3,children:B,overlay:O}){let z=Le(()=>l(e,M,U),[e,M,U]),G=((I??j??0)-(j??0)+360)%360,F=G===90||G===270,V=F?1/z.aspect:z.aspect,ie=(M??1206)/W/(Number.parseFloat(z.style.width)/100),ce=(U??2622)/W/(Number.parseFloat(z.style.height)/100),se=`min(100cqh, 100cqw, ${Math.max(ie,ce)}px)`,S=T==="fit"?{height:V>1?`calc(${se} / ${V})`:se,aspectRatio:V}:(()=>{let q=(100-2*Number.parseFloat(F?z.style.left:z.style.top))/100;return{height:`${(F?M??1206:U??2622)/W*T/100/q}px`,aspectRatio:V,flexShrink:0}})();return f("div",{"data-device-screen-stage":!0,"data-device-rotation":I??j??0,"data-device-zoom":T,className:"relative m-auto",style:S,children:Y("div",{className:"absolute",style:{left:"50%",top:"50%",width:F?`${z.aspect*100}%`:"100%",height:F?`${100/z.aspect}%`:"100%",transform:`translate(-50%, -50%) rotate(${G}deg)`},children:[f("div",{className:"bg-background absolute z-0 overflow-hidden",style:z.style,children:B}),f(c,{kind:e,pixelWidth:M,pixelHeight:U,rotation:j,style:{position:"absolute",inset:0,zIndex:10,width:"100%",height:"100%",pointerEvents:"none",userSelect:"none",filter:"drop-shadow(0 2px 6px rgb(0 0 0 / 0.2)) drop-shadow(0 12px 32px rgb(0 0 0 / 0.25))"}}),O&&f("div",{className:"absolute z-20",style:z.style,children:O})]})})}function Ht({bridge:e,attachment:T,labels:M,fps:U,zoom:j,onError:I,onFps:W,onInspect:B,selectedElement:O}){let{udid:z,deviceName:G,platform:F}=T,V=r(e.nativeView,F,z,U,I,W),[ie,ce]=E(null),se=T.pixelWidth&&T.pixelHeight?{width:T.pixelWidth,height:T.pixelHeight}:null,[S,q]=E(!1),Z=Ee(null),Q=Ee(!1),_=Ee([]);X(()=>{if(U<=0||V.supported!==!1)return;let N=!1,L,J=0,ke=async()=>{if(N)return;let Oe=performance.now();try{let me=await e.captureFrame(z);if(!N&&me){if(J>0)I(null);J=0,ce(me);let we=performance.now();_.current=[..._.current.filter((Ie)=>we-Ie<2000),we],W(Math.round(_.current.length/2))}}catch(me){if(!N)J++,_.current=[],ce(null),W(0),I(ne(me))}if(N)return;L=setTimeout(()=>void ke(),J?Math.min(5000,250*2**Math.min(J,5)):Math.max(0,1000/U-(performance.now()-Oe)))};return ke(),()=>{if(N=!0,W(0),L!==void 0)clearTimeout(L)}},[e,z,U,W,I,V.supported]);let ye=i(F,G),pe=((T.deviceRotation??T.rotation??0)-(T.rotation??0)+360)%360,o=T.pointWidth??0,ee=T.pointHeight??0,ge=T.pixelWidth&&o>0?T.pixelWidth/o:void 0,de=ae((N)=>{e.gesture(z,N).then(()=>I(null),(L)=>I(ne(L)))},[e,z,I]),oe=ae(()=>{if(S)return;q(!0),e.takeOver?.(z).catch(()=>{return})},[e,z,S]),K=Le(()=>new h((N)=>e.gesture(z,N),(N)=>I(ne(N))),[e,z,I]);X(()=>()=>K.cancel(),[K]),X(()=>{if(B)Z.current=null,K.cancel()},[B,K]);let le=ae((N,L)=>{let J=m(N.currentTarget.getBoundingClientRect(),N.clientX,N.clientY,o,ee,pe);return J?L?[J,{x:o-1-J.x,y:ee-1-J.y}]:[J]:null},[o,ee,pe]),Ce=ae((N)=>{if(N.button!==0||Z.current)return;let L=le(N,N.altKey);if(!L)return;if(N.preventDefault(),B){B(L[0]);return}oe(),N.currentTarget.setPointerCapture(N.pointerId),N.currentTarget.focus({preventScroll:!0}),Z.current={mirrored:N.altKey},K.push("begin",L)},[le,oe,K,B]),Me=ae((N)=>{if(N.button!==0||!Z.current)return;let L=le(N,Z.current.mirrored);if(Z.current=null,L)K.push("end",L);else K.cancel()},[le,K]),be=ae((N)=>{if(B){N.preventDefault();return}if(N.nativeEvent.isComposing||Q.current)return;let L=p(N,F==="android"?d:u);if(!L)return;N.preventDefault(),N.stopPropagation(),oe(),de(L)},[F,de,oe,B]);return f(pt,{kind:ye,zoom:j,pixelWidth:se?.width,pixelHeight:se?.height,scale:ge,rotation:T.rotation??void 0,deviceRotation:T.deviceRotation??void 0,overlay:Y(qt,{children:[f("div",{role:"application",tabIndex:0,"aria-label":M.touchSurface,"data-device-touch-surface":!0,"data-controlling":S||void 0,title:S?M.takeOver:void 0,contentEditable:"plaintext-only",suppressContentEditableWarning:!0,spellCheck:!1,className:"h-full w-full cursor-pointer touch-none overflow-hidden text-transparent caret-transparent outline-none",onPointerDown:Ce,onPointerMove:(N)=>{if(!Z.current)return;let L=le(N,Z.current.mirrored);if(L)K.push("move",L)},onPointerUp:Me,onPointerCancel:()=>{Z.current=null,K.cancel()},onLostPointerCapture:()=>{Z.current=null,K.cancel()},onBlur:()=>{Z.current=null,K.cancel()},onKeyDown:be,onCompositionStart:()=>{Q.current=!0},onCompositionEnd:(N)=>{if(Q.current=!1,N.data&&!B)oe(),de({type:"text",value:N.data});N.currentTarget.textContent=""},onInput:(N)=>{if(!Q.current)N.currentTarget.textContent=""},onPaste:(N)=>{N.preventDefault();let L=N.clipboardData.getData("text/plain");if(L&&!B)oe(),de({type:"text",value:L})}}),O&&o>0&&ee>0&&Y("div",{className:"pointer-events-none absolute",style:{left:`${O.frame.x/o*100}%`,top:`${O.frame.y/ee*100}%`,width:`${O.frame.width/o*100}%`,height:`${O.frame.height/ee*100}%`},children:[f("div",{"data-device-overlay":!0,className:"bg-primary absolute inset-x-0 top-0 h-0.5"}),f("div",{"data-device-overlay":!0,className:"bg-primary absolute inset-x-0 bottom-0 h-0.5"}),f("div",{"data-device-overlay":!0,className:"bg-primary absolute inset-y-0 left-0 w-0.5"}),f("div",{"data-device-overlay":!0,className:"bg-primary absolute inset-y-0 right-0 w-0.5"})]})]}),children:V.supported?f("div",{ref:V.ref,"data-device-native-view":!0,"data-native-rotation":pe,className:"bg-background h-full w-full"}):ie?f("img",{src:ie,alt:t(M.liveStream,{device:G}),draggable:!1,className:"block h-full w-full bg-black object-cover select-none"}):f("div",{className:"h-full w-full bg-black"})})}function Wt({bridge:e,udid:T,labels:M,onClose:U}){let[j,I]=E([]),W=Ee(0),B=Ee(null);return X(()=>{let O=!1,z=async()=>{try{let F=await e.readLogs(T,{sinceSeq:W.current||void 0,tail:200});if(O)return;if(F.entries.length>0)W.current=F.lastSeq,I((V)=>[...V,...F.entries].slice(-500))}catch{}};z();let G=setInterval(()=>void z(),2000);return()=>{O=!0,clearInterval(G)}},[e,T]),X(()=>{B.current?.scrollTo({top:B.current.scrollHeight})},[j]),Y("div",{"data-device-logs":!0,className:"border-border flex h-[40%] shrink-0 flex-col border-t",children:[Y("div",{className:"text-muted-foreground flex h-8 shrink-0 items-center gap-2 px-3 text-xs",children:[f("span",{className:"flex-1",children:M.logsTitle}),f(ut,{variant:"ghost",size:"icon-xs","aria-label":M.closeLogs,title:M.closeLogs,onClick:U,children:f(dt,{})})]}),f("div",{ref:B,className:"min-h-0 flex-1 overflow-auto px-3 pb-2 font-mono text-[11px] leading-4",children:j.length===0?f("p",{className:"text-muted-foreground py-4 text-center",children:M.logsEmpty}):j.map((O)=>Y("div",{className:"flex gap-2 break-all whitespace-pre-wrap",children:[f("span",{className:"text-muted-foreground shrink-0",children:O.timestamp.slice(11,23)}),f("span",{className:`shrink-0 ${O.level==="error"||O.level==="fault"?"text-destructive":"text-muted-foreground"}`,children:O.level}),f("span",{children:O.message})]},O.seq))})]})}
|
|
2
|
+
export{R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R}from"../chunk-
|
|
1
|
+
import{R}from"../chunk-30kbebc6.js";import"../chunk-1r5rvxr9.js";import"../chunk-z6e1m5r3.js";import"../chunk-arw91r4t.js";import"../chunk-dv7gz9ee.js";import"../chunk-kza0t2p3.js";import"../chunk-bryvgfbf.js";import"../chunk-kr39jn06.js";import"../chunk-6m4eefxr.js";import"../chunk-34h0m6pp.js";import"../chunk-jdmxpq93.js";import"../chunk-zsk39eje.js";import"../chunk-a68z39dh.js";export{R as DevicePanel};
|
package/dist/preview/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S,i,l,c}from"../chunk-kza0t2p3.js";import"../chunk-bryvgfbf.js";import"../chunk-34h0m6pp.js";import"../chunk-6m4eefxr.js";import"../chunk-kr39jn06.js";import{N,u,d,E,z,p,m}from"../chunk-a68z39dh.js";import"../chunk-z6e1m5r3.js";import"../chunk-1r5rvxr9.js";import"../chunk-dv7gz9ee.js";import{o,s,t}from"../chunk-zsk39eje.js";import{n}from"../chunk-arw91r4t.js";import"../chunk-jdmxpq93.js";import{R}from"../chunk-
|
|
1
|
+
import{S,i,l,c}from"../chunk-kza0t2p3.js";import"../chunk-bryvgfbf.js";import"../chunk-34h0m6pp.js";import"../chunk-6m4eefxr.js";import"../chunk-kr39jn06.js";import{N,u,d,E,z,p,m}from"../chunk-a68z39dh.js";import"../chunk-z6e1m5r3.js";import"../chunk-1r5rvxr9.js";import"../chunk-dv7gz9ee.js";import{o,s,t}from"../chunk-zsk39eje.js";import{n}from"../chunk-arw91r4t.js";import"../chunk-jdmxpq93.js";import{R}from"../chunk-30kbebc6.js";import{T}from"../chunk-1y1w0srz.js";export{d as ANDROID_SHORTCUTS,c as Bezel,T as CapturePreview,R as DevicePanel,S as FRAMES,u as IOS_SHORTCUTS,N as KEY_CODES,n as MenuButton,o as deviceLocales,t as fill,i as frameKindFor,p as keyGesture,m as pointFor,E as releaseGesture,s as resolveDeviceLabels,l as screenPlacement,z as shortcutKey};
|
|
@@ -13,7 +13,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
13
13
|
- block2@0.6.2: MIT; licenses/block2-0.6.2/; source: https://raw.githubusercontent.com/madsmtm/objc2/b4167b582b2f75f9a1be75495c41b765344fd03c/LICENSE.md
|
|
14
14
|
- bytemuck@1.25.2: Zlib OR Apache-2.0 OR MIT; licenses/bytemuck-1.25.2/
|
|
15
15
|
- byteorder-lite@0.1.0: Unlicense OR MIT; licenses/byteorder-lite-0.1.0/
|
|
16
|
-
- bytes@1.12.
|
|
16
|
+
- bytes@1.12.2: MIT; licenses/bytes-1.12.2/
|
|
17
17
|
- cfg-if@1.0.5: MIT OR Apache-2.0; licenses/cfg-if-1.0.5/
|
|
18
18
|
- crc32fast@1.5.5: MIT OR Apache-2.0; licenses/crc32fast-1.5.5/
|
|
19
19
|
- dirs@7.0.0: MIT OR Apache-2.0; licenses/dirs-7.0.0/
|
|
@@ -28,12 +28,12 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
28
28
|
- flate2@1.1.11: MIT OR Apache-2.0; licenses/flate2-1.1.11/
|
|
29
29
|
- fnv@1.0.7: Apache-2.0 / MIT; licenses/fnv-1.0.7/
|
|
30
30
|
- foldhash@0.2.0: Zlib; licenses/foldhash-0.2.0/
|
|
31
|
-
- form_urlencoded@1.2.
|
|
31
|
+
- form_urlencoded@1.2.3: MIT OR Apache-2.0; licenses/form_urlencoded-1.2.3/
|
|
32
32
|
- futures-core@0.3.34: MIT OR Apache-2.0; licenses/futures-core-0.3.34/
|
|
33
33
|
- futures-sink@0.3.34: MIT OR Apache-2.0; licenses/futures-sink-0.3.34/
|
|
34
34
|
- getrandom@0.4.3: MIT OR Apache-2.0; licenses/getrandom-0.4.3/
|
|
35
35
|
- h2@0.4.20: MIT; licenses/h2-0.4.20/
|
|
36
|
-
- hashbrown@0.17.
|
|
36
|
+
- hashbrown@0.17.2: MIT OR Apache-2.0; licenses/hashbrown-0.17.2/
|
|
37
37
|
- http@1.5.0: MIT OR Apache-2.0; licenses/http-1.5.0/
|
|
38
38
|
- icu_collections@2.4.0: Unicode-3.0; licenses/icu_collections-2.4.0/
|
|
39
39
|
- icu_locale_core@2.4.0: Unicode-3.0; licenses/icu_locale_core-2.4.0/
|
|
@@ -64,7 +64,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
64
64
|
- once_cell@1.21.4: MIT OR Apache-2.0; licenses/once_cell-1.21.4/
|
|
65
65
|
- option-ext@0.2.0: MPL-2.0; licenses/option-ext-0.2.0/
|
|
66
66
|
- percent-encoding@2.3.2: MIT OR Apache-2.0; licenses/percent-encoding-2.3.2/
|
|
67
|
-
- pin-project-lite@0.2.
|
|
67
|
+
- pin-project-lite@0.2.18: Apache-2.0 OR MIT; licenses/pin-project-lite-0.2.18/
|
|
68
68
|
- png@0.18.1: MIT OR Apache-2.0; licenses/png-0.18.1/
|
|
69
69
|
- potential_utf@0.1.6: Unicode-3.0; licenses/potential_utf-0.1.6/
|
|
70
70
|
- proc-macro2@1.0.107: MIT OR Apache-2.0; licenses/proc-macro2-1.0.107/
|
|
@@ -82,7 +82,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
82
82
|
- signal-hook-registry@1.4.8: MIT OR Apache-2.0; licenses/signal-hook-registry-1.4.8/
|
|
83
83
|
- simd-adler32@0.3.10: MIT; licenses/simd-adler32-0.3.10/
|
|
84
84
|
- slab@0.4.12: MIT; licenses/slab-0.4.12/
|
|
85
|
-
- smallvec@1.16.
|
|
85
|
+
- smallvec@1.16.6: MIT OR Apache-2.0; licenses/smallvec-1.16.6/
|
|
86
86
|
- socket2@0.6.5: MIT OR Apache-2.0; licenses/socket2-0.6.5/
|
|
87
87
|
- specta@2.0.0-rc.28: MIT; licenses/specta-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
|
|
88
88
|
- specta-macros@2.0.0-rc.28: MIT; licenses/specta-macros-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
|
|
@@ -98,10 +98,10 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
98
98
|
- tracing@0.1.44: MIT; licenses/tracing-0.1.44/
|
|
99
99
|
- tracing-core@0.1.36: MIT; licenses/tracing-core-0.1.36/
|
|
100
100
|
- unicode-ident@1.0.27: (MIT OR Apache-2.0) AND Unicode-3.0; licenses/unicode-ident-1.0.27/
|
|
101
|
-
- url@2.5.
|
|
101
|
+
- url@2.5.9: MIT OR Apache-2.0; licenses/url-2.5.9/
|
|
102
102
|
- utf8_iter@1.1.0: Apache-2.0 OR MIT; licenses/utf8_iter-1.1.0/
|
|
103
103
|
- utf_types@1.0.0: Apache-2.0 OR MIT; licenses/utf_types-1.0.0/
|
|
104
|
-
- uuid@1.29.
|
|
104
|
+
- uuid@1.29.3: Apache-2.0 OR MIT; licenses/uuid-1.29.3/
|
|
105
105
|
- writeable@0.6.4: Unicode-3.0; licenses/writeable-0.6.4/
|
|
106
106
|
- yoke@0.8.4: Unicode-3.0; licenses/yoke-0.8.4/
|
|
107
107
|
- yoke-derive@0.8.4: Unicode-3.0; licenses/yoke-derive-0.8.4/
|
|
Binary file
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"abi": 1,
|
|
5
5
|
"target": "aarch64-apple-darwin",
|
|
6
6
|
"binary": "libalwith_native_device.dylib",
|
|
7
|
-
"sha256": "
|
|
7
|
+
"sha256": "d60f26aabda090d096a197b6822173109c2c104f75f8b821268c87f873750ac3",
|
|
8
8
|
"helper": {
|
|
9
9
|
"binary": "alwith-device-helper",
|
|
10
|
-
"sha256": "
|
|
10
|
+
"sha256": "82edaab6b72d37a9df7faf82c05d7c7fbb7c115dccac1a7493272daeb7135d96",
|
|
11
11
|
"revision": "c793afad2a31092628f7013cf1aa96f266c85024"
|
|
12
12
|
}
|
|
13
13
|
}
|
|
Binary file
|
|
@@ -11,7 +11,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
11
11
|
- bitflags@2.13.2: MIT OR Apache-2.0; licenses/bitflags-2.13.2/
|
|
12
12
|
- bytemuck@1.25.2: Zlib OR Apache-2.0 OR MIT; licenses/bytemuck-1.25.2/
|
|
13
13
|
- byteorder-lite@0.1.0: Unlicense OR MIT; licenses/byteorder-lite-0.1.0/
|
|
14
|
-
- bytes@1.12.
|
|
14
|
+
- bytes@1.12.2: MIT; licenses/bytes-1.12.2/
|
|
15
15
|
- cfg-if@1.0.5: MIT OR Apache-2.0; licenses/cfg-if-1.0.5/
|
|
16
16
|
- crc32fast@1.5.5: MIT OR Apache-2.0; licenses/crc32fast-1.5.5/
|
|
17
17
|
- dirs@7.0.0: MIT OR Apache-2.0; licenses/dirs-7.0.0/
|
|
@@ -24,12 +24,12 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
24
24
|
- flate2@1.1.11: MIT OR Apache-2.0; licenses/flate2-1.1.11/
|
|
25
25
|
- fnv@1.0.7: Apache-2.0 / MIT; licenses/fnv-1.0.7/
|
|
26
26
|
- foldhash@0.2.0: Zlib; licenses/foldhash-0.2.0/
|
|
27
|
-
- form_urlencoded@1.2.
|
|
27
|
+
- form_urlencoded@1.2.3: MIT OR Apache-2.0; licenses/form_urlencoded-1.2.3/
|
|
28
28
|
- futures-core@0.3.34: MIT OR Apache-2.0; licenses/futures-core-0.3.34/
|
|
29
29
|
- futures-sink@0.3.34: MIT OR Apache-2.0; licenses/futures-sink-0.3.34/
|
|
30
30
|
- getrandom@0.4.3: MIT OR Apache-2.0; licenses/getrandom-0.4.3/
|
|
31
31
|
- h2@0.4.20: MIT; licenses/h2-0.4.20/
|
|
32
|
-
- hashbrown@0.17.
|
|
32
|
+
- hashbrown@0.17.2: MIT OR Apache-2.0; licenses/hashbrown-0.17.2/
|
|
33
33
|
- http@1.5.0: MIT OR Apache-2.0; licenses/http-1.5.0/
|
|
34
34
|
- icu_collections@2.4.0: Unicode-3.0; licenses/icu_collections-2.4.0/
|
|
35
35
|
- icu_locale_core@2.4.0: Unicode-3.0; licenses/icu_locale_core-2.4.0/
|
|
@@ -55,7 +55,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
55
55
|
- once_cell@1.21.4: MIT OR Apache-2.0; licenses/once_cell-1.21.4/
|
|
56
56
|
- option-ext@0.2.0: MPL-2.0; licenses/option-ext-0.2.0/
|
|
57
57
|
- percent-encoding@2.3.2: MIT OR Apache-2.0; licenses/percent-encoding-2.3.2/
|
|
58
|
-
- pin-project-lite@0.2.
|
|
58
|
+
- pin-project-lite@0.2.18: Apache-2.0 OR MIT; licenses/pin-project-lite-0.2.18/
|
|
59
59
|
- png@0.18.1: MIT OR Apache-2.0; licenses/png-0.18.1/
|
|
60
60
|
- potential_utf@0.1.6: Unicode-3.0; licenses/potential_utf-0.1.6/
|
|
61
61
|
- proc-macro2@1.0.107: MIT OR Apache-2.0; licenses/proc-macro2-1.0.107/
|
|
@@ -71,7 +71,7 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
71
71
|
- serde_json@1.0.154: MIT OR Apache-2.0; licenses/serde_json-1.0.154/
|
|
72
72
|
- simd-adler32@0.3.10: MIT; licenses/simd-adler32-0.3.10/
|
|
73
73
|
- slab@0.4.12: MIT; licenses/slab-0.4.12/
|
|
74
|
-
- smallvec@1.16.
|
|
74
|
+
- smallvec@1.16.6: MIT OR Apache-2.0; licenses/smallvec-1.16.6/
|
|
75
75
|
- socket2@0.6.5: MIT OR Apache-2.0; licenses/socket2-0.6.5/
|
|
76
76
|
- specta@2.0.0-rc.28: MIT; licenses/specta-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
|
|
77
77
|
- specta-macros@2.0.0-rc.28: MIT; licenses/specta-macros-2.0.0-rc.28/; source: https://raw.githubusercontent.com/specta-rs/specta/82278bb5fef379b755af41b831ae3d3533e55b39/LICENSE
|
|
@@ -87,10 +87,10 @@ ALwith native implementations are proprietary. Dependencies retain their own lic
|
|
|
87
87
|
- tracing@0.1.44: MIT; licenses/tracing-0.1.44/
|
|
88
88
|
- tracing-core@0.1.36: MIT; licenses/tracing-core-0.1.36/
|
|
89
89
|
- unicode-ident@1.0.27: (MIT OR Apache-2.0) AND Unicode-3.0; licenses/unicode-ident-1.0.27/
|
|
90
|
-
- url@2.5.
|
|
90
|
+
- url@2.5.9: MIT OR Apache-2.0; licenses/url-2.5.9/
|
|
91
91
|
- utf8_iter@1.1.0: Apache-2.0 OR MIT; licenses/utf8_iter-1.1.0/
|
|
92
92
|
- utf_types@1.0.0: Apache-2.0 OR MIT; licenses/utf_types-1.0.0/
|
|
93
|
-
- uuid@1.29.
|
|
93
|
+
- uuid@1.29.3: Apache-2.0 OR MIT; licenses/uuid-1.29.3/
|
|
94
94
|
- windows-link@0.2.1: MIT OR Apache-2.0; licenses/windows-link-0.2.1/
|
|
95
95
|
- windows-sys@0.61.2: MIT OR Apache-2.0; licenses/windows-sys-0.61.2/
|
|
96
96
|
- writeable@0.6.4: Unicode-3.0; licenses/writeable-0.6.4/
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwith/module-device",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"files": [
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "bun ../../scripts/build-npm.ts",
|
|
35
35
|
"prepack": "bun run build && bun ../../scripts/verify-module-package.ts device",
|
|
36
|
-
"test": "bun test src",
|
|
36
|
+
"test": "bun test --parallel=4 ./src",
|
|
37
37
|
"test:rust": "cargo test --manifest-path rust/Cargo.toml"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@nyssance/shadcn": "^4.23.4",
|
|
41
|
-
"lucide-react": "^1.
|
|
41
|
+
"lucide-react": "^1.77.0",
|
|
42
42
|
"sonner": "^2.0.8"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
package/dist/chunk-36wzsv9q.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{k}from"./chunk-bryvgfbf.js";import{i,l,c}from"./chunk-kza0t2p3.js";import{r}from"./chunk-34h0m6pp.js";import{D}from"./chunk-kr39jn06.js";import{u,d,p,m}from"./chunk-a68z39dh.js";import{b,w,x}from"./chunk-z6e1m5r3.js";import{g,y}from"./chunk-1r5rvxr9.js";import{h}from"./chunk-dv7gz9ee.js";import{s,t}from"./chunk-zsk39eje.js";import{n}from"./chunk-arw91r4t.js";import{A,C}from"./chunk-jdmxpq93.js";import{Camera as Dt,ChevronDown as ot,History as Nt,Home as Pt,Images as Tt,Maximize2 as Et,Minimize2 as Ct,RotateCw as Mt,ScanSearch as Rt,Square as zt,SquareTerminal as At,Video as Bt,X as dt}from"lucide-react";import{useCallback as te,useEffect as X,useMemo as Le,useRef as Ee,useState as E}from"react";import{toast as Ve}from"sonner";import{Button as ut}from"@nyssance/shadcn/vega/components/ui/button";import{Tooltip as Lt,TooltipContent as Ot,TooltipProvider as It,TooltipTrigger as Ft}from"@nyssance/shadcn/vega/components/ui/tooltip";import{jsx as f,jsxs as Y,Fragment as qt}from"react/jsx-runtime";var ve=[25,33,50,66,75,100,125,150,200],lt=(e)=>`alwith-device:consent:${e}`,$t={read:(e)=>Promise.resolve(rt(()=>localStorage.getItem(lt(e))==="granted")??!1),write:(e,T)=>Promise.resolve(rt(()=>localStorage.setItem(lt(e),T?"granted":"denied"))??void 0)};function rt(e){try{return e()}catch{return null}}function re(e){let T=e instanceof Error?e.message:String(e);try{let M=JSON.parse(T);if(typeof M==="object"&&M!==null&&"message"in M&&typeof M.message==="string")return M.message}catch{}return T}function R({bridge:e,onAddContext:T,onAddCapture:M,platform:U="ios",udid:j,initialDeviceId:I,onDeviceChange:H,language:B,agentName:O="AI",pollFps:z=60,maximized:G=!1,onMaximize:F,windowAction:V,windowGrip:ne,onClose:ce,className:ae}){let S=Le(()=>s(B),[B]),[W,q]=E(U),[Q,_]=E(I??null),[ye,pe]=E([]);X(()=>e.subscribe(pe,(a)=>oe(re(a))),[e]);let o=Le(()=>ye.find((a)=>a.udid===(j??Q))??(j?void 0:ye.reduce((a,v)=>!a||v.attachedAt>a.attachedAt?v:a,void 0)),[ye,j,Q]);X(()=>{if(o?.platform==="ios"||o?.platform==="android")q(o.platform)},[o?.platform]);let[ee,ge]=E(null);X(()=>{let a=!1;if(ge(null),o&&e.capabilities)e.capabilities(o.udid).then((v)=>{if(!a)ge(v)}).catch((v)=>{if(!a)oe(re(v))});return()=>{a=!0}},[o?.udid,e]);let[de,ie]=E("fit"),[Z,se]=E(!1),[Ce,Me]=E(null);X(()=>{if(!e.monitorDensity)return;let a=!1,v,P=async()=>{try{let K=await e.monitorDensity();if(!a)Me(K)}catch(K){if(!a)Me(null),oe(re(K))}if(!a)v=setTimeout(()=>void P(),1000)};return P(),()=>{a=!0,clearTimeout(v)}},[e]);let be=ee?.densityDpi&&Ce&&o?.pointWidth&&o?.pixelWidth?100*Ce*o.pixelWidth/o.pointWidth/ee.densityDpi:null,N=Z&&be?be:de,[L,J]=E(z),[ke,Oe]=E(0),[me,we]=E(!1),[Ie,je]=E(!1),[Ge,xe]=E(!1),[_e,Se]=E(!1),[Xe,De]=E(!1),[mt,Je]=E(0),[fe,he]=E(!1),[Fe,$e]=E([]),[Re,Ne]=E(null),[Pe,ze]=E([]),[He,Ye]=E(!1),[ft,Qe]=E(null),[ht,vt]=E(0);X(()=>{he(!1),Ne(null),$e([]),ze([])},[o?.udid]),X(()=>{if(!fe||!o||!e.inspect)return;let a=!1;Ye(!0),Qe(null),Ne(null),ze([]);let v=setTimeout(()=>{e.inspect(o.udid).then((P)=>{if(a)return;$e(b(P,o.platform))}).catch((P)=>{if(!a)$e([]),Qe(re(P))}).finally(()=>{if(!a)Ye(!1)})},150);return()=>{a=!0,clearTimeout(v)}},[fe,o?.udid,o?.platform,o?.inputRevision,o?.rotation,e,ht]);let yt=te((a)=>{if(He)return;let v=w(Fe,a);ze(v),Ne(v[0]??null)},[Fe,He]),[et,oe]=E(null);X(()=>oe(null),[o?.udid]),X(()=>{H?.(o?.udid)},[o?.udid,H]);let[We,Ae]=E(null),[Te,qe]=E(null),[gt,tt]=E(null),[nt,Ze]=E(null),[at,it]=E("live"),Ke=e.consent??$t,ue=te((a)=>{oe(null),a().catch((v)=>oe(re(v)))},[]),Be=te(async(a)=>{Ae(a&&!a.running?"booting":"attaching"),oe(null);try{let v=await e.attach(a?.id,a?.platform??W);return _(v.udid),pe((P)=>[...P.filter((K)=>K.udid!==v.udid),v]),tt(null),v}catch(v){let P=re(v);if(a&&/no simulator|not available|不可用|No device/i.test(P))tt(a.name);return oe(P),null}finally{Ae(null)}},[e,W]),Ue=te(async(a)=>{let v=a;if(!v){let P=await e.listDevices(W);if(v=P.find((K)=>K.running)??P[0],!v){oe(S.noSimulators);return}}if(await Ke.read(v.id))await Be(v);else qe(v)},[e,W,Ke,Be,S.noSimulators]);X(()=>{if(!o||!e.appearance)return;let a=!1;return e.appearance(o.udid).then((v)=>{if(!a)Ze(v)}).catch(()=>{return}),()=>{a=!0}},[e,o]);let bt=f(ct,{bridge:e,platform:W,labels:S,current:o?.udid,currentName:o?.deviceName,onPlatformChange:q,disabled:We!==null,onPick:(a)=>{if(o&&a.id!==o.udid)ue(async()=>{if(await Be(a))await e.detach(o.udid)});else if(!o)ue(()=>Ue(a))}}),kt=[{kind:"item",label:S.undo,disabled:!0,hint:S.inputUnavailable},{kind:"item",label:S.redo,disabled:!0},{kind:"separator"},{kind:"item",label:S.cut,disabled:!0},{kind:"item",label:S.copy,disabled:!0},{kind:"item",label:S.paste,disabled:!0},{kind:"item",label:S.selectAll,disabled:!0},{kind:"item",label:S.delete,disabled:!0}],wt=()=>{let a=o,v=(P)=>()=>{if(a)ue(()=>P(a))};return[{kind:"section",label:S.appearance},{kind:"item",label:S.light,checked:nt==="light",disabled:!a||!e.setAppearance,onSelect:v(async(P)=>{await e.setAppearance?.(P.udid,"light"),Ze("light")})},{kind:"item",label:S.dark,checked:nt==="dark",disabled:!a||!e.setAppearance,onSelect:v(async(P)=>{await e.setAppearance?.(P.udid,"dark"),Ze("dark")})},...ee?.hingeAngle!=null?[{kind:"section",label:B?.startsWith("zh")?"折叠角度":"Hinge angle"},...[0,90,180].map((P)=>({kind:"item",label:`${P}°`,checked:Math.abs(ee.hingeAngle-P)<0.5,onSelect:v(async(K)=>{await e.gesture(K.udid,{type:"hinge",angle:P}),ge(await e.capabilities(K.udid))})}))]:[],{kind:"section",label:S.statusBar},{kind:"item",label:S.statusLive,checked:at==="live",disabled:!a||!e.setStatusBar,onSelect:v(async(P)=>{await e.setStatusBar?.(P.udid,"live"),it("live")})},{kind:"item",label:S.statusShowcase,checked:at==="showcase",disabled:!a||!e.setStatusBar,onSelect:v(async(P)=>{await e.setStatusBar?.(P.udid,"showcase"),it("showcase")})},{kind:"separator"},{kind:"item",label:S.restart,disabled:!a||!e.restart,onSelect:v(async(P)=>{Ae("booting");try{await e.restart?.(P.udid),await e.attach(P.udid,P.platform)}finally{Ae(null)}})},{kind:"item",label:S.shutdown,disabled:!a||!e.shutdown,onSelect:v((P)=>e.shutdown(P.udid))},{kind:"separator"},{kind:"item",label:S.detach,disabled:!a,onSelect:v((P)=>e.detach(P.udid))}]},st=(a)=>(se(!1),ie((v)=>{let P=v==="fit"?100:v,K=ve.findIndex((St)=>St>=P);return(a>0?ve[Math.min(ve.length-1,(K===-1?ve.length-1:K)+1)]:ve[Math.max(0,(K===-1?ve.length:K)-1)])??v})),xt=()=>[...V?[{kind:"item",...V}]:[],{kind:"item",label:S.zoomIn,onSelect:()=>st(1),hint:"⌘+"},{kind:"item",label:S.zoomOut,onSelect:()=>st(-1),hint:"⌘−"},{kind:"item",label:S.zoomFit,checked:!Z&&de==="fit",onSelect:()=>{se(!1),ie("fit")}},{kind:"item",label:S.actualSize,checked:!Z&&de===100,onSelect:()=>{se(!1),ie(100)},hint:"⌘0"},{kind:"item",label:B?.startsWith("zh")?"物理尺寸":"Physical size",disabled:be===null,checked:Z,onSelect:()=>se(!0)},{kind:"section",label:S.frameRate},...[15,30,60].map((a)=>({kind:"item",label:`${a} FPS`,checked:L===a,onSelect:()=>J(a)}))],le=(a,v,P,K)=>Y(Lt,{children:[f(Ft,{render:f(ut,{variant:"ghost",size:"icon-sm","aria-label":a,"aria-pressed":K?.pressed,disabled:K?.disabled,onClick:P,className:"aria-pressed:bg-muted"}),children:v}),f(Ot,{children:a})]});return f(It,{children:Y("div",{"data-device-panel":!0,className:`bg-background text-foreground flex h-full min-h-0 flex-col ${ae??""}`,children:[Y("div",{"data-device-menubar":!0,className:"border-border flex h-10 shrink-0 items-center gap-0.5 overflow-x-auto border-b px-2 whitespace-nowrap",children:[ne,bt,f(n,{label:S.menuEdit,entries:kt}),f(n,{label:S.menuDevice,entries:wt}),f(n,{label:S.menuView,entries:xt}),f("span",{className:"flex-1"}),o&&f("span",{className:"text-muted-foreground mx-1 text-xs tabular-nums",children:ke>0?t(S.fpsValue,{fps:ke}):S.fpsIdle}),F&&le(G?S.collapse:S.expand,G?f(Ct,{}):f(Et,{}),F,{pressed:G}),ce&&le(S.close,f(dt,{}),ce)]}),et&&f("p",{role:"alert",className:"border-border text-destructive shrink-0 border-b px-3 py-1.5 text-xs",children:et}),Y("div",{className:"flex min-h-0 min-w-0 flex-1",children:[f("div",{"data-device-stage":!0,className:`[container-type:size] flex min-h-0 min-w-0 flex-1 items-start justify-start p-4 ${de==="fit"?"overflow-hidden":"overflow-auto"}`,children:o?f(Ht,{bridge:e,attachment:o,labels:S,fps:L,zoom:N,onError:oe,onFps:Oe,onInspect:fe?yt:void 0,selectedElement:fe?Re:null},o.udid):f(pt,{kind:i(W,Te?.name??"iPhone"),zoom:N,children:Te?f(C,{labels:S,agent:O,deviceName:Te.name,systemVersion:Te.systemVersion,onCancel:()=>qe(null),onContinue:()=>{let a=Te;qe(null),ue(async()=>{await Ke.write(a.id,!0),await Be(a)})}}):f(A,{labels:S,agent:O,unavailableDevice:gt,busy:We,error:null,onAttach:()=>void Ue(void 0),picker:f(ct,{bridge:e,platform:W,labels:S,disabled:We!==null,compact:!0,onPick:(a)=>void Ue(a)})})})}),Xe&&e.listCaptures&&e.captureUrl&&f(D,{bridge:e,language:B,revision:mt,onClose:()=>De(!1),onAdd:M}),fe&&o&&f(y,{elements:Fe,selected:Re,loading:He,error:ft,language:B,onSelect:(a)=>{Ne(a),ze([a])},onRefresh:()=>vt((a)=>a+1),onClose:()=>he(!1),onCycle:(a)=>{if(Pe.length&&Re)Ne(Pe[(Pe.indexOf(Re)+a+Pe.length)%Pe.length])},onCopy:(a)=>e.copyText?e.copyText(a):navigator.clipboard.writeText(a),onAdd:T?async(a,v)=>{await T(x(o.deviceName,o.platform,a,v))}:void 0},o.udid)]}),f("div",{"data-device-toolbar":!0,className:"flex shrink-0 justify-center py-3",children:Y("div",{className:"inline-flex items-center gap-0.5",children:[le(S.home,f(Pt,{className:"size-4"}),()=>o&&ue(()=>e.gesture(o.udid,{type:"button",name:"HOME"})),{disabled:!o}),le(S.rotate,f(Mt,{className:"size-4"}),()=>o&&ue(()=>e.gesture(o.udid,{type:"rotate",direction:"right"})),{disabled:!o}),le(S.screenshot,f(Dt,{className:"size-4"}),()=>o&&ue(async()=>{je(!0);try{let a;if(e.saveScreenshot)a=await e.saveScreenshot(o.udid,"");else{let v=await e.captureFrame(o.udid);if(!v)throw Error("Device did not produce a frame");let P=document.createElement("a");P.href=v,P.download=`${o.deviceName}-${Date.now()}.${v.startsWith("data:image/jpeg")?"jpg":"png"}`,P.click(),a=P.download}if(a)Je((v)=>v+1),Ve.success(t(S.screenshotSaved,{path:a}))}finally{je(!1)}}),{disabled:!o||Ie}),le(o?.recordingPath?S.stopRecording:S.record,o?.recordingPath?f(zt,{className:"size-4"}):f(Bt,{className:"size-4"}),()=>o&&ue(async()=>{we(!0);try{if(o.recordingPath){let a=await e.stopRecording(o.udid);Je((v)=>v+1),Ve.success(t(S.recordingSaved,{path:a}))}else await e.startRecording(o.udid),Ve.success(S.recordingStarted)}finally{we(!1)}}),{disabled:!o||me||!e.startRecording||!e.stopRecording,pressed:!!o?.recordingPath}),le(g(B).inspect,f(Rt,{}),()=>{he((a)=>!a),xe(!1),Se(!1),De(!1)},{disabled:!o||!e.inspect||!!o.recordingPath,pressed:fe}),le(B?.startsWith("zh")?"操作历史":"Activity",f(Nt,{}),()=>{Se((a)=>!a),xe(!1),he(!1),De(!1)},{disabled:!e.readActivity,pressed:_e}),le(B?.startsWith("zh")?"设备素材":"Captures",f(Tt,{}),()=>{De((a)=>!a),xe(!1),he(!1),Se(!1)},{disabled:!e.listCaptures||!e.captureUrl,pressed:Xe}),le(S.logs,f(At,{className:"size-4"}),()=>{xe((a)=>!a),he(!1),Se(!1),De(!1)},{disabled:!o||!e.readLogs,pressed:Ge})]})}),_e&&e.readActivity&&f(k,{bridge:e,language:B,onClose:()=>Se(!1)}),Ge&&o&&e.readLogs&&f(Wt,{bridge:e,udid:o.udid,labels:S,onClose:()=>xe(!1)})]})})}function ct({bridge:e,platform:T,labels:M,current:U,currentName:j,onPlatformChange:I,disabled:H,compact:B,onPick:O}){let[z,G]=E(null),[F,V]=E(null),ne=te(()=>{G(null),V(null),e.listDevices(T).then(G).catch((W)=>V(re(W)))},[e,T]);X(()=>{ne()},[ne]);let ce=()=>{if(F)return[{kind:"item",label:F,disabled:!0}];if(z===null)return[{kind:"item",label:M.loadingDevices,disabled:!0}];if(z.length===0)return[{kind:"item",label:M.noSimulators,disabled:!0}];let W=z.filter((_)=>_.running),q=z.filter((_)=>!_.running),Q=(_)=>({kind:"item",label:_.name,hint:_.systemVersion,checked:U===void 0?void 0:_.id===U,onSelect:()=>O(_)});return[...W.length>0?[{kind:"section",label:M.booted},...W.map(Q)]:[],...q.length>0?[{kind:"section",label:M.willBoot},...q.map(Q)]:[]]},ae=()=>[...I?[{kind:"item",label:"iOS",checked:T==="ios",onSelect:()=>I("ios")},{kind:"item",label:"Android",checked:T==="android",onSelect:()=>I("android")},{kind:"separator"}]:[],...ce()],S=(W)=>{if(W)ne()};if(B)return f(n,{ariaLabel:M.chooseDevice,entries:ae,disabled:H,caret:!1,align:"end",variant:"default",size:"lg",className:"border-s-primary-foreground/20 rounded-s-none border-s px-3",onOpenChange:S,children:f(ot,{className:"size-4","aria-hidden":!0})});return Y(n,{ariaLabel:M.chooseDevice,entries:ae,disabled:H,caret:!1,size:"default",className:"h-8 max-w-48 justify-start px-2 text-left",onOpenChange:S,children:[f("span",{className:"flex min-w-0 items-center gap-2",children:f("span",{className:"truncate text-[15px] font-medium",children:j??M.chooseDevice})}),f(ot,{className:"size-4 shrink-0 opacity-60","aria-hidden":!0})]})}function pt({kind:e,zoom:T,pixelWidth:M,pixelHeight:U,rotation:j,deviceRotation:I,scale:H=3,children:B,overlay:O}){let z=Le(()=>l(e,M,U),[e,M,U]),G=((I??j??0)-(j??0)+360)%360,F=G===90||G===270,V=F?1/z.aspect:z.aspect,ne=(M??1206)/H/(Number.parseFloat(z.style.width)/100),ce=(U??2622)/H/(Number.parseFloat(z.style.height)/100),ae=`min(100cqh, 100cqw, ${Math.max(ne,ce)}px)`,S=T==="fit"?{height:V>1?`calc(${ae} / ${V})`:ae,aspectRatio:V}:(()=>{let W=(100-2*Number.parseFloat(F?z.style.left:z.style.top))/100;return{height:`${(F?M??1206:U??2622)/H*T/100/W}px`,aspectRatio:V,flexShrink:0}})();return f("div",{"data-device-screen-stage":!0,"data-device-rotation":I??j??0,"data-device-zoom":T,className:"relative m-auto",style:S,children:Y("div",{className:"absolute",style:{left:"50%",top:"50%",width:F?`${z.aspect*100}%`:"100%",height:F?`${100/z.aspect}%`:"100%",transform:`translate(-50%, -50%) rotate(${G}deg)`},children:[f("div",{className:"bg-background absolute z-0 overflow-hidden",style:z.style,children:B}),f(c,{kind:e,pixelWidth:M,pixelHeight:U,rotation:j,style:{position:"absolute",inset:0,zIndex:10,width:"100%",height:"100%",pointerEvents:"none",userSelect:"none",filter:"drop-shadow(0 2px 6px rgb(0 0 0 / 0.2)) drop-shadow(0 12px 32px rgb(0 0 0 / 0.25))"}}),O&&f("div",{className:"absolute z-20",style:z.style,children:O})]})})}function Ht({bridge:e,attachment:T,labels:M,fps:U,zoom:j,onError:I,onFps:H,onInspect:B,selectedElement:O}){let{udid:z,deviceName:G,platform:F}=T,V=r(e.nativeView,F,z,U,I,H),[ne,ce]=E(null),ae=T.pixelWidth&&T.pixelHeight?{width:T.pixelWidth,height:T.pixelHeight}:null,[S,W]=E(!1),q=Ee(null),Q=Ee(!1),_=Ee([]);X(()=>{if(U<=0||V.supported!==!1)return;let N=!1,L,J=0,ke=async()=>{if(N)return;let Oe=performance.now();try{let me=await e.captureFrame(z);if(!N&&me){if(J>0)I(null);J=0,ce(me);let we=performance.now();_.current=[..._.current.filter((Ie)=>we-Ie<2000),we],H(Math.round(_.current.length/2))}}catch(me){if(!N)J++,_.current=[],ce(null),H(0),I(re(me))}if(N)return;L=setTimeout(()=>void ke(),J?Math.min(5000,250*2**Math.min(J,5)):Math.max(0,1000/U-(performance.now()-Oe)))};return ke(),()=>{if(N=!0,H(0),L!==void 0)clearTimeout(L)}},[e,z,U,H,I,V.supported]);let ye=i(F,G),pe=((T.deviceRotation??T.rotation??0)-(T.rotation??0)+360)%360,o=T.pointWidth??0,ee=T.pointHeight??0,ge=T.pixelWidth&&o>0?T.pixelWidth/o:void 0,de=te((N)=>{e.gesture(z,N).then(()=>I(null),(L)=>I(re(L)))},[e,z,I]),ie=te(()=>{if(S)return;W(!0),e.takeOver?.(z).catch(()=>{return})},[e,z,S]),Z=Le(()=>new h((N)=>e.gesture(z,N),(N)=>I(re(N))),[e,z,I]);X(()=>()=>Z.cancel(),[Z]),X(()=>{if(B)q.current=null,Z.cancel()},[B,Z]);let se=te((N,L)=>{let J=m(N.currentTarget.getBoundingClientRect(),N.clientX,N.clientY,o,ee,pe);return J?L?[J,{x:o-1-J.x,y:ee-1-J.y}]:[J]:null},[o,ee,pe]),Ce=te((N)=>{if(N.button!==0||q.current)return;let L=se(N,N.altKey);if(!L)return;if(N.preventDefault(),B){B(L[0]);return}ie(),N.currentTarget.setPointerCapture(N.pointerId),N.currentTarget.focus({preventScroll:!0}),q.current={mirrored:N.altKey},Z.push("begin",L)},[se,ie,Z,B]),Me=te((N)=>{if(N.button!==0||!q.current)return;let L=se(N,q.current.mirrored);if(q.current=null,L)Z.push("end",L);else Z.cancel()},[se,Z]),be=te((N)=>{if(B){N.preventDefault();return}if(N.nativeEvent.isComposing||Q.current)return;let L=p(N,F==="android"?d:u);if(!L)return;N.preventDefault(),N.stopPropagation(),ie(),de(L)},[F,de,ie,B]);return f(pt,{kind:ye,zoom:j,pixelWidth:ae?.width,pixelHeight:ae?.height,scale:ge,rotation:T.rotation??void 0,deviceRotation:T.deviceRotation??void 0,overlay:Y(qt,{children:[f("div",{role:"application",tabIndex:0,"aria-label":M.touchSurface,"data-device-touch-surface":!0,"data-controlling":S||void 0,title:S?M.takeOver:void 0,contentEditable:"plaintext-only",suppressContentEditableWarning:!0,spellCheck:!1,className:"h-full w-full cursor-pointer touch-none overflow-hidden text-transparent caret-transparent outline-none",onPointerDown:Ce,onPointerMove:(N)=>{if(!q.current)return;let L=se(N,q.current.mirrored);if(L)Z.push("move",L)},onPointerUp:Me,onPointerCancel:()=>{q.current=null,Z.cancel()},onLostPointerCapture:()=>{q.current=null,Z.cancel()},onBlur:()=>{q.current=null,Z.cancel()},onKeyDown:be,onCompositionStart:()=>{Q.current=!0},onCompositionEnd:(N)=>{if(Q.current=!1,N.data&&!B)ie(),de({type:"text",value:N.data});N.currentTarget.textContent=""},onInput:(N)=>{if(!Q.current)N.currentTarget.textContent=""},onPaste:(N)=>{N.preventDefault();let L=N.clipboardData.getData("text/plain");if(L&&!B)ie(),de({type:"text",value:L})}}),O&&o>0&&ee>0&&Y("div",{className:"pointer-events-none absolute",style:{left:`${O.frame.x/o*100}%`,top:`${O.frame.y/ee*100}%`,width:`${O.frame.width/o*100}%`,height:`${O.frame.height/ee*100}%`},children:[f("div",{"data-device-overlay":!0,className:"bg-primary absolute inset-x-0 top-0 h-0.5"}),f("div",{"data-device-overlay":!0,className:"bg-primary absolute inset-x-0 bottom-0 h-0.5"}),f("div",{"data-device-overlay":!0,className:"bg-primary absolute inset-y-0 left-0 w-0.5"}),f("div",{"data-device-overlay":!0,className:"bg-primary absolute inset-y-0 right-0 w-0.5"})]})]}),children:V.supported?f("div",{ref:V.ref,"data-device-native-view":!0,"data-native-rotation":pe,className:"bg-background h-full w-full"}):ne?f("img",{src:ne,alt:t(M.liveStream,{device:G}),draggable:!1,className:"block h-full w-full bg-black object-cover select-none"}):f("div",{className:"h-full w-full bg-black"})})}function Wt({bridge:e,udid:T,labels:M,onClose:U}){let[j,I]=E([]),H=Ee(0),B=Ee(null);return X(()=>{let O=!1,z=async()=>{try{let F=await e.readLogs(T,{sinceSeq:H.current||void 0,tail:200});if(O)return;if(F.entries.length>0)H.current=F.lastSeq,I((V)=>[...V,...F.entries].slice(-500))}catch{}};z();let G=setInterval(()=>void z(),2000);return()=>{O=!0,clearInterval(G)}},[e,T]),X(()=>{B.current?.scrollTo({top:B.current.scrollHeight})},[j]),Y("div",{"data-device-logs":!0,className:"border-border flex h-[40%] shrink-0 flex-col border-t",children:[Y("div",{className:"text-muted-foreground flex h-8 shrink-0 items-center gap-2 px-3 text-xs",children:[f("span",{className:"flex-1",children:M.logsTitle}),f(ut,{variant:"ghost",size:"icon-xs","aria-label":M.closeLogs,title:M.closeLogs,onClick:U,children:f(dt,{})})]}),f("div",{ref:B,className:"min-h-0 flex-1 overflow-auto px-3 pb-2 font-mono text-[11px] leading-4",children:j.length===0?f("p",{className:"text-muted-foreground py-4 text-center",children:M.logsEmpty}):j.map((O)=>Y("div",{className:"flex gap-2 break-all whitespace-pre-wrap",children:[f("span",{className:"text-muted-foreground shrink-0",children:O.timestamp.slice(11,23)}),f("span",{className:`shrink-0 ${O.level==="error"||O.level==="fault"?"text-destructive":"text-muted-foreground"}`,children:O.level}),f("span",{children:O.message})]},O.seq))})]})}
|
|
2
|
-
export{R};
|
|
File without changes
|
/package/native/darwin-arm64/licenses/{form_urlencoded-1.2.2 → form_urlencoded-1.2.3}/LICENSE-APACHE
RENAMED
|
File without changes
|
/package/native/darwin-arm64/licenses/{form_urlencoded-1.2.2 → form_urlencoded-1.2.3}/LICENSE-MIT
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/native/win32-x64/licenses/{form_urlencoded-1.2.2 → form_urlencoded-1.2.3}/LICENSE-APACHE
RENAMED
|
File without changes
|
/package/native/win32-x64/licenses/{form_urlencoded-1.2.2 → form_urlencoded-1.2.3}/LICENSE-MIT
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/native/win32-x64/licenses/{pin-project-lite-0.2.17 → pin-project-lite-0.2.18}/LICENSE-MIT
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|