lido-player 0.0.2-alpha-82 → 0.0.2-alpha-84

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.
Files changed (45) hide show
  1. package/dist/cjs/{decode-CwZGUwfu.js → decode-DcCOGYxt.js} +1 -1
  2. package/dist/cjs/{index-CzDTBZkw.js → index-BmGzuXUP.js} +17 -5
  3. package/dist/cjs/index.cjs.js +1 -1
  4. package/dist/cjs/lido-avatar_22.cjs.entry.js +40 -24
  5. package/dist/collection/components/avatar/lido-avatar.js +1 -1
  6. package/dist/collection/components/home/lido-home.js +4 -1
  7. package/dist/collection/components/keyboard/lido-keyboard.js +9 -11
  8. package/dist/collection/components/trace/lido-trace.js +4 -6
  9. package/dist/collection/utils/audioPlayer.js +3 -0
  10. package/dist/collection/utils/utils.js +8 -3
  11. package/dist/collection/utils/utilsHandlers/clickHandler.js +2 -0
  12. package/dist/collection/utils/utilsHandlers/dragDropHandler.js +3 -1
  13. package/dist/components/index.js +1 -1
  14. package/dist/components/lido-avatar.js +1 -1
  15. package/dist/components/lido-calculator.js +1 -1
  16. package/dist/components/lido-canvas.js +1 -1
  17. package/dist/components/lido-container.js +1 -1
  18. package/dist/components/lido-home.js +1 -1
  19. package/dist/components/lido-keyboard.js +1 -1
  20. package/dist/components/lido-root.js +1 -1
  21. package/dist/components/lido-text.js +1 -1
  22. package/dist/components/lido-trace.js +1 -1
  23. package/dist/components/{p-D35rnXjX.js → p-BVzB_wMB.js} +1 -1
  24. package/dist/components/{p-XuYuvQ2t.js → p-BbmL31D0.js} +1 -1
  25. package/dist/components/p-Bo_qoxns.js +1 -0
  26. package/dist/components/p-C-VpLebJ.js +1 -0
  27. package/dist/components/{p-DhMA5bRq.js → p-D9NAzHjN.js} +1 -1
  28. package/dist/components/{p-BP8urjEF.js → p-DkUS6PPi.js} +1 -1
  29. package/dist/components/{p-CtAIatJL.js → p-Dx2gO6sh.js} +1 -1
  30. package/dist/components/p-ltnEAOTv.js +1 -0
  31. package/dist/esm/{decode-CIumlRg2.js → decode-DINMHb4l.js} +1 -1
  32. package/dist/esm/{index-ClUl8I7L.js → index-CrVvfO2B.js} +17 -5
  33. package/dist/esm/index.js +1 -1
  34. package/dist/esm/lido-avatar_22.entry.js +40 -24
  35. package/dist/lido-player/index.esm.js +1 -1
  36. package/dist/lido-player/lido-player.esm.js +1 -1
  37. package/dist/lido-player/p-19ce1c24.entry.js +1 -0
  38. package/dist/lido-player/{p-DitY2e2u.js → p-CWmrkq9f.js} +1 -1
  39. package/dist/lido-player/p-CadDPr02.js +1 -0
  40. package/package.json +1 -1
  41. package/dist/components/p-D7aZnpC8.js +0 -1
  42. package/dist/components/p-DOAdkXuf.js +0 -1
  43. package/dist/components/p-DfzpwbRE.js +0 -1
  44. package/dist/lido-player/p-4J_58BkH.js +0 -1
  45. package/dist/lido-player/p-7445d9ec.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CzDTBZkw.js');
