@alwith/module-device 0.5.0 → 0.5.1
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-jfm7e0rj.js → chunk-ek1jm29t.js} +2 -2
- package/dist/{chunk-7670k67t.js → chunk-fj7w5b36.js} +2 -2
- package/dist/{chunk-bte1b035.js → chunk-m6q76fpn.js} +1 -1
- package/dist/chunk-wfcd0qt8.js +2 -0
- package/dist/preview/bezel.js +1 -1
- package/dist/preview/device-panel.js +1 -1
- package/dist/preview/gestures.js +1 -1
- package/dist/preview/index.js +1 -1
- package/dist/preview/screens.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-0pxm29yj.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-brbw9wqh.js";import{Button as r}from"@nyssance/shadcn/vega/components/ui/button";import{CircleCheck as
|
|
2
|
-
export{
|
|
1
|
+
import{e}from"./chunk-brbw9wqh.js";import{Button as r}from"@nyssance/shadcn/vega/components/ui/button";import{CircleCheck as u,Eye as f,Info as v,Settings2 as h,Smartphone as N,UserRound as b}from"lucide-react";import{jsx as t,jsxs as a}from"react/jsx-runtime";function p({labels:n,agent:i,unavailableDevice:o,busy:s,error:l,onAttach:c,picker:d}){return a("div",{"data-device-attach-screen":!0,className:"bg-background text-foreground flex h-full min-h-0 flex-col text-center",children:[a("div",{className:"flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-5 pt-[22%]",children:[t("h2",{className:"text-[22px] leading-tight font-semibold text-balance",children:e(n.attachTitle,{agent:i})}),t("p",{className:"text-muted-foreground mt-3 text-sm text-balance",children:e(n.attachBody,{agent:i})}),a("div",{className:"bg-muted mt-6 flex w-full items-center gap-3 rounded-xl px-4 py-3 text-left text-sm",children:[t(u,{className:"size-5 shrink-0 text-emerald-500","aria-hidden":!0}),t("span",{children:n.xcodeInstalled})]}),o&&a("div",{className:"border-border mt-3 flex w-full items-start gap-3 rounded-xl border px-4 py-3 text-left text-sm",children:[t(v,{className:"text-muted-foreground mt-0.5 size-5 shrink-0","aria-hidden":!0}),t("span",{children:e(n.unavailable,{device:o})})]}),l&&t("p",{role:"alert",className:"text-destructive mt-3 w-full text-left text-xs",children:l})]}),a("div",{className:"w-full shrink-0 px-5 pb-6",children:[t("p",{className:"text-muted-foreground mb-4 text-[11px]",children:n.trademark}),a("div",{className:"flex w-full","data-slot":"button-group",children:[t(r,{size:"lg",className:"flex-1 rounded-e-none",disabled:s!==null,onClick:c,children:s==="booting"?n.booting:s==="attaching"?n.attaching:n.attach}),d]})]})]})}function g({labels:n,agent:i,deviceName:o,systemVersion:s,onCancel:l,onContinue:c}){let d=[{icon:f,text:n.consentScreen},{icon:b,text:n.consentAccounts},{icon:h,text:n.consentSettings}];return a("div",{"data-device-consent-screen":!0,className:"bg-background text-foreground flex h-full min-h-0 flex-col text-center",children:[a("div",{className:"flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-5 pt-[10%]",children:[t("h2",{className:"text-[22px] leading-tight font-semibold text-balance",children:e(n.consentTitle,{agent:i})}),a("span",{className:"bg-muted mt-4 inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium",children:[t(N,{className:"size-4","aria-hidden":!0}),o," · ",s]}),t("p",{className:"text-muted-foreground mt-5 text-sm text-balance",children:e(n.consentBody,{agent:i})}),t("p",{className:"text-muted-foreground mt-3 text-sm text-balance",children:n.consentRetention}),t("div",{className:"mt-4 flex w-full flex-col gap-2 pb-4",children:d.map(({icon:x,text:m})=>a("div",{className:"bg-muted flex items-start gap-3 rounded-xl px-3 py-3 text-left text-[13px] leading-snug",children:[t(x,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),t("span",{children:m})]},m))})]}),a("div",{className:"flex w-full shrink-0 gap-3 px-5 pt-2 pb-6",children:[t(r,{variant:"outline",size:"lg",className:"flex-1",onClick:l,children:n.cancel}),t(r,{size:"lg",className:"flex-1",onClick:c,children:n.continue})]})]})}
|
|
2
|
+
export{p,g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
export{
|
|
1
|
+
var h={Enter:40,Backspace:42,ArrowRight:79,ArrowLeft:80,ArrowDown:81,ArrowUp:82,Delete:76,Home:74,End:77,PageUp:75,PageDown:78},l={"meta+shift+h":{type:"button",name:"HOME"},"meta+l":{type:"button",name:"LOCK"},"ctrl+meta+z":{type:"shake"},"meta+shift+a":{type:"toggleAppearance"}},c={"meta+shift+h":{type:"button",name:"HOME"},"meta+shift+b":{type:"button",name:"BACK"},"meta+shift+r":{type:"button",name:"RECENTS"},"meta+l":{type:"button",name:"LOCK"},"meta+shift+a":{type:"toggleAppearance"}};function d(e,t){let n=t.t-e.t;if(Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY)<6)return n>=500?{type:"longPress",x:e.x,y:e.y,duration:n/1000}:{type:"tap",x:e.x,y:e.y};return{type:"swipe",x1:e.x,y1:e.y,x2:t.x,y2:t.y,duration:Math.max(0.1,n/1000)}}function v(e){return[e.altKey&&"alt",e.ctrlKey&&"ctrl",e.metaKey&&"meta",e.shiftKey&&"shift",e.key.toLowerCase()].filter(Boolean).join("+")}function u(e,t){if(e.metaKey||e.ctrlKey)return t[v(e)]??null;let n=h[e.key];if(n!==void 0)return{type:"key",code:n};return e.key.length===1?{type:"text",value:e.key}:null}function i(e,t,n,r,o){if(e.width===0||e.height===0)return null;return{x:Math.round((t-e.left)/e.width*r),y:Math.round((n-e.top)/e.height*o)}}
|
|
2
|
+
export{h,l,c,d,v,u,i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i,d,u}from"./chunk-0pxm29yj.js";import{s,r,l,c,o}from"./chunk-7670k67t.js";import{a,e}from"./chunk-brbw9wqh.js";import{t}from"./chunk-6acejx53.js";import{m,p}from"./chunk-jfm7e0rj.js";import{Button as be}from"@nyssance/shadcn/vega/components/ui/button";import{Tooltip as Pe,TooltipContent as ze,TooltipProvider as Te,TooltipTrigger as Ee}from"@nyssance/shadcn/vega/components/ui/tooltip";import{Camera as Me,ChevronDown as fe,Home as Ce,Maximize2 as Le,Minimize2 as Be,RotateCw as Fe,Scan as Ie,SquareTerminal as Re,Video as Oe,X as ke,ZoomIn as Ae,ZoomOut as He}from"lucide-react";import{useCallback as X,useEffect as ee,useMemo as me,useRef as ce,useState as E}from"react";import{jsx as g,jsxs as H}from"react/jsx-runtime";var Q=[25,33,50,66,75,100,125,150,200];function Ze(n,x){if(n==="android")return 1;return x.toLowerCase().includes("ipad")?2:3}var he=(n)=>`alwith-device:consent:${n}`,$e={read:(n)=>Promise.resolve(ge(()=>localStorage.getItem(he(n))==="granted")??!1),write:(n,x)=>Promise.resolve(ge(()=>localStorage.setItem(he(n),x?"granted":"denied"))??void 0)};function ge(n){try{return n()}catch{return null}}function pe(n){return n instanceof Error?n.message:String(n)}function f({bridge:n,platform:x="ios",udid:N,language:z,agentName:B="AI",pollFps:Z=4,maximized:M=!1,onMaximize:S,onClose:P,className:F}){let h=me(()=>a(z),[z]),[R,q]=E([]);ee(()=>n.subscribe(q),[n]);let k=me(()=>N?R.find((v)=>v.udid===N):R[0],[R,N]),[T,C]=E("fit"),[O,L]=E(Z),[se,te]=E(0),[U,Y]=E(!1),[K,I]=E(null),[ne,G]=E(null),[j,b]=E(null),[D,A]=E(null),[ie,_]=E(null),[ae,oe]=E("live"),de=n.consent??$e,J=X((v)=>{I(null),v().catch((w)=>I(pe(w)))},[]),le=X(async(v)=>{G(v&&!v.running?"booting":"attaching"),I(null);try{await n.attach(v?.id,x),A(null)}catch(w){let y=pe(w);if(v&&/no simulator|not available|不可用|No device/i.test(y))A(v.name);I(y)}finally{G(null)}},[n,x]),ue=X(async(v)=>{let w=v;if(!w){let y=await n.listDevices(x).catch(()=>[]);if(w=y.find((W)=>W.running)??y[0],!w){I(h.noSimulators);return}}if(await de.read(w.id))await le(w);else b(w)},[n,x,de,le,h.noSimulators]);ee(()=>{if(!k||!n.appearance)return;let v=!1;return n.appearance(k.udid).then((w)=>{if(!v)_(w)}).catch(()=>{return}),()=>{v=!0}},[n,k]);let xe=g(ve,{bridge:n,platform:x,labels:h,current:k?.udid,disabled:ne!==null,onPick:(v)=>{if(k&&v.id!==k.udid)J(async()=>{await le(v),await n.detach(k.udid)});else if(!k)ue(v)}}),ye=[{kind:"item",label:h.undo,disabled:!0,hint:h.inputUnavailable},{kind:"item",label:h.redo,disabled:!0},{kind:"separator"},{kind:"item",label:h.cut,disabled:!0},{kind:"item",label:h.copy,disabled:!0},{kind:"item",label:h.paste,disabled:!0},{kind:"item",label:h.selectAll,disabled:!0},{kind:"item",label:h.delete,disabled:!0}],Se=()=>{let v=k,w=(y)=>()=>{if(v)J(()=>y(v))};return[{kind:"section",label:h.appearance},{kind:"item",label:h.light,checked:ie==="light",disabled:!v||!n.setAppearance,onSelect:w(async(y)=>{await n.setAppearance?.(y.udid,"light"),_("light")})},{kind:"item",label:h.dark,checked:ie==="dark",disabled:!v||!n.setAppearance,onSelect:w(async(y)=>{await n.setAppearance?.(y.udid,"dark"),_("dark")})},{kind:"section",label:h.statusBar},{kind:"item",label:h.statusLive,checked:ae==="live",disabled:!v||!n.setStatusBar,onSelect:w(async(y)=>{await n.setStatusBar?.(y.udid,"live"),oe("live")})},{kind:"item",label:h.statusShowcase,checked:ae==="showcase",disabled:!v||!n.setStatusBar,onSelect:w(async(y)=>{await n.setStatusBar?.(y.udid,"showcase"),oe("showcase")})},{kind:"separator"},{kind:"item",label:h.restart,disabled:!v||!n.restart,onSelect:w(async(y)=>{G("booting");try{await n.restart?.(y.udid),await n.attach(y.udid,x)}finally{G(null)}})},{kind:"item",label:h.shutdown,disabled:!v||!n.shutdown,onSelect:w((y)=>n.shutdown(y.udid))},{kind:"separator"},{kind:"item",label:h.detach,disabled:!v,onSelect:w((y)=>n.detach(y.udid))}]},re=(v)=>C((w)=>{let y=w==="fit"?100:w,W=Q.findIndex((De)=>De>=y);return(v>0?Q[Math.min(Q.length-1,(W===-1?Q.length-1:W)+1)]:Q[Math.max(0,(W===-1?Q.length:W)-1)])??w}),Ne=()=>[{kind:"item",label:h.zoomIn,onSelect:()=>re(1),hint:"⌘+"},{kind:"item",label:h.zoomOut,onSelect:()=>re(-1),hint:"⌘−"},{kind:"item",label:h.zoomFit,checked:T==="fit",onSelect:()=>C("fit")},{kind:"item",label:h.actualSize,checked:T===100,onSelect:()=>C(100),hint:"⌘0"},{kind:"section",label:h.frameRate},...[1,2,4,8].map((v)=>({kind:"item",label:`${v} FPS`,checked:O===v,onSelect:()=>L(v)}))],V=(v,w,y,W)=>H(Pe,{children:[g(Ee,{render:g(be,{variant:"ghost",size:"icon-sm","aria-label":v,"aria-pressed":W?.pressed,disabled:W?.disabled,onClick:y,className:"aria-pressed:bg-muted"}),children:w}),g(ze,{children:v})]});return g(Te,{children:H("div",{"data-device-panel":!0,className:`bg-background text-foreground flex h-full min-h-0 flex-col ${F??""}`,children:[H("div",{"data-device-menubar":!0,className:"border-border flex h-10 shrink-0 items-center gap-0.5 border-b px-2",children:[g(t,{label:h.menuEdit,entries:ye}),g(t,{label:h.menuDevice,entries:Se}),g(t,{label:h.menuView,entries:Ne}),g("span",{className:"flex-1"}),S&&V(M?h.collapse:h.expand,M?g(Be,{className:"size-4"}):g(Le,{className:"size-4"}),S,{pressed:M}),P&&V(h.close,g(ke,{className:"size-4"}),P)]}),H("div",{"data-device-devicebar":!0,className:"border-border flex h-12 shrink-0 items-center gap-1 border-b px-2",children:[xe,g("span",{className:"flex-1"}),k&&g("span",{className:"text-muted-foreground mr-1 text-xs tabular-nums",children:se>0?e(h.fpsValue,{fps:se}):h.fpsIdle}),V(h.zoomOut,g(He,{className:"size-4"}),()=>re(-1)),V(h.zoomFit,g(Ie,{className:"size-4"}),()=>C("fit"),{pressed:T==="fit"}),V(h.actualSize,g("span",{className:"inline-flex size-4 items-center justify-center rounded-full border border-current text-[10px] leading-none font-semibold",children:"1"}),()=>C(100),{pressed:T===100}),V(h.zoomIn,g(Ae,{className:"size-4"}),()=>re(1))]}),K&&g("p",{role:"alert",className:"border-border text-destructive shrink-0 border-b px-3 py-1.5 text-xs",children:K}),g("div",{"data-device-stage":!0,className:`[container-type:size] flex min-h-0 flex-1 items-center justify-center p-4 ${T==="fit"?"overflow-hidden":"overflow-auto"}`,children:k?g(qe,{bridge:n,attachment:k,labels:h,fps:O,zoom:T,onError:I,onFps:te}):g(we,{kind:i(x,j?.name??"iPhone"),zoom:T,children:j?g(p,{labels:h,agent:B,deviceName:j.name,systemVersion:j.systemVersion,onCancel:()=>b(null),onContinue:()=>{let v=j;b(null),J(async()=>{await de.write(v.id,!0),await le(v)})}}):g(m,{labels:h,agent:B,unavailableDevice:D,busy:ne,error:null,onAttach:()=>void ue(void 0),picker:g(ve,{bridge:n,platform:x,labels:h,disabled:ne!==null,compact:!0,onPick:(v)=>void ue(v)})})})}),g("div",{"data-device-toolbar":!0,className:"flex shrink-0 justify-center py-3",children:H("div",{className:"border-border bg-muted/40 inline-flex items-center gap-0.5 rounded-full border p-1",children:[V(h.home,g(Ce,{className:"size-4"}),()=>k&&J(()=>n.gesture(k.udid,{type:"button",name:"HOME"})),{disabled:!k}),V(h.rotate,g(Fe,{className:"size-4"}),()=>k&&J(()=>n.gesture(k.udid,{type:"rotate",direction:"right"})),{disabled:!k}),V(h.screenshot,g(Me,{className:"size-4"}),()=>k&&J(async()=>{let v=await n.captureFrame(k.udid);if(!v)return;if(n.saveScreenshot){if(await n.saveScreenshot(k.udid,v))I(null)}else{let w=document.createElement("a");w.href=v,w.download=`${k.deviceName}-${Date.now()}.png`,w.click()}}),{disabled:!k}),V(h.record,g(Oe,{className:"size-4"}),void 0,{disabled:!0}),V(h.logs,g(Re,{className:"size-4"}),()=>Y((v)=>!v),{disabled:!k||!n.readLogs,pressed:U})]})}),U&&k&&n.readLogs&&g(Ve,{bridge:n,udid:k.udid,labels:h,onClose:()=>Y(!1)})]})})}function ve({bridge:n,platform:x,labels:N,current:z,disabled:B,compact:Z,onPick:M}){let[S,P]=E(null),F=X(()=>{P(null),n.listDevices(x).then(P).catch(()=>P([]))},[n,x]),[h,R]=E(null);ee(()=>{if(!z)return;n.listDevices(x).then((T)=>{let C=T.find((O)=>O.id===z);if(C)R({name:C.name,version:C.systemVersion})}).catch(()=>{return})},[n,x,z]);let q=()=>{if(S===null)return[{kind:"item",label:N.loadingDevices,disabled:!0}];if(S.length===0)return[{kind:"item",label:N.noSimulators,disabled:!0}];let T=S.filter((L)=>L.running),C=S.filter((L)=>!L.running),O=(L)=>({kind:"item",label:L.name,hint:L.systemVersion,checked:z===void 0?void 0:L.id===z,onSelect:()=>M(L)});return[...T.length>0?[{kind:"section",label:N.booted},...T.map(O)]:[],...C.length>0?[{kind:"section",label:N.willBoot},...C.map(O)]:[]]},k=(T)=>{if(T)F()};if(Z)return g(t,{ariaLabel:N.chooseDevice,entries:q,disabled:B,caret:!1,align:"end",variant:"default",size:"lg",className:"border-s-primary-foreground/20 rounded-s-none border-s px-3",onOpenChange:k,children:g(fe,{className:"size-4","aria-hidden":!0})});return H(t,{ariaLabel:N.chooseDevice,entries:q,disabled:B,caret:!1,size:"default",className:"h-10 max-w-full justify-start px-2 text-left",onOpenChange:k,children:[H("span",{className:"flex min-w-0 flex-col leading-tight",children:[g("span",{className:"truncate text-[15px] font-medium",children:h?.name??N.chooseDevice}),h&&H("span",{className:"text-muted-foreground truncate text-xs",children:[x==="ios"?"iOS":"Android"," ",h.version]})]}),g(fe,{className:"size-4 shrink-0 opacity-60","aria-hidden":!0})]})}function we({kind:n,zoom:x,pixelWidth:N,pixelHeight:z,scale:B=3,children:Z,overlay:M}){let S=me(()=>d(n,N,z),[n,N,z]),P=x==="fit"?{height:`min(100cqh, calc(100cqw / ${S.aspect}))`,aspectRatio:S.aspect}:(()=>{let F=(100-2*parseFloat(S.style.top))/100;return{height:`${(z??2622)/B*x/100/F}px`,aspectRatio:S.aspect,flexShrink:0}})();return H("div",{"data-device-screen-stage":!0,className:"relative",style:P,children:[g("div",{className:"bg-background absolute z-0 overflow-hidden",style:S.style,children:Z}),g(u,{kind:n,pixelWidth:N,pixelHeight:z,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))"}}),M&&g("div",{className:"absolute z-20",style:S.style,children:M})]})}function qe({bridge:n,attachment:x,labels:N,fps:z,zoom:B,onError:Z,onFps:M}){let{udid:S,deviceName:P,platform:F}=x,[h,R]=E(null),[q,k]=E(x.pixelWidth&&x.pixelHeight?{width:x.pixelWidth,height:x.pixelHeight}:null),[T,C]=E(!1),O=ce(null),L=ce([]);ee(()=>{if(z<=0)return;let b=!1,D,A=async()=>{if(b)return;let ie=performance.now();try{let _=await n.captureFrame(S);if(!b&&_){R(_);let ae=performance.now();L.current=[...L.current.filter((oe)=>ae-oe<2000),ae],M(Math.round(L.current.length/2))}}catch{}if(b)return;D=setTimeout(A,Math.max(0,1000/z-(performance.now()-ie)))};return A(),()=>{if(b=!0,M(0),D!==void 0)clearTimeout(D)}},[n,S,z,M]);let se=i(F,P),te=Ze(F,P),U=(q?.width??0)/te,Y=(q?.height??0)/te,K=X((b)=>{n.gesture(S,b).then(()=>Z(null),(D)=>Z(pe(D)))},[n,S,Z]),I=X(()=>{if(T)return;C(!0),n.takeOver?.(S).catch(()=>{return})},[n,S,T]),ne=X((b)=>{if(b.button!==0)return;I(),b.currentTarget.setPointerCapture(b.pointerId),b.currentTarget.focus({preventScroll:!0});let D=o(b.currentTarget.getBoundingClientRect(),b.clientX,b.clientY,U,Y);if(D)O.current={...D,clientX:b.clientX,clientY:b.clientY,t:performance.now()}},[I,U,Y]),G=X((b)=>{if(b.button!==0)return;let D=O.current;if(O.current=null,!D)return;let A=o(b.currentTarget.getBoundingClientRect(),b.clientX,b.clientY,U,Y);if(!A)return;K(l(D,{...A,clientX:b.clientX,clientY:b.clientY,t:performance.now()}))},[K,U,Y]),j=X((b)=>{if(b.nativeEvent.isComposing)return;let D=c(b,F==="android"?r:s);if(!D)return;b.preventDefault(),b.stopPropagation(),I(),K(D)},[F,K,I]);return g(we,{kind:se,zoom:B,pixelWidth:q?.width,pixelHeight:q?.height,scale:te,overlay:g("div",{role:"application",tabIndex:0,"aria-label":N.touchSurface,"data-device-touch-surface":!0,"data-controlling":T||void 0,title:T?N.takeOver:void 0,className:"h-full w-full cursor-pointer touch-none outline-none",onPointerDown:ne,onPointerUp:G,onPointerCancel:()=>O.current=null,onKeyDown:j,onCompositionEnd:(b)=>b.data&&(I(),K({type:"text",value:b.data}))}),children:h?g("img",{src:h,alt:e(N.liveStream,{device:P}),draggable:!1,onLoad:(b)=>{let D=b.currentTarget;if(D.naturalWidth&&D.naturalHeight)k((A)=>A?.width===D.naturalWidth&&A.height===D.naturalHeight?A:{width:D.naturalWidth,height:D.naturalHeight})},className:"block h-full w-full bg-black object-cover select-none"}):g("div",{className:"h-full w-full bg-black"})})}function Ve({bridge:n,udid:x,labels:N,onClose:z}){let[B,Z]=E([]),M=ce(0),S=ce(null);return ee(()=>{let P=!1,F=async()=>{try{let R=await n.readLogs(x,{sinceSeq:M.current||void 0,tail:200});if(P)return;if(R.entries.length>0)M.current=R.lastSeq,Z((q)=>[...q,...R.entries].slice(-500))}catch{}};F();let h=setInterval(F,2000);return()=>{P=!0,clearInterval(h)}},[n,x]),ee(()=>{S.current?.scrollTo({top:S.current.scrollHeight})},[B]),H("div",{"data-device-logs":!0,className:"border-border flex h-[40%] shrink-0 flex-col border-t",children:[H("div",{className:"text-muted-foreground flex h-8 shrink-0 items-center gap-2 px-3 text-xs",children:[g("span",{className:"flex-1",children:N.logsTitle}),g(be,{variant:"ghost",size:"icon-xs","aria-label":N.closeLogs,title:N.closeLogs,onClick:z,children:g(ke,{})})]}),g("div",{ref:S,className:"min-h-0 flex-1 overflow-auto px-3 pb-2 font-mono text-[11px] leading-4",children:B.length===0?g("p",{className:"text-muted-foreground py-4 text-center",children:N.logsEmpty}):B.map((P)=>H("div",{className:"flex gap-2 break-all whitespace-pre-wrap",children:[g("span",{className:"text-muted-foreground shrink-0",children:P.timestamp.slice(11,23)}),g("span",{className:`shrink-0 ${P.level==="error"||P.level==="fault"?"text-destructive":"text-muted-foreground"}`,children:P.level}),g("span",{children:P.message})]},P.seq))})]})}
|
|
1
|
+
import{o,s,r}from"./chunk-wfcd0qt8.js";import{l,c,d,u,i}from"./chunk-fj7w5b36.js";import{a,e}from"./chunk-brbw9wqh.js";import{t}from"./chunk-6acejx53.js";import{p,g}from"./chunk-ek1jm29t.js";import{Button as be}from"@nyssance/shadcn/vega/components/ui/button";import{Tooltip as Pe,TooltipContent as ze,TooltipProvider as Te,TooltipTrigger as Ee}from"@nyssance/shadcn/vega/components/ui/tooltip";import{Camera as Me,ChevronDown as fe,Home as Ce,Maximize2 as Le,Minimize2 as Be,RotateCw as Fe,Scan as Ie,SquareTerminal as Re,Video as Oe,X as ke,ZoomIn as Ae,ZoomOut as He}from"lucide-react";import{useCallback as X,useEffect as ee,useMemo as me,useRef as ce,useState as E}from"react";import{jsx as h,jsxs as H}from"react/jsx-runtime";var Q=[25,33,50,66,75,100,125,150,200];function Ze(n,x){if(n==="android")return 1;return x.toLowerCase().includes("ipad")?2:3}var he=(n)=>`alwith-device:consent:${n}`,$e={read:(n)=>Promise.resolve(ge(()=>localStorage.getItem(he(n))==="granted")??!1),write:(n,x)=>Promise.resolve(ge(()=>localStorage.setItem(he(n),x?"granted":"denied"))??void 0)};function ge(n){try{return n()}catch{return null}}function pe(n){return n instanceof Error?n.message:String(n)}function f({bridge:n,platform:x="ios",udid:N,language:z,agentName:B="AI",pollFps:Z=4,maximized:M=!1,onMaximize:S,onClose:P,className:F}){let m=me(()=>a(z),[z]),[R,q]=E([]);ee(()=>n.subscribe(q),[n]);let k=me(()=>N?R.find((v)=>v.udid===N):R[0],[R,N]),[T,C]=E("fit"),[O,L]=E(Z),[se,te]=E(0),[U,Y]=E(!1),[K,I]=E(null),[ne,G]=E(null),[j,b]=E(null),[D,A]=E(null),[ie,_]=E(null),[ae,oe]=E("live"),de=n.consent??$e,J=X((v)=>{I(null),v().catch((w)=>I(pe(w)))},[]),le=X(async(v)=>{G(v&&!v.running?"booting":"attaching"),I(null);try{await n.attach(v?.id,x),A(null)}catch(w){let y=pe(w);if(v&&/no simulator|not available|不可用|No device/i.test(y))A(v.name);I(y)}finally{G(null)}},[n,x]),ue=X(async(v)=>{let w=v;if(!w){let y=await n.listDevices(x).catch(()=>[]);if(w=y.find((W)=>W.running)??y[0],!w){I(m.noSimulators);return}}if(await de.read(w.id))await le(w);else b(w)},[n,x,de,le,m.noSimulators]);ee(()=>{if(!k||!n.appearance)return;let v=!1;return n.appearance(k.udid).then((w)=>{if(!v)_(w)}).catch(()=>{return}),()=>{v=!0}},[n,k]);let xe=h(ve,{bridge:n,platform:x,labels:m,current:k?.udid,disabled:ne!==null,onPick:(v)=>{if(k&&v.id!==k.udid)J(async()=>{await le(v),await n.detach(k.udid)});else if(!k)ue(v)}}),ye=[{kind:"item",label:m.undo,disabled:!0,hint:m.inputUnavailable},{kind:"item",label:m.redo,disabled:!0},{kind:"separator"},{kind:"item",label:m.cut,disabled:!0},{kind:"item",label:m.copy,disabled:!0},{kind:"item",label:m.paste,disabled:!0},{kind:"item",label:m.selectAll,disabled:!0},{kind:"item",label:m.delete,disabled:!0}],Se=()=>{let v=k,w=(y)=>()=>{if(v)J(()=>y(v))};return[{kind:"section",label:m.appearance},{kind:"item",label:m.light,checked:ie==="light",disabled:!v||!n.setAppearance,onSelect:w(async(y)=>{await n.setAppearance?.(y.udid,"light"),_("light")})},{kind:"item",label:m.dark,checked:ie==="dark",disabled:!v||!n.setAppearance,onSelect:w(async(y)=>{await n.setAppearance?.(y.udid,"dark"),_("dark")})},{kind:"section",label:m.statusBar},{kind:"item",label:m.statusLive,checked:ae==="live",disabled:!v||!n.setStatusBar,onSelect:w(async(y)=>{await n.setStatusBar?.(y.udid,"live"),oe("live")})},{kind:"item",label:m.statusShowcase,checked:ae==="showcase",disabled:!v||!n.setStatusBar,onSelect:w(async(y)=>{await n.setStatusBar?.(y.udid,"showcase"),oe("showcase")})},{kind:"separator"},{kind:"item",label:m.restart,disabled:!v||!n.restart,onSelect:w(async(y)=>{G("booting");try{await n.restart?.(y.udid),await n.attach(y.udid,x)}finally{G(null)}})},{kind:"item",label:m.shutdown,disabled:!v||!n.shutdown,onSelect:w((y)=>n.shutdown(y.udid))},{kind:"separator"},{kind:"item",label:m.detach,disabled:!v,onSelect:w((y)=>n.detach(y.udid))}]},re=(v)=>C((w)=>{let y=w==="fit"?100:w,W=Q.findIndex((De)=>De>=y);return(v>0?Q[Math.min(Q.length-1,(W===-1?Q.length-1:W)+1)]:Q[Math.max(0,(W===-1?Q.length:W)-1)])??w}),Ne=()=>[{kind:"item",label:m.zoomIn,onSelect:()=>re(1),hint:"⌘+"},{kind:"item",label:m.zoomOut,onSelect:()=>re(-1),hint:"⌘−"},{kind:"item",label:m.zoomFit,checked:T==="fit",onSelect:()=>C("fit")},{kind:"item",label:m.actualSize,checked:T===100,onSelect:()=>C(100),hint:"⌘0"},{kind:"section",label:m.frameRate},...[1,2,4,8].map((v)=>({kind:"item",label:`${v} FPS`,checked:O===v,onSelect:()=>L(v)}))],V=(v,w,y,W)=>H(Pe,{children:[h(Ee,{render:h(be,{variant:"ghost",size:"icon-sm","aria-label":v,"aria-pressed":W?.pressed,disabled:W?.disabled,onClick:y,className:"aria-pressed:bg-muted"}),children:w}),h(ze,{children:v})]});return h(Te,{children:H("div",{"data-device-panel":!0,className:`bg-background text-foreground flex h-full min-h-0 flex-col ${F??""}`,children:[H("div",{"data-device-menubar":!0,className:"border-border flex h-10 shrink-0 items-center gap-0.5 border-b px-2",children:[h(t,{label:m.menuEdit,entries:ye}),h(t,{label:m.menuDevice,entries:Se}),h(t,{label:m.menuView,entries:Ne}),h("span",{className:"flex-1"}),S&&V(M?m.collapse:m.expand,M?h(Be,{className:"size-4"}):h(Le,{className:"size-4"}),S,{pressed:M}),P&&V(m.close,h(ke,{className:"size-4"}),P)]}),H("div",{"data-device-devicebar":!0,className:"border-border flex h-12 shrink-0 items-center gap-1 border-b px-2",children:[xe,h("span",{className:"flex-1"}),k&&h("span",{className:"text-muted-foreground mr-1 text-xs tabular-nums",children:se>0?e(m.fpsValue,{fps:se}):m.fpsIdle}),V(m.zoomOut,h(He,{className:"size-4"}),()=>re(-1)),V(m.zoomFit,h(Ie,{className:"size-4"}),()=>C("fit"),{pressed:T==="fit"}),V(m.actualSize,h("span",{className:"inline-flex size-4 items-center justify-center rounded-full border border-current text-[10px] leading-none font-semibold",children:"1"}),()=>C(100),{pressed:T===100}),V(m.zoomIn,h(Ae,{className:"size-4"}),()=>re(1))]}),K&&h("p",{role:"alert",className:"border-border text-destructive shrink-0 border-b px-3 py-1.5 text-xs",children:K}),h("div",{"data-device-stage":!0,className:`[container-type:size] flex min-h-0 flex-1 items-center justify-center p-4 ${T==="fit"?"overflow-hidden":"overflow-auto"}`,children:k?h(qe,{bridge:n,attachment:k,labels:m,fps:O,zoom:T,onError:I,onFps:te}):h(we,{kind:o(x,j?.name??"iPhone"),zoom:T,children:j?h(g,{labels:m,agent:B,deviceName:j.name,systemVersion:j.systemVersion,onCancel:()=>b(null),onContinue:()=>{let v=j;b(null),J(async()=>{await de.write(v.id,!0),await le(v)})}}):h(p,{labels:m,agent:B,unavailableDevice:D,busy:ne,error:null,onAttach:()=>void ue(void 0),picker:h(ve,{bridge:n,platform:x,labels:m,disabled:ne!==null,compact:!0,onPick:(v)=>void ue(v)})})})}),h("div",{"data-device-toolbar":!0,className:"flex shrink-0 justify-center py-3",children:H("div",{className:"border-border bg-muted/40 inline-flex items-center gap-0.5 rounded-full border p-1",children:[V(m.home,h(Ce,{className:"size-4"}),()=>k&&J(()=>n.gesture(k.udid,{type:"button",name:"HOME"})),{disabled:!k}),V(m.rotate,h(Fe,{className:"size-4"}),()=>k&&J(()=>n.gesture(k.udid,{type:"rotate",direction:"right"})),{disabled:!k}),V(m.screenshot,h(Me,{className:"size-4"}),()=>k&&J(async()=>{let v=await n.captureFrame(k.udid);if(!v)return;if(n.saveScreenshot){if(await n.saveScreenshot(k.udid,v))I(null)}else{let w=document.createElement("a");w.href=v,w.download=`${k.deviceName}-${Date.now()}.png`,w.click()}}),{disabled:!k}),V(m.record,h(Oe,{className:"size-4"}),void 0,{disabled:!0}),V(m.logs,h(Re,{className:"size-4"}),()=>Y((v)=>!v),{disabled:!k||!n.readLogs,pressed:U})]})}),U&&k&&n.readLogs&&h(Ve,{bridge:n,udid:k.udid,labels:m,onClose:()=>Y(!1)})]})})}function ve({bridge:n,platform:x,labels:N,current:z,disabled:B,compact:Z,onPick:M}){let[S,P]=E(null),F=X(()=>{P(null),n.listDevices(x).then(P).catch(()=>P([]))},[n,x]),[m,R]=E(null);ee(()=>{if(!z)return;n.listDevices(x).then((T)=>{let C=T.find((O)=>O.id===z);if(C)R({name:C.name,version:C.systemVersion})}).catch(()=>{return})},[n,x,z]);let q=()=>{if(S===null)return[{kind:"item",label:N.loadingDevices,disabled:!0}];if(S.length===0)return[{kind:"item",label:N.noSimulators,disabled:!0}];let T=S.filter((L)=>L.running),C=S.filter((L)=>!L.running),O=(L)=>({kind:"item",label:L.name,hint:L.systemVersion,checked:z===void 0?void 0:L.id===z,onSelect:()=>M(L)});return[...T.length>0?[{kind:"section",label:N.booted},...T.map(O)]:[],...C.length>0?[{kind:"section",label:N.willBoot},...C.map(O)]:[]]},k=(T)=>{if(T)F()};if(Z)return h(t,{ariaLabel:N.chooseDevice,entries:q,disabled:B,caret:!1,align:"end",variant:"default",size:"lg",className:"border-s-primary-foreground/20 rounded-s-none border-s px-3",onOpenChange:k,children:h(fe,{className:"size-4","aria-hidden":!0})});return H(t,{ariaLabel:N.chooseDevice,entries:q,disabled:B,caret:!1,size:"default",className:"h-10 max-w-full justify-start px-2 text-left",onOpenChange:k,children:[H("span",{className:"flex min-w-0 flex-col leading-tight",children:[h("span",{className:"truncate text-[15px] font-medium",children:m?.name??N.chooseDevice}),m&&H("span",{className:"text-muted-foreground truncate text-xs",children:[x==="ios"?"iOS":"Android"," ",m.version]})]}),h(fe,{className:"size-4 shrink-0 opacity-60","aria-hidden":!0})]})}function we({kind:n,zoom:x,pixelWidth:N,pixelHeight:z,scale:B=3,children:Z,overlay:M}){let S=me(()=>s(n,N,z),[n,N,z]),P=x==="fit"?{height:`min(100cqh, calc(100cqw / ${S.aspect}))`,aspectRatio:S.aspect}:(()=>{let F=(100-2*parseFloat(S.style.top))/100;return{height:`${(z??2622)/B*x/100/F}px`,aspectRatio:S.aspect,flexShrink:0}})();return H("div",{"data-device-screen-stage":!0,className:"relative",style:P,children:[h("div",{className:"bg-background absolute z-0 overflow-hidden",style:S.style,children:Z}),h(r,{kind:n,pixelWidth:N,pixelHeight:z,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))"}}),M&&h("div",{className:"absolute z-20",style:S.style,children:M})]})}function qe({bridge:n,attachment:x,labels:N,fps:z,zoom:B,onError:Z,onFps:M}){let{udid:S,deviceName:P,platform:F}=x,[m,R]=E(null),[q,k]=E(x.pixelWidth&&x.pixelHeight?{width:x.pixelWidth,height:x.pixelHeight}:null),[T,C]=E(!1),O=ce(null),L=ce([]);ee(()=>{if(z<=0)return;let b=!1,D,A=async()=>{if(b)return;let ie=performance.now();try{let _=await n.captureFrame(S);if(!b&&_){R(_);let ae=performance.now();L.current=[...L.current.filter((oe)=>ae-oe<2000),ae],M(Math.round(L.current.length/2))}}catch{}if(b)return;D=setTimeout(A,Math.max(0,1000/z-(performance.now()-ie)))};return A(),()=>{if(b=!0,M(0),D!==void 0)clearTimeout(D)}},[n,S,z,M]);let se=o(F,P),te=Ze(F,P),U=(q?.width??0)/te,Y=(q?.height??0)/te,K=X((b)=>{n.gesture(S,b).then(()=>Z(null),(D)=>Z(pe(D)))},[n,S,Z]),I=X(()=>{if(T)return;C(!0),n.takeOver?.(S).catch(()=>{return})},[n,S,T]),ne=X((b)=>{if(b.button!==0)return;I(),b.currentTarget.setPointerCapture(b.pointerId),b.currentTarget.focus({preventScroll:!0});let D=i(b.currentTarget.getBoundingClientRect(),b.clientX,b.clientY,U,Y);if(D)O.current={...D,clientX:b.clientX,clientY:b.clientY,t:performance.now()}},[I,U,Y]),G=X((b)=>{if(b.button!==0)return;let D=O.current;if(O.current=null,!D)return;let A=i(b.currentTarget.getBoundingClientRect(),b.clientX,b.clientY,U,Y);if(!A)return;K(d(D,{...A,clientX:b.clientX,clientY:b.clientY,t:performance.now()}))},[K,U,Y]),j=X((b)=>{if(b.nativeEvent.isComposing)return;let D=u(b,F==="android"?c:l);if(!D)return;b.preventDefault(),b.stopPropagation(),I(),K(D)},[F,K,I]);return h(we,{kind:se,zoom:B,pixelWidth:q?.width,pixelHeight:q?.height,scale:te,overlay:h("div",{role:"application",tabIndex:0,"aria-label":N.touchSurface,"data-device-touch-surface":!0,"data-controlling":T||void 0,title:T?N.takeOver:void 0,className:"h-full w-full cursor-pointer touch-none outline-none",onPointerDown:ne,onPointerUp:G,onPointerCancel:()=>O.current=null,onKeyDown:j,onCompositionEnd:(b)=>b.data&&(I(),K({type:"text",value:b.data}))}),children:m?h("img",{src:m,alt:e(N.liveStream,{device:P}),draggable:!1,onLoad:(b)=>{let D=b.currentTarget;if(D.naturalWidth&&D.naturalHeight)k((A)=>A?.width===D.naturalWidth&&A.height===D.naturalHeight?A:{width:D.naturalWidth,height:D.naturalHeight})},className:"block h-full w-full bg-black object-cover select-none"}):h("div",{className:"h-full w-full bg-black"})})}function Ve({bridge:n,udid:x,labels:N,onClose:z}){let[B,Z]=E([]),M=ce(0),S=ce(null);return ee(()=>{let P=!1,F=async()=>{try{let R=await n.readLogs(x,{sinceSeq:M.current||void 0,tail:200});if(P)return;if(R.entries.length>0)M.current=R.lastSeq,Z((q)=>[...q,...R.entries].slice(-500))}catch{}};F();let m=setInterval(F,2000);return()=>{P=!0,clearInterval(m)}},[n,x]),ee(()=>{S.current?.scrollTo({top:S.current.scrollHeight})},[B]),H("div",{"data-device-logs":!0,className:"border-border flex h-[40%] shrink-0 flex-col border-t",children:[H("div",{className:"text-muted-foreground flex h-8 shrink-0 items-center gap-2 px-3 text-xs",children:[h("span",{className:"flex-1",children:N.logsTitle}),h(be,{variant:"ghost",size:"icon-xs","aria-label":N.closeLogs,title:N.closeLogs,onClick:z,children:h(ke,{})})]}),h("div",{ref:S,className:"min-h-0 flex-1 overflow-auto px-3 pb-2 font-mono text-[11px] leading-4",children:B.length===0?h("p",{className:"text-muted-foreground py-4 text-center",children:N.logsEmpty}):B.map((P)=>H("div",{className:"flex gap-2 break-all whitespace-pre-wrap",children:[h("span",{className:"text-muted-foreground shrink-0",children:P.timestamp.slice(11,23)}),h("span",{className:`shrink-0 ${P.level==="error"||P.level==="fault"?"text-destructive":"text-muted-foreground"}`,children:P.level}),h("span",{children:P.message})]},P.seq))})]})}
|
|
2
2
|
export{f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{memo as L,useId as Q,useMemo as S}from"react";import{jsx as v,jsxs as z}from"react/jsx-runtime";var m={iPhone:{pixelW:1206,pixelH:2622,screenRadius:186,frame:34,silver:8,grey:12,nubProtrude:27,nubs:[["left",507,102],["left",690,192],["left",927,192],["right",813,303]]},androidPhone:{pixelW:1080,pixelH:2400,screenRadius:100,frame:22,silver:6,grey:8,nubProtrude:18,nubs:[["right",480,130],["right",670,240]]},iPad:{pixelW:1668,pixelH:2420,screenRadius:58,frame:64,silver:12,grey:16,nubProtrude:20,nubs:[["right",202,104],["right",328,104],["top",-148,126]]}};function o(t,e){if(t==="android")return"androidPhone";return e.toLowerCase().includes("ipad")?"iPad":"iPhone"}function C(t,e,R){let p=m[t],F=p.frame+p.silver+p.grey,g=F+p.nubProtrude,b=e??p.pixelW,c=R??p.pixelH;return{p,edge:F,margin:g,W:b+2*g,H:c+2*g,width:b,height:c}}function s(t,e,R){let{p,margin:F,W:g,H:b,width:c,height:l}=C(t,e,R),f=100*F/g,d=100*F/b;return{aspect:g/b,style:{left:`${f}%`,top:`${d}%`,width:`${100-2*f}%`,height:`${100-2*d}%`,borderRadius:`${100*p.screenRadius/c}% / ${100*p.screenRadius/l}%`}}}function w(t,e,R,p,F){let g=Math.min(F,Math.min(R,p)/3.06),b=1.528665*g,c=1.088311*g,l=0.868407*g,f=0.631494*g,d=0.372375*g,H=0.16906*g,P=0.066987*g,n=t+R,a=e+p,i=(h)=>+h.toFixed(3),u=(h,M,W,k,E,K)=>`C${i(h)} ${i(M)} ${i(W)} ${i(k)} ${i(E)} ${i(K)}`;return[`M${i(t+b)} ${i(e)}`,`L${i(n-b)} ${i(e)}`,u(n-c,e,n-l,e,n-f,e+P),u(n-d,e+H,n-H,e+d,n-P,e+f),u(n,e+l,n,e+c,n,e+b),`L${i(n)} ${i(a-b)}`,u(n,a-c,n,a-l,n-P,a-f),u(n-H,a-d,n-d,a-H,n-f,a-P),u(n-l,a,n-c,a,n-b,a),`L${i(t+b)} ${i(a)}`,u(t+c,a,t+l,a,t+f,a-P),u(t+d,a-H,t+H,a-d,t+P,a-f),u(t,a-l,t,a-c,t,a-b),`L${i(t)} ${i(e+b)}`,u(t,e+c,t,e+l,t+P,e+f),u(t+H,e+d,t+d,e+H,t+f,e+P),u(t+l,e,t+c,e,t+b,e),"Z"].join("")}var r=L(function({kind:e="iPhone",pixelWidth:R,pixelHeight:p,className:F,style:g}){let b=Q(),c=S(()=>{let{p:l,edge:f,W:d,H}=C(e,R,p),P=(i)=>w(l.nubProtrude+i,l.nubProtrude+i,d-2*(l.nubProtrude+i),H-2*(l.nubProtrude+i),l.screenRadius+(f-i)),n=l.nubProtrude,a=l.nubs.map(([i,u,h])=>{let M=u+6,W=u+h-6;switch(i){case"left":return{fill:`M0 ${u}h${n}v${h}H0z`,edge:`M${n} ${u}H6Q0 ${u} 0 ${M}V${W}Q0 ${u+h} 6 ${u+h}H${n}`};case"right":return{fill:`M${d-n} ${u}H${d}v${h}H${d-n}z`,edge:`M${d-n} ${u}H${d-6}Q${d} ${u} ${d} ${M}V${W}Q${d} ${u+h} ${d-6} ${u+h}H${d-n}`};default:{let k=u>=0?u:d+u-h;return{fill:`M${k} 0v${n}h${h}V0z`,edge:`M${k} ${n}V6Q${k} 0 ${k+6} 0H${k+h-6}Q${k+h} 0 ${k+h} 6V${n}`}}}});return{W:d,H,outer:P(0),grey:P(l.silver),black:P(l.silver+l.grey),cutout:P(f),nubFill:a.map((i)=>i.fill).join(""),nubEdge:a.map((i)=>i.edge).join("")}},[e,R,p]);return z("svg",{viewBox:`0 0 ${c.W} ${c.H}`,className:F,style:g,"aria-hidden":!0,focusable:!1,children:[v("defs",{children:z("linearGradient",{id:b,x1:"0",y1:"0",x2:"1",y2:"1",children:[v("stop",{offset:"0%",stopColor:"#e8e8ec"}),v("stop",{offset:"45%",stopColor:"#bcbcc0"}),v("stop",{offset:"55%",stopColor:"#b4b4b8"}),v("stop",{offset:"100%",stopColor:"#e2e2e6"})]})}),v("path",{d:`${c.outer} ${c.cutout}`,fill:`url(#${b})`,fillRule:"evenodd"}),v("path",{d:`${c.grey} ${c.cutout}`,fill:"#4a4a4e",fillRule:"evenodd"}),v("path",{d:`${c.black} ${c.cutout}`,fill:"#0b0b0c",fillRule:"evenodd"}),v("path",{d:c.cutout,fill:"none",stroke:"#2a2a2c",strokeWidth:3}),v("path",{d:c.outer,fill:"none",stroke:"#000",strokeWidth:1.5,vectorEffect:"non-scaling-stroke"}),v("path",{d:c.nubFill,fill:"#4a4a4e"}),v("path",{d:c.nubEdge,fill:"none",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]})});
|
|
2
|
+
export{m,o,s,r};
|
package/dist/preview/bezel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{m,o,s,r}from"../chunk-wfcd0qt8.js";export{r as Bezel,m as FRAMES,o as frameKindFor,s as screenPlacement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f}from"../chunk-
|
|
1
|
+
import{f}from"../chunk-m6q76fpn.js";import"../chunk-wfcd0qt8.js";import"../chunk-ek1jm29t.js";import"../chunk-brbw9wqh.js";import"../chunk-fj7w5b36.js";import"../chunk-6acejx53.js";export{f as DevicePanel};
|
package/dist/preview/gestures.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h,l,c,d,v,u,i}from"../chunk-fj7w5b36.js";export{c as ANDROID_SHORTCUTS,l as IOS_SHORTCUTS,h as KEY_CODES,u as keyGesture,i as pointFor,d as releaseGesture,v as shortcutKey};
|
package/dist/preview/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{m,o,s,r}from"../chunk-wfcd0qt8.js";import{h,l,c,d,v,u,i}from"../chunk-fj7w5b36.js";import{n,a,e}from"../chunk-brbw9wqh.js";import{t}from"../chunk-6acejx53.js";import"../chunk-ek1jm29t.js";import{f}from"../chunk-m6q76fpn.js";export{c as ANDROID_SHORTCUTS,r as Bezel,f as DevicePanel,m as FRAMES,l as IOS_SHORTCUTS,h as KEY_CODES,t as MenuButton,n as deviceLocales,e as fill,o as frameKindFor,u as keyGesture,i as pointFor,d as releaseGesture,a as resolveDeviceLabels,s as screenPlacement,v as shortcutKey};
|
package/dist/preview/screens.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{p,g}from"../chunk-ek1jm29t.js";import"../chunk-brbw9wqh.js";export{p as AttachScreen,g as ConsentScreen};
|
package/package.json
CHANGED
package/dist/chunk-0pxm29yj.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{memo as L,useId as Q,useMemo as S}from"react";import{jsx as P,jsxs as z}from"react/jsx-runtime";var v={iPhone:{pixelW:1206,pixelH:2622,screenRadius:186,frame:34,silver:8,grey:12,nubProtrude:27,nubs:[["left",507,102],["left",690,192],["left",927,192],["right",813,303]]},androidPhone:{pixelW:1080,pixelH:2400,screenRadius:100,frame:22,silver:6,grey:8,nubProtrude:18,nubs:[["right",480,130],["right",670,240]]},iPad:{pixelW:1668,pixelH:2420,screenRadius:58,frame:64,silver:12,grey:16,nubProtrude:20,nubs:[["right",202,104],["right",328,104],["top",-148,126]]}};function i(n,e){if(n==="android")return"androidPhone";return e.toLowerCase().includes("ipad")?"iPad":"iPhone"}function C(n,e,R){let m=v[n],F=m.frame+m.silver+m.grey,p=F+m.nubProtrude,b=e??m.pixelW,s=R??m.pixelH;return{p:m,edge:F,margin:p,W:b+2*p,H:s+2*p,width:b,height:s}}function d(n,e,R){let{p:m,margin:F,W:p,H:b,width:s,height:l}=C(n,e,R),h=100*F/p,c=100*F/b;return{aspect:p/b,style:{left:`${h}%`,top:`${c}%`,width:`${100-2*h}%`,height:`${100-2*c}%`,borderRadius:`${100*m.screenRadius/s}% / ${100*m.screenRadius/l}%`}}}function w(n,e,R,m,F){let p=Math.min(F,Math.min(R,m)/3.06),b=1.528665*p,s=1.088311*p,l=0.868407*p,h=0.631494*p,c=0.372375*p,H=0.16906*p,f=0.066987*p,r=n+R,a=e+m,t=(g)=>+g.toFixed(3),o=(g,M,W,k,E,K)=>`C${t(g)} ${t(M)} ${t(W)} ${t(k)} ${t(E)} ${t(K)}`;return[`M${t(n+b)} ${t(e)}`,`L${t(r-b)} ${t(e)}`,o(r-s,e,r-l,e,r-h,e+f),o(r-c,e+H,r-H,e+c,r-f,e+h),o(r,e+l,r,e+s,r,e+b),`L${t(r)} ${t(a-b)}`,o(r,a-s,r,a-l,r-f,a-h),o(r-H,a-c,r-c,a-H,r-h,a-f),o(r-l,a,r-s,a,r-b,a),`L${t(n+b)} ${t(a)}`,o(n+s,a,n+l,a,n+h,a-f),o(n+c,a-H,n+H,a-c,n+f,a-h),o(n,a-l,n,a-s,n,a-b),`L${t(n)} ${t(e+b)}`,o(n,e+s,n,e+l,n+f,e+h),o(n+H,e+c,n+c,e+H,n+h,e+f),o(n+l,e,n+s,e,n+b,e),"Z"].join("")}var u=L(function({kind:e="iPhone",pixelWidth:R,pixelHeight:m,className:F,style:p}){let b=Q(),s=S(()=>{let{p:l,edge:h,W:c,H}=C(e,R,m),f=(t)=>w(l.nubProtrude+t,l.nubProtrude+t,c-2*(l.nubProtrude+t),H-2*(l.nubProtrude+t),l.screenRadius+(h-t)),r=l.nubProtrude,a=l.nubs.map(([t,o,g])=>{let M=o+6,W=o+g-6;switch(t){case"left":return{fill:`M0 ${o}h${r}v${g}H0z`,edge:`M${r} ${o}H6Q0 ${o} 0 ${M}V${W}Q0 ${o+g} 6 ${o+g}H${r}`};case"right":return{fill:`M${c-r} ${o}H${c}v${g}H${c-r}z`,edge:`M${c-r} ${o}H${c-6}Q${c} ${o} ${c} ${M}V${W}Q${c} ${o+g} ${c-6} ${o+g}H${c-r}`};default:{let k=o>=0?o:c+o-g;return{fill:`M${k} 0v${r}h${g}V0z`,edge:`M${k} ${r}V6Q${k} 0 ${k+6} 0H${k+g-6}Q${k+g} 0 ${k+g} 6V${r}`}}}});return{W:c,H,outer:f(0),grey:f(l.silver),black:f(l.silver+l.grey),cutout:f(h),nubFill:a.map((t)=>t.fill).join(""),nubEdge:a.map((t)=>t.edge).join("")}},[e,R,m]);return z("svg",{viewBox:`0 0 ${s.W} ${s.H}`,className:F,style:p,"aria-hidden":!0,focusable:!1,children:[P("defs",{children:z("linearGradient",{id:b,x1:"0",y1:"0",x2:"1",y2:"1",children:[P("stop",{offset:"0%",stopColor:"#e8e8ec"}),P("stop",{offset:"45%",stopColor:"#bcbcc0"}),P("stop",{offset:"55%",stopColor:"#b4b4b8"}),P("stop",{offset:"100%",stopColor:"#e2e2e6"})]})}),P("path",{d:`${s.outer} ${s.cutout}`,fill:`url(#${b})`,fillRule:"evenodd"}),P("path",{d:`${s.grey} ${s.cutout}`,fill:"#4a4a4e",fillRule:"evenodd"}),P("path",{d:`${s.black} ${s.cutout}`,fill:"#0b0b0c",fillRule:"evenodd"}),P("path",{d:s.cutout,fill:"none",stroke:"#2a2a2c",strokeWidth:3}),P("path",{d:s.outer,fill:"none",stroke:"#000",strokeWidth:1.5,vectorEffect:"non-scaling-stroke"}),P("path",{d:s.nubFill,fill:"#4a4a4e"}),P("path",{d:s.nubEdge,fill:"none",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]})});
|
|
2
|
-
export{v,i,d,u};
|