lido-player 0.0.2-alpha-60-dev → 0.0.2-alpha-62

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 (110) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/lido-avatar_22.cjs.entry.js +70 -28
  3. package/dist/cjs/lido-player.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{utils-28faa755.js → utils-b13cba29.js} +130 -64
  6. package/dist/collection/components/container/lido-container.js +21 -18
  7. package/dist/collection/components/home/lido-home.js +4 -4
  8. package/dist/collection/components/root/lido-root.js +5 -5
  9. package/dist/collection/components/text/lido-text.js +3 -2
  10. package/dist/collection/stories/Templates/balancing/balancing.stories.js +1 -1
  11. package/dist/collection/stories/Templates/imageMatch/imageMatch.stories.js +16 -15
  12. package/dist/collection/stories/Templates/numberIdentification/numberIdentificationimageTotext.stories.js +9 -7
  13. package/dist/collection/stories/Templates/numberIdentification/numberIdentificationtextTotext.stories.js +8 -6
  14. package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaMultiOption.stories.js +4 -3
  15. package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.js +3 -2
  16. package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +32 -19
  17. package/dist/collection/stories/Templates/palEgmaWordProblem/palEgmaWordProblem.stories.js +5 -5
  18. package/dist/collection/stories/Templates/palEgraInventedSpelling/pal_egra_invented_spelling_schema.stories.js +10 -7
  19. package/dist/collection/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.js +11 -8
  20. package/dist/collection/stories/Templates/palEgraOptionWithAudio/palEgraOptionWithAudio.stories.js +18 -14
  21. package/dist/collection/stories/Templates/palEgraStoryMaking/pal_egra_story_making.stories.js +9 -9
  22. package/dist/collection/stories/Templates/palEgraTemplate1/palEgraLetterIdentification.stories.js +17 -10
  23. package/dist/collection/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.js +98 -0
  24. package/dist/collection/stories/Templates/palEgra_OddOneOut/palEgra_oddOneOut.stories.js +8 -8
  25. package/dist/collection/stories/Templates/palEgra_arrange_pictures/palEgra_arrange_pictures.stories.js +16 -19
  26. package/dist/collection/stories/Templates/palEgra_build_word/palEgra_build_word.stories.js +21 -18
  27. package/dist/collection/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.js +26 -19
  28. package/dist/collection/stories/Templates/palStorytale/palStorytale.stories.js +9 -9
  29. package/dist/collection/stories/Templates/pictureClues/pictureClues.stories.js +9 -9
  30. package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch1.stories.js +15 -15
  31. package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch2.stories.js +11 -11
  32. package/dist/collection/stories/Templates/sentenceMatch/sentenceMatch.stories.js +63 -0
  33. package/dist/collection/stories/Templates/substraction/substractionWithimg.stories.js +7 -7
  34. package/dist/collection/stories/Templates/substraction/substractionWithoutImg.stories.js +13 -13
  35. package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithimg.stories.js +7 -7
  36. package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.js +1 -1
  37. package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +6 -5
  38. package/dist/collection/utils/audioPlayer.js +10 -0
  39. package/dist/collection/utils/customEvents.js +2 -1
  40. package/dist/collection/utils/i18n.js +2 -0
  41. package/dist/collection/utils/utils.js +8 -12
  42. package/dist/collection/utils/utilsHandlers/clickHandler.js +20 -14
  43. package/dist/collection/utils/utilsHandlers/dragDropHandler.js +26 -52
  44. package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +4 -5
  45. package/dist/collection/utils/utilsHandlers/timer.js +53 -0
  46. package/dist/components/index.js +1 -1
  47. package/dist/components/lido-avatar.js +1 -1
  48. package/dist/components/lido-balance.js +1 -1
  49. package/dist/components/lido-calculator.js +1 -1
  50. package/dist/components/lido-canvas.js +1 -1
  51. package/dist/components/lido-cell.js +1 -1
  52. package/dist/components/lido-col.js +1 -1
  53. package/dist/components/lido-container.js +1 -1
  54. package/dist/components/lido-flash-card.js +1 -1
  55. package/dist/components/lido-float.js +1 -1
  56. package/dist/components/lido-home.js +1 -1
  57. package/dist/components/lido-image.js +1 -1
  58. package/dist/components/lido-keyboard.js +1 -1
  59. package/dist/components/lido-math-matrix.js +1 -1
  60. package/dist/components/lido-pos.js +1 -1
  61. package/dist/components/lido-random.js +1 -1
  62. package/dist/components/lido-root.js +27 -27
  63. package/dist/components/lido-row.js +1 -1
  64. package/dist/components/lido-shape.js +1 -1
  65. package/dist/components/lido-slide-fill.js +1 -1
  66. package/dist/components/lido-text.js +1 -1
  67. package/dist/components/lido-trace.js +1 -1
  68. package/dist/components/lido-wrap.js +1 -1
  69. package/dist/components/{p-74c270d2.js → p-21938b85.js} +2 -2
  70. package/dist/components/{p-a182c9a2.js → p-39767aae.js} +1 -1
  71. package/dist/components/{p-3acd9a2e.js → p-3db5a756.js} +1 -1
  72. package/dist/components/{p-93acfbb2.js → p-40dd6fa3.js} +1 -1
  73. package/dist/components/{p-5e7c6afa.js → p-552f581f.js} +1 -1
  74. package/dist/components/{p-37c86a94.js → p-5a3a7f41.js} +47 -7
  75. package/dist/components/{p-b151457d.js → p-5da9c4a0.js} +22 -20
  76. package/dist/components/{p-3acada8c.js → p-64b85ae6.js} +1 -1
  77. package/dist/components/{p-4d01394c.js → p-6c1ea24d.js} +1 -1
  78. package/dist/components/{p-b867548e.js → p-7256917d.js} +1 -1
  79. package/dist/components/{p-8a32f7cb.js → p-777293d6.js} +1 -1
  80. package/dist/components/{p-8c0667eb.js → p-85eaa0b7.js} +1 -1
  81. package/dist/components/{p-8f082c62.js → p-8f174468.js} +1 -1
  82. package/dist/components/{p-235091a1.js → p-bd09bc5b.js} +130 -65
  83. package/dist/components/{p-32c89979.js → p-bf0c1e81.js} +1 -1
  84. package/dist/components/{p-c90d92db.js → p-cdb5b0e6.js} +1 -1
  85. package/dist/components/{p-db2a05f5.js → p-d0d890d8.js} +3 -3
  86. package/dist/components/{p-57400ebc.js → p-d2d6e641.js} +1 -1
  87. package/dist/components/{p-354f7b19.js → p-da85322a.js} +2 -2
  88. package/dist/components/{p-16604098.js → p-e42ddea5.js} +1 -1
  89. package/dist/components/{p-06cecca5.js → p-f4c980f0.js} +1 -1
  90. package/dist/components/{p-de45dcab.js → p-fb9e274c.js} +25 -25
  91. package/dist/esm/index.js +1 -1
  92. package/dist/esm/lido-avatar_22.entry.js +70 -28
  93. package/dist/esm/lido-player.js +1 -1
  94. package/dist/esm/loader.js +1 -1
  95. package/dist/esm/{utils-2edeb213.js → utils-b7ed15c2.js} +130 -65
  96. package/dist/lido-player/index.esm.js +1 -1
  97. package/dist/lido-player/lido-player.esm.js +1 -1
  98. package/dist/lido-player/{p-add7f36e.js → p-1557f3df.js} +2 -2
  99. package/dist/lido-player/p-7e79ea93.entry.js +1 -0
  100. package/dist/types/components/container/lido-container.d.ts +1 -1
  101. package/dist/types/components/home/lido-home.d.ts +1 -1
  102. package/dist/types/components/root/lido-root.d.ts +1 -1
  103. package/dist/types/components.d.ts +24 -24
  104. package/dist/types/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.d.ts +4 -0
  105. package/dist/types/stories/Templates/sentenceMatch/sentenceMatch.stories.d.ts +4 -0
  106. package/dist/types/utils/audioPlayer.d.ts +1 -0
  107. package/dist/types/utils/constants.d.ts +4 -5
  108. package/dist/types/utils/utilsHandlers/timer.d.ts +14 -0
  109. package/package.json +1 -1
  110. package/dist/lido-player/p-280e3d34.entry.js +0 -1
