lido-player 0.0.2-alpha-63 → 0.0.2-alpha-65

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 (76) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/lido-avatar_22.cjs.entry.js +45 -8
  3. package/dist/cjs/{utils-b13cba29.js → utils-6fbaf604.js} +142 -112
  4. package/dist/collection/components/calculator/lido-calculator.js +12 -2
  5. package/dist/collection/stories/Templates/balancing/balancing.stories.js +1 -1
  6. package/dist/collection/stories/Templates/blender/blender.stories.js +52 -47
  7. package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +28 -20
  8. package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +7 -9
  9. package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +3 -5
  10. package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +1 -1
  11. package/dist/collection/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.js +10 -10
  12. package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithimg.stories.js +1 -1
  13. package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.js +1 -1
  14. package/dist/collection/utils/utils.js +44 -35
  15. package/dist/collection/utils/utilsHandlers/clickHandler.js +1 -3
  16. package/dist/collection/utils/utilsHandlers/dragDropHandler.js +26 -21
  17. package/dist/collection/utils/utilsHandlers/highlightHandler.js +4 -4
  18. package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +5 -4
  19. package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +60 -46
  20. package/dist/components/index.js +1 -1
  21. package/dist/components/lido-avatar.js +1 -1
  22. package/dist/components/lido-balance.js +1 -1
  23. package/dist/components/lido-calculator.js +1 -1
  24. package/dist/components/lido-canvas.js +1 -1
  25. package/dist/components/lido-cell.js +1 -1
  26. package/dist/components/lido-col.js +1 -1
  27. package/dist/components/lido-container.js +1 -1
  28. package/dist/components/lido-flash-card.js +1 -1
  29. package/dist/components/lido-float.js +1 -1
  30. package/dist/components/lido-home.js +1 -1
  31. package/dist/components/lido-image.js +1 -1
  32. package/dist/components/lido-keyboard.js +1 -1
  33. package/dist/components/lido-math-matrix.js +1 -1
  34. package/dist/components/lido-pos.js +1 -1
  35. package/dist/components/lido-random.js +1 -1
  36. package/dist/components/lido-root.js +22 -22
  37. package/dist/components/lido-row.js +1 -1
  38. package/dist/components/lido-shape.js +1 -1
  39. package/dist/components/lido-slide-fill.js +1 -1
  40. package/dist/components/lido-text.js +1 -1
  41. package/dist/components/lido-trace.js +1 -1
  42. package/dist/components/lido-wrap.js +1 -1
  43. package/dist/components/{p-3db5a756.js → p-03e44e4a.js} +1 -1
  44. package/dist/components/{p-6c1ea24d.js → p-09a49b19.js} +1 -1
  45. package/dist/components/{p-bf0c1e81.js → p-0f72edb4.js} +1 -1
  46. package/dist/components/{p-552f581f.js → p-1238f648.js} +1 -1
  47. package/dist/components/{p-40dd6fa3.js → p-342bed2e.js} +1 -1
  48. package/dist/components/{p-85eaa0b7.js → p-4c026d99.js} +1 -1
  49. package/dist/components/{p-777293d6.js → p-4c870db5.js} +1 -1
  50. package/dist/components/{p-cdb5b0e6.js → p-50896aee.js} +1 -1
  51. package/dist/components/{p-8f174468.js → p-50a2d817.js} +1 -1
  52. package/dist/components/{p-1a53b784.js → p-56a84433.js} +2 -2
  53. package/dist/components/{p-adfef26f.js → p-5aeef0cc.js} +2 -2
  54. package/dist/components/{p-228a12b2.js → p-6b9fcb83.js} +2 -2
  55. package/dist/components/{p-7256917d.js → p-80c422c2.js} +1 -1
  56. package/dist/components/{p-bd09bc5b.js → p-873471c6.js} +142 -112
  57. package/dist/components/{p-39767aae.js → p-9f03a14c.js} +1 -1
  58. package/dist/components/{p-d2d6e641.js → p-bb46f8e2.js} +1 -1
  59. package/dist/components/{p-d31bcfae.js → p-c682e9ff.js} +15 -5
  60. package/dist/components/{p-64b85ae6.js → p-cf94b10e.js} +1 -1
  61. package/dist/components/{p-e42ddea5.js → p-d0fc464d.js} +1 -1
  62. package/dist/components/{p-196e9b0e.js → p-d764f75c.js} +33 -6
  63. package/dist/components/{p-f4c980f0.js → p-dc616111.js} +1 -1
  64. package/dist/components/{p-302d1390.js → p-f0a5d487.js} +21 -21
  65. package/dist/esm/index.js +1 -1
  66. package/dist/esm/lido-avatar_22.entry.js +45 -8
  67. package/dist/esm/{utils-b7ed15c2.js → utils-db03cb43.js} +142 -112
  68. package/dist/lido-player/index.esm.js +1 -1
  69. package/dist/lido-player/lido-player.esm.js +1 -1
  70. package/dist/lido-player/{p-1557f3df.js → p-5e0def71.js} +2 -2
  71. package/dist/lido-player/p-6192dda7.entry.js +1 -0
  72. package/dist/types/stories/Templates/blender/blender.stories.d.ts +1 -1
  73. package/dist/types/stories/Templates/matchingCard/matching-card.stories.d.ts +1 -1
  74. package/dist/types/utils/utilsHandlers/dragDropHandler.d.ts +1 -1
  75. package/package.json +1 -1
  76. package/dist/lido-player/p-c309d462.entry.js +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const utils = require('./utils-b13cba29.js');