3
+ var index = require('./index-BmGzuXUP.js');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  m.forEach(function (e) {
@@ -980,7 +980,9 @@ async function onElementDropComplete(dragElement, dropElement) {
980
980
  // Add pulse and highlight effect for a successful match
981
981
  const isCorrect = dropElement['value'].toLowerCase().includes(dragElement['value'].toLowerCase());
982
982
  dispatchElementDropEvent(dragElement, dropElement, isCorrect);
983
- storingEachActivityScore(isCorrect);
983
+ if (container.getAttribute("template-id") !== "blender") {
984
+ storingEachActivityScore(isCorrect);
985
+ }
984
986
  dragElement.style.opacity = '1';
985
987
  const allDropElements = document.querySelectorAll('.drop-element');
986
988
  allDropElements.forEach(el => updateDropBorder(el));
@@ -1289,6 +1291,9 @@ class AudioPlayer {
1289
1291
  this.activeWordIndex = -1;
1290
1292
  this.highlightRAF = null;
1291
1293
  this.handleUserClick = () => {
1294
+ const container = document.getElementById(LidoContainer);
1295
+ if ((container === null || container === void 0 ? void 0 : container.getAttribute('game-completed')) === 'true')
1296
+ return;
1292
1297
  this.stop();
1293
1298
  };
1294
1299
  this.audioElement = document.createElement('audio');
@@ -3557,6 +3562,8 @@ function addClickListenerForClickType(element) {
3557
3562
  }
3558
3563
  const onClick = async () => {
3559
3564
  var _a;
3565
+ if (container.getAttribute("game-completed") === "true")
3566
+ return;
3560
3567
  const lido_buttons = element.getAttribute('id');
3561
3568
  if (lido_buttons === 'lido-arrow-left' || lido_buttons === 'lido-arrow-right') {
3562
3569
  return;
@@ -71687,7 +71694,7 @@ const checkEquationOfActiveCell = async (container) => {
71687
71694
  let score = 0;
71688
71695
  const handleSolvedEquationSubmissionAndScoreUpdate = async (container) => {
71689
71696
  var _a;
71690
- const resolvedContainer = container !== null && container !== void 0 ? container : document.getElementById("lido-container");
71697
+ const resolvedContainer = document.getElementById("lido-container");
71691
71698
  if (!resolvedContainer)
71692
71699
  return;
71693
71700
  const calculatorValue = ((_a = resolvedContainer.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) ||
@@ -72195,7 +72202,7 @@ const executeActions = async (actionsString, thisElement, element) => {
72195
72202
  }
72196
72203
  case 'scrollCellAfterEquationSolved': {
72197
72204
  if (targetElement) {
72198
- handleSolvedEquationSubmissionAndScoreUpdate(targetElement);
72205
+ handleSolvedEquationSubmissionAndScoreUpdate();
72199
72206
  }
72200
72207
  break;
72201
72208
  }
@@ -72822,7 +72829,7 @@ const validateObjectiveStatus = async () => {
72822
72829
  if (attach === 'true') {
72823
72830
  appendingDragElementsInDrop();
72824
72831
  }
72825
- if (container.querySelectorAll("[type='click']").length > 0) {
72832
+ if (container.querySelectorAll("[type='click']").length > 0 || container.getAttribute("template-id") === "blender") {
72826
72833
  storingEachActivityScore(true);
72827
72834
  }
72828
72835
  await executeActions(onCorrect, container);
@@ -72840,7 +72847,7 @@ const validateObjectiveStatus = async () => {
72840
72847
  else {
72841
72848
  const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
72842
72849
  const onCorrect = container.getAttribute('onCorrect');
72843
- if (container.querySelectorAll("[type='click']").length > 0) {
72850
+ if (container.querySelectorAll("[type='click']").length > 0 || container.getAttribute("template-id") === "blender") {
72844
72851
  storingEachActivityScore(false);
72845
72852
  }
72846
72853
  if (!isContinueOnCorrect) {
@@ -73048,6 +73055,7 @@ const handlingElementFlexibleWidth = (element, type) => {
73048
73055
  });
73049
73056
  };
73050
73057
  const equationCheck = (additionalCheck) => {
73058
+ console.log('🚀 ~ equationCheck ~ additionalCheck:', additionalCheck);
73051
73059
  if (!additionalCheck) {
73052
73060
  console.log('Input string is empty.');
73053
73061
  return undefined;
@@ -73057,9 +73065,12 @@ const equationCheck = (additionalCheck) => {
73057
73065
  // 2. Map through the parts, replacing those that start with '#'
73058
73066
  const modifiedParts = parts.map(part => {
73059
73067
  var _a;
73068
+ console.log('🚀 ~ equationCheck ~ part:', part);
73060
73069
  if (part.startsWith('$')) {
73061
73070
  const cleanWord = part.substring(1);
73071
+ console.log('🚀 ~ equationCheck ~ part starts with $:', cleanWord);
73062
73072
  const dragSelectedElements = getElementsForQueries(cleanWord);
73073
+ console.log('🚀 ~ equationCheck ~ dragSelectedElements:', dragSelectedElements);
73063
73074
  const randomReplacement = isArray(dragSelectedElements)
73064
73075
  ? dragSelectedElements === null || dragSelectedElements === void 0 ? void 0 : dragSelectedElements.map(val => val.getAttribute('value'))
73065
73076
  : dragSelectedElements.getAttribute('value') || ((_a = document.getElementById(cleanWord)) === null || _a === void 0 ? void 0 : _a['value']);
@@ -73069,6 +73080,7 @@ const equationCheck = (additionalCheck) => {
73069
73080
  return part;
73070
73081
  }
73071
73082
  });
73083
+ console.log('🚀 ~ equationCheck ~ modifiedParts:', modifiedParts);
73072
73084
  // 3. Join the modified parts back into one string
73073
73085
  const resultString = modifiedParts.join('');
73074
73086
  console.log('🚀 ~ equationCheck ~ resultString:', resultString);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CzDTBZkw.js');
3
+ var index = require('./index-BmGzuXUP.js');
4
4
  require('./index-7Dh-uOww.js');
5
5
 
6
6
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-7Dh-uOww.js');
4
- var index$1 = require('./index-CzDTBZkw.js');
4
+ var index$1 = require('./index-BmGzuXUP.js');
5
5
 
6
6
  var rive$1 = {exports: {}};
7
7
 
@@ -3390,7 +3390,7 @@ function requireRive () {
3390
3390
  /* 2 */
3391
3391
  /***/ ((module) => {
3392
3392
 
3393
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.35.1","description":"Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3393
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.35.2","description":"Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3394
3394
 
3395
3395
  /***/ }),
3396
3396
  /* 3 */
@@ -8278,7 +8278,7 @@ const LidoAvatar = class {
8278
8278
  display: this.visible ? 'flex' : 'none',
8279
8279
  zIndex: this.z,
8280
8280
  };
8281
- return (index.h(index.Host, { key: '8a31ce98213ff51bf7cfc776690b6770bbeae604', id: this.id, type: this.type, "tab-index": this.tabIndex, value: this.value, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, index.h("canvas", { key: '922568310a3be177e3185f86c54df95d16a0e42b', class: "lido-canvas" })));
8281
+ return (index.h(index.Host, { key: 'e37ca80bf4fce30a13791a1b1dce283966903645', id: this.id, type: this.type, "tab-index": this.tabIndex, value: this.value, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, src: this.src }, index.h("canvas", { key: '0b1ac45cfb89c5d88c0720e92664af71b143f274', class: "lido-canvas" })));
8282
8282
  }
8283
8283
  get el() { return index.getElement(this); }
8284
8284
  };
@@ -9556,7 +9556,16 @@ function keysFromSelector(selector, opts) {
9556
9556
  const {
9557
9557
  [PATH_KEY]: path
9558
9558
  } = selector(createProxy());
9559
- return path.join(opts?.keySeparator ?? '.');
9559
+ const keySeparator = opts?.keySeparator ?? '.';
9560
+ const nsSeparator = opts?.nsSeparator ?? ':';
9561
+ if (path.length > 1 && nsSeparator) {
9562
+ const ns = opts?.ns;
9563
+ const namespaces = ns ? Array.isArray(ns) ? ns : [ns] : [];
9564
+ if (namespaces.includes(path[0])) {
9565
+ return `${path[0]}${nsSeparator}${path.slice(1).join(keySeparator)}`;
9566
+ }
9567
+ }
9568
+ return path.join(keySeparator);
9560
9569
  }
9561
9570
 
9562
9571
  const checkedLoadedFor = {};
@@ -9630,6 +9639,10 @@ class Translator extends EventEmitter {
9630
9639
  ...opt
9631
9640
  });
9632
9641
  if (!Array.isArray(keys)) keys = [String(keys)];
9642
+ keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
9643
+ ...this.options,
9644
+ ...opt
9645
+ }) : String(k));
9633
9646
  const returnDetails = opt.returnDetails !== undefined ? opt.returnDetails : this.options.returnDetails;
9634
9647
  const keySeparator = opt.keySeparator !== undefined ? opt.keySeparator : this.options.keySeparator;
9635
9648
  const {
@@ -9876,6 +9889,10 @@ class Translator extends EventEmitter {
9876
9889
  let usedLng;
9877
9890
  let usedNS;
9878
9891
  if (isString(keys)) keys = [keys];
9892
+ if (Array.isArray(keys)) keys = keys.map(k => typeof k === 'function' ? keysFromSelector(k, {
9893
+ ...this.options,
9894
+ ...opt
9895
+ }) : k);
9879
9896
  keys.forEach(k => {
9880
9897
  if (this.isValidLookup(found)) return;
9881
9898
  const extracted = this.extractFromKey(k, opt);
@@ -10874,7 +10891,7 @@ class I18n extends EventEmitter {
10874
10891
  this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
10875
10892
  }
10876
10893
  if (this.options.showSupportNotice !== false && !usesLocize(this) && !getSupportNoticeShown()) {
10877
- if (typeof console !== 'undefined' && typeof console.info !== 'undefined') console.info('🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙');
10894
+ if (typeof console !== 'undefined' && typeof console.info !== 'undefined') console.info('🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙');
10878
10895
  setSupportNoticeShown();
10879
10896
  }
10880
10897
  const createClassOnDemand = ClassOrObject => {
@@ -12903,7 +12920,7 @@ const LidoHome = class {
12903
12920
  }
12904
12921
  // Pure-JS fallback (no wasm asset required)
12905
12922
  try {
12906
- const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-CwZGUwfu.js'); }).then(function (n) { return n.decode; });
12923
+ const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-DcCOGYxt.js'); }).then(function (n) { return n.decode; });
12907
12924
  const brotliDecompressBuffer = brotliDecodeModule.BrotliDecompressBuffer ||
12908
12925
  ((_a = brotliDecodeModule.default) === null || _a === void 0 ? void 0 : _a.BrotliDecompressBuffer);
12909
12926
  if (typeof brotliDecompressBuffer !== 'function') {
@@ -13152,9 +13169,12 @@ const LidoHome = class {
13152
13169
  }
13153
13170
  async btnpopup() {
13154
13171
  var _a, _b;
13172
+ const container = document.getElementById(index$1.LidoContainer);
13173
+ console.log("game completed !");
13174
+ if (!container || container.getAttribute("game-completed") === "true")
13175
+ return;
13155
13176
  index$1.setCancelBtnPopup(false);
13156
13177
  await index$1.AudioPlayer.getI().stop();
13157
- const container = document.getElementById(index$1.LidoContainer);
13158
13178
  const allele = container.querySelectorAll('*');
13159
13179
  const templateId = container.getAttribute(index$1.TemplateID);
13160
13180
  if (templateId) {
@@ -16405,39 +16425,37 @@ const LidoKeyboard = class {
16405
16425
  async inputValidation(e) {
16406
16426
  if (this.type !== 'click')
16407
16427
  return;
16408
- let isOverlapping = false;
16409
16428
  const container = document.getElementById(index$1.LidoContainer);
16410
16429
  const clickedValue = e.target.getAttribute('value');
16411
16430
  if (!clickedValue)
16412
16431
  return;
16413
16432
  let selectedValue = JSON.parse(localStorage.getItem(index$1.SelectedValuesKey)) || '';
16414
16433
  localStorage.setItem(index$1.SelectedValuesKey, JSON.stringify(selectedValue));
16434
+ const bodyRect = document.body.getBoundingClientRect();
16415
16435
  // Get all word bubbles (make sure bubbles have class "bubble-element")
16416
16436
  const bubbles = Array.from(container.querySelectorAll('.bubble-element'));
16437
+ const overlapingBubbles = bubbles.filter(bubble => {
16438
+ const elemRect = bubble.getBoundingClientRect();
16439
+ return elemRect.left < bodyRect.right && elemRect.right > bodyRect.left && elemRect.top < bodyRect.bottom && elemRect.bottom > bodyRect.top;
16440
+ });
16417
16441
  // Find a bubble whose word starts with current progress + clicked letter
16418
- const matchedBubble = bubbles.find(bubble => {
16442
+ const matchedBubble = overlapingBubbles.find(bubble => {
16419
16443
  const word = bubble.getAttribute('value'); // full word like "one"
16420
16444
  const hasElement = word === null || word === void 0 ? void 0 : word.startsWith(this.inputString.toLowerCase());
16421
16445
  return hasElement ? bubble : null;
16422
16446
  });
16423
- const bodyRect = document.body.getBoundingClientRect();
16424
16447
  if (matchedBubble) {
16425
- const elemRect = matchedBubble.getBoundingClientRect();
16426
- // Ciheck if the matched bubble is overlapping with the target area (you can define the target area as needed, here we use the entire viewport)
16427
- isOverlapping = matchedBubble && elemRect.left < bodyRect.right && elemRect.right > bodyRect.left && elemRect.top < bodyRect.bottom && elemRect.bottom > bodyRect.top;
16428
- }
16429
- if (matchedBubble && isOverlapping) {
16430
16448
  // If full word completed
16431
16449
  if (this.inputString.toLowerCase() === matchedBubble.getAttribute('value').toLowerCase()) {
16432
16450
  index$1.storingEachActivityScore(true);
16433
16451
  index$1.AudioPlayer.getI().play(matchedBubble);
16434
16452
  index$1.stopHighlightForSpeakingElement(matchedBubble);
16453
+ setTimeout(() => { this.inputString = ''; }, 1000);
16435
16454
  const elementOnCorrect = matchedBubble.getAttribute('onCorrect');
16436
16455
  await index$1.executeActions(elementOnCorrect, matchedBubble);
16437
16456
  matchedBubble.style.animation = 'none';
16438
16457
  matchedBubble.style.pointerEvents = 'none';
16439
16458
  this.numberOfClick++;
16440
- setTimeout(() => { this.inputString = ''; }, 1000);
16441
16459
  localStorage.removeItem(index$1.SelectedValuesKey);
16442
16460
  if (this.numberOfClick === this.letterLength) {
16443
16461
  index$1.calculateScore();
@@ -16508,10 +16526,10 @@ const LidoKeyboard = class {
16508
16526
  const keysArray = this.keys.split(',').map(k => k.trim());
16509
16527
  const container = document.getElementById(index$1.LidoContainer);
16510
16528
  const showCheck = container.getAttribute('show-check') === 'true';
16511
- return (index.h(index.Host, { key: 'db30eeabd3f70dd7753d8c16078cf8bf9af54a8b', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (index.h("div", { key: 'b3a0ca9bc3192c483f6eab60c8f367c4f2897c76', class: "input-area" }, index.h("input", { key: 'b37ef07e190b40624d0f06f38956c45e24be8070', type: "text", value: this.inputString, class: "input-area", readonly: true }), index.h("lido-text", { key: '183d046c44ac1136ee15060feeaaeb8a16eabbdd', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
16529
+ return (index.h(index.Host, { key: 'ee4b2c3c87f9b38cf024f6f47d40e73dedf64ec1', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (index.h("div", { key: '379cf5601a978a5e52e6245a9484261d852a3bbc', class: "input-area" }, index.h("input", { key: 'de44c37dcdefef362705a1c6a43e909f7c19490d', type: "text", value: this.inputString, class: "input-area", readonly: true }), index.h("lido-text", { key: '79d716f37f67f6162e9fca097d0082986c773f7c', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
16512
16530
  this.inputString = this.inputString.slice(0, -1);
16513
16531
  this.inputValidation(event);
16514
- } }), index.h("lido-text", { key: 'd394b9dfad91c63988117056abf3c791ac81a34f', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (index.h("lido-text", { key: 'c69cce204d7436094d4d1b0872a0755113a38266', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), index.h("div", { key: 'd7360b8f805b56962c9e615ac4a50fa2fc46b958', class: "keyboard-wrapper", style: {
16532
+ } }), index.h("lido-text", { key: '3252cf615eb880e5b046098fe7d5307a6609b45f', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (index.h("lido-text", { key: '9159f3cad979873485da0fc04acdbd37d61bb1c8', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), index.h("div", { key: '91c190d8a0c93250825640ba5b754f1d8b9b0adb', class: "keyboard-wrapper", style: {
16515
16533
  display: 'flex',
16516
16534
  flexWrap: 'wrap',
16517
16535
  justifyContent: 'center',
@@ -18560,6 +18578,9 @@ const LidoTrace = class {
18560
18578
  await this.playTraceAnimation();
18561
18579
  }
18562
18580
  index$1.storingEachActivityScore(true);
18581
+ if (this.el && this.onCorrect) {
18582
+ await index$1.executeActions(this.onCorrect, this.el);
18583
+ }
18563
18584
  console.log(`Moving to next container after SVG index: ${this.currentSvgIndex}`);
18564
18585
  const delay = 1000; // milliseconds
18565
18586
  if (this.currentSvgIndex < this.svgUrls.length - 1) {
@@ -18571,11 +18592,6 @@ const LidoTrace = class {
18571
18592
  this.moving = false;
18572
18593
  return;
18573
18594
  }
18574
- console.log('onCorrect:', this.onCorrect);
18575
- console.log('el :', this.el);
18576
- if (this.el && this.onCorrect) {
18577
- await index$1.executeActions(this.onCorrect, this.el);
18578
- }
18579
18595
  index$1.calculateScore();
18580
18596
  console.log('All SVGs completed, hiding component.');
18581
18597
  index$1.triggerNextContainer();
@@ -18788,7 +18804,7 @@ const LidoTrace = class {
18788
18804
  };
18789
18805
  }
18790
18806
  render() {
18791
- return (index.h(index.Host, { key: 'b3efc3effa7fbfdb85af80103e2c04689bdd4ef7', class: "lido-trace", id: this.id, audio: this.audio, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex, "disable-speak": this.disableSpeak }, index.h("div", { key: 'b5a5ac42a3417441940de75cd4e2dfdbe1dc7c47', style: this.style, id: "lido-svgContainer" })));
18807
+ return (index.h(index.Host, { key: '253a2c8840d47f1758eb2e025de799921ba7e972', class: "lido-trace", id: this.id, audio: this.audio, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex, "disable-speak": this.disableSpeak }, index.h("div", { key: '182018457f29150918f52ef92bc0fc4fc70bb463', style: this.style, id: "lido-svgContainer" })));
18792
18808
  }
18793
18809
  static get assetsDirs() { return ["svg", "images"]; }
18794
18810
  get el() { return index.getElement(this); }
@@ -138,7 +138,7 @@ export class LidoAvatar {
138
138
  display: this.visible ? 'flex' : 'none',
139
139
  zIndex: this.z,
140
140
  };
141
- return (h(Host, { key: '8a31ce98213ff51bf7cfc776690b6770bbeae604', id: this.id, type: this.type, "tab-index": this.tabIndex, value: this.value, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry }, h("canvas", { key: '922568310a3be177e3185f86c54df95d16a0e42b', class: "lido-canvas" })));
141
+ return (h(Host, { key: 'e37ca80bf4fce30a13791a1b1dce283966903645', id: this.id, type: this.type, "tab-index": this.tabIndex, value: this.value, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, src: this.src }, h("canvas", { key: '0b1ac45cfb89c5d88c0720e92664af71b143f274', class: "lido-canvas" })));
142
142
  }
143
143
  static get is() { return "lido-avatar"; }
144
144
  static get originalStyleUrls() {
@@ -520,9 +520,12 @@ export class LidoHome {
520
520
  }
521
521
  async btnpopup() {
522
522
  var _a, _b;
523
+ const container = document.getElementById(LidoContainer);
524
+ console.log("game completed !");
525
+ if (!container || container.getAttribute("game-completed") === "true")
526
+ return;
523
527
  setCancelBtnPopup(false);
524
528
  await AudioPlayer.getI().stop();
525
- const container = document.getElementById(LidoContainer);
526
529
  const allele = container.querySelectorAll('*');
527
530
  const templateId = container.getAttribute(TemplateID);
528
531
  if (templateId) {
@@ -36,39 +36,37 @@ export class LidoKeyboard {
36
36
  async inputValidation(e) {
37
37
  if (this.type !== 'click')
38
38
  return;
39
- let isOverlapping = false;
40
39
  const container = document.getElementById(LidoContainer);
41
40
  const clickedValue = e.target.getAttribute('value');
42
41
  if (!clickedValue)
43
42
  return;
44
43
  let selectedValue = JSON.parse(localStorage.getItem(SelectedValuesKey)) || '';
45
44
  localStorage.setItem(SelectedValuesKey, JSON.stringify(selectedValue));
45
+ const bodyRect = document.body.getBoundingClientRect();
46
46
  // Get all word bubbles (make sure bubbles have class "bubble-element")
47
47
  const bubbles = Array.from(container.querySelectorAll('.bubble-element'));
48
+ const overlapingBubbles = bubbles.filter(bubble => {
49
+ const elemRect = bubble.getBoundingClientRect();
50
+ return elemRect.left < bodyRect.right && elemRect.right > bodyRect.left && elemRect.top < bodyRect.bottom && elemRect.bottom > bodyRect.top;
51
+ });
48
52
  // Find a bubble whose word starts with current progress + clicked letter
49
- const matchedBubble = bubbles.find(bubble => {
53
+ const matchedBubble = overlapingBubbles.find(bubble => {
50
54
  const word = bubble.getAttribute('value'); // full word like "one"
51
55
  const hasElement = word === null || word === void 0 ? void 0 : word.startsWith(this.inputString.toLowerCase());
52
56
  return hasElement ? bubble : null;
53
57
  });
54
- const bodyRect = document.body.getBoundingClientRect();
55
58
  if (matchedBubble) {
56
- const elemRect = matchedBubble.getBoundingClientRect();
57
- // Ciheck if the matched bubble is overlapping with the target area (you can define the target area as needed, here we use the entire viewport)
58
- isOverlapping = matchedBubble && elemRect.left < bodyRect.right && elemRect.right > bodyRect.left && elemRect.top < bodyRect.bottom && elemRect.bottom > bodyRect.top;
59
- }
60
- if (matchedBubble && isOverlapping) {
61
59
  // If full word completed
62
60
  if (this.inputString.toLowerCase() === matchedBubble.getAttribute('value').toLowerCase()) {
63
61
  storingEachActivityScore(true);
64
62
  AudioPlayer.getI().play(matchedBubble);
65
63
  stopHighlightForSpeakingElement(matchedBubble);
64
+ setTimeout(() => { this.inputString = ''; }, 1000);
66
65
  const elementOnCorrect = matchedBubble.getAttribute('onCorrect');
67
66
  await executeActions(elementOnCorrect, matchedBubble);
68
67
  matchedBubble.style.animation = 'none';
69
68
  matchedBubble.style.pointerEvents = 'none';
70
69
  this.numberOfClick++;
71
- setTimeout(() => { this.inputString = ''; }, 1000);
72
70
  localStorage.removeItem(SelectedValuesKey);
73
71
  if (this.numberOfClick === this.letterLength) {
74
72
  calculateScore();
@@ -139,10 +137,10 @@ export class LidoKeyboard {
139
137
  const keysArray = this.keys.split(',').map(k => k.trim());
140
138
  const container = document.getElementById(LidoContainer);
141
139
  const showCheck = container.getAttribute('show-check') === 'true';
142
- return (h(Host, { key: 'db30eeabd3f70dd7753d8c16078cf8bf9af54a8b', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (h("div", { key: 'b3a0ca9bc3192c483f6eab60c8f367c4f2897c76', class: "input-area" }, h("input", { key: 'b37ef07e190b40624d0f06f38956c45e24be8070', type: "text", value: this.inputString, class: "input-area", readonly: true }), h("lido-text", { key: '183d046c44ac1136ee15060feeaaeb8a16eabbdd', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
140
+ return (h(Host, { key: 'ee4b2c3c87f9b38cf024f6f47d40e73dedf64ec1', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (h("div", { key: '379cf5601a978a5e52e6245a9484261d852a3bbc', class: "input-area" }, h("input", { key: 'de44c37dcdefef362705a1c6a43e909f7c19490d', type: "text", value: this.inputString, class: "input-area", readonly: true }), h("lido-text", { key: '79d716f37f67f6162e9fca097d0082986c773f7c', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
143
141
  this.inputString = this.inputString.slice(0, -1);
144
142
  this.inputValidation(event);
145
- } }), h("lido-text", { key: 'd394b9dfad91c63988117056abf3c791ac81a34f', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (h("lido-text", { key: 'c69cce204d7436094d4d1b0872a0755113a38266', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), h("div", { key: 'd7360b8f805b56962c9e615ac4a50fa2fc46b958', class: "keyboard-wrapper", style: {
143
+ } }), h("lido-text", { key: '3252cf615eb880e5b046098fe7d5307a6609b45f', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (h("lido-text", { key: '9159f3cad979873485da0fc04acdbd37d61bb1c8', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), h("div", { key: '91c190d8a0c93250825640ba5b754f1d8b9b0adb', class: "keyboard-wrapper", style: {
146
144
  display: 'flex',
147
145
  flexWrap: 'wrap',
148
146
  justifyContent: 'center',
@@ -702,6 +702,9 @@ export class LidoTrace {
702
702
  await this.playTraceAnimation();
703
703
  }
704
704
  storingEachActivityScore(true);
705
+ if (this.el && this.onCorrect) {
706
+ await executeActions(this.onCorrect, this.el);
707
+ }
705
708
  console.log(`Moving to next container after SVG index: ${this.currentSvgIndex}`);
706
709
  const delay = 1000; // milliseconds
707
710
  if (this.currentSvgIndex < this.svgUrls.length - 1) {
@@ -713,11 +716,6 @@ export class LidoTrace {
713
716
  this.moving = false;
714
717
  return;
715
718
  }
716
- console.log('onCorrect:', this.onCorrect);
717
- console.log('el :', this.el);
718
- if (this.el && this.onCorrect) {
719
- await executeActions(this.onCorrect, this.el);
720
- }
721
719
  calculateScore();
722
720
  console.log('All SVGs completed, hiding component.');
723
721
  triggerNextContainer();
@@ -930,7 +928,7 @@ export class LidoTrace {
930
928
  };
931
929
  }
932
930
  render() {
933
- return (h(Host, { key: 'b3efc3effa7fbfdb85af80103e2c04689bdd4ef7', class: "lido-trace", id: this.id, audio: this.audio, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex, "disable-speak": this.disableSpeak }, h("div", { key: 'b5a5ac42a3417441940de75cd4e2dfdbe1dc7c47', style: this.style, id: "lido-svgContainer" })));
931
+ return (h(Host, { key: '253a2c8840d47f1758eb2e025de799921ba7e972', class: "lido-trace", id: this.id, audio: this.audio, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex, "disable-speak": this.disableSpeak }, h("div", { key: '182018457f29150918f52ef92bc0fc4fc70bb463', style: this.style, id: "lido-svgContainer" })));
934
932
  }
935
933
  static get is() { return "lido-trace"; }
936
934
  static get originalStyleUrls() {
@@ -10,6 +10,9 @@ export class AudioPlayer {
10
10
  this.activeWordIndex = -1;
11
11
  this.highlightRAF = null;
12
12
  this.handleUserClick = () => {
13
+ const container = document.getElementById(LidoContainer);
14
+ if ((container === null || container === void 0 ? void 0 : container.getAttribute('game-completed')) === 'true')
15
+ return;
13
16
  this.stop();
14
17
  };
15
18
  this.audioElement = document.createElement('audio');
@@ -125,7 +125,7 @@ export const executeActions = async (actionsString, thisElement, element) => {
125
125
  }
126
126
  case 'scrollCellAfterEquationSolved': {
127
127
  if (targetElement) {
128
- handleSolvedEquationSubmissionAndScoreUpdate(targetElement);
128
+ handleSolvedEquationSubmissionAndScoreUpdate();
129
129
  }
130
130
  break;
131
131
  }
@@ -753,7 +753,7 @@ export const validateObjectiveStatus = async () => {
753
753
  if (attach === 'true') {
754
754
  appendingDragElementsInDrop();
755
755
  }
756
- if (container.querySelectorAll("[type='click']").length > 0) {
756
+ if (container.querySelectorAll("[type='click']").length > 0 || container.getAttribute("template-id") === "blender") {
757
757
  storingEachActivityScore(true);
758
758
  }
759
759
  await executeActions(onCorrect, container);
@@ -771,7 +771,7 @@ export const validateObjectiveStatus = async () => {
771
771
  else {
772
772
  const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
773
773
  const onCorrect = container.getAttribute('onCorrect');
774
- if (container.querySelectorAll("[type='click']").length > 0) {
774
+ if (container.querySelectorAll("[type='click']").length > 0 || container.getAttribute("template-id") === "blender") {
775
775
  storingEachActivityScore(false);
776
776
  }
777
777
  if (!isContinueOnCorrect) {
@@ -979,6 +979,7 @@ export const handlingElementFlexibleWidth = (element, type) => {
979
979
  });
980
980
  };
981
981
  export const equationCheck = (additionalCheck) => {
982
+ console.log('🚀 ~ equationCheck ~ additionalCheck:', additionalCheck);
982
983
  if (!additionalCheck) {
983
984
  console.log('Input string is empty.');
984
985
  return undefined;
@@ -988,9 +989,12 @@ export const equationCheck = (additionalCheck) => {
988
989
  // 2. Map through the parts, replacing those that start with '#'
989
990
  const modifiedParts = parts.map(part => {
990
991
  var _a;
992
+ console.log('🚀 ~ equationCheck ~ part:', part);
991
993
  if (part.startsWith('$')) {
992
994
  const cleanWord = part.substring(1);
995
+ console.log('🚀 ~ equationCheck ~ part starts with $:', cleanWord);
993
996
  const dragSelectedElements = getElementsForQueries(cleanWord);
997
+ console.log('🚀 ~ equationCheck ~ dragSelectedElements:', dragSelectedElements);
994
998
  const randomReplacement = isArray(dragSelectedElements)
995
999
  ? dragSelectedElements === null || dragSelectedElements === void 0 ? void 0 : dragSelectedElements.map(val => val.getAttribute('value'))
996
1000
  : dragSelectedElements.getAttribute('value') || ((_a = document.getElementById(cleanWord)) === null || _a === void 0 ? void 0 : _a['value']);
@@ -1000,6 +1004,7 @@ export const equationCheck = (additionalCheck) => {
1000
1004
  return part;
1001
1005
  }
1002
1006
  });
1007
+ console.log('🚀 ~ equationCheck ~ modifiedParts:', modifiedParts);
1003
1008
  // 3. Join the modified parts back into one string
1004
1009
  const resultString = modifiedParts.join('');
1005
1010
  console.log('🚀 ~ equationCheck ~ resultString:', resultString);
@@ -67,6 +67,8 @@ export function addClickListenerForClickType(element) {
67
67
  }
68
68
  const onClick = async () => {
69
69
  var _a;
70
+ if (container.getAttribute("game-completed") === "true")
71
+ return;
70
72
  const lido_buttons = element.getAttribute('id');
71
73
  if (lido_buttons === 'lido-arrow-left' || lido_buttons === 'lido-arrow-right') {
72
74
  return;
@@ -714,7 +714,9 @@ export async function onElementDropComplete(dragElement, dropElement) {
714
714
  // Add pulse and highlight effect for a successful match
715
715
  const isCorrect = dropElement['value'].toLowerCase().includes(dragElement['value'].toLowerCase());
716
716
  dispatchElementDropEvent(dragElement, dropElement, isCorrect);
717
- storingEachActivityScore(isCorrect);
717
+ if (container.getAttribute("template-id") !== "blender") {
718
+ storingEachActivityScore(isCorrect);
719
+ }
718
720
  dragElement.style.opacity = '1';
719
721
  const allDropElements = document.querySelectorAll('.drop-element');
720
722
  allDropElements.forEach(el => updateDropBorder(el));