@@ -55,6 +55,60 @@ const nextUrl = 'https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/publ
55
55
  const speakUrl = 'https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/Navbar-buttons/audio.png';
56
56
  const fingerUrl = 'https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/trace/Tracing-hand.svg';
57
57
 
58
+ class Timer {
59
+ constructor() {
60
+ this.startTime = 0;
61
+ this.elapsedTime = 0;
62
+ this.intervalId = null;
63
+ }
64
+ static getI(onTick) {
65
+ if (!Timer.instance) {
66
+ Timer.instance = new Timer();
67
+ }
68
+ if (onTick) {
69
+ Timer.instance.onTick = onTick;
70
+ }
71
+ return Timer.instance;
72
+ }
73
+ start() {
74
+ if (this.intervalId)
75
+ return;
76
+ this.startTime = Date.now() - this.elapsedTime;
77
+ this.intervalId = window.setInterval(() => {
78
+ var _a;
79
+ this.elapsedTime = Date.now() - this.startTime;
80
+ (_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, this.elapsedTime);
81
+ }, 1000);
82
+ }
83
+ pause() {
84
+ if (!this.intervalId)
85
+ return;
86
+ clearInterval(this.intervalId);
87
+ this.intervalId = null;
88
+ this.elapsedTime = Date.now() - this.startTime;
89
+ }
90
+ resume() {
91
+ if (this.intervalId)
92
+ return;
93
+ this.start();
94
+ }
95
+ stop() {
96
+ var _a;
97
+ if (this.intervalId) {
98
+ clearInterval(this.intervalId);
99
+ this.intervalId = null;
100
+ }
101
+ this.startTime = 0;
102
+ this.elapsedTime = 0;
103
+ (_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, 0);
104
+ }
105
+ getElapsed() {
106
+ return this.intervalId
107
+ ? Date.now() - this.startTime
108
+ : this.elapsedTime;
109
+ }
110
+ }
111
+
58
112
  function dispatchCustomEvent(eventName, detail) {
59
113
  console.log("👍Event Name : ", eventName, "Detail : ", detail.toString());
60
114
  const event = new CustomEvent(eventName, { detail });
@@ -64,7 +118,7 @@ function dispatchActivityEndEvent(index, totalIndex, score) {
64
118
  dispatchCustomEvent(ActivityEndKey, { index, totalIndex, score });
65
119
  }
66
120
  function dispatchLessonEndEvent(score) {
67
- dispatchCustomEvent(LessonEndKey, { score });
121
+ dispatchCustomEvent(LessonEndKey, { score, timeSpent: Math.floor(Timer.getI().getElapsed() / 1000) });
68
122
  }
69
123
  function dispatchNextContainerEvent() {
70
124
  dispatchCustomEvent(NextContainerKey, {});
@@ -120,7 +174,7 @@ function updateBalanceOnDrop(dragElement, dropElement) {
120
174
  }
121
175
  function calculateValue(elements, operation) {
122
176
  if (elements.length === 0)
123
- return 0;
177
+ return null;
124
178
  if (operation === "count") {
125
179
  return elements.length;
126
180
  }
@@ -152,18 +206,15 @@ function calculateValue(elements, operation) {
152
206
  }
153
207
  }
154
208
  function balanceResult(container, objectiveString) {
155
- var _a, _b, _c, _d, _e, _f;
156
209
  const additionalCheck = container.getAttribute('equationCheck');
157
210
  if (!additionalCheck)
158
211
  return false;
159
212
  const balanceEl = document.querySelector('lido-balance');
160
213
  if (!balanceEl)
161
214
  return false;
162
- 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);
163
- 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);
164
- const hasLeft = !isNaN(leftVal);
165
- const hasRight = !isNaN(rightVal);
166
- if (!hasLeft || !hasRight) {
215
+ const leftVal = balanceEl.leftVal;
216
+ const rightVal = balanceEl.rightVal;
217
+ if (leftVal == null || rightVal == null) {
167
218
  return false;
168
219
  }
169
220
  const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
@@ -291,6 +342,7 @@ function enableDraggingWithScaling(element) {
291
342
  handlingElementFlexibleWidth(element, 'drag');
292
343
  const onStart = (event) => {
293
344
  var _a, _b;
345
+ console.log("moving start");
294
346
  if (isDraggingDisabled) {
295
347
  isDragging = false;
296
348
  return;
@@ -434,22 +486,24 @@ function enableDraggingWithScaling(element) {
434
486
  const storedTabIndexes = Object.keys(dropObject).map(Number);
435
487
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
436
488
  if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
437
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
438
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
439
- otherElement.style.opacity = '0';
489
+ if (otherElement) {
490
+ otherElement.style.opacity = "0.3";
440
491
  }
441
492
  }
442
493
  }
443
494
  else {
444
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
445
- if (otherElement.tagName.toLowerCase() === 'lido-image' || 'lido-cell') {
446
- otherElement.style.opacity = '1';
495
+ if (otherElement) {
496
+ otherElement.style.opacity = "1";
447
497
  }
448
498
  }
449
499
  });
450
500
  // Apply styles only to the most overlapped element
451
501
  if (mostOverlappedElement) {
452
- if (mostOverlappedElement.tagName.toLowerCase() === 'lido-text') ;
502
+ if (mostOverlappedElement.tagName.toLowerCase() === 'lido-text') {
503
+ // mostOverlappedElement.style.border = '2px dashed #ff0000'; // Red dashed border
504
+ // mostOverlappedElement.style.backgroundColor = 'rgba(255, 0, 0, 0.1)'; // Light red background
505
+ mostOverlappedElement.style.opacity = "0.3";
506
+ }
453
507
  else {
454
508
  if (!document.getElementById('unitsDrop') || !document.getElementById('tensDrop') || !document.getElementById('hundredsDrop')) {
455
509
  mostOverlappedElement.style.opacity = '0.3';
@@ -485,9 +539,8 @@ function enableDraggingWithScaling(element) {
485
539
  const storedTabIndexes = Object.keys(dropObject).map(Number);
486
540
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
487
541
  if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
488
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
489
- else if (otherElement.tagName.toLowerCase() === 'lido-image') {
490
- otherElement.style.opacity = '0';
542
+ if (otherElement) {
543
+ otherElement.style.opacity = "0";
491
544
  }
492
545
  else {
493
546
  otherElement.style.opacity = '1';
@@ -495,9 +548,8 @@ function enableDraggingWithScaling(element) {
495
548
  }
496
549
  }
497
550
  else {
498
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
499
- if (otherElement.tagName.toLowerCase() === 'lido-image' || 'lido-cell') {
500
- otherElement.style.opacity = '1';
551
+ if (otherElement) {
552
+ otherElement.style.opacity = "1";
501
553
  }
502
554
  }
503
555
  });
@@ -548,6 +600,7 @@ function enableDraggingWithScaling(element) {
548
600
  element.addEventListener('touchstart', onStart);
549
601
  element.addEventListener('click', ev => {
550
602
  if (isClicked) {
603
+ console.log("clicked drag elkement");
551
604
  onClickDropOrDragElement(element, 'drag');
552
605
  }
553
606
  });
@@ -675,18 +728,14 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
675
728
  const storedTabIndexes = Object.keys(dropObject).map(Number);
676
729
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
677
730
  if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
678
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
679
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
680
- otherElement.style.opacity = '0';
681
- otherElement.style.backgroundColor = 'transparent';
731
+ if (otherElement.tagName.toLowerCase() === 'lido-text') {
732
+ otherElement.style.opacity = "0";
682
733
  }
683
734
  }
684
735
  }
685
736
  else {
686
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
687
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
688
- otherElement.style.opacity = '1';
689
- otherElement.style.backgroundColor = 'transparent';
737
+ if (otherElement) {
738
+ otherElement.style.opacity = "1";
690
739
  }
691
740
  }
692
741
  });
@@ -704,11 +753,14 @@ async function onElementDropComplete(dragElement, dropElement) {
704
753
  if (!dropElement) {
705
754
  handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
706
755
  }
707
- const dropTabIndex = dropElement.getAttribute('tab-index');
708
- const isAllowOnlyOneDrop = dropElement.getAttribute('is-allow-only-one-drop') === 'false';
709
- if (((_b = dropHasDrag[dropTabIndex]) === null || _b === void 0 ? void 0 : _b.isFull) && !isAllowOnlyOneDrop) {
710
- handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
711
- return;
756
+ let dropTabIndex;
757
+ if (dropElement) {
758
+ dropTabIndex = dropElement.getAttribute('tab-index');
759
+ const isAllowOnlyOneDrop = dropElement.getAttribute('is-allow-only-one-drop') === 'false';
760
+ if (((_b = dropHasDrag[dropTabIndex]) === null || _b === void 0 ? void 0 : _b.isFull) && !isAllowOnlyOneDrop) {
761
+ handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
762
+ return;
763
+ }
712
764
  }
713
765
  const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
714
766
  if (isAllowOnlyCorrect) {
@@ -741,7 +793,6 @@ async function onElementDropComplete(dragElement, dropElement) {
741
793
  dragElement.style.transition = 'transform 0.5s ease';
742
794
  animateDragToTarget(dragElement, dropElement, container);
743
795
  const onInCorrect = dropElement.getAttribute('onInCorrect');
744
- console.log("onincorrectttt", onInCorrect);
745
796
  await executeActions(onInCorrect, dropElement, dragElement);
746
797
  setTimeout(() => {
747
798
  dragElement.style.transform = 'translate(0, 0)';
@@ -848,15 +899,13 @@ async function onElementDropComplete(dragElement, dropElement) {
848
899
  const storedTabIndexes = Object.keys(dropObject).map(Number);
849
900
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
850
901
  if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
851
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
852
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
902
+ if (otherElement) {
853
903
  otherElement.style.opacity = '0';
854
904
  }
855
905
  }
856
906
  }
857
907
  else {
858
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
859
- if (otherElement.tagName.toLowerCase() === 'lido-image' || 'lido-cell') {
908
+ if (otherElement) {
860
909
  otherElement.style.opacity = '1';
861
910
  }
862
911
  }
@@ -982,8 +1031,9 @@ async function onClickDropOrDragElement(element, type) {
982
1031
  element.ariaPressed = 'true';
983
1032
  const selectedDropElement = type === 'drop' ? element : document.querySelector("[type='drop'].highlight-element");
984
1033
  const selectedDragElement = type === 'drag' ? element : document.querySelector("[type='drag'].highlight-element");
985
- if (!selectedDropElement) {
1034
+ if (!selectedDropElement || element.classList.contains("dropped")) {
986
1035
  onClickDragElement(element);
1036
+ return;
987
1037
  }
988
1038
  if (selectedDropElement && selectedDragElement) {
989
1039
  if (selectedDragElement.getAttribute('drop-to'))
@@ -1196,6 +1246,9 @@ function highlightElement() {
1196
1246
 
1197
1247
  class AudioPlayer {
1198
1248
  constructor() {
1249
+ this.handleUserClick = () => {
1250
+ this.stop();
1251
+ };
1199
1252
  this.audioElement = document.createElement('audio');
1200
1253
  this.audioElement.id = 'audio';
1201
1254
  document.body.appendChild(this.audioElement);
@@ -1232,6 +1285,10 @@ class AudioPlayer {
1232
1285
  catch (e) {
1233
1286
  console.error('Error stopping audio before speak action:', e);
1234
1287
  }
1288
+ const text = targetElement.closest('lido-text');
1289
+ if (text && text.getAttribute('disable-speak') === 'true') {
1290
+ return;
1291
+ }
1235
1292
  // then play the target element audio.
1236
1293
  let audioUrl = targetElement.getAttribute('audio') || '';
1237
1294
  // If no direct audio attribute, check childrens for audio
@@ -1252,6 +1309,7 @@ class AudioPlayer {
1252
1309
  try {
1253
1310
  setDraggingDisabled(true);
1254
1311
  highlightSpeakingElement(targetElement);
1312
+ // window.addEventListener('click', this.handleUserClick, true);
1255
1313
  await this.audioElement.play();
1256
1314
  await new Promise(resolve => {
1257
1315
  this.audioElement.onended = () => {
@@ -1263,6 +1321,7 @@ class AudioPlayer {
1263
1321
  console.log('🎧 Audio play error:', error);
1264
1322
  }
1265
1323
  finally {
1324
+ window.removeEventListener('click', this.handleUserClick, true);
1266
1325
  this.audioElement.onended = null; // cleanup
1267
1326
  setDraggingDisabled(false);
1268
1327
  stopHighlightForSpeakingElement(targetElement);
@@ -1272,6 +1331,7 @@ class AudioPlayer {
1272
1331
  else if (targetElement.textContent) {
1273
1332
  try {
1274
1333
  highlightSpeakingElement(targetElement);
1334
+ window.addEventListener('click', this.handleUserClick, true);
1275
1335
  await speakText(targetElement.textContent, targetElement);
1276
1336
  const highlightedElements = document.querySelectorAll('.speaking-highlight');
1277
1337
  highlightedElements.forEach(element => stopHighlightForSpeakingElement(element));
@@ -3182,9 +3242,9 @@ function onTouchListenerForOnTouch(element) {
3182
3242
  return;
3183
3243
  const container = document.getElementById('lido-container');
3184
3244
  // const container = element.closest('lido-container') as HTMLElement;
3185
- if (container && container.getAttribute('disable-speak') === 'true') {
3186
- return;
3187
- }
3245
+ // if (container && container.getAttribute('disable-speak') === 'true') {
3246
+ // return;
3247
+ // }
3188
3248
  // if (element.closest('[disableSpeak="true"]')) {
3189
3249
  // return;
3190
3250
  // }
@@ -3193,6 +3253,9 @@ function onTouchListenerForOnTouch(element) {
3193
3253
  let onholdTriggered = false;
3194
3254
  const onholdTime = 1000;
3195
3255
  const playAudio = async () => {
3256
+ if (container && container.getAttribute('disable-speak') === 'true') {
3257
+ return;
3258
+ }
3196
3259
  onholdTriggered = true;
3197
3260
  setDraggingDisabled(true);
3198
3261
  await AudioPlayer.getI().play(element);
@@ -3233,6 +3296,7 @@ function addClickListenerForClickType(element) {
3233
3296
  }
3234
3297
  const onClick = async () => {
3235
3298
  var _a;
3299
+ const container = document.getElementById(LidoContainer);
3236
3300
  const lido_buttons = element.getAttribute('id');
3237
3301
  if (lido_buttons === 'lido-arrow-left' || lido_buttons === 'lido-arrow-right') {
3238
3302
  return;
@@ -3242,7 +3306,6 @@ function addClickListenerForClickType(element) {
3242
3306
  if (hasValidAudio) {
3243
3307
  AudioPlayer.getI().stop();
3244
3308
  }
3245
- const container = document.getElementById(LidoContainer);
3246
3309
  const objective = container['objective'].split(',');
3247
3310
  const checkButton = document.querySelector('#lido-checkButton');
3248
3311
  const showCheck = container.getAttribute('show-check') === 'true';
@@ -3259,12 +3322,13 @@ function addClickListenerForClickType(element) {
3259
3322
  container.setAttribute(SelectedValuesKey, JSON.stringify([element['value']]));
3260
3323
  const isCorrect = objective.includes(element['value']);
3261
3324
  dispatchClickEvent(element, isCorrect);
3262
- if (isCorrect) {
3325
+ if (isCorrect || container.getAttribute('is-continue-on-correct') === 'false') {
3263
3326
  const onCorrect = element.getAttribute('onCorrect');
3264
- if (!(element.id && element.id.startsWith('key-button'))) {
3265
- element.style.pointerEvents = 'none';
3266
- }
3267
- document.body.style.pointerEvents = 'none';
3327
+ // if(!(element.id && element.id.startsWith('key-button')))
3328
+ // {
3329
+ // // element.style.pointerEvents = 'none';
3330
+ // }
3331
+ // document.body.style.pointerEvents = 'none';
3268
3332
  await executeActions(onCorrect, element);
3269
3333
  }
3270
3334
  else {
@@ -3273,12 +3337,14 @@ function addClickListenerForClickType(element) {
3273
3337
  // showWrongAnswerAnimation([element]);
3274
3338
  }
3275
3339
  // const calciEl=document.querySelector('#lidoCalculator') as any;
3276
- const isInsideCalculator = element.closest('#lidoCalculator') !== null;
3277
- if (!isInsideCalculator) {
3278
- storingEachActivityScore(isCorrect);
3279
- }
3340
+ // const isInsideCalculator = element.closest('#lidoCalculator') !== null;
3341
+ // if(!isInsideCalculator){
3342
+ // storingEachActivityScore(isCorrect);
3343
+ // }
3280
3344
  highlightElement();
3281
- handleShowCheck();
3345
+ if (!container.getAttribute("click-completed")) {
3346
+ handleShowCheck();
3347
+ }
3282
3348
  return;
3283
3349
  }
3284
3350
  if (showCheck) {
@@ -68720,6 +68786,7 @@ const executeActions = async (actionsString, thisElement, element) => {
68720
68786
  const container = document.getElementById(LidoContainer);
68721
68787
  if (container.getAttribute('is-continue-on-correct') !== 'true') {
68722
68788
  targetElement.style.pointerEvents = 'none';
68789
+ AudioPlayer.getI().stop();
68723
68790
  }
68724
68791
  await validateObjectiveStatus();
68725
68792
  break;
@@ -68887,7 +68954,7 @@ const executeActions = async (actionsString, thisElement, element) => {
68887
68954
  }
68888
68955
  }
68889
68956
  }
68890
- body.style.pointerEvents = 'auto';
68957
+ // body.style.pointerEvents = 'auto';
68891
68958
  };
68892
68959
  const afterDropDragHandling = (dragElement, dropElement) => {
68893
68960
  const container = document.getElementById(LidoContainer);
@@ -68951,7 +69018,7 @@ const afterDropDragHandling = (dragElement, dropElement) => {
68951
69018
  const scaledLeft = (dropCenterX - dragCenterX) / containerScale;
68952
69019
  const scaledTop = (dropCenterY - dragCenterY) / containerScale;
68953
69020
  dragElement.style.transform = `translate(${scaledLeft}px, ${scaledTop}px)`;
68954
- }, 100);
69021
+ }, 700);
68955
69022
  }
68956
69023
  };
68957
69024
  // function cloneElementWithComputedStyles(originalEl: HTMLElement): HTMLElement {
@@ -69135,18 +69202,14 @@ async function onActivityComplete(dragElement, dropElement) {
69135
69202
  const storedTabIndexes = Object.keys(dragScore).map(Number);
69136
69203
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
69137
69204
  if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
69138
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
69139
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
69140
- otherElement.style.opacity = '0';
69141
- otherElement.style.backgroundColor = 'transparent';
69205
+ if (otherElement) {
69206
+ otherElement.style.opacity = "0";
69142
69207
  }
69143
69208
  }
69144
69209
  }
69145
69210
  else {
69146
- if (otherElement.tagName.toLowerCase() === 'lido-text') ;
69147
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
69211
+ if (otherElement.tagName.toLowerCase() === 'lido-text') {
69148
69212
  otherElement.style.opacity = '1';
69149
- otherElement.style.backgroundColor = 'transparent';
69150
69213
  }
69151
69214
  }
69152
69215
  });
@@ -69179,6 +69242,7 @@ const storeActivityScore = (score) => {
69179
69242
  const handleShowCheck = () => {
69180
69243
  var _a, _b;
69181
69244
  const container = document.getElementById(LidoContainer);
69245
+ container.setAttribute("click-completed", "true");
69182
69246
  const objectiveString = container['objective'];
69183
69247
  const selectValues = (_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '';
69184
69248
  const checkButton = document.querySelector('#lido-checkButton');
@@ -69206,7 +69270,6 @@ const handleShowCheck = () => {
69206
69270
  validateObjectiveStatus();
69207
69271
  }
69208
69272
  };
69209
- const body = document.body;
69210
69273
  let res;
69211
69274
  const validateObjectiveStatus = async () => {
69212
69275
  var _a, _b;
@@ -69272,6 +69335,7 @@ const validateObjectiveStatus = async () => {
69272
69335
  const onCorrect = container.getAttribute('onCorrect');
69273
69336
  if (!isContinueOnCorrect) {
69274
69337
  await calculateScore();
69338
+ storingEachActivityScore(false);
69275
69339
  await executeActions(onCorrect, container);
69276
69340
  triggerNextContainer();
69277
69341
  }
@@ -69279,6 +69343,7 @@ const validateObjectiveStatus = async () => {
69279
69343
  const onInCorrect = container.getAttribute('onInCorrect');
69280
69344
  storingEachActivityScore(false);
69281
69345
  await executeActions(onInCorrect, container);
69346
+ container.removeAttribute("click-completed");
69282
69347
  }
69283
69348
  }
69284
69349
  };
@@ -69947,6 +70012,7 @@ exports.PrevContainerKey = PrevContainerKey;
69947
70012
  exports.RiveService = RiveService;
69948
70013
  exports.SelectedValuesKey = SelectedValuesKey;
69949
70014
  exports.TemplateID = TemplateID;
70015
+ exports.Timer = Timer;
69950
70016
  exports.attachSpeakIcon = attachSpeakIcon;
69951
70017
  exports.calculateScale = calculateScale;
69952
70018
  exports.calculateScore = calculateScore;
@@ -3,6 +3,7 @@ import { convertUrlToRelative, initEventsForElement, calculateScale } from "../.
3
3
  import i18next from "../../utils/i18n";
4
4
  import { highlightElement } from "../../utils/utilsHandlers/highlightHandler";
5
5
  import { TemplateID } from "../../utils/constants";
6
+ import { Timer } from "../../utils/utilsHandlers/timer";
6
7
  /**
7
8
  * @component LidoContainer
8
9
  *
@@ -12,7 +13,7 @@ import { TemplateID } from "../../utils/constants";
12
13
  */
13
14
  export class LidoContainer {
14
15
  constructor() {
15
- this.locale = '';
16
+ this.Lang = '';
16
17
  this.showDropBorder = true;
17
18
  this.appendToDropOnCompletion = false;
18
19
  this.id = '';
@@ -65,13 +66,13 @@ export class LidoContainer {
65
66
  }
66
67
  resolveInstructionAudio() {
67
68
  var _a;
68
- this.instructName =
69
- (_a = {
70
- flashcard: "Review the flashcards to reinforce your learning." /* templateAudio.flashcards */,
71
- mcq: "Select the correct answer from the options provided." /* templateAudio.mcq */,
72
- tracing: "Trace the shape by following the outline carefully." /* templateAudio.tracing */,
73
- dragAndDrop: "Match the items by dragging and dropping them into the correct places." /* templateAudio.dragAndDrop */,
74
- }[this.templateId]) !== null && _a !== void 0 ? _a : '';
69
+ const key = (_a = {
70
+ flashcard: "instruction.flashcards" /* templateAudio.flashcards */,
71
+ mcq: "instruction.mcq" /* templateAudio.mcq */,
72
+ tracing: "instruction.tracing" /* templateAudio.tracing */,
73
+ dragAndDrop: "instruction.dragAndDrop" /* templateAudio.dragAndDrop */,
74
+ }[this.templateId]) !== null && _a !== void 0 ? _a : '';
75
+ this.instructName = key ? i18next.t(key) : '';
75
76
  const home = document.querySelector('lido-home');
76
77
  if (!home)
77
78
  return;
@@ -84,16 +85,16 @@ export class LidoContainer {
84
85
  resolveLanguage() {
85
86
  var _a, _b;
86
87
  const rootEl = this.el.closest('lido-root');
87
- const rootLang = (rootEl === null || rootEl === void 0 ? void 0 : rootEl.locale) || '';
88
+ const rootLang = (rootEl === null || rootEl === void 0 ? void 0 : rootEl.Lang) || '';
88
89
  if (rootLang === null || rootLang === void 0 ? void 0 : rootLang.trim())
89
90
  return rootLang;
90
91
  const homeEl = this.el.closest('lido-home');
91
- const homeLang = (homeEl === null || homeEl === void 0 ? void 0 : homeEl.locale) || '';
92
+ const homeLang = (homeEl === null || homeEl === void 0 ? void 0 : homeEl.Lang) || '';
92
93
  if (homeLang === null || homeLang === void 0 ? void 0 : homeLang.trim())
93
94
  return homeLang;
94
- if ((_a = this.locale) === null || _a === void 0 ? void 0 : _a.trim())
95
- return this.locale;
96
- const xmlLang = this.el.getAttribute('locale');
95
+ if ((_a = this.Lang) === null || _a === void 0 ? void 0 : _a.trim())
96
+ return this.Lang;
97
+ const xmlLang = this.el.getAttribute('Lang');
97
98
  if (xmlLang === null || xmlLang === void 0 ? void 0 : xmlLang.trim())
98
99
  return xmlLang;
99
100
  return (_b = this.el.textContent) === null || _b === void 0 ? void 0 : _b.trim();
@@ -165,7 +166,7 @@ export class LidoContainer {
165
166
  i18next.changeLanguage(appliedLang);
166
167
  const texts = this.el.querySelectorAll('lido-text');
167
168
  texts.forEach((textEl) => {
168
- textEl.locale = appliedLang;
169
+ textEl.Lang = appliedLang;
169
170
  textEl.dispatchEvent(new CustomEvent('languageChanged', { bubbles: true }));
170
171
  });
171
172
  }
@@ -204,12 +205,14 @@ export class LidoContainer {
204
205
  setTimeout(() => {
205
206
  highlightElement();
206
207
  }, 100);
208
+ Timer.getI().start();
207
209
  }
208
210
  disconnectedCallback() {
209
211
  window.removeEventListener('resize', () => this.scaleContainer(this.el));
210
212
  window.removeEventListener('load', () => this.scaleContainer(this.el));
211
213
  document.body.style.backgroundColor = '';
212
214
  document.body.style.backgroundImage = '';
215
+ Timer.getI().stop();
213
216
  }
214
217
  render() {
215
218
  // Define the styles for the container element
@@ -223,7 +226,7 @@ export class LidoContainer {
223
226
  userSelect: 'none', // Prevent any field selection
224
227
  };
225
228
  console.log('🚀 ~ LidoContainer ~ canplay:', this.canplay);
226
- return (h(Host, { key: 'bdae7c7d24046fc0f726668b9b1bbb84f3ddd3dd', id: "lido-container", locale: this.locale, "tab-index": 0, class: "lido-container", objective: this.objective, baseUrl: this.baseUrl, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, onTouch: this.onTouch, onInCorrect: this.onInCorrect, onCorrect: this.onCorrect, onEntry: this.onEntry, "show-check": `${this.showCheck}`, "is-continue-on-correct": `${this.isContinueOnCorrect}`, "is-allow-only-correct": `${this.isAllowOnlyCorrect}`, canplay: `${this.canplay}`, appendToDropOnCompletion: `${this.appendToDropOnCompletion}`, "show-prev-button": `${this.showPrevButton}`, "show-next-button": `${this.showNextButton}`, "show-drop-border": `${this.showDropBorder}`, "bg-image": this.bgImage, "exit-button-url": this.exitButtonUrl, "prev-button-url": this.prevButtonUrl, "next-button-url": this.nextButtonUrl, "speaker-button-url": this.speakerButtonUrl, "disable-speak": this.disableSpeak, "template-id": this.templateId, audio: this.audio }, h("lido-text", { key: 'aa5d73493b429f0d99c5737aed89488c565e1699', visible: "false", id: this.templateId, audio: "", string: this.instructName }), h("slot", { key: 'd251b1fed4468aabd66a6f6c14b3de234329ab64' })));
229
+ return (h(Host, { key: 'b2b35ac6c3be99cabf0eeaf2708611bfd4c3360c', id: "lido-container", Lang: this.Lang, "tab-index": 0, class: "lido-container", objective: this.objective, baseUrl: this.baseUrl, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, onTouch: this.onTouch, onInCorrect: this.onInCorrect, onCorrect: this.onCorrect, onEntry: this.onEntry, "show-check": `${this.showCheck}`, "is-continue-on-correct": `${this.isContinueOnCorrect}`, "is-allow-only-correct": `${this.isAllowOnlyCorrect}`, canplay: `${this.canplay}`, appendToDropOnCompletion: `${this.appendToDropOnCompletion}`, "show-prev-button": `${this.showPrevButton}`, "show-next-button": `${this.showNextButton}`, "show-drop-border": `${this.showDropBorder}`, "bg-image": this.bgImage, "exit-button-url": this.exitButtonUrl, "prev-button-url": this.prevButtonUrl, "next-button-url": this.nextButtonUrl, "speaker-button-url": this.speakerButtonUrl, "disable-speak": this.disableSpeak, "template-id": this.templateId, audio: this.audio }, h("lido-text", { key: 'ebd91c0603caa4e52d583dd86a1692b57b99afb4', visible: "false", id: this.templateId, audio: "", string: this.instructName }), h("slot", { key: '76f7f53558af814bbd0ce4516b80d4fa970e3c48' })));
227
230
  }
228
231
  static get is() { return "lido-container"; }
229
232
  static get originalStyleUrls() {
@@ -238,7 +241,7 @@ export class LidoContainer {
238
241
  }
239
242
  static get properties() {
240
243
  return {
241
- "locale": {
244
+ "Lang": {
242
245
  "type": "string",
243
246
  "mutable": false,
244
247
  "complexType": {
@@ -252,7 +255,7 @@ export class LidoContainer {
252
255
  "tags": [],
253
256
  "text": "Language to apply to all texts"
254
257
  },
255
- "attribute": "locale",
258
+ "attribute": "lang",
256
259
  "reflect": false,
257
260
  "defaultValue": "''"
258
261
  },
@@ -947,7 +950,7 @@ export class LidoContainer {
947
950
  static get elementRef() { return "el"; }
948
951
  static get watchers() {
949
952
  return [{
950
- "propName": "locale",
953
+ "propName": "Lang",
951
954
  "methodName": "languageChanged"
952
955
  }];
953
956
  }
@@ -111,7 +111,7 @@ export class LidoHome {
111
111
  this.commonAudioPath = "";
112
112
  this.showNav = true;
113
113
  this.activeContainerIndexes = [];
114
- this.locale = '';
114
+ this.Lang = '';
115
115
  this.xmlData = '';
116
116
  this.initialIndex = 0;
117
117
  this.canplay = true;
@@ -543,7 +543,7 @@ export class LidoHome {
543
543
  },
544
544
  "defaultValue": "[]"
545
545
  },
546
- "locale": {
546
+ "Lang": {
547
547
  "type": "string",
548
548
  "mutable": false,
549
549
  "complexType": {
@@ -557,7 +557,7 @@ export class LidoHome {
557
557
  "tags": [],
558
558
  "text": "Language to apply to all texts"
559
559
  },
560
- "attribute": "locale",
560
+ "attribute": "lang",
561
561
  "reflect": false,
562
562
  "defaultValue": "''"
563
563
  },
@@ -768,7 +768,7 @@ export class LidoHome {
768
768
  static get elementRef() { return "el"; }
769
769
  static get watchers() {
770
770
  return [{
771
- "propName": "locale",
771
+ "propName": "Lang",
772
772
  "methodName": "onLangChange"
773
773
  }, {
774
774
  "propName": "commonAudioPath",
@@ -9,7 +9,7 @@ import i18next from "../../utils/i18n";
9
9
  */
10
10
  export class LidoRoot {
11
11
  constructor() {
12
- this.locale = '';
12
+ this.Lang = '';
13
13
  this.xmlPath = '';
14
14
  this.initialIndex = 0;
15
15
  this.margin = '';
@@ -26,7 +26,7 @@ export class LidoRoot {
26
26
  * It fetches the XML data from the specified path or URL and sets it to the component's state.
27
27
  */
28
28
  connectedCallback() {
29
- this.setLanguage(this.locale);
29
+ this.setLanguage(this.Lang);
30
30
  }
31
31
  onLangChange(newLang) {
32
32
  this.setLanguage(newLang);
@@ -80,7 +80,7 @@ export class LidoRoot {
80
80
  static get assetsDirs() { return ["assets"]; }
81
81
  static get properties() {
82
82
  return {
83
- "locale": {
83
+ "Lang": {
84
84
  "type": "string",
85
85
  "mutable": false,
86
86
  "complexType": {
@@ -94,7 +94,7 @@ export class LidoRoot {
94
94
  "tags": [],
95
95
  "text": "Language to apply to all texts"
96
96
  },
97
- "attribute": "locale",
97
+ "attribute": "lang",
98
98
  "reflect": false,
99
99
  "defaultValue": "''"
100
100
  },
@@ -265,7 +265,7 @@ export class LidoRoot {
265
265
  }
266
266
  static get watchers() {
267
267
  return [{
268
- "propName": "locale",
268
+ "propName": "Lang",
269
269
  "methodName": "onLangChange"
270
270
  }];
271
271
  }