lido-player 0.0.2-alpha-50-dev → 0.0.2-alpha-51-dev

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 (213) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/{index-6a69c33a.js → index-baff5c15.js} +48 -14
  3. package/dist/cjs/index.cjs.js +2 -2
  4. package/dist/cjs/{lido-avatar_21.cjs.entry.js → lido-avatar_22.cjs.entry.js} +3043 -162
  5. package/dist/cjs/lido-player.cjs.js +2 -2
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/{utils-079a5e7d.js → utils-dc02d753.js} +150 -95
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/avatar/lido-avatar.css +4 -4
  10. package/dist/collection/components/avatar/lido-avatar.js +1 -1
  11. package/dist/collection/components/calculator/lido-calculator.css +87 -87
  12. package/dist/collection/components/calculator/lido-calculator.js +14 -8
  13. package/dist/collection/components/canvas/lido-canvas.css +38 -0
  14. package/dist/collection/components/canvas/lido-canvas.js +220 -0
  15. package/dist/collection/components/cell/lido-cell.css +100 -100
  16. package/dist/collection/components/cell/lido-cell.js +12 -12
  17. package/dist/collection/components/column/lido-col.css +19 -19
  18. package/dist/collection/components/column/lido-col.js +6 -6
  19. package/dist/collection/components/container/lido-container.css +10 -10
  20. package/dist/collection/components/container/lido-container.js +70 -8
  21. package/dist/collection/components/flashCard/lido-flash-card.css +28 -28
  22. package/dist/collection/components/flashCard/lido-flash-card.js +4 -4
  23. package/dist/collection/components/float/lido-float.css +30 -30
  24. package/dist/collection/components/float/lido-float.js +2 -2
  25. package/dist/collection/components/home/lido-home.css +278 -278
  26. package/dist/collection/components/home/lido-home.js +92 -12
  27. package/dist/collection/components/image/lido-image.css +17 -17
  28. package/dist/collection/components/image/lido-image.js +6 -6
  29. package/dist/collection/components/keyboard/lido-keyboard.css +38 -38
  30. package/dist/collection/components/keyboard/lido-keyboard.js +3 -3
  31. package/dist/collection/components/mathMatrix/lido-math-matrix.css +56 -56
  32. package/dist/collection/components/mathMatrix/lido-math-matrix.js +56 -2
  33. package/dist/collection/components/position/lido-pos.css +16 -16
  34. package/dist/collection/components/position/lido-pos.js +2 -2
  35. package/dist/collection/components/random/lido-random.css +8 -8
  36. package/dist/collection/components/random/lido-random.js +2 -2
  37. package/dist/collection/components/root/lido-root.js +42 -6
  38. package/dist/collection/components/row/lido-row.css +10 -10
  39. package/dist/collection/components/row/lido-row.js +6 -6
  40. package/dist/collection/components/scale/lido-balance.css +145 -114
  41. package/dist/collection/components/scale/lido-balance.js +17 -17
  42. package/dist/collection/components/shape/lido-shape.css +96 -96
  43. package/dist/collection/components/shape/lido-shape.js +5 -5
  44. package/dist/collection/components/slideFill/lido-slide-fill.css +3 -3
  45. package/dist/collection/components/slideFill/lido-slide-fill.js +13 -13
  46. package/dist/collection/components/text/lido-text.css +53 -53
  47. package/dist/collection/components/text/lido-text.js +6 -5
  48. package/dist/collection/components/trace/lido-trace.css +97 -97
  49. package/dist/collection/components/trace/lido-trace.js +2 -2
  50. package/dist/collection/components/wrap/lido-wrap.css +18 -18
  51. package/dist/collection/components/wrap/lido-wrap.js +6 -6
  52. package/dist/collection/css/animation.css +194 -194
  53. package/dist/collection/css/index.css +277 -277
  54. package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +60 -60
  55. package/dist/collection/stories/Templates/LetterPairing/LetterPairing.stories.js +123 -123
  56. package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +55 -48
  57. package/dist/collection/stories/Templates/Tag/tagGame.stories.js +29 -29
  58. package/dist/collection/stories/Templates/arrangeLetters/arrangeLetters.stories.js +42 -42
  59. package/dist/collection/stories/Templates/balancing/balancing.stories.js +37 -31
  60. package/dist/collection/stories/Templates/balloonPop/balloonPop.stories.js +38 -38
  61. package/dist/collection/stories/Templates/bubbleType/bubbleType.stories.js +42 -42
  62. package/dist/collection/stories/Templates/calculator/calculator.stories.js +48 -0
  63. package/dist/collection/stories/Templates/categorize/categorize.stories.js +37 -37
  64. package/dist/collection/stories/Templates/categorize2/categorize2.stories.js +67 -67
  65. package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +28 -22
  66. package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +13 -13
  67. package/dist/collection/stories/Templates/create-sentence/createSentence.stories.js +74 -74
  68. package/dist/collection/stories/Templates/dragAndDrop/drag-drop.stories.js +69 -69
  69. package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +37 -37
  70. package/dist/collection/stories/Templates/fillBlank/fill-blank.stories.js +282 -282
  71. package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +35 -35
  72. package/dist/collection/stories/Templates/grid/grid.stories.js +118 -118
  73. package/dist/collection/stories/Templates/gridGame/grid-game.stories.js +57 -57
  74. package/dist/collection/stories/Templates/jumpSentence/jumpSentence.stories.js +41 -41
  75. package/dist/collection/stories/Templates/letterboard/letterboard.stories.js +183 -183
  76. package/dist/collection/stories/Templates/makeSentence/make-sentence.stories.js +36 -36
  77. package/dist/collection/stories/Templates/matchBox/matchBox.stories.js +69 -69
  78. package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +54 -54
  79. package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +23 -23
  80. package/dist/collection/stories/Templates/multipleOption/mcqWithQuestionImage.stories.js +112 -112
  81. package/dist/collection/stories/Templates/multipleOption/multiple-option.stories.js +47 -47
  82. package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +32 -28
  83. package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +56 -54
  84. package/dist/collection/stories/Templates/numberBoard/numberBoard.stories.js +56 -45
  85. package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +38 -38
  86. package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +131 -127
  87. package/dist/collection/stories/Templates/openwindow/openwindow.stories.js +53 -49
  88. package/dist/collection/stories/Templates/openwindow/openwindow2.stories.js +44 -40
  89. package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +96 -96
  90. package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +90 -90
  91. package/dist/collection/stories/Templates/phonic-tractor/phonic-tractor.stories.js +47 -45
  92. package/dist/collection/stories/Templates/picturemeaning/pictureMeaningCocos.stories.js +20 -20
  93. package/dist/collection/stories/Templates/puzzleGame/puzzleGame.stories.js +17 -17
  94. package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +62 -58
  95. package/dist/collection/stories/Templates/quizLiteracy/quizLiteracy.stories.js +50 -50
  96. package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWithText.stories.js +36 -36
  97. package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWord.stories.js +43 -43
  98. package/dist/collection/stories/Templates/reorder/reorder.stories.js +63 -63
  99. package/dist/collection/stories/Templates/rowBlocks/rowBlocks.stories.js +52 -48
  100. package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +65 -61
  101. package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +62 -58
  102. package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +111 -107
  103. package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +46 -46
  104. package/dist/collection/stories/Templates/spellDoor/spellDoor.stories.js +41 -41
  105. package/dist/collection/stories/Templates/storyTale/storyTale.stories.js +39 -39
  106. package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +51 -47
  107. package/dist/collection/stories/Templates/total/total.stories.js +27 -27
  108. package/dist/collection/stories/Templates/writeCard/writeCard.stories.js +35 -31
  109. package/dist/collection/stories/Templates/writeLetter/writeLetter.stories.js +62 -58
  110. package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +44 -40
  111. package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +36 -32
  112. package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +37 -33
  113. package/dist/collection/stories/components/flash-card.stories.js +48 -48
  114. package/dist/collection/stories/components/keyboard.stories.js +10 -10
  115. package/dist/collection/stories/components/slider.stories.js +4 -4
  116. package/dist/collection/stories/components/trace.stories.js +5 -5
  117. package/dist/collection/utils/audioPlayer.js +43 -6
  118. package/dist/collection/utils/constants.js +1 -0
  119. package/dist/collection/utils/i18n.js +36 -0
  120. package/dist/collection/utils/utils.js +36 -29
  121. package/dist/collection/utils/utilsHandlers/clickHandler.js +5 -1
  122. package/dist/collection/utils/utilsHandlers/dragDropHandler.js +17 -9
  123. package/dist/collection/utils/utilsHandlers/highlightHandler.js +54 -54
  124. package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +2 -2
  125. package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +9 -9
  126. package/dist/collection/utils/utilsHandlers/sortHandler.js +10 -10
  127. package/dist/components/index.js +1 -1
  128. package/dist/components/lido-avatar.js +1 -1
  129. package/dist/components/lido-balance.js +1 -1
  130. package/dist/components/lido-calculator.js +1 -1
  131. package/dist/components/lido-canvas.d.ts +11 -0
  132. package/dist/components/lido-canvas.js +6 -0
  133. package/dist/components/lido-cell.js +1 -1
  134. package/dist/components/lido-col.js +1 -1
  135. package/dist/components/lido-container.js +1 -1
  136. package/dist/components/lido-flash-card.js +1 -1
  137. package/dist/components/lido-float.js +1 -1
  138. package/dist/components/lido-home.js +1 -1
  139. package/dist/components/lido-image.js +1 -1
  140. package/dist/components/lido-keyboard.js +1 -1
  141. package/dist/components/lido-math-matrix.js +1 -1
  142. package/dist/components/lido-pos.js +1 -1
  143. package/dist/components/lido-random.js +1 -1
  144. package/dist/components/lido-root.js +49 -25
  145. package/dist/components/lido-row.js +1 -1
  146. package/dist/components/lido-shape.js +1 -1
  147. package/dist/components/lido-slide-fill.js +1 -1
  148. package/dist/components/lido-text.js +1 -1
  149. package/dist/components/lido-trace.js +1 -1
  150. package/dist/components/lido-wrap.js +1 -1
  151. package/dist/components/{p-73e31a86.js → p-04e904b5.js} +8 -8
  152. package/dist/components/p-0fbeb3a1.js +2700 -0
  153. package/dist/components/{p-1fbdb431.js → p-12432f23.js} +2 -2
  154. package/dist/components/p-1c84cf65.js +123 -0
  155. package/dist/components/{p-74849cdd.js → p-1f3c2783.js} +4 -4
  156. package/dist/components/{p-e4e42677.js → p-4fd6b588.js} +2 -2
  157. package/dist/components/{p-e36ddcc1.js → p-56c8f3da.js} +14 -11
  158. package/dist/components/{p-cbac3cbc.js → p-62d2a5b3.js} +2 -2
  159. package/dist/components/{p-44808985.js → p-6ba0f1af.js} +7 -7
  160. package/dist/components/{p-52844fa4.js → p-6be6c5eb.js} +2 -2
  161. package/dist/components/{p-08d0deab.js → p-74b90a9c.js} +9 -3
  162. package/dist/components/{p-d37ab4dc.js → p-988477ad.js} +2 -2
  163. package/dist/components/{p-7f7e5672.js → p-a8724f06.js} +2 -2
  164. package/dist/components/{p-3f406017.js → p-b7efadad.js} +2 -2
  165. package/dist/components/{p-15971ede.js → p-b89371ac.js} +1 -1
  166. package/dist/components/{p-904711c8.js → p-bb907e43.js} +2 -2
  167. package/dist/components/{p-afbc196f.js → p-bef96764.js} +3 -2
  168. package/dist/components/{p-322acda6.js → p-c8815e84.js} +67 -31
  169. package/dist/components/{p-835b973d.js → p-caa05d1e.js} +2 -2
  170. package/dist/components/{p-bed94c37.js → p-d0131159.js} +187 -105
  171. package/dist/components/{p-29bdd953.js → p-d3f7d561.js} +2 -2
  172. package/dist/components/{p-90465904.js → p-d7693f47.js} +2 -2
  173. package/dist/components/{p-9be56729.js → p-e9548986.js} +46 -2
  174. package/dist/esm/{index-170e58c7.js → index-37c2ad2d.js} +48 -14
  175. package/dist/esm/index.js +2 -2
  176. package/dist/esm/{lido-avatar_21.entry.js → lido-avatar_22.entry.js} +3043 -163
  177. package/dist/esm/lido-player.js +3 -3
  178. package/dist/esm/loader.js +3 -3
  179. package/dist/esm/{utils-5df09162.js → utils-b5eb2360.js} +150 -95
  180. package/dist/lido-player/index.esm.js +1 -1
  181. package/dist/lido-player/lido-player.esm.js +1 -1
  182. package/dist/lido-player/p-9a9d5339.js +2 -0
  183. package/dist/lido-player/{p-7556e652.js → p-9fd87d44.js} +2 -2
  184. package/dist/lido-player/p-e1a9c26f.entry.js +1 -0
  185. package/dist/types/components/canvas/lido-canvas.d.ts +27 -0
  186. package/dist/types/components/container/lido-container.d.ts +6 -0
  187. package/dist/types/components/home/lido-home.d.ts +8 -0
  188. package/dist/types/components/mathMatrix/lido-math-matrix.d.ts +3 -0
  189. package/dist/types/components/root/lido-root.d.ts +5 -0
  190. package/dist/types/components.d.ts +71 -0
  191. package/dist/types/stories/Templates/RocketGame/rocketGame.stories.d.ts +1 -0
  192. package/dist/types/stories/Templates/calculator/calculator.stories.d.ts +4 -0
  193. package/dist/types/stories/Templates/multiplyBeeds/multiplyBeeds.stories.d.ts +1 -0
  194. package/dist/types/stories/Templates/openwindow/openwindow.stories.d.ts +1 -0
  195. package/dist/types/stories/Templates/openwindow/openwindow2.stories.d.ts +1 -0
  196. package/dist/types/stories/Templates/questionBoard/questionBoard.stories.d.ts +1 -0
  197. package/dist/types/stories/Templates/sequenceBox/sequenceBox1.stories.d.ts +1 -0
  198. package/dist/types/stories/Templates/sequenceBox/sequenceBox2.stories.d.ts +1 -0
  199. package/dist/types/stories/Templates/shapePair/shape-pair.stories.d.ts +1 -1
  200. package/dist/types/stories/Templates/sumTogether/sumTogether.stories.d.ts +1 -0
  201. package/dist/types/stories/Templates/writeCard/writeCard.stories.d.ts +1 -0
  202. package/dist/types/stories/Templates/writeLetter/writeLetter.stories.d.ts +1 -0
  203. package/dist/types/stories/Templates/writeNumber/writeNumber.stories.d.ts +1 -0
  204. package/dist/types/stories/Templates/writeWord/writeWord.stories.d.ts +1 -0
  205. package/dist/types/types/json.d.ts +4 -0
  206. package/dist/types/utils/audioPlayer.d.ts +2 -0
  207. package/dist/types/utils/constants.d.ts +1 -0
  208. package/dist/types/utils/i18n.d.ts +5 -0
  209. package/dist/types/utils/utils.d.ts +1 -0
  210. package/package.json +71 -69
  211. package/readme.md +113 -113
  212. package/dist/lido-player/p-137c99ce.js +0 -2
  213. package/dist/lido-player/p-eb956325.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index$1 = require('./index-6a69c33a.js');
