@mblinkov/whats-missing 20.0.27 → 20.0.29
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 -3
- package/dist/whats-missing.es.js +244 -254
- package/package.json +1 -1
- package/src/Game.styles.ts +5 -2
- package/src/Game.tsx +255 -241
package/dist/whats-missing.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
const
|
|
4
|
-
src: `${
|
|
1
|
+
import { jsx as n, jsxs as l, Fragment as ke } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as J, useState as a, useEffect as _, useLayoutEffect as me, useMemo as ze } from "react";
|
|
3
|
+
const Me = window.origin + "/cloud/speakid/games/whatsmissing/", K = (r, u) => r.map(([s, o]) => ({
|
|
4
|
+
src: `${Me}${u}/${o.replace(/\s/g, "%20")}.png`,
|
|
5
5
|
name: o
|
|
6
|
-
})),
|
|
6
|
+
})), Se = [
|
|
7
7
|
["apple", "apple"],
|
|
8
8
|
["banana", "banana"],
|
|
9
9
|
["bread", "bread"],
|
|
@@ -29,7 +29,7 @@ const fe = window.origin + "/cloud/speakid/games/whatsmissing/", P = (i, g) => i
|
|
|
29
29
|
["strawberry", "strawberry"],
|
|
30
30
|
["tomato", "tomato"],
|
|
31
31
|
["watermelon", "watermelon"]
|
|
32
|
-
],
|
|
32
|
+
], Te = [
|
|
33
33
|
["bear", "bear"],
|
|
34
34
|
["cat", "cat"],
|
|
35
35
|
["crocodile", "crocodile"],
|
|
@@ -49,7 +49,7 @@ const fe = window.origin + "/cloud/speakid/games/whatsmissing/", P = (i, g) => i
|
|
|
49
49
|
["tortoise", "tortoise"],
|
|
50
50
|
["wolf", "wolf"],
|
|
51
51
|
["zebra", "zebra"]
|
|
52
|
-
],
|
|
52
|
+
], Re = [
|
|
53
53
|
["ball", "ball"],
|
|
54
54
|
["balloon", "balloon"],
|
|
55
55
|
["blocks", "blocks"],
|
|
@@ -69,23 +69,23 @@ const fe = window.origin + "/cloud/speakid/games/whatsmissing/", P = (i, g) => i
|
|
|
69
69
|
["teddy_bear", "teddy bear"],
|
|
70
70
|
["yo-yo", "yo-yo"],
|
|
71
71
|
["crayons", "crayons"]
|
|
72
|
-
],
|
|
73
|
-
food:
|
|
74
|
-
animals:
|
|
75
|
-
toys:
|
|
76
|
-
},
|
|
72
|
+
], ce = {
|
|
73
|
+
food: K(Se, "food"),
|
|
74
|
+
animals: K(Te, "animals"),
|
|
75
|
+
toys: K(Re, "toys")
|
|
76
|
+
}, Ie = `
|
|
77
77
|
@keyframes spin {
|
|
78
78
|
from { transform: rotate(0deg); }
|
|
79
79
|
to { transform: rotate(360deg); }
|
|
80
80
|
}
|
|
81
81
|
`;
|
|
82
82
|
if (typeof document < "u" && !document.getElementById("spin-keyframes")) {
|
|
83
|
-
const
|
|
84
|
-
|
|
83
|
+
const r = document.createElement("style");
|
|
84
|
+
r.id = "spin-keyframes", r.innerHTML = Ie, document.head.appendChild(r);
|
|
85
85
|
}
|
|
86
|
-
const
|
|
86
|
+
const He = {
|
|
87
87
|
animation: "spin 1.4s linear infinite"
|
|
88
|
-
},
|
|
88
|
+
}, t = {
|
|
89
89
|
gmCenterScreen: {
|
|
90
90
|
position: "relative",
|
|
91
91
|
zIndex: 1,
|
|
@@ -145,7 +145,8 @@ const ve = {
|
|
|
145
145
|
gmGameLayout: {
|
|
146
146
|
position: "relative",
|
|
147
147
|
width: "100%",
|
|
148
|
-
|
|
148
|
+
// allow the layout to expand within the square container for tablets/laptops
|
|
149
|
+
maxWidth: "none",
|
|
149
150
|
// should fill the parent square, not the full viewport
|
|
150
151
|
minHeight: "100%",
|
|
151
152
|
display: "flex",
|
|
@@ -159,9 +160,11 @@ const ve = {
|
|
|
159
160
|
},
|
|
160
161
|
gmGrid: {
|
|
161
162
|
width: "100%",
|
|
162
|
-
|
|
163
|
+
// let the grid use all available space; sizing is controlled in Game.tsx
|
|
164
|
+
maxWidth: "none",
|
|
163
165
|
margin: "0 auto",
|
|
164
166
|
display: "grid",
|
|
167
|
+
// defaults; overridden responsively in Game.tsx
|
|
165
168
|
gridTemplateColumns: "repeat(3, 210px)",
|
|
166
169
|
gridAutoRows: "210px",
|
|
167
170
|
gap: "20px",
|
|
@@ -236,176 +239,191 @@ const ve = {
|
|
|
236
239
|
},
|
|
237
240
|
gmHourglass: {
|
|
238
241
|
fontSize: "42px",
|
|
239
|
-
...
|
|
242
|
+
...He
|
|
240
243
|
}
|
|
241
|
-
},
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
+
}, Be = () => {
|
|
245
|
+
const r = document.createElement("style");
|
|
246
|
+
r.textContent = `
|
|
244
247
|
#whats-missing-root, #whats-missing-root * { box-sizing: border-box; }
|
|
245
248
|
#whats-missing-root img { max-width:100%; height:auto; display:block; user-select:none; }
|
|
246
|
-
`, document.head.appendChild(
|
|
247
|
-
},
|
|
248
|
-
const
|
|
249
|
-
for (let o = 0; o <=
|
|
250
|
-
for (let o = 0; o <=
|
|
251
|
-
for (let o = 1; o <=
|
|
252
|
-
for (let
|
|
253
|
-
|
|
254
|
-
return
|
|
249
|
+
`, document.head.appendChild(r);
|
|
250
|
+
}, Ae = (r, u) => {
|
|
251
|
+
const s = Array.from({ length: r.length + 1 }, () => Array(u.length + 1).fill(0));
|
|
252
|
+
for (let o = 0; o <= r.length; o++) s[o][0] = o;
|
|
253
|
+
for (let o = 0; o <= u.length; o++) s[0][o] = o;
|
|
254
|
+
for (let o = 1; o <= r.length; o++)
|
|
255
|
+
for (let c = 1; c <= u.length; c++)
|
|
256
|
+
s[o][c] = r[o - 1] === u[c - 1] ? s[o - 1][c - 1] : Math.min(s[o - 1][c - 1], s[o][c - 1], s[o - 1][c]) + 1;
|
|
257
|
+
return s[r.length][u.length];
|
|
255
258
|
};
|
|
256
|
-
function
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
if (typeof window > "u" || !
|
|
260
|
-
const
|
|
259
|
+
function Le(r, u = { minDesktopWidth: 1200, forceResize: !1 }) {
|
|
260
|
+
const s = J(null), o = u.minDesktopWidth ?? 1200, c = !!u.forceResize;
|
|
261
|
+
me(() => {
|
|
262
|
+
if (typeof window > "u" || !r || !r.current) return;
|
|
263
|
+
const m = r.current, H = () => {
|
|
261
264
|
try {
|
|
262
|
-
const d = document.body, h = getComputedStyle(d),
|
|
263
|
-
if (
|
|
265
|
+
const d = document.body, h = getComputedStyle(d), M = parseFloat(d.style && d.style.zoom || "");
|
|
266
|
+
if (M && !isNaN(M) && M > 0) return M;
|
|
264
267
|
const v = parseFloat(h.zoom || "");
|
|
265
268
|
if (v && !isNaN(v) && v > 0) return v;
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
if (document.documentElement.removeChild(
|
|
270
|
-
const
|
|
271
|
-
if (!isNaN(
|
|
269
|
+
const f = document.createElement("div");
|
|
270
|
+
f.style.position = "absolute", f.style.left = "0", f.style.top = "0", f.style.width = "100px", f.style.height = "1px", f.style.visibility = "hidden", document.documentElement.appendChild(f);
|
|
271
|
+
const y = f.getBoundingClientRect();
|
|
272
|
+
if (document.documentElement.removeChild(f), y && y.width > 0) {
|
|
273
|
+
const B = y.width / 100;
|
|
274
|
+
if (!isNaN(B) && B > 0) return B;
|
|
272
275
|
}
|
|
273
276
|
} catch {
|
|
274
277
|
}
|
|
275
278
|
return 1;
|
|
276
279
|
}, C = () => {
|
|
277
280
|
if (o && window.innerWidth < o) {
|
|
278
|
-
|
|
281
|
+
T();
|
|
279
282
|
return;
|
|
280
283
|
}
|
|
281
|
-
const d =
|
|
284
|
+
const d = H();
|
|
282
285
|
if (!d || d === 1) {
|
|
283
|
-
|
|
286
|
+
T();
|
|
284
287
|
return;
|
|
285
288
|
}
|
|
286
|
-
|
|
287
|
-
transform:
|
|
288
|
-
transformOrigin:
|
|
289
|
-
width:
|
|
290
|
-
height:
|
|
291
|
-
willChange:
|
|
289
|
+
s.current || (s.current = {
|
|
290
|
+
transform: m.style.transform || null,
|
|
291
|
+
transformOrigin: m.style.transformOrigin || null,
|
|
292
|
+
width: m.style.width || null,
|
|
293
|
+
height: m.style.height || null,
|
|
294
|
+
willChange: m.style.willChange || null
|
|
292
295
|
});
|
|
293
296
|
const h = 1 / d;
|
|
294
|
-
|
|
295
|
-
},
|
|
296
|
-
if (!
|
|
297
|
-
const d =
|
|
298
|
-
|
|
297
|
+
c && (m.style.width = `${d * 100}%`, m.style.height = `${d * 100}%`), m.style.transformOrigin = "50% 50%", m.style.transform = `scale(${h})`, m.style.willChange = "transform";
|
|
298
|
+
}, T = () => {
|
|
299
|
+
if (!s.current) return;
|
|
300
|
+
const d = s.current;
|
|
301
|
+
m.style.transform = d.transform ?? "", m.style.transformOrigin = d.transformOrigin ?? "", m.style.width = d.width ?? "", m.style.height = d.height ?? "", m.style.willChange = d.willChange ?? "", s.current = null;
|
|
299
302
|
};
|
|
300
|
-
let
|
|
301
|
-
const
|
|
302
|
-
cancelAnimationFrame(
|
|
303
|
-
},
|
|
303
|
+
let x = 0;
|
|
304
|
+
const k = () => {
|
|
305
|
+
cancelAnimationFrame(x), x = requestAnimationFrame(C);
|
|
306
|
+
}, z = new MutationObserver((d) => {
|
|
304
307
|
for (const h of d)
|
|
305
308
|
if (h.type === "attributes" && (h.attributeName === "style" || h.attributeName === "class")) {
|
|
306
|
-
|
|
309
|
+
k();
|
|
307
310
|
break;
|
|
308
311
|
}
|
|
309
312
|
});
|
|
310
|
-
return
|
|
311
|
-
cancelAnimationFrame(
|
|
313
|
+
return z.observe(document.body, { attributes: !0, attributeFilter: ["style", "class"] }), window.addEventListener("resize", k), k(), () => {
|
|
314
|
+
cancelAnimationFrame(x), z.disconnect(), window.removeEventListener("resize", k), T();
|
|
312
315
|
};
|
|
313
|
-
}, [
|
|
316
|
+
}, [r, o, c]);
|
|
314
317
|
}
|
|
315
|
-
function
|
|
316
|
-
gameCubeSize:
|
|
317
|
-
screenHeight:
|
|
318
|
-
screenWidth:
|
|
318
|
+
function Ge({
|
|
319
|
+
gameCubeSize: r,
|
|
320
|
+
screenHeight: u,
|
|
321
|
+
screenWidth: s
|
|
319
322
|
}) {
|
|
320
|
-
const o =
|
|
321
|
-
|
|
323
|
+
const o = J(null), c = J(null), [m, H] = a(null);
|
|
324
|
+
Le(o, { minDesktopWidth: 1200, forceResize: !1 }), _(() => (Be(), () => {
|
|
322
325
|
document.body.style.overflow = "";
|
|
323
326
|
}), []);
|
|
324
|
-
const [C,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
+
const [C, T] = a(null), [x, k] = a([]), [z, d] = a(4), [h, M] = a(!1), [v, f] = a(1), [y, B] = a(null), [b, E] = a("ready"), [Q, X] = a(3), [G, N] = a(10), [D, ee] = a(20), [ue, O] = a(0), [j, q] = a(!1), [F, te] = a(""), [R, Y] = a(!1), [P, ne] = a(!1), [oe, A] = a(null), [ge, U] = a([]), [he, ie] = a([]), [S, fe] = a(!1);
|
|
328
|
+
_(() => {
|
|
329
|
+
if (typeof window > "u") return;
|
|
330
|
+
const e = () => {
|
|
331
|
+
const i = s ?? window.innerWidth;
|
|
332
|
+
fe(i <= 768);
|
|
333
|
+
};
|
|
334
|
+
return e(), window.addEventListener("resize", e), window.addEventListener("orientationchange", e), () => {
|
|
335
|
+
window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e);
|
|
336
|
+
};
|
|
337
|
+
}, [s]), me(() => {
|
|
338
|
+
const e = c.current;
|
|
327
339
|
if (!e || typeof window > "u") return;
|
|
328
|
-
let
|
|
340
|
+
let i = null;
|
|
329
341
|
try {
|
|
330
|
-
|
|
331
|
-
for (const
|
|
332
|
-
const
|
|
333
|
-
|
|
342
|
+
i = new ResizeObserver((p) => {
|
|
343
|
+
for (const g of p) {
|
|
344
|
+
const w = g.contentRect;
|
|
345
|
+
H(Math.round(Math.min(w.width, w.height)));
|
|
334
346
|
}
|
|
335
|
-
}),
|
|
347
|
+
}), i.observe(e), H(Math.round(Math.min(e.clientWidth, e.clientHeight)));
|
|
336
348
|
} catch {
|
|
337
|
-
|
|
349
|
+
H(Math.round(Math.min(e.clientWidth, e.clientHeight)));
|
|
338
350
|
}
|
|
339
|
-
return () =>
|
|
340
|
-
}, [
|
|
341
|
-
const
|
|
351
|
+
return () => i?.disconnect();
|
|
352
|
+
}, [S]);
|
|
353
|
+
const re = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), se = () => {
|
|
342
354
|
if (!C) return;
|
|
343
|
-
const e =
|
|
344
|
-
|
|
345
|
-
},
|
|
346
|
-
const
|
|
347
|
-
let
|
|
348
|
-
for (;
|
|
349
|
-
|
|
350
|
-
|
|
355
|
+
const e = re(ce[C]);
|
|
356
|
+
k(e), M(!0), q(!1), f(1), O(0), U([]), ie([]), le(e, [], !0);
|
|
357
|
+
}, le = (e = x, i = he, p = !1) => {
|
|
358
|
+
const g = re(e.length ? e : ce[C]);
|
|
359
|
+
let w = Math.floor(Math.random() * g.length), I = g[w].name, L = 0;
|
|
360
|
+
for (; i.includes(I) && L < 20; )
|
|
361
|
+
w = Math.floor(Math.random() * g.length), I = g[w].name, L++;
|
|
362
|
+
k(g), B(w), ie([...i, I]), Y(!1), te(""), ee(20), A(null), p ? (E("ready"), X(3), N(10)) : (E("memorize"), N(10));
|
|
351
363
|
};
|
|
352
|
-
|
|
353
|
-
if (!(!h || j ||
|
|
354
|
-
if (
|
|
355
|
-
if (
|
|
364
|
+
_(() => {
|
|
365
|
+
if (!(!h || j || R)) {
|
|
366
|
+
if (b === "ready")
|
|
367
|
+
if (Q <= 0) E("memorize");
|
|
356
368
|
else {
|
|
357
|
-
const e = setTimeout(() =>
|
|
369
|
+
const e = setTimeout(() => X((i) => i - 1), 1e3);
|
|
358
370
|
return () => clearTimeout(e);
|
|
359
371
|
}
|
|
360
|
-
if (
|
|
361
|
-
if (
|
|
372
|
+
if (b === "memorize")
|
|
373
|
+
if (G <= 0) E("guess");
|
|
362
374
|
else {
|
|
363
|
-
const e = setTimeout(() =>
|
|
375
|
+
const e = setTimeout(() => N((i) => i - 1), 1e3);
|
|
364
376
|
return () => clearTimeout(e);
|
|
365
377
|
}
|
|
366
|
-
if (
|
|
367
|
-
if (
|
|
368
|
-
|
|
369
|
-
const
|
|
370
|
-
|
|
378
|
+
if (b === "guess") {
|
|
379
|
+
if (D <= 0) {
|
|
380
|
+
Y(!0), A("wrong");
|
|
381
|
+
const i = x[y].name;
|
|
382
|
+
U((p) => [
|
|
383
|
+
...p,
|
|
384
|
+
{ round: v, answer: F, correct: i, result: "wrong" }
|
|
385
|
+
]);
|
|
371
386
|
return;
|
|
372
387
|
}
|
|
373
|
-
const e = setTimeout(() =>
|
|
388
|
+
const e = setTimeout(() => ee((i) => i - 1), 1e3);
|
|
374
389
|
return () => clearTimeout(e);
|
|
375
390
|
}
|
|
376
391
|
}
|
|
377
|
-
}, [
|
|
378
|
-
const
|
|
379
|
-
if (
|
|
380
|
-
const e =
|
|
381
|
-
let
|
|
382
|
-
|
|
383
|
-
|
|
392
|
+
}, [b, Q, G, D, h, j, R, x, y, v, F]);
|
|
393
|
+
const pe = () => {
|
|
394
|
+
if (y === null || P) return;
|
|
395
|
+
const e = x[y].name, i = F.toLowerCase().trim();
|
|
396
|
+
let p = "wrong";
|
|
397
|
+
i === e ? (O((g) => g + 1), A("correct"), p = "correct") : Ae(i, e) === 1 ? (O((g) => g + 0.5), A("almost"), p = "almost") : (A("wrong"), p = "wrong"), U((g) => [...g, { round: v, answer: i, correct: e, result: p }]), ne(!0), setTimeout(() => {
|
|
398
|
+
ne(!1), Y(!0);
|
|
384
399
|
}, 600);
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
},
|
|
388
|
-
() => /* @__PURE__ */
|
|
389
|
-
/* @__PURE__ */
|
|
400
|
+
}, ye = () => v < z ? (f((e) => e + 1), le()) : q(!0), be = () => {
|
|
401
|
+
M(!1), q(!1), T(null);
|
|
402
|
+
}, we = ze(
|
|
403
|
+
() => /* @__PURE__ */ n("div", { style: { ...t.gmLogoFixed, position: "absolute", top: 16, left: 16, zIndex: 30 }, children: /* @__PURE__ */ l("picture", { children: [
|
|
404
|
+
/* @__PURE__ */ n(
|
|
390
405
|
"source",
|
|
391
406
|
{
|
|
392
407
|
srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg",
|
|
393
408
|
type: "image/svg+xml"
|
|
394
409
|
}
|
|
395
410
|
),
|
|
396
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ n(
|
|
397
412
|
"img",
|
|
398
413
|
{
|
|
399
414
|
src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png",
|
|
400
415
|
alt: "SPEAKID Logo",
|
|
401
|
-
style:
|
|
416
|
+
style: t.gmLogoImg,
|
|
402
417
|
loading: "lazy"
|
|
403
418
|
}
|
|
404
419
|
)
|
|
405
420
|
] }) }),
|
|
406
421
|
[]
|
|
407
|
-
)
|
|
408
|
-
|
|
422
|
+
), V = typeof window < "u" ? Math.min(
|
|
423
|
+
(s ?? window.innerWidth) / 1440,
|
|
424
|
+
(u ?? window.innerHeight) / 900
|
|
425
|
+
) : 1;
|
|
426
|
+
return /* @__PURE__ */ n(
|
|
409
427
|
"div",
|
|
410
428
|
{
|
|
411
429
|
ref: o,
|
|
@@ -416,63 +434,53 @@ function Me({
|
|
|
416
434
|
justifyContent: "center",
|
|
417
435
|
alignItems: "center",
|
|
418
436
|
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
419
|
-
transition: "background 0.3s ease",
|
|
420
437
|
overflow: "hidden",
|
|
421
|
-
zIndex: 1
|
|
422
|
-
pointerEvents: "auto"
|
|
438
|
+
zIndex: 1
|
|
423
439
|
},
|
|
424
|
-
children: /* @__PURE__ */
|
|
440
|
+
children: /* @__PURE__ */ n(
|
|
425
441
|
"div",
|
|
426
442
|
{
|
|
427
|
-
ref:
|
|
443
|
+
ref: c,
|
|
428
444
|
style: {
|
|
429
|
-
width:
|
|
430
|
-
height:
|
|
431
|
-
|
|
432
|
-
|
|
445
|
+
width: S ? "100%" : `${Math.min(r ?? 1e3, s ?? 1e3, u ?? 1e3)}px`,
|
|
446
|
+
height: S ? "100%" : `${Math.min(r ?? 1e3, s ?? 1e3, u ?? 1e3)}px`,
|
|
447
|
+
borderRadius: S ? 0 : "20px",
|
|
448
|
+
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
449
|
+
position: "relative",
|
|
450
|
+
overflow: "hidden",
|
|
451
|
+
boxShadow: S ? "none" : "0 0 40px rgba(0,0,0,0.08)",
|
|
433
452
|
display: "flex",
|
|
434
453
|
justifyContent: "center",
|
|
435
|
-
alignItems: "center"
|
|
436
|
-
overflow: "hidden",
|
|
437
|
-
borderRadius: k ? 0 : "20px",
|
|
438
|
-
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
|
|
439
|
-
boxShadow: k ? "none" : "0 0 40px rgba(0,0,0,0.08)",
|
|
440
|
-
position: "relative"
|
|
454
|
+
alignItems: "center"
|
|
441
455
|
},
|
|
442
|
-
children: /* @__PURE__ */
|
|
456
|
+
children: /* @__PURE__ */ l(
|
|
443
457
|
"div",
|
|
444
458
|
{
|
|
459
|
+
id: "whats-missing-root",
|
|
445
460
|
style: {
|
|
446
|
-
transform:
|
|
447
|
-
transformOrigin: "
|
|
448
|
-
width:
|
|
449
|
-
height:
|
|
461
|
+
transform: `scale(${V})`,
|
|
462
|
+
transformOrigin: "center center",
|
|
463
|
+
width: `${100 / V}%`,
|
|
464
|
+
height: `${100 / V}%`,
|
|
450
465
|
display: "flex",
|
|
466
|
+
flexDirection: "column",
|
|
451
467
|
justifyContent: "center",
|
|
452
468
|
alignItems: "center"
|
|
453
469
|
},
|
|
454
|
-
children:
|
|
455
|
-
!
|
|
456
|
-
!C && !h && /* @__PURE__ */
|
|
457
|
-
/* @__PURE__ */
|
|
458
|
-
/* @__PURE__ */
|
|
459
|
-
/* @__PURE__ */
|
|
460
|
-
|
|
461
|
-
{
|
|
462
|
-
|
|
463
|
-
onClick: () => M(e),
|
|
464
|
-
children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys"
|
|
465
|
-
},
|
|
466
|
-
e
|
|
467
|
-
)) }),
|
|
468
|
-
/* @__PURE__ */ s("div", { style: { marginTop: 24 }, children: [
|
|
469
|
-
/* @__PURE__ */ t("p", { style: n.gmBodyS, children: "Choose number of rounds:" }),
|
|
470
|
-
/* @__PURE__ */ t("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ t(
|
|
470
|
+
children: [
|
|
471
|
+
!S && we,
|
|
472
|
+
!C && !h && /* @__PURE__ */ l("div", { style: t.gmCenterScreen, children: [
|
|
473
|
+
/* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
|
|
474
|
+
/* @__PURE__ */ n("p", { style: t.gmBodyM, children: "Select a theme:" }),
|
|
475
|
+
/* @__PURE__ */ n("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ n("button", { style: t.gmButton, onClick: () => T(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
|
|
476
|
+
/* @__PURE__ */ l("div", { style: { marginTop: 24 }, children: [
|
|
477
|
+
/* @__PURE__ */ n("p", { style: t.gmBodyS, children: "Choose number of rounds:" }),
|
|
478
|
+
/* @__PURE__ */ n("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ n(
|
|
471
479
|
"button",
|
|
472
480
|
{
|
|
473
481
|
style: {
|
|
474
|
-
...
|
|
475
|
-
...
|
|
482
|
+
...t.gmButton,
|
|
483
|
+
...z === e ? t.gmButtonActive : {}
|
|
476
484
|
},
|
|
477
485
|
onClick: () => d(e),
|
|
478
486
|
children: e
|
|
@@ -481,47 +489,47 @@ function Me({
|
|
|
481
489
|
)) })
|
|
482
490
|
] })
|
|
483
491
|
] }),
|
|
484
|
-
C && !h && /* @__PURE__ */
|
|
485
|
-
/* @__PURE__ */
|
|
492
|
+
C && !h && /* @__PURE__ */ l("div", { style: t.gmCenterScreen, children: [
|
|
493
|
+
/* @__PURE__ */ l("h1", { style: t.gmHeadline1, children: [
|
|
486
494
|
"Theme selected: ",
|
|
487
495
|
C
|
|
488
496
|
] }),
|
|
489
|
-
/* @__PURE__ */
|
|
497
|
+
/* @__PURE__ */ l("p", { style: t.gmBodyM, children: [
|
|
490
498
|
"Rounds: ",
|
|
491
|
-
|
|
499
|
+
z
|
|
492
500
|
] }),
|
|
493
|
-
/* @__PURE__ */
|
|
501
|
+
/* @__PURE__ */ n("button", { style: t.gmButton, onClick: se, children: "▶ Start game" })
|
|
494
502
|
] }),
|
|
495
|
-
j && /* @__PURE__ */
|
|
496
|
-
/* @__PURE__ */
|
|
497
|
-
/* @__PURE__ */
|
|
503
|
+
j && /* @__PURE__ */ l("div", { style: t.gmCenterScreen, children: [
|
|
504
|
+
/* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "Results" }),
|
|
505
|
+
/* @__PURE__ */ l("h2", { style: t.gmHeadline3, children: [
|
|
498
506
|
"Your score: ",
|
|
499
|
-
|
|
507
|
+
ue,
|
|
500
508
|
" / ",
|
|
501
|
-
|
|
509
|
+
z
|
|
502
510
|
] }),
|
|
503
|
-
/* @__PURE__ */
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
/* @__PURE__ */
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
509
|
-
/* @__PURE__ */
|
|
511
|
+
/* @__PURE__ */ n("p", { style: { ...t.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
|
|
512
|
+
/* @__PURE__ */ l("table", { style: t.gmTable, children: [
|
|
513
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ l("tr", { children: [
|
|
514
|
+
/* @__PURE__ */ n("th", { children: "Round" }),
|
|
515
|
+
/* @__PURE__ */ n("th", { children: "Your Answer" }),
|
|
516
|
+
/* @__PURE__ */ n("th", { children: "Correct" }),
|
|
517
|
+
/* @__PURE__ */ n("th", { children: "Result" })
|
|
510
518
|
] }) }),
|
|
511
|
-
/* @__PURE__ */
|
|
512
|
-
/* @__PURE__ */
|
|
513
|
-
/* @__PURE__ */
|
|
514
|
-
/* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
] },
|
|
519
|
+
/* @__PURE__ */ n("tbody", { children: ge.map((e, i) => /* @__PURE__ */ l("tr", { children: [
|
|
520
|
+
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.round }),
|
|
521
|
+
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.answer || "—" }),
|
|
522
|
+
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.correct }),
|
|
523
|
+
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
524
|
+
] }, i)) })
|
|
517
525
|
] }),
|
|
518
|
-
/* @__PURE__ */
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
/* @__PURE__ */
|
|
526
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
|
|
527
|
+
/* @__PURE__ */ n("button", { style: t.gmButton, onClick: se, children: "🔁 Play again" }),
|
|
528
|
+
/* @__PURE__ */ n("button", { style: t.gmButton, onClick: be, children: "⬅️ Choose theme" })
|
|
521
529
|
] })
|
|
522
530
|
] }),
|
|
523
|
-
h && !j && /* @__PURE__ */
|
|
524
|
-
/* @__PURE__ */
|
|
531
|
+
h && !j && /* @__PURE__ */ l("div", { style: t.gmGameLayout, children: [
|
|
532
|
+
/* @__PURE__ */ l(
|
|
525
533
|
"div",
|
|
526
534
|
{
|
|
527
535
|
style: {
|
|
@@ -532,73 +540,63 @@ function Me({
|
|
|
532
540
|
alignItems: "center"
|
|
533
541
|
},
|
|
534
542
|
children: [
|
|
535
|
-
|
|
536
|
-
/* @__PURE__ */ t
|
|
537
|
-
|
|
538
|
-
{
|
|
539
|
-
style: { ...n.gmHeadline1, color: "#ec4c44" },
|
|
540
|
-
children: "GET READY"
|
|
541
|
-
}
|
|
542
|
-
),
|
|
543
|
-
/* @__PURE__ */ t("div", { style: n.gmHourglass, children: "⏳" })
|
|
543
|
+
b === "ready" && /* @__PURE__ */ l(ke, { children: [
|
|
544
|
+
/* @__PURE__ */ n("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
|
|
545
|
+
/* @__PURE__ */ n("div", { style: t.gmHourglass, children: "⏳" })
|
|
544
546
|
] }),
|
|
545
|
-
|
|
547
|
+
b === "memorize" && /* @__PURE__ */ l("p", { style: { ...t.gmBodyM, color: "#10b981" }, children: [
|
|
546
548
|
"MEMORIZE (",
|
|
547
|
-
|
|
549
|
+
G,
|
|
548
550
|
")"
|
|
549
551
|
] }),
|
|
550
|
-
|
|
552
|
+
b === "guess" && !R && /* @__PURE__ */ l("p", { style: t.gmBodyM, children: [
|
|
551
553
|
"⏳ Time left: ",
|
|
552
|
-
|
|
554
|
+
D,
|
|
553
555
|
"s"
|
|
554
556
|
] })
|
|
555
557
|
]
|
|
556
558
|
}
|
|
557
559
|
),
|
|
558
|
-
|
|
559
|
-
const e =
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
), m = k ? 2 : 3, y = Math.max(
|
|
565
|
-
90,
|
|
566
|
-
Math.floor(
|
|
567
|
-
(f - r - e * (m - 1)) / m
|
|
560
|
+
b !== "ready" && (() => {
|
|
561
|
+
const e = S ? 12 : 20, i = 32, p = c.current?.clientWidth ?? Math.min(r ?? 1e3, s ?? 1e3), g = c.current?.clientHeight ?? Math.min(r ?? 1e3, u ?? 1e3), w = Math.min(p, g), I = typeof window < "u" ? window.innerWidth : s ?? 1e3, L = I < 600 ? 110 : I < 1024 ? 140 : 180, xe = 4, ae = 2, Z = Math.max(
|
|
562
|
+
ae,
|
|
563
|
+
Math.min(
|
|
564
|
+
xe,
|
|
565
|
+
Math.floor((w - i + e) / (L + e)) || ae
|
|
568
566
|
)
|
|
569
|
-
);
|
|
570
|
-
return /* @__PURE__ */
|
|
567
|
+
), ve = Math.floor((w - i - e * (Z - 1)) / Z), W = Math.max(L, ve);
|
|
568
|
+
return /* @__PURE__ */ n(
|
|
571
569
|
"div",
|
|
572
570
|
{
|
|
573
571
|
style: {
|
|
574
|
-
...
|
|
575
|
-
gridTemplateColumns: `repeat(${
|
|
576
|
-
gridAutoRows: `${
|
|
572
|
+
...t.gmGrid,
|
|
573
|
+
gridTemplateColumns: `repeat(${Z}, ${W}px)`,
|
|
574
|
+
gridAutoRows: `${W}px`,
|
|
577
575
|
gap: `${e}px`,
|
|
578
576
|
justifyContent: "center",
|
|
579
577
|
justifyItems: "center",
|
|
580
578
|
padding: 8,
|
|
581
579
|
boxSizing: "border-box"
|
|
582
580
|
},
|
|
583
|
-
children:
|
|
584
|
-
const
|
|
585
|
-
return /* @__PURE__ */
|
|
581
|
+
children: x.map((de, $) => {
|
|
582
|
+
const Ce = y === $ && b === "guess" && !R;
|
|
583
|
+
return /* @__PURE__ */ n(
|
|
586
584
|
"div",
|
|
587
585
|
{
|
|
588
586
|
style: {
|
|
589
|
-
...
|
|
590
|
-
width: `${
|
|
591
|
-
height: `${
|
|
592
|
-
padding:
|
|
587
|
+
...t.gmCard,
|
|
588
|
+
width: `${W}px`,
|
|
589
|
+
height: `${W}px`,
|
|
590
|
+
padding: W >= 160 ? 10 : 8,
|
|
593
591
|
boxSizing: "border-box",
|
|
594
|
-
...
|
|
595
|
-
...
|
|
592
|
+
...oe === "correct" && y === $ ? t.gmCorrect : {},
|
|
593
|
+
...oe === "wrong" && y === $ ? t.gmWrong : {}
|
|
596
594
|
},
|
|
597
|
-
children: !
|
|
595
|
+
children: !Ce && /* @__PURE__ */ n(
|
|
598
596
|
"img",
|
|
599
597
|
{
|
|
600
|
-
src:
|
|
601
|
-
alt:
|
|
598
|
+
src: de.src,
|
|
599
|
+
alt: de.name,
|
|
602
600
|
style: {
|
|
603
601
|
width: "100%",
|
|
604
602
|
height: "100%",
|
|
@@ -608,46 +606,38 @@ function Me({
|
|
|
608
606
|
}
|
|
609
607
|
)
|
|
610
608
|
},
|
|
611
|
-
|
|
609
|
+
$
|
|
612
610
|
);
|
|
613
611
|
})
|
|
614
612
|
}
|
|
615
613
|
);
|
|
616
614
|
})(),
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
-
|
|
619
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ l("div", { style: { marginTop: 16, height: 80 }, children: [
|
|
616
|
+
b === "guess" && !R && /* @__PURE__ */ l("div", { children: [
|
|
617
|
+
/* @__PURE__ */ n(
|
|
620
618
|
"input",
|
|
621
619
|
{
|
|
622
620
|
type: "text",
|
|
623
621
|
placeholder: "Type the missing word",
|
|
624
|
-
value:
|
|
625
|
-
onChange: (e) =>
|
|
626
|
-
style:
|
|
622
|
+
value: F,
|
|
623
|
+
onChange: (e) => te(e.target.value),
|
|
624
|
+
style: t.gmInput
|
|
627
625
|
}
|
|
628
626
|
),
|
|
629
|
-
/* @__PURE__ */
|
|
627
|
+
/* @__PURE__ */ n(
|
|
630
628
|
"button",
|
|
631
629
|
{
|
|
632
|
-
style: { ...
|
|
633
|
-
onClick:
|
|
634
|
-
disabled:
|
|
635
|
-
children:
|
|
630
|
+
style: { ...t.gmButton, marginLeft: 8 },
|
|
631
|
+
onClick: pe,
|
|
632
|
+
disabled: P,
|
|
633
|
+
children: P ? "..." : "Check"
|
|
636
634
|
}
|
|
637
635
|
)
|
|
638
636
|
] }),
|
|
639
|
-
|
|
640
|
-
"button",
|
|
641
|
-
{
|
|
642
|
-
type: "button",
|
|
643
|
-
style: n.gmButton,
|
|
644
|
-
onClick: ce,
|
|
645
|
-
children: "Next round"
|
|
646
|
-
}
|
|
647
|
-
)
|
|
637
|
+
R && /* @__PURE__ */ n("button", { type: "button", style: t.gmButton, onClick: ye, children: "Next round" })
|
|
648
638
|
] })
|
|
649
639
|
] })
|
|
650
|
-
]
|
|
640
|
+
]
|
|
651
641
|
}
|
|
652
642
|
)
|
|
653
643
|
}
|
|
@@ -656,6 +646,6 @@ function Me({
|
|
|
656
646
|
);
|
|
657
647
|
}
|
|
658
648
|
export {
|
|
659
|
-
|
|
660
|
-
|
|
649
|
+
Ge as Game,
|
|
650
|
+
ce as themes
|
|
661
651
|
};
|