5
+ const utils = require('./utils-6fbaf604.js');
6
6
  require('./index-baff5c15.js');
7
7
 
8
8
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-baff5c15.js');
6
- const utils = require('./utils-b13cba29.js');
6
+ const utils = require('./utils-6fbaf604.js');
7
7
 
8
8
  var rive = {exports: {}};
9
9
 
@@ -6828,7 +6828,9 @@ const LidoCalculator = class {
6828
6828
  }
6829
6829
  }
6830
6830
  this.onOk.emit(isCorrect);
6831
+ const okbtn = document.getElementById("btn-11");
6831
6832
  if (isCorrect) {
6833
+ okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
6832
6834
  this.displayValue = "";
6833
6835
  utils.storingEachActivityScore(isCorrect);
6834
6836
  const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
@@ -6845,15 +6847,23 @@ const LidoCalculator = class {
6845
6847
  }
6846
6848
  }
6847
6849
  else {
6850
+ okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
6848
6851
  this.displayValue = "";
6849
6852
  utils.storingEachActivityScore(isCorrect);
6850
6853
  const onInCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onInCorrect')) || '';
6851
- await utils.executeActions(onInCorrect, container);
6854
+ const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
6855
+ if (container.getAttribute('is-continue-on-correct') === 'false') {
6856
+ await utils.executeActions(onCorrect, container);
6857
+ }
6858
+ else {
6859
+ await utils.executeActions(onInCorrect, container);
6860
+ }
6852
6861
  }
6862
+ okbtn.style.pointerEvents = 'auto'; // Re-enable OK button after processing
6853
6863
  }
