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