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