@idosgames/app-shell 0.1.16 → 0.2.0
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/index.cjs +3 -3
- package/dist/index.d.cts +84 -8
- package/dist/index.d.ts +84 -8
- package/dist/index.js +3 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var client=require('react-dom/client'),react$1=require('@idosgames/react'),react=require('react'),core=require('@idosgames/core'),jsxRuntime=require('react/jsx-runtime');function
|
|
1
|
+
'use strict';var client=require('react-dom/client'),react$1=require('@idosgames/react'),moduleSdk=require('@idosgames/module-sdk'),react=require('react'),core=require('@idosgames/core'),jsxRuntime=require('react/jsx-runtime');var we=50,U="host",Z=e=>typeof e=="string"?e:e.name,ee=e=>typeof e=="string"?null:e.shape,te=e=>e.replace(/@\d+$/,"");function T(){let e=new Map,o=new Map,t=[],l=new Set,n=r=>{t.push(r),t.length>we&&t.shift();},a=(r,s)=>{l.has(r)||(l.add(r),console.warn(s));},c=(r,s,p)=>{console.error(`[idos events] ${p}`),n({topic:s,from:r,at:Date.now(),delivered:0,rejected:p});},g=(r,s,p,f)=>{if(!moduleSdk.isTopicName(s)){c(r,s,`"${r}" emitted "${s}", which is not a topic name \u2014 use defineTopic("<module-id>:<event>@<major>", shape({\u2026})). Not delivered.`);return}let d=moduleSdk.topicNamespace(s);if(r!==U&&d===U){c(r,s,`"${r}" emitted "${s}", but the "host:" namespace belongs to the host. Not delivered.`);return}if(r!==U&&d!==r){c(r,s,`"${r}" emitted "${s}" into the "${d}" namespace \u2014 a module may only emit its own topics ("${r}:\u2026"). Not delivered.`);return}if(p){let S=p.check(f);S&&a(`emit|${r}|${s}`,`[idos events] "${r}" emitted "${s}" with a payload that does not match its own shape: ${S}. Fix the emit or the topic's shape (and module.meta.json).`);}let y=o.get(s);y||o.set(s,y=new Set),y.add(r);let b=0;for(let S of [...e.get(s)??[]]){if(S.shape){let v=S.shape.check(f);if(v){a(`on|${S.moduleId}|${s}`,`[idos events] "${S.moduleId}" skipped "${s}" from "${r}": ${v}. Its copy of the topic's shape no longer matches the emitter \u2014 re-copy it from the catalog.`);continue}}try{S.handler(f),b+=1;}catch(v){console.error(`[idos events] a "${s}" handler in "${S.moduleId}" threw \u2014 other listeners still received the event.`,v);}}n({topic:s,from:r,at:Date.now(),delivered:b});},u=(r,s,p)=>{let f=e.get(s);return f||e.set(s,f=new Set),f.add(p),()=>{let d=e.get(s);d&&(d.delete(p),d.size===0&&e.delete(s));}};return {forModule(r){let s=new Set,p=false;return {emit(d,y){p||g(r,Z(d),ee(d),y);},on(d,y){if(p)return ()=>{};let b=Z(d);moduleSdk.isTopicName(b)||console.warn(`[idos events] "${r}" subscribed to "${b}", which is not a topic name \u2014 nothing can ever be emitted to it.`);let S=u(r,b,{moduleId:r,shape:ee(d),handler:y});return s.add(S),()=>{S(),s.delete(S);}},dispose(){p=true;for(let d of s)d();s.clear();}}},emitAsHost(r,s){g(U,r.name,r.shape,s);},describe(){let r={};for(let[f,d]of e)r[f]=[...new Set([...d].map(y=>y.moduleId))];let s={};for(let[f,d]of o)s[f]=[...d];let p=[];for(let[f,d]of Object.entries(r)){if(o.has(f))continue;let y=[...o.keys()].filter(b=>b!==f&&te(b)===te(f));y.length>0&&p.push(`${d.join(", ")} listen${d.length===1?"s":""} to "${f}", but only ${y.map(b=>`"${b}"`).join(", ")} ${y.length===1?"has":"have"} been emitted \u2014 the major versions differ, so these never meet.`);}return {log:t.slice(),listeners:r,emitted:s,mismatches:p}}}}function xe(){let e=new Map;return {emit(o,t){let l=e.get(o);if(l)for(let n of [...l])n(t);},on(o,t){let l=t,n=e.get(o);return n||(n=new Set,e.set(o,n)),n.add(l),()=>{n.delete(l),n.size===0&&e.delete(o);}}}}function re(){return Object.fromEntries(moduleSdk.SHARED_UI_ROLES.map(e=>[e,null]))}function I(e){let o=re(),t=[],l=moduleSdk.SHARED_UI_ROLES.join(", ");for(let n of e)for(let a of n.sharedUi?.provides??[]){if(!moduleSdk.isSharedUiRole(a)){t.push(`module "${n.id}" provides unknown shared UI role "${String(a)}" (known: ${l}) \u2014 ignored.`);continue}let c=o[a];c===null?o[a]=n.id:c!==n.id&&t.push(`shared UI role "${a}" is provided by both "${c}" and "${n.id}" \u2014 "${c}" wins (it comes first in src/modules.ts), "${n.id}" hides its copy.`);}for(let n of e)for(let a of n.sharedUi?.requires??[]){if(!moduleSdk.isSharedUiRole(a)){t.push(`module "${n.id}" requires unknown shared UI role "${String(a)}" (known: ${l}).`);continue}o[a]===null&&t.push(`module "${n.id}" requires shared UI role "${a}", but no installed module provides it \u2014 install game-hud (or another module that provides "${a}").`);}return {owners:o,warnings:t}}function D(e,o){let t=l=>e[l]??null;return {ownerOf:t,shouldDraw:l=>{let n=t(l);return n===null||n===o}}}var Re={position:"absolute",inset:"0"};function B(e){return {request(o){let t=document.createElement("div");return t.dataset.surface=o,Object.assign(t.style,Re),t.style.pointerEvents=o==="fullbleed-canvas"?"auto":"none",e.appendChild(t),{host:t,release(){t.remove();}}}}}var Ee="__IDOS_AGENT__",se={},ie,le;function ke(){try{return typeof window<"u"&&window.self!==window.top}catch{return true}}function z(e,o){se[e]=o,_();}function G(e){ie=e,_();}function N(e){le=e,_();}function _(){if(!ke())return;let e={version:1,modules:se,host:ie,events:le};globalThis[Ee]=e;}function j(e,o){let t=o.sharedUi??I(e).owners,l=[];try{for(let n of e){let a=o.events.forModule(n.id),c={module:n,scenes:[],panels:[],routes:[],dispose:()=>a.dispose()};l.push(c);let g={client:o.client,titleId:o.client.titleID,events:a,sharedUi:D(t,n.id),surface:o.surface,registerScene:u=>c.scenes.push(u),registerPanel:u=>c.panels.push(u),registerRoute:u=>c.routes.push(u),exposeToAgent:u=>z(n.id,u)};n.setup(g);}}catch(n){for(let a of l)a.dispose();throw n}return l}var C=class{constructor(o){this.container=o;}container;hosts=new Map;active=new Set;ensureMounted(o){let t=this.hosts.get(o);return t||(t=document.createElement("div"),Object.assign(t.style,{position:"absolute",inset:"0"}),this.container.appendChild(t),this.hosts.set(o,t),o.mount({host:t})),t}setActive(o){let t=new Set(o);for(let l of this.active){if(t.has(l))continue;l.suspend?.();let n=this.hosts.get(l);n&&(n.style.display="none");}for(let l of t){if(this.active.has(l))continue;let n=this.ensureMounted(l);n.style.display="block",l.activate?.();}this.active=t;}destroy(){for(let[o,t]of this.hosts)o.destroy(),t.remove();this.hosts.clear(),this.active.clear();}};function K({registrations:e,sharedUi:o,events:t,onLogout:l,userID:n}){let a=react.useRef(null),c=react.useRef(null),g=react.useMemo(()=>e.flatMap(i=>i.routes.map(m=>({id:m.id,label:m.label,icon:m.icon,order:m.order??0,moduleId:i.module.id}))).sort((i,m)=>i.order-m.order),[e]),[u,r]=react.useState(()=>g[0]?.id??null);react.useEffect(()=>{u!==null&&g.some(i=>i.id===u)||r(g[0]?.id??null);},[g,u]);let s=react.useMemo(()=>g.find(i=>i.id===u)?.moduleId??null,[g,u]),p=react.useRef(null);react.useEffect(()=>{if(u===null||u===p.current)return;let i=p.current;p.current=u,t?.emitAsHost(moduleSdk.hostTopics.modeChanged,i===null?{to:u}:{from:i,to:u});},[u,t]),react.useEffect(()=>{let i=a.current;if(!i)return;let m=c.current??=new C(i),M=e.find(L=>L.module.id===s)?.scenes??[];m.setActive(M);},[e,s]),react.useEffect(()=>()=>{c.current?.destroy(),c.current=null;},[]);let f=react.useMemo(()=>e.flatMap(i=>i.panels.filter(m=>m.activeOnly===false||i.module.id===s).map(m=>{let M=m.component;return {key:`${i.module.id}:${m.id}`,slot:m.slot,order:m.order??0,moduleId:i.module.id,component:jsxRuntime.jsx(M,{})}})).sort((i,m)=>i.order-m.order),[e,s]),d=i=>f.filter(m=>m.slot===i),y=e.length>0,b=d("hud").length,S=g.length>1,v=!o?.account,x=react.useRef(null),E=react.useRef(null),[k,ye]=react.useState({top:0,bottom:0});react.useLayoutEffect(()=>{let i=()=>{let M=b>0&&x.current?Math.ceil(x.current.getBoundingClientRect().height):0,L=S&&E.current?Math.ceil(E.current.getBoundingClientRect().height)+de:0;ye(O=>O.top===M&&O.bottom===L?O:{top:M,bottom:L});};if(i(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(i);return x.current&&m.observe(x.current),E.current&&m.observe(E.current),()=>m.disconnect()},[b,S]);let Se={...He,"--idos-safe-top":`${k.top}px`,"--idos-safe-bottom":`${k.bottom}px`};return jsxRuntime.jsxs("div",{style:Se,children:[jsxRuntime.jsx("div",{ref:a,style:Le}),jsxRuntime.jsx("div",{style:{...Ue,top:k.top,bottom:k.bottom},children:d("overlay").map(i=>jsxRuntime.jsx("div",{style:V,children:i.component},i.key))}),jsxRuntime.jsx("div",{ref:x,style:Pe,children:d("hud").map(i=>jsxRuntime.jsx("div",{style:$e,children:i.component},i.key))}),jsxRuntime.jsx("div",{style:{...Oe,top:k.top,bottom:k.bottom},children:d("sidebar").map(i=>jsxRuntime.jsx("div",{style:V,children:i.component},i.key))}),S&&jsxRuntime.jsx("nav",{ref:E,style:Te,children:g.map(i=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>r(i.id),style:i.id===u?De:ce,children:[i.icon?`${i.icon} `:"",i.label]},i.id))}),v&&(l||n)&&jsxRuntime.jsxs("div",{style:Be,children:[l&&jsxRuntime.jsx("button",{type:"button",style:ue,onClick:l,title:"Log out",children:"\u{1F6AA} Log out"}),n&&jsxRuntime.jsx(Ie,{userID:n})]}),d("modal").length>0&&jsxRuntime.jsx("div",{style:Ge,children:d("modal").map(i=>jsxRuntime.jsx("div",{style:V,children:i.component},i.key))}),!y&&jsxRuntime.jsx(Ce,{})]})}function Ie({userID:e}){let[o,t]=react.useState(false),l=()=>{(async()=>{try{await navigator.clipboard.writeText(e);}catch{let a=document.createElement("textarea");a.value=e,document.body.appendChild(a),a.select(),document.execCommand("copy"),a.remove();}t(true),window.setTimeout(()=>t(false),1500);})();},n=e.length>12?`${e.slice(0,5)}\u2026${e.slice(-5)}`:e;return jsxRuntime.jsx("button",{type:"button",style:ze,onClick:l,title:`Copy your player ID: ${e}`,children:o?"\u2713 Copied":`ID: ${n} \u29C9`})}function Ce(){return jsxRuntime.jsxs("div",{style:Ne,children:[jsxRuntime.jsx("style",{children:`
|
|
2
2
|
@keyframes idos-empty-float {
|
|
3
3
|
0%, 100% { transform: translateY(0) rotate(-6deg); }
|
|
4
4
|
50% { transform: translateY(-16px) rotate(6deg); }
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
0% { transform: scale(0.55); opacity: 0.55; }
|
|
8
8
|
100% { transform: scale(1.7); opacity: 0; }
|
|
9
9
|
}
|
|
10
|
-
`}),jsxRuntime.jsxs("div",{style:ue,children:[jsxRuntime.jsx("span",{style:{...N,animationDelay:"0s"}}),jsxRuntime.jsx("span",{style:{...N,animationDelay:"1.1s"}}),jsxRuntime.jsx("span",{style:pe,children:"\u{1F9E9}"})]}),jsxRuntime.jsx("div",{style:{fontWeight:700,fontSize:18,marginBottom:6},children:"No modules installed"}),jsxRuntime.jsxs("div",{style:{opacity:.85,maxWidth:380,lineHeight:1.5},children:["Add a module under ",jsxRuntime.jsx("code",{children:"src/modules/"})," and register it in"," ",jsxRuntime.jsx("code",{children:"src/modules.ts"}),". The host shell will pick it up here."]})]})}var ee={position:"absolute",inset:0,overflow:"hidden",background:"#0d66fe",color:"#fff",fontFamily:"system-ui, sans-serif"},te={position:"absolute",inset:0,zIndex:0},oe={position:"absolute",inset:0,zIndex:1,pointerEvents:"none"},ne={position:"absolute",top:0,left:0,right:0,zIndex:2,display:"flex",gap:12,padding:16,pointerEvents:"none"},re={position:"absolute",top:0,right:0,bottom:0,width:340,maxWidth:"40vw",zIndex:2,display:"flex",flexDirection:"column",gap:12,padding:16,overflowY:"auto",pointerEvents:"none"},se={position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:3,display:"flex",gap:8,padding:6,borderRadius:14,background:"rgba(4,32,90,0.72)",backdropFilter:"blur(6px)",pointerEvents:"auto"},W={border:"none",borderRadius:10,padding:"8px 16px",fontWeight:700,fontSize:14,color:"#cfe0ff",background:"transparent",cursor:"pointer"},ie={...W,color:"#0d66fe",background:"#fff"},le={position:"absolute",bottom:16,left:16,zIndex:3,display:"flex",gap:8,alignItems:"center",pointerEvents:"auto"},U={border:"none",borderRadius:12,padding:"8px 14px",fontWeight:700,fontSize:13,color:"#cfe0ff",background:"rgba(4,32,90,0.72)",backdropFilter:"blur(6px)",cursor:"pointer"},ae={...U,fontWeight:600,fontFamily:"ui-monospace, Consolas, monospace"},de={position:"absolute",inset:0,zIndex:4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.5)",pointerEvents:"none"},x={pointerEvents:"auto"},ce={position:"absolute",inset:0,zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:24},ue={position:"relative",width:110,height:110,marginBottom:16,display:"grid",placeItems:"center"},N={position:"absolute",inset:0,borderRadius:"50%",border:"2px solid rgba(255,255,255,0.55)",animation:"idos-empty-ripple 2.2s ease-out infinite"},pe={fontSize:46,animation:"idos-empty-float 3s ease-in-out infinite",filter:"drop-shadow(0 8px 12px rgba(0,0,0,0.25))"};function P(n){let{client:t,modules:e,events:s,surface:i,renderLogin:r}=n,[a,f]=react.useState(true),[c,u]=react.useState(null),g=()=>{u(w(e,{client:t,events:s,surface:i}));},b=react.useRef(false);react.useEffect(()=>{if(b.current)return;b.current=true;let m=core.readSsoCodeFromUrl();if(m){(async()=>((await t.auth.loginWithSsoCode(m.code)).ok&&g(),f(false)))();return}if(t.auth.lastAuthType===core.AuthType.None){f(false);return}(async()=>((await t.auth.autoLogin()).ok&&g(),f(false)))();},[t]),react.useEffect(()=>{let m=()=>u(null),v=t.on("auth:unauthorized",m),j=t.on("auth:loggedOut",m);return ()=>{v(),j();}},[t]);let o=c?"game":a?"loading":"login";return react.useEffect(()=>{C({screen:o,loggedIn:c!==null,userId:t.auth.context?.userID??null,titleId:t.titleID??null,modules:e.map(m=>m.id)});},[o,c,t,e]),c?jsxRuntime.jsx(L,{registrations:c,onLogout:()=>t.auth.logout(),userID:t.auth.context?.userID??null}):a?null:jsxRuntime.jsx(r,{client:t,onAuthenticated:g})}var ye='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 860 690" fill="#fff"><g transform="translate(243 -2)"><path d="M147.333 12.333c-13.6 2.534-12.533 1.2-12.933 15.067l-.4 12.267-4.533-11.067c-2.534-6-5.067-10.933-5.734-10.933-2.666 0-27.866 8.666-36.533 12.666-11.733 5.334-26.667 14.8-36.133 22.934l-6.934 5.866L51.6 69.267c8.133 11.066 7.333 11.466-5.067 2.933-7.6-5.067-8.4-5.333-11.466-3.733-3.467 1.866-18.4 17.333-20.4 21.2-.8 1.6 7.066 8.8 33.733 30.933l34.667 28.933 8.8-8.266c14.666-13.867 28.666-22 48.133-28.267 9.067-2.933 14.8-3.733 28.533-4.4 34.267-1.333 60 7.467 81.6 28.133 21.6 20.4 34.934 49.6 37.467 81.734l.8 11.2 14.8 4.533c8.133 2.533 23.733 7.333 34.667 10.8 10.933 3.333 20.4 5.6 21.066 4.933 1.6-1.6 6.134-20.533 7.734-32.666.8-6 1.333-17.6 1.066-25.6l-.4-14.667-8-1.067c-4.4-.533-10.133-1.466-12.666-1.866l-4.667-.8 4.667-1.2c16.933-4.534 18.666-5.2 18.666-8 0-5.467-9.6-31.334-16.666-44.8-4-7.6-10.667-18.667-14.934-24.667-9.866-13.867-31.333-35.467-45.2-45.2-10.4-7.467-34.4-20.933-37.2-21.067-.8 0-4 4-7.333 8.8-3.2 4.8-6.133 8.134-6.4 7.334s.4-5.6 1.6-10.667c1.2-5.2 2.133-9.6 2.133-9.867 0-.933-19.866-6.133-34.4-9.066-14.8-2.934-49.333-4.4-59.6-2.534"/><path d="M157.867 125.533c-21.067 3.334-42.134 14.8-57.467 31.334-13.333 14.133-13.733 12.8 5.6 22 9.2 4.4 16.667 8.266 16.667 8.533s-1.334.4-2.934.133c-13.866-2.133-41.6-5.866-41.733-5.6-.267.267-7.467 28.534-16.267 63.067l-16 62.667 7.334.4c4 .266 7.466.266 7.6 0 .266-.267 3.866-13.867 8.133-30.4 4.267-16.534 8.267-30.8 8.933-31.734.934-1.2 11.067-1.6 42.4-1.6 32.134 0 41.2.4 41.2 1.6 0 .934-1.733 4.667-3.866 8.4L153.733 261l-35.066 6.933c-19.334 3.867-35.2 7.2-35.467 7.467-.667.667-29.867 113.467-29.467 113.867.267.133 23.734-3.6 52.4-8.534l52-8.8 20.4-39.866c11.2-22 20.667-39.734 20.934-39.467.4.533-1.334 26.8-2.8 40.8l-.667 6.933 6.267-3.2c21.2-10.666 52.4-13.466 86.933-8l5.867.934-5.6-7.334C286.4 318.6 281.2 310.6 278 304.867c-5.867-10.134-6-10.8-6-21.867 0-6.267 1.467-20 3.333-30.667 1.867-10.666 3.334-19.466 3.334-19.466 0-.134-9.067-4.267-20.134-9.334s-19.466-9.333-18.8-9.6c.8-.266 7.734.8 15.6 2.267 7.734 1.6 14.4 2.8 14.8 2.8 1.2 0 .4-10.533-1.466-18-7.2-27.733-28-53.467-53.734-66-16.4-8-40.8-12-57.066-9.467"/><path d="M235.6 346.333c-24 4.534-44.133 13.867-68.267 31.467-14 10.267-28.533 18.133-47.733 25.867-23.467 9.466-52.8 32.666-64.4 50.666l-2.533 4L58 454.2c9.333-7.333 30.133-19.467 49.333-28.667C173.733 393.667 246.4 382.2 312.8 393c11.2 1.733 39.2 8.533 45.067 10.8 2.266.8 2.266.667.8-2.267-4-7.6-15.6-21.866-25.867-31.466-12-11.467-24.667-18.934-37.6-22.4-11.467-3.067-46.267-3.867-59.6-1.334"/></g><g transform="translate(-460 467)"><path d="M721.533 34.467c-14.933 5.466-22 17.466-22.933 38.666-.933 24.134 3.467 32.8 30.267 59.867 19.6 19.867 22.933 25.2 22.933 37.867.133 13.466-6.133 20.133-16.933 18.4-9.067-1.467-12.534-7.867-12.534-22.667V159H696.6l.667 13.333c.533 11.467 1.2 14.4 4.933 22 7.067 14.267 16.8 19.6 36.4 19.734 10.667.133 12.267-.134 20.667-4.4 7.6-3.867 9.733-5.867 13.2-11.734 7.6-12.533 9.066-32 3.733-47.6-3.733-11.066-10.667-20.4-27.867-37.2-19.866-19.6-22.533-24.133-22.666-38.4 0-8.933.4-10.533 3.2-13.6 6.266-6.666 18.266-5.6 22.133 2 1.067 2 2 7.067 2 11.2v7.334h27.067l-.934-9.2c-1.6-18.267-8.266-30.267-20-36.4-7.2-3.867-29.2-4.8-37.6-1.6M630.067 34.867c-11.734 4.666-18 11.6-21.734 24.4-1.866 6.4-2 15.333-1.733 67.2l.4 59.866 3.733 7.6c6.8 13.867 18.534 20.267 36.934 20.267 13.733 0 22.933-3.333 30.666-11.067 10.934-11.066 11.2-12.533 11.734-74.666.266-35.734-.134-56.934-1.067-62.8-2.667-16.134-11.6-27.467-24.8-31.467-8.933-2.667-26.4-2.267-34.133.667m28.666 26.8 3.6 4v56.666c0 40.934-.4 57.467-1.6 60-3.6 8-15.6 9.734-22.666 3.467l-4.4-3.867-.4-56.533c-.267-51.733-.134-56.8 2-61.067 3.066-5.866 7.6-8.266 14.4-7.466 3.733.4 6.4 1.866 9.066 4.8M511.667 123.133v89.334l29.066-.4c28.8-.4 28.934-.4 36.667-4.267 9.467-4.533 14.4-10.933 17.467-22.4 2-7.333 2.266-15.467 1.866-65.733l-.4-57.334-4.266-8.8c-8.267-16.666-17.2-19.866-55.334-19.866h-25.066zm53.6-60.266 4.4 3.866.4 52.8c.266 35.067-.134 54.4-1.067 58-2 7.467-5.733 9.6-18.667 10.4l-10.666.8V59h10.666c9.867 0 10.934.267 14.934 3.867M471.667 145v67.333h26.666V77.667h-26.666zM471.667 48.333V63h26.666V33.667h-26.666z"/></g><g transform="translate(-106 244)"><path d="M893.4 259.733c-6.8 3.467-9.2 5.6-12.667 11.467-10.666 17.733-9.2 42.933 3.467 62.267 2.8 4.266 12.267 14.8 20.933 23.333 9.867 9.467 17.067 17.733 18.934 21.6 5.6 11.333 5.2 25.333-.934 30.8-3.466 3.067-11.333 4.133-16.133 2.133-5.867-2.4-8-7.466-8-19.333v-10h-27.067l.8 11.6c1.2 15.867 3.867 24.133 10.267 31.333 7.467 8.534 16.4 12.134 30 12.267 19.067.133 30.133-5.733 37.333-19.867 3.734-7.466 4-8.666 4-24 0-16 0-16.133-5.2-26.666-4.4-9.2-7.733-13.2-23.066-28.534-21.067-21.066-24.8-27.066-24.934-40.4-.133-10.4 2.8-15.6 9.734-17.6 10.133-2.933 17.2 3.334 18.4 16.267l.8 8.267H955.4l-.8-10.8c-.533-8.4-1.6-12.667-4.8-19.2-7.067-14.134-16.667-19.334-36.133-19.334-10.667 0-12.534.4-20.267 4.4M791 346v89.333h76v-24h-48v-54.666h37.333v-24H819V282h48v-25.333h-76zM661.667 346v89.333h22.666l.134-63.066c0-34.534.533-61.734 1.066-60.267.534 1.467 5.467 29.867 10.8 62.933l9.867 60.4h13.067c7.2 0 13.066-.4 13.066-1.066 0-3.067 18.8-124.8 19.334-125.334.4-.4.666 27.867.666 62.8v63.6h25.334V256.667h-38l-9.2 61.6c-5.067 34-9.6 62.133-10 62.666-.534.534-5.334-26.4-10.667-60-5.467-33.466-10.133-61.733-10.533-62.666-.4-1.2-5.467-1.6-19.067-1.6h-18.533zM586.467 258.267c-.8 2.666-27.467 172.4-27.467 174.933 0 1.867 1.733 2.133 12 2.133h11.867l.8-4.4c.533-2.266 1.6-9.333 2.4-15.6l1.6-11.333 17.6-.4 17.466-.4 1.467 8.4c.8 4.667 1.733 11.867 2.267 16l.933 7.733h13.733c7.6 0 13.867-.266 13.867-.666 0-.8-26.533-168.134-27.467-173.734l-.8-4.266h-19.866c-14.8 0-20.134.4-20.4 1.6M613 336.533c3.333 23.067 5.867 42.134 5.6 42.4-.4.267-6.533.267-13.867.134l-13.2-.4 4.934-33.334c2.8-18.4 5.733-38.4 6.666-44.666C604.2 292.533 605 290.133 605.8 292c.533 1.467 3.867 21.467 7.2 44.533M497.267 257.2c-10.134 3.733-15.2 8.267-19.867 17.733L473 284l-.4 59.067c-.4 51.2-.133 60.133 1.733 66.533 5.6 19.333 17.067 27.333 39.467 27.467 10.267.133 12.267-.267 20.133-4.134 9.334-4.533 13.867-9.733 17.867-20.266 2-4.934 2.4-12 2.933-41.067l.534-34.933h-38.934v23.866l6.4.4 6.267.4v19.334c0 13.466-.533 20.666-1.867 23.733-5.066 12-23.333 10.4-26.8-2.4-.933-3.6-1.333-23.2-1.066-59.067.4-48.533.666-54.133 2.666-57.333 3.334-4.8 11.2-7.067 17.6-4.933 6.934 2.266 9.067 7.2 9.867 22.933l.667 13.067H555.4l-.8-15.734c-.8-18-3.067-25.6-9.867-33.466-7.466-8.8-13.466-11.2-29.066-11.734-9.067-.266-14.934.134-18.4 1.467"/></g></svg>',F=`data:image/svg+xml;utf8,${encodeURIComponent(ye)}`;var ve=["https://cloud.idosgames.com","https://idosgames.com","https://www.idosgames.com"];function K(){return typeof window<"u"&&ve.includes(window.location.origin)}function D({client:n,onAuthenticated:t}){let[e,s]=react.useState(false),[i,r]=react.useState(null),[a,f]=react.useState(true),c=async()=>{s(true),r(null),n.auth.setRememberSession(a);let u=await n.auth.loginWithDeviceID();if(u.ok){t();return}r(u.error),s(false);};return jsxRuntime.jsx("div",{style:p.root,children:jsxRuntime.jsxs("div",{style:p.card,children:[jsxRuntime.jsx("img",{src:F,alt:"iDos Games",style:p.logo}),jsxRuntime.jsx("h1",{style:p.title,children:"Sign in"}),K()&&jsxRuntime.jsx("button",{type:"button",onClick:()=>core.beginSsoRedirect({titleID:n.titleID}),disabled:e,style:{...p.primary,opacity:e?.6:1,cursor:e?"default":"pointer"},children:"Continue with iDos Games"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{c();},disabled:e,style:{...K()?p.ghost:p.primary,opacity:e?.6:1,cursor:e?"default":"pointer"},children:e?"Signing in\u2026":"Play as guest"}),jsxRuntime.jsxs("label",{style:{...p.remember,opacity:e?.6:1},children:[jsxRuntime.jsx("input",{type:"checkbox",checked:a,disabled:e,onChange:u=>f(u.target.checked),style:p.switchInput}),jsxRuntime.jsx("span",{style:{...p.switchTrack,background:a?"#fff":"rgba(255, 255, 255, 0.3)"},children:jsxRuntime.jsx("span",{style:{...p.switchKnob,left:a?"21px":"3px",background:a?"#0d66fe":"#fff"}})}),"Remember me"]}),i&&jsxRuntime.jsx("span",{style:p.error,children:i})]})})}var p={root:{position:"absolute",inset:0,display:"grid",placeItems:"center",background:"#0d66fe",color:"#fff",font:"14px system-ui, sans-serif"},card:{width:"min(340px, 88vw)",display:"grid",gap:"18px",justifyItems:"center"},logo:{width:"180px",userSelect:"none",pointerEvents:"none"},title:{margin:0,fontSize:"22px",fontWeight:600,textAlign:"center"},primary:{width:"100%",padding:"11px 16px",borderRadius:"8px",border:"none",background:"#fff",color:"#0d66fe",fontWeight:600,font:"inherit"},ghost:{width:"100%",padding:"11px 16px",borderRadius:"8px",border:"1px solid rgba(255, 255, 255, 0.45)",background:"transparent",color:"#fff",fontWeight:600,font:"inherit"},remember:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",color:"rgba(255, 255, 255, 0.85)"},switchInput:{position:"absolute",opacity:0,width:0,height:0},switchTrack:{position:"relative",width:"42px",height:"24px",borderRadius:"12px",transition:"background 0.15s",flexShrink:0},switchKnob:{position:"absolute",top:"3px",width:"18px",height:"18px",borderRadius:"50%",transition:"left 0.15s, background 0.15s"},error:{color:"#ffd7d7",textAlign:"center"}};function Re(n){let{container:t,client:e,modules:s,renderLogin:i}=n;t.style.position="relative";let r=document.createElement("div");Object.assign(r.style,{position:"absolute",inset:"0",zIndex:"0",pointerEvents:"none"});let a=document.createElement("div");Object.assign(a.style,{position:"absolute",inset:"0",zIndex:"1"}),t.append(r,a);let f=R(),c=k(r),u=client.createRoot(a);return u.render(jsxRuntime.jsx(react$1.IDosGamesProvider,{client:e,children:jsxRuntime.jsx(react$1.StatusProvider,{children:jsxRuntime.jsx(P,{client:e,modules:s,events:f,surface:c,renderLogin:i??D})})})),{unmount(){u.unmount(),r.remove(),a.remove();}}}
|
|
11
|
-
exports.AuthGate=
|
|
10
|
+
`}),jsxRuntime.jsxs("div",{style:_e,children:[jsxRuntime.jsx("span",{style:{...ae,animationDelay:"0s"}}),jsxRuntime.jsx("span",{style:{...ae,animationDelay:"1.1s"}}),jsxRuntime.jsx("span",{style:je,children:"\u{1F9E9}"})]}),jsxRuntime.jsx("div",{style:{fontWeight:700,fontSize:18,marginBottom:6},children:"No modules installed"}),jsxRuntime.jsxs("div",{style:{opacity:.85,maxWidth:380,lineHeight:1.5},children:["Add a module under ",jsxRuntime.jsx("code",{children:"src/modules/"})," and register it in"," ",jsxRuntime.jsx("code",{children:"src/modules.ts"}),". The host shell will pick it up here."]})]})}var He={position:"absolute",inset:0,overflow:"hidden",background:"#0d66fe",color:"#fff",fontFamily:"system-ui, sans-serif"},Le={position:"absolute",inset:0,zIndex:0},de=16,Ue={position:"absolute",top:0,right:0,bottom:0,left:0,zIndex:1,pointerEvents:"none"},$e={display:"contents",pointerEvents:"auto"},Pe={position:"absolute",top:0,left:0,right:0,zIndex:2,display:"flex",gap:12,padding:16,pointerEvents:"none"},Oe={position:"absolute",top:0,right:0,bottom:0,width:340,maxWidth:"40vw",zIndex:2,display:"flex",flexDirection:"column",gap:12,padding:16,overflowY:"auto",pointerEvents:"none"},Te={position:"absolute",bottom:de,left:"50%",transform:"translateX(-50%)",zIndex:3,display:"flex",gap:8,padding:6,borderRadius:14,background:"rgba(4,32,90,0.72)",backdropFilter:"blur(6px)",pointerEvents:"auto"},ce={border:"none",borderRadius:10,padding:"8px 16px",fontWeight:700,fontSize:14,color:"#cfe0ff",background:"transparent",cursor:"pointer"},De={...ce,color:"#0d66fe",background:"#fff"},Be={position:"absolute",bottom:16,left:16,zIndex:3,display:"flex",gap:8,alignItems:"center",pointerEvents:"auto"},ue={border:"none",borderRadius:12,padding:"8px 14px",fontWeight:700,fontSize:13,color:"#cfe0ff",background:"rgba(4,32,90,0.72)",backdropFilter:"blur(6px)",cursor:"pointer"},ze={...ue,fontWeight:600,fontFamily:"ui-monospace, Consolas, monospace"},Ge={position:"absolute",inset:0,zIndex:4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.5)",pointerEvents:"none"},V={pointerEvents:"auto"},Ne={position:"absolute",inset:0,zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:24},_e={position:"relative",width:110,height:110,marginBottom:16,display:"grid",placeItems:"center"},ae={position:"absolute",inset:0,borderRadius:"50%",border:"2px solid rgba(255,255,255,0.55)",animation:"idos-empty-ripple 2.2s ease-out infinite"},je={fontSize:46,animation:"idos-empty-float 3s ease-in-out infinite",filter:"drop-shadow(0 8px 12px rgba(0,0,0,0.25))"};function q(e){let{client:o,modules:t,events:l,sharedUi:n,surface:a,renderLogin:c}=e,[g,u]=react.useState(true),[r,s]=react.useState(null),p=react.useRef(null),f=()=>{for(let v of p.current??[])v.dispose();p.current=null;},d=()=>{f();let v=j(t,{client:o,events:l,surface:a,sharedUi:n});p.current=v,s(v);};react.useEffect(()=>()=>f(),[]);let y=react.useRef(false);react.useEffect(()=>{if(y.current)return;y.current=true;let v=core.readSsoCodeFromUrl();if(v){(async()=>((await o.auth.loginWithSsoCode(v.code)).ok&&d(),u(false)))();return}if(o.auth.lastAuthType===core.AuthType.None){u(false);return}(async()=>((await o.auth.autoLogin()).ok&&d(),u(false)))();},[o]),react.useEffect(()=>{let v=()=>{f(),s(null);},x=o.on("auth:unauthorized",v),E=o.on("auth:loggedOut",v);return ()=>{x(),E();}},[o]);let b=r?"game":g?"loading":"login";return react.useEffect(()=>{G({screen:b,loggedIn:r!==null,userId:o.auth.context?.userID??null,titleId:o.titleID??null,modules:t.map(v=>v.id),sharedUi:n});},[b,r,o,t,n]),r?jsxRuntime.jsx(K,{registrations:r,sharedUi:n,events:l,onLogout:()=>o.auth.logout(),userID:o.auth.context?.userID??null}):g?null:jsxRuntime.jsx(c,{client:o,onAuthenticated:d})}var Fe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 860 690" fill="#fff"><g transform="translate(243 -2)"><path d="M147.333 12.333c-13.6 2.534-12.533 1.2-12.933 15.067l-.4 12.267-4.533-11.067c-2.534-6-5.067-10.933-5.734-10.933-2.666 0-27.866 8.666-36.533 12.666-11.733 5.334-26.667 14.8-36.133 22.934l-6.934 5.866L51.6 69.267c8.133 11.066 7.333 11.466-5.067 2.933-7.6-5.067-8.4-5.333-11.466-3.733-3.467 1.866-18.4 17.333-20.4 21.2-.8 1.6 7.066 8.8 33.733 30.933l34.667 28.933 8.8-8.266c14.666-13.867 28.666-22 48.133-28.267 9.067-2.933 14.8-3.733 28.533-4.4 34.267-1.333 60 7.467 81.6 28.133 21.6 20.4 34.934 49.6 37.467 81.734l.8 11.2 14.8 4.533c8.133 2.533 23.733 7.333 34.667 10.8 10.933 3.333 20.4 5.6 21.066 4.933 1.6-1.6 6.134-20.533 7.734-32.666.8-6 1.333-17.6 1.066-25.6l-.4-14.667-8-1.067c-4.4-.533-10.133-1.466-12.666-1.866l-4.667-.8 4.667-1.2c16.933-4.534 18.666-5.2 18.666-8 0-5.467-9.6-31.334-16.666-44.8-4-7.6-10.667-18.667-14.934-24.667-9.866-13.867-31.333-35.467-45.2-45.2-10.4-7.467-34.4-20.933-37.2-21.067-.8 0-4 4-7.333 8.8-3.2 4.8-6.133 8.134-6.4 7.334s.4-5.6 1.6-10.667c1.2-5.2 2.133-9.6 2.133-9.867 0-.933-19.866-6.133-34.4-9.066-14.8-2.934-49.333-4.4-59.6-2.534"/><path d="M157.867 125.533c-21.067 3.334-42.134 14.8-57.467 31.334-13.333 14.133-13.733 12.8 5.6 22 9.2 4.4 16.667 8.266 16.667 8.533s-1.334.4-2.934.133c-13.866-2.133-41.6-5.866-41.733-5.6-.267.267-7.467 28.534-16.267 63.067l-16 62.667 7.334.4c4 .266 7.466.266 7.6 0 .266-.267 3.866-13.867 8.133-30.4 4.267-16.534 8.267-30.8 8.933-31.734.934-1.2 11.067-1.6 42.4-1.6 32.134 0 41.2.4 41.2 1.6 0 .934-1.733 4.667-3.866 8.4L153.733 261l-35.066 6.933c-19.334 3.867-35.2 7.2-35.467 7.467-.667.667-29.867 113.467-29.467 113.867.267.133 23.734-3.6 52.4-8.534l52-8.8 20.4-39.866c11.2-22 20.667-39.734 20.934-39.467.4.533-1.334 26.8-2.8 40.8l-.667 6.933 6.267-3.2c21.2-10.666 52.4-13.466 86.933-8l5.867.934-5.6-7.334C286.4 318.6 281.2 310.6 278 304.867c-5.867-10.134-6-10.8-6-21.867 0-6.267 1.467-20 3.333-30.667 1.867-10.666 3.334-19.466 3.334-19.466 0-.134-9.067-4.267-20.134-9.334s-19.466-9.333-18.8-9.6c.8-.266 7.734.8 15.6 2.267 7.734 1.6 14.4 2.8 14.8 2.8 1.2 0 .4-10.533-1.466-18-7.2-27.733-28-53.467-53.734-66-16.4-8-40.8-12-57.066-9.467"/><path d="M235.6 346.333c-24 4.534-44.133 13.867-68.267 31.467-14 10.267-28.533 18.133-47.733 25.867-23.467 9.466-52.8 32.666-64.4 50.666l-2.533 4L58 454.2c9.333-7.333 30.133-19.467 49.333-28.667C173.733 393.667 246.4 382.2 312.8 393c11.2 1.733 39.2 8.533 45.067 10.8 2.266.8 2.266.667.8-2.267-4-7.6-15.6-21.866-25.867-31.466-12-11.467-24.667-18.934-37.6-22.4-11.467-3.067-46.267-3.867-59.6-1.334"/></g><g transform="translate(-460 467)"><path d="M721.533 34.467c-14.933 5.466-22 17.466-22.933 38.666-.933 24.134 3.467 32.8 30.267 59.867 19.6 19.867 22.933 25.2 22.933 37.867.133 13.466-6.133 20.133-16.933 18.4-9.067-1.467-12.534-7.867-12.534-22.667V159H696.6l.667 13.333c.533 11.467 1.2 14.4 4.933 22 7.067 14.267 16.8 19.6 36.4 19.734 10.667.133 12.267-.134 20.667-4.4 7.6-3.867 9.733-5.867 13.2-11.734 7.6-12.533 9.066-32 3.733-47.6-3.733-11.066-10.667-20.4-27.867-37.2-19.866-19.6-22.533-24.133-22.666-38.4 0-8.933.4-10.533 3.2-13.6 6.266-6.666 18.266-5.6 22.133 2 1.067 2 2 7.067 2 11.2v7.334h27.067l-.934-9.2c-1.6-18.267-8.266-30.267-20-36.4-7.2-3.867-29.2-4.8-37.6-1.6M630.067 34.867c-11.734 4.666-18 11.6-21.734 24.4-1.866 6.4-2 15.333-1.733 67.2l.4 59.866 3.733 7.6c6.8 13.867 18.534 20.267 36.934 20.267 13.733 0 22.933-3.333 30.666-11.067 10.934-11.066 11.2-12.533 11.734-74.666.266-35.734-.134-56.934-1.067-62.8-2.667-16.134-11.6-27.467-24.8-31.467-8.933-2.667-26.4-2.267-34.133.667m28.666 26.8 3.6 4v56.666c0 40.934-.4 57.467-1.6 60-3.6 8-15.6 9.734-22.666 3.467l-4.4-3.867-.4-56.533c-.267-51.733-.134-56.8 2-61.067 3.066-5.866 7.6-8.266 14.4-7.466 3.733.4 6.4 1.866 9.066 4.8M511.667 123.133v89.334l29.066-.4c28.8-.4 28.934-.4 36.667-4.267 9.467-4.533 14.4-10.933 17.467-22.4 2-7.333 2.266-15.467 1.866-65.733l-.4-57.334-4.266-8.8c-8.267-16.666-17.2-19.866-55.334-19.866h-25.066zm53.6-60.266 4.4 3.866.4 52.8c.266 35.067-.134 54.4-1.067 58-2 7.467-5.733 9.6-18.667 10.4l-10.666.8V59h10.666c9.867 0 10.934.267 14.934 3.867M471.667 145v67.333h26.666V77.667h-26.666zM471.667 48.333V63h26.666V33.667h-26.666z"/></g><g transform="translate(-106 244)"><path d="M893.4 259.733c-6.8 3.467-9.2 5.6-12.667 11.467-10.666 17.733-9.2 42.933 3.467 62.267 2.8 4.266 12.267 14.8 20.933 23.333 9.867 9.467 17.067 17.733 18.934 21.6 5.6 11.333 5.2 25.333-.934 30.8-3.466 3.067-11.333 4.133-16.133 2.133-5.867-2.4-8-7.466-8-19.333v-10h-27.067l.8 11.6c1.2 15.867 3.867 24.133 10.267 31.333 7.467 8.534 16.4 12.134 30 12.267 19.067.133 30.133-5.733 37.333-19.867 3.734-7.466 4-8.666 4-24 0-16 0-16.133-5.2-26.666-4.4-9.2-7.733-13.2-23.066-28.534-21.067-21.066-24.8-27.066-24.934-40.4-.133-10.4 2.8-15.6 9.734-17.6 10.133-2.933 17.2 3.334 18.4 16.267l.8 8.267H955.4l-.8-10.8c-.533-8.4-1.6-12.667-4.8-19.2-7.067-14.134-16.667-19.334-36.133-19.334-10.667 0-12.534.4-20.267 4.4M791 346v89.333h76v-24h-48v-54.666h37.333v-24H819V282h48v-25.333h-76zM661.667 346v89.333h22.666l.134-63.066c0-34.534.533-61.734 1.066-60.267.534 1.467 5.467 29.867 10.8 62.933l9.867 60.4h13.067c7.2 0 13.066-.4 13.066-1.066 0-3.067 18.8-124.8 19.334-125.334.4-.4.666 27.867.666 62.8v63.6h25.334V256.667h-38l-9.2 61.6c-5.067 34-9.6 62.133-10 62.666-.534.534-5.334-26.4-10.667-60-5.467-33.466-10.133-61.733-10.533-62.666-.4-1.2-5.467-1.6-19.067-1.6h-18.533zM586.467 258.267c-.8 2.666-27.467 172.4-27.467 174.933 0 1.867 1.733 2.133 12 2.133h11.867l.8-4.4c.533-2.266 1.6-9.333 2.4-15.6l1.6-11.333 17.6-.4 17.466-.4 1.467 8.4c.8 4.667 1.733 11.867 2.267 16l.933 7.733h13.733c7.6 0 13.867-.266 13.867-.666 0-.8-26.533-168.134-27.467-173.734l-.8-4.266h-19.866c-14.8 0-20.134.4-20.4 1.6M613 336.533c3.333 23.067 5.867 42.134 5.6 42.4-.4.267-6.533.267-13.867.134l-13.2-.4 4.934-33.334c2.8-18.4 5.733-38.4 6.666-44.666C604.2 292.533 605 290.133 605.8 292c.533 1.467 3.867 21.467 7.2 44.533M497.267 257.2c-10.134 3.733-15.2 8.267-19.867 17.733L473 284l-.4 59.067c-.4 51.2-.133 60.133 1.733 66.533 5.6 19.333 17.067 27.333 39.467 27.467 10.267.133 12.267-.267 20.133-4.134 9.334-4.533 13.867-9.733 17.867-20.266 2-4.934 2.4-12 2.933-41.067l.534-34.933h-38.934v23.866l6.4.4 6.267.4v19.334c0 13.466-.533 20.666-1.867 23.733-5.066 12-23.333 10.4-26.8-2.4-.933-3.6-1.333-23.2-1.066-59.067.4-48.533.666-54.133 2.666-57.333 3.334-4.8 11.2-7.067 17.6-4.933 6.934 2.266 9.067 7.2 9.867 22.933l.667 13.067H555.4l-.8-15.734c-.8-18-3.067-25.6-9.867-33.466-7.466-8.8-13.466-11.2-29.066-11.734-9.067-.266-14.934.134-18.4 1.467"/></g></svg>',he=`data:image/svg+xml;utf8,${encodeURIComponent(Fe)}`;var qe=["https://cloud.idosgames.com","https://idosgames.com","https://www.idosgames.com"];function ge(){return typeof window<"u"&&qe.includes(window.location.origin)}function X({client:e,onAuthenticated:o}){let[t,l]=react.useState(false),[n,a]=react.useState(null),[c,g]=react.useState(true),u=async()=>{l(true),a(null),e.auth.setRememberSession(c);let r=await e.auth.loginWithDeviceID();if(r.ok){o();return}a(r.error),l(false);};return jsxRuntime.jsx("div",{style:w.root,children:jsxRuntime.jsxs("div",{style:w.card,children:[jsxRuntime.jsx("img",{src:he,alt:"iDos Games",style:w.logo}),jsxRuntime.jsx("h1",{style:w.title,children:"Sign in"}),ge()&&jsxRuntime.jsx("button",{type:"button",onClick:()=>core.beginSsoRedirect({titleID:e.titleID}),disabled:t,style:{...w.primary,opacity:t?.6:1,cursor:t?"default":"pointer"},children:"Continue with iDos Games"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>{u();},disabled:t,style:{...ge()?w.ghost:w.primary,opacity:t?.6:1,cursor:t?"default":"pointer"},children:t?"Signing in\u2026":"Play as guest"}),jsxRuntime.jsxs("label",{style:{...w.remember,opacity:t?.6:1},children:[jsxRuntime.jsx("input",{type:"checkbox",checked:c,disabled:t,onChange:r=>g(r.target.checked),style:w.switchInput}),jsxRuntime.jsx("span",{style:{...w.switchTrack,background:c?"#fff":"rgba(255, 255, 255, 0.3)"},children:jsxRuntime.jsx("span",{style:{...w.switchKnob,left:c?"21px":"3px",background:c?"#0d66fe":"#fff"}})}),"Remember me"]}),n&&jsxRuntime.jsx("span",{style:w.error,children:n})]})})}var w={root:{position:"absolute",inset:0,display:"grid",placeItems:"center",background:"#0d66fe",color:"#fff",font:"14px system-ui, sans-serif"},card:{width:"min(340px, 88vw)",display:"grid",gap:"18px",justifyItems:"center"},logo:{width:"180px",userSelect:"none",pointerEvents:"none"},title:{margin:0,fontSize:"22px",fontWeight:600,textAlign:"center"},primary:{width:"100%",padding:"11px 16px",borderRadius:"8px",border:"none",background:"#fff",color:"#0d66fe",fontWeight:600,font:"inherit"},ghost:{width:"100%",padding:"11px 16px",borderRadius:"8px",border:"1px solid rgba(255, 255, 255, 0.45)",background:"transparent",color:"#fff",fontWeight:600,font:"inherit"},remember:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",color:"rgba(255, 255, 255, 0.85)"},switchInput:{position:"absolute",opacity:0,width:0,height:0},switchTrack:{position:"relative",width:"42px",height:"24px",borderRadius:"12px",transition:"background 0.15s",flexShrink:0},switchKnob:{position:"absolute",top:"3px",width:"18px",height:"18px",borderRadius:"50%",transition:"left 0.15s, background 0.15s"},error:{color:"#ffd7d7",textAlign:"center"}};function Qe(e){let{container:o,client:t,modules:l,renderLogin:n}=e;o.style.position="relative";let a=document.createElement("div");Object.assign(a.style,{position:"absolute",inset:"0",zIndex:"0",pointerEvents:"none"});let c=document.createElement("div");Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"1"}),o.append(a,c);let g=T(),u=B(a);N(()=>g.describe());let r=I(l);for(let p of r.warnings)console.warn(`[idos shared-ui] ${p}`);let s=client.createRoot(c);return s.render(jsxRuntime.jsx(react$1.IDosGamesProvider,{client:t,children:jsxRuntime.jsx(react$1.StatusProvider,{children:jsxRuntime.jsx(q,{client:t,modules:l,events:g,sharedUi:r.owners,surface:u,renderLogin:n??X})})})),{unmount(){s.unmount(),a.remove(),c.remove();}}}
|
|
11
|
+
exports.AuthGate=q;exports.DefaultLoginScreen=X;exports.HostShell=K;exports.SceneStage=C;exports.createHostEventBus=T;exports.createSharedEventBus=xe;exports.createSurfaceAllocator=B;exports.emptySharedUiOwners=re;exports.mountHost=Qe;exports.publishEventsProvider=N;exports.publishHostState=G;exports.registerAgentApi=z;exports.resolveSharedUi=I;exports.runModules=j;exports.sharedUiFor=D;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleEvents, Topic, SharedEventBus, SharedUiRole, Module, SharedUiContext, IDosGamesClient, SurfaceAllocator, EngineScene, UiPanel, RouteEntry, ModuleAgentApi } from '@idosgames/module-sdk';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
/** One delivered (or refused) event, as the agent sees it. */
|
|
5
|
+
interface EventLogEntry {
|
|
6
|
+
topic: string;
|
|
7
|
+
/** Emitting module id, or "host". */
|
|
8
|
+
from: string;
|
|
9
|
+
at: number;
|
|
10
|
+
/** How many handlers were called. */
|
|
11
|
+
delivered: number;
|
|
12
|
+
/** Set when the bus refused the event outright (bad name, foreign namespace). */
|
|
13
|
+
rejected?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Snapshot for the agent (`__IDOS_AGENT__.events()`). */
|
|
16
|
+
interface HostEventBusDescription {
|
|
17
|
+
log: EventLogEntry[];
|
|
18
|
+
/** topic → module ids subscribed to it. */
|
|
19
|
+
listeners: Record<string, string[]>;
|
|
20
|
+
/** topic → module ids that emitted it this session. */
|
|
21
|
+
emitted: Record<string, string[]>;
|
|
22
|
+
/** Human hints, e.g. "board-game listens to a@1, but only a@2 has been emitted". */
|
|
23
|
+
mismatches: string[];
|
|
24
|
+
}
|
|
25
|
+
/** `ctx.events` plus the host-only teardown. */
|
|
26
|
+
interface ModuleEventHandle extends ModuleEvents {
|
|
27
|
+
/** Remove every subscription made through this handle; later calls on it are ignored. */
|
|
28
|
+
dispose(): void;
|
|
29
|
+
}
|
|
30
|
+
interface HostEventBus {
|
|
31
|
+
/** The scoped handle for one module — what `ctx.events` is. */
|
|
32
|
+
forModule(moduleId: string): ModuleEventHandle;
|
|
33
|
+
/** Emit a `host:` topic (e.g. `hostTopics.modeChanged`). */
|
|
34
|
+
emitAsHost<T>(topic: Topic<T>, payload: T): void;
|
|
35
|
+
describe(): HostEventBusDescription;
|
|
36
|
+
}
|
|
37
|
+
declare function createHostEventBus(): HostEventBus;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated The pre-0.2 unscoped string bus (no namespaces, no isolation, no teardown). The host
|
|
40
|
+
* now hands every module a scoped handle from `createHostEventBus().forModule(id)`.
|
|
41
|
+
*/
|
|
42
|
+
declare function createSharedEventBus(): SharedEventBus;
|
|
43
|
+
|
|
44
|
+
/** role → owning module id, or null when nobody took the role. */
|
|
45
|
+
type SharedUiOwners = Record<SharedUiRole, string | null>;
|
|
46
|
+
interface SharedUiResolution {
|
|
47
|
+
owners: SharedUiOwners;
|
|
48
|
+
/** Human-readable problems: conflicts, unknown roles, unmet `requires`. The host console.warns them. */
|
|
49
|
+
warnings: string[];
|
|
50
|
+
}
|
|
51
|
+
declare function emptySharedUiOwners(): SharedUiOwners;
|
|
52
|
+
declare function resolveSharedUi(modules: readonly Pick<Module, "id" | "sharedUi">[]): SharedUiResolution;
|
|
53
|
+
/** The `ctx.sharedUi` a given module receives. */
|
|
54
|
+
declare function sharedUiFor(owners: SharedUiOwners, moduleId: string): SharedUiContext;
|
|
55
|
+
|
|
4
56
|
/** What a login screen receives from the host. */
|
|
5
57
|
interface LoginScreenProps {
|
|
6
58
|
/** The (not yet authenticated) shared client. Call any `client.auth.login*` method on it. */
|
|
@@ -24,7 +76,9 @@ type RenderLogin = (props: LoginScreenProps) => ReactNode;
|
|
|
24
76
|
declare function AuthGate(props: {
|
|
25
77
|
client: IDosGamesClient;
|
|
26
78
|
modules: readonly Module[];
|
|
27
|
-
events:
|
|
79
|
+
events: HostEventBus;
|
|
80
|
+
/** Resolved shared-UI owners (see `resolveSharedUi`). */
|
|
81
|
+
sharedUi: SharedUiOwners;
|
|
28
82
|
surface: SurfaceAllocator;
|
|
29
83
|
renderLogin: RenderLogin;
|
|
30
84
|
}): ReactNode;
|
|
@@ -75,18 +129,30 @@ interface ModuleRegistration {
|
|
|
75
129
|
scenes: EngineScene[];
|
|
76
130
|
panels: UiPanel[];
|
|
77
131
|
routes: RouteEntry[];
|
|
132
|
+
/**
|
|
133
|
+
* Undo what `setup()` left behind on shared services — today, the module's event subscriptions.
|
|
134
|
+
* The host calls it before re-running `setup()` (re-login) and on logout; without it every login
|
|
135
|
+
* would add one more copy of each handler to the session-wide bus.
|
|
136
|
+
*/
|
|
137
|
+
dispose(): void;
|
|
78
138
|
}
|
|
79
139
|
/** Shared services every module receives — created once per host session. */
|
|
80
140
|
interface SharedServices {
|
|
81
141
|
client: IDosGamesClient;
|
|
82
|
-
events:
|
|
142
|
+
events: HostEventBus;
|
|
83
143
|
surface: SurfaceAllocator;
|
|
144
|
+
/** Resolved shared-UI owners. Resolved here from the modules when omitted. */
|
|
145
|
+
sharedUi?: SharedUiOwners;
|
|
84
146
|
}
|
|
85
147
|
/** Install every module and return their collected registrations, in declaration order. */
|
|
86
148
|
declare function runModules(modules: readonly Module[], shared: SharedServices): ModuleRegistration[];
|
|
87
149
|
|
|
88
|
-
declare function HostShell({ registrations, onLogout, userID, }: {
|
|
150
|
+
declare function HostShell({ registrations, sharedUi, events, onLogout, userID, }: {
|
|
89
151
|
registrations: readonly ModuleRegistration[];
|
|
152
|
+
/** Shared-UI owners. When a module owns "account", the host does not draw its own logout/ID row. */
|
|
153
|
+
sharedUi?: SharedUiOwners;
|
|
154
|
+
/** The host bus — used to announce mode switches (`host:mode-changed@1`). */
|
|
155
|
+
events?: HostEventBus;
|
|
90
156
|
/** Renders a "Log out" control in the host chrome (bottom-left) when provided. */
|
|
91
157
|
onLogout?: () => void;
|
|
92
158
|
/** Shown next to the logout control; click copies it to the clipboard. */
|
|
@@ -108,12 +174,23 @@ interface AgentHostState {
|
|
|
108
174
|
titleId: string | null;
|
|
109
175
|
/** Идентификаторы установленных модулей — включая те, что агенту ничего не открыли. */
|
|
110
176
|
modules: string[];
|
|
177
|
+
/**
|
|
178
|
+
* Кто рисует общий интерфейс: роль → id модуля или null. Отвечает агенту на вопрос «почему у
|
|
179
|
+
* шаблона пропал кошелёк» — его взял поставщик роли, это не поломка.
|
|
180
|
+
*/
|
|
181
|
+
sharedUi?: Record<string, string | null>;
|
|
111
182
|
}
|
|
112
183
|
/** Что видит зонд. Версия — чтобы старый зонд не гадал по форме объекта. */
|
|
113
184
|
interface AgentBridgeGlobal {
|
|
114
185
|
version: 1;
|
|
115
186
|
modules: Record<string, ModuleAgentApi>;
|
|
116
187
|
host?: AgentHostState;
|
|
188
|
+
/**
|
|
189
|
+
* Журнал шины событий: последние события, кто что слушает, подсказки о расхождении версий
|
|
190
|
+
* топиков. Функция, а не снимок, — журнал меняется между запросами зонда. Поле добавлено без
|
|
191
|
+
* смены `version`: старый зонд его просто не читает.
|
|
192
|
+
*/
|
|
193
|
+
events?: () => unknown;
|
|
117
194
|
}
|
|
118
195
|
/**
|
|
119
196
|
* Зарегистрировать debug-поверхность модуля. Вызывается из `ctx.exposeToAgent` при `setup()`.
|
|
@@ -126,6 +203,8 @@ declare function registerAgentApi(moduleId: string, api: ModuleAgentApi): void;
|
|
|
126
203
|
* ровно то, что делает ответ зонда осмысленным без всякой кооперации со стороны игры.
|
|
127
204
|
*/
|
|
128
205
|
declare function publishHostState(state: AgentHostState): void;
|
|
206
|
+
/** Подключить журнал шины событий (зовёт `mountHost` один раз на сессию хоста). */
|
|
207
|
+
declare function publishEventsProvider(provider: () => unknown): void;
|
|
129
208
|
|
|
130
209
|
declare class SceneStage {
|
|
131
210
|
private readonly container;
|
|
@@ -140,10 +219,7 @@ declare class SceneStage {
|
|
|
140
219
|
destroy(): void;
|
|
141
220
|
}
|
|
142
221
|
|
|
143
|
-
/** In-memory pub/sub shared by all modules for a host session. */
|
|
144
|
-
declare function createSharedEventBus(): SharedEventBus;
|
|
145
|
-
|
|
146
222
|
/** Creates an allocator whose surfaces are appended to `layer`. */
|
|
147
223
|
declare function createSurfaceAllocator(layer: HTMLElement): SurfaceAllocator;
|
|
148
224
|
|
|
149
|
-
export { type AgentBridgeGlobal, type AgentHostState, AuthGate, DefaultLoginScreen, type HostHandle, HostShell, type LoginScreenProps, type ModuleRegistration, type RenderLogin, SceneStage, type SharedServices, createSharedEventBus, createSurfaceAllocator, mountHost, publishHostState, registerAgentApi, runModules };
|
|
225
|
+
export { type AgentBridgeGlobal, type AgentHostState, AuthGate, DefaultLoginScreen, type EventLogEntry, type HostEventBus, type HostEventBusDescription, type HostHandle, HostShell, type LoginScreenProps, type ModuleEventHandle, type ModuleRegistration, type RenderLogin, SceneStage, type SharedServices, type SharedUiOwners, type SharedUiResolution, createHostEventBus, createSharedEventBus, createSurfaceAllocator, emptySharedUiOwners, mountHost, publishEventsProvider, publishHostState, registerAgentApi, resolveSharedUi, runModules, sharedUiFor };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleEvents, Topic, SharedEventBus, SharedUiRole, Module, SharedUiContext, IDosGamesClient, SurfaceAllocator, EngineScene, UiPanel, RouteEntry, ModuleAgentApi } from '@idosgames/module-sdk';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
/** One delivered (or refused) event, as the agent sees it. */
|
|
5
|
+
interface EventLogEntry {
|
|
6
|
+
topic: string;
|
|
7
|
+
/** Emitting module id, or "host". */
|
|
8
|
+
from: string;
|
|
9
|
+
at: number;
|
|
10
|
+
/** How many handlers were called. */
|
|
11
|
+
delivered: number;
|
|
12
|
+
/** Set when the bus refused the event outright (bad name, foreign namespace). */
|
|
13
|
+
rejected?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Snapshot for the agent (`__IDOS_AGENT__.events()`). */
|
|
16
|
+
interface HostEventBusDescription {
|
|
17
|
+
log: EventLogEntry[];
|
|
18
|
+
/** topic → module ids subscribed to it. */
|
|
19
|
+
listeners: Record<string, string[]>;
|
|
20
|
+
/** topic → module ids that emitted it this session. */
|
|
21
|
+
emitted: Record<string, string[]>;
|
|
22
|
+
/** Human hints, e.g. "board-game listens to a@1, but only a@2 has been emitted". */
|
|
23
|
+
mismatches: string[];
|
|
24
|
+
}
|
|
25
|
+
/** `ctx.events` plus the host-only teardown. */
|
|
26
|
+
interface ModuleEventHandle extends ModuleEvents {
|
|
27
|
+
/** Remove every subscription made through this handle; later calls on it are ignored. */
|
|
28
|
+
dispose(): void;
|
|
29
|
+
}
|
|
30
|
+
interface HostEventBus {
|
|
31
|
+
/** The scoped handle for one module — what `ctx.events` is. */
|
|
32
|
+
forModule(moduleId: string): ModuleEventHandle;
|
|
33
|
+
/** Emit a `host:` topic (e.g. `hostTopics.modeChanged`). */
|
|
34
|
+
emitAsHost<T>(topic: Topic<T>, payload: T): void;
|
|
35
|
+
describe(): HostEventBusDescription;
|
|
36
|
+
}
|
|
37
|
+
declare function createHostEventBus(): HostEventBus;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated The pre-0.2 unscoped string bus (no namespaces, no isolation, no teardown). The host
|
|
40
|
+
* now hands every module a scoped handle from `createHostEventBus().forModule(id)`.
|
|
41
|
+
*/
|
|
42
|
+
declare function createSharedEventBus(): SharedEventBus;
|
|
43
|
+
|
|
44
|
+
/** role → owning module id, or null when nobody took the role. */
|
|
45
|
+
type SharedUiOwners = Record<SharedUiRole, string | null>;
|
|
46
|
+
interface SharedUiResolution {
|
|
47
|
+
owners: SharedUiOwners;
|
|
48
|
+
/** Human-readable problems: conflicts, unknown roles, unmet `requires`. The host console.warns them. */
|
|
49
|
+
warnings: string[];
|
|
50
|
+
}
|
|
51
|
+
declare function emptySharedUiOwners(): SharedUiOwners;
|
|
52
|
+
declare function resolveSharedUi(modules: readonly Pick<Module, "id" | "sharedUi">[]): SharedUiResolution;
|
|
53
|
+
/** The `ctx.sharedUi` a given module receives. */
|
|
54
|
+
declare function sharedUiFor(owners: SharedUiOwners, moduleId: string): SharedUiContext;
|
|
55
|
+
|
|
4
56
|
/** What a login screen receives from the host. */
|
|
5
57
|
interface LoginScreenProps {
|
|
6
58
|
/** The (not yet authenticated) shared client. Call any `client.auth.login*` method on it. */
|
|
@@ -24,7 +76,9 @@ type RenderLogin = (props: LoginScreenProps) => ReactNode;
|
|
|
24
76
|
declare function AuthGate(props: {
|
|
25
77
|
client: IDosGamesClient;
|
|
26
78
|
modules: readonly Module[];
|
|
27
|
-
events:
|
|
79
|
+
events: HostEventBus;
|
|
80
|
+
/** Resolved shared-UI owners (see `resolveSharedUi`). */
|
|
81
|
+
sharedUi: SharedUiOwners;
|
|
28
82
|
surface: SurfaceAllocator;
|
|
29
83
|
renderLogin: RenderLogin;
|
|
30
84
|
}): ReactNode;
|
|
@@ -75,18 +129,30 @@ interface ModuleRegistration {
|
|
|
75
129
|
scenes: EngineScene[];
|
|
76
130
|
panels: UiPanel[];
|
|
77
131
|
routes: RouteEntry[];
|
|
132
|
+
/**
|
|
133
|
+
* Undo what `setup()` left behind on shared services — today, the module's event subscriptions.
|
|
134
|
+
* The host calls it before re-running `setup()` (re-login) and on logout; without it every login
|
|
135
|
+
* would add one more copy of each handler to the session-wide bus.
|
|
136
|
+
*/
|
|
137
|
+
dispose(): void;
|
|
78
138
|
}
|
|
79
139
|
/** Shared services every module receives — created once per host session. */
|
|
80
140
|
interface SharedServices {
|
|
81
141
|
client: IDosGamesClient;
|
|
82
|
-
events:
|
|
142
|
+
events: HostEventBus;
|
|
83
143
|
surface: SurfaceAllocator;
|
|
144
|
+
/** Resolved shared-UI owners. Resolved here from the modules when omitted. */
|
|
145
|
+
sharedUi?: SharedUiOwners;
|
|
84
146
|
}
|
|
85
147
|
/** Install every module and return their collected registrations, in declaration order. */
|
|
86
148
|
declare function runModules(modules: readonly Module[], shared: SharedServices): ModuleRegistration[];
|
|
87
149
|
|
|
88
|
-
declare function HostShell({ registrations, onLogout, userID, }: {
|
|
150
|
+
declare function HostShell({ registrations, sharedUi, events, onLogout, userID, }: {
|
|
89
151
|
registrations: readonly ModuleRegistration[];
|
|
152
|
+
/** Shared-UI owners. When a module owns "account", the host does not draw its own logout/ID row. */
|
|
153
|
+
sharedUi?: SharedUiOwners;
|
|
154
|
+
/** The host bus — used to announce mode switches (`host:mode-changed@1`). */
|
|
155
|
+
events?: HostEventBus;
|
|
90
156
|
/** Renders a "Log out" control in the host chrome (bottom-left) when provided. */
|
|
91
157
|
onLogout?: () => void;
|
|
92
158
|
/** Shown next to the logout control; click copies it to the clipboard. */
|
|
@@ -108,12 +174,23 @@ interface AgentHostState {
|
|
|
108
174
|
titleId: string | null;
|
|
109
175
|
/** Идентификаторы установленных модулей — включая те, что агенту ничего не открыли. */
|
|
110
176
|
modules: string[];
|
|
177
|
+
/**
|
|
178
|
+
* Кто рисует общий интерфейс: роль → id модуля или null. Отвечает агенту на вопрос «почему у
|
|
179
|
+
* шаблона пропал кошелёк» — его взял поставщик роли, это не поломка.
|
|
180
|
+
*/
|
|
181
|
+
sharedUi?: Record<string, string | null>;
|
|
111
182
|
}
|
|
112
183
|
/** Что видит зонд. Версия — чтобы старый зонд не гадал по форме объекта. */
|
|
113
184
|
interface AgentBridgeGlobal {
|
|
114
185
|
version: 1;
|
|
115
186
|
modules: Record<string, ModuleAgentApi>;
|
|
116
187
|
host?: AgentHostState;
|
|
188
|
+
/**
|
|
189
|
+
* Журнал шины событий: последние события, кто что слушает, подсказки о расхождении версий
|
|
190
|
+
* топиков. Функция, а не снимок, — журнал меняется между запросами зонда. Поле добавлено без
|
|
191
|
+
* смены `version`: старый зонд его просто не читает.
|
|
192
|
+
*/
|
|
193
|
+
events?: () => unknown;
|
|
117
194
|
}
|
|
118
195
|
/**
|
|
119
196
|
* Зарегистрировать debug-поверхность модуля. Вызывается из `ctx.exposeToAgent` при `setup()`.
|
|
@@ -126,6 +203,8 @@ declare function registerAgentApi(moduleId: string, api: ModuleAgentApi): void;
|
|
|
126
203
|
* ровно то, что делает ответ зонда осмысленным без всякой кооперации со стороны игры.
|
|
127
204
|
*/
|
|
128
205
|
declare function publishHostState(state: AgentHostState): void;
|
|
206
|
+
/** Подключить журнал шины событий (зовёт `mountHost` один раз на сессию хоста). */
|
|
207
|
+
declare function publishEventsProvider(provider: () => unknown): void;
|
|
129
208
|
|
|
130
209
|
declare class SceneStage {
|
|
131
210
|
private readonly container;
|
|
@@ -140,10 +219,7 @@ declare class SceneStage {
|
|
|
140
219
|
destroy(): void;
|
|
141
220
|
}
|
|
142
221
|
|
|
143
|
-
/** In-memory pub/sub shared by all modules for a host session. */
|
|
144
|
-
declare function createSharedEventBus(): SharedEventBus;
|
|
145
|
-
|
|
146
222
|
/** Creates an allocator whose surfaces are appended to `layer`. */
|
|
147
223
|
declare function createSurfaceAllocator(layer: HTMLElement): SurfaceAllocator;
|
|
148
224
|
|
|
149
|
-
export { type AgentBridgeGlobal, type AgentHostState, AuthGate, DefaultLoginScreen, type HostHandle, HostShell, type LoginScreenProps, type ModuleRegistration, type RenderLogin, SceneStage, type SharedServices, createSharedEventBus, createSurfaceAllocator, mountHost, publishHostState, registerAgentApi, runModules };
|
|
225
|
+
export { type AgentBridgeGlobal, type AgentHostState, AuthGate, DefaultLoginScreen, type EventLogEntry, type HostEventBus, type HostEventBusDescription, type HostHandle, HostShell, type LoginScreenProps, type ModuleEventHandle, type ModuleRegistration, type RenderLogin, SceneStage, type SharedServices, type SharedUiOwners, type SharedUiResolution, createHostEventBus, createSharedEventBus, createSurfaceAllocator, emptySharedUiOwners, mountHost, publishEventsProvider, publishHostState, registerAgentApi, resolveSharedUi, runModules, sharedUiFor };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {IDosGamesProvider,StatusProvider}from'@idosgames/react';import {useRef,useMemo,useState,useEffect}from'react';import {readSsoCodeFromUrl,AuthType,beginSsoRedirect}from'@idosgames/core';import {jsx,jsxs}from'react/jsx-runtime';function
|
|
1
|
+
import {createRoot}from'react-dom/client';import {IDosGamesProvider,StatusProvider}from'@idosgames/react';import {isTopicName,SHARED_UI_ROLES,isSharedUiRole,hostTopics,topicNamespace}from'@idosgames/module-sdk';import {useRef,useMemo,useState,useEffect,useLayoutEffect}from'react';import {readSsoCodeFromUrl,AuthType,beginSsoRedirect}from'@idosgames/core';import {jsx,jsxs}from'react/jsx-runtime';var we=50,U="host",Z=e=>typeof e=="string"?e:e.name,ee=e=>typeof e=="string"?null:e.shape,te=e=>e.replace(/@\d+$/,"");function T(){let e=new Map,o=new Map,t=[],l=new Set,n=r=>{t.push(r),t.length>we&&t.shift();},a=(r,s)=>{l.has(r)||(l.add(r),console.warn(s));},c=(r,s,p)=>{console.error(`[idos events] ${p}`),n({topic:s,from:r,at:Date.now(),delivered:0,rejected:p});},g=(r,s,p,f)=>{if(!isTopicName(s)){c(r,s,`"${r}" emitted "${s}", which is not a topic name \u2014 use defineTopic("<module-id>:<event>@<major>", shape({\u2026})). Not delivered.`);return}let d=topicNamespace(s);if(r!==U&&d===U){c(r,s,`"${r}" emitted "${s}", but the "host:" namespace belongs to the host. Not delivered.`);return}if(r!==U&&d!==r){c(r,s,`"${r}" emitted "${s}" into the "${d}" namespace \u2014 a module may only emit its own topics ("${r}:\u2026"). Not delivered.`);return}if(p){let S=p.check(f);S&&a(`emit|${r}|${s}`,`[idos events] "${r}" emitted "${s}" with a payload that does not match its own shape: ${S}. Fix the emit or the topic's shape (and module.meta.json).`);}let y=o.get(s);y||o.set(s,y=new Set),y.add(r);let b=0;for(let S of [...e.get(s)??[]]){if(S.shape){let v=S.shape.check(f);if(v){a(`on|${S.moduleId}|${s}`,`[idos events] "${S.moduleId}" skipped "${s}" from "${r}": ${v}. Its copy of the topic's shape no longer matches the emitter \u2014 re-copy it from the catalog.`);continue}}try{S.handler(f),b+=1;}catch(v){console.error(`[idos events] a "${s}" handler in "${S.moduleId}" threw \u2014 other listeners still received the event.`,v);}}n({topic:s,from:r,at:Date.now(),delivered:b});},u=(r,s,p)=>{let f=e.get(s);return f||e.set(s,f=new Set),f.add(p),()=>{let d=e.get(s);d&&(d.delete(p),d.size===0&&e.delete(s));}};return {forModule(r){let s=new Set,p=false;return {emit(d,y){p||g(r,Z(d),ee(d),y);},on(d,y){if(p)return ()=>{};let b=Z(d);isTopicName(b)||console.warn(`[idos events] "${r}" subscribed to "${b}", which is not a topic name \u2014 nothing can ever be emitted to it.`);let S=u(r,b,{moduleId:r,shape:ee(d),handler:y});return s.add(S),()=>{S(),s.delete(S);}},dispose(){p=true;for(let d of s)d();s.clear();}}},emitAsHost(r,s){g(U,r.name,r.shape,s);},describe(){let r={};for(let[f,d]of e)r[f]=[...new Set([...d].map(y=>y.moduleId))];let s={};for(let[f,d]of o)s[f]=[...d];let p=[];for(let[f,d]of Object.entries(r)){if(o.has(f))continue;let y=[...o.keys()].filter(b=>b!==f&&te(b)===te(f));y.length>0&&p.push(`${d.join(", ")} listen${d.length===1?"s":""} to "${f}", but only ${y.map(b=>`"${b}"`).join(", ")} ${y.length===1?"has":"have"} been emitted \u2014 the major versions differ, so these never meet.`);}return {log:t.slice(),listeners:r,emitted:s,mismatches:p}}}}function xe(){let e=new Map;return {emit(o,t){let l=e.get(o);if(l)for(let n of [...l])n(t);},on(o,t){let l=t,n=e.get(o);return n||(n=new Set,e.set(o,n)),n.add(l),()=>{n.delete(l),n.size===0&&e.delete(o);}}}}function re(){return Object.fromEntries(SHARED_UI_ROLES.map(e=>[e,null]))}function I(e){let o=re(),t=[],l=SHARED_UI_ROLES.join(", ");for(let n of e)for(let a of n.sharedUi?.provides??[]){if(!isSharedUiRole(a)){t.push(`module "${n.id}" provides unknown shared UI role "${String(a)}" (known: ${l}) \u2014 ignored.`);continue}let c=o[a];c===null?o[a]=n.id:c!==n.id&&t.push(`shared UI role "${a}" is provided by both "${c}" and "${n.id}" \u2014 "${c}" wins (it comes first in src/modules.ts), "${n.id}" hides its copy.`);}for(let n of e)for(let a of n.sharedUi?.requires??[]){if(!isSharedUiRole(a)){t.push(`module "${n.id}" requires unknown shared UI role "${String(a)}" (known: ${l}).`);continue}o[a]===null&&t.push(`module "${n.id}" requires shared UI role "${a}", but no installed module provides it \u2014 install game-hud (or another module that provides "${a}").`);}return {owners:o,warnings:t}}function D(e,o){let t=l=>e[l]??null;return {ownerOf:t,shouldDraw:l=>{let n=t(l);return n===null||n===o}}}var Re={position:"absolute",inset:"0"};function B(e){return {request(o){let t=document.createElement("div");return t.dataset.surface=o,Object.assign(t.style,Re),t.style.pointerEvents=o==="fullbleed-canvas"?"auto":"none",e.appendChild(t),{host:t,release(){t.remove();}}}}}var Ee="__IDOS_AGENT__",se={},ie,le;function ke(){try{return typeof window<"u"&&window.self!==window.top}catch{return true}}function z(e,o){se[e]=o,_();}function G(e){ie=e,_();}function N(e){le=e,_();}function _(){if(!ke())return;let e={version:1,modules:se,host:ie,events:le};globalThis[Ee]=e;}function j(e,o){let t=o.sharedUi??I(e).owners,l=[];try{for(let n of e){let a=o.events.forModule(n.id),c={module:n,scenes:[],panels:[],routes:[],dispose:()=>a.dispose()};l.push(c);let g={client:o.client,titleId:o.client.titleID,events:a,sharedUi:D(t,n.id),surface:o.surface,registerScene:u=>c.scenes.push(u),registerPanel:u=>c.panels.push(u),registerRoute:u=>c.routes.push(u),exposeToAgent:u=>z(n.id,u)};n.setup(g);}}catch(n){for(let a of l)a.dispose();throw n}return l}var C=class{constructor(o){this.container=o;}container;hosts=new Map;active=new Set;ensureMounted(o){let t=this.hosts.get(o);return t||(t=document.createElement("div"),Object.assign(t.style,{position:"absolute",inset:"0"}),this.container.appendChild(t),this.hosts.set(o,t),o.mount({host:t})),t}setActive(o){let t=new Set(o);for(let l of this.active){if(t.has(l))continue;l.suspend?.();let n=this.hosts.get(l);n&&(n.style.display="none");}for(let l of t){if(this.active.has(l))continue;let n=this.ensureMounted(l);n.style.display="block",l.activate?.();}this.active=t;}destroy(){for(let[o,t]of this.hosts)o.destroy(),t.remove();this.hosts.clear(),this.active.clear();}};function K({registrations:e,sharedUi:o,events:t,onLogout:l,userID:n}){let a=useRef(null),c=useRef(null),g=useMemo(()=>e.flatMap(i=>i.routes.map(m=>({id:m.id,label:m.label,icon:m.icon,order:m.order??0,moduleId:i.module.id}))).sort((i,m)=>i.order-m.order),[e]),[u,r]=useState(()=>g[0]?.id??null);useEffect(()=>{u!==null&&g.some(i=>i.id===u)||r(g[0]?.id??null);},[g,u]);let s=useMemo(()=>g.find(i=>i.id===u)?.moduleId??null,[g,u]),p=useRef(null);useEffect(()=>{if(u===null||u===p.current)return;let i=p.current;p.current=u,t?.emitAsHost(hostTopics.modeChanged,i===null?{to:u}:{from:i,to:u});},[u,t]),useEffect(()=>{let i=a.current;if(!i)return;let m=c.current??=new C(i),M=e.find(L=>L.module.id===s)?.scenes??[];m.setActive(M);},[e,s]),useEffect(()=>()=>{c.current?.destroy(),c.current=null;},[]);let f=useMemo(()=>e.flatMap(i=>i.panels.filter(m=>m.activeOnly===false||i.module.id===s).map(m=>{let M=m.component;return {key:`${i.module.id}:${m.id}`,slot:m.slot,order:m.order??0,moduleId:i.module.id,component:jsx(M,{})}})).sort((i,m)=>i.order-m.order),[e,s]),d=i=>f.filter(m=>m.slot===i),y=e.length>0,b=d("hud").length,S=g.length>1,v=!o?.account,x=useRef(null),E=useRef(null),[k,ye]=useState({top:0,bottom:0});useLayoutEffect(()=>{let i=()=>{let M=b>0&&x.current?Math.ceil(x.current.getBoundingClientRect().height):0,L=S&&E.current?Math.ceil(E.current.getBoundingClientRect().height)+de:0;ye(O=>O.top===M&&O.bottom===L?O:{top:M,bottom:L});};if(i(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(i);return x.current&&m.observe(x.current),E.current&&m.observe(E.current),()=>m.disconnect()},[b,S]);let Se={...He,"--idos-safe-top":`${k.top}px`,"--idos-safe-bottom":`${k.bottom}px`};return jsxs("div",{style:Se,children:[jsx("div",{ref:a,style:Le}),jsx("div",{style:{...Ue,top:k.top,bottom:k.bottom},children:d("overlay").map(i=>jsx("div",{style:V,children:i.component},i.key))}),jsx("div",{ref:x,style:Pe,children:d("hud").map(i=>jsx("div",{style:$e,children:i.component},i.key))}),jsx("div",{style:{...Oe,top:k.top,bottom:k.bottom},children:d("sidebar").map(i=>jsx("div",{style:V,children:i.component},i.key))}),S&&jsx("nav",{ref:E,style:Te,children:g.map(i=>jsxs("button",{type:"button",onClick:()=>r(i.id),style:i.id===u?De:ce,children:[i.icon?`${i.icon} `:"",i.label]},i.id))}),v&&(l||n)&&jsxs("div",{style:Be,children:[l&&jsx("button",{type:"button",style:ue,onClick:l,title:"Log out",children:"\u{1F6AA} Log out"}),n&&jsx(Ie,{userID:n})]}),d("modal").length>0&&jsx("div",{style:Ge,children:d("modal").map(i=>jsx("div",{style:V,children:i.component},i.key))}),!y&&jsx(Ce,{})]})}function Ie({userID:e}){let[o,t]=useState(false),l=()=>{(async()=>{try{await navigator.clipboard.writeText(e);}catch{let a=document.createElement("textarea");a.value=e,document.body.appendChild(a),a.select(),document.execCommand("copy"),a.remove();}t(true),window.setTimeout(()=>t(false),1500);})();},n=e.length>12?`${e.slice(0,5)}\u2026${e.slice(-5)}`:e;return jsx("button",{type:"button",style:ze,onClick:l,title:`Copy your player ID: ${e}`,children:o?"\u2713 Copied":`ID: ${n} \u29C9`})}function Ce(){return jsxs("div",{style:Ne,children:[jsx("style",{children:`
|
|
2
2
|
@keyframes idos-empty-float {
|
|
3
3
|
0%, 100% { transform: translateY(0) rotate(-6deg); }
|
|
4
4
|
50% { transform: translateY(-16px) rotate(6deg); }
|
|
@@ -7,5 +7,5 @@ import {createRoot}from'react-dom/client';import {IDosGamesProvider,StatusProvid
|
|
|
7
7
|
0% { transform: scale(0.55); opacity: 0.55; }
|
|
8
8
|
100% { transform: scale(1.7); opacity: 0; }
|
|
9
9
|
}
|
|
10
|
-
`}),jsxs("div",{style:ue,children:[jsx("span",{style:{...N,animationDelay:"0s"}}),jsx("span",{style:{...N,animationDelay:"1.1s"}}),jsx("span",{style:pe,children:"\u{1F9E9}"})]}),jsx("div",{style:{fontWeight:700,fontSize:18,marginBottom:6},children:"No modules installed"}),jsxs("div",{style:{opacity:.85,maxWidth:380,lineHeight:1.5},children:["Add a module under ",jsx("code",{children:"src/modules/"})," and register it in"," ",jsx("code",{children:"src/modules.ts"}),". The host shell will pick it up here."]})]})}var ee={position:"absolute",inset:0,overflow:"hidden",background:"#0d66fe",color:"#fff",fontFamily:"system-ui, sans-serif"},te={position:"absolute",inset:0,zIndex:0},oe={position:"absolute",inset:0,zIndex:1,pointerEvents:"none"},ne={position:"absolute",top:0,left:0,right:0,zIndex:2,display:"flex",gap:12,padding:16,pointerEvents:"none"},re={position:"absolute",top:0,right:0,bottom:0,width:340,maxWidth:"40vw",zIndex:2,display:"flex",flexDirection:"column",gap:12,padding:16,overflowY:"auto",pointerEvents:"none"},se={position:"absolute",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:3,display:"flex",gap:8,padding:6,borderRadius:14,background:"rgba(4,32,90,0.72)",backdropFilter:"blur(6px)",pointerEvents:"auto"},W={border:"none",borderRadius:10,padding:"8px 16px",fontWeight:700,fontSize:14,color:"#cfe0ff",background:"transparent",cursor:"pointer"},ie={...W,color:"#0d66fe",background:"#fff"},le={position:"absolute",bottom:16,left:16,zIndex:3,display:"flex",gap:8,alignItems:"center",pointerEvents:"auto"},U={border:"none",borderRadius:12,padding:"8px 14px",fontWeight:700,fontSize:13,color:"#cfe0ff",background:"rgba(4,32,90,0.72)",backdropFilter:"blur(6px)",cursor:"pointer"},ae={...U,fontWeight:600,fontFamily:"ui-monospace, Consolas, monospace"},de={position:"absolute",inset:0,zIndex:4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.5)",pointerEvents:"none"},x={pointerEvents:"auto"},ce={position:"absolute",inset:0,zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:24},ue={position:"relative",width:110,height:110,marginBottom:16,display:"grid",placeItems:"center"},N={position:"absolute",inset:0,borderRadius:"50%",border:"2px solid rgba(255,255,255,0.55)",animation:"idos-empty-ripple 2.2s ease-out infinite"},pe={fontSize:46,animation:"idos-empty-float 3s ease-in-out infinite",filter:"drop-shadow(0 8px 12px rgba(0,0,0,0.25))"};function P(n){let{client:t,modules:e,events:s,surface:i,renderLogin:r}=n,[a,f]=useState(true),[c,u]=useState(null),g=()=>{u(w(e,{client:t,events:s,surface:i}));},b=useRef(false);useEffect(()=>{if(b.current)return;b.current=true;let m=readSsoCodeFromUrl();if(m){(async()=>((await t.auth.loginWithSsoCode(m.code)).ok&&g(),f(false)))();return}if(t.auth.lastAuthType===AuthType.None){f(false);return}(async()=>((await t.auth.autoLogin()).ok&&g(),f(false)))();},[t]),useEffect(()=>{let m=()=>u(null),v=t.on("auth:unauthorized",m),j=t.on("auth:loggedOut",m);return ()=>{v(),j();}},[t]);let o=c?"game":a?"loading":"login";return useEffect(()=>{C({screen:o,loggedIn:c!==null,userId:t.auth.context?.userID??null,titleId:t.titleID??null,modules:e.map(m=>m.id)});},[o,c,t,e]),c?jsx(L,{registrations:c,onLogout:()=>t.auth.logout(),userID:t.auth.context?.userID??null}):a?null:jsx(r,{client:t,onAuthenticated:g})}var ye='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 860 690" fill="#fff"><g transform="translate(243 -2)"><path d="M147.333 12.333c-13.6 2.534-12.533 1.2-12.933 15.067l-.4 12.267-4.533-11.067c-2.534-6-5.067-10.933-5.734-10.933-2.666 0-27.866 8.666-36.533 12.666-11.733 5.334-26.667 14.8-36.133 22.934l-6.934 5.866L51.6 69.267c8.133 11.066 7.333 11.466-5.067 2.933-7.6-5.067-8.4-5.333-11.466-3.733-3.467 1.866-18.4 17.333-20.4 21.2-.8 1.6 7.066 8.8 33.733 30.933l34.667 28.933 8.8-8.266c14.666-13.867 28.666-22 48.133-28.267 9.067-2.933 14.8-3.733 28.533-4.4 34.267-1.333 60 7.467 81.6 28.133 21.6 20.4 34.934 49.6 37.467 81.734l.8 11.2 14.8 4.533c8.133 2.533 23.733 7.333 34.667 10.8 10.933 3.333 20.4 5.6 21.066 4.933 1.6-1.6 6.134-20.533 7.734-32.666.8-6 1.333-17.6 1.066-25.6l-.4-14.667-8-1.067c-4.4-.533-10.133-1.466-12.666-1.866l-4.667-.8 4.667-1.2c16.933-4.534 18.666-5.2 18.666-8 0-5.467-9.6-31.334-16.666-44.8-4-7.6-10.667-18.667-14.934-24.667-9.866-13.867-31.333-35.467-45.2-45.2-10.4-7.467-34.4-20.933-37.2-21.067-.8 0-4 4-7.333 8.8-3.2 4.8-6.133 8.134-6.4 7.334s.4-5.6 1.6-10.667c1.2-5.2 2.133-9.6 2.133-9.867 0-.933-19.866-6.133-34.4-9.066-14.8-2.934-49.333-4.4-59.6-2.534"/><path d="M157.867 125.533c-21.067 3.334-42.134 14.8-57.467 31.334-13.333 14.133-13.733 12.8 5.6 22 9.2 4.4 16.667 8.266 16.667 8.533s-1.334.4-2.934.133c-13.866-2.133-41.6-5.866-41.733-5.6-.267.267-7.467 28.534-16.267 63.067l-16 62.667 7.334.4c4 .266 7.466.266 7.6 0 .266-.267 3.866-13.867 8.133-30.4 4.267-16.534 8.267-30.8 8.933-31.734.934-1.2 11.067-1.6 42.4-1.6 32.134 0 41.2.4 41.2 1.6 0 .934-1.733 4.667-3.866 8.4L153.733 261l-35.066 6.933c-19.334 3.867-35.2 7.2-35.467 7.467-.667.667-29.867 113.467-29.467 113.867.267.133 23.734-3.6 52.4-8.534l52-8.8 20.4-39.866c11.2-22 20.667-39.734 20.934-39.467.4.533-1.334 26.8-2.8 40.8l-.667 6.933 6.267-3.2c21.2-10.666 52.4-13.466 86.933-8l5.867.934-5.6-7.334C286.4 318.6 281.2 310.6 278 304.867c-5.867-10.134-6-10.8-6-21.867 0-6.267 1.467-20 3.333-30.667 1.867-10.666 3.334-19.466 3.334-19.466 0-.134-9.067-4.267-20.134-9.334s-19.466-9.333-18.8-9.6c.8-.266 7.734.8 15.6 2.267 7.734 1.6 14.4 2.8 14.8 2.8 1.2 0 .4-10.533-1.466-18-7.2-27.733-28-53.467-53.734-66-16.4-8-40.8-12-57.066-9.467"/><path d="M235.6 346.333c-24 4.534-44.133 13.867-68.267 31.467-14 10.267-28.533 18.133-47.733 25.867-23.467 9.466-52.8 32.666-64.4 50.666l-2.533 4L58 454.2c9.333-7.333 30.133-19.467 49.333-28.667C173.733 393.667 246.4 382.2 312.8 393c11.2 1.733 39.2 8.533 45.067 10.8 2.266.8 2.266.667.8-2.267-4-7.6-15.6-21.866-25.867-31.466-12-11.467-24.667-18.934-37.6-22.4-11.467-3.067-46.267-3.867-59.6-1.334"/></g><g transform="translate(-460 467)"><path d="M721.533 34.467c-14.933 5.466-22 17.466-22.933 38.666-.933 24.134 3.467 32.8 30.267 59.867 19.6 19.867 22.933 25.2 22.933 37.867.133 13.466-6.133 20.133-16.933 18.4-9.067-1.467-12.534-7.867-12.534-22.667V159H696.6l.667 13.333c.533 11.467 1.2 14.4 4.933 22 7.067 14.267 16.8 19.6 36.4 19.734 10.667.133 12.267-.134 20.667-4.4 7.6-3.867 9.733-5.867 13.2-11.734 7.6-12.533 9.066-32 3.733-47.6-3.733-11.066-10.667-20.4-27.867-37.2-19.866-19.6-22.533-24.133-22.666-38.4 0-8.933.4-10.533 3.2-13.6 6.266-6.666 18.266-5.6 22.133 2 1.067 2 2 7.067 2 11.2v7.334h27.067l-.934-9.2c-1.6-18.267-8.266-30.267-20-36.4-7.2-3.867-29.2-4.8-37.6-1.6M630.067 34.867c-11.734 4.666-18 11.6-21.734 24.4-1.866 6.4-2 15.333-1.733 67.2l.4 59.866 3.733 7.6c6.8 13.867 18.534 20.267 36.934 20.267 13.733 0 22.933-3.333 30.666-11.067 10.934-11.066 11.2-12.533 11.734-74.666.266-35.734-.134-56.934-1.067-62.8-2.667-16.134-11.6-27.467-24.8-31.467-8.933-2.667-26.4-2.267-34.133.667m28.666 26.8 3.6 4v56.666c0 40.934-.4 57.467-1.6 60-3.6 8-15.6 9.734-22.666 3.467l-4.4-3.867-.4-56.533c-.267-51.733-.134-56.8 2-61.067 3.066-5.866 7.6-8.266 14.4-7.466 3.733.4 6.4 1.866 9.066 4.8M511.667 123.133v89.334l29.066-.4c28.8-.4 28.934-.4 36.667-4.267 9.467-4.533 14.4-10.933 17.467-22.4 2-7.333 2.266-15.467 1.866-65.733l-.4-57.334-4.266-8.8c-8.267-16.666-17.2-19.866-55.334-19.866h-25.066zm53.6-60.266 4.4 3.866.4 52.8c.266 35.067-.134 54.4-1.067 58-2 7.467-5.733 9.6-18.667 10.4l-10.666.8V59h10.666c9.867 0 10.934.267 14.934 3.867M471.667 145v67.333h26.666V77.667h-26.666zM471.667 48.333V63h26.666V33.667h-26.666z"/></g><g transform="translate(-106 244)"><path d="M893.4 259.733c-6.8 3.467-9.2 5.6-12.667 11.467-10.666 17.733-9.2 42.933 3.467 62.267 2.8 4.266 12.267 14.8 20.933 23.333 9.867 9.467 17.067 17.733 18.934 21.6 5.6 11.333 5.2 25.333-.934 30.8-3.466 3.067-11.333 4.133-16.133 2.133-5.867-2.4-8-7.466-8-19.333v-10h-27.067l.8 11.6c1.2 15.867 3.867 24.133 10.267 31.333 7.467 8.534 16.4 12.134 30 12.267 19.067.133 30.133-5.733 37.333-19.867 3.734-7.466 4-8.666 4-24 0-16 0-16.133-5.2-26.666-4.4-9.2-7.733-13.2-23.066-28.534-21.067-21.066-24.8-27.066-24.934-40.4-.133-10.4 2.8-15.6 9.734-17.6 10.133-2.933 17.2 3.334 18.4 16.267l.8 8.267H955.4l-.8-10.8c-.533-8.4-1.6-12.667-4.8-19.2-7.067-14.134-16.667-19.334-36.133-19.334-10.667 0-12.534.4-20.267 4.4M791 346v89.333h76v-24h-48v-54.666h37.333v-24H819V282h48v-25.333h-76zM661.667 346v89.333h22.666l.134-63.066c0-34.534.533-61.734 1.066-60.267.534 1.467 5.467 29.867 10.8 62.933l9.867 60.4h13.067c7.2 0 13.066-.4 13.066-1.066 0-3.067 18.8-124.8 19.334-125.334.4-.4.666 27.867.666 62.8v63.6h25.334V256.667h-38l-9.2 61.6c-5.067 34-9.6 62.133-10 62.666-.534.534-5.334-26.4-10.667-60-5.467-33.466-10.133-61.733-10.533-62.666-.4-1.2-5.467-1.6-19.067-1.6h-18.533zM586.467 258.267c-.8 2.666-27.467 172.4-27.467 174.933 0 1.867 1.733 2.133 12 2.133h11.867l.8-4.4c.533-2.266 1.6-9.333 2.4-15.6l1.6-11.333 17.6-.4 17.466-.4 1.467 8.4c.8 4.667 1.733 11.867 2.267 16l.933 7.733h13.733c7.6 0 13.867-.266 13.867-.666 0-.8-26.533-168.134-27.467-173.734l-.8-4.266h-19.866c-14.8 0-20.134.4-20.4 1.6M613 336.533c3.333 23.067 5.867 42.134 5.6 42.4-.4.267-6.533.267-13.867.134l-13.2-.4 4.934-33.334c2.8-18.4 5.733-38.4 6.666-44.666C604.2 292.533 605 290.133 605.8 292c.533 1.467 3.867 21.467 7.2 44.533M497.267 257.2c-10.134 3.733-15.2 8.267-19.867 17.733L473 284l-.4 59.067c-.4 51.2-.133 60.133 1.733 66.533 5.6 19.333 17.067 27.333 39.467 27.467 10.267.133 12.267-.267 20.133-4.134 9.334-4.533 13.867-9.733 17.867-20.266 2-4.934 2.4-12 2.933-41.067l.534-34.933h-38.934v23.866l6.4.4 6.267.4v19.334c0 13.466-.533 20.666-1.867 23.733-5.066 12-23.333 10.4-26.8-2.4-.933-3.6-1.333-23.2-1.066-59.067.4-48.533.666-54.133 2.666-57.333 3.334-4.8 11.2-7.067 17.6-4.933 6.934 2.266 9.067 7.2 9.867 22.933l.667 13.067H555.4l-.8-15.734c-.8-18-3.067-25.6-9.867-33.466-7.466-8.8-13.466-11.2-29.066-11.734-9.067-.266-14.934.134-18.4 1.467"/></g></svg>',F=`data:image/svg+xml;utf8,${encodeURIComponent(ye)}`;var ve=["https://cloud.idosgames.com","https://idosgames.com","https://www.idosgames.com"];function K(){return typeof window<"u"&&ve.includes(window.location.origin)}function D({client:n,onAuthenticated:t}){let[e,s]=useState(false),[i,r]=useState(null),[a,f]=useState(true),c=async()=>{s(true),r(null),n.auth.setRememberSession(a);let u=await n.auth.loginWithDeviceID();if(u.ok){t();return}r(u.error),s(false);};return jsx("div",{style:p.root,children:jsxs("div",{style:p.card,children:[jsx("img",{src:F,alt:"iDos Games",style:p.logo}),jsx("h1",{style:p.title,children:"Sign in"}),K()&&jsx("button",{type:"button",onClick:()=>beginSsoRedirect({titleID:n.titleID}),disabled:e,style:{...p.primary,opacity:e?.6:1,cursor:e?"default":"pointer"},children:"Continue with iDos Games"}),jsx("button",{type:"button",onClick:()=>{c();},disabled:e,style:{...K()?p.ghost:p.primary,opacity:e?.6:1,cursor:e?"default":"pointer"},children:e?"Signing in\u2026":"Play as guest"}),jsxs("label",{style:{...p.remember,opacity:e?.6:1},children:[jsx("input",{type:"checkbox",checked:a,disabled:e,onChange:u=>f(u.target.checked),style:p.switchInput}),jsx("span",{style:{...p.switchTrack,background:a?"#fff":"rgba(255, 255, 255, 0.3)"},children:jsx("span",{style:{...p.switchKnob,left:a?"21px":"3px",background:a?"#0d66fe":"#fff"}})}),"Remember me"]}),i&&jsx("span",{style:p.error,children:i})]})})}var p={root:{position:"absolute",inset:0,display:"grid",placeItems:"center",background:"#0d66fe",color:"#fff",font:"14px system-ui, sans-serif"},card:{width:"min(340px, 88vw)",display:"grid",gap:"18px",justifyItems:"center"},logo:{width:"180px",userSelect:"none",pointerEvents:"none"},title:{margin:0,fontSize:"22px",fontWeight:600,textAlign:"center"},primary:{width:"100%",padding:"11px 16px",borderRadius:"8px",border:"none",background:"#fff",color:"#0d66fe",fontWeight:600,font:"inherit"},ghost:{width:"100%",padding:"11px 16px",borderRadius:"8px",border:"1px solid rgba(255, 255, 255, 0.45)",background:"transparent",color:"#fff",fontWeight:600,font:"inherit"},remember:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",color:"rgba(255, 255, 255, 0.85)"},switchInput:{position:"absolute",opacity:0,width:0,height:0},switchTrack:{position:"relative",width:"42px",height:"24px",borderRadius:"12px",transition:"background 0.15s",flexShrink:0},switchKnob:{position:"absolute",top:"3px",width:"18px",height:"18px",borderRadius:"50%",transition:"left 0.15s, background 0.15s"},error:{color:"#ffd7d7",textAlign:"center"}};function Re(n){let{container:t,client:e,modules:s,renderLogin:i}=n;t.style.position="relative";let r=document.createElement("div");Object.assign(r.style,{position:"absolute",inset:"0",zIndex:"0",pointerEvents:"none"});let a=document.createElement("div");Object.assign(a.style,{position:"absolute",inset:"0",zIndex:"1"}),t.append(r,a);let f=R(),c=k(r),u=createRoot(a);return u.render(jsx(IDosGamesProvider,{client:e,children:jsx(StatusProvider,{children:jsx(P,{client:e,modules:s,events:f,surface:c,renderLogin:i??D})})})),{unmount(){u.unmount(),r.remove(),a.remove();}}}
|
|
11
|
-
export{
|
|
10
|
+
`}),jsxs("div",{style:_e,children:[jsx("span",{style:{...ae,animationDelay:"0s"}}),jsx("span",{style:{...ae,animationDelay:"1.1s"}}),jsx("span",{style:je,children:"\u{1F9E9}"})]}),jsx("div",{style:{fontWeight:700,fontSize:18,marginBottom:6},children:"No modules installed"}),jsxs("div",{style:{opacity:.85,maxWidth:380,lineHeight:1.5},children:["Add a module under ",jsx("code",{children:"src/modules/"})," and register it in"," ",jsx("code",{children:"src/modules.ts"}),". The host shell will pick it up here."]})]})}var He={position:"absolute",inset:0,overflow:"hidden",background:"#0d66fe",color:"#fff",fontFamily:"system-ui, sans-serif"},Le={position:"absolute",inset:0,zIndex:0},de=16,Ue={position:"absolute",top:0,right:0,bottom:0,left:0,zIndex:1,pointerEvents:"none"},$e={display:"contents",pointerEvents:"auto"},Pe={position:"absolute",top:0,left:0,right:0,zIndex:2,display:"flex",gap:12,padding:16,pointerEvents:"none"},Oe={position:"absolute",top:0,right:0,bottom:0,width:340,maxWidth:"40vw",zIndex:2,display:"flex",flexDirection:"column",gap:12,padding:16,overflowY:"auto",pointerEvents:"none"},Te={position:"absolute",bottom:de,left:"50%",transform:"translateX(-50%)",zIndex:3,display:"flex",gap:8,padding:6,borderRadius:14,background:"rgba(4,32,90,0.72)",backdropFilter:"blur(6px)",pointerEvents:"auto"},ce={border:"none",borderRadius:10,padding:"8px 16px",fontWeight:700,fontSize:14,color:"#cfe0ff",background:"transparent",cursor:"pointer"},De={...ce,color:"#0d66fe",background:"#fff"},Be={position:"absolute",bottom:16,left:16,zIndex:3,display:"flex",gap:8,alignItems:"center",pointerEvents:"auto"},ue={border:"none",borderRadius:12,padding:"8px 14px",fontWeight:700,fontSize:13,color:"#cfe0ff",background:"rgba(4,32,90,0.72)",backdropFilter:"blur(6px)",cursor:"pointer"},ze={...ue,fontWeight:600,fontFamily:"ui-monospace, Consolas, monospace"},Ge={position:"absolute",inset:0,zIndex:4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.5)",pointerEvents:"none"},V={pointerEvents:"auto"},Ne={position:"absolute",inset:0,zIndex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:24},_e={position:"relative",width:110,height:110,marginBottom:16,display:"grid",placeItems:"center"},ae={position:"absolute",inset:0,borderRadius:"50%",border:"2px solid rgba(255,255,255,0.55)",animation:"idos-empty-ripple 2.2s ease-out infinite"},je={fontSize:46,animation:"idos-empty-float 3s ease-in-out infinite",filter:"drop-shadow(0 8px 12px rgba(0,0,0,0.25))"};function q(e){let{client:o,modules:t,events:l,sharedUi:n,surface:a,renderLogin:c}=e,[g,u]=useState(true),[r,s]=useState(null),p=useRef(null),f=()=>{for(let v of p.current??[])v.dispose();p.current=null;},d=()=>{f();let v=j(t,{client:o,events:l,surface:a,sharedUi:n});p.current=v,s(v);};useEffect(()=>()=>f(),[]);let y=useRef(false);useEffect(()=>{if(y.current)return;y.current=true;let v=readSsoCodeFromUrl();if(v){(async()=>((await o.auth.loginWithSsoCode(v.code)).ok&&d(),u(false)))();return}if(o.auth.lastAuthType===AuthType.None){u(false);return}(async()=>((await o.auth.autoLogin()).ok&&d(),u(false)))();},[o]),useEffect(()=>{let v=()=>{f(),s(null);},x=o.on("auth:unauthorized",v),E=o.on("auth:loggedOut",v);return ()=>{x(),E();}},[o]);let b=r?"game":g?"loading":"login";return useEffect(()=>{G({screen:b,loggedIn:r!==null,userId:o.auth.context?.userID??null,titleId:o.titleID??null,modules:t.map(v=>v.id),sharedUi:n});},[b,r,o,t,n]),r?jsx(K,{registrations:r,sharedUi:n,events:l,onLogout:()=>o.auth.logout(),userID:o.auth.context?.userID??null}):g?null:jsx(c,{client:o,onAuthenticated:d})}var Fe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 860 690" fill="#fff"><g transform="translate(243 -2)"><path d="M147.333 12.333c-13.6 2.534-12.533 1.2-12.933 15.067l-.4 12.267-4.533-11.067c-2.534-6-5.067-10.933-5.734-10.933-2.666 0-27.866 8.666-36.533 12.666-11.733 5.334-26.667 14.8-36.133 22.934l-6.934 5.866L51.6 69.267c8.133 11.066 7.333 11.466-5.067 2.933-7.6-5.067-8.4-5.333-11.466-3.733-3.467 1.866-18.4 17.333-20.4 21.2-.8 1.6 7.066 8.8 33.733 30.933l34.667 28.933 8.8-8.266c14.666-13.867 28.666-22 48.133-28.267 9.067-2.933 14.8-3.733 28.533-4.4 34.267-1.333 60 7.467 81.6 28.133 21.6 20.4 34.934 49.6 37.467 81.734l.8 11.2 14.8 4.533c8.133 2.533 23.733 7.333 34.667 10.8 10.933 3.333 20.4 5.6 21.066 4.933 1.6-1.6 6.134-20.533 7.734-32.666.8-6 1.333-17.6 1.066-25.6l-.4-14.667-8-1.067c-4.4-.533-10.133-1.466-12.666-1.866l-4.667-.8 4.667-1.2c16.933-4.534 18.666-5.2 18.666-8 0-5.467-9.6-31.334-16.666-44.8-4-7.6-10.667-18.667-14.934-24.667-9.866-13.867-31.333-35.467-45.2-45.2-10.4-7.467-34.4-20.933-37.2-21.067-.8 0-4 4-7.333 8.8-3.2 4.8-6.133 8.134-6.4 7.334s.4-5.6 1.6-10.667c1.2-5.2 2.133-9.6 2.133-9.867 0-.933-19.866-6.133-34.4-9.066-14.8-2.934-49.333-4.4-59.6-2.534"/><path d="M157.867 125.533c-21.067 3.334-42.134 14.8-57.467 31.334-13.333 14.133-13.733 12.8 5.6 22 9.2 4.4 16.667 8.266 16.667 8.533s-1.334.4-2.934.133c-13.866-2.133-41.6-5.866-41.733-5.6-.267.267-7.467 28.534-16.267 63.067l-16 62.667 7.334.4c4 .266 7.466.266 7.6 0 .266-.267 3.866-13.867 8.133-30.4 4.267-16.534 8.267-30.8 8.933-31.734.934-1.2 11.067-1.6 42.4-1.6 32.134 0 41.2.4 41.2 1.6 0 .934-1.733 4.667-3.866 8.4L153.733 261l-35.066 6.933c-19.334 3.867-35.2 7.2-35.467 7.467-.667.667-29.867 113.467-29.467 113.867.267.133 23.734-3.6 52.4-8.534l52-8.8 20.4-39.866c11.2-22 20.667-39.734 20.934-39.467.4.533-1.334 26.8-2.8 40.8l-.667 6.933 6.267-3.2c21.2-10.666 52.4-13.466 86.933-8l5.867.934-5.6-7.334C286.4 318.6 281.2 310.6 278 304.867c-5.867-10.134-6-10.8-6-21.867 0-6.267 1.467-20 3.333-30.667 1.867-10.666 3.334-19.466 3.334-19.466 0-.134-9.067-4.267-20.134-9.334s-19.466-9.333-18.8-9.6c.8-.266 7.734.8 15.6 2.267 7.734 1.6 14.4 2.8 14.8 2.8 1.2 0 .4-10.533-1.466-18-7.2-27.733-28-53.467-53.734-66-16.4-8-40.8-12-57.066-9.467"/><path d="M235.6 346.333c-24 4.534-44.133 13.867-68.267 31.467-14 10.267-28.533 18.133-47.733 25.867-23.467 9.466-52.8 32.666-64.4 50.666l-2.533 4L58 454.2c9.333-7.333 30.133-19.467 49.333-28.667C173.733 393.667 246.4 382.2 312.8 393c11.2 1.733 39.2 8.533 45.067 10.8 2.266.8 2.266.667.8-2.267-4-7.6-15.6-21.866-25.867-31.466-12-11.467-24.667-18.934-37.6-22.4-11.467-3.067-46.267-3.867-59.6-1.334"/></g><g transform="translate(-460 467)"><path d="M721.533 34.467c-14.933 5.466-22 17.466-22.933 38.666-.933 24.134 3.467 32.8 30.267 59.867 19.6 19.867 22.933 25.2 22.933 37.867.133 13.466-6.133 20.133-16.933 18.4-9.067-1.467-12.534-7.867-12.534-22.667V159H696.6l.667 13.333c.533 11.467 1.2 14.4 4.933 22 7.067 14.267 16.8 19.6 36.4 19.734 10.667.133 12.267-.134 20.667-4.4 7.6-3.867 9.733-5.867 13.2-11.734 7.6-12.533 9.066-32 3.733-47.6-3.733-11.066-10.667-20.4-27.867-37.2-19.866-19.6-22.533-24.133-22.666-38.4 0-8.933.4-10.533 3.2-13.6 6.266-6.666 18.266-5.6 22.133 2 1.067 2 2 7.067 2 11.2v7.334h27.067l-.934-9.2c-1.6-18.267-8.266-30.267-20-36.4-7.2-3.867-29.2-4.8-37.6-1.6M630.067 34.867c-11.734 4.666-18 11.6-21.734 24.4-1.866 6.4-2 15.333-1.733 67.2l.4 59.866 3.733 7.6c6.8 13.867 18.534 20.267 36.934 20.267 13.733 0 22.933-3.333 30.666-11.067 10.934-11.066 11.2-12.533 11.734-74.666.266-35.734-.134-56.934-1.067-62.8-2.667-16.134-11.6-27.467-24.8-31.467-8.933-2.667-26.4-2.267-34.133.667m28.666 26.8 3.6 4v56.666c0 40.934-.4 57.467-1.6 60-3.6 8-15.6 9.734-22.666 3.467l-4.4-3.867-.4-56.533c-.267-51.733-.134-56.8 2-61.067 3.066-5.866 7.6-8.266 14.4-7.466 3.733.4 6.4 1.866 9.066 4.8M511.667 123.133v89.334l29.066-.4c28.8-.4 28.934-.4 36.667-4.267 9.467-4.533 14.4-10.933 17.467-22.4 2-7.333 2.266-15.467 1.866-65.733l-.4-57.334-4.266-8.8c-8.267-16.666-17.2-19.866-55.334-19.866h-25.066zm53.6-60.266 4.4 3.866.4 52.8c.266 35.067-.134 54.4-1.067 58-2 7.467-5.733 9.6-18.667 10.4l-10.666.8V59h10.666c9.867 0 10.934.267 14.934 3.867M471.667 145v67.333h26.666V77.667h-26.666zM471.667 48.333V63h26.666V33.667h-26.666z"/></g><g transform="translate(-106 244)"><path d="M893.4 259.733c-6.8 3.467-9.2 5.6-12.667 11.467-10.666 17.733-9.2 42.933 3.467 62.267 2.8 4.266 12.267 14.8 20.933 23.333 9.867 9.467 17.067 17.733 18.934 21.6 5.6 11.333 5.2 25.333-.934 30.8-3.466 3.067-11.333 4.133-16.133 2.133-5.867-2.4-8-7.466-8-19.333v-10h-27.067l.8 11.6c1.2 15.867 3.867 24.133 10.267 31.333 7.467 8.534 16.4 12.134 30 12.267 19.067.133 30.133-5.733 37.333-19.867 3.734-7.466 4-8.666 4-24 0-16 0-16.133-5.2-26.666-4.4-9.2-7.733-13.2-23.066-28.534-21.067-21.066-24.8-27.066-24.934-40.4-.133-10.4 2.8-15.6 9.734-17.6 10.133-2.933 17.2 3.334 18.4 16.267l.8 8.267H955.4l-.8-10.8c-.533-8.4-1.6-12.667-4.8-19.2-7.067-14.134-16.667-19.334-36.133-19.334-10.667 0-12.534.4-20.267 4.4M791 346v89.333h76v-24h-48v-54.666h37.333v-24H819V282h48v-25.333h-76zM661.667 346v89.333h22.666l.134-63.066c0-34.534.533-61.734 1.066-60.267.534 1.467 5.467 29.867 10.8 62.933l9.867 60.4h13.067c7.2 0 13.066-.4 13.066-1.066 0-3.067 18.8-124.8 19.334-125.334.4-.4.666 27.867.666 62.8v63.6h25.334V256.667h-38l-9.2 61.6c-5.067 34-9.6 62.133-10 62.666-.534.534-5.334-26.4-10.667-60-5.467-33.466-10.133-61.733-10.533-62.666-.4-1.2-5.467-1.6-19.067-1.6h-18.533zM586.467 258.267c-.8 2.666-27.467 172.4-27.467 174.933 0 1.867 1.733 2.133 12 2.133h11.867l.8-4.4c.533-2.266 1.6-9.333 2.4-15.6l1.6-11.333 17.6-.4 17.466-.4 1.467 8.4c.8 4.667 1.733 11.867 2.267 16l.933 7.733h13.733c7.6 0 13.867-.266 13.867-.666 0-.8-26.533-168.134-27.467-173.734l-.8-4.266h-19.866c-14.8 0-20.134.4-20.4 1.6M613 336.533c3.333 23.067 5.867 42.134 5.6 42.4-.4.267-6.533.267-13.867.134l-13.2-.4 4.934-33.334c2.8-18.4 5.733-38.4 6.666-44.666C604.2 292.533 605 290.133 605.8 292c.533 1.467 3.867 21.467 7.2 44.533M497.267 257.2c-10.134 3.733-15.2 8.267-19.867 17.733L473 284l-.4 59.067c-.4 51.2-.133 60.133 1.733 66.533 5.6 19.333 17.067 27.333 39.467 27.467 10.267.133 12.267-.267 20.133-4.134 9.334-4.533 13.867-9.733 17.867-20.266 2-4.934 2.4-12 2.933-41.067l.534-34.933h-38.934v23.866l6.4.4 6.267.4v19.334c0 13.466-.533 20.666-1.867 23.733-5.066 12-23.333 10.4-26.8-2.4-.933-3.6-1.333-23.2-1.066-59.067.4-48.533.666-54.133 2.666-57.333 3.334-4.8 11.2-7.067 17.6-4.933 6.934 2.266 9.067 7.2 9.867 22.933l.667 13.067H555.4l-.8-15.734c-.8-18-3.067-25.6-9.867-33.466-7.466-8.8-13.466-11.2-29.066-11.734-9.067-.266-14.934.134-18.4 1.467"/></g></svg>',he=`data:image/svg+xml;utf8,${encodeURIComponent(Fe)}`;var qe=["https://cloud.idosgames.com","https://idosgames.com","https://www.idosgames.com"];function ge(){return typeof window<"u"&&qe.includes(window.location.origin)}function X({client:e,onAuthenticated:o}){let[t,l]=useState(false),[n,a]=useState(null),[c,g]=useState(true),u=async()=>{l(true),a(null),e.auth.setRememberSession(c);let r=await e.auth.loginWithDeviceID();if(r.ok){o();return}a(r.error),l(false);};return jsx("div",{style:w.root,children:jsxs("div",{style:w.card,children:[jsx("img",{src:he,alt:"iDos Games",style:w.logo}),jsx("h1",{style:w.title,children:"Sign in"}),ge()&&jsx("button",{type:"button",onClick:()=>beginSsoRedirect({titleID:e.titleID}),disabled:t,style:{...w.primary,opacity:t?.6:1,cursor:t?"default":"pointer"},children:"Continue with iDos Games"}),jsx("button",{type:"button",onClick:()=>{u();},disabled:t,style:{...ge()?w.ghost:w.primary,opacity:t?.6:1,cursor:t?"default":"pointer"},children:t?"Signing in\u2026":"Play as guest"}),jsxs("label",{style:{...w.remember,opacity:t?.6:1},children:[jsx("input",{type:"checkbox",checked:c,disabled:t,onChange:r=>g(r.target.checked),style:w.switchInput}),jsx("span",{style:{...w.switchTrack,background:c?"#fff":"rgba(255, 255, 255, 0.3)"},children:jsx("span",{style:{...w.switchKnob,left:c?"21px":"3px",background:c?"#0d66fe":"#fff"}})}),"Remember me"]}),n&&jsx("span",{style:w.error,children:n})]})})}var w={root:{position:"absolute",inset:0,display:"grid",placeItems:"center",background:"#0d66fe",color:"#fff",font:"14px system-ui, sans-serif"},card:{width:"min(340px, 88vw)",display:"grid",gap:"18px",justifyItems:"center"},logo:{width:"180px",userSelect:"none",pointerEvents:"none"},title:{margin:0,fontSize:"22px",fontWeight:600,textAlign:"center"},primary:{width:"100%",padding:"11px 16px",borderRadius:"8px",border:"none",background:"#fff",color:"#0d66fe",fontWeight:600,font:"inherit"},ghost:{width:"100%",padding:"11px 16px",borderRadius:"8px",border:"1px solid rgba(255, 255, 255, 0.45)",background:"transparent",color:"#fff",fontWeight:600,font:"inherit"},remember:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",color:"rgba(255, 255, 255, 0.85)"},switchInput:{position:"absolute",opacity:0,width:0,height:0},switchTrack:{position:"relative",width:"42px",height:"24px",borderRadius:"12px",transition:"background 0.15s",flexShrink:0},switchKnob:{position:"absolute",top:"3px",width:"18px",height:"18px",borderRadius:"50%",transition:"left 0.15s, background 0.15s"},error:{color:"#ffd7d7",textAlign:"center"}};function Qe(e){let{container:o,client:t,modules:l,renderLogin:n}=e;o.style.position="relative";let a=document.createElement("div");Object.assign(a.style,{position:"absolute",inset:"0",zIndex:"0",pointerEvents:"none"});let c=document.createElement("div");Object.assign(c.style,{position:"absolute",inset:"0",zIndex:"1"}),o.append(a,c);let g=T(),u=B(a);N(()=>g.describe());let r=I(l);for(let p of r.warnings)console.warn(`[idos shared-ui] ${p}`);let s=createRoot(c);return s.render(jsx(IDosGamesProvider,{client:t,children:jsx(StatusProvider,{children:jsx(q,{client:t,modules:l,events:g,sharedUi:r.owners,surface:u,renderLogin:n??X})})})),{unmount(){s.unmount(),a.remove(),c.remove();}}}
|
|
11
|
+
export{q as AuthGate,X as DefaultLoginScreen,K as HostShell,C as SceneStage,T as createHostEventBus,xe as createSharedEventBus,B as createSurfaceAllocator,re as emptySharedUiOwners,Qe as mountHost,N as publishEventsProvider,G as publishHostState,z as registerAgentApi,I as resolveSharedUi,j as runModules,D as sharedUiFor};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idosgames/app-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "The host runtime for composable modules: module registry, shared event bus, surface allocator, scene stage, and the React Mode Router shell. A project seeds one host shell and plugs N modules into it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
},
|
|
48
48
|
"//": "react/react-dom are consumer-provided peers. @idosgames/* are real ranges pinned in step with those packages.",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@idosgames/core": "^0.
|
|
51
|
-
"@idosgames/module-sdk": "^0.
|
|
52
|
-
"@idosgames/react": "^0.2.
|
|
50
|
+
"@idosgames/core": "^0.12.0",
|
|
51
|
+
"@idosgames/module-sdk": "^0.2.0",
|
|
52
|
+
"@idosgames/react": "^0.2.5"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"react": "^18.3.1 || ^19.0.0",
|