6854
6864
  render() {
6855
6865
  const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
6856
- return (index.h(index.Host, { key: '394177b08965252a6008cce3284475c6176eca3d', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, index.h("lido-cell", { key: '1c79a951e666ad4171b686400f0ba391783e693f', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: '70da4a0990c7ae72367f8d61026c1d4e6f682d48', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, index.h("img", { key: 'c510e7f1cc6ec5d34683030fff988054ac721225', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: '790d7bd307e296cc8e05e29705ebf4bfdda49906', class: "lido-calculator-displayParent" }, index.h("div", { key: 'f0195ce772bffdee06483da524f8a392dffdde38', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: '00fda79dab52a801acafe6006db0dd50923ea74b', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
6866
+ return (index.h(index.Host, { key: '595c92e80baed8e1709c51302aa427d672b3a9e0', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, index.h("lido-cell", { key: '4a2966a46fd008d66fedeb5f44e0ee2c5e8c083a', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: '35e38f7412be8489b668ba0aab927b7ba3d98f29', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, index.h("img", { key: '926def912022a30a27f5419d98348beb84fc1a42', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: '41a69c7aa7d1dfbeea19b1a1ef095b97d2c953ba', class: "lido-calculator-displayParent" }, index.h("div", { key: '047dfc84e8b02739a982287f82b1df2b7f552dcd', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: '41cd91f2c9aa40f6adcf6b0318e07e394bc3b38e', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
6857
6867
  'lido-calculator-btn-special': num === '←' || num === 'OK',
6858
6868
  'lido-calculator-btn-default': num !== '←' && num !== 'OK'
6859
6869
  }, onClick: () => this.handleClick(num) }))))));
@@ -9866,7 +9876,7 @@ const fr = {
9866
9876
 
9867
9877
  const Exit$3 = "बाहर निकलें";
9868
9878
  const instruction$2 = {
9869
- dragAndDrop: "Match_the_items_by_dragging_and_dropping_them_into_the_correct_places.",
9879
+ dragAndDrop: "Match the items by dragging and dropping them into the correct places.",
9870
9880
  mcq: "Select the correct answer from the options provided.",
9871
9881
  tracing: "Trace the shape by following the outline carefully.",
9872
9882
  flashcards: "Review the flashcards to reinforce your learning.",
@@ -9909,10 +9919,37 @@ const hi = {
9909
9919
 
9910
9920
  const Exit$2 = "ನಿರ್ಗಮಿಸು";
9911
9921
  const instruction$1 = {
9912
- dragAndDrop: "ವಸ್ತುಗಳನ್ನು ಸರಿಯಾದ ಸ್ಥಳಗಳಿಗೆ ಎಳೆದು ಬಿಟ್ಟು ಹೊಂದಿಸಿ.",
9913
- mcq: "ನೀಡಿದ ಆಯ್ಕೆಗಳಲ್ಲಿ ಸರಿಯಾದ ಉತ್ತರವನ್ನು ಆಯ್ಕೆಮಾಡಿ.",
9914
- tracing: "ರೆಖೆಯನ್ನು ಗಮನದಿಂದ ಅನುಸರಿಸಿ ಆಕಾರವನ್ನು ಬಿಡಿಸಿ.",
9915
- flashcards: "ಕಲಿಕೆಯನ್ನು ಬಲಪಡಿಸಲು ಫ್ಲ್ಯಾಶ್ ಕಾರ್ಡ್‌ಗಳನ್ನು ನೋಡಿ."
9922
+ dragAndDrop: "Match the items by dragging and dropping them into the correct places.",
9923
+ mcq: "Select the correct answer from the options provided.",
9924
+ tracing: "Trace the shape by following the outline carefully.",
9925
+ flashcards: "Review the flashcards to reinforce your learning.",
9926
+ substractionWithImage: "substractionWithImageKaAudio",
9927
+ substractionWithoutImage: "substractionWithoutImageKaAudio",
9928
+ numberIdentificationWithImage: "numberIdentificationWithImageKaAudio",
9929
+ numberIdentificationWithoutImage: "numberIdentificationWithoutImageKaAudio",
9930
+ wordBuildingWithImage: "wordBuildingWithImageKaAudio",
9931
+ wordBuildingWithoutImage: "wordBuildingWithoutImageKaAudio",
9932
+ pictureClues: "pictureCluesKaAudio",
9933
+ pictureWordMatchMultipleImages: "pictureWordMatchMultipleImagesKaAudio",
9934
+ pictureWordMatchSingleImage: "pictureWordMatchSingleImageKaAudio",
9935
+ sentenceMatch: "sentenceMatchKaAudio",
9936
+ imageMatch: "imageMatchKaAudio",
9937
+ palStoryTale: "palStoryTaleKaAudio",
9938
+ palEgmaPatternMatching: "palEgmaPatternMatchingKaAudio",
9939
+ palEgmaWordProblemDragnDrop: "palEgmaWordProblemDragnDropKaAudio",
9940
+ palEgmaWordProblemClick: "palEgmaWordProblemClickKaAudio",
9941
+ palEgraOddOneOut: "palEgraOddOneOutKaAudio",
9942
+ palEgraArrangePictures: "palEgraArrangePicturesKaAudio",
9943
+ palEgraBuildWord: "palEgraBuildWordKaAudio",
9944
+ palEgraWordFormation: "palEgraWordFormationKaAudio",
9945
+ palInventedSpelling: "palInventedSpellingKaAudio",
9946
+ palLetterIdentification: "palLetterIdentificationKaAudio",
9947
+ palStoryMaking: "palStoryMakingKaAudio",
9948
+ palegmasumtogether: "palegmasumtogetherKaAudio",
9949
+ palegmamultioption: "palegmamultioptionKaAudio",
9950
+ palegraoptionaudio: "palegraoptionaudioKaAudio",
9951
+ palegrawordmatch: "palegrawordmatchKaAudio",
9952
+ palegramcqimages: "palegramcqimagesKaAudio"
9916
9953
  };
9917
9954
  const ka = {
9918
9955
  "Do you want to exit?": "ನೀವು ನಿರ್ಗಮಿಸಲು ಬಯಸುವಿರಾ?",
@@ -174,7 +174,7 @@ function updateBalanceOnDrop(dragElement, dropElement) {
174
174
  }
175
175
  function calculateValue(elements, operation) {
176
176
  if (elements.length === 0)
177
- return null;
177
+ return 0;
178
178
  if (operation === "count") {
179
179
  return elements.length;
180
180
  }
@@ -206,15 +206,18 @@ function calculateValue(elements, operation) {
206
206
  }
207
207
  }
208
208
  function balanceResult(container, objectiveString) {
209
+ var _a, _b, _c, _d, _e, _f;
209
210
  const additionalCheck = container.getAttribute('equationCheck');
210
211
  if (!additionalCheck)
211
212
  return false;
212
213
  const balanceEl = document.querySelector('lido-balance');
213
214
  if (!balanceEl)
214
215
  return false;
215
- const leftVal = balanceEl.leftVal;
216
- const rightVal = balanceEl.rightVal;
217
- if (leftVal == null || rightVal == null) {
216
+ const leftVal = Number((_c = (_a = balanceEl.leftVal) !== null && _a !== void 0 ? _a : (_b = balanceEl.dataset) === null || _b === void 0 ? void 0 : _b.leftVal) !== null && _c !== void 0 ? _c : 0);
217
+ const rightVal = Number((_f = (_d = balanceEl.rightVal) !== null && _d !== void 0 ? _d : (_e = balanceEl.dataset) === null || _e === void 0 ? void 0 : _e.rightVal) !== null && _f !== void 0 ? _f : 0);
218
+ const hasLeft = !isNaN(leftVal);
219
+ const hasRight = !isNaN(rightVal);
220
+ if (!hasLeft || !hasRight) {
218
221
  return false;
219
222
  }
220
223
  const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
@@ -533,29 +536,26 @@ function enableDraggingWithScaling(element) {
533
536
  // Reset overlapping styles from all elements
534
537
  const allElements = document.querySelectorAll("[type='drop']");
535
538
  allElements.forEach(otherElement => {
536
- allElements.forEach(otherElement => {
537
- var _a;
538
- const dropObject = buildDragSelectedMapFromDOM();
539
- const storedTabIndexes = Object.keys(dropObject).map(Number);
540
- if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
541
- if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
542
- if (otherElement) {
543
- otherElement.style.opacity = "0";
544
- }
545
- else {
546
- otherElement.style.opacity = '1';
547
- }
548
- }
539
+ var _a;
540
+ const dropObject = buildDragSelectedMapFromDOM();
541
+ const storedTabIndexes = Object.keys(dropObject).map(Number);
542
+ if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
543
+ if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
544
+ otherElement.style.opacity = '1';
549
545
  }
550
- else {
551
- if (otherElement) {
552
- otherElement.style.opacity = "1";
553
- }
546
+ }
547
+ else {
548
+ if (otherElement) {
549
+ otherElement.style.opacity = '1';
554
550
  }
555
- });
551
+ }
556
552
  });
557
553
  // Check for overlaps and log the most overlapping element
558
554
  let mostOverlappedElement = findMostoverlappedElement$1(element, 'drop');
555
+ if (!mostOverlappedElement) {
556
+ handleResetDragElement(element, null, null, null, null);
557
+ return;
558
+ }
559
559
  onElementDropComplete(element, mostOverlappedElement);
560
560
  executeActions("this.updateCountBlender='true'", container);
561
561
  if (((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) {
@@ -651,7 +651,7 @@ function animateDragToTarget(dragElement, targetElement, container, transition =
651
651
  dragElement.style.transition = 'transform 0.5s ease';
652
652
  dragElement.style.transform = `translate(${finalX}px, ${finalY}px)`;
653
653
  }
654
- function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData) {
654
+ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData) {
655
655
  var _a;
656
656
  dragElement.classList.remove('dropped');
657
657
  const container = document.getElementById(LidoContainer);
@@ -729,7 +729,7 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
729
729
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
730
730
  if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
731
731
  if (otherElement.tagName.toLowerCase() === 'lido-text') {
732
- otherElement.style.opacity = "0";
732
+ otherElement.style.opacity = "1";
733
733
  }
734
734
  }
735
735
  }
@@ -739,6 +739,10 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
739
739
  }
740
740
  }
741
741
  });
742
+ // Update counts when a drag is reset/removed from a drop
743
+ if (container) {
744
+ await executeActions("this.updateCountBlender='true'", container);
745
+ }
742
746
  handleShowCheck();
743
747
  highlightElement();
744
748
  }
@@ -1060,6 +1064,8 @@ async function onClickDropOrDragElement(element, type) {
1060
1064
  });
1061
1065
  // await new Promise(resolve => setTimeout(resolve, 500));
1062
1066
  await onElementDropComplete(selectedDragElement, selectedDropElement);
1067
+ // ensure count update for click-to-drop flow
1068
+ await executeActions("this.updateCountBlender='true'", container);
1063
1069
  // await new Promise(resolve => setTimeout(resolve, 500));
1064
1070
  // selectedDragElement.style.transform = 'translate(0px, 0px)';
1065
1071
  }
@@ -1087,7 +1093,9 @@ async function onClickDragElement(element) {
1087
1093
  if (firstFalse) {
1088
1094
  const dropEl = document.querySelector(`#${firstFalse.drop}`);
1089
1095
  dragEl.style.transition = 'transform 0.5s ease';
1090
- onElementDropComplete(dragEl, dropEl);
1096
+ await onElementDropComplete(dragEl, dropEl);
1097
+ const container = document.getElementById(LidoContainer);
1098
+ await executeActions("this.updateCountBlender='true'", container);
1091
1099
  }
1092
1100
  }
1093
1101
  const appendingDragElementsInDrop = () => {
@@ -1202,12 +1210,12 @@ function highlightElement() {
1202
1210
  if (!container)
1203
1211
  return;
1204
1212
  const dropElements = buildDropHasDragFromDOM();
1213
+ const dropEls = container.querySelectorAll(`[type="drop"]`);
1214
+ dropEls.forEach(dropEl => {
1215
+ dropEl.classList.remove('highlight-element');
1216
+ });
1205
1217
  let firstFalse = Object.values(dropElements).find(item => !item.isFull);
1206
1218
  if (firstFalse) {
1207
- const dropEls = container.querySelectorAll(`[type="drop"]`);
1208
- dropEls.forEach(dropEl => {
1209
- dropEl.classList.remove('highlight-element');
1210
- });
1211
1219
  const dropEle = container.querySelector(`#${firstFalse.drop}`);
1212
1220
  if (dropEle) {
1213
1221
  dropEle.classList.add('highlight-element');
@@ -3342,9 +3350,7 @@ function addClickListenerForClickType(element) {
3342
3350
  // storingEachActivityScore(isCorrect);
3343
3351
  // }
3344
3352
  highlightElement();
3345
- if (!container.getAttribute("click-completed")) {
3346
- handleShowCheck();
3347
- }
3353
+ handleShowCheck();
3348
3354
  return;
3349
3355
  }
3350
3356
  if (showCheck) {
@@ -68222,7 +68228,9 @@ function calculateFill(input, currentFill = 0) {
68222
68228
  return Math.max(0, Math.min(100, value));
68223
68229
  }
68224
68230
 
68225
- // Helper to animate and remove the active equation cell
68231
+ /* ------------------ helpers ------------------ */
68232
+ const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
68233
+ /* ------------------ animation ------------------ */
68226
68234
  const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalculateTypes) => {
68227
68235
  return new Promise((resolve) => {
68228
68236
  const keyframes = `
@@ -68231,88 +68239,100 @@ const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalcul
68231
68239
  background-color: ${activeCell.style.backgroundColor};
68232
68240
  height: ${activeCell.style.height};
68233
68241
  margin: ${activeCell.style.margin};
68234
- ${activeCell.innerHTML = ""}
68235
68242
  }
68236
68243
  100% { background-color: transparent; height: 0px; margin: 0px; }
68237
68244
  }`;
68238
68245
  const styleSheet = document.styleSheets[0];
68239
68246
  styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
68240
- activeCell.style.animation = `widthDecrease 0.1s`;
68241
- activeCell.addEventListener('animationend', () => {
68242
- activeCell.style.height = '0px';
68243
- activeCell.style.margin = '0px';
68244
- activeCell.style.backgroundColor = 'transparent';
68247
+ activeCell.style.animation = `widthDecrease 0s`;
68248
+ activeCell.addEventListener("animationend", () => {
68245
68249
  activeCell.remove();
68246
68250
  // Trigger next container if last cell
68247
68251
  if (allCalculateTypes.length === 1) {
68248
68252
  setTimeout(() => triggerNextContainer(), 2000);
68249
68253
  }
68250
68254
  resolve();
68251
- });
68255
+ }, { once: true });
68252
68256
  });
68253
68257
  };
68254
- // Function: checks and animates equation when correct
68258
+ /* ------------------ PRACTICE MODE ------------------ */
68255
68259
  const checkEquationOfActiveCell = async (container) => {
68256
68260
  var _a;
68257
- const calculatorValue = (_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value");
68261
+ const calculatorValue = ((_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) || "";
68258
68262
  const allCalculateTypes = document.querySelectorAll("[type='calculate']");
68259
68263
  const activeCell = allCalculateTypes[0];
68264
+ if (!activeCell)
68265
+ return;
68260
68266
  const activeCellValue = Number(activeCell["value"]);
68261
- const calculteValue = Number(calculatorValue);
68262
- if (!activeCell || calculteValue !== activeCellValue)
68267
+ const calculateValue = Number(calculatorValue);
68268
+ if (activeCellValue !== calculateValue)
68263
68269
  return;
68264
68270
  const equation = activeCell["string"];
68265
- // Replace equation after a short delay
68266
- //await new Promise(r => setTimeout(r, 200));
68267
- activeCell.innerHTML = equation.replaceAll("?", calculteValue);
68271
+ const element1 = container.querySelector("#dummy111");
68268
68272
  const element2 = container.querySelector("#dummy112");
68273
+ // 1. mascot animation
68274
+ await wait(3000);
68275
+ // Save previous element2 BEFORE overwriting
68276
+ const previousElement2Content = element2.innerHTML;
68277
+ // Replace ?
68278
+ activeCell.innerHTML = equation.replaceAll("?", calculateValue.toString());
68279
+ // Update element2 with NEW content
68269
68280
  element2.innerHTML = activeCell.innerHTML;
68270
- // Animate and clean up
68281
+ // 3. animate out
68271
68282
  await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
68283
+ // 4. update element1 ONLY from second equation onwards
68284
+ if (previousElement2Content) {
68285
+ element1.innerHTML = previousElement2Content;
68286
+ }
68272
68287
  };
68273
- // Function: handles equation check when clicked on OK
68288
+ /* ------------------ MAIN HANDLER ------------------ */
68274
68289
  let score = 0;
68275
68290
  const handleSolvedEquationSubmissionAndScoreUpdate = async () => {
68276
68291
  var _a;
68277
- const container = document.getElementById('lido-container');
68278
- const calculatorValue = (_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value");
68292
+ const container = document.getElementById("lido-container");
68293
+ if (!container)
68294
+ return;
68295
+ const calculatorValue = ((_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) || "";
68296
+ if (!calculatorValue.length)
68297
+ return;
68279
68298
  const allCalculateTypes = document.querySelectorAll("[type='calculate']");
68280
68299
  const activeCell = allCalculateTypes[0];
68300
+ if (!activeCell)
68301
+ return;
68281
68302
  const isContinueOnCorrect = container.getAttribute("is-continue-on-correct") === "true";
68282
68303
  const activeCellValue = Number(activeCell["value"]);
68283
- const calculteValue = Number(calculatorValue);
68304
+ const calculateValue = Number(calculatorValue);
68284
68305
  const element1 = container.querySelector("#dummy111");
68285
68306
  const element2 = container.querySelector("#dummy112");
68286
- // PRACTICE MODE (continue only if correct)
68307
+ /* ---------- PRACTICE MODE ---------- */
68287
68308
  if (isContinueOnCorrect) {
68288
- if (element2.innerHTML.length > 0 && activeCellValue === calculteValue) {
68289
- element1.innerHTML = element2.innerHTML;
68290
- }
68291
68309
  await checkEquationOfActiveCell(container);
68310
+ return;
68311
+ }
68312
+ /* ---------- TEST MODE ---------- */
68313
+ // Score update
68314
+ if (activeCellValue === calculateValue) {
68315
+ score++;
68292
68316
  }
68293
- // TEST MODE (store all, animate regardless of correctness)
68294
68317
  else {
68295
- if (calculatorValue.length > 0) {
68296
- if (calculatorValue === activeCell["value"]) {
68297
- score++;
68298
- console.log("SCOREEEE", score);
68299
- }
68300
- else {
68301
- if (score > 0) {
68302
- score--;
68303
- }
68304
- console.log("SCOREEEE", score);
68305
- }
68306
- if (element2.innerHTML.length > 0) {
68307
- element1.innerHTML = element2.innerHTML;
68308
- }
68309
- const equation = activeCell["string"];
68310
- // Replace value visually
68311
- activeCell.innerHTML = equation.replaceAll("?", calculteValue);
68312
- element2.innerHTML = activeCell.innerHTML;
68313
- // Animate
68314
- await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
68315
- }
68318
+ if (score > 0)
68319
+ score--;
68320
+ }
68321
+ console.log("SCORE:", score);
68322
+ const equation = activeCell["string"];
68323
+ //1. mascot animation
68324
+ await wait(3000);
68325
+ // Save previous element2 BEFORE overwrite
68326
+ const previousElement2Content = element2.innerHTML;
68327
+ // Replace ?
68328
+ activeCell.innerHTML = equation.replaceAll("?", calculateValue.toString());
68329
+ // Update element2 with new content
68330
+ element2.innerHTML = activeCell.innerHTML;
68331
+ //3. animate out
68332
+ await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
68333
+ //4. update element1 ONLY after animation & only if previous exists
68334
+ if (previousElement2Content) {
68335
+ element1.innerHTML = previousElement2Content;
68316
68336
  }
68317
68337
  };
68318
68338
 
@@ -68973,6 +68993,7 @@ const afterDropDragHandling = (dragElement, dropElement) => {
68973
68993
  dummyElement.classList.remove('dropped');
68974
68994
  dummyElement.removeAttribute('drop-to');
68975
68995
  dummyElement.removeAttribute('drop-time');
68996
+ dummyElement.style.opacity = "1";
68976
68997
  dragElement.style.width = dropElement.style.width;
68977
68998
  dragElement.style.height = dropElement.style.height;
68978
68999
  dragElement.setAttribute('hasDummy', 'true');
@@ -69048,6 +69069,7 @@ function cloneElementWithComputedStyles(originalEl) {
69048
69069
  clone.style.margin = originalEl.style.margin;
69049
69070
  clone.style.opacity = originalEl.style.opacity;
69050
69071
  clone.style.transform = originalEl.style.transform;
69072
+ clone.style.borderRadius = originalEl.style.borderRadius;
69051
69073
  clone.setAttribute("visible", "true");
69052
69074
  clone.setAttribute("data-dummy", "true");
69053
69075
  if (tag === "lido-math-matrix") {
@@ -69076,6 +69098,7 @@ const parseActions = (input) => {
69076
69098
  return actions;
69077
69099
  };
69078
69100
  const matchStringPattern = (pattern, arr) => {
69101
+ var _a;
69079
69102
  const patternGroups = pattern.split(',').map(group => group.trim());
69080
69103
  let arrIndex = 0;
69081
69104
  let options = new Set();
@@ -69088,21 +69111,25 @@ const matchStringPattern = (pattern, arr) => {
69088
69111
  }
69089
69112
  for (const group of patternGroups) {
69090
69113
  if (group.startsWith('(') && group.endsWith(')')) {
69091
- // Inside parentheses: '|' acts like "OR" condition
69092
- const choices = group
69093
- .slice(1, -1)
69094
- .split('|')
69095
- .map(option => option.trim());
69096
- const arrChoice = arr[arrIndex]
69097
- .slice(1, -1)
69098
- .split('|')
69099
- .map(option => option.trim());
69100
- if (arrIndex > arrChoice.length)
69114
+ // Parenthesized group: treat choices as a set (order-insensitive)
69115
+ const choices = group.slice(1, -1).split('|').map(option => option.trim());
69116
+ const arrVal = (_a = arr[arrIndex]) !== null && _a !== void 0 ? _a : '';
69117
+ let arrChoice = [];
69118
+ if (arrVal.startsWith('(') && arrVal.endsWith(')')) {
69119
+ arrChoice = arrVal.slice(1, -1).split('|').map(option => option.trim());
69120
+ }
69121
+ else if (arrVal.includes('|')) {
69122
+ arrChoice = arrVal.split('|').map(option => option.trim());
69123
+ }
69124
+ else if (arrVal !== '') {
69125
+ arrChoice = [arrVal.trim()];
69126
+ }
69127
+ else {
69101
69128
  return false;
69102
- for (let i = 0; i < choices.length; i++) {
69103
- if (!choices.includes(arrChoice[i]))
69104
- return false;
69105
69129
  }
69130
+ const normalize = (items) => items.map(s => s.trim()).sort().join('|');
69131
+ if (normalize(choices) !== normalize(arrChoice))
69132
+ return false;
69106
69133
  arrIndex++;
69107
69134
  }
69108
69135
  else if (group.includes('|')) {
@@ -69114,8 +69141,9 @@ const matchStringPattern = (pattern, arr) => {
69114
69141
  }
69115
69142
  else {
69116
69143
  // Exact match required
69117
- if (arrIndex >= arr.length || arr[arrIndex] !== group)
69144
+ if (arrIndex >= arr.length || arr[arrIndex] !== group) {
69118
69145
  return false;
69146
+ }
69119
69147
  arrIndex++;
69120
69148
  }
69121
69149
  }
@@ -69198,10 +69226,10 @@ async function onActivityComplete(dragElement, dropElement) {
69198
69226
  drag[index].push(dragElement.id);
69199
69227
  const allElements = document.querySelectorAll("[type='drop']");
69200
69228
  allElements.forEach(otherElement => {
69201
- var _a;
69229
+ var _a, _b;
69202
69230
  const storedTabIndexes = Object.keys(dragScore).map(Number);
69203
69231
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
69204
- if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
69232
+ if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) && !(((_b = container.getAttribute('drop-action')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === DropMode.InfiniteDrop)) {
69205
69233
  if (otherElement) {
69206
69234
  otherElement.style.opacity = "0";
69207
69235
  }
@@ -69242,7 +69270,6 @@ const storeActivityScore = (score) => {
69242
69270
  const handleShowCheck = () => {
69243
69271
  var _a, _b;
69244
69272
  const container = document.getElementById(LidoContainer);
69245
- container.setAttribute("click-completed", "true");
69246
69273
  const objectiveString = container['objective'];
69247
69274
  const selectValues = (_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '';
69248
69275
  const checkButton = document.querySelector('#lido-checkButton');
@@ -69267,7 +69294,10 @@ const handleShowCheck = () => {
69267
69294
  }
69268
69295
  }
69269
69296
  else {
69270
- validateObjectiveStatus();
69297
+ if (!container.getAttribute("game-completed")) {
69298
+ validateObjectiveStatus();
69299
+ }
69300
+ container.setAttribute("game-completed", "true");
69271
69301
  }
69272
69302
  };
69273
69303
  let res;
@@ -69317,9 +69347,12 @@ const validateObjectiveStatus = async () => {
69317
69347
  if (attach === 'true') {
69318
69348
  appendingDragElementsInDrop();
69319
69349
  }
69320
- storingEachActivityScore(true);
69350
+ if (container.querySelectorAll("[type='click']").length > 0) {
69351
+ storingEachActivityScore(true);
69352
+ }
69321
69353
  await executeActions(onCorrect, container);
69322
69354
  }
69355
+ calculateScore();
69323
69356
  if (container.getAttribute('dropAttr') === 'EnableAnimation') {
69324
69357
  setTimeout(() => {
69325
69358
  triggerNextContainer();
@@ -69328,14 +69361,13 @@ const validateObjectiveStatus = async () => {
69328
69361
  else {
69329
69362
  triggerNextContainer();
69330
69363
  }
69331
- await calculateScore();
69332
69364
  }
69333
69365
  else {
69334
69366
  const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
69335
69367
  const onCorrect = container.getAttribute('onCorrect');
69336
69368
  if (!isContinueOnCorrect) {
69337
- await calculateScore();
69338
69369
  storingEachActivityScore(false);
69370
+ calculateScore();
69339
69371
  await executeActions(onCorrect, container);
69340
69372
  triggerNextContainer();
69341
69373
  }
@@ -69343,7 +69375,7 @@ const validateObjectiveStatus = async () => {
69343
69375
  const onInCorrect = container.getAttribute('onInCorrect');
69344
69376
  storingEachActivityScore(false);
69345
69377
  await executeActions(onInCorrect, container);
69346
- container.removeAttribute("click-completed");
69378
+ container.removeAttribute("game-completed");
69347
69379
  }
69348
69380
  }
69349
69381
  };
@@ -69826,20 +69858,18 @@ const questionBoxAnimation = async (element, value) => {
69826
69858
  const dragElements = Array.from(element.querySelectorAll("[type='drag']"));
69827
69859
  // Ensure all drag childrens which is dropped disappear
69828
69860
  dragElements.forEach(dragElement => {
69829
- if (dragElement.hasAttribute('drop-to')) {
69861
+ const dropToAttr = dragElement.getAttribute('drop-to');
69862
+ if (dropToAttr && dropToAttr !== '') {
69830
69863
  dragElement.style.transition = 'opacity 0.5s ease';
69831
69864
  dragElement.style.opacity = '0'; // Fade out
69832
- setTimeout(() => {
69833
- dragElement.remove(); // Remove from view after fade-out
69834
- }, 500);
69835
- }
69836
- });
69837
- // Reveal all drop childrens which is hidden
69838
- const dropElements = Array.from(element.querySelectorAll("[type='drop']"));
69839
- dropElements.forEach(dropEl => {
69840
- const dropVal = dropEl.getAttribute("value");
69841
- if (dropVal && dropEl.innerText.trim() === "?") {
69842
- dropEl.innerText = dropVal;
69865
+ const dropEl = document.getElementById(dropToAttr);
69866
+ const dragVal = dragElement.getAttribute("value");
69867
+ if (dragVal && dropEl.innerText.trim() === "?") {
69868
+ dropEl.innerText = dragVal;
69869
+ }
69870
+ // setTimeout(() => {
69871
+ // // dragElement.remove() // Remove from view after fade-out
69872
+ // }, 500);
69843
69873
  }
69844
69874
  });
69845
69875
  };
@@ -94,7 +94,9 @@ export class LidoCalculator {
94
94
  }
95
95
  }
96
96
  this.onOk.emit(isCorrect);
97
+ const okbtn = document.getElementById("btn-11");
97
98
  if (isCorrect) {
99
+ okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
98
100
  this.displayValue = "";
99
101
  storingEachActivityScore(isCorrect);
100
102
  const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
@@ -111,15 +113,23 @@ export class LidoCalculator {
111
113
  }
112
114
  }
113
115
  else {
116
+ okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
114
117
  this.displayValue = "";
115
118
  storingEachActivityScore(isCorrect);
116
119
  const onInCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onInCorrect')) || '';
117
- await executeActions(onInCorrect, container);
120
+ const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
121
+ if (container.getAttribute('is-continue-on-correct') === 'false') {
122
+ await executeActions(onCorrect, container);
123
+ }
124
+ else {
125
+ await executeActions(onInCorrect, container);
126
+ }
118
127
  }
128
+ okbtn.style.pointerEvents = 'auto'; // Re-enable OK button after processing
119
129
  }
120
130
  render() {
121
131
  const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
122
- return (h(Host, { key: '394177b08965252a6008cce3284475c6176eca3d', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, h("lido-cell", { key: '1c79a951e666ad4171b686400f0ba391783e693f', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: '70da4a0990c7ae72367f8d61026c1d4e6f682d48', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: 'c510e7f1cc6ec5d34683030fff988054ac721225', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: '790d7bd307e296cc8e05e29705ebf4bfdda49906', class: "lido-calculator-displayParent" }, h("div", { key: 'f0195ce772bffdee06483da524f8a392dffdde38', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: '00fda79dab52a801acafe6006db0dd50923ea74b', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
132
+ return (h(Host, { key: '595c92e80baed8e1709c51302aa427d672b3a9e0', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, h("lido-cell", { key: '4a2966a46fd008d66fedeb5f44e0ee2c5e8c083a', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: '35e38f7412be8489b668ba0aab927b7ba3d98f29', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: '926def912022a30a27f5419d98348beb84fc1a42', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: '41a69c7aa7d1dfbeea19b1a1ef095b97d2c953ba', class: "lido-calculator-displayParent" }, h("div", { key: '047dfc84e8b02739a982287f82b1df2b7f552dcd', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: '41cd91f2c9aa40f6adcf6b0318e07e394bc3b38e', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
123
133
  'lido-calculator-btn-special': num === '←' || num === 'OK',
124
134
  'lido-calculator-btn-default': num !== '←' && num !== 'OK'
125
135
  }, onClick: () => this.handleClick(num) }))))));
@@ -46,7 +46,7 @@ function getContainerXml(args) {
46
46
  </lido-text>
47
47
  </lido-pos>
48
48
  <!-- question -->
49
- <lido-text visible="true" audio="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/fill-in-the-blanks/fill-upAudio.mp3" id="heading" tab-index="12" height="landscape.100px,portrait.175px" font-family="'Baloo Bhai 2'" font-size="60px" width="landscape.auto,portrait.86%" string="Drop the elements to match the given symbol '${objective}'" font-color="black" bg-color="white" y="landscape.0%,portrait.-12%" onEntry="this.speak='true';this.font-weight='600'; this.position='relative';">
49
+ <lido-text visible="true" tab-index="12" height="landscape.100px,portrait.175px" font-family="'Baloo Bhai 2'" font-size="60px" width="landscape.auto,portrait.86%" string="Drop the elements to match the given symbol '${objective}'" font-color="black" bg-color="white" y="landscape.0%,portrait.-12%" onEntry="this.font-weight='600'; this.position='relative';">
50
50
  </lido-text>
51
51
  <lido-balance tilt="0" operation="add" visible="true" height="landscape.456px,portrait.500px" y="landscape.4%,portrait.0%" width="landscape.1136px,portrait.876px">
52
52
  <!-- drop Element -->