@mblinkov/whats-missing 20.0.9 → 20.0.12
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 -38
- package/dist/whats-missing.es.js +248 -293
- package/package.json +9 -3
- package/src/Game.tsx +220 -263
package/dist/whats-missing.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
const
|
|
4
|
-
src: `${
|
|
5
|
-
name:
|
|
6
|
-
})),
|
|
1
|
+
import { jsx as n, jsxs as r, Fragment as se } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as le, useEffect as j, useState as s, useMemo as ae } from "react";
|
|
3
|
+
const de = window.origin + "/cloud/speakid/games/whatsmissing/", W = (l, a) => l.map(([d, o]) => ({
|
|
4
|
+
src: `${de}${a}/${o.replace(/\s/g, "%20")}.png`,
|
|
5
|
+
name: o
|
|
6
|
+
})), ce = [
|
|
7
7
|
["apple", "apple"],
|
|
8
8
|
["banana", "banana"],
|
|
9
9
|
["bread", "bread"],
|
|
@@ -29,7 +29,7 @@ const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r
|
|
|
29
29
|
["strawberry", "strawberry"],
|
|
30
30
|
["tomato", "tomato"],
|
|
31
31
|
["watermelon", "watermelon"]
|
|
32
|
-
],
|
|
32
|
+
], me = [
|
|
33
33
|
["bear", "bear"],
|
|
34
34
|
["cat", "cat"],
|
|
35
35
|
["crocodile", "crocodile"],
|
|
@@ -49,7 +49,7 @@ const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r
|
|
|
49
49
|
["tortoise", "tortoise"],
|
|
50
50
|
["wolf", "wolf"],
|
|
51
51
|
["zebra", "zebra"]
|
|
52
|
-
],
|
|
52
|
+
], ge = [
|
|
53
53
|
["ball", "ball"],
|
|
54
54
|
["balloon", "balloon"],
|
|
55
55
|
["blocks", "blocks"],
|
|
@@ -69,21 +69,21 @@ const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r
|
|
|
69
69
|
["teddy_bear", "teddy bear"],
|
|
70
70
|
["yo-yo", "yo-yo"],
|
|
71
71
|
["crayons", "crayons"]
|
|
72
|
-
],
|
|
73
|
-
food: W(
|
|
74
|
-
animals: W(
|
|
75
|
-
toys: W(
|
|
76
|
-
},
|
|
72
|
+
], O = {
|
|
73
|
+
food: W(ce, "food"),
|
|
74
|
+
animals: W(me, "animals"),
|
|
75
|
+
toys: W(ge, "toys")
|
|
76
|
+
}, he = `
|
|
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 l = document.createElement("style");
|
|
84
|
+
l.id = "spin-keyframes", l.innerHTML = he, document.head.appendChild(l);
|
|
85
85
|
}
|
|
86
|
-
const
|
|
86
|
+
const pe = {
|
|
87
87
|
animation: "spin 1.4s linear infinite"
|
|
88
88
|
}, t = {
|
|
89
89
|
gmCenterScreen: {
|
|
@@ -233,327 +233,282 @@ const ge = {
|
|
|
233
233
|
},
|
|
234
234
|
gmHourglass: {
|
|
235
235
|
fontSize: "42px",
|
|
236
|
-
...
|
|
236
|
+
...pe
|
|
237
237
|
}
|
|
238
|
-
},
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
html, body {
|
|
242
|
-
margin: 0;
|
|
243
|
-
padding: 0;
|
|
244
|
-
width: 100%;
|
|
245
|
-
height: 100%;
|
|
246
|
-
overflow-x: hidden;
|
|
247
|
-
background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
|
|
248
|
-
background-repeat: no-repeat;
|
|
249
|
-
background-attachment: fixed;
|
|
250
|
-
background-size: cover;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
#whats-missing-root {
|
|
254
|
-
all: unset;
|
|
255
|
-
display: block;
|
|
256
|
-
position: relative;
|
|
257
|
-
left: 0;
|
|
258
|
-
top: 0;
|
|
259
|
-
overflow: hidden;
|
|
260
|
-
width: 100%;
|
|
261
|
-
min-height: 100vh;
|
|
262
|
-
margin: 0;
|
|
263
|
-
padding: 0;
|
|
264
|
-
color: #1f2937;
|
|
265
|
-
text-align: center;
|
|
266
|
-
background: linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%);
|
|
267
|
-
background-size: cover;
|
|
268
|
-
}
|
|
269
|
-
|
|
238
|
+
}, ue = () => {
|
|
239
|
+
const l = document.createElement("style");
|
|
240
|
+
l.textContent = `
|
|
270
241
|
#whats-missing-root, #whats-missing-root * {
|
|
271
242
|
box-sizing: border-box;
|
|
272
243
|
font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
|
|
273
244
|
}
|
|
274
|
-
|
|
275
245
|
#whats-missing-root img {
|
|
276
246
|
max-width: 100%;
|
|
277
247
|
height: auto;
|
|
278
248
|
display: block;
|
|
279
249
|
user-select: none;
|
|
280
250
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
for (let n = 0; n <= m.length; n++) a[0][n] = n;
|
|
291
|
-
for (let n = 1; n <= r.length; n++)
|
|
292
|
-
for (let d = 1; d <= m.length; d++)
|
|
293
|
-
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;
|
|
294
|
-
return a[r.length][m.length];
|
|
251
|
+
`, document.head.appendChild(l);
|
|
252
|
+
}, fe = (l, a) => {
|
|
253
|
+
const d = Array.from({ length: l.length + 1 }, () => Array(a.length + 1).fill(0));
|
|
254
|
+
for (let o = 0; o <= l.length; o++) d[o][0] = o;
|
|
255
|
+
for (let o = 0; o <= a.length; o++) d[0][o] = o;
|
|
256
|
+
for (let o = 1; o <= l.length; o++)
|
|
257
|
+
for (let c = 1; c <= a.length; c++)
|
|
258
|
+
d[o][c] = l[o - 1] === a[c - 1] ? d[o - 1][c - 1] : Math.min(d[o - 1][c - 1], d[o][c - 1], d[o - 1][c]) + 1;
|
|
259
|
+
return d[l.length][a.length];
|
|
295
260
|
};
|
|
296
|
-
function
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
261
|
+
function be() {
|
|
262
|
+
const l = le(null);
|
|
263
|
+
j(() => (ue(), () => {
|
|
264
|
+
document.body.style.overflow = "";
|
|
265
|
+
}), []);
|
|
266
|
+
const [a, d] = s(null), [o, c] = s([]), [x, Z] = s(4), [f, E] = s(!1), [b, G] = s(1), [p, J] = s(null), [g, w] = s("ready"), [F, D] = s(3), [S, z] = s(10), [R, Y] = s(20), [Q, I] = s(0), [k, H] = s(!1), [v, U] = s(""), [u, M] = s(!1), [A, N] = s(!1), [P, y] = s(null), [X, B] = s([]), [ee, V] = s([]), [C, te] = s(!1);
|
|
267
|
+
j(() => {
|
|
268
|
+
const e = () => te(window.innerWidth < 768);
|
|
303
269
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
304
270
|
}, []);
|
|
305
|
-
const
|
|
306
|
-
if (!
|
|
307
|
-
const e =
|
|
308
|
-
|
|
309
|
-
},
|
|
310
|
-
const
|
|
311
|
-
let
|
|
312
|
-
for (; i.includes(
|
|
313
|
-
|
|
314
|
-
|
|
271
|
+
const _ = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), $ = () => {
|
|
272
|
+
if (!a) return;
|
|
273
|
+
const e = _(O[a]);
|
|
274
|
+
c(e), E(!0), H(!1), G(1), I(0), B([]), V([]), q(e, [], !0);
|
|
275
|
+
}, q = (e = o, i = ee, h = !1) => {
|
|
276
|
+
const m = _(e.length ? e : O[a]);
|
|
277
|
+
let T = Math.floor(Math.random() * m.length), L = m[T].name, K = 0;
|
|
278
|
+
for (; i.includes(L) && K < 20; )
|
|
279
|
+
T = Math.floor(Math.random() * m.length), L = m[T].name, K++;
|
|
280
|
+
c(m), J(T), V([...i, L]), M(!1), U(""), Y(20), y(null), h ? (w("ready"), D(3), z(10)) : (w("memorize"), z(10));
|
|
315
281
|
};
|
|
316
|
-
|
|
317
|
-
if (!(!f ||
|
|
282
|
+
j(() => {
|
|
283
|
+
if (!(!f || k || u)) {
|
|
318
284
|
if (g === "ready")
|
|
319
|
-
if (
|
|
320
|
-
b("memorize");
|
|
285
|
+
if (F <= 0) w("memorize");
|
|
321
286
|
else {
|
|
322
|
-
const e = setTimeout(() =>
|
|
287
|
+
const e = setTimeout(() => D((i) => i - 1), 1e3);
|
|
323
288
|
return () => clearTimeout(e);
|
|
324
289
|
}
|
|
325
290
|
if (g === "memorize")
|
|
326
|
-
if (
|
|
327
|
-
b("guess");
|
|
291
|
+
if (S <= 0) w("guess");
|
|
328
292
|
else {
|
|
329
|
-
const e = setTimeout(() =>
|
|
293
|
+
const e = setTimeout(() => z((i) => i - 1), 1e3);
|
|
330
294
|
return () => clearTimeout(e);
|
|
331
295
|
}
|
|
332
296
|
if (g === "guess") {
|
|
333
|
-
if (
|
|
334
|
-
|
|
335
|
-
const i =
|
|
336
|
-
|
|
337
|
-
...
|
|
338
|
-
{ round:
|
|
297
|
+
if (R <= 0) {
|
|
298
|
+
M(!0), y("wrong");
|
|
299
|
+
const i = o[p].name;
|
|
300
|
+
B((h) => [
|
|
301
|
+
...h,
|
|
302
|
+
{ round: b, answer: v, correct: i, result: "wrong" }
|
|
339
303
|
]);
|
|
340
304
|
return;
|
|
341
305
|
}
|
|
342
|
-
const e = setTimeout(() =>
|
|
306
|
+
const e = setTimeout(() => Y((i) => i - 1), 1e3);
|
|
343
307
|
return () => clearTimeout(e);
|
|
344
308
|
}
|
|
345
309
|
}
|
|
346
|
-
}, [
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
u,
|
|
354
|
-
a,
|
|
355
|
-
h,
|
|
356
|
-
x,
|
|
357
|
-
k
|
|
358
|
-
]);
|
|
359
|
-
const te = () => {
|
|
360
|
-
if (h === null || H) return;
|
|
361
|
-
const e = a[h].name, i = k.toLowerCase().trim();
|
|
362
|
-
let p = "wrong";
|
|
363
|
-
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) => [
|
|
364
|
-
...c,
|
|
365
|
-
{ round: x, answer: i, correct: e, result: p }
|
|
366
|
-
]), Y(!0), setTimeout(() => {
|
|
367
|
-
Y(!1), A(!0);
|
|
310
|
+
}, [g, F, S, R, f, k, u, o, p, b, v]);
|
|
311
|
+
const ne = () => {
|
|
312
|
+
if (p === null || A) return;
|
|
313
|
+
const e = o[p].name, i = v.toLowerCase().trim();
|
|
314
|
+
let h = "wrong";
|
|
315
|
+
i === e ? (I((m) => m + 1), y("correct"), h = "correct") : fe(i, e) === 1 ? (I((m) => m + 0.5), y("almost"), h = "almost") : (y("wrong"), h = "wrong"), B((m) => [...m, { round: b, answer: i, correct: e, result: h }]), N(!0), setTimeout(() => {
|
|
316
|
+
N(!1), M(!0);
|
|
368
317
|
}, 600);
|
|
369
|
-
}, oe = () =>
|
|
370
|
-
|
|
371
|
-
}, re =
|
|
372
|
-
() => /* @__PURE__ */
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
-
|
|
375
|
-
{
|
|
376
|
-
srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg",
|
|
377
|
-
type: "image/svg+xml"
|
|
378
|
-
}
|
|
379
|
-
),
|
|
380
|
-
/* @__PURE__ */ o(
|
|
381
|
-
"img",
|
|
382
|
-
{
|
|
383
|
-
src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png",
|
|
384
|
-
alt: "SPEAKID Logo",
|
|
385
|
-
style: t.gmLogoImg,
|
|
386
|
-
loading: "lazy"
|
|
387
|
-
}
|
|
388
|
-
)
|
|
318
|
+
}, oe = () => b < x ? (G((e) => e + 1), q()) : H(!0), ie = () => {
|
|
319
|
+
E(!1), H(!1), d(null);
|
|
320
|
+
}, re = ae(
|
|
321
|
+
() => /* @__PURE__ */ n("div", { style: t.gmLogoFixed, children: /* @__PURE__ */ r("picture", { children: [
|
|
322
|
+
/* @__PURE__ */ n("source", { srcSet: window.origin + "/cloud/speakid/games/whatsmissing/logo.svg", type: "image/svg+xml" }),
|
|
323
|
+
/* @__PURE__ */ n("img", { src: window.origin + "/cloud/speakid/games/whatsmissing/logo.png", alt: "SPEAKID Logo", style: t.gmLogoImg, loading: "lazy" })
|
|
389
324
|
] }) }),
|
|
390
325
|
[]
|
|
391
326
|
);
|
|
392
|
-
return /* @__PURE__ */
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
...d === e ? t.gmButtonActive : {}
|
|
406
|
-
},
|
|
407
|
-
onClick: () => O(e),
|
|
408
|
-
children: e
|
|
409
|
-
},
|
|
410
|
-
e
|
|
411
|
-
)) })
|
|
412
|
-
] })
|
|
413
|
-
] }),
|
|
414
|
-
r && !f && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
|
|
415
|
-
/* @__PURE__ */ s("h1", { style: t.gmHeadline1, children: [
|
|
416
|
-
"Theme selected: ",
|
|
417
|
-
r
|
|
418
|
-
] }),
|
|
419
|
-
/* @__PURE__ */ s("p", { style: t.gmBodyM, children: [
|
|
420
|
-
"Rounds: ",
|
|
421
|
-
d
|
|
422
|
-
] }),
|
|
423
|
-
/* @__PURE__ */ o("button", { style: t.gmButton, onClick: _, children: "▶ Start game" })
|
|
424
|
-
] }),
|
|
425
|
-
w && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
|
|
426
|
-
/* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "Results" }),
|
|
427
|
-
/* @__PURE__ */ s("h2", { style: t.gmHeadline3, children: [
|
|
428
|
-
"Your score: ",
|
|
429
|
-
J,
|
|
430
|
-
" / ",
|
|
431
|
-
d
|
|
432
|
-
] }),
|
|
433
|
-
/* @__PURE__ */ s("table", { style: t.gmTable, children: [
|
|
434
|
-
/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ s("tr", { children: [
|
|
435
|
-
/* @__PURE__ */ o("th", { children: "Round" }),
|
|
436
|
-
/* @__PURE__ */ o("th", { children: "Your Answer" }),
|
|
437
|
-
/* @__PURE__ */ o("th", { children: "Correct" }),
|
|
438
|
-
/* @__PURE__ */ o("th", { children: "Result" })
|
|
439
|
-
] }) }),
|
|
440
|
-
/* @__PURE__ */ o("tbody", { children: Q.map((e, i) => /* @__PURE__ */ s("tr", { children: [
|
|
441
|
-
/* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.round }),
|
|
442
|
-
/* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.answer || "—" }),
|
|
443
|
-
/* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.correct }),
|
|
444
|
-
/* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
445
|
-
] }, i)) })
|
|
446
|
-
] }),
|
|
447
|
-
/* @__PURE__ */ s("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
|
|
448
|
-
/* @__PURE__ */ o("button", { style: t.gmButton, onClick: _, children: "🔁 Play again" }),
|
|
449
|
-
/* @__PURE__ */ o("button", { style: t.gmButton, onClick: ne, children: "⬅️ Choose theme" })
|
|
450
|
-
] })
|
|
451
|
-
] }),
|
|
452
|
-
f && !w && /* @__PURE__ */ s("div", { style: t.gmGameLayout, children: [
|
|
453
|
-
/* @__PURE__ */ s(
|
|
327
|
+
return /* @__PURE__ */ n(
|
|
328
|
+
"div",
|
|
329
|
+
{
|
|
330
|
+
ref: l,
|
|
331
|
+
style: {
|
|
332
|
+
display: "flex",
|
|
333
|
+
justifyContent: "center",
|
|
334
|
+
alignItems: "center",
|
|
335
|
+
width: "100%",
|
|
336
|
+
height: "100%",
|
|
337
|
+
overflow: "hidden"
|
|
338
|
+
},
|
|
339
|
+
children: /* @__PURE__ */ n(
|
|
454
340
|
"div",
|
|
455
341
|
{
|
|
456
342
|
style: {
|
|
457
|
-
|
|
343
|
+
width: window.innerWidth > window.innerHeight ? "90vh" : "90vw",
|
|
344
|
+
height: window.innerWidth > window.innerHeight ? "90vh" : "90vw",
|
|
458
345
|
display: "flex",
|
|
459
|
-
flexDirection: "column",
|
|
460
346
|
justifyContent: "center",
|
|
461
|
-
alignItems: "center"
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
/* @__PURE__ */ o("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
|
|
466
|
-
/* @__PURE__ */ o("div", { style: t.gmHourglass, children: "⏳" })
|
|
467
|
-
] }),
|
|
468
|
-
g === "memorize" && /* @__PURE__ */ s("p", { style: { ...t.gmBodyM, color: "#10b981" }, children: [
|
|
469
|
-
"MEMORIZE (",
|
|
470
|
-
T,
|
|
471
|
-
")"
|
|
472
|
-
] }),
|
|
473
|
-
g === "guess" && !u && /* @__PURE__ */ s("p", { style: t.gmBodyM, children: [
|
|
474
|
-
"⏳ Time left: ",
|
|
475
|
-
z,
|
|
476
|
-
"s"
|
|
477
|
-
] })
|
|
478
|
-
]
|
|
479
|
-
}
|
|
480
|
-
),
|
|
481
|
-
g !== "ready" && /* @__PURE__ */ o(
|
|
482
|
-
"div",
|
|
483
|
-
{
|
|
484
|
-
style: {
|
|
485
|
-
...t.gmGrid,
|
|
486
|
-
gridTemplateColumns: v ? "repeat(2, 1fr)" : "repeat(3, 210px)",
|
|
487
|
-
gridAutoRows: v ? "150px" : "210px",
|
|
488
|
-
gap: v ? "12px" : "20px",
|
|
489
|
-
justifyItems: "center",
|
|
490
|
-
...window.innerWidth > 2e3 ? {
|
|
491
|
-
gridTemplateColumns: "repeat(3, 260px)",
|
|
492
|
-
gridAutoRows: "260px",
|
|
493
|
-
gap: "28px"
|
|
494
|
-
} : {},
|
|
495
|
-
...window.innerWidth > 2560 ? {
|
|
496
|
-
gridTemplateColumns: "repeat(3, 300px)",
|
|
497
|
-
gridAutoRows: "300px",
|
|
498
|
-
gap: "32px"
|
|
499
|
-
} : {}
|
|
347
|
+
alignItems: "center",
|
|
348
|
+
flexDirection: "column",
|
|
349
|
+
borderRadius: "20px",
|
|
350
|
+
background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)"
|
|
500
351
|
},
|
|
501
|
-
children:
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
"
|
|
505
|
-
{
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
children: !p && /* @__PURE__ */ o(
|
|
512
|
-
"img",
|
|
352
|
+
children: /* @__PURE__ */ r("div", { id: "whats-missing-root", children: [
|
|
353
|
+
!C && re,
|
|
354
|
+
!a && !f && /* @__PURE__ */ r("div", { style: t.gmCenterScreen, children: [
|
|
355
|
+
/* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
|
|
356
|
+
/* @__PURE__ */ n("p", { style: t.gmBodyM, children: "Select a theme:" }),
|
|
357
|
+
/* @__PURE__ */ n("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ n("button", { style: t.gmButton, onClick: () => d(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
|
|
358
|
+
/* @__PURE__ */ r("div", { style: { marginTop: 24 }, children: [
|
|
359
|
+
/* @__PURE__ */ n("p", { style: t.gmBodyS, children: "Choose number of rounds:" }),
|
|
360
|
+
/* @__PURE__ */ n("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ n(
|
|
361
|
+
"button",
|
|
513
362
|
{
|
|
514
|
-
src: e.src,
|
|
515
|
-
alt: e.name,
|
|
516
363
|
style: {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
364
|
+
...t.gmButton,
|
|
365
|
+
...x === e ? t.gmButtonActive : {}
|
|
366
|
+
},
|
|
367
|
+
onClick: () => Z(e),
|
|
368
|
+
children: e
|
|
369
|
+
},
|
|
370
|
+
e
|
|
371
|
+
)) })
|
|
372
|
+
] })
|
|
373
|
+
] }),
|
|
374
|
+
a && !f && /* @__PURE__ */ r("div", { style: t.gmCenterScreen, children: [
|
|
375
|
+
/* @__PURE__ */ r("h1", { style: t.gmHeadline1, children: [
|
|
376
|
+
"Theme selected: ",
|
|
377
|
+
a
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ r("p", { style: t.gmBodyM, children: [
|
|
380
|
+
"Rounds: ",
|
|
381
|
+
x
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ n("button", { style: t.gmButton, onClick: $, children: "▶ Start game" })
|
|
384
|
+
] }),
|
|
385
|
+
k && /* @__PURE__ */ r("div", { style: t.gmCenterScreen, children: [
|
|
386
|
+
/* @__PURE__ */ n("h1", { style: t.gmHeadline1, children: "Results" }),
|
|
387
|
+
/* @__PURE__ */ r("h2", { style: t.gmHeadline3, children: [
|
|
388
|
+
"Your score: ",
|
|
389
|
+
Q,
|
|
390
|
+
" / ",
|
|
391
|
+
x
|
|
392
|
+
] }),
|
|
393
|
+
/* @__PURE__ */ n("p", { style: { ...t.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
|
|
394
|
+
/* @__PURE__ */ r("table", { style: t.gmTable, children: [
|
|
395
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ r("tr", { children: [
|
|
396
|
+
/* @__PURE__ */ n("th", { children: "Round" }),
|
|
397
|
+
/* @__PURE__ */ n("th", { children: "Your Answer" }),
|
|
398
|
+
/* @__PURE__ */ n("th", { children: "Correct" }),
|
|
399
|
+
/* @__PURE__ */ n("th", { children: "Result" })
|
|
400
|
+
] }) }),
|
|
401
|
+
/* @__PURE__ */ n("tbody", { children: X.map((e, i) => /* @__PURE__ */ r("tr", { children: [
|
|
402
|
+
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.round }),
|
|
403
|
+
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.answer || "—" }),
|
|
404
|
+
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.correct }),
|
|
405
|
+
/* @__PURE__ */ n("td", { style: t.gmTableCell, children: e.result === "correct" ? "✔ Correct" : e.result === "almost" ? "◐ Almost (0.5)" : "✘ Wrong" })
|
|
406
|
+
] }, i)) })
|
|
407
|
+
] }),
|
|
408
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
|
|
409
|
+
/* @__PURE__ */ n("button", { style: t.gmButton, onClick: $, children: "🔁 Play again" }),
|
|
410
|
+
/* @__PURE__ */ n("button", { style: t.gmButton, onClick: ie, children: "⬅️ Choose theme" })
|
|
411
|
+
] })
|
|
412
|
+
] }),
|
|
413
|
+
f && !k && /* @__PURE__ */ r("div", { style: t.gmGameLayout, children: [
|
|
414
|
+
/* @__PURE__ */ r(
|
|
415
|
+
"div",
|
|
416
|
+
{
|
|
417
|
+
style: {
|
|
418
|
+
minHeight: 160,
|
|
419
|
+
display: "flex",
|
|
420
|
+
flexDirection: "column",
|
|
421
|
+
justifyContent: "center",
|
|
422
|
+
alignItems: "center"
|
|
423
|
+
},
|
|
424
|
+
children: [
|
|
425
|
+
g === "ready" && /* @__PURE__ */ r(se, { children: [
|
|
426
|
+
/* @__PURE__ */ n("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
|
|
427
|
+
/* @__PURE__ */ n("div", { style: t.gmHourglass, children: "⏳" })
|
|
428
|
+
] }),
|
|
429
|
+
g === "memorize" && /* @__PURE__ */ r("p", { style: { ...t.gmBodyM, color: "#10b981" }, children: [
|
|
430
|
+
"MEMORIZE (",
|
|
431
|
+
S,
|
|
432
|
+
")"
|
|
433
|
+
] }),
|
|
434
|
+
g === "guess" && !u && /* @__PURE__ */ r("p", { style: t.gmBodyM, children: [
|
|
435
|
+
"⏳ Time left: ",
|
|
436
|
+
R,
|
|
437
|
+
"s"
|
|
438
|
+
] })
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
),
|
|
442
|
+
g !== "ready" && /* @__PURE__ */ n(
|
|
443
|
+
"div",
|
|
444
|
+
{
|
|
445
|
+
style: {
|
|
446
|
+
...t.gmGrid,
|
|
447
|
+
gridTemplateColumns: C ? "repeat(2, 1fr)" : "repeat(3, 210px)",
|
|
448
|
+
gridAutoRows: C ? "150px" : "210px",
|
|
449
|
+
gap: C ? "12px" : "20px",
|
|
450
|
+
justifyItems: "center"
|
|
451
|
+
},
|
|
452
|
+
children: o.map((e, i) => {
|
|
453
|
+
const h = p === i && g === "guess" && !u;
|
|
454
|
+
return /* @__PURE__ */ n(
|
|
455
|
+
"div",
|
|
456
|
+
{
|
|
457
|
+
style: {
|
|
458
|
+
...t.gmCard,
|
|
459
|
+
...P === "correct" && p === i ? t.gmCorrect : {},
|
|
460
|
+
...P === "wrong" && p === i ? t.gmWrong : {}
|
|
461
|
+
},
|
|
462
|
+
children: !h && /* @__PURE__ */ n(
|
|
463
|
+
"img",
|
|
464
|
+
{
|
|
465
|
+
src: e.src,
|
|
466
|
+
alt: e.name,
|
|
467
|
+
style: {
|
|
468
|
+
width: "100%",
|
|
469
|
+
height: "100%",
|
|
470
|
+
objectFit: "cover"
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
)
|
|
474
|
+
},
|
|
475
|
+
i
|
|
476
|
+
);
|
|
477
|
+
})
|
|
478
|
+
}
|
|
479
|
+
),
|
|
480
|
+
/* @__PURE__ */ r("div", { style: { marginTop: 16, height: 80 }, children: [
|
|
481
|
+
g === "guess" && !u && /* @__PURE__ */ r("div", { children: [
|
|
482
|
+
/* @__PURE__ */ n(
|
|
483
|
+
"input",
|
|
484
|
+
{
|
|
485
|
+
type: "text",
|
|
486
|
+
placeholder: "Type the missing word",
|
|
487
|
+
value: v,
|
|
488
|
+
onChange: (e) => U(e.target.value),
|
|
489
|
+
style: t.gmInput
|
|
520
490
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
491
|
+
),
|
|
492
|
+
/* @__PURE__ */ n(
|
|
493
|
+
"button",
|
|
494
|
+
{
|
|
495
|
+
style: { ...t.gmButton, marginLeft: 8 },
|
|
496
|
+
onClick: ne,
|
|
497
|
+
disabled: A,
|
|
498
|
+
children: A ? "..." : "Check"
|
|
499
|
+
}
|
|
500
|
+
)
|
|
501
|
+
] }),
|
|
502
|
+
u && /* @__PURE__ */ n("button", { style: t.gmButton, onClick: oe, children: "Next round" })
|
|
503
|
+
] })
|
|
504
|
+
] })
|
|
505
|
+
] })
|
|
527
506
|
}
|
|
528
|
-
)
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
/* @__PURE__ */ o(
|
|
532
|
-
"input",
|
|
533
|
-
{
|
|
534
|
-
type: "text",
|
|
535
|
-
placeholder: "Type the missing word",
|
|
536
|
-
value: k,
|
|
537
|
-
onChange: (e) => U(e.target.value),
|
|
538
|
-
style: t.gmInput
|
|
539
|
-
}
|
|
540
|
-
),
|
|
541
|
-
/* @__PURE__ */ o(
|
|
542
|
-
"button",
|
|
543
|
-
{
|
|
544
|
-
style: { ...t.gmButton, marginLeft: 8 },
|
|
545
|
-
onClick: te,
|
|
546
|
-
disabled: H,
|
|
547
|
-
children: H ? "..." : "Check"
|
|
548
|
-
}
|
|
549
|
-
)
|
|
550
|
-
] }),
|
|
551
|
-
u && /* @__PURE__ */ o("button", { style: t.gmButton, onClick: oe, children: "Next round" })
|
|
552
|
-
] })
|
|
553
|
-
] })
|
|
554
|
-
] });
|
|
507
|
+
)
|
|
508
|
+
}
|
|
509
|
+
);
|
|
555
510
|
}
|
|
556
511
|
export {
|
|
557
|
-
|
|
558
|
-
|
|
512
|
+
be as Game,
|
|
513
|
+
O as themes
|
|
559
514
|
};
|
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mblinkov/whats-missing",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.12",
|
|
4
4
|
"main": "dist/whats-missing.umd.js",
|
|
5
5
|
"module": "dist/whats-missing.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"react": "^18.
|
|
9
|
-
"react-dom": "^18.
|
|
8
|
+
"react": "^18.3.1",
|
|
9
|
+
"react-dom": "^18.3.1"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "vite",
|
|
13
13
|
"build": "vite build",
|
|
14
14
|
"preview": "vite preview"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/react": "^19.2.2",
|
|
18
|
+
"@types/react-dom": "^19.2.1",
|
|
19
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
20
|
+
"typescript": "^5.9.3"
|
|
15
21
|
}
|
|
16
22
|
}
|