@mblinkov/whats-missing 20.0.8 → 20.0.11

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.
@@ -1,28 +1,38 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),oe=window.origin+"/cloud/speakid/games/whatsmissing/",M=(r,c)=>r.map(([a,o])=>({src:`${oe}${c}/${o.replace(/\s/g,"%20")}.png`,name:o})),ne=[["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"]],re=[["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"]],ie=[["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"]],B={food:M(ne,"food"),animals:M(re,"animals"),toys:M(ie,"toys")},ae=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),se=window.origin+"/cloud/speakid/games/whatsmissing/",H=(r,c)=>r.map(([a,s])=>({src:`${se}${c}/${s.replace(/\s/g,"%20")}.png`,name:s})),ne=[["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"]],re=[["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"]],ie=[["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"]],B={food:H(ne,"food"),animals:H(re,"animals"),toys:H(ie,"toys")},ae=`
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 r=document.createElement("style");r.id="spin-keyframes",r.innerHTML=ae,document.head.appendChild(r)}const le={animation:"spin 1.4s linear infinite"},s={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100vh",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:"600px",minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"calc(210px * 3 + 20px * 2)",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",...le}},de=()=>{const r=document.createElement("style");r.textContent=`
6
+ `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const r=document.createElement("style");r.id="spin-keyframes",r.innerHTML=ae,document.head.appendChild(r)}const le={animation:"spin 1.4s linear infinite"},o={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100vh",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:"600px",minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"calc(210px * 3 + 20px * 2)",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",...le}},de=()=>{const r=document.createElement("style");r.textContent=`
7
7
  html, body {
8
8
  margin: 0;
9
9
  padding: 0;
10
10
  width: 100%;
11
11
  height: 100%;
12
- background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%) !important;
12
+ overflow-x: hidden;
13
+ overflow-y: hidden;
14
+ background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
15
+ background-repeat: no-repeat;
16
+ background-attachment: fixed;
17
+ background-size: cover;
13
18
  }
14
19
 
15
20
  #whats-missing-root {
16
21
  all: unset;
17
- display: block;
22
+ display: flex;
23
+ flex-direction: column;
24
+ justify-content: center;
25
+ align-items: center;
26
+ position: fixed;
27
+ inset: 0;
18
28
  width: 100vw;
19
- min-height: 100vh;
29
+ height: 100vh;
20
30
  margin: 0;
21
31
  padding: 0;
22
- background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
23
- background-attachment: fixed;
24
32
  color: #1f2937;
25
33
  text-align: center;
34
+ background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
35
+ background-size: cover;
26
36
  }
27
37
 
28
38
  #whats-missing-root, #whats-missing-root * {
@@ -41,4 +51,4 @@
41
51
  from { transform: rotate(0deg); }
42
52
  to { transform: rotate(360deg); }
43
53
  }