3
+ const index$1 = require('./index-baff5c15.js');
4
4
 
5
5
  const DragMapKey = 'lidoDragMap';
6
6
  const SelectedValuesKey = 'lidoSelectedValues';
@@ -116,34 +116,34 @@ function highlightSpeakingElement(element) {
116
116
  if (!document.querySelector(styleId)) {
117
117
  const style = document.createElement('style');
118
118
  style.id = styleId;
119
- style.innerHTML = `
120
- .speaking-highlight {
121
- --base-transform: ${element.style.transform};
122
- box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
123
- // border: 3px solid green !important;
124
- // transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
125
- // transform: scale(1.05); /* Subtle scale effect to pop the element */
126
- // animation: pulseEffect 1.5s infinite; /* Pulsing animation */
127
-
128
- }
129
-
130
- @keyframes pulseEffect {
131
- 0% {
132
- box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
133
- // transform: var(--base-transform) scale(1.05);
134
- // background-color: #FFFF0B;
135
- }
136
- 50% {
137
- box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
138
- // transform: var(--base-transform) scale(1.1);
139
- // background-color: #FFFF0B;
140
- }
141
- 100% {
142
- box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
143
- // transform: var(--base-transform) scale(1.05);
144
- // background-color: #FFFF0B;
145
- }
146
- }
119
+ style.innerHTML = `
120
+ .speaking-highlight {
121
+ --base-transform: ${element.style.transform};
122
+ box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
123
+ // border: 3px solid green !important;
124
+ // transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
125
+ // transform: scale(1.05); /* Subtle scale effect to pop the element */
126
+ // animation: pulseEffect 1.5s infinite; /* Pulsing animation */
127
+
128
+ }
129
+
130
+ @keyframes pulseEffect {
131
+ 0% {
132
+ box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
133
+ // transform: var(--base-transform) scale(1.05);
134
+ // background-color: #FFFF0B;
135
+ }
136
+ 50% {
137
+ box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
138
+ // transform: var(--base-transform) scale(1.1);
139
+ // background-color: #FFFF0B;
140
+ }
141
+ 100% {
142
+ box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
143
+ // transform: var(--base-transform) scale(1.05);
144
+ // background-color: #FFFF0B;
145
+ }
146
+ }
147
147
  `;
148
148
  document.head.appendChild(style);
149
149
  }
@@ -215,8 +215,8 @@ function balanceResult(container, objectiveString) {
215
215
  return false;
216
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
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) && leftVal !== 0;
219
- const hasRight = !isNaN(rightVal) && rightVal !== 0;
218
+ const hasLeft = !isNaN(leftVal);
219
+ const hasRight = !isNaN(rightVal);
220
220
  if (!hasLeft || !hasRight) {
221
221
  return false;
222
222
  }
@@ -266,6 +266,7 @@ function enableOptionArea(element) {
266
266
  }
267
267
  let isDraggingDisabled = false;
268
268
  const setDraggingDisabled = (disabled) => {
269
+ console.log("Setting dragging disabled to:", disabled);
269
270
  isDraggingDisabled = disabled;
270
271
  };
271
272
  function enableDraggingWithScaling(element) {
@@ -748,6 +749,9 @@ async function onElementDropComplete(dragElement, dropElement) {
748
749
  if (!isCorrect) {
749
750
  dragElement.style.transition = 'transform 0.5s ease';
750
751
  animateDragToTarget(dragElement, dropElement, container);
752
+ const onInCorrect = dropElement.getAttribute('onInCorrect');
753
+ console.log("onincorrectttt", onInCorrect);
754
+ await executeActions(onInCorrect, dropElement, dragElement);
751
755
  setTimeout(() => {
752
756
  dragElement.style.transform = 'translate(0, 0)';
753
757
  // const oldDropIndex = dragToDropMap[dragElement.getAttribute('data-id')];
@@ -1016,14 +1020,14 @@ async function onClickDropOrDragElement(element, type) {
1016
1020
  if (!document.querySelector('#dynamic-highlight-style')) {
1017
1021
  const style = document.createElement('style');
1018
1022
  style.id = 'dynamic-highlight-style';
1019
- style.innerHTML = `
1020
- .highlight {
1021
- // border: 4px solid #e74c3c; /* Thicker red border for more visibility */
1022
- // border-radius: 12px; /* Larger rounded corners */
1023
- // background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
1024
- // box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
1025
- // outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
1026
- }
1023
+ style.innerHTML = `
1024
+ .highlight {
1025
+ // border: 4px solid #e74c3c; /* Thicker red border for more visibility */
1026
+ // border-radius: 12px; /* Larger rounded corners */
1027
+ // background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
1028
+ // box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
1029
+ // outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
1030
+ }
1027
1031
  `;
1028
1032
  document.head.appendChild(style);
1029
1033
  }
@@ -1065,7 +1069,11 @@ async function onClickDropOrDragElement(element, type) {
1065
1069
  }
1066
1070
  const dragToDropMap = new Map();
1067
1071
  async function onClickDragElement(element) {
1068
- AudioPlayer.getI().stop();
1072
+ const audioAttr = element.getAttribute('audio');
1073
+ const hasValidAudio = audioAttr && audioAttr.trim().length > 0;
1074
+ if (hasValidAudio) {
1075
+ AudioPlayer.getI().stop();
1076
+ }
1069
1077
  const dropElements = buildDropHasDragFromDOM();
1070
1078
  const dragEl = element;
1071
1079
  if (!dragEl) {
@@ -1140,6 +1148,7 @@ class AudioPlayer {
1140
1148
  this.audioElement = document.createElement('audio');
1141
1149
  this.audioElement.id = 'audio';
1142
1150
  document.body.appendChild(this.audioElement);
1151
+ this.registerGlobalStopEvents();
1143
1152
  }
1144
1153
  static getI() {
1145
1154
  if (!AudioPlayer.instance) {
@@ -1165,13 +1174,23 @@ class AudioPlayer {
1165
1174
  }
1166
1175
  }
1167
1176
  async play(targetElement) {
1177
+ // Stop any currently playing audio first if target element has audio given
1178
+ try {
1179
+ await AudioPlayer.getI().stop();
1180
+ }
1181
+ catch (e) {
1182
+ console.error('Error stopping audio before speak action:', e);
1183
+ }
1184
+ // then play the target element audio.
1168
1185
  let audioUrl = targetElement.getAttribute('audio') || '';
1186
+ // If no direct audio attribute, check childrens for audio
1169
1187
  if (!audioUrl) {
1170
1188
  const childElements = targetElement.children;
1171
1189
  for (let i = 0; i < childElements.length; i++) {
1172
1190
  const childAudioUrl = childElements[i].getAttribute('audio');
1173
1191
  if (childAudioUrl) {
1174
1192
  audioUrl = childAudioUrl;
1193
+ break;
1175
1194
  }
1176
1195
  }
1177
1196
  }
@@ -1181,18 +1200,21 @@ class AudioPlayer {
1181
1200
  console.log('🚀 Playing audio:', this.audioElement.src);
1182
1201
  try {
1183
1202
  setDraggingDisabled(true);
1184
- await this.audioElement.play();
1185
1203
  highlightSpeakingElement(targetElement);
1204
+ await this.audioElement.play();
1186
1205
  await new Promise(resolve => {
1187
1206
  this.audioElement.onended = () => {
1188
- stopHighlightForSpeakingElement(targetElement);
1189
1207
  resolve();
1190
- setDraggingDisabled(false);
1191
1208
  };
1192
1209
  });
1193
1210
  }
1194
1211
  catch (error) {
1195
- console.log('🚀 Audio play error:', error);
1212
+ console.log('🎧 Audio play error:', error);
1213
+ }
1214
+ finally {
1215
+ this.audioElement.onended = null; // cleanup
1216
+ setDraggingDisabled(false);
1217
+ stopHighlightForSpeakingElement(targetElement);
1196
1218
  }
1197
1219
  }
1198
1220
  // If no audio, use text-to-speech
@@ -1202,13 +1224,35 @@ class AudioPlayer {
1202
1224
  await speakText(targetElement.textContent, targetElement);
1203
1225
  const highlightedElements = document.querySelectorAll('.speaking-highlight');
1204
1226
  highlightedElements.forEach(element => stopHighlightForSpeakingElement(element));
1205
- setDraggingDisabled(false);
1206
1227
  }
1207
1228
  catch (error) {
1208
- console.log('🚀 TTS Error:', error);
1229
+ console.log('🎧 TTS Error:', error);
1230
+ }
1231
+ finally {
1232
+ setDraggingDisabled(false);
1209
1233
  }
1210
1234
  }
1211
1235
  }
1236
+ // GLOBAL STOP EVENTS (container change, activity change…)
1237
+ registerGlobalStopEvents() {
1238
+ const stopEvents = [
1239
+ NextContainerKey, PrevContainerKey, LessonEndKey, ActivityChangeKey,
1240
+ ActivityEndKey, GameCompletedKey, GameExitKey
1241
+ ];
1242
+ stopEvents.forEach(key => {
1243
+ window.addEventListener(key, () => this.stop());
1244
+ });
1245
+ }
1246
+ // DESTROY (for hot-reload)
1247
+ destroy() {
1248
+ console.log("AudioPlayer destroyed (hot-reload safe)");
1249
+ this.stop();
1250
+ // Remove DOM element
1251
+ if (this.audioElement.parentNode) {
1252
+ this.audioElement.parentNode.removeChild(this.audioElement);
1253
+ }
1254
+ AudioPlayer.instance = undefined;
1255
+ }
1212
1256
  }
1213
1257
 
1214
1258
  let preOverlap;
@@ -1367,11 +1411,11 @@ function enableReorderDrag(element) {
1367
1411
  onDropToCategory(element, category);
1368
1412
  }
1369
1413
  if (divEl) {
1370
- const keyframes = `
1371
- @keyframes widthDecrease {
1372
- 0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
1373
- 100% { width: 0px; height: 0px;}
1374
- }
1414
+ const keyframes = `
1415
+ @keyframes widthDecrease {
1416
+ 0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
1417
+ 100% { width: 0px; height: 0px;}
1418
+ }
1375
1419
  `;
1376
1420
  const styleSheet = document.styleSheets[0];
1377
1421
  styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
@@ -1581,11 +1625,11 @@ function moveWithAnimation(target, overlapped) {
1581
1625
  const dummy = createDummyElement(target);
1582
1626
  dummy.style.visibility = 'hidden';
1583
1627
  dummy.setAttribute('type', 'dummy');
1584
- const keyframes = `
1585
- @keyframes widthIncrease {
1586
- 0% { width: 0px; height: 0px; }
1587
- 100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
1588
- }
1628
+ const keyframes = `
1629
+ @keyframes widthIncrease {
1630
+ 0% { width: 0px; height: 0px; }
1631
+ 100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
1632
+ }
1589
1633
  `;
1590
1634
  if (!overlapped) {
1591
1635
  const overlapCategory = findMostoverlappedElement(target, 'category');
@@ -3142,7 +3186,11 @@ function addClickListenerForClickType(element) {
3142
3186
  if (lido_buttons === 'lido-arrow-left' || lido_buttons === 'lido-arrow-right') {
3143
3187
  return;
3144
3188
  }
3145
- AudioPlayer.getI().stop();
3189
+ const audioAttr = element.getAttribute('audio');
3190
+ const hasValidAudio = audioAttr && audioAttr.trim().length > 0;
3191
+ if (hasValidAudio) {
3192
+ AudioPlayer.getI().stop();
3193
+ }
3146
3194
  const container = document.getElementById(LidoContainer);
3147
3195
  const objective = container['objective'].split(',');
3148
3196
  const checkButton = document.querySelector('#lido-checkButton');
@@ -68055,15 +68103,15 @@ function calculateFill(input, currentFill = 0) {
68055
68103
  // Helper to animate and remove the active equation cell
68056
68104
  const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalculateTypes) => {
68057
68105
  return new Promise((resolve) => {
68058
- const keyframes = `
68059
- @keyframes widthDecrease {
68060
- 0% {
68061
- background-color: ${activeCell.style.backgroundColor};
68062
- height: ${activeCell.style.height};
68063
- margin: ${activeCell.style.margin};
68064
- ${activeCell.innerHTML = ""}
68065
- }
68066
- 100% { background-color: transparent; height: 0px; margin: 0px; }
68106
+ const keyframes = `
68107
+ @keyframes widthDecrease {
68108
+ 0% {
68109
+ background-color: ${activeCell.style.backgroundColor};
68110
+ height: ${activeCell.style.height};
68111
+ margin: ${activeCell.style.margin};
68112
+ ${activeCell.innerHTML = ""}
68113
+ }
68114
+ 100% { background-color: transparent; height: 0px; margin: 0px; }
68067
68115
  }`;
68068
68116
  const styleSheet = document.styleSheets[0];
68069
68117
  styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
@@ -68596,7 +68644,15 @@ const executeActions = async (actionsString, thisElement, element) => {
68596
68644
  break;
68597
68645
  }
68598
68646
  case 'speak': {
68599
- await AudioPlayer.getI().play(targetElement);
68647
+ const val = (action.value || '').toString().trim().toLowerCase();
68648
+ if (val === 'true' || val === '1' || val === 'yes') {
68649
+ try {
68650
+ await AudioPlayer.getI().play(targetElement);
68651
+ }
68652
+ catch (err) {
68653
+ console.error('Error playing audio for speak action:', err);
68654
+ }
68655
+ }
68600
68656
  break;
68601
68657
  }
68602
68658
  case 'fill-slide': {
@@ -68718,6 +68774,10 @@ const executeActions = async (actionsString, thisElement, element) => {
68718
68774
  }
68719
68775
  break;
68720
68776
  }
68777
+ case 'updatedAnswer': {
68778
+ updatedAnswer();
68779
+ break;
68780
+ }
68721
68781
  default: {
68722
68782
  targetElement.style[action.action] = action.value;
68723
68783
  break;
@@ -68748,11 +68808,11 @@ const afterDropDragHandling = (dragElement, dropElement) => {
68748
68808
  }
68749
68809
  dummyElement.setAttribute('id', dragElement.getAttribute('id'));
68750
68810
  dragElement.replaceWith(dummyElement);
68751
- const keyframes = `
68752
- @keyframes widthDecrease {
68753
- 0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
68754
- 100% { width: 0px; height: 0px; margin: 0px;}
68755
- }
68811
+ const keyframes = `
68812
+ @keyframes widthDecrease {
68813
+ 0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
68814
+ 100% { width: 0px; height: 0px; margin: 0px;}
68815
+ }
68756
68816
  `;
68757
68817
  if (!isInfinite) {
68758
68818
  dummyElement.style.width = element.style.width;
@@ -68915,10 +68975,6 @@ async function onActivityComplete(dragElement, dropElement) {
68915
68975
  await executeActions(onCorrect, dropElement, dragElement);
68916
68976
  }
68917
68977
  }
68918
- else {
68919
- const onInCorrect = dropElement.getAttribute('onInCorrect');
68920
- await executeActions(onInCorrect, dropElement, dragElement);
68921
- }
68922
68978
  }
68923
68979
  let dragScore = buildDragSelectedMapFromDOM();
68924
68980
  const sortedValues = getSortedValuesArrayFromMap(dragScore);
@@ -68930,21 +68986,6 @@ async function onActivityComplete(dragElement, dropElement) {
68930
68986
  drag[index] = [];
68931
68987
  }
68932
68988
  drag[index].push(dragElement.id);
68933
- // localStorage.setItem(DragMapKey, JSON.stringify(drag));
68934
- Object.keys(dragScore).sort((a, b) => parseInt(a) - parseInt(b));
68935
- if (dragElement && dropElement) {
68936
- const isCorrect = dropElement['value'].toLowerCase().includes(dragElement['value'].toLowerCase());
68937
- if (isCorrect) {
68938
- const onCorrect = dropElement.getAttribute('onCorrect');
68939
- if (onCorrect) {
68940
- await executeActions(onCorrect, dropElement, dragElement);
68941
- }
68942
- }
68943
- else {
68944
- const onInCorrect = dropElement.getAttribute('onInCorrect');
68945
- await executeActions(onInCorrect, dropElement, dragElement);
68946
- }
68947
- }
68948
68989
  const allElements = document.querySelectorAll("[type='drop']");
68949
68990
  allElements.forEach(otherElement => {
68950
68991
  var _a;
@@ -69034,6 +69075,7 @@ const validateObjectiveStatus = async () => {
69034
69075
  return;
69035
69076
  const objectiveString = container['objective'];
69036
69077
  const additionalCheck = container.getAttribute('equationCheck');
69078
+ container.getAttribute('isAllowOnlyCorrect') === 'true' || '';
69037
69079
  console.log('🚀 ~ validateObjectiveStatus ~ additionalCheck:', additionalCheck);
69038
69080
  let equationGiven = false;
69039
69081
  if (objectiveString == null || objectiveString.length === 0) {
@@ -69085,13 +69127,15 @@ const validateObjectiveStatus = async () => {
69085
69127
  await calculateScore();
69086
69128
  }
69087
69129
  else {
69088
- const onInCorrect = container.getAttribute('onInCorrect');
69089
- await executeActions(onInCorrect, container);
69090
69130
  const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
69091
69131
  if (!isContinueOnCorrect) {
69092
69132
  triggerNextContainer();
69093
69133
  await calculateScore();
69094
69134
  }
69135
+ else {
69136
+ const onInCorrect = container.getAttribute('onInCorrect');
69137
+ await executeActions(onInCorrect, container);
69138
+ }
69095
69139
  }
69096
69140
  };
69097
69141
  const triggerNextContainer = () => {
@@ -69655,14 +69699,14 @@ const SumTogetherAnimation = async (element, value) => {
69655
69699
  const sign = ((signElement && ((signElement.getAttribute('string') || signElement.textContent) || '')).toString().trim() === '+') ? '+' : '-';
69656
69700
  if (sign === '-') {
69657
69701
  // '-' flow: reveal one by one then change bgColor of last B to red
69658
- for (let i = 0; i < topRowChildren.length; i++) {
69702
+ for (let i = 0; i < Math.min(number1, topRowChildren.length); i++) {
69659
69703
  await new Promise(resolve => setTimeout(resolve, 75));
69660
69704
  showElement(topRowChildren[i]);
69661
69705
  }
69662
69706
  elementAppearance(true);
69663
69707
  await new Promise(r => setTimeout(r, 500));
69664
69708
  for (let k = 0; k < Math.min(number2, topRowChildren.length); k++) {
69665
- const idx = topRowChildren.length - 1 - k;
69709
+ const idx = Math.min(number1, topRowChildren.length) - 1 - k;
69666
69710
  setImageBackground(topRowChildren[idx], 'red');
69667
69711
  await new Promise(r => setTimeout(r, 200));
69668
69712
  }
@@ -69687,6 +69731,17 @@ const SumTogetherAnimation = async (element, value) => {
69687
69731
  elementAppearance(false);
69688
69732
  }
69689
69733
  };
69734
+ const updatedAnswer = () => {
69735
+ const container = document.getElementById(LidoContainer);
69736
+ if (!container)
69737
+ return;
69738
+ const answerText = container.querySelector('#answer');
69739
+ if (!answerText)
69740
+ return;
69741
+ const equationAttr = container.getAttribute('equationCheck') || '';
69742
+ const calculatedValue = equationCheck(equationAttr);
69743
+ answerText.setAttribute('string', String(calculatedValue));
69744
+ };
69690
69745
 
69691
69746
  exports.ActivityScoreKey = ActivityScoreKey;
69692
69747
  exports.AudioPlayer = AudioPlayer;
@@ -2,6 +2,7 @@
2
2
  "entries": [
3
3
  "components/avatar/lido-avatar.js",
4
4
  "components/calculator/lido-calculator.js",
5
+ "components/canvas/lido-canvas.js",
5
6
  "components/cell/lido-cell.js",
6
7
  "components/column/lido-col.js",
7
8
  "components/container/lido-container.js",
@@ -1,4 +1,4 @@
1
- .lido-canvas {
2
- height: 100%;
3
- width: 100%;
4
- }
1
+ .lido-canvas {
2
+ height: 100%;
3
+ width: 100%;
4
+ }
@@ -78,7 +78,7 @@ export class LidoAvatar {
78
78
  display: this.visible ? 'flex' : 'none',
79
79
  zIndex: this.z,
80
80
  };
81
- return (h(Host, { key: '0889129b1e69b8966dec70f6364c602cadce10ef', 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: '975318180c4454f81d307accd823e2eaaeddf6cc', class: "lido-canvas" })));
81
+ return (h(Host, { key: 'dc25762d0edf77a71e93ca1cc3ea160a1778858e', 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: '70c803f3b58d3cd4a4f94f66eab40a7af656ef36', class: "lido-canvas" })));
82
82
  }
83
83
  static get is() { return "lido-avatar"; }
84
84
  static get originalStyleUrls() {
@@ -1,87 +1,87 @@
1
- #lidoCalculator {
2
- border-radius: 19px;
3
- border: 5px solid #029A9A;
4
- position: relative;
5
- display: flex;
6
- flex-direction: column;
7
- padding: 2%;
8
- box-sizing: border-box;
9
- }
10
- .lido-calculator-btn-special{
11
- background-color:#014D4D !important;
12
- --btn-shadow-color: #0a2f2f !important;
13
- }
14
-
15
- .lido-calculator-btn-default {
16
- background-color: #029A9A !important;
17
- color: #000;
18
- --btn-shadow-color: #0f4242 !important ;
19
- }
20
-
21
- #lido-calculator-penIcon {
22
- --btn-bg-color: #FB7038 !important;
23
- --btn-shadow-px: 0 8px 0 !important;
24
- --btn-shadow-color: #D74B12 !important;
25
- border-radius: 5px !important;
26
- }
27
-
28
- .lido-calculator-displayParent{
29
- width: 89%;
30
- height: 107px;
31
- background-color: rgb(68, 186, 186);;
32
- border-radius: 5px;
33
- margin: 14px auto 17px auto;
34
- overflow: hidden;
35
- display: flex;
36
- align-items: end;
37
- }
38
-
39
- .lido-calculator-display {
40
- width: 97%;
41
- height: 94px;
42
- background: #029A9A;
43
- color: #fff;
44
- text-align: right;
45
- display: flex;
46
- justify-content: flex-end;
47
- align-items: center;
48
- font-size: 72px;
49
- font-weight: 700;
50
- font-family: 'Baloo Bhai 2', serif;
51
- border-radius: 5px 0px 0px 5px;
52
- box-sizing: border-box;
53
- margin: 0 0px -6px auto;
54
- }
55
-
56
- .lido-calculator-buttons {
57
- flex: 1;
58
- display: grid;
59
- grid-template-columns: repeat(3, 1fr);
60
- grid-auto-rows: 1fr;
61
- gap: 0%;
62
- width: 100%;
63
- justify-items: center;
64
- align-items: center;
65
- position: relative;
66
- top: -1%;
67
- }
68
- .lido-calculator-buttons lido-text {
69
- display: flex !important;
70
- justify-content: center;
71
- align-items: center;
72
- width: 96px !important;
73
- height: 80px !important;
74
- font-size: 72px !important;
75
- font-weight: 700 !important;
76
- color: #fff;
77
- border-radius: 5px !important;
78
- cursor: pointer;
79
- text-align: center;
80
- line-height: 1;
81
- box-sizing: border-box;
82
- transition: transform 0.1s;
83
- }
84
- .lido-calculator-buttons lido-text:active {
85
- transform: scale(0.95);
86
- }
87
-
1
+ #lidoCalculator {
2
+ border-radius: 19px;
3
+ border: 5px solid #029A9A;
4
+ position: relative;
5
+ display: flex;
6
+ flex-direction: column;
7
+ padding: 2%;
8
+ box-sizing: border-box;
9
+ }
10
+ .lido-calculator-btn-special{
11
+ background-color:#014D4D !important;
12
+ --btn-shadow-color: #0a2f2f !important;
13
+ }
14
+
15
+ .lido-calculator-btn-default {
16
+ background-color: #029A9A !important;
17
+ color: #000;
18
+ --btn-shadow-color: #0f4242 !important ;
19
+ }
20
+
21
+ #lido-calculator-penIcon {
22
+ --btn-bg-color: #FB7038 !important;
23
+ --btn-shadow-px: 0 8px 0 !important;
24
+ --btn-shadow-color: #D74B12 !important;
25
+ border-radius: 5px !important;
26
+ }
27
+
28
+ .lido-calculator-displayParent{
29
+ width: 89%;
30
+ height: 107px;
31
+ background-color: rgb(68, 186, 186);;
32
+ border-radius: 5px;
33
+ margin: 14px auto 17px auto;
34
+ overflow: hidden;
35
+ display: flex;
36
+ align-items: end;
37
+ }
38
+
39
+ .lido-calculator-display {
40
+ width: 97%;
41
+ height: 94px;
42
+ background: #029A9A;
43
+ color: #fff;
44
+ text-align: right;
45
+ display: flex;
46
+ justify-content: flex-end;
47
+ align-items: center;
48
+ font-size: 72px;
49
+ font-weight: 700;
50
+ font-family: 'Baloo Bhai 2', serif;
51
+ border-radius: 5px 0px 0px 5px;
52
+ box-sizing: border-box;
53
+ margin: 0 0px -6px auto;
54
+ }
55
+
56
+ .lido-calculator-buttons {
57
+ flex: 1;
58
+ display: grid;
59
+ grid-template-columns: repeat(3, 1fr);
60
+ grid-auto-rows: 1fr;
61
+ gap: 0%;
62
+ width: 100%;
63
+ justify-items: center;
64
+ align-items: center;
65
+ position: relative;
66
+ top: -1%;
67
+ }
68
+ .lido-calculator-buttons lido-text {
69
+ display: flex !important;
70
+ justify-content: center;
71
+ align-items: center;
72
+ width: 96px !important;
73
+ height: 80px !important;
74
+ font-size: 72px !important;
75
+ font-weight: 700 !important;
76
+ color: #fff;
77
+ border-radius: 5px !important;
78
+ cursor: pointer;
79
+ text-align: center;
80
+ line-height: 1;
81
+ box-sizing: border-box;
82
+ transition: transform 0.1s;
83
+ }
84
+ .lido-calculator-buttons lido-text:active {
85
+ transform: scale(0.95);
86
+ }
87
+