@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.
@@ -1,9 +1,9 @@
1
- import { jsx as t, jsxs as s, Fragment as pe } from "react/jsx-runtime";
2
- import { useRef as he, useEffect as N, useState as r, useMemo as fe } from "react";
3
- const ye = window.origin + "/cloud/speakid/games/whatsmissing/", Y = (l, d) => l.map(([m, o]) => ({
4
- src: `${ye}${d}/${o.replace(/\s/g, "%20")}.png`,
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
- })), xe = [
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
- ], be = [
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
- ], we = [
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
- ], ne = {
73
- food: Y(xe, "food"),
74
- animals: Y(be, "animals"),
75
- toys: Y(we, "toys")
76
- }, ve = `
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 = ve, document.head.appendChild(l);
84
+ l.id = "spin-keyframes", l.innerHTML = ye, document.head.appendChild(l);
85
85
  }
86
- const ke = {
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
- ...ke
236
+ ...be
237
237
  }
238
- }, Ce = () => {
238
+ }, xe = () => {
239
239
  const l = document.createElement("style");
240
240
  l.textContent = `
241
- #whats-missing-root, #whats-missing-root * {
242
- box-sizing: border-box;
243
- font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
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
- }, Se = (l, d) => {
254
- const m = Array.from({ length: l.length + 1 }, () => Array(d.length + 1).fill(0));
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 <= d.length; o++) m[0][o] = 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 g = 1; g <= d.length; g++)
259
- m[o][g] = l[o - 1] === d[g - 1] ? m[o - 1][g - 1] : Math.min(m[o - 1][g - 1], m[o][g - 1], m[o - 1][g]) + 1;
260
- return m[l.length][d.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 Me() {
263
- const l = he(null);
264
- N(() => (Ce(), () => {
265
- document.body.style.overflow = "";
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 a = document.body, f = getComputedStyle(a), p = parseFloat(f.zoom || "");
280
- if (p && !isNaN(p) && p > 0) {
281
- G(p);
282
- return;
283
- }
284
- const y = f.transform;
285
- if (y && y !== "none") {
286
- const I = y.match(/matrix\(([^)]+)\)/);
287
- if (I) {
288
- const $ = I[1].split(",").map((ue) => parseFloat(ue))[0];
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
- G(1);
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
- e(), i(), window.addEventListener("resize", e), window.addEventListener("resize", i);
300
- const c = new MutationObserver(i);
301
- return c.observe(document.body, { attributes: !0, attributeFilter: ["style", "class"] }), () => {
302
- window.removeEventListener("resize", e), window.removeEventListener("resize", i), c.disconnect();
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 J = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), Q = () => {
306
- if (!d) return;
307
- const e = J(ne[d]);
308
- g(e), D(!0), j(!1), P(1), L(0), E([]), Z([]), ee(e, [], !0);
309
- }, ee = (e = o, i = ae, c = !1) => {
310
- const a = J(e.length ? e : ne[d]);
311
- let f = Math.floor(Math.random() * a.length), p = a[f].name, y = 0;
312
- for (; i.includes(p) && y < 20; )
313
- f = Math.floor(Math.random() * a.length), p = a[f].name, y++;
314
- g(a), ie(f), Z([...i, p]), F(!1), q(""), V(20), k(null), c ? (z("ready"), U(3), B(10)) : (z("memorize"), B(10));
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
- N(() => {
317
- if (!(!v || T || w)) {
318
- if (u === "ready")
319
- if (O <= 0) z("memorize");
343
+ P(() => {
344
+ if (!(!w || L || R)) {
345
+ if (a === "ready")
346
+ if (k <= 0) y("memorize");
320
347
  else {
321
- const e = setTimeout(() => U((i) => i - 1), 1e3);
348
+ const e = setTimeout(() => S((s) => s - 1), 1e3);
322
349
  return () => clearTimeout(e);
323
350
  }
324
- if (u === "memorize")
325
- if (H <= 0) z("guess");
351
+ if (a === "memorize")
352
+ if (T <= 0) y("guess");
326
353
  else {
327
- const e = setTimeout(() => B((i) => i - 1), 1e3);
354
+ const e = setTimeout(() => A((s) => s - 1), 1e3);
328
355
  return () => clearTimeout(e);
329
356
  }
330
- if (u === "guess") {
331
- if (A <= 0) {
332
- F(!0), k("wrong");
333
- const i = o[x].name;
334
- E((c) => [...c, { round: S, answer: M, correct: i, result: "wrong" }]);
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(() => V((i) => i - 1), 1e3);
367
+ const e = setTimeout(() => H((s) => s - 1), 1e3);
338
368
  return () => clearTimeout(e);
339
369
  }
340
370
  }
341
- }, [u, O, H, A, v, T, w, o, x, S, M]);
342
- const de = () => {
343
- if (x === null || W) return;
344
- const e = o[x].name, i = M.toLowerCase().trim();
345
- let c = "wrong";
346
- i === e ? (L((a) => a + 1), k("correct"), c = "correct") : Se(i, e) === 1 ? (L((a) => a + 0.5), k("almost"), c = "almost") : (k("wrong"), c = "wrong"), E((a) => [...a, { round: S, answer: i, correct: e, result: c }]), _(!0), setTimeout(() => {
347
- _(!1), F(!0);
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
- }, ce = () => S < C ? (P((e) => e + 1), ee()) : j(!0), me = () => {
350
- D(!1), j(!1), m(null);
351
- }, ge = fe(
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__ */ s("picture", { children: [
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: h ? "100%" : R ? `${Math.round(R * b)}px` : `${Math.round(1e3 * b)}px`,
380
- height: h ? "100%" : R ? `${Math.round(R * b)}px` : `${Math.round(1e3 * b)}px`,
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: h ? 0 : "20px",
415
+ borderRadius: b ? 0 : "20px",
386
416
  background: "linear-gradient(to bottom, #fff8f8 0%, #f9fafb 100%)",
387
- boxShadow: h ? "none" : "0 0 40px rgba(0,0,0,0.1)",
388
- margin: h ? "0 auto" : "unset",
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: b && b !== 1 ? `scale(${1 / b})` : "none",
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__ */ s("div", { id: "whats-missing-root", children: [
404
- !h && ge,
405
- !d && !v && /* @__PURE__ */ s("div", { style: n.gmCenterScreen, children: [
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__ */ s("div", { style: { marginTop: 24 }, children: [
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: { ...n.gmButton, ...C === e ? n.gmButtonActive : {} },
415
- onClick: () => oe(e),
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
- d && !v && /* @__PURE__ */ s("div", { style: n.gmCenterScreen, children: [
423
- /* @__PURE__ */ s("h1", { style: n.gmHeadline1, children: [
455
+ g && !w && /* @__PURE__ */ c("div", { style: n.gmCenterScreen, children: [
456
+ /* @__PURE__ */ c("h1", { style: n.gmHeadline1, children: [
424
457
  "Theme selected: ",
425
- d
458
+ g
426
459
  ] }),
427
- /* @__PURE__ */ s("p", { style: n.gmBodyM, children: [
460
+ /* @__PURE__ */ c("p", { style: n.gmBodyM, children: [
428
461
  "Rounds: ",
429
- C
462
+ i
430
463
  ] }),
431
- /* @__PURE__ */ t("button", { style: n.gmButton, onClick: Q, children: "▶ Start game" })
464
+ /* @__PURE__ */ t("button", { style: n.gmButton, onClick: J, children: "▶ Start game" })
432
465
  ] }),
433
- T && /* @__PURE__ */ s("div", { style: n.gmCenterScreen, children: [
466
+ L && /* @__PURE__ */ c("div", { style: n.gmCenterScreen, children: [
434
467
  /* @__PURE__ */ t("h1", { style: n.gmHeadline1, children: "Results" }),
435
- /* @__PURE__ */ s("h2", { style: n.gmHeadline3, children: [
468
+ /* @__PURE__ */ c("h2", { style: n.gmHeadline3, children: [
436
469
  "Your score: ",
437
- re,
470
+ ne,
438
471
  " / ",
439
- C
472
+ i
440
473
  ] }),
441
474
  /* @__PURE__ */ t("p", { style: { ...n.gmBodyM, color: "#10b981", marginTop: 12 }, children: "Yahoo! You did it! 🍬✨" }),
442
- /* @__PURE__ */ s("table", { style: n.gmTable, children: [
443
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ s("tr", { children: [
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: se.map((e, i) => /* @__PURE__ */ s("tr", { 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
- ] }, i)) })
487
+ ] }, s)) })
455
488
  ] }),
456
- /* @__PURE__ */ s("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
457
- /* @__PURE__ */ t("button", { style: n.gmButton, onClick: Q, children: "🔁 Play again" }),
458
- /* @__PURE__ */ t("button", { style: n.gmButton, onClick: me, children: "⬅️ Choose theme" })
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
- v && !T && /* @__PURE__ */ s("div", { style: n.gmGameLayout, children: [
462
- /* @__PURE__ */ s("div", { style: { minHeight: 160, display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center" }, children: [
463
- u === "ready" && /* @__PURE__ */ s(pe, { children: [
464
- /* @__PURE__ */ t("h1", { style: { ...n.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
465
- /* @__PURE__ */ t("div", { style: n.gmHourglass, children: "⏳" })
466
- ] }),
467
- u === "memorize" && /* @__PURE__ */ s("p", { style: { ...n.gmBodyM, color: "#10b981" }, children: [
468
- "MEMORIZE (",
469
- H,
470
- ")"
471
- ] }),
472
- u === "guess" && !w && /* @__PURE__ */ s("p", { style: n.gmBodyM, children: [
473
- " Time left: ",
474
- A,
475
- "s"
476
- ] })
477
- ] }),
478
- u !== "ready" && /* @__PURE__ */ t("div", { style: { ...n.gmGrid, gridTemplateColumns: h ? "repeat(2, 1fr)" : "repeat(3, 210px)", gridAutoRows: h ? "150px" : "210px", gap: h ? "12px" : "20px", justifyItems: "center" }, children: o.map((e, i) => {
479
- const c = x === i && u === "guess" && !w;
480
- return /* @__PURE__ */ t("div", { style: { ...n.gmCard, ...K === "correct" && x === i ? n.gmCorrect : {}, ...K === "wrong" && x === i ? n.gmWrong : {} }, children: !c && /* @__PURE__ */ t("img", { src: e.src, alt: e.name, style: { width: "100%", height: "100%", objectFit: "cover" } }) }, i);
481
- }) }),
482
- /* @__PURE__ */ s("div", { style: { marginTop: 16, height: 80 }, children: [
483
- u === "guess" && !w && /* @__PURE__ */ s("div", { children: [
484
- /* @__PURE__ */ t("input", { type: "text", placeholder: "Type the missing word", value: M, onChange: (e) => q(e.target.value), style: n.gmInput }),
485
- /* @__PURE__ */ t("button", { style: { ...n.gmButton, marginLeft: 8 }, onClick: de, disabled: W, children: W ? "..." : "Check" })
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
- w && /* @__PURE__ */ t("button", { style: n.gmButton, onClick: ce, children: "Next round" })
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
- Me as Game,
500
- ne as themes
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.19",
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",