44
- `,document.head.appendChild(r)},ce=(r,c)=>{const a=Array.from({length:r.length+1},()=>Array(c.length+1).fill(0));for(let o=0;o<=r.length;o++)a[o][0]=o;for(let o=0;o<=c.length;o++)a[0][o]=o;for(let o=1;o<=r.length;o++)for(let l=1;l<=c.length;l++)a[o][l]=r[o-1]===c[l-1]?a[o-1][l-1]:Math.min(a[o-1][l-1],a[o][l-1],a[o-1][l])+1;return a[r.length][c.length]};function me(){n.useEffect(()=>{de()},[]);const[r,c]=n.useState(null),[a,o]=n.useState([]),[l,_]=n.useState(4),[h,L]=n.useState(!1),[x,W]=n.useState(1),[u,$]=n.useState(null),[m,y]=n.useState("ready"),[E,G]=n.useState(3),[k,C]=n.useState(7),[v,F]=n.useState(20),[K,T]=n.useState(0),[b,z]=n.useState(!1),[w,D]=n.useState(""),[p,R]=n.useState(!1),[I,q]=n.useState(!1),[P,f]=n.useState(null),[Z,A]=n.useState([]),[J,U]=n.useState([]),[j,Q]=n.useState(!1);n.useEffect(()=>{const t=()=>Q(window.innerWidth<768);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const Y=t=>[...t].sort(()=>Math.random()-.5).slice(0,6),N=()=>{if(!r)return;const t=Y(B[r]);o(t),L(!0),z(!1),W(1),T(0),A([]),U([]),O(t,[],!0)},O=(t=a,i=J,g=!1)=>{const d=Y(t.length?t:B[r]);let S=Math.floor(Math.random()*d.length),H=d[S].name,V=0;for(;i.includes(H)&&V<20;)S=Math.floor(Math.random()*d.length),H=d[S].name,V++;o(d),$(S),U([...i,H]),R(!1),D(""),F(20),f(null),g?(y("ready"),G(3),C(7)):(y("memorize"),C(7))};n.useEffect(()=>{if(!(!h||b||p)){if(m==="ready")if(E<=0)y("memorize");else{const t=setTimeout(()=>G(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="memorize")if(k<=0)y("guess");else{const t=setTimeout(()=>C(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="guess"){if(v<=0){R(!0),f("wrong");const i=a[u].name;A(g=>[...g,{round:x,answer:w,correct:i,result:"wrong"}]);return}const t=setTimeout(()=>F(i=>i-1),1e3);return()=>clearTimeout(t)}}},[m,E,k,v,h,b,p,a,u,x,w]);const X=()=>{if(u===null||I)return;const t=a[u].name,i=w.toLowerCase().trim();let g="wrong";i===t?(T(d=>d+1),f("correct"),g="correct"):ce(i,t)===1?(T(d=>d+.5),f("almost"),g="almost"):(f("wrong"),g="wrong"),A(d=>[...d,{round:x,answer:i,correct:t,result:g}]),q(!0),setTimeout(()=>{q(!1),R(!0)},600)},ee=()=>x<l?(W(t=>t+1),O()):z(!0),te=()=>{L(!1),z(!1),c(null)},se=n.useMemo(()=>e.jsx("div",{style:s.gmLogoFixed,children:e.jsxs("picture",{children:[e.jsx("source",{srcSet:window.origin+"/cloud/speakid/games/whatsmissing/logo.svg",type:"image/svg+xml"}),e.jsx("img",{src:window.origin+"/cloud/speakid/games/whatsmissing/logo.png",alt:"SPEAKID Logo",style:s.gmLogoImg,loading:"lazy"})]})}),[]);return e.jsxs("div",{id:"whats-missing-root",children:[!j&&se,!r&&!h&&e.jsxs("div",{style:s.gmCenterScreen,children:[e.jsx("h1",{style:s.gmHeadline1,children:"WHAT'S MISSING?"}),e.jsx("p",{style:s.gmBodyM,children:"Select a theme:"}),e.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(t=>e.jsx("button",{style:s.gmButton,onClick:()=>c(t),children:t==="animals"?"🐶 Animals":t==="food"?"🍎 Food":"🧸 Toys"},t))}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx("p",{style:s.gmBodyS,children:"Choose number of rounds:"}),e.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(t=>e.jsx("button",{style:{...s.gmButton,...l===t?s.gmButtonActive:{}},onClick:()=>_(t),children:t},t))})]})]}),r&&!h&&e.jsxs("div",{style:s.gmCenterScreen,children:[e.jsxs("h1",{style:s.gmHeadline1,children:["Theme selected: ",r]}),e.jsxs("p",{style:s.gmBodyM,children:["Rounds: ",l]}),e.jsx("button",{style:s.gmButton,onClick:N,children:"▶ Start game"})]}),b&&e.jsxs("div",{style:s.gmCenterScreen,children:[e.jsx("h1",{style:s.gmHeadline1,children:"Results"}),e.jsxs("h2",{style:s.gmHeadline3,children:["Your score: ",K," / ",l]}),e.jsxs("table",{style:s.gmTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Round"}),e.jsx("th",{children:"Your Answer"}),e.jsx("th",{children:"Correct"}),e.jsx("th",{children:"Result"})]})}),e.jsx("tbody",{children:Z.map((t,i)=>e.jsxs("tr",{children:[e.jsx("td",{style:s.gmTableCell,children:t.round}),e.jsx("td",{style:s.gmTableCell,children:t.answer||"—"}),e.jsx("td",{style:s.gmTableCell,children:t.correct}),e.jsx("td",{style:s.gmTableCell,children:t.result==="correct"?"✔ Correct":t.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},i))})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[e.jsx("button",{style:s.gmButton,onClick:N,children:"🔁 Play again"}),e.jsx("button",{style:s.gmButton,onClick:te,children:"⬅️ Choose theme"})]})]}),h&&!b&&e.jsxs("div",{style:s.gmGameLayout,children:[e.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[m==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{style:{...s.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),e.jsx("div",{style:s.gmHourglass,children:"⏳"})]}),m==="memorize"&&e.jsxs("p",{style:{...s.gmBodyM,color:"#10b981"},children:["MEMORIZE (",k,")"]}),m==="guess"&&!p&&e.jsxs("p",{style:s.gmBodyM,children:["⏳ Time left: ",v,"s"]})]}),m!=="ready"&&e.jsx("div",{style:{...s.gmGrid,gridTemplateColumns:j?"repeat(2, 1fr)":"repeat(3, 210px)",gridAutoRows:j?"150px":"210px",gap:j?"12px":"20px",justifyItems:"center",...window.innerWidth>2e3?{gridTemplateColumns:"repeat(3, 260px)",gridAutoRows:"260px",gap:"28px"}:{},...window.innerWidth>2560?{gridTemplateColumns:"repeat(3, 300px)",gridAutoRows:"300px",gap:"32px"}:{}},children:a.map((t,i)=>{const g=u===i&&m==="guess"&&!p;return e.jsx("div",{style:{...s.gmCard,...P==="correct"&&u===i?s.gmCorrect:{},...P==="wrong"&&u===i?s.gmWrong:{}},children:!g&&e.jsx("img",{src:t.src,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"}})},i)})}),e.jsxs("div",{style:{marginTop:16,height:80},children:[m==="guess"&&!p&&e.jsxs("div",{children:[e.jsx("input",{type:"text",placeholder:"Type the missing word",value:w,onChange:t=>D(t.target.value),style:s.gmInput}),e.jsx("button",{style:{...s.gmButton,marginLeft:8},onClick:X,disabled:I,children:I?"...":"Check"})]}),p&&e.jsx("button",{style:s.gmButton,onClick:ee,children:"Next round"})]})]})]})}exports.Game=me;exports.themes=B;
54
+ `,document.head.appendChild(r)},ce=(r,c)=>{const a=Array.from({length:r.length+1},()=>Array(c.length+1).fill(0));for(let s=0;s<=r.length;s++)a[s][0]=s;for(let s=0;s<=c.length;s++)a[0][s]=s;for(let s=1;s<=r.length;s++)for(let l=1;l<=c.length;l++)a[s][l]=r[s-1]===c[l-1]?a[s-1][l-1]:Math.min(a[s-1][l-1],a[s][l-1],a[s-1][l])+1;return a[r.length][c.length]};function me(){n.useEffect(()=>{de()},[]);const[r,c]=n.useState(null),[a,s]=n.useState([]),[l,_]=n.useState(4),[h,L]=n.useState(!1),[x,W]=n.useState(1),[u,$]=n.useState(null),[m,y]=n.useState("ready"),[E,G]=n.useState(3),[k,v]=n.useState(10),[C,F]=n.useState(20),[K,T]=n.useState(0),[b,z]=n.useState(!1),[w,Y]=n.useState(""),[p,R]=n.useState(!1),[I,D]=n.useState(!1),[q,f]=n.useState(null),[Z,A]=n.useState([]),[J,P]=n.useState([]),[j,Q]=n.useState(!1);n.useEffect(()=>{const t=()=>Q(window.innerWidth<768);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const U=t=>[...t].sort(()=>Math.random()-.5).slice(0,6),N=()=>{if(!r)return;const t=U(B[r]);s(t),L(!0),z(!1),W(1),T(0),A([]),P([]),O(t,[],!0)},O=(t=a,i=J,g=!1)=>{const d=U(t.length?t:B[r]);let S=Math.floor(Math.random()*d.length),M=d[S].name,V=0;for(;i.includes(M)&&V<20;)S=Math.floor(Math.random()*d.length),M=d[S].name,V++;s(d),$(S),P([...i,M]),R(!1),Y(""),F(20),f(null),g?(y("ready"),G(3),v(10)):(y("memorize"),v(10))};n.useEffect(()=>{if(!(!h||b||p)){if(m==="ready")if(E<=0)y("memorize");else{const t=setTimeout(()=>G(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="memorize")if(k<=0)y("guess");else{const t=setTimeout(()=>v(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="guess"){if(C<=0){R(!0),f("wrong");const i=a[u].name;A(g=>[...g,{round:x,answer:w,correct:i,result:"wrong"}]);return}const t=setTimeout(()=>F(i=>i-1),1e3);return()=>clearTimeout(t)}}},[m,E,k,C,h,b,p,a,u,x,w]);const X=()=>{if(u===null||I)return;const t=a[u].name,i=w.toLowerCase().trim();let g="wrong";i===t?(T(d=>d+1),f("correct"),g="correct"):ce(i,t)===1?(T(d=>d+.5),f("almost"),g="almost"):(f("wrong"),g="wrong"),A(d=>[...d,{round:x,answer:i,correct:t,result:g}]),D(!0),setTimeout(()=>{D(!1),R(!0)},600)},ee=()=>x<l?(W(t=>t+1),O()):z(!0),te=()=>{L(!1),z(!1),c(null)},oe=n.useMemo(()=>e.jsx("div",{style:o.gmLogoFixed,children:e.jsxs("picture",{children:[e.jsx("source",{srcSet:window.origin+"/cloud/speakid/games/whatsmissing/logo.svg",type:"image/svg+xml"}),e.jsx("img",{src:window.origin+"/cloud/speakid/games/whatsmissing/logo.png",alt:"SPEAKID Logo",style:o.gmLogoImg,loading:"lazy"})]})}),[]);return e.jsxs("div",{id:"whats-missing-root",children:[!j&&oe,!r&&!h&&e.jsxs("div",{style:o.gmCenterScreen,children:[e.jsx("h1",{style:o.gmHeadline1,children:"WHAT'S MISSING?"}),e.jsx("p",{style:o.gmBodyM,children:"Select a theme:"}),e.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(t=>e.jsx("button",{style:o.gmButton,onClick:()=>c(t),children:t==="animals"?"🐶 Animals":t==="food"?"🍎 Food":"🧸 Toys"},t))}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx("p",{style:o.gmBodyS,children:"Choose number of rounds:"}),e.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(t=>e.jsx("button",{style:{...o.gmButton,...l===t?o.gmButtonActive:{}},onClick:()=>_(t),children:t},t))})]})]}),r&&!h&&e.jsxs("div",{style:o.gmCenterScreen,children:[e.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",r]}),e.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",l]}),e.jsx("button",{style:o.gmButton,onClick:N,children:"▶ Start game"})]}),b&&e.jsxs("div",{style:o.gmCenterScreen,children:[e.jsx("h1",{style:o.gmHeadline1,children:"Results"}),e.jsxs("h2",{style:o.gmHeadline3,children:["Your score: ",K," / ",l]}),e.jsx("p",{style:{...o.gmBodyM,color:"#10b981",marginTop:12},children:"Yahoo! You did it! 🍬✨"}),e.jsxs("table",{style:o.gmTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Round"}),e.jsx("th",{children:"Your Answer"}),e.jsx("th",{children:"Correct"}),e.jsx("th",{children:"Result"})]})}),e.jsx("tbody",{children:Z.map((t,i)=>e.jsxs("tr",{children:[e.jsx("td",{style:o.gmTableCell,children:t.round}),e.jsx("td",{style:o.gmTableCell,children:t.answer||"—"}),e.jsx("td",{style:o.gmTableCell,children:t.correct}),e.jsx("td",{style:o.gmTableCell,children:t.result==="correct"?"✔ Correct":t.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},i))})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[e.jsx("button",{style:o.gmButton,onClick:N,children:"🔁 Play again"}),e.jsx("button",{style:o.gmButton,onClick:te,children:"⬅️ Choose theme"})]})]}),h&&!b&&e.jsxs("div",{style:o.gmGameLayout,children:[e.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[m==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),e.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),m==="memorize"&&e.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",k,")"]}),m==="guess"&&!p&&e.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",C,"s"]})]}),m!=="ready"&&e.jsx("div",{style:{...o.gmGrid,gridTemplateColumns:j?"repeat(2, 1fr)":"repeat(3, 210px)",gridAutoRows:j?"150px":"210px",gap:j?"12px":"20px",justifyItems:"center",...window.innerWidth>2e3?{gridTemplateColumns:"repeat(3, 260px)",gridAutoRows:"260px",gap:"28px"}:{},...window.innerWidth>2560?{gridTemplateColumns:"repeat(3, 300px)",gridAutoRows:"300px",gap:"32px"}:{}},children:a.map((t,i)=>{const g=u===i&&m==="guess"&&!p;return e.jsx("div",{style:{...o.gmCard,...q==="correct"&&u===i?o.gmCorrect:{},...q==="wrong"&&u===i?o.gmWrong:{}},children:!g&&e.jsx("img",{src:t.src,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"}})},i)})}),e.jsxs("div",{style:{marginTop:16,height:80},children:[m==="guess"&&!p&&e.jsxs("div",{children:[e.jsx("input",{type:"text",placeholder:"Type the missing word",value:w,onChange:t=>Y(t.target.value),style:o.gmInput}),e.jsx("button",{style:{...o.gmButton,marginLeft:8},onClick:X,disabled:I,children:I?"...":"Check"})]}),p&&e.jsx("button",{style:o.gmButton,onClick:ee,children:"Next round"})]})]})]})}exports.Game=me;exports.themes=B;
@@ -243,20 +243,30 @@ const ge = {
243
243
  padding: 0;
244
244
  width: 100%;
245
245
  height: 100%;
246
- background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%) !important;
246
+ overflow-x: hidden;
247
+ overflow-y: hidden;
248
+ background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
249
+ background-repeat: no-repeat;
250
+ background-attachment: fixed;
251
+ background-size: cover;
247
252
  }
