@mblinkov/whats-missing 20.0.2 → 20.0.4
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 +3 -24
- package/dist/whats-missing.es.js +175 -449
- package/package.json +1 -1
- package/src/Game.styles.ts +9 -7
- package/src/Game.tsx +13 -11
- package/vite.config.ts +3 -2
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var ae;function ce(){if(ae)return G;ae=1;var a=Symbol.for("react.transitional.element"),g=Symbol.for("react.fragment");function m(s,i,h){var x=null;if(h!==void 0&&(x=""+h),i.key!==void 0&&(x=""+i.key),"key"in i){h={};for(var v in i)v!=="key"&&(h[v]=i[v])}else h=i;return i=h.ref,{$$typeof:a,type:s,key:x,ref:i!==void 0?i:null,props:h}}return G.Fragment=g,G.jsx=m,G.jsxs=m,G}var D={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ie;function de(){return ie||(ie=1,process.env.NODE_ENV!=="production"&&(function(){function a(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===H?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case S:return"Fragment";case L:return"Profiler";case M:return"StrictMode";case A:return"Suspense";case F:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case V:return"Portal";case te:return e.displayName||"Context";case J:return(e._context.displayName||"Context")+".Consumer";case W:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return n=e.displayName||null,n!==null?n:a(e.type)||"Memo";case P:n=e._payload,e=e._init;try{return a(e(n))}catch{}}return null}function g(e){return""+e}function m(e){try{g(e);var n=!1}catch{n=!0}if(n){n=console;var l=n.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return l.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),g(e)}}function s(e){if(e===S)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===P)return"<...>";try{var n=a(e);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function i(){var e=E.A;return e===null?null:e.getOwner()}function h(){return Error("react-stack-top-frame")}function x(e){if(Y.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function v(e,n){function l(){Z||(Z=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}l.isReactWarning=!0,Object.defineProperty(e,"key",{get:l,configurable:!0})}function C(){var e=a(this.type);return I[e]||(I[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function U(e,n,l,u,z,$){var f=l.ref;return e={$$typeof:N,type:e,key:n,props:l,_owner:u},(f!==void 0?f:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:C}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:$}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function y(e,n,l,u,z,$){var f=n.children;if(f!==void 0)if(u)if(X(f)){for(u=0;u<f.length;u++)q(f[u]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else q(f);if(Y.call(n,"key")){f=a(e);var k=Object.keys(n).filter(function(c){return c!=="key"});u=0<k.length?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}",_[f+u]||(k=0<k.length?"{"+k.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
-
let props = %s;
|
|
19
|
-
<%s {...props} />
|
|
20
|
-
React keys must be passed directly to JSX without using spread:
|
|
21
|
-
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,u,f,k,f),_[f+u]=!0)}if(f=null,l!==void 0&&(m(l),f=""+l),x(n)&&(m(n.key),f=""+n.key),"key"in n){l={};for(var r in n)r!=="key"&&(l[r]=n[r])}else l=n;return f&&v(l,typeof e=="function"?e.displayName||e.name||"Unknown":e),U(e,f,l,i(),z,$)}function q(e){p(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===P&&(e._payload.status==="fulfilled"?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e=="object"&&e!==null&&e.$$typeof===N}var T=d,N=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),te=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),E=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,X=Array.isArray,j=console.createTask?console.createTask:function(){return null};T={react_stack_bottom_frame:function(e){return e()}};var Z,I={},Q=T.react_stack_bottom_frame.bind(T,h)(),B=j(s(h)),_={};D.Fragment=S,D.jsx=function(e,n,l){var u=1e4>E.recentlyCreatedOwnerStacks++;return y(e,n,l,!1,u?Error("react-stack-top-frame"):Q,u?j(s(e)):B)},D.jsxs=function(e,n,l){var u=1e4>E.recentlyCreatedOwnerStacks++;return y(e,n,l,!0,u?Error("react-stack-top-frame"):Q,u?j(s(e)):B)}})()),D}var le;function ue(){return le||(le=1,process.env.NODE_ENV==="production"?ee.exports=ce():ee.exports=de()),ee.exports}var t=ue();const me=window.origin+"/cloud/speakid/games/whatsmissing/",ne=(a,g)=>a.map(([m,s])=>({src:`${me}${g}/${s.replace(/\s/g,"%20")}.png`,name:s})),fe=[["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"]],ge=[["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"]],pe=[["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"]],oe={food:ne(fe,"food"),animals:ne(ge,"animals"),toys:ne(pe,"toys")},he=`
|
|
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/",M=(r,c)=>r.map(([l,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:M(ne,"food"),animals:M(re,"animals"),toys:M(ie,"toys")},le=`
|
|
23
2
|
@keyframes spin {
|
|
24
3
|
from { transform: rotate(0deg); }
|
|
25
4
|
to { transform: rotate(360deg); }
|
|
26
5
|
}
|
|
27
|
-
`;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const
|
|
6
|
+
`;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const r=document.createElement("style");r.id="spin-keyframes",r.innerHTML=le,document.head.appendChild(r)}const ae={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"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto",background:"transparent"},gmHourglass:{fontSize:"42px",...ae}},de=window.origin+"/cloud/speakid/games/whatsmissing/logo.png",ce=()=>{const r=document.createElement("style");r.textContent=`
|
|
28
7
|
html, body, #root {
|
|
29
8
|
margin: 0;
|
|
30
9
|
padding: 0;
|
|
@@ -54,4 +33,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
54
33
|
from { transform: rotate(0deg); }
|
|
55
34
|
to { transform: rotate(360deg); }
|
|
56
35
|
}
|
|
57
|
-
`,document.head.appendChild(
|
|
36
|
+
`,document.head.appendChild(r)},me=(r,c)=>{const l=Array.from({length:r.length+1},()=>Array(c.length+1).fill(0));for(let s=0;s<=r.length;s++)l[s][0]=s;for(let s=0;s<=c.length;s++)l[0][s]=s;for(let s=1;s<=r.length;s++)for(let a=1;a<=c.length;a++)l[s][a]=r[s-1]===c[a-1]?l[s-1][a-1]:Math.min(l[s-1][a-1],l[s][a-1],l[s-1][a])+1;return l[r.length][c.length]};function ge(){n.useEffect(()=>{ce()},[]);const[r,c]=n.useState(null),[l,s]=n.useState([]),[a,$]=n.useState(4),[h,L]=n.useState(!1),[f,W]=n.useState(1),[u,K]=n.useState(null),[m,y]=n.useState("ready"),[E,G]=n.useState(3),[k,C]=n.useState(7),[T,F]=n.useState(20),[V,v]=n.useState(0),[b,z]=n.useState(!1),[w,D]=n.useState(""),[p,R]=n.useState(!1),[I,q]=n.useState(!1),[P,x]=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]);s(t),L(!0),z(!1),W(1),v(0),A([]),U([]),O(t,[],!0)},O=(t=l,i=J,g=!1)=>{const d=Y(t.length?t:B[r]);let S=Math.floor(Math.random()*d.length),H=d[S].name,_=0;for(;i.includes(H)&&_<20;)S=Math.floor(Math.random()*d.length),H=d[S].name,_++;s(d),K(S),U([...i,H]),R(!1),D(""),F(20),x(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(T<=0){R(!0),x("wrong");const i=l[u].name;A(g=>[...g,{round:f,answer:w,correct:i,result:"wrong"}]);return}const t=setTimeout(()=>F(i=>i-1),1e3);return()=>clearTimeout(t)}}},[m,E,k,T,h,b,p,l,u,f,w]);const X=()=>{if(u===null||I)return;const t=l[u].name,i=w.toLowerCase().trim();let g="wrong";i===t?(v(d=>d+1),x("correct"),g="correct"):me(i,t)===1?(v(d=>d+.5),x("almost"),g="almost"):(x("wrong"),g="wrong"),A(d=>[...d,{round:f,answer:i,correct:t,result:g}]),q(!0),setTimeout(()=>{q(!1),R(!0)},600)},ee=()=>f<a?(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.jsx("img",{src:de,alt:"SPEAKID Logo",style:o.gmLogoImg})}),[]);return e.jsxs(e.Fragment,{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,...a===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: ",a]}),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: ",V," / ",a]}),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: ",T,"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:l.map((t,i)=>{const g=u===i&&m==="guess"&&!p;return e.jsx("div",{style:{...o.gmCard,...P==="correct"&&u===i?o.gmCorrect:{},...P==="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=>D(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=ge;exports.themes=B;
|
package/dist/whats-missing.es.js
CHANGED
|
@@ -1,286 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
var ae;
|
|
13
|
-
function ue() {
|
|
14
|
-
if (ae) return D;
|
|
15
|
-
ae = 1;
|
|
16
|
-
var a = Symbol.for("react.transitional.element"), p = Symbol.for("react.fragment");
|
|
17
|
-
function u(s, i, h) {
|
|
18
|
-
var x = null;
|
|
19
|
-
if (h !== void 0 && (x = "" + h), i.key !== void 0 && (x = "" + i.key), "key" in i) {
|
|
20
|
-
h = {};
|
|
21
|
-
for (var v in i)
|
|
22
|
-
v !== "key" && (h[v] = i[v]);
|
|
23
|
-
} else h = i;
|
|
24
|
-
return i = h.ref, {
|
|
25
|
-
$$typeof: a,
|
|
26
|
-
type: s,
|
|
27
|
-
key: x,
|
|
28
|
-
ref: i !== void 0 ? i : null,
|
|
29
|
-
props: h
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return D.Fragment = p, D.jsx = u, D.jsxs = u, D;
|
|
33
|
-
}
|
|
34
|
-
var G = {};
|
|
35
|
-
/**
|
|
36
|
-
* @license React
|
|
37
|
-
* react-jsx-runtime.development.js
|
|
38
|
-
*
|
|
39
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the MIT license found in the
|
|
42
|
-
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/
|
|
44
|
-
var ie;
|
|
45
|
-
function me() {
|
|
46
|
-
return ie || (ie = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
47
|
-
function a(e) {
|
|
48
|
-
if (e == null) return null;
|
|
49
|
-
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof === H ? null : e.displayName || e.name || null;
|
|
51
|
-
if (typeof e == "string") return e;
|
|
52
|
-
switch (e) {
|
|
53
|
-
case E:
|
|
54
|
-
return "Fragment";
|
|
55
|
-
case L:
|
|
56
|
-
return "Profiler";
|
|
57
|
-
case M:
|
|
58
|
-
return "StrictMode";
|
|
59
|
-
case A:
|
|
60
|
-
return "Suspense";
|
|
61
|
-
case F:
|
|
62
|
-
return "SuspenseList";
|
|
63
|
-
case R:
|
|
64
|
-
return "Activity";
|
|
65
|
-
}
|
|
66
|
-
if (typeof e == "object")
|
|
67
|
-
switch (typeof e.tag == "number" && console.error(
|
|
68
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
-
), e.$$typeof) {
|
|
70
|
-
case V:
|
|
71
|
-
return "Portal";
|
|
72
|
-
case te:
|
|
73
|
-
return e.displayName || "Context";
|
|
74
|
-
case J:
|
|
75
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case W:
|
|
77
|
-
var n = e.render;
|
|
78
|
-
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
-
case O:
|
|
80
|
-
return n = e.displayName || null, n !== null ? n : a(e.type) || "Memo";
|
|
81
|
-
case P:
|
|
82
|
-
n = e._payload, e = e._init;
|
|
83
|
-
try {
|
|
84
|
-
return a(e(n));
|
|
85
|
-
} catch {
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
function p(e) {
|
|
91
|
-
return "" + e;
|
|
92
|
-
}
|
|
93
|
-
function u(e) {
|
|
94
|
-
try {
|
|
95
|
-
p(e);
|
|
96
|
-
var n = !1;
|
|
97
|
-
} catch {
|
|
98
|
-
n = !0;
|
|
99
|
-
}
|
|
100
|
-
if (n) {
|
|
101
|
-
n = console;
|
|
102
|
-
var l = n.error, d = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
-
return l.call(
|
|
104
|
-
n,
|
|
105
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
-
d
|
|
107
|
-
), p(e);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function s(e) {
|
|
111
|
-
if (e === E) return "<>";
|
|
112
|
-
if (typeof e == "object" && e !== null && e.$$typeof === P)
|
|
113
|
-
return "<...>";
|
|
114
|
-
try {
|
|
115
|
-
var n = a(e);
|
|
116
|
-
return n ? "<" + n + ">" : "<...>";
|
|
117
|
-
} catch {
|
|
118
|
-
return "<...>";
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function i() {
|
|
122
|
-
var e = _.A;
|
|
123
|
-
return e === null ? null : e.getOwner();
|
|
124
|
-
}
|
|
125
|
-
function h() {
|
|
126
|
-
return Error("react-stack-top-frame");
|
|
127
|
-
}
|
|
128
|
-
function x(e) {
|
|
129
|
-
if (Y.call(e, "key")) {
|
|
130
|
-
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
|
-
if (n && n.isReactWarning) return !1;
|
|
132
|
-
}
|
|
133
|
-
return e.key !== void 0;
|
|
134
|
-
}
|
|
135
|
-
function v(e, n) {
|
|
136
|
-
function l() {
|
|
137
|
-
Z || (Z = !0, console.error(
|
|
138
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
-
n
|
|
140
|
-
));
|
|
141
|
-
}
|
|
142
|
-
l.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
-
get: l,
|
|
144
|
-
configurable: !0
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function C() {
|
|
148
|
-
var e = a(this.type);
|
|
149
|
-
return I[e] || (I[e] = !0, console.error(
|
|
150
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
|
-
}
|
|
153
|
-
function U(e, n, l, d, z, $) {
|
|
154
|
-
var m = l.ref;
|
|
155
|
-
return e = {
|
|
156
|
-
$$typeof: N,
|
|
157
|
-
type: e,
|
|
158
|
-
key: n,
|
|
159
|
-
props: l,
|
|
160
|
-
_owner: d
|
|
161
|
-
}, (m !== void 0 ? m : null) !== null ? Object.defineProperty(e, "ref", {
|
|
162
|
-
enumerable: !1,
|
|
163
|
-
get: C
|
|
164
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
165
|
-
configurable: !1,
|
|
166
|
-
enumerable: !1,
|
|
167
|
-
writable: !0,
|
|
168
|
-
value: 0
|
|
169
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
170
|
-
configurable: !1,
|
|
171
|
-
enumerable: !1,
|
|
172
|
-
writable: !0,
|
|
173
|
-
value: null
|
|
174
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
175
|
-
configurable: !1,
|
|
176
|
-
enumerable: !1,
|
|
177
|
-
writable: !0,
|
|
178
|
-
value: z
|
|
179
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
180
|
-
configurable: !1,
|
|
181
|
-
enumerable: !1,
|
|
182
|
-
writable: !0,
|
|
183
|
-
value: $
|
|
184
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
185
|
-
}
|
|
186
|
-
function y(e, n, l, d, z, $) {
|
|
187
|
-
var m = n.children;
|
|
188
|
-
if (m !== void 0)
|
|
189
|
-
if (d)
|
|
190
|
-
if (X(m)) {
|
|
191
|
-
for (d = 0; d < m.length; d++)
|
|
192
|
-
q(m[d]);
|
|
193
|
-
Object.freeze && Object.freeze(m);
|
|
194
|
-
} else
|
|
195
|
-
console.error(
|
|
196
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
|
-
);
|
|
198
|
-
else q(m);
|
|
199
|
-
if (Y.call(n, "key")) {
|
|
200
|
-
m = a(e);
|
|
201
|
-
var k = Object.keys(n).filter(function(c) {
|
|
202
|
-
return c !== "key";
|
|
203
|
-
});
|
|
204
|
-
d = 0 < k.length ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}", S[m + d] || (k = 0 < k.length ? "{" + k.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
205
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
206
|
-
let props = %s;
|
|
207
|
-
<%s {...props} />
|
|
208
|
-
React keys must be passed directly to JSX without using spread:
|
|
209
|
-
let props = %s;
|
|
210
|
-
<%s key={someKey} {...props} />`,
|
|
211
|
-
d,
|
|
212
|
-
m,
|
|
213
|
-
k,
|
|
214
|
-
m
|
|
215
|
-
), S[m + d] = !0);
|
|
216
|
-
}
|
|
217
|
-
if (m = null, l !== void 0 && (u(l), m = "" + l), x(n) && (u(n.key), m = "" + n.key), "key" in n) {
|
|
218
|
-
l = {};
|
|
219
|
-
for (var r in n)
|
|
220
|
-
r !== "key" && (l[r] = n[r]);
|
|
221
|
-
} else l = n;
|
|
222
|
-
return m && v(
|
|
223
|
-
l,
|
|
224
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
225
|
-
), U(
|
|
226
|
-
e,
|
|
227
|
-
m,
|
|
228
|
-
l,
|
|
229
|
-
i(),
|
|
230
|
-
z,
|
|
231
|
-
$
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
function q(e) {
|
|
235
|
-
g(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === P && (e._payload.status === "fulfilled" ? g(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
236
|
-
}
|
|
237
|
-
function g(e) {
|
|
238
|
-
return typeof e == "object" && e !== null && e.$$typeof === N;
|
|
239
|
-
}
|
|
240
|
-
var T = de, N = Symbol.for("react.transitional.element"), V = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), L = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), te = Symbol.for("react.context"), W = Symbol.for("react.forward_ref"), A = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), O = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), R = Symbol.for("react.activity"), H = Symbol.for("react.client.reference"), _ = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, X = Array.isArray, j = console.createTask ? console.createTask : function() {
|
|
241
|
-
return null;
|
|
242
|
-
};
|
|
243
|
-
T = {
|
|
244
|
-
react_stack_bottom_frame: function(e) {
|
|
245
|
-
return e();
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
var Z, I = {}, Q = T.react_stack_bottom_frame.bind(
|
|
249
|
-
T,
|
|
250
|
-
h
|
|
251
|
-
)(), B = j(s(h)), S = {};
|
|
252
|
-
G.Fragment = E, G.jsx = function(e, n, l) {
|
|
253
|
-
var d = 1e4 > _.recentlyCreatedOwnerStacks++;
|
|
254
|
-
return y(
|
|
255
|
-
e,
|
|
256
|
-
n,
|
|
257
|
-
l,
|
|
258
|
-
!1,
|
|
259
|
-
d ? Error("react-stack-top-frame") : Q,
|
|
260
|
-
d ? j(s(e)) : B
|
|
261
|
-
);
|
|
262
|
-
}, G.jsxs = function(e, n, l) {
|
|
263
|
-
var d = 1e4 > _.recentlyCreatedOwnerStacks++;
|
|
264
|
-
return y(
|
|
265
|
-
e,
|
|
266
|
-
n,
|
|
267
|
-
l,
|
|
268
|
-
!0,
|
|
269
|
-
d ? Error("react-stack-top-frame") : Q,
|
|
270
|
-
d ? j(s(e)) : B
|
|
271
|
-
);
|
|
272
|
-
};
|
|
273
|
-
})()), G;
|
|
274
|
-
}
|
|
275
|
-
var le;
|
|
276
|
-
function fe() {
|
|
277
|
-
return le || (le = 1, process.env.NODE_ENV === "production" ? ee.exports = ue() : ee.exports = me()), ee.exports;
|
|
278
|
-
}
|
|
279
|
-
var t = fe();
|
|
280
|
-
const pe = window.origin + "/cloud/speakid/games/whatsmissing/", oe = (a, p) => a.map(([u, s]) => ({
|
|
281
|
-
src: `${pe}${p}/${s.replace(/\s/g, "%20")}.png`,
|
|
282
|
-
name: s
|
|
283
|
-
})), ge = [
|
|
1
|
+
import { jsx as o, jsxs as s, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as L, useState as l, useMemo as se } from "react";
|
|
3
|
+
const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r.map(([a, n]) => ({
|
|
4
|
+
src: `${le}${m}/${n.replace(/\s/g, "%20")}.png`,
|
|
5
|
+
name: n
|
|
6
|
+
})), ae = [
|
|
284
7
|
["apple", "apple"],
|
|
285
8
|
["banana", "banana"],
|
|
286
9
|
["bread", "bread"],
|
|
@@ -306,7 +29,7 @@ const pe = window.origin + "/cloud/speakid/games/whatsmissing/", oe = (a, p) =>
|
|
|
306
29
|
["strawberry", "strawberry"],
|
|
307
30
|
["tomato", "tomato"],
|
|
308
31
|
["watermelon", "watermelon"]
|
|
309
|
-
],
|
|
32
|
+
], de = [
|
|
310
33
|
["bear", "bear"],
|
|
311
34
|
["cat", "cat"],
|
|
312
35
|
["crocodile", "crocodile"],
|
|
@@ -326,7 +49,7 @@ const pe = window.origin + "/cloud/speakid/games/whatsmissing/", oe = (a, p) =>
|
|
|
326
49
|
["tortoise", "tortoise"],
|
|
327
50
|
["wolf", "wolf"],
|
|
328
51
|
["zebra", "zebra"]
|
|
329
|
-
],
|
|
52
|
+
], ce = [
|
|
330
53
|
["ball", "ball"],
|
|
331
54
|
["balloon", "balloon"],
|
|
332
55
|
["blocks", "blocks"],
|
|
@@ -346,23 +69,23 @@ const pe = window.origin + "/cloud/speakid/games/whatsmissing/", oe = (a, p) =>
|
|
|
346
69
|
["teddy_bear", "teddy bear"],
|
|
347
70
|
["yo-yo", "yo-yo"],
|
|
348
71
|
["crayons", "crayons"]
|
|
349
|
-
],
|
|
350
|
-
food:
|
|
351
|
-
animals:
|
|
352
|
-
toys:
|
|
353
|
-
},
|
|
72
|
+
], V = {
|
|
73
|
+
food: W(ae, "food"),
|
|
74
|
+
animals: W(de, "animals"),
|
|
75
|
+
toys: W(ce, "toys")
|
|
76
|
+
}, me = `
|
|
354
77
|
@keyframes spin {
|
|
355
78
|
from { transform: rotate(0deg); }
|
|
356
79
|
to { transform: rotate(360deg); }
|
|
357
80
|
}
|
|
358
81
|
`;
|
|
359
82
|
if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
|
|
360
|
-
const
|
|
361
|
-
|
|
83
|
+
const r = document.createElement("style");
|
|
84
|
+
r.id = "spin-keyframes", r.innerHTML = me, document.head.appendChild(r);
|
|
362
85
|
}
|
|
363
|
-
const
|
|
86
|
+
const ge = {
|
|
364
87
|
animation: "spin 1.4s linear infinite"
|
|
365
|
-
},
|
|
88
|
+
}, t = {
|
|
366
89
|
gmCenterScreen: {
|
|
367
90
|
position: "relative",
|
|
368
91
|
zIndex: 1,
|
|
@@ -421,7 +144,6 @@ const ye = {
|
|
|
421
144
|
position: "relative",
|
|
422
145
|
width: "100%",
|
|
423
146
|
maxWidth: "600px",
|
|
424
|
-
// ограничение ширины для мобильных
|
|
425
147
|
minHeight: "100vh",
|
|
426
148
|
display: "flex",
|
|
427
149
|
flexDirection: "column",
|
|
@@ -487,26 +209,28 @@ const ye = {
|
|
|
487
209
|
overflow: "hidden",
|
|
488
210
|
textOverflow: "ellipsis"
|
|
489
211
|
},
|
|
212
|
+
// ✅ Исправленный логотип: без белого фона, не ломает верстку
|
|
490
213
|
gmLogoFixed: {
|
|
491
|
-
position: "
|
|
214
|
+
position: "absolute",
|
|
492
215
|
top: "16px",
|
|
493
|
-
left: "
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
216
|
+
left: "24px",
|
|
217
|
+
width: "120px",
|
|
218
|
+
zIndex: 10,
|
|
219
|
+
pointerEvents: "none",
|
|
220
|
+
background: "transparent"
|
|
498
221
|
},
|
|
499
222
|
gmLogoImg: {
|
|
500
223
|
height: "clamp(28px, 5vw, 40px)",
|
|
501
|
-
width: "auto"
|
|
224
|
+
width: "auto",
|
|
225
|
+
background: "transparent"
|
|
502
226
|
},
|
|
503
227
|
gmHourglass: {
|
|
504
228
|
fontSize: "42px",
|
|
505
|
-
...
|
|
229
|
+
...ge
|
|
506
230
|
}
|
|
507
|
-
},
|
|
508
|
-
const
|
|
509
|
-
|
|
231
|
+
}, pe = window.origin + "/cloud/speakid/games/whatsmissing/logo.png", ue = () => {
|
|
232
|
+
const r = document.createElement("style");
|
|
233
|
+
r.textContent = `
|
|
510
234
|
html, body, #root {
|
|
511
235
|
margin: 0;
|
|
512
236
|
padding: 0;
|
|
@@ -536,154 +260,157 @@ const ye = {
|
|
|
536
260
|
from { transform: rotate(0deg); }
|
|
537
261
|
to { transform: rotate(360deg); }
|
|
538
262
|
}
|
|
539
|
-
`, document.head.appendChild(
|
|
540
|
-
},
|
|
541
|
-
const
|
|
542
|
-
for (let
|
|
543
|
-
for (let
|
|
544
|
-
for (let
|
|
545
|
-
for (let
|
|
546
|
-
|
|
547
|
-
return
|
|
263
|
+
`, document.head.appendChild(r);
|
|
264
|
+
}, he = (r, m) => {
|
|
265
|
+
const a = Array.from({ length: r.length + 1 }, () => Array(m.length + 1).fill(0));
|
|
266
|
+
for (let n = 0; n <= r.length; n++) a[n][0] = n;
|
|
267
|
+
for (let n = 0; n <= m.length; n++) a[0][n] = n;
|
|
268
|
+
for (let n = 1; n <= r.length; n++)
|
|
269
|
+
for (let d = 1; d <= m.length; d++)
|
|
270
|
+
a[n][d] = r[n - 1] === m[d - 1] ? a[n - 1][d - 1] : Math.min(a[n - 1][d - 1], a[n][d - 1], a[n - 1][d]) + 1;
|
|
271
|
+
return a[r.length][m.length];
|
|
548
272
|
};
|
|
549
|
-
function
|
|
550
|
-
|
|
551
|
-
|
|
273
|
+
function xe() {
|
|
274
|
+
L(() => {
|
|
275
|
+
ue();
|
|
552
276
|
}, []);
|
|
553
|
-
const [
|
|
554
|
-
|
|
555
|
-
const
|
|
556
|
-
return
|
|
277
|
+
const [r, m] = l(null), [a, n] = l([]), [d, Z] = l(4), [f, j] = l(!1), [x, E] = l(1), [u, J] = l(null), [g, b] = l("ready"), [G, F] = l(3), [v, S] = l(7), [z, D] = l(20), [Q, R] = l(0), [w, I] = l(!1), [k, U] = l(""), [h, A] = l(!1), [H, Y] = l(!1), [N, y] = l(null), [X, M] = l([]), [ee, P] = l([]), [C, te] = l(!1);
|
|
278
|
+
L(() => {
|
|
279
|
+
const e = () => te(window.innerWidth < 768);
|
|
280
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
557
281
|
}, []);
|
|
558
|
-
const
|
|
559
|
-
if (!
|
|
560
|
-
const
|
|
561
|
-
|
|
562
|
-
},
|
|
563
|
-
const
|
|
564
|
-
let
|
|
565
|
-
for (;
|
|
566
|
-
|
|
567
|
-
|
|
282
|
+
const _ = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), $ = () => {
|
|
283
|
+
if (!r) return;
|
|
284
|
+
const e = _(V[r]);
|
|
285
|
+
n(e), j(!0), I(!1), E(1), R(0), M([]), P([]), q(e, [], !0);
|
|
286
|
+
}, q = (e = a, i = ee, p = !1) => {
|
|
287
|
+
const c = _(e.length ? e : V[r]);
|
|
288
|
+
let T = Math.floor(Math.random() * c.length), B = c[T].name, K = 0;
|
|
289
|
+
for (; i.includes(B) && K < 20; )
|
|
290
|
+
T = Math.floor(Math.random() * c.length), B = c[T].name, K++;
|
|
291
|
+
n(c), J(T), P([...i, B]), A(!1), U(""), D(20), y(null), p ? (b("ready"), F(3), S(7)) : (b("memorize"), S(7));
|
|
568
292
|
};
|
|
569
|
-
|
|
570
|
-
if (!(!
|
|
293
|
+
L(() => {
|
|
294
|
+
if (!(!f || w || h)) {
|
|
571
295
|
if (g === "ready")
|
|
572
|
-
if (
|
|
573
|
-
|
|
296
|
+
if (G <= 0)
|
|
297
|
+
b("memorize");
|
|
574
298
|
else {
|
|
575
|
-
const
|
|
576
|
-
return () => clearTimeout(
|
|
299
|
+
const e = setTimeout(() => F((i) => i - 1), 1e3);
|
|
300
|
+
return () => clearTimeout(e);
|
|
577
301
|
}
|
|
578
302
|
if (g === "memorize")
|
|
579
|
-
if (
|
|
580
|
-
|
|
303
|
+
if (v <= 0)
|
|
304
|
+
b("guess");
|
|
581
305
|
else {
|
|
582
|
-
const
|
|
583
|
-
return () => clearTimeout(
|
|
306
|
+
const e = setTimeout(() => S((i) => i - 1), 1e3);
|
|
307
|
+
return () => clearTimeout(e);
|
|
584
308
|
}
|
|
585
309
|
if (g === "guess") {
|
|
586
|
-
if (
|
|
587
|
-
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
...
|
|
591
|
-
{ round:
|
|
310
|
+
if (z <= 0) {
|
|
311
|
+
A(!0), y("wrong");
|
|
312
|
+
const i = a[u].name;
|
|
313
|
+
M((p) => [
|
|
314
|
+
...p,
|
|
315
|
+
{ round: x, answer: k, correct: i, result: "wrong" }
|
|
592
316
|
]);
|
|
593
317
|
return;
|
|
594
318
|
}
|
|
595
|
-
const
|
|
596
|
-
return () => clearTimeout(
|
|
319
|
+
const e = setTimeout(() => D((i) => i - 1), 1e3);
|
|
320
|
+
return () => clearTimeout(e);
|
|
597
321
|
}
|
|
598
322
|
}
|
|
599
323
|
}, [
|
|
600
324
|
g,
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
325
|
+
G,
|
|
326
|
+
v,
|
|
327
|
+
z,
|
|
328
|
+
f,
|
|
329
|
+
w,
|
|
330
|
+
h,
|
|
331
|
+
a,
|
|
607
332
|
u,
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
O
|
|
333
|
+
x,
|
|
334
|
+
k
|
|
611
335
|
]);
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
614
|
-
const
|
|
615
|
-
let
|
|
616
|
-
|
|
617
|
-
...
|
|
618
|
-
{ round:
|
|
336
|
+
const oe = () => {
|
|
337
|
+
if (u === null || H) return;
|
|
338
|
+
const e = a[u].name, i = k.toLowerCase().trim();
|
|
339
|
+
let p = "wrong";
|
|
340
|
+
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) => [
|
|
341
|
+
...c,
|
|
342
|
+
{ round: x, answer: i, correct: e, result: p }
|
|
619
343
|
]), Y(!0), setTimeout(() => {
|
|
620
|
-
Y(!1),
|
|
344
|
+
Y(!1), A(!0);
|
|
621
345
|
}, 600);
|
|
622
|
-
},
|
|
623
|
-
|
|
624
|
-
},
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
/* @__PURE__ */
|
|
632
|
-
|
|
633
|
-
|
|
346
|
+
}, ne = () => x < d ? (E((e) => e + 1), q()) : I(!0), re = () => {
|
|
347
|
+
j(!1), I(!1), m(null);
|
|
348
|
+
}, ie = se(
|
|
349
|
+
() => /* @__PURE__ */ o("div", { style: t.gmLogoFixed, children: /* @__PURE__ */ o("img", { src: pe, alt: "SPEAKID Logo", style: t.gmLogoImg }) }),
|
|
350
|
+
[]
|
|
351
|
+
);
|
|
352
|
+
return /* @__PURE__ */ s(O, { children: [
|
|
353
|
+
!C && ie,
|
|
354
|
+
!r && !f && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
|
|
355
|
+
/* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
|
|
356
|
+
/* @__PURE__ */ o("p", { style: t.gmBodyM, children: "Select a theme:" }),
|
|
357
|
+
/* @__PURE__ */ o("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ o("button", { style: t.gmButton, onClick: () => m(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
|
|
358
|
+
/* @__PURE__ */ s("div", { style: { marginTop: 24 }, children: [
|
|
359
|
+
/* @__PURE__ */ o("p", { style: t.gmBodyS, children: "Choose number of rounds:" }),
|
|
360
|
+
/* @__PURE__ */ o("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ o(
|
|
634
361
|
"button",
|
|
635
362
|
{
|
|
636
363
|
style: {
|
|
637
|
-
...
|
|
638
|
-
...
|
|
364
|
+
...t.gmButton,
|
|
365
|
+
...d === e ? t.gmButtonActive : {}
|
|
639
366
|
},
|
|
640
|
-
onClick: () =>
|
|
641
|
-
children:
|
|
367
|
+
onClick: () => Z(e),
|
|
368
|
+
children: e
|
|
642
369
|
},
|
|
643
|
-
|
|
370
|
+
e
|
|
644
371
|
)) })
|
|
645
372
|
] })
|
|
646
373
|
] }),
|
|
647
|
-
|
|
648
|
-
/* @__PURE__ */
|
|
374
|
+
r && !f && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
|
|
375
|
+
/* @__PURE__ */ s("h1", { style: t.gmHeadline1, children: [
|
|
649
376
|
"Theme selected: ",
|
|
650
|
-
|
|
377
|
+
r
|
|
651
378
|
] }),
|
|
652
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ s("p", { style: t.gmBodyM, children: [
|
|
653
380
|
"Rounds: ",
|
|
654
|
-
|
|
381
|
+
d
|
|
655
382
|
] }),
|
|
656
|
-
/* @__PURE__ */
|
|
383
|
+
/* @__PURE__ */ o("button", { style: t.gmButton, onClick: $, children: "▶ Start game" })
|
|
657
384
|
] }),
|
|
658
|
-
|
|
659
|
-
/* @__PURE__ */
|
|
660
|
-
/* @__PURE__ */
|
|
385
|
+
w && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
|
|
386
|
+
/* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "Results" }),
|
|
387
|
+
/* @__PURE__ */ s("h2", { style: t.gmHeadline3, children: [
|
|
661
388
|
"Your score: ",
|
|
662
|
-
|
|
389
|
+
Q,
|
|
663
390
|
" / ",
|
|
664
|
-
|
|
391
|
+
d
|
|
665
392
|
] }),
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ s("table", { style: t.gmTable, children: [
|
|
394
|
+
/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [
|
|
395
|
+
/* @__PURE__ */ o("th", { children: "Round" }),
|
|
396
|
+
/* @__PURE__ */ o("th", { children: "Your Answer" }),
|
|
397
|
+
/* @__PURE__ */ o("th", { children: "Correct" }),
|
|
398
|
+
/* @__PURE__ */ o("th", { children: "Result" })
|
|
672
399
|
] }) }),
|
|
673
|
-
/* @__PURE__ */
|
|
674
|
-
/* @__PURE__ */
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
/* @__PURE__ */
|
|
677
|
-
/* @__PURE__ */
|
|
678
|
-
] },
|
|
400
|
+
/* @__PURE__ */ o("tbody", { children: X.map((e, i) => /* @__PURE__ */ s("tr", { children: [
|
|
401
|
+
/* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.round }),
|
|
402
|
+
/* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.answer || "—" }),
|
|
403
|
+
/* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.correct }),
|
|
404
|
+
/* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
405
|
+
] }, i)) })
|
|
679
406
|
] }),
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ s("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
|
|
408
|
+
/* @__PURE__ */ o("button", { style: t.gmButton, onClick: $, children: "🔁 Play again" }),
|
|
409
|
+
/* @__PURE__ */ o("button", { style: t.gmButton, onClick: re, children: "⬅️ Choose theme" })
|
|
683
410
|
] })
|
|
684
411
|
] }),
|
|
685
|
-
|
|
686
|
-
/* @__PURE__ */
|
|
412
|
+
f && !w && /* @__PURE__ */ s("div", { style: t.gmGameLayout, children: [
|
|
413
|
+
/* @__PURE__ */ s(
|
|
687
414
|
"div",
|
|
688
415
|
{
|
|
689
416
|
style: {
|
|
@@ -694,33 +421,32 @@ function Re() {
|
|
|
694
421
|
alignItems: "center"
|
|
695
422
|
},
|
|
696
423
|
children: [
|
|
697
|
-
g === "ready" && /* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
424
|
+
g === "ready" && /* @__PURE__ */ s(O, { children: [
|
|
425
|
+
/* @__PURE__ */ o("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
|
|
426
|
+
/* @__PURE__ */ o("div", { style: t.gmHourglass, children: "⏳" })
|
|
700
427
|
] }),
|
|
701
|
-
g === "memorize" && /* @__PURE__ */
|
|
428
|
+
g === "memorize" && /* @__PURE__ */ s("p", { style: { ...t.gmBodyM, color: "#10b981" }, children: [
|
|
702
429
|
"MEMORIZE (",
|
|
703
|
-
|
|
430
|
+
v,
|
|
704
431
|
")"
|
|
705
432
|
] }),
|
|
706
|
-
g === "guess" && !
|
|
433
|
+
g === "guess" && !h && /* @__PURE__ */ s("p", { style: t.gmBodyM, children: [
|
|
707
434
|
"⏳ Time left: ",
|
|
708
|
-
|
|
435
|
+
z,
|
|
709
436
|
"s"
|
|
710
437
|
] })
|
|
711
438
|
]
|
|
712
439
|
}
|
|
713
440
|
),
|
|
714
|
-
g !== "ready" && /* @__PURE__ */
|
|
441
|
+
g !== "ready" && /* @__PURE__ */ o(
|
|
715
442
|
"div",
|
|
716
443
|
{
|
|
717
444
|
style: {
|
|
718
|
-
...
|
|
719
|
-
gridTemplateColumns:
|
|
720
|
-
gridAutoRows:
|
|
721
|
-
gap:
|
|
445
|
+
...t.gmGrid,
|
|
446
|
+
gridTemplateColumns: C ? "repeat(2, 1fr)" : "repeat(3, 210px)",
|
|
447
|
+
gridAutoRows: C ? "150px" : "210px",
|
|
448
|
+
gap: C ? "12px" : "20px",
|
|
722
449
|
justifyItems: "center",
|
|
723
|
-
// 🔹 увеличение только при >2000px
|
|
724
450
|
...window.innerWidth > 2e3 ? {
|
|
725
451
|
gridTemplateColumns: "repeat(3, 260px)",
|
|
726
452
|
gridAutoRows: "260px",
|
|
@@ -732,21 +458,21 @@ function Re() {
|
|
|
732
458
|
gap: "32px"
|
|
733
459
|
} : {}
|
|
734
460
|
},
|
|
735
|
-
children:
|
|
736
|
-
const
|
|
737
|
-
return /* @__PURE__ */
|
|
461
|
+
children: a.map((e, i) => {
|
|
462
|
+
const p = u === i && g === "guess" && !h;
|
|
463
|
+
return /* @__PURE__ */ o(
|
|
738
464
|
"div",
|
|
739
465
|
{
|
|
740
466
|
style: {
|
|
741
|
-
...
|
|
742
|
-
...
|
|
743
|
-
...
|
|
467
|
+
...t.gmCard,
|
|
468
|
+
...N === "correct" && u === i ? t.gmCorrect : {},
|
|
469
|
+
...N === "wrong" && u === i ? t.gmWrong : {}
|
|
744
470
|
},
|
|
745
|
-
children: !
|
|
471
|
+
children: !p && /* @__PURE__ */ o(
|
|
746
472
|
"img",
|
|
747
473
|
{
|
|
748
|
-
src:
|
|
749
|
-
alt:
|
|
474
|
+
src: e.src,
|
|
475
|
+
alt: e.name,
|
|
750
476
|
style: {
|
|
751
477
|
width: "100%",
|
|
752
478
|
height: "100%",
|
|
@@ -755,39 +481,39 @@ function Re() {
|
|
|
755
481
|
}
|
|
756
482
|
)
|
|
757
483
|
},
|
|
758
|
-
|
|
484
|
+
i
|
|
759
485
|
);
|
|
760
486
|
})
|
|
761
487
|
}
|
|
762
488
|
),
|
|
763
|
-
/* @__PURE__ */
|
|
764
|
-
g === "guess" && !
|
|
765
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ s("div", { style: { marginTop: 16, height: 80 }, children: [
|
|
490
|
+
g === "guess" && !h && /* @__PURE__ */ s("div", { children: [
|
|
491
|
+
/* @__PURE__ */ o(
|
|
766
492
|
"input",
|
|
767
493
|
{
|
|
768
494
|
type: "text",
|
|
769
495
|
placeholder: "Type the missing word",
|
|
770
|
-
value:
|
|
771
|
-
onChange: (
|
|
772
|
-
style:
|
|
496
|
+
value: k,
|
|
497
|
+
onChange: (e) => U(e.target.value),
|
|
498
|
+
style: t.gmInput
|
|
773
499
|
}
|
|
774
500
|
),
|
|
775
|
-
/* @__PURE__ */
|
|
501
|
+
/* @__PURE__ */ o(
|
|
776
502
|
"button",
|
|
777
503
|
{
|
|
778
|
-
style: { ...
|
|
779
|
-
onClick:
|
|
780
|
-
disabled:
|
|
781
|
-
children:
|
|
504
|
+
style: { ...t.gmButton, marginLeft: 8 },
|
|
505
|
+
onClick: oe,
|
|
506
|
+
disabled: H,
|
|
507
|
+
children: H ? "..." : "Check"
|
|
782
508
|
}
|
|
783
509
|
)
|
|
784
510
|
] }),
|
|
785
|
-
|
|
511
|
+
h && /* @__PURE__ */ o("button", { style: t.gmButton, onClick: ne, children: "Next round" })
|
|
786
512
|
] })
|
|
787
513
|
] })
|
|
788
514
|
] });
|
|
789
515
|
}
|
|
790
516
|
export {
|
|
791
|
-
|
|
792
|
-
|
|
517
|
+
xe as Game,
|
|
518
|
+
V as themes
|
|
793
519
|
};
|
package/package.json
CHANGED
package/src/Game.styles.ts
CHANGED
|
@@ -99,7 +99,7 @@ export const styles: Record<string, CSSProperties> = {
|
|
|
99
99
|
gmGameLayout: {
|
|
100
100
|
position: "relative",
|
|
101
101
|
width: "100%",
|
|
102
|
-
maxWidth: "600px",
|
|
102
|
+
maxWidth: "600px",
|
|
103
103
|
minHeight: "100vh",
|
|
104
104
|
display: "flex",
|
|
105
105
|
flexDirection: "column",
|
|
@@ -174,19 +174,21 @@ export const styles: Record<string, CSSProperties> = {
|
|
|
174
174
|
textOverflow: "ellipsis",
|
|
175
175
|
},
|
|
176
176
|
|
|
177
|
+
// ✅ Исправленный логотип: без белого фона, не ломает верстку
|
|
177
178
|
gmLogoFixed: {
|
|
178
|
-
position: "
|
|
179
|
+
position: "absolute",
|
|
179
180
|
top: "16px",
|
|
180
|
-
left: "
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
left: "24px",
|
|
182
|
+
width: "120px",
|
|
183
|
+
zIndex: 10,
|
|
184
|
+
pointerEvents: "none",
|
|
185
|
+
background: "transparent",
|
|
185
186
|
},
|
|
186
187
|
|
|
187
188
|
gmLogoImg: {
|
|
188
189
|
height: "clamp(28px, 5vw, 40px)",
|
|
189
190
|
width: "auto",
|
|
191
|
+
background: "transparent",
|
|
190
192
|
},
|
|
191
193
|
|
|
192
194
|
gmReadyWrapper: {
|
package/src/Game.tsx
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { useState, useEffect } from "react";
|
|
2
|
-
// логотип теперь в облаке, локальный импорт удаляем
|
|
1
|
+
import { useState, useEffect, useMemo } from "react";
|
|
3
2
|
import { themes } from "./themes";
|
|
4
3
|
import { styles } from "./Game.styles";
|
|
5
4
|
import type { Theme } from "./themes";
|
|
6
5
|
|
|
7
|
-
// если логотип всё-таки нужен в интерфейсе
|
|
8
6
|
const logo = window.origin + "/cloud/speakid/games/whatsmissing/logo.png";
|
|
7
|
+
|
|
9
8
|
type ImageItem = { src: string; name: string };
|
|
10
9
|
type RoundResult = {
|
|
11
10
|
round: number;
|
|
@@ -14,7 +13,6 @@ type RoundResult = {
|
|
|
14
13
|
result: "correct" | "almost" | "wrong";
|
|
15
14
|
};
|
|
16
15
|
|
|
17
|
-
// 🔹 встроенный глобальный reset (вместо index.css)
|
|
18
16
|
const globalReset = () => {
|
|
19
17
|
const style = document.createElement("style");
|
|
20
18
|
style.textContent = `
|
|
@@ -226,15 +224,19 @@ export default function Game() {
|
|
|
226
224
|
setTheme(null);
|
|
227
225
|
};
|
|
228
226
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
227
|
+
// ✅ мемоизированный логотип (больше не мигает)
|
|
228
|
+
const MemoizedLogo = useMemo(
|
|
229
|
+
() => (
|
|
230
|
+
<div style={styles.gmLogoFixed}>
|
|
231
|
+
<img src={logo} alt="SPEAKID Logo" style={styles.gmLogoImg} />
|
|
232
|
+
</div>
|
|
233
|
+
),
|
|
234
|
+
[]
|
|
233
235
|
);
|
|
234
236
|
|
|
235
237
|
return (
|
|
236
238
|
<>
|
|
237
|
-
{!isMobile &&
|
|
239
|
+
{!isMobile && MemoizedLogo}
|
|
238
240
|
|
|
239
241
|
{!theme && !started && (
|
|
240
242
|
<div style={styles.gmCenterScreen}>
|
|
@@ -355,7 +357,6 @@ export default function Game() {
|
|
|
355
357
|
gridAutoRows: isMobile ? "150px" : "210px",
|
|
356
358
|
gap: isMobile ? "12px" : "20px",
|
|
357
359
|
justifyItems: "center",
|
|
358
|
-
// 🔹 увеличение только при >2000px
|
|
359
360
|
...(window.innerWidth > 2000
|
|
360
361
|
? {
|
|
361
362
|
gridTemplateColumns: "repeat(3, 260px)",
|
|
@@ -373,7 +374,8 @@ export default function Game() {
|
|
|
373
374
|
}}
|
|
374
375
|
>
|
|
375
376
|
{files.map((file, i) => {
|
|
376
|
-
const isHidden =
|
|
377
|
+
const isHidden =
|
|
378
|
+
hiddenIndex === i && phase === "guess" && !answered;
|
|
377
379
|
return (
|
|
378
380
|
<div
|
|
379
381
|
key={i}
|
package/vite.config.ts
CHANGED
|
@@ -17,11 +17,12 @@ export default defineConfig({
|
|
|
17
17
|
lib: {
|
|
18
18
|
entry: "src/index.ts",
|
|
19
19
|
name: "WhatsMissing",
|
|
20
|
-
formats: ["es", "cjs"], // ✅
|
|
20
|
+
formats: ["es", "cjs"], // ✅ поддержка Webpack
|
|
21
21
|
fileName: (format) => `whats-missing.${format}.js`,
|
|
22
22
|
},
|
|
23
23
|
rollupOptions: {
|
|
24
|
-
|
|
24
|
+
// 🔥 добавлено "react/jsx-runtime"
|
|
25
|
+
external: ["react", "react-dom", "react/jsx-runtime"],
|
|
25
26
|
output: {
|
|
26
27
|
globals: {
|
|
27
28
|
react: "React",
|