@mblinkov/whats-missing 20.0.40 → 20.0.42
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/whats-missing.cjs.js +33 -30
- package/dist/whats-missing.es.js +345 -338
- package/package.json +1 -1
- package/src/Game.tsx +71 -73
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),s=require("react"),pe=require("react-dom"),ye=window.origin+"/cloud/speakid/games/whatsmissing/",P=(d,m)=>d.map(([r,i])=>({src:`${ye}${m}/${i.replace(/\s/g,"%20")}.png`,name:i})),xe=[["apple","apple"],["banana","banana"],["bread","bread"],["burger","burger"],["cake","cake"],["carrot","carrot"],["cheese","cheese"],["chicken","chicken"],["chocolate","chocolate"],["corn","corn"],["donut","donut"],["fish","fish"],["fries","fries"],["grapes","grapes"],["ice_cream","ice cream"],["milk","milk"],["orange","orange"],["pear","pear"],["pizza","pizza"],["rice","rice"],["sandwich","sandwich"],["soup","soup"],["strawberry","strawberry"],["tomato","tomato"],["watermelon","watermelon"]],we=[["bear","bear"],["cat","cat"],["crocodile","crocodile"],["dolphin","dolphin"],["elephant","elephant"],["fox","fox"],["giraffe","giraffe"],["horse","horse"],["kangaroo","kangaroo"],["lion","lion"],["monkey","monkey"],["owl","owl"],["panda","panda"],["penguin","penguin"],["squirrel","squirrel"],["tiger","tiger"],["tortoise","tortoise"],["wolf","wolf"],["zebra","zebra"]],be=[["ball","ball"],["balloon","balloon"],["blocks","blocks"],["car","car"],["doll","doll"],["drum","drum"],["guitar","guitar"],["jump_rope","jump rope"],["kite","kite"],["paints","paints"],["plane","plane"],["puzzle","puzzle"],["rocket","rocket"],["scooter","scooter"],["skateboard","skateboard"],["slide","slide"],["teddy_bear","teddy bear"],["yo-yo","yo-yo"],["crayons","crayons"]],Y={food:P(xe,"food"),animals:P(we,"animals"),toys:P(be,"toys")},je=`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
from { transform: rotate(0deg); }
|
|
4
4
|
to { transform: rotate(360deg); }
|
|
5
5
|
}
|
|
6
|
-
`;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const
|
|
6
|
+
`;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const d=document.createElement("style");d.id="spin-keyframes",d.innerHTML=je,document.head.appendChild(d)}const Se={animation:"spin 1.4s linear infinite"},o={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100%",width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"#1f2937",padding:"24px 16px",boxSizing:"border-box",transform:"translateY(20px)"},gmHeadline1:{fontWeight:700,fontSize:"clamp(28px, 4vw, 40px)",lineHeight:"110%"},gmHeadline3:{fontWeight:600,fontSize:"18px",lineHeight:"130%"},gmBodyM:{fontWeight:400,fontSize:"16px",lineHeight:"140%"},gmBodyS:{fontWeight:400,fontSize:"14px",lineHeight:"140%",color:"#6b7280"},gmButton:{fontFamily:'"Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans"',fontWeight:600,fontSize:"16px",padding:"10px 16px",borderRadius:"12px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"0 6px 18px rgba(236, 76, 68, .18)",transition:"transform .06s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease"},gmButtonActive:{background:"#333",color:"#fff"},gmGameLayout:{position:"relative",width:"100%",maxWidth:"none",minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"none",margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(3, 210px)",gridAutoRows:"210px",gap:"20px",justifyContent:"center"},gmCard:{border:"1px solid #e5e7eb",borderRadius:"16px",background:"#f9f9f9",aspectRatio:"1 / 1",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"transform .2s ease, box-shadow .2s ease, border-color .2s ease"},gmCorrect:{border:"2px solid #10b981",boxShadow:"0 0 18px rgba(16,185,129,.45)",background:"#ecfdf5"},gmWrong:{border:"2px solid #ec4c44",boxShadow:"0 0 18px rgba(236,76,68,.35)",background:"#fef2f2"},gmInput:{padding:"6px 10px",borderRadius:"6px",border:"1px solid #ccc",fontSize:"16px",fontFamily:'"Geist", system-ui',width:"160px"},gmTable:{marginTop:"20px",marginBottom:"32px",borderCollapse:"collapse",width:"100%",maxWidth:"520px",tableLayout:"fixed",textAlign:"center"},gmTableCell:{padding:"8px 12px",borderBottom:"1px solid #e5e7eb",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},gmLogoFixed:{position:"absolute",top:"16px",left:"24px",width:"120px",zIndex:10,pointerEvents:"none",background:"transparent",transform:"none",willChange:"auto"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto",background:"transparent",objectFit:"contain",imageRendering:"auto",transform:"translateZ(0)",backfaceVisibility:"hidden",WebkitFontSmoothing:"antialiased"},gmHourglass:{fontSize:"42px",...Se}},ve=(d,m)=>{const r=Array.from({length:d.length+1},()=>Array(m.length+1).fill(0));for(let i=0;i<=d.length;i++)r[i][0]=i;for(let i=0;i<=m.length;i++)r[0][i]=i;for(let i=1;i<=d.length;i++)for(let g=1;g<=m.length;g++)r[i][g]=d[i-1]===m[g-1]?r[i-1][g-1]:Math.min(r[i-1][g-1],r[i][g-1],r[i-1][g])+1;return r[d.length][m.length]};function ze(d,m={minDesktopWidth:1200,forceResize:!1}){const r=s.useRef(null),i=m.minDesktopWidth??1200,g=!!m.forceResize;s.useLayoutEffect(()=>{if(typeof window>"u"||!d||!d.current)return;const c=d.current,T=()=>{try{const l=document.body,y=getComputedStyle(l),w=parseFloat(l.style&&l.style.zoom||"");if(w&&!isNaN(w)&&w>0)return w;const z=parseFloat(y.zoom||"");if(z&&!isNaN(z)&&z>0)return z;const u=document.createElement("div");u.style.position="absolute",u.style.left="0",u.style.top="0",u.style.width="100px",u.style.height="1px",u.style.visibility="hidden",document.documentElement.appendChild(u);const C=u.getBoundingClientRect();if(document.documentElement.removeChild(u),C&&C.width>0){const j=C.width/100;if(!isNaN(j)&&j>0)return j}}catch{}return 1},B=()=>{if(i&&window.innerWidth<i){R();return}const l=T();if(!l||l===1){R();return}r.current||(r.current={transform:c.style.transform||null,transformOrigin:c.style.transformOrigin||null,width:c.style.width||null,height:c.style.height||null,willChange:c.style.willChange||null});const y=1/l;g&&(c.style.width=`${l*100}%`,c.style.height=`${l*100}%`),c.style.transformOrigin="50% 50%",c.style.transform=`scale(${y})`,c.style.willChange="transform"},R=()=>{if(!r.current)return;const l=r.current;c.style.transform=l.transform??"",c.style.transformOrigin=l.transformOrigin??"",c.style.width=l.width??"",c.style.height=l.height??"",c.style.willChange=l.willChange??"",r.current=null};let v=0;const p=()=>{cancelAnimationFrame(v),v=requestAnimationFrame(B)},M=new MutationObserver(l=>{for(const y of l)if(y.type==="attributes"&&(y.attributeName==="style"||y.attributeName==="class")){p();break}});return M.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),window.addEventListener("resize",p),p(),()=>{cancelAnimationFrame(v),M.disconnect(),window.removeEventListener("resize",p),R()}},[d,i,g])}function Ce({gameCubeSize:d,screenHeight:m,screenWidth:r}){const i=s.useRef(null),g=s.useRef(null),[c,T]=s.useState(null),[B,R]=s.useState(null);ze(i,{minDesktopWidth:1024,forceResize:!1}),s.useLayoutEffect(()=>{const e=i.current;if(!e)return;let n=e.shadowRoot;n||(n=e.attachShadow({mode:"open"})),n.innerHTML="";const a=document.createElement("style");a.textContent=`
|
|
7
7
|
:host {
|
|
8
|
-
position: fixed
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
position: fixed;
|
|
9
|
+
inset: 0;
|
|
10
|
+
width: 100vw;
|
|
11
|
+
height: 100vh;
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
|
|
16
|
+
z-index: 100;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
transform: none;
|
|
21
|
+
zoom: 1;
|
|
22
|
+
scale: 1;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
#whats-missing-root, #whats-missing-root * {
|
|
24
|
-
box-sizing: border-box
|
|
26
|
+
box-sizing: border-box;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
#whats-missing-root img {
|
|
28
|
-
max-width: 100
|
|
29
|
-
height: auto
|
|
30
|
-
display: block
|
|
31
|
-
user-select: none
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
height: auto;
|
|
32
|
+
display: block;
|
|
33
|
+
user-select: none;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
#whats-missing-root {
|
|
35
|
-
position: relative
|
|
36
|
-
width: 100
|
|
37
|
-
height: 100
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
position: relative;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
max-width: 1200px;
|
|
41
|
+
display: flex;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
align-items: center;
|
|
44
|
+
transform: none;
|
|
45
|
+
zoom: 1;
|
|
46
|
+
scale: 1;
|
|
44
47
|
}
|
|
45
|
-
|
|
48
|
+
`,n.appendChild(a),R(n)},[]),s.useEffect(()=>{const e=document.body,n=document.documentElement,a=e.style.zoom,h=e.style.transform,b=n.style.zoom,I=n.style.transform;return e.style.zoom="1",e.style.transform="none",n.style.zoom="1",n.style.transform="none",()=>{e.style.zoom=a,e.style.transform=h,n.style.zoom=b,n.style.transform=I}},[]);const v=s.useMemo(()=>{const e=d??Math.min(r??1e3,m??1e3),n=r??(typeof window<"u"?window.innerWidth:1e3);return e<600&&n>768?600:n<=768?Math.min(e,n-20):e},[d,r,m]);s.useEffect(()=>()=>{document.body.style.overflow=""},[]);const[p,M]=s.useState(null),[l,y]=s.useState([]),[w,z]=s.useState(4),[u,C]=s.useState(!1),[j,Z]=s.useState(1),[S,re]=s.useState(null),[x,E]=s.useState("ready"),[U,V]=s.useState(3),[W,F]=s.useState(10),[G,_]=s.useState(20),[le,N]=s.useState(0),[L,D]=s.useState(!1),[A,K]=s.useState(""),[k,O]=s.useState(!1),[$,J]=s.useState(!1),[Q,H]=s.useState(null),[ae,q]=s.useState([]),[de,X]=s.useState([]),[f,ce]=s.useState(!1);s.useEffect(()=>{if(typeof window>"u")return;const e=()=>{const n=r??window.innerWidth,a=window.matchMedia&&window.matchMedia("(pointer: coarse)").matches;ce(n<=768||a)};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[r]),s.useLayoutEffect(()=>{const e=g.current;if(!e||typeof window>"u")return;let n=null;try{n=new ResizeObserver(a=>{for(const h of a){const b=h.contentRect;T(Math.round(Math.min(b.width,b.height)))}}),n.observe(e),T(Math.round(Math.min(e.clientWidth,e.clientHeight)))}catch{T(Math.round(Math.min(e.clientWidth,e.clientHeight)))}return()=>n?.disconnect()},[f]);const ee=e=>[...e].sort(()=>Math.random()-.5).slice(0,6),te=()=>{if(!p)return;const e=ee(Y[p]);y(e),C(!0),D(!1),Z(1),N(0),q([]),X([]),ne(e,[],!0)},ne=(e=l,n=de,a=!1)=>{const h=ee(e.length?e:Y[p]);let b=Math.floor(Math.random()*h.length),I=h[b].name,ie=0;for(;n.includes(I)&&ie<20;)b=Math.floor(Math.random()*h.length),I=h[b].name,ie++;y(h),re(b),X([...n,I]),O(!1),K(""),_(20),H(null),a?(E("ready"),V(3),F(10)):(E("memorize"),F(10))};s.useEffect(()=>{if(!(!u||L||k)){if(x==="ready")if(U<=0)E("memorize");else{const e=setTimeout(()=>V(n=>n-1),1e3);return()=>clearTimeout(e)}if(x==="memorize")if(W<=0)E("guess");else{const e=setTimeout(()=>F(n=>n-1),1e3);return()=>clearTimeout(e)}if(x==="guess"){if(G<=0){O(!0),H("wrong");const n=l[S].name;q(a=>[...a,{round:j,answer:A,correct:n,result:"wrong"}]);return}const e=setTimeout(()=>_(n=>n-1),1e3);return()=>clearTimeout(e)}}},[x,U,W,G,u,L,k,l,S,j,A]);const me=()=>{if(S===null||$)return;const e=l[S].name,n=A.toLowerCase().trim();let a="wrong";n===e?(N(h=>h+1),H("correct"),a="correct"):ve(n,e)===1?(N(h=>h+.5),H("almost"),a="almost"):(H("wrong"),a="wrong"),q(h=>[...h,{round:j,answer:n,correct:e,result:a}]),J(!0),setTimeout(()=>{J(!1),O(!0)},600)},ue=()=>j<w?(Z(e=>e+1),ne()):D(!0),he=()=>{C(!1),D(!1),M(null)},ge=s.useMemo(()=>t.jsx("div",{style:{...o.gmLogoFixed,position:"absolute",top:16,left:16,zIndex:30},children:t.jsxs("picture",{children:[t.jsx("source",{srcSet:window.origin+"/cloud/speakid/games/whatsmissing/logo.svg",type:"image/svg+xml"}),t.jsx("img",{src:window.origin+"/cloud/speakid/games/whatsmissing/logo.png",alt:"SPEAKID Logo",style:o.gmLogoImg,loading:"lazy"})]})}),[]),oe=1200,se=700,fe=s.useMemo(()=>{const e=r??(typeof window<"u"?window.innerWidth:oe),n=m??(typeof window<"u"?window.innerHeight:se),a=Math.min(e/oe,n/se);return Math.min(1.35,Math.max(1,a))},[r,m,f]);return t.jsx("div",{ref:i,style:{width:"100%",height:"100%"},children:B&&pe.createPortal(t.jsx("div",{id:"whats-missing-root",style:{all:"unset"},children:t.jsx("div",{ref:g,style:{width:f?"100%":`${v}px`,height:f?"100%":`${v}px`,borderRadius:f?0:"20px",background:"linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",position:"relative",overflow:"hidden",boxShadow:f?"none":"0 0 40px rgba(0,0,0,0.08)",display:"flex",justifyContent:"center",alignItems:"center"},children:t.jsxs("div",{style:{transform:`scale(${fe})`,transformOrigin:"center center",transition:"transform 0.2s ease-out",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[!f&&ge,!p&&!u&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsx("h1",{style:o.gmHeadline1,children:"WHAT'S MISSING?"}),t.jsx("p",{style:o.gmBodyM,children:"Select a theme:"}),t.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(e=>t.jsx("button",{style:o.gmButton,onClick:()=>M(e),children:e==="animals"?"🐶 Animals":e==="food"?"🍎 Food":"🧸 Toys"},e))}),t.jsxs("div",{style:{marginTop:24},children:[t.jsx("p",{style:o.gmBodyS,children:"Choose number of rounds:"}),t.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(e=>t.jsx("button",{style:{...o.gmButton,...w===e?o.gmButtonActive:{}},onClick:()=>z(e),children:e},e))})]})]}),p&&!u&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",p]}),t.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",w]}),t.jsx("button",{style:o.gmButton,onClick:te,children:"▶ Start game"})]}),L&&t.jsxs("div",{style:o.gmCenterScreen,children:[t.jsx("h1",{style:o.gmHeadline1,children:"Results"}),t.jsxs("h2",{style:o.gmHeadline3,children:["Your score: ",le," / ",w]}),t.jsx("p",{style:{...o.gmBodyM,color:"#10b981",marginTop:12},children:"Yahoo! You did it! 🍬✨"}),t.jsxs("table",{style:o.gmTable,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Round"}),t.jsx("th",{children:"Your Answer"}),t.jsx("th",{children:"Correct"}),t.jsx("th",{children:"Result"})]})}),t.jsx("tbody",{children:ae.map((e,n)=>t.jsxs("tr",{children:[t.jsx("td",{style:o.gmTableCell,children:e.round}),t.jsx("td",{style:o.gmTableCell,children:e.answer||"—"}),t.jsx("td",{style:o.gmTableCell,children:e.correct}),t.jsx("td",{style:o.gmTableCell,children:e.result==="correct"?"✔ Correct":e.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},n))})]}),t.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[t.jsx("button",{style:o.gmButton,onClick:te,children:"🔁 Play again"}),t.jsx("button",{style:o.gmButton,onClick:he,children:"⬅️ Choose theme"})]})]}),u&&!L&&t.jsxs("div",{style:o.gmGameLayout,children:[t.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[x==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),t.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),x==="memorize"&&t.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",W,")"]}),x==="guess"&&!k&&t.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",G,"s"]})]}),x!=="ready"&&t.jsx("div",{style:{...o.gmGrid,display:"grid",gridTemplateColumns:`repeat(${f?2:3}, 1fr)`,gridTemplateRows:`repeat(${f?3:2}, 1fr)`,gap:f?12:20,justifyContent:"center",alignContent:"center",padding:f?8:16,width:"100%",height:"100%",maxWidth:f?"100%":600,maxHeight:f?"100%":400,boxSizing:"border-box"},children:l.map((e,n)=>{const a=S===n&&x==="guess"&&!k;return t.jsx("div",{style:{...o.gmCard,width:"100%",height:"100%",...Q==="correct"&&S===n?o.gmCorrect:{},...Q==="wrong"&&S===n?o.gmWrong:{}},children:!a&&t.jsx("img",{src:e.src,alt:e.name,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},n)})}),t.jsxs("div",{style:{marginTop:16,height:80},children:[x==="guess"&&!k&&t.jsxs("div",{children:[t.jsx("input",{type:"text",placeholder:"Type the missing word",value:A,onChange:e=>K(e.target.value),style:o.gmInput}),t.jsx("button",{style:{...o.gmButton,marginLeft:8},onClick:me,disabled:$,children:$?"...":"Check"})]}),k&&t.jsx("button",{type:"button",style:o.gmButton,onClick:ue,children:"Next round"})]})]})]})})}),B)})}exports.Game=Ce;exports.themes=Y;
|
package/dist/whats-missing.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as V, useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
const Ce = window.origin + "/cloud/speakid/games/whatsmissing/", U = (
|
|
5
|
-
src: `${Ce}${
|
|
1
|
+
import { jsx as n, jsxs as d, Fragment as ve } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as V, useState as a, useLayoutEffect as _, useEffect as F, useMemo as Z } from "react";
|
|
3
|
+
import { createPortal as ze } from "react-dom";
|
|
4
|
+
const Ce = window.origin + "/cloud/speakid/games/whatsmissing/", U = (c, h) => c.map(([r, i]) => ({
|
|
5
|
+
src: `${Ce}${h}/${i.replace(/\s/g, "%20")}.png`,
|
|
6
6
|
name: i
|
|
7
|
-
})),
|
|
7
|
+
})), ke = [
|
|
8
8
|
["apple", "apple"],
|
|
9
9
|
["banana", "banana"],
|
|
10
10
|
["bread", "bread"],
|
|
@@ -30,7 +30,7 @@ const Ce = window.origin + "/cloud/speakid/games/whatsmissing/", U = (m, g) => m
|
|
|
30
30
|
["strawberry", "strawberry"],
|
|
31
31
|
["tomato", "tomato"],
|
|
32
32
|
["watermelon", "watermelon"]
|
|
33
|
-
],
|
|
33
|
+
], Se = [
|
|
34
34
|
["bear", "bear"],
|
|
35
35
|
["cat", "cat"],
|
|
36
36
|
["crocodile", "crocodile"],
|
|
@@ -50,7 +50,7 @@ const Ce = window.origin + "/cloud/speakid/games/whatsmissing/", U = (m, g) => m
|
|
|
50
50
|
["tortoise", "tortoise"],
|
|
51
51
|
["wolf", "wolf"],
|
|
52
52
|
["zebra", "zebra"]
|
|
53
|
-
],
|
|
53
|
+
], Te = [
|
|
54
54
|
["ball", "ball"],
|
|
55
55
|
["balloon", "balloon"],
|
|
56
56
|
["blocks", "blocks"],
|
|
@@ -71,22 +71,22 @@ const Ce = window.origin + "/cloud/speakid/games/whatsmissing/", U = (m, g) => m
|
|
|
71
71
|
["yo-yo", "yo-yo"],
|
|
72
72
|
["crayons", "crayons"]
|
|
73
73
|
], ce = {
|
|
74
|
-
food: U(
|
|
75
|
-
animals: U(
|
|
76
|
-
toys: U(
|
|
77
|
-
},
|
|
74
|
+
food: U(ke, "food"),
|
|
75
|
+
animals: U(Se, "animals"),
|
|
76
|
+
toys: U(Te, "toys")
|
|
77
|
+
}, Re = `
|
|
78
78
|
@keyframes spin {
|
|
79
79
|
from { transform: rotate(0deg); }
|
|
80
80
|
to { transform: rotate(360deg); }
|
|
81
81
|
}
|
|
82
82
|
`;
|
|
83
83
|
if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
|
|
84
|
-
const
|
|
85
|
-
|
|
84
|
+
const c = document.createElement("style");
|
|
85
|
+
c.id = "spin-keyframes", c.innerHTML = Re, document.head.appendChild(c);
|
|
86
86
|
}
|
|
87
|
-
const
|
|
87
|
+
const Me = {
|
|
88
88
|
animation: "spin 1.4s linear infinite"
|
|
89
|
-
},
|
|
89
|
+
}, o = {
|
|
90
90
|
gmCenterScreen: {
|
|
91
91
|
position: "relative",
|
|
92
92
|
zIndex: 1,
|
|
@@ -240,447 +240,454 @@ const Re = {
|
|
|
240
240
|
},
|
|
241
241
|
gmHourglass: {
|
|
242
242
|
fontSize: "42px",
|
|
243
|
-
...
|
|
243
|
+
...Me
|
|
244
244
|
}
|
|
245
|
-
},
|
|
246
|
-
const r = Array.from({ length:
|
|
247
|
-
for (let i = 0; i <=
|
|
248
|
-
for (let i = 0; i <=
|
|
249
|
-
for (let i = 1; i <=
|
|
250
|
-
for (let
|
|
251
|
-
r[i][
|
|
252
|
-
return r[
|
|
245
|
+
}, He = (c, h) => {
|
|
246
|
+
const r = Array.from({ length: c.length + 1 }, () => Array(h.length + 1).fill(0));
|
|
247
|
+
for (let i = 0; i <= c.length; i++) r[i][0] = i;
|
|
248
|
+
for (let i = 0; i <= h.length; i++) r[0][i] = i;
|
|
249
|
+
for (let i = 1; i <= c.length; i++)
|
|
250
|
+
for (let f = 1; f <= h.length; f++)
|
|
251
|
+
r[i][f] = c[i - 1] === h[f - 1] ? r[i - 1][f - 1] : Math.min(r[i - 1][f - 1], r[i][f - 1], r[i - 1][f]) + 1;
|
|
252
|
+
return r[c.length][h.length];
|
|
253
253
|
};
|
|
254
|
-
function
|
|
255
|
-
const r = V(null), i =
|
|
254
|
+
function Ie(c, h = { minDesktopWidth: 1200, forceResize: !1 }) {
|
|
255
|
+
const r = V(null), i = h.minDesktopWidth ?? 1200, f = !!h.forceResize;
|
|
256
256
|
_(() => {
|
|
257
|
-
if (typeof window > "u" || !
|
|
258
|
-
const
|
|
257
|
+
if (typeof window > "u" || !c || !c.current) return;
|
|
258
|
+
const m = c.current, M = () => {
|
|
259
259
|
try {
|
|
260
|
-
const s = document.body,
|
|
260
|
+
const s = document.body, w = getComputedStyle(s), x = parseFloat(s.style && s.style.zoom || "");
|
|
261
261
|
if (x && !isNaN(x) && x > 0) return x;
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
const T =
|
|
267
|
-
if (document.documentElement.removeChild(
|
|
268
|
-
const
|
|
269
|
-
if (!isNaN(
|
|
262
|
+
const S = parseFloat(w.zoom || "");
|
|
263
|
+
if (S && !isNaN(S) && S > 0) return S;
|
|
264
|
+
const u = document.createElement("div");
|
|
265
|
+
u.style.position = "absolute", u.style.left = "0", u.style.top = "0", u.style.width = "100px", u.style.height = "1px", u.style.visibility = "hidden", document.documentElement.appendChild(u);
|
|
266
|
+
const T = u.getBoundingClientRect();
|
|
267
|
+
if (document.documentElement.removeChild(u), T && T.width > 0) {
|
|
268
|
+
const z = T.width / 100;
|
|
269
|
+
if (!isNaN(z) && z > 0) return z;
|
|
270
270
|
}
|
|
271
271
|
} catch {
|
|
272
272
|
}
|
|
273
273
|
return 1;
|
|
274
|
-
},
|
|
274
|
+
}, A = () => {
|
|
275
275
|
if (i && window.innerWidth < i) {
|
|
276
|
-
|
|
276
|
+
H();
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
const s = M();
|
|
280
280
|
if (!s || s === 1) {
|
|
281
|
-
|
|
281
|
+
H();
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
284
|
r.current || (r.current = {
|
|
285
|
-
transform:
|
|
286
|
-
transformOrigin:
|
|
287
|
-
width:
|
|
288
|
-
height:
|
|
289
|
-
willChange:
|
|
285
|
+
transform: m.style.transform || null,
|
|
286
|
+
transformOrigin: m.style.transformOrigin || null,
|
|
287
|
+
width: m.style.width || null,
|
|
288
|
+
height: m.style.height || null,
|
|
289
|
+
willChange: m.style.willChange || null
|
|
290
290
|
});
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
},
|
|
291
|
+
const w = 1 / s;
|
|
292
|
+
f && (m.style.width = `${s * 100}%`, m.style.height = `${s * 100}%`), m.style.transformOrigin = "50% 50%", m.style.transform = `scale(${w})`, m.style.willChange = "transform";
|
|
293
|
+
}, H = () => {
|
|
294
294
|
if (!r.current) return;
|
|
295
295
|
const s = r.current;
|
|
296
|
-
|
|
296
|
+
m.style.transform = s.transform ?? "", m.style.transformOrigin = s.transformOrigin ?? "", m.style.width = s.width ?? "", m.style.height = s.height ?? "", m.style.willChange = s.willChange ?? "", r.current = null;
|
|
297
297
|
};
|
|
298
|
-
let
|
|
299
|
-
const
|
|
300
|
-
cancelAnimationFrame(
|
|
301
|
-
},
|
|
302
|
-
for (const
|
|
303
|
-
if (
|
|
304
|
-
|
|
298
|
+
let k = 0;
|
|
299
|
+
const y = () => {
|
|
300
|
+
cancelAnimationFrame(k), k = requestAnimationFrame(A);
|
|
301
|
+
}, I = new MutationObserver((s) => {
|
|
302
|
+
for (const w of s)
|
|
303
|
+
if (w.type === "attributes" && (w.attributeName === "style" || w.attributeName === "class")) {
|
|
304
|
+
y();
|
|
305
305
|
break;
|
|
306
306
|
}
|
|
307
307
|
});
|
|
308
|
-
return
|
|
309
|
-
cancelAnimationFrame(
|
|
308
|
+
return I.observe(document.body, { attributes: !0, attributeFilter: ["style", "class"] }), window.addEventListener("resize", y), y(), () => {
|
|
309
|
+
cancelAnimationFrame(k), I.disconnect(), window.removeEventListener("resize", y), H();
|
|
310
310
|
};
|
|
311
|
-
}, [
|
|
311
|
+
}, [c, i, f]);
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
gameCubeSize:
|
|
315
|
-
screenHeight:
|
|
313
|
+
function Ee({
|
|
314
|
+
gameCubeSize: c,
|
|
315
|
+
screenHeight: h,
|
|
316
316
|
screenWidth: r
|
|
317
317
|
}) {
|
|
318
|
-
const i = V(null),
|
|
319
|
-
|
|
318
|
+
const i = V(null), f = V(null), [m, M] = a(null), [A, H] = a(null);
|
|
319
|
+
Ie(i, { minDesktopWidth: 1024, forceResize: !1 }), _(() => {
|
|
320
320
|
const e = i.current;
|
|
321
321
|
if (!e) return;
|
|
322
322
|
let t = e.shadowRoot;
|
|
323
323
|
t || (t = e.attachShadow({ mode: "open" })), t.innerHTML = "";
|
|
324
|
-
const
|
|
325
|
-
|
|
324
|
+
const l = document.createElement("style");
|
|
325
|
+
l.textContent = `
|
|
326
326
|
:host {
|
|
327
|
-
position: fixed
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
327
|
+
position: fixed;
|
|
328
|
+
inset: 0;
|
|
329
|
+
width: 100vw;
|
|
330
|
+
height: 100vh;
|
|
331
|
+
display: flex;
|
|
332
|
+
justify-content: center;
|
|
333
|
+
align-items: center;
|
|
334
|
+
background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
|
|
335
|
+
z-index: 100;
|
|
336
|
+
overflow: hidden;
|
|
337
|
+
margin: 0;
|
|
338
|
+
padding: 0;
|
|
339
|
+
transform: none;
|
|
340
|
+
zoom: 1;
|
|
341
|
+
scale: 1;
|
|
340
342
|
}
|
|
341
343
|
|
|
342
344
|
#whats-missing-root, #whats-missing-root * {
|
|
343
|
-
box-sizing: border-box
|
|
345
|
+
box-sizing: border-box;
|
|
344
346
|
}
|
|
345
347
|
|
|
346
348
|
#whats-missing-root img {
|
|
347
|
-
max-width: 100
|
|
348
|
-
height: auto
|
|
349
|
-
display: block
|
|
350
|
-
user-select: none
|
|
349
|
+
max-width: 100%;
|
|
350
|
+
height: auto;
|
|
351
|
+
display: block;
|
|
352
|
+
user-select: none;
|
|
351
353
|
}
|
|
352
354
|
|
|
353
355
|
#whats-missing-root {
|
|
354
|
-
position: relative
|
|
355
|
-
width: 100
|
|
356
|
-
height: 100
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
356
|
+
position: relative;
|
|
357
|
+
width: 100%;
|
|
358
|
+
height: 100%;
|
|
359
|
+
max-width: 1200px;
|
|
360
|
+
display: flex;
|
|
361
|
+
justify-content: center;
|
|
362
|
+
align-items: center;
|
|
363
|
+
transform: none;
|
|
364
|
+
zoom: 1;
|
|
365
|
+
scale: 1;
|
|
363
366
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}, []), j(() => {
|
|
368
|
-
const e = document.body, t = document.documentElement, a = e.style.zoom, l = e.style.transform, z = t.style.zoom, B = t.style.transform;
|
|
367
|
+
`, t.appendChild(l), H(t);
|
|
368
|
+
}, []), F(() => {
|
|
369
|
+
const e = document.body, t = document.documentElement, l = e.style.zoom, g = e.style.transform, v = t.style.zoom, L = t.style.transform;
|
|
369
370
|
return e.style.zoom = "1", e.style.transform = "none", t.style.zoom = "1", t.style.transform = "none", () => {
|
|
370
|
-
e.style.zoom =
|
|
371
|
+
e.style.zoom = l, e.style.transform = g, t.style.zoom = v, t.style.transform = L;
|
|
371
372
|
};
|
|
372
373
|
}, []);
|
|
373
|
-
const
|
|
374
|
-
const e =
|
|
374
|
+
const k = Z(() => {
|
|
375
|
+
const e = c ?? Math.min(r ?? 1e3, h ?? 1e3), t = r ?? (typeof window < "u" ? window.innerWidth : 1e3);
|
|
375
376
|
return e < 600 && t > 768 ? 600 : t <= 768 ? Math.min(e, t - 20) : e;
|
|
376
|
-
}, [
|
|
377
|
-
|
|
377
|
+
}, [c, r, h]);
|
|
378
|
+
F(() => () => {
|
|
378
379
|
document.body.style.overflow = "";
|
|
379
380
|
}, []);
|
|
380
|
-
const [
|
|
381
|
-
|
|
381
|
+
const [y, I] = a(null), [s, w] = a([]), [x, S] = a(4), [u, T] = a(!1), [z, K] = a(1), [C, me] = a(null), [b, E] = a("ready"), [J, Q] = a(3), [G, N] = a(10), [$, X] = a(20), [he, D] = a(0), [W, O] = a(!1), [j, ee] = a(""), [R, q] = a(!1), [Y, te] = a(!1), [ne, B] = a(null), [ue, P] = a([]), [ge, oe] = a([]), [p, fe] = a(!1);
|
|
382
|
+
F(() => {
|
|
382
383
|
if (typeof window > "u") return;
|
|
383
384
|
const e = () => {
|
|
384
|
-
const t = r ?? window.innerWidth,
|
|
385
|
-
|
|
385
|
+
const t = r ?? window.innerWidth, l = window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
|
|
386
|
+
fe(t <= 768 || l);
|
|
386
387
|
};
|
|
387
388
|
return e(), window.addEventListener("resize", e), window.addEventListener("orientationchange", e), () => {
|
|
388
389
|
window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e);
|
|
389
390
|
};
|
|
390
391
|
}, [r]), _(() => {
|
|
391
|
-
const e =
|
|
392
|
+
const e = f.current;
|
|
392
393
|
if (!e || typeof window > "u") return;
|
|
393
394
|
let t = null;
|
|
394
395
|
try {
|
|
395
|
-
t = new ResizeObserver((
|
|
396
|
-
for (const
|
|
397
|
-
const
|
|
398
|
-
M(Math.round(Math.min(
|
|
396
|
+
t = new ResizeObserver((l) => {
|
|
397
|
+
for (const g of l) {
|
|
398
|
+
const v = g.contentRect;
|
|
399
|
+
M(Math.round(Math.min(v.width, v.height)));
|
|
399
400
|
}
|
|
400
401
|
}), t.observe(e), M(Math.round(Math.min(e.clientWidth, e.clientHeight)));
|
|
401
402
|
} catch {
|
|
402
403
|
M(Math.round(Math.min(e.clientWidth, e.clientHeight)));
|
|
403
404
|
}
|
|
404
405
|
return () => t?.disconnect();
|
|
405
|
-
}, [
|
|
406
|
-
const
|
|
407
|
-
if (!
|
|
408
|
-
const e =
|
|
409
|
-
|
|
410
|
-
},
|
|
411
|
-
const
|
|
412
|
-
let
|
|
413
|
-
for (; t.includes(
|
|
414
|
-
|
|
415
|
-
|
|
406
|
+
}, [p]);
|
|
407
|
+
const ie = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), re = () => {
|
|
408
|
+
if (!y) return;
|
|
409
|
+
const e = ie(ce[y]);
|
|
410
|
+
w(e), T(!0), O(!1), K(1), D(0), P([]), oe([]), se(e, [], !0);
|
|
411
|
+
}, se = (e = s, t = ge, l = !1) => {
|
|
412
|
+
const g = ie(e.length ? e : ce[y]);
|
|
413
|
+
let v = Math.floor(Math.random() * g.length), L = g[v].name, de = 0;
|
|
414
|
+
for (; t.includes(L) && de < 20; )
|
|
415
|
+
v = Math.floor(Math.random() * g.length), L = g[v].name, de++;
|
|
416
|
+
w(g), me(v), oe([...t, L]), q(!1), ee(""), X(20), B(null), l ? (E("ready"), Q(3), N(10)) : (E("memorize"), N(10));
|
|
416
417
|
};
|
|
417
|
-
|
|
418
|
-
if (!(!
|
|
419
|
-
if (
|
|
420
|
-
if (
|
|
418
|
+
F(() => {
|
|
419
|
+
if (!(!u || W || R)) {
|
|
420
|
+
if (b === "ready")
|
|
421
|
+
if (J <= 0) E("memorize");
|
|
421
422
|
else {
|
|
422
|
-
const e = setTimeout(() =>
|
|
423
|
+
const e = setTimeout(() => Q((t) => t - 1), 1e3);
|
|
423
424
|
return () => clearTimeout(e);
|
|
424
425
|
}
|
|
425
|
-
if (
|
|
426
|
-
if (
|
|
426
|
+
if (b === "memorize")
|
|
427
|
+
if (G <= 0) E("guess");
|
|
427
428
|
else {
|
|
428
|
-
const e = setTimeout(() =>
|
|
429
|
+
const e = setTimeout(() => N((t) => t - 1), 1e3);
|
|
429
430
|
return () => clearTimeout(e);
|
|
430
431
|
}
|
|
431
|
-
if (
|
|
432
|
-
if (
|
|
433
|
-
|
|
434
|
-
const t =
|
|
435
|
-
|
|
436
|
-
...
|
|
437
|
-
{ round:
|
|
432
|
+
if (b === "guess") {
|
|
433
|
+
if ($ <= 0) {
|
|
434
|
+
q(!0), B("wrong");
|
|
435
|
+
const t = s[C].name;
|
|
436
|
+
P((l) => [
|
|
437
|
+
...l,
|
|
438
|
+
{ round: z, answer: j, correct: t, result: "wrong" }
|
|
438
439
|
]);
|
|
439
440
|
return;
|
|
440
441
|
}
|
|
441
|
-
const e = setTimeout(() =>
|
|
442
|
+
const e = setTimeout(() => X((t) => t - 1), 1e3);
|
|
442
443
|
return () => clearTimeout(e);
|
|
443
444
|
}
|
|
444
445
|
}
|
|
445
|
-
}, [
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
448
|
-
const e =
|
|
449
|
-
let
|
|
450
|
-
t === e ? (
|
|
451
|
-
|
|
446
|
+
}, [b, J, G, $, u, W, R, s, C, z, j]);
|
|
447
|
+
const pe = () => {
|
|
448
|
+
if (C === null || Y) return;
|
|
449
|
+
const e = s[C].name, t = j.toLowerCase().trim();
|
|
450
|
+
let l = "wrong";
|
|
451
|
+
t === e ? (D((g) => g + 1), B("correct"), l = "correct") : He(t, e) === 1 ? (D((g) => g + 0.5), B("almost"), l = "almost") : (B("wrong"), l = "wrong"), P((g) => [...g, { round: z, answer: t, correct: e, result: l }]), te(!0), setTimeout(() => {
|
|
452
|
+
te(!1), q(!0);
|
|
452
453
|
}, 600);
|
|
453
|
-
}, ye = () =>
|
|
454
|
-
|
|
454
|
+
}, ye = () => z < x ? (K((e) => e + 1), se()) : O(!0), we = () => {
|
|
455
|
+
T(!1), O(!1), I(null);
|
|
455
456
|
}, be = Z(
|
|
456
|
-
() => /* @__PURE__ */
|
|
457
|
-
/* @__PURE__ */
|
|
457
|
+
() => /* @__PURE__ */ n("div", { style: { ...o.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ d("picture", { children: [
|
|
458
|
+
/* @__PURE__ */ n(
|
|
458
459
|
"source",
|
|
459
460
|
{
|
|
460
461
|
srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg",
|
|
461
462
|
type: "image/svg+xml"
|
|
462
463
|
}
|
|
463
464
|
),
|
|
464
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ n(
|
|
465
466
|
"img",
|
|
466
467
|
{
|
|
467
468
|
src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png",
|
|
468
469
|
alt: "SPEAKID Logo",
|
|
469
|
-
style:
|
|
470
|
+
style: o.gmLogoImg,
|
|
470
471
|
loading: "lazy"
|
|
471
472
|
}
|
|
472
473
|
)
|
|
473
474
|
] }) }),
|
|
474
475
|
[]
|
|
475
|
-
),
|
|
476
|
-
const e = r ?? (typeof window < "u" ? window.innerWidth :
|
|
477
|
-
return Math.min(1.35, Math.max(1,
|
|
478
|
-
}, [r,
|
|
479
|
-
return /* @__PURE__ */
|
|
480
|
-
/* @__PURE__ */
|
|
476
|
+
), le = 1200, ae = 700, xe = Z(() => {
|
|
477
|
+
const e = r ?? (typeof window < "u" ? window.innerWidth : le), t = h ?? (typeof window < "u" ? window.innerHeight : ae), l = Math.min(e / le, t / ae);
|
|
478
|
+
return Math.min(1.35, Math.max(1, l));
|
|
479
|
+
}, [r, h, p]);
|
|
480
|
+
return /* @__PURE__ */ n("div", { ref: i, style: { width: "100%", height: "100%" }, children: A && ze(
|
|
481
|
+
/* @__PURE__ */ n(
|
|
481
482
|
"div",
|
|
482
483
|
{
|
|
483
|
-
|
|
484
|
-
style: {
|
|
485
|
-
|
|
486
|
-
height: f ? "100%" : `${L}px`,
|
|
487
|
-
borderRadius: f ? 0 : "20px",
|
|
488
|
-
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
489
|
-
position: "relative",
|
|
490
|
-
overflow: "hidden",
|
|
491
|
-
boxShadow: f ? "none" : "0 0 40px rgba(0,0,0,0.08)",
|
|
492
|
-
display: "flex",
|
|
493
|
-
justifyContent: "center",
|
|
494
|
-
alignItems: "center"
|
|
495
|
-
},
|
|
496
|
-
children: /* @__PURE__ */ d(
|
|
484
|
+
id: "whats-missing-root",
|
|
485
|
+
style: { all: "unset" },
|
|
486
|
+
children: /* @__PURE__ */ n(
|
|
497
487
|
"div",
|
|
498
488
|
{
|
|
499
|
-
|
|
489
|
+
ref: f,
|
|
500
490
|
style: {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
491
|
+
width: p ? "100%" : `${k}px`,
|
|
492
|
+
height: p ? "100%" : `${k}px`,
|
|
493
|
+
borderRadius: p ? 0 : "20px",
|
|
494
|
+
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
495
|
+
position: "relative",
|
|
496
|
+
overflow: "hidden",
|
|
497
|
+
boxShadow: p ? "none" : "0 0 40px rgba(0,0,0,0.08)",
|
|
506
498
|
display: "flex",
|
|
507
|
-
flexDirection: "column",
|
|
508
499
|
justifyContent: "center",
|
|
509
500
|
alignItems: "center"
|
|
510
501
|
},
|
|
511
|
-
children:
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
},
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
"Theme selected: ",
|
|
536
|
-
w
|
|
537
|
-
] }),
|
|
538
|
-
/* @__PURE__ */ d("p", { style: n.gmBodyM, children: [
|
|
539
|
-
"Rounds: ",
|
|
540
|
-
s
|
|
541
|
-
] }),
|
|
542
|
-
/* @__PURE__ */ o("button", { style: n.gmButton, onClick: ie, children: "▶ Start game" })
|
|
543
|
-
] }),
|
|
544
|
-
E && /* @__PURE__ */ d("div", { style: n.gmCenterScreen, children: [
|
|
545
|
-
/* @__PURE__ */ o("h1", { style: n.gmHeadline1, children: "Results" }),
|
|
546
|
-
/* @__PURE__ */ d("h2", { style: n.gmHeadline3, children: [
|
|
547
|
-
"Your score: ",
|
|
548
|
-
ue,
|
|
549
|
-
" / ",
|
|
550
|
-
s
|
|
551
|
-
] }),
|
|
552
|
-
/* @__PURE__ */ o("p", { style: { ...n.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
|
|
553
|
-
/* @__PURE__ */ d("table", { style: n.gmTable, children: [
|
|
554
|
-
/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ d("tr", { children: [
|
|
555
|
-
/* @__PURE__ */ o("th", { children: "Round" }),
|
|
556
|
-
/* @__PURE__ */ o("th", { children: "Your Answer" }),
|
|
557
|
-
/* @__PURE__ */ o("th", { children: "Correct" }),
|
|
558
|
-
/* @__PURE__ */ o("th", { children: "Result" })
|
|
559
|
-
] }) }),
|
|
560
|
-
/* @__PURE__ */ o("tbody", { children: he.map((e, t) => /* @__PURE__ */ d("tr", { children: [
|
|
561
|
-
/* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.round }),
|
|
562
|
-
/* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.answer || "—" }),
|
|
563
|
-
/* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.correct }),
|
|
564
|
-
/* @__PURE__ */ o("td", { style: n.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
565
|
-
] }, t)) })
|
|
566
|
-
] }),
|
|
567
|
-
/* @__PURE__ */ d("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
|
|
568
|
-
/* @__PURE__ */ o("button", { style: n.gmButton, onClick: ie, children: "🔁 Play again" }),
|
|
569
|
-
/* @__PURE__ */ o("button", { style: n.gmButton, onClick: we, children: "⬅️ Choose theme" })
|
|
570
|
-
] })
|
|
571
|
-
] }),
|
|
572
|
-
x && !E && /* @__PURE__ */ d("div", { style: n.gmGameLayout, children: [
|
|
573
|
-
/* @__PURE__ */ d(
|
|
574
|
-
"div",
|
|
575
|
-
{
|
|
576
|
-
style: {
|
|
577
|
-
minHeight: 160,
|
|
578
|
-
display: "flex",
|
|
579
|
-
flexDirection: "column",
|
|
580
|
-
justifyContent: "center",
|
|
581
|
-
alignItems: "center"
|
|
582
|
-
},
|
|
583
|
-
children: [
|
|
584
|
-
v === "ready" && /* @__PURE__ */ d(xe, { children: [
|
|
585
|
-
/* @__PURE__ */ o("h1", { style: { ...n.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
|
|
586
|
-
/* @__PURE__ */ o("div", { style: n.gmHourglass, children: "⏳" })
|
|
587
|
-
] }),
|
|
588
|
-
v === "memorize" && /* @__PURE__ */ d("p", { style: { ...n.gmBodyM, color: "#10b981" }, children: [
|
|
589
|
-
"MEMORIZE (",
|
|
590
|
-
F,
|
|
591
|
-
")"
|
|
592
|
-
] }),
|
|
593
|
-
v === "guess" && !R && /* @__PURE__ */ d("p", { style: n.gmBodyM, children: [
|
|
594
|
-
"⏳ Time left: ",
|
|
595
|
-
G,
|
|
596
|
-
"s"
|
|
597
|
-
] })
|
|
598
|
-
]
|
|
599
|
-
}
|
|
600
|
-
),
|
|
601
|
-
v !== "ready" && /* @__PURE__ */ o(
|
|
602
|
-
"div",
|
|
603
|
-
{
|
|
604
|
-
style: {
|
|
605
|
-
...n.gmGrid,
|
|
606
|
-
display: "grid",
|
|
607
|
-
gridTemplateColumns: `repeat(${f ? 2 : 3}, 1fr)`,
|
|
608
|
-
gridTemplateRows: `repeat(${f ? 3 : 2}, 1fr)`,
|
|
609
|
-
gap: f ? 12 : 20,
|
|
610
|
-
justifyContent: "center",
|
|
611
|
-
alignContent: "center",
|
|
612
|
-
padding: f ? 8 : 16,
|
|
613
|
-
width: "100%",
|
|
614
|
-
height: "100%",
|
|
615
|
-
maxWidth: f ? "100%" : 600,
|
|
616
|
-
maxHeight: f ? "100%" : 400,
|
|
617
|
-
boxSizing: "border-box"
|
|
618
|
-
},
|
|
619
|
-
children: b.map((e, t) => {
|
|
620
|
-
const a = y === t && v === "guess" && !R;
|
|
621
|
-
return /* @__PURE__ */ o(
|
|
622
|
-
"div",
|
|
502
|
+
children: /* @__PURE__ */ d(
|
|
503
|
+
"div",
|
|
504
|
+
{
|
|
505
|
+
style: {
|
|
506
|
+
transform: `scale(${xe})`,
|
|
507
|
+
transformOrigin: "center center",
|
|
508
|
+
transition: "transform 0.2s ease-out",
|
|
509
|
+
width: "100%",
|
|
510
|
+
height: "100%",
|
|
511
|
+
display: "flex",
|
|
512
|
+
flexDirection: "column",
|
|
513
|
+
justifyContent: "center",
|
|
514
|
+
alignItems: "center"
|
|
515
|
+
},
|
|
516
|
+
children: [
|
|
517
|
+
!p && be,
|
|
518
|
+
!y && !u && /* @__PURE__ */ d("div", { style: o.gmCenterScreen, children: [
|
|
519
|
+
/* @__PURE__ */ n("h1", { style: o.gmHeadline1, children: "WHAT'S MISSING?" }),
|
|
520
|
+
/* @__PURE__ */ n("p", { style: o.gmBodyM, children: "Select a theme:" }),
|
|
521
|
+
/* @__PURE__ */ n("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ n("button", { style: o.gmButton, onClick: () => I(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
|
|
522
|
+
/* @__PURE__ */ d("div", { style: { marginTop: 24 }, children: [
|
|
523
|
+
/* @__PURE__ */ n("p", { style: o.gmBodyS, children: "Choose number of rounds:" }),
|
|
524
|
+
/* @__PURE__ */ n("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ n(
|
|
525
|
+
"button",
|
|
623
526
|
{
|
|
624
527
|
style: {
|
|
625
|
-
...
|
|
626
|
-
|
|
627
|
-
height: "100%",
|
|
628
|
-
...te === "correct" && y === t ? n.gmCorrect : {},
|
|
629
|
-
...te === "wrong" && y === t ? n.gmWrong : {}
|
|
528
|
+
...o.gmButton,
|
|
529
|
+
...x === e ? o.gmButtonActive : {}
|
|
630
530
|
},
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
{
|
|
634
|
-
src: e.src,
|
|
635
|
-
alt: e.name,
|
|
636
|
-
style: {
|
|
637
|
-
width: "100%",
|
|
638
|
-
height: "100%",
|
|
639
|
-
objectFit: "cover",
|
|
640
|
-
display: "block"
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
)
|
|
531
|
+
onClick: () => S(e),
|
|
532
|
+
children: e
|
|
644
533
|
},
|
|
645
|
-
|
|
646
|
-
)
|
|
647
|
-
})
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
534
|
+
e
|
|
535
|
+
)) })
|
|
536
|
+
] })
|
|
537
|
+
] }),
|
|
538
|
+
y && !u && /* @__PURE__ */ d("div", { style: o.gmCenterScreen, children: [
|
|
539
|
+
/* @__PURE__ */ d("h1", { style: o.gmHeadline1, children: [
|
|
540
|
+
"Theme selected: ",
|
|
541
|
+
y
|
|
542
|
+
] }),
|
|
543
|
+
/* @__PURE__ */ d("p", { style: o.gmBodyM, children: [
|
|
544
|
+
"Rounds: ",
|
|
545
|
+
x
|
|
546
|
+
] }),
|
|
547
|
+
/* @__PURE__ */ n("button", { style: o.gmButton, onClick: re, children: "▶ Start game" })
|
|
548
|
+
] }),
|
|
549
|
+
W && /* @__PURE__ */ d("div", { style: o.gmCenterScreen, children: [
|
|
550
|
+
/* @__PURE__ */ n("h1", { style: o.gmHeadline1, children: "Results" }),
|
|
551
|
+
/* @__PURE__ */ d("h2", { style: o.gmHeadline3, children: [
|
|
552
|
+
"Your score: ",
|
|
553
|
+
he,
|
|
554
|
+
" / ",
|
|
555
|
+
x
|
|
556
|
+
] }),
|
|
557
|
+
/* @__PURE__ */ n("p", { style: { ...o.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
|
|
558
|
+
/* @__PURE__ */ d("table", { style: o.gmTable, children: [
|
|
559
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ d("tr", { children: [
|
|
560
|
+
/* @__PURE__ */ n("th", { children: "Round" }),
|
|
561
|
+
/* @__PURE__ */ n("th", { children: "Your Answer" }),
|
|
562
|
+
/* @__PURE__ */ n("th", { children: "Correct" }),
|
|
563
|
+
/* @__PURE__ */ n("th", { children: "Result" })
|
|
564
|
+
] }) }),
|
|
565
|
+
/* @__PURE__ */ n("tbody", { children: ue.map((e, t) => /* @__PURE__ */ d("tr", { children: [
|
|
566
|
+
/* @__PURE__ */ n("td", { style: o.gmTableCell, children: e.round }),
|
|
567
|
+
/* @__PURE__ */ n("td", { style: o.gmTableCell, children: e.answer || "—" }),
|
|
568
|
+
/* @__PURE__ */ n("td", { style: o.gmTableCell, children: e.correct }),
|
|
569
|
+
/* @__PURE__ */ n("td", { style: o.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
570
|
+
] }, t)) })
|
|
571
|
+
] }),
|
|
572
|
+
/* @__PURE__ */ d("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
|
|
573
|
+
/* @__PURE__ */ n("button", { style: o.gmButton, onClick: re, children: "🔁 Play again" }),
|
|
574
|
+
/* @__PURE__ */ n("button", { style: o.gmButton, onClick: we, children: "⬅️ Choose theme" })
|
|
575
|
+
] })
|
|
576
|
+
] }),
|
|
577
|
+
u && !W && /* @__PURE__ */ d("div", { style: o.gmGameLayout, children: [
|
|
578
|
+
/* @__PURE__ */ d(
|
|
579
|
+
"div",
|
|
654
580
|
{
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
581
|
+
style: {
|
|
582
|
+
minHeight: 160,
|
|
583
|
+
display: "flex",
|
|
584
|
+
flexDirection: "column",
|
|
585
|
+
justifyContent: "center",
|
|
586
|
+
alignItems: "center"
|
|
587
|
+
},
|
|
588
|
+
children: [
|
|
589
|
+
b === "ready" && /* @__PURE__ */ d(ve, { children: [
|
|
590
|
+
/* @__PURE__ */ n("h1", { style: { ...o.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
|
|
591
|
+
/* @__PURE__ */ n("div", { style: o.gmHourglass, children: "⏳" })
|
|
592
|
+
] }),
|
|
593
|
+
b === "memorize" && /* @__PURE__ */ d("p", { style: { ...o.gmBodyM, color: "#10b981" }, children: [
|
|
594
|
+
"MEMORIZE (",
|
|
595
|
+
G,
|
|
596
|
+
")"
|
|
597
|
+
] }),
|
|
598
|
+
b === "guess" && !R && /* @__PURE__ */ d("p", { style: o.gmBodyM, children: [
|
|
599
|
+
"⏳ Time left: ",
|
|
600
|
+
$,
|
|
601
|
+
"s"
|
|
602
|
+
] })
|
|
603
|
+
]
|
|
660
604
|
}
|
|
661
605
|
),
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
"
|
|
606
|
+
b !== "ready" && /* @__PURE__ */ n(
|
|
607
|
+
"div",
|
|
664
608
|
{
|
|
665
|
-
style: {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
609
|
+
style: {
|
|
610
|
+
...o.gmGrid,
|
|
611
|
+
display: "grid",
|
|
612
|
+
gridTemplateColumns: `repeat(${p ? 2 : 3}, 1fr)`,
|
|
613
|
+
gridTemplateRows: `repeat(${p ? 3 : 2}, 1fr)`,
|
|
614
|
+
gap: p ? 12 : 20,
|
|
615
|
+
justifyContent: "center",
|
|
616
|
+
alignContent: "center",
|
|
617
|
+
padding: p ? 8 : 16,
|
|
618
|
+
width: "100%",
|
|
619
|
+
height: "100%",
|
|
620
|
+
maxWidth: p ? "100%" : 600,
|
|
621
|
+
maxHeight: p ? "100%" : 400,
|
|
622
|
+
boxSizing: "border-box"
|
|
623
|
+
},
|
|
624
|
+
children: s.map((e, t) => {
|
|
625
|
+
const l = C === t && b === "guess" && !R;
|
|
626
|
+
return /* @__PURE__ */ n(
|
|
627
|
+
"div",
|
|
628
|
+
{
|
|
629
|
+
style: {
|
|
630
|
+
...o.gmCard,
|
|
631
|
+
width: "100%",
|
|
632
|
+
height: "100%",
|
|
633
|
+
...ne === "correct" && C === t ? o.gmCorrect : {},
|
|
634
|
+
...ne === "wrong" && C === t ? o.gmWrong : {}
|
|
635
|
+
},
|
|
636
|
+
children: !l && /* @__PURE__ */ n(
|
|
637
|
+
"img",
|
|
638
|
+
{
|
|
639
|
+
src: e.src,
|
|
640
|
+
alt: e.name,
|
|
641
|
+
style: {
|
|
642
|
+
width: "100%",
|
|
643
|
+
height: "100%",
|
|
644
|
+
objectFit: "cover",
|
|
645
|
+
display: "block"
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
)
|
|
649
|
+
},
|
|
650
|
+
t
|
|
651
|
+
);
|
|
652
|
+
})
|
|
669
653
|
}
|
|
670
|
-
)
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
654
|
+
),
|
|
655
|
+
/* @__PURE__ */ d("div", { style: { marginTop: 16, height: 80 }, children: [
|
|
656
|
+
b === "guess" && !R && /* @__PURE__ */ d("div", { children: [
|
|
657
|
+
/* @__PURE__ */ n(
|
|
658
|
+
"input",
|
|
659
|
+
{
|
|
660
|
+
type: "text",
|
|
661
|
+
placeholder: "Type the missing word",
|
|
662
|
+
value: j,
|
|
663
|
+
onChange: (e) => ee(e.target.value),
|
|
664
|
+
style: o.gmInput
|
|
665
|
+
}
|
|
666
|
+
),
|
|
667
|
+
/* @__PURE__ */ n(
|
|
668
|
+
"button",
|
|
669
|
+
{
|
|
670
|
+
style: { ...o.gmButton, marginLeft: 8 },
|
|
671
|
+
onClick: pe,
|
|
672
|
+
disabled: Y,
|
|
673
|
+
children: Y ? "..." : "Check"
|
|
674
|
+
}
|
|
675
|
+
)
|
|
676
|
+
] }),
|
|
677
|
+
R && /* @__PURE__ */ n("button", { type: "button", style: o.gmButton, onClick: ye, children: "Next round" })
|
|
678
|
+
] })
|
|
679
|
+
] })
|
|
680
|
+
]
|
|
681
|
+
}
|
|
682
|
+
)
|
|
676
683
|
}
|
|
677
684
|
)
|
|
678
685
|
}
|
|
679
686
|
),
|
|
680
|
-
|
|
687
|
+
A
|
|
681
688
|
) });
|
|
682
689
|
}
|
|
683
690
|
export {
|
|
684
|
-
|
|
691
|
+
Ee as Game,
|
|
685
692
|
ce as themes
|
|
686
693
|
};
|
package/package.json
CHANGED
package/src/Game.tsx
CHANGED
|
@@ -151,77 +151,74 @@ export default function Game({
|
|
|
151
151
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
152
152
|
const squareRef = useRef<HTMLDivElement | null>(null);
|
|
153
153
|
const [squareSize, setSquareSize] = useState<number | null>(null);
|
|
154
|
+
const [shadowRoot, setShadowRoot] = useState<ShadowRoot | null>(null);
|
|
154
155
|
useNeutralizeBodyZoom(containerRef, { minDesktopWidth: 1024, forceResize: false });
|
|
155
156
|
|
|
156
|
-
// ✅ Shadow DOM изоляция
|
|
157
|
+
// ✅ Shadow DOM изоляция - создаем сначала, потом рендерим
|
|
157
158
|
useLayoutEffect(() => {
|
|
158
159
|
const container = containerRef.current;
|
|
159
160
|
if (!container) return;
|
|
160
161
|
|
|
161
162
|
// Создаем Shadow DOM если его нет
|
|
162
|
-
let
|
|
163
|
-
if (!
|
|
164
|
-
|
|
163
|
+
let root = container.shadowRoot;
|
|
164
|
+
if (!root) {
|
|
165
|
+
root = container.attachShadow({ mode: 'open' });
|
|
165
166
|
}
|
|
166
167
|
|
|
167
168
|
// Очищаем содержимое shadow root
|
|
168
|
-
|
|
169
|
+
root.innerHTML = '';
|
|
169
170
|
|
|
170
171
|
// Создаем стили для изоляции
|
|
171
172
|
const style = document.createElement('style');
|
|
172
173
|
style.textContent = `
|
|
173
174
|
:host {
|
|
174
|
-
position: fixed
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
175
|
+
position: fixed;
|
|
176
|
+
inset: 0;
|
|
177
|
+
width: 100vw;
|
|
178
|
+
height: 100vh;
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
align-items: center;
|
|
182
|
+
background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
|
|
183
|
+
z-index: 100;
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
margin: 0;
|
|
186
|
+
padding: 0;
|
|
187
|
+
transform: none;
|
|
188
|
+
zoom: 1;
|
|
189
|
+
scale: 1;
|
|
187
190
|
}
|
|
188
191
|
|
|
189
192
|
#whats-missing-root, #whats-missing-root * {
|
|
190
|
-
box-sizing: border-box
|
|
193
|
+
box-sizing: border-box;
|
|
191
194
|
}
|
|
192
195
|
|
|
193
196
|
#whats-missing-root img {
|
|
194
|
-
max-width: 100
|
|
195
|
-
height: auto
|
|
196
|
-
display: block
|
|
197
|
-
user-select: none
|
|
197
|
+
max-width: 100%;
|
|
198
|
+
height: auto;
|
|
199
|
+
display: block;
|
|
200
|
+
user-select: none;
|
|
198
201
|
}
|
|
199
202
|
|
|
200
203
|
#whats-missing-root {
|
|
201
|
-
position: relative
|
|
202
|
-
width: 100
|
|
203
|
-
height: 100
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
204
|
+
position: relative;
|
|
205
|
+
width: 100%;
|
|
206
|
+
height: 100%;
|
|
207
|
+
max-width: 1200px;
|
|
208
|
+
display: flex;
|
|
209
|
+
justify-content: center;
|
|
210
|
+
align-items: center;
|
|
211
|
+
transform: none;
|
|
212
|
+
zoom: 1;
|
|
213
|
+
scale: 1;
|
|
210
214
|
}
|
|
211
215
|
`;
|
|
212
216
|
|
|
213
|
-
//
|
|
214
|
-
|
|
215
|
-
gameContainer.id = 'whats-missing-root';
|
|
217
|
+
// Добавляем стили в shadow root
|
|
218
|
+
root.appendChild(style);
|
|
216
219
|
|
|
217
|
-
//
|
|
218
|
-
|
|
219
|
-
shadowRoot.appendChild(gameContainer);
|
|
220
|
-
|
|
221
|
-
// Обновляем squareRef чтобы он указывал на контейнер внутри shadow root
|
|
222
|
-
if (squareRef.current !== gameContainer) {
|
|
223
|
-
squareRef.current = gameContainer;
|
|
224
|
-
}
|
|
220
|
+
// Устанавливаем shadow root для рендера
|
|
221
|
+
setShadowRoot(root);
|
|
225
222
|
}, []);
|
|
226
223
|
|
|
227
224
|
useEffect(() => {
|
|
@@ -466,45 +463,45 @@ export default function Game({
|
|
|
466
463
|
return Math.min(1.35, Math.max(1.0, rawScale));
|
|
467
464
|
}, [screenWidth, screenHeight, isMobile]);
|
|
468
465
|
|
|
469
|
-
// Получаем контейнер внутри Shadow DOM для рендера
|
|
470
|
-
const shadowContainer = squareRef.current;
|
|
471
|
-
|
|
472
466
|
return (
|
|
473
|
-
<div ref={containerRef}>
|
|
474
|
-
{
|
|
467
|
+
<div ref={containerRef} style={{ width: "100%", height: "100%" }}>
|
|
468
|
+
{shadowRoot && createPortal(
|
|
475
469
|
<div
|
|
476
|
-
|
|
477
|
-
style={{
|
|
478
|
-
width: isMobile
|
|
479
|
-
? "100%"
|
|
480
|
-
: `${effectiveGameCubeSize}px`,
|
|
481
|
-
height: isMobile
|
|
482
|
-
? "100%"
|
|
483
|
-
: `${effectiveGameCubeSize}px`,
|
|
484
|
-
borderRadius: isMobile ? 0 : "20px",
|
|
485
|
-
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
486
|
-
position: "relative",
|
|
487
|
-
overflow: "hidden",
|
|
488
|
-
boxShadow: isMobile ? "none" : "0 0 40px rgba(0,0,0,0.08)",
|
|
489
|
-
display: "flex",
|
|
490
|
-
justifyContent: "center",
|
|
491
|
-
alignItems: "center",
|
|
492
|
-
}}
|
|
470
|
+
id="whats-missing-root"
|
|
471
|
+
style={{ all: "unset" }}
|
|
493
472
|
>
|
|
494
473
|
<div
|
|
495
|
-
|
|
474
|
+
ref={squareRef}
|
|
496
475
|
style={{
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
476
|
+
width: isMobile
|
|
477
|
+
? "100%"
|
|
478
|
+
: `${effectiveGameCubeSize}px`,
|
|
479
|
+
height: isMobile
|
|
480
|
+
? "100%"
|
|
481
|
+
: `${effectiveGameCubeSize}px`,
|
|
482
|
+
borderRadius: isMobile ? 0 : "20px",
|
|
483
|
+
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
484
|
+
position: "relative",
|
|
485
|
+
overflow: "hidden",
|
|
486
|
+
boxShadow: isMobile ? "none" : "0 0 40px rgba(0,0,0,0.08)",
|
|
502
487
|
display: "flex",
|
|
503
|
-
flexDirection: "column",
|
|
504
488
|
justifyContent: "center",
|
|
505
489
|
alignItems: "center",
|
|
506
490
|
}}
|
|
507
491
|
>
|
|
492
|
+
<div
|
|
493
|
+
style={{
|
|
494
|
+
transform: `scale(${scale})`,
|
|
495
|
+
transformOrigin: "center center",
|
|
496
|
+
transition: "transform 0.2s ease-out",
|
|
497
|
+
width: "100%",
|
|
498
|
+
height: "100%",
|
|
499
|
+
display: "flex",
|
|
500
|
+
flexDirection: "column",
|
|
501
|
+
justifyContent: "center",
|
|
502
|
+
alignItems: "center",
|
|
503
|
+
}}
|
|
504
|
+
>
|
|
508
505
|
{!isMobile && MemoizedLogo}
|
|
509
506
|
|
|
510
507
|
{/* ====== ЛОББИ ====== */}
|
|
@@ -703,9 +700,10 @@ export default function Game({
|
|
|
703
700
|
</div>
|
|
704
701
|
</div>
|
|
705
702
|
)}
|
|
703
|
+
</div>
|
|
706
704
|
</div>
|
|
707
705
|
</div>,
|
|
708
|
-
|
|
706
|
+
shadowRoot
|
|
709
707
|
)}
|
|
710
708
|
</div>
|
|
711
709
|
);
|