248
253
 
249
254
  #whats-missing-root {
250
255
  all: unset;
251
- display: block;
256
+ display: flex;
257
+ flex-direction: column;
258
+ justify-content: center;
259
+ align-items: center;
260
+ position: fixed;
261
+ inset: 0;
252
262
  width: 100vw;
253
- min-height: 100vh;
263
+ height: 100vh;
254
264
  margin: 0;
255
265
  padding: 0;
256
- background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
257
- background-attachment: fixed;
258
266
  color: #1f2937;
259
267
  text-align: center;
268
+ background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
269
+ background-size: cover;
260
270
  }
261
271
 
262
272
  #whats-missing-root, #whats-missing-root * {
@@ -289,7 +299,7 @@ function ye() {
289
299
  L(() => {
290
300
  pe();
291
301
  }, []);
292
- const [r, m] = l(null), [a, n] = l([]), [d, O] = l(4), [f, j] = l(!1), [x, E] = l(1), [h, Z] = l(null), [g, b] = l("ready"), [G, F] = l(3), [T, S] = l(7), [z, D] = l(20), [J, R] = l(0), [w, I] = l(!1), [k, U] = l(""), [u, A] = l(!1), [H, Y] = l(!1), [N, y] = l(null), [Q, M] = l([]), [X, P] = l([]), [C, ee] = l(!1);
302
+ const [r, m] = l(null), [a, n] = l([]), [d, O] = l(4), [f, j] = l(!1), [x, E] = l(1), [h, Z] = l(null), [g, b] = l("ready"), [G, F] = l(3), [T, S] = l(10), [z, Y] = l(20), [J, R] = l(0), [w, I] = l(!1), [k, D] = l(""), [u, A] = l(!1), [H, U] = l(!1), [N, y] = l(null), [Q, M] = l([]), [X, P] = l([]), [v, ee] = l(!1);
293
303
  L(() => {
294
304
  const e = () => ee(window.innerWidth < 768);
295
305
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
@@ -300,10 +310,10 @@ function ye() {
300
310
  n(e), j(!0), I(!1), E(1), R(0), M([]), P([]), $(e, [], !0);
301
311
  }, $ = (e = a, i = X, p = !1) => {
302
312
  const c = V(e.length ? e : K[r]);
303
- let v = Math.floor(Math.random() * c.length), B = c[v].name, q = 0;
313
+ let C = Math.floor(Math.random() * c.length), B = c[C].name, q = 0;
304
314
  for (; i.includes(B) && q < 20; )
305
- v = Math.floor(Math.random() * c.length), B = c[v].name, q++;
306
- n(c), Z(v), P([...i, B]), A(!1), U(""), D(20), y(null), p ? (b("ready"), F(3), S(7)) : (b("memorize"), S(7));
315
+ C = Math.floor(Math.random() * c.length), B = c[C].name, q++;
316
+ n(c), Z(C), P([...i, B]), A(!1), D(""), Y(20), y(null), p ? (b("ready"), F(3), S(10)) : (b("memorize"), S(10));
307
317
  };
308
318
  L(() => {
309
319
  if (!(!f || w || u)) {
@@ -331,7 +341,7 @@ function ye() {
331
341
  ]);
332
342
  return;
333
343
  }
334
- const e = setTimeout(() => D((i) => i - 1), 1e3);
344
+ const e = setTimeout(() => Y((i) => i - 1), 1e3);
335
345
  return () => clearTimeout(e);
336
346
  }
337
347
  }
@@ -355,8 +365,8 @@ function ye() {
355
365
  i === e ? (R((c) => c + 1), y("correct"), p = "correct") : he(i, e) === 1 ? (R((c) => c + 0.5), y("almost"), p = "almost") : (y("wrong"), p = "wrong"), M((c) => [
356
366
  ...c,
357
367
  { round: x, answer: i, correct: e, result: p }
358
- ]), Y(!0), setTimeout(() => {
359
- Y(!1), A(!0);
368
+ ]), U(!0), setTimeout(() => {
369
+ U(!1), A(!0);
360
370
  }, 600);
361
371
  }, oe = () => x < d ? (E((e) => e + 1), $()) : I(!0), ne = () => {
362
372
  j(!1), I(!1), m(null);
@@ -382,7 +392,7 @@ function ye() {
382
392
  []
383
393
  );
384
394
  return /* @__PURE__ */ s("div", { id: "whats-missing-root", children: [
385
- !C && re,
395
+ !v && re,
386
396
  !r && !f && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
387
397
  /* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
388
398
  /* @__PURE__ */ o("p", { style: t.gmBodyM, children: "Select a theme:" }),
@@ -422,6 +432,7 @@ function ye() {
422
432
  " / ",
423
433
  d
424
434
  ] }),
435
+ /* @__PURE__ */ o("p", { style: { ...t.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
425
436
  /* @__PURE__ */ s("table", { style: t.gmTable, children: [
426
437
  /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [
427
438
  /* @__PURE__ */ o("th", { children: "Round" }),
@@ -475,9 +486,9 @@ function ye() {
475
486
  {
476
487
  style: {
477
488
  ...t.gmGrid,
478
- gridTemplateColumns: C ? "repeat(2, 1fr)" : "repeat(3, 210px)",
479
- gridAutoRows: C ? "150px" : "210px",
480
- gap: C ? "12px" : "20px",
489
+ gridTemplateColumns: v ? "repeat(2, 1fr)" : "repeat(3, 210px)",
490
+ gridAutoRows: v ? "150px" : "210px",
491
+ gap: v ? "12px" : "20px",
481
492
  justifyItems: "center",
482
493
  ...window.innerWidth > 2e3 ? {
483
494
  gridTemplateColumns: "repeat(3, 260px)",
@@ -526,7 +537,7 @@ function ye() {
526
537
  type: "text",
527
538
  placeholder: "Type the missing word",
528
539
  value: k,
529
- onChange: (e) => U(e.target.value),
540
+ onChange: (e) => D(e.target.value),
530
541
  style: t.gmInput
531
542
  }
532
543
  ),
package/package.json CHANGED
@@ -1,16 +1,22 @@
1
1
  {
2
2
  "name": "@mblinkov/whats-missing",
3
- "version": "20.0.8",
3
+ "version": "20.0.11",
4
4
  "main": "dist/whats-missing.umd.js",
5
5
  "module": "dist/whats-missing.es.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "peerDependencies": {
8
- "react": "^18.0.0",
9
- "react-dom": "^18.0.0"
8
+ "react": "^18.3.1",
9
+ "react-dom": "^18.3.1"
10
10
  },
11
11
  "scripts": {
12
12
  "dev": "vite",
13
13
  "build": "vite build",
14
14
  "preview": "vite preview"
15
+ },
16
+ "devDependencies": {
17
+ "@types/react": "^19.2.2",
18
+ "@types/react-dom": "^19.2.1",
19
+ "@vitejs/plugin-react": "^5.0.4",
20
+ "typescript": "^5.9.3"
15
21
  }
16
22
  }
package/src/Game.tsx CHANGED
@@ -10,7 +10,8 @@ type RoundResult = {
10
10
  correct: string;
11
11
  result: "correct" | "almost" | "wrong";
12
12
  };
13
- // ✅ Изоляция без потери адаптива и с фоном на всю страницу
13
+
14
+ // ✅ Финальный reset без скроллов, полос и с растяжением фона
14
15
  const globalReset = () => {
15
16
  const style = document.createElement("style");
16
17
  style.textContent = `
@@ -19,20 +20,30 @@ const globalReset = () => {
19
20
  padding: 0;
20
21
  width: 100%;
21
22
  height: 100%;
22
- background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%) !important;
23
+ overflow-x: hidden;
24
+ overflow-y: hidden;
25
+ background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
26
+ background-repeat: no-repeat;
27
+ background-attachment: fixed;
28
+ background-size: cover;
23
29
  }
24
30
 
25
31
  #whats-missing-root {
26
32
  all: unset;
27
- display: block;
33
+ display: flex;
34
+ flex-direction: column;
35
+ justify-content: center;
36
+ align-items: center;
37
+ position: fixed;
38
+ inset: 0;
28
39
  width: 100vw;
29
- min-height: 100vh;
40
+ height: 100vh;
30
41
  margin: 0;
31
42
  padding: 0;
32
- background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
33
- background-attachment: fixed;
34
43
  color: #1f2937;
35
44
  text-align: center;
45
+ background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
46
+ background-size: cover;
36
47
  }
37
48
 
38
49
  #whats-missing-root, #whats-missing-root * {
@@ -83,7 +94,7 @@ export default function Game() {
83
94
  const [hiddenIndex, setHiddenIndex] = useState<number | null>(null);
84
95
  const [phase, setPhase] = useState<"ready" | "memorize" | "guess">("ready");
85
96
  const [readyTime, setReadyTime] = useState(3);
86
- const [memorizeTime, setMemorizeTime] = useState(7);
97
+ const [memorizeTime, setMemorizeTime] = useState(10);
87
98
  const [timeLeft, setTimeLeft] = useState(20);
88
99
  const [score, setScore] = useState(0);
89
100
  const [finished, setFinished] = useState(false);
@@ -138,10 +149,10 @@ export default function Game() {
138
149
  if (isFirst) {
139
150
  setPhase("ready");
140
151
  setReadyTime(3);
141
- setMemorizeTime(7);
152
+ setMemorizeTime(10);
142
153
  } else {
143
154
  setPhase("memorize");
144
- setMemorizeTime(7);
155
+ setMemorizeTime(10);
145
156
  }
146
157
  };
147
158
 
@@ -230,7 +241,6 @@ export default function Game() {
230
241
  setTheme(null);
231
242
  };
232
243
 
233
- // ✅ логотип с fallback SVG → PNG
234
244
  const MemoizedLogo = useMemo(
235
245
  () => (
236
246
  <div style={styles.gmLogoFixed}>
@@ -302,6 +312,9 @@ export default function Game() {
302
312
  <h2 style={styles.gmHeadline3}>
303
313
  Your score: {score} / {rounds}
304
314
  </h2>
315
+ <p style={{ ...styles.gmBodyM, color: "#10b981", marginTop: 12 }}>
316
+ Yahoo! You did it! 🍬✨
317
+ </p>
305
318
  <table style={styles.gmTable}>
306
319
  <thead>
307
320
  <tr>