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

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-9cf49b55.js} +118 -55
  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 +2 -2
  15. package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.js +1 -1
  16. package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +31 -18
  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 +10 -6
  20. package/dist/collection/stories/Templates/palEgraOptionWithAudio/palEgraOptionWithAudio.stories.js +19 -14
  21. package/dist/collection/stories/Templates/palEgraStoryMaking/pal_egra_story_making.stories.js +8 -8
  22. package/dist/collection/stories/Templates/palEgraTemplate1/palEgraLetterIdentification.stories.js +17 -10
  23. package/dist/collection/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.js +97 -0
  24. package/dist/collection/stories/Templates/palEgra_OddOneOut/palEgra_oddOneOut.stories.js +6 -6
  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 +17 -18
  27. package/dist/collection/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.js +22 -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 +13 -13
  31. package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch2.stories.js +9 -9
  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 +4 -11
  42. package/dist/collection/utils/utilsHandlers/clickHandler.js +12 -7
  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-354f7b19.js → p-0f54f212.js} +2 -2
  70. package/dist/components/{p-3acada8c.js → p-16a6a6f6.js} +1 -1
  71. package/dist/components/{p-b151457d.js → p-27bfb88f.js} +22 -20
  72. package/dist/components/{p-93acfbb2.js → p-2b0ef6d4.js} +1 -1
  73. package/dist/components/{p-c90d92db.js → p-2ce1503f.js} +1 -1
  74. package/dist/components/{p-8f082c62.js → p-2fedf56d.js} +1 -1
  75. package/dist/components/{p-a182c9a2.js → p-3c9dd098.js} +1 -1
  76. package/dist/components/{p-235091a1.js → p-40afd35f.js} +118 -56
  77. package/dist/components/{p-57400ebc.js → p-4a1af1bb.js} +1 -1
  78. package/dist/components/{p-74c270d2.js → p-4c1d15df.js} +2 -2
  79. package/dist/components/{p-5e7c6afa.js → p-4ec94e44.js} +1 -1
  80. package/dist/components/{p-3acd9a2e.js → p-572f8490.js} +1 -1
  81. package/dist/components/{p-16604098.js → p-6bee9883.js} +1 -1
  82. package/dist/components/{p-4d01394c.js → p-76947363.js} +1 -1
  83. package/dist/components/{p-de45dcab.js → p-8632f479.js} +25 -25
  84. package/dist/components/{p-db2a05f5.js → p-97ca067d.js} +3 -3
  85. package/dist/components/{p-8a32f7cb.js → p-be063cbd.js} +1 -1
  86. package/dist/components/{p-8c0667eb.js → p-d28496a9.js} +1 -1
  87. package/dist/components/{p-b867548e.js → p-df6042b0.js} +1 -1
  88. package/dist/components/{p-06cecca5.js → p-dfa70e99.js} +1 -1
  89. package/dist/components/{p-37c86a94.js → p-e4b71ba1.js} +47 -7
  90. package/dist/components/{p-32c89979.js → p-f241ab97.js} +1 -1
  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-01d6cbb5.js} +118 -56
  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-c5ca9462.js} +2 -2
  99. package/dist/lido-player/p-e4d5dabf.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
@@ -10,7 +10,7 @@ const meta = {
10
10
  export default meta;
11
11
  export const writeSet = {
12
12
  args: {
13
- questions: ["26"],
13
+ questions: ["110"],
14
14
  isAllowOnlyCorrect: true,
15
15
  isContinueOnCorrect: true,
16
16
  },
@@ -25,8 +25,9 @@ function getContainerXml(args) {
25
25
  const QuestionCells = questions.map(question => {
26
26
  return `
27
27
  <!-- Questions -->
28
- <lido-cell visible="true" id="question" layout="" height="93px" width="368px" bg-Color="transparent" onEntry="" justify-content="space-evenly" margin="landscape.0px 0px 0px -78px,portrait.44px">
29
- <lido-text visible="true" id="number" audio="" value="${question}" onTouch="" tab-index="${tabCounter++}" height="100%" width="100%" bg-Color="#FFE99B" margin="" onEntry="this.border='5px solid #FFC805'" string="${question}" font-size="76px" font-weight="500" font-family="'Baloo Bhai 2'" onCorrect="this.speak='true'">
28
+ <lido-cell visible="true" id="question" layout="" height="93px" width="202px" bg-Color="transparent" onEntry="" justify-content="space-evenly"
29
+ margin="landscape.0px -74px 0px 68px,portrait.44px">
30
+ <lido-text visible="true" id="number" audio="" value="${question}" onTouch="" tab-index="${tabCounter++}" height="100%" width="100%" bg-Color="#FFE99B" margin="" onEntry="this.border='5px solid #FFC805'; justify-content='center'; align-items='center'" string="${question}" font-size="76px" font-weight="500" font-family="'Baloo Bhai 2'" onCorrect="this.speak='true'">
30
31
  </lido-text>
31
32
  </lido-cell>
32
33
  `;
@@ -35,10 +36,10 @@ function getContainerXml(args) {
35
36
  <lido-container visible="true" show-next-button="false" dropAttr="math-matrix" appendToDropOnCompletion="true" equationCheck="$#mat1,==,$#number" objective="" is-allow-only-correct="${isAllowOnlyCorrect}" bg-color="transparent" bg-image="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/background-images/Write%20Set.png" onInCorrect="lido-avatar.avatarAnimate='Fail'; this.sleep='2000';" onCorrect="lido-avatar.avatarAnimate='Success'; number.speak='true'; this.sleep='2000';" is-continue-on-correct="${isContinueOnCorrect}">
36
37
 
37
38
  <!-- Audio -->
38
- <lido-text visible="false" id="audio123" onEntry="this.display='none'; this.speak='true';" string="Fill the matrix according to the number given in the box."></lido-text>
39
+ <lido-text visible="false" tab-index="111" id="audio123" onEntry="this.display='none'; this.speak='true';" string="Fill the matrix according to the number given in the box."></lido-text>
39
40
 
40
41
  <!-- Chimple Avatar -->
41
- <lido-cell layout="pos" id="pos1" disable-edit="true" value="pos2" height="landscape.346px,portrait.310px" width="landscape.263px,portrait.276px" x="landscape.82%, portrait.72%" y="landscape.68%, portrait.82%" aria-hidden="true" z="1" bg-color="transparent" visible="true" onEntry="">
42
+ <lido-cell layout="pos" id="pos1" disable-edit="true" value="pos2" height="landscape.346px,portrait.310px" width="landscape.263px,portrait.276px" x="landscape.86%, portrait.72%" y="landscape.68%, portrait.82%" aria-hidden="true" z="1" bg-color="transparent" visible="true" onEntry="">
42
43
  <lido-avatar id="lido-avatar" disable-edit="true" visible="true" height="100%" width="100%" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp2/chimplecharacter.riv" alt-text="{chimpleCharacterRive}">
43
44
  </lido-avatar>
44
45
  </lido-cell>
@@ -4,6 +4,9 @@ import { setDraggingDisabled } from "./utilsHandlers/dragDropHandler";
4
4
  import { NextContainerKey, PrevContainerKey, ActivityChangeKey, GameCompletedKey, GameExitKey, ActivityEndKey, LessonEndKey } from "./constants";
5
5
  export class AudioPlayer {
6
6
  constructor() {
7
+ this.handleUserClick = () => {
8
+ this.stop();
9
+ };
7
10
  this.audioElement = document.createElement('audio');
8
11
  this.audioElement.id = 'audio';
9
12
  document.body.appendChild(this.audioElement);
@@ -40,6 +43,10 @@ export class AudioPlayer {
40
43
  catch (e) {
41
44
  console.error('Error stopping audio before speak action:', e);
42
45
  }
46
+ const text = targetElement.closest('lido-text');
47
+ if (text && text.getAttribute('disable-speak') === 'true') {
48
+ return;
49
+ }
43
50
  // then play the target element audio.
44
51
  let audioUrl = targetElement.getAttribute('audio') || '';
45
52
  // If no direct audio attribute, check childrens for audio
@@ -60,6 +67,7 @@ export class AudioPlayer {
60
67
  try {
61
68
  setDraggingDisabled(true);
62
69
  highlightSpeakingElement(targetElement);
70
+ window.addEventListener('click', this.handleUserClick, true);
63
71
  await this.audioElement.play();
64
72
  await new Promise(resolve => {
65
73
  this.audioElement.onended = () => {
@@ -71,6 +79,7 @@ export class AudioPlayer {
71
79
  console.log('🎧 Audio play error:', error);
72
80
  }
73
81
  finally {
82
+ window.removeEventListener('click', this.handleUserClick, true);
74
83
  this.audioElement.onended = null; // cleanup
75
84
  setDraggingDisabled(false);
76
85
  stopHighlightForSpeakingElement(targetElement);
@@ -80,6 +89,7 @@ export class AudioPlayer {
80
89
  else if (targetElement.textContent) {
81
90
  try {
82
91
  highlightSpeakingElement(targetElement);
92
+ window.addEventListener('click', this.handleUserClick, true);
83
93
  await speakText(targetElement.textContent, targetElement);
84
94
  const highlightedElements = document.querySelectorAll('.speaking-highlight');
85
95
  highlightedElements.forEach(element => stopHighlightForSpeakingElement(element));
@@ -1,4 +1,5 @@
1
1
  import { ActivityChangeKey, ActivityEndKey, ElementClickKey, ElementDropKey, GameCompletedKey, GameExitKey, LessonEndKey, NextContainerKey, PrevContainerKey } from "./constants";
2
+ import { Timer } from "./utilsHandlers/timer";
2
3
  function dispatchCustomEvent(eventName, detail) {
3
4
  console.log("👍Event Name : ", eventName, "Detail : ", detail.toString());
4
5
  const event = new CustomEvent(eventName, { detail });
@@ -8,7 +9,7 @@ export function dispatchActivityEndEvent(index, totalIndex, score) {
8
9
  dispatchCustomEvent(ActivityEndKey, { index, totalIndex, score });
9
10
  }
10
11
  export function dispatchLessonEndEvent(score) {
11
- dispatchCustomEvent(LessonEndKey, { score });
12
+ dispatchCustomEvent(LessonEndKey, { score, timeSpent: Math.floor(Timer.getI().getElapsed() / 1000) });
12
13
  }
13
14
  export function dispatchNextContainerEvent() {
14
15
  dispatchCustomEvent(NextContainerKey, {});
@@ -7,6 +7,7 @@ import hi from "../i18n/hi.json";
7
7
  import ka from "../i18n/ka.json";
8
8
  import te from "../i18n/te.json";
9
9
  import port from "../i18n/port.json";
10
+ import ma from "../i18n/ma.json";
10
11
  i18next
11
12
  .use(LanguageDetector)
12
13
  .init({
@@ -17,6 +18,7 @@ i18next
17
18
  ka: { translation: ka },
18
19
  te: { translation: te },
19
20
  port: { translation: port },
21
+ ma: { translation: ma },
20
22
  },
21
23
  fallbackLng: 'en', // fallback if current lang not found
22
24
  debug: false,
@@ -189,6 +189,7 @@ export const executeActions = async (actionsString, thisElement, element) => {
189
189
  const container = document.getElementById(LidoContainer);
190
190
  if (container.getAttribute('is-continue-on-correct') !== 'true') {
191
191
  targetElement.style.pointerEvents = 'none';
192
+ AudioPlayer.getI().stop();
192
193
  }
193
194
  await validateObjectiveStatus();
194
195
  break;
@@ -420,7 +421,7 @@ const afterDropDragHandling = (dragElement, dropElement) => {
420
421
  const scaledLeft = (dropCenterX - dragCenterX) / containerScale;
421
422
  const scaledTop = (dropCenterY - dragCenterY) / containerScale;
422
423
  dragElement.style.transform = `translate(${scaledLeft}px, ${scaledTop}px)`;
423
- }, 100);
424
+ }, 700);
424
425
  }
425
426
  };
426
427
  // function cloneElementWithComputedStyles(originalEl: HTMLElement): HTMLElement {
@@ -604,22 +605,14 @@ export async function onActivityComplete(dragElement, dropElement) {
604
605
  const storedTabIndexes = Object.keys(dragScore).map(Number);
605
606
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
606
607
  if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
607
- if (otherElement.tagName.toLowerCase() === 'lido-text') {
608
- // otherElement.style.backgroundColor = 'transparent'; // Reset background color**
609
- }
610
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
611
- otherElement.style.opacity = '0';
612
- otherElement.style.backgroundColor = 'transparent';
608
+ if (otherElement) {
609
+ otherElement.style.opacity = "0";
613
610
  }
614
611
  }
615
612
  }
616
613
  else {
617
614
  if (otherElement.tagName.toLowerCase() === 'lido-text') {
618
- // otherElement.style.backgroundColor = 'transparent'; // Reset background color**********
619
- }
620
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
621
615
  otherElement.style.opacity = '1';
622
- otherElement.style.backgroundColor = 'transparent';
623
616
  }
624
617
  }
625
618
  });
@@ -27,7 +27,7 @@ export function onTouchListenerForOnTouch(element) {
27
27
  setDraggingDisabled(false);
28
28
  };
29
29
  const onPointerDown = (event) => {
30
- event.stopPropagation();
30
+ // event.stopPropagation();
31
31
  onholdTriggered = false;
32
32
  onholdTimer = setTimeout(() => {
33
33
  playAudio();
@@ -35,13 +35,18 @@ export function onTouchListenerForOnTouch(element) {
35
35
  };
36
36
  const onPointerUp = async (event) => {
37
37
  clearTimeout(onholdTimer);
38
- if (!onholdTriggered && onTouch) {
38
+ // If long-press happened → do nothing else
39
+ if (onholdTriggered) {
40
+ setDraggingDisabled(false);
41
+ return;
42
+ }
43
+ // If an onTouch action is defined, execute it on tap.
44
+ if (onTouch) {
39
45
  await executeActions(onTouch, element);
40
46
  }
41
- else if (!onTouch) {
42
- if (['category', 'option'].includes(element.getAttribute('type') || '')) {
43
- element.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
44
- }
47
+ const type = element.getAttribute('type') || '';
48
+ if (['category', 'option', 'click'].includes(type)) {
49
+ element.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
45
50
  }
46
51
  setDraggingDisabled(false);
47
52
  };
@@ -87,7 +92,7 @@ export function addClickListenerForClickType(element) {
87
92
  container.setAttribute(SelectedValuesKey, JSON.stringify([element['value']]));
88
93
  const isCorrect = objective.includes(element['value']);
89
94
  dispatchClickEvent(element, isCorrect);
90
- if (isCorrect) {
95
+ if (isCorrect || container.getAttribute('is-continue-on-correct') === 'false') {
91
96
  const onCorrect = element.getAttribute('onCorrect');
92
97
  if (!(element.id && element.id.startsWith('key-button'))) {
93
98
  element.style.pointerEvents = 'none';
@@ -70,6 +70,7 @@ export function enableDraggingWithScaling(element) {
70
70
  let horizontalDistance;
71
71
  const onStart = (event) => {
72
72
  var _a, _b;
73
+ console.log("moving start");
73
74
  if (isDraggingDisabled) {
74
75
  isDragging = false;
75
76
  return;
@@ -217,22 +218,14 @@ export function enableDraggingWithScaling(element) {
217
218
  const storedTabIndexes = Object.keys(dropObject).map(Number);
218
219
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
219
220
  if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
220
- if (otherElement.tagName.toLowerCase() === 'lido-text') {
221
- // otherElement.style.border = ''; // Reset border
222
- // otherElement.style.backgroundColor = 'transparent'; // Reset background color
223
- }
224
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
225
- otherElement.style.opacity = '0';
221
+ if (otherElement) {
222
+ otherElement.style.opacity = "0.3";
226
223
  }
227
224
  }
228
225
  }
229
226
  else {
230
- if (otherElement.tagName.toLowerCase() === 'lido-text') {
231
- // otherElement.style.border = ''; // Reset border
232
- // otherElement.style.backgroundColor = ''; // Reset background color
233
- }
234
- if (otherElement.tagName.toLowerCase() === 'lido-image' || 'lido-cell') {
235
- otherElement.style.opacity = '1';
227
+ if (otherElement) {
228
+ otherElement.style.opacity = "1";
236
229
  }
237
230
  }
238
231
  });
@@ -241,6 +234,7 @@ export function enableDraggingWithScaling(element) {
241
234
  if (mostOverlappedElement.tagName.toLowerCase() === 'lido-text') {
242
235
  // mostOverlappedElement.style.border = '2px dashed #ff0000'; // Red dashed border
243
236
  // mostOverlappedElement.style.backgroundColor = 'rgba(255, 0, 0, 0.1)'; // Light red background
237
+ mostOverlappedElement.style.opacity = "0.3";
244
238
  }
245
239
  else {
246
240
  if (!document.getElementById('unitsDrop') || !document.getElementById('tensDrop') || !document.getElementById('hundredsDrop')) {
@@ -277,12 +271,8 @@ export function enableDraggingWithScaling(element) {
277
271
  const storedTabIndexes = Object.keys(dropObject).map(Number);
278
272
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
279
273
  if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
280
- if (otherElement.tagName.toLowerCase() === 'lido-text') {
281
- // otherElement.style.border = ''; // Reset border
282
- // otherElement.style.backgroundColor = 'transparent'; // Reset background color
283
- }
284
- else if (otherElement.tagName.toLowerCase() === 'lido-image') {
285
- otherElement.style.opacity = '0';
274
+ if (otherElement) {
275
+ otherElement.style.opacity = "0";
286
276
  }
287
277
  else {
288
278
  otherElement.style.opacity = '1';
@@ -290,12 +280,8 @@ export function enableDraggingWithScaling(element) {
290
280
  }
291
281
  }
292
282
  else {
293
- if (otherElement.tagName.toLowerCase() === 'lido-text') {
294
- // otherElement.style.border = ''; // Reset border
295
- // otherElement.style.backgroundColor = ''; // Reset background color
296
- }
297
- if (otherElement.tagName.toLowerCase() === 'lido-image' || 'lido-cell') {
298
- otherElement.style.opacity = '1';
283
+ if (otherElement) {
284
+ otherElement.style.opacity = "1";
299
285
  }
300
286
  }
301
287
  });
@@ -346,6 +332,7 @@ export function enableDraggingWithScaling(element) {
346
332
  element.addEventListener('touchstart', onStart);
347
333
  element.addEventListener('click', ev => {
348
334
  if (isClicked) {
335
+ console.log("clicked drag elkement");
349
336
  onClickDropOrDragElement(element, 'drag');
350
337
  }
351
338
  });
@@ -474,21 +461,13 @@ export function handleResetDragElement(dragElement, dropElement, dropHasDrag, se
474
461
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
475
462
  if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
476
463
  if (otherElement.tagName.toLowerCase() === 'lido-text') {
477
- // otherElement.style.backgroundColor = 'transparent'; // Reset background color
478
- }
479
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
480
- otherElement.style.opacity = '0';
481
- otherElement.style.backgroundColor = 'transparent';
464
+ otherElement.style.opacity = "0";
482
465
  }
483
466
  }
484
467
  }
485
468
  else {
486
- if (otherElement.tagName.toLowerCase() === 'lido-text') {
487
- // otherElement.style.backgroundColor = 'transparent'; // Reset background color
488
- }
489
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
490
- otherElement.style.opacity = '1';
491
- otherElement.style.backgroundColor = 'transparent';
469
+ if (otherElement) {
470
+ otherElement.style.opacity = "1";
492
471
  }
493
472
  }
494
473
  });
@@ -506,11 +485,14 @@ export async function onElementDropComplete(dragElement, dropElement) {
506
485
  if (!dropElement) {
507
486
  handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
508
487
  }
509
- const dropTabIndex = dropElement.getAttribute('tab-index');
510
- const isAllowOnlyOneDrop = dropElement.getAttribute('is-allow-only-one-drop') === 'false';
511
- if (((_b = dropHasDrag[dropTabIndex]) === null || _b === void 0 ? void 0 : _b.isFull) && !isAllowOnlyOneDrop) {
512
- handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
513
- return;
488
+ let dropTabIndex;
489
+ if (dropElement) {
490
+ dropTabIndex = dropElement.getAttribute('tab-index');
491
+ const isAllowOnlyOneDrop = dropElement.getAttribute('is-allow-only-one-drop') === 'false';
492
+ if (((_b = dropHasDrag[dropTabIndex]) === null || _b === void 0 ? void 0 : _b.isFull) && !isAllowOnlyOneDrop) {
493
+ handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
494
+ return;
495
+ }
514
496
  }
515
497
  const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
516
498
  if (isAllowOnlyCorrect) {
@@ -544,7 +526,6 @@ export async function onElementDropComplete(dragElement, dropElement) {
544
526
  dragElement.style.transition = 'transform 0.5s ease';
545
527
  animateDragToTarget(dragElement, dropElement, container);
546
528
  const onInCorrect = dropElement.getAttribute('onInCorrect');
547
- console.log("onincorrectttt", onInCorrect);
548
529
  await executeActions(onInCorrect, dropElement, dragElement);
549
530
  setTimeout(() => {
550
531
  dragElement.style.transform = 'translate(0, 0)';
@@ -651,21 +632,13 @@ export async function onElementDropComplete(dragElement, dropElement) {
651
632
  const storedTabIndexes = Object.keys(dropObject).map(Number);
652
633
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
653
634
  if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
654
- if (otherElement.tagName.toLowerCase() === 'lido-text') {
655
- // otherElement.style.border = ''; // Reset border
656
- // otherElement.style.backgroundColor = 'transparent'; // Reset background color
657
- }
658
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
635
+ if (otherElement) {
659
636
  otherElement.style.opacity = '0';
660
637
  }
661
638
  }
662
639
  }
663
640
  else {
664
- if (otherElement.tagName.toLowerCase() === 'lido-text') {
665
- // otherElement.style.border = ''; // Reset border
666
- // otherElement.style.backgroundColor = ''; // Reset background color
667
- }
668
- if (otherElement.tagName.toLowerCase() === 'lido-image' || 'lido-cell') {
641
+ if (otherElement) {
669
642
  otherElement.style.opacity = '1';
670
643
  }
671
644
  }
@@ -794,8 +767,9 @@ export async function onClickDropOrDragElement(element, type) {
794
767
  element.ariaPressed = 'true';
795
768
  const selectedDropElement = type === 'drop' ? element : document.querySelector("[type='drop'].highlight-element");
796
769
  const selectedDragElement = type === 'drag' ? element : document.querySelector("[type='drag'].highlight-element");
797
- if (!selectedDropElement) {
770
+ if (!selectedDropElement || element.classList.contains("dropped")) {
798
771
  onClickDragElement(element);
772
+ return;
799
773
  }
800
774
  if (selectedDropElement && selectedDragElement) {
801
775
  if (selectedDragElement.getAttribute('drop-to'))
@@ -14,7 +14,7 @@ export function updateBalanceOnDrop(dragElement, dropElement) {
14
14
  }
15
15
  function calculateValue(elements, operation) {
16
16
  if (elements.length === 0)
17
- return 0;
17
+ return null;
18
18
  if (operation === "count") {
19
19
  return elements.length;
20
20
  }
@@ -46,18 +46,17 @@ function calculateValue(elements, operation) {
46
46
  }
47
47
  }
48
48
  export function balanceResult(container, objectiveString) {
49
- var _a, _b, _c, _d, _e, _f;
50
49
  const additionalCheck = container.getAttribute('equationCheck');
51
50
  if (!additionalCheck)
52
51
  return false;
53
52
  const balanceEl = document.querySelector('lido-balance');
54
53
  if (!balanceEl)
55
54
  return false;
56
- 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);
57
- 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);
55
+ const leftVal = balanceEl.leftVal;
56
+ const rightVal = balanceEl.rightVal;
58
57
  const hasLeft = !isNaN(leftVal);
59
58
  const hasRight = !isNaN(rightVal);
60
- if (!hasLeft || !hasRight) {
59
+ if (leftVal == null || rightVal == null) {
61
60
  return false;
62
61
  }
63
62
  const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
@@ -0,0 +1,53 @@
1
+ export class Timer {
2
+ constructor() {
3
+ this.startTime = 0;
4
+ this.elapsedTime = 0;
5
+ this.intervalId = null;
6
+ }
7
+ static getI(onTick) {
8
+ if (!Timer.instance) {
9
+ Timer.instance = new Timer();
10
+ }
11
+ if (onTick) {
12
+ Timer.instance.onTick = onTick;
13
+ }
14
+ return Timer.instance;
15
+ }
16
+ start() {
17
+ if (this.intervalId)
18
+ return;
19
+ this.startTime = Date.now() - this.elapsedTime;
20
+ this.intervalId = window.setInterval(() => {
21
+ var _a;
22
+ this.elapsedTime = Date.now() - this.startTime;
23
+ (_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, this.elapsedTime);
24
+ }, 1000);
25
+ }
26
+ pause() {
27
+ if (!this.intervalId)
28
+ return;
29
+ clearInterval(this.intervalId);
30
+ this.intervalId = null;
31
+ this.elapsedTime = Date.now() - this.startTime;
32
+ }
33
+ resume() {
34
+ if (this.intervalId)
35
+ return;
36
+ this.start();
37
+ }
38
+ stop() {
39
+ var _a;
40
+ if (this.intervalId) {
41
+ clearInterval(this.intervalId);
42
+ this.intervalId = null;
43
+ }
44
+ this.startTime = 0;
45
+ this.elapsedTime = 0;
46
+ (_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, 0);
47
+ }
48
+ getElapsed() {
49
+ return this.intervalId
50
+ ? Date.now() - this.startTime
51
+ : this.elapsedTime;
52
+ }
53
+ }
@@ -1 +1 @@
1
- export { f as format, g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-235091a1.js';
1
+ export { f as format, g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-40afd35f.js';
@@ -1,4 +1,4 @@
1
- import { L as LidoAvatar$1, d as defineCustomElement$1 } from './p-4d01394c.js';
1
+ import { L as LidoAvatar$1, d as defineCustomElement$1 } from './p-76947363.js';
2
2
 
3
3
  const LidoAvatar = LidoAvatar$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoBalance$1, d as defineCustomElement$1 } from './p-06cecca5.js';
1
+ import { L as LidoBalance$1, d as defineCustomElement$1 } from './p-dfa70e99.js';
2
2
 
3
3
  const LidoBalance = LidoBalance$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoCalculator$1, d as defineCustomElement$1 } from './p-db2a05f5.js';
1
+ import { L as LidoCalculator$1, d as defineCustomElement$1 } from './p-97ca067d.js';
2
2
 
3
3
  const LidoCalculator = LidoCalculator$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoCanvas$1, d as defineCustomElement$1 } from './p-354f7b19.js';
1
+ import { L as LidoCanvas$1, d as defineCustomElement$1 } from './p-0f54f212.js';
2
2
 
3
3
  const LidoCanvas = LidoCanvas$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoCell$1, d as defineCustomElement$1 } from './p-3acada8c.js';
1
+ import { L as LidoCell$1, d as defineCustomElement$1 } from './p-16a6a6f6.js';
2
2
 
3
3
  const LidoCell = LidoCell$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoCol$1, d as defineCustomElement$1 } from './p-57400ebc.js';
1
+ import { L as LidoCol$1, d as defineCustomElement$1 } from './p-4a1af1bb.js';
2
2
 
3
3
  const LidoCol = LidoCol$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoContainer$1, d as defineCustomElement$1 } from './p-b151457d.js';
1
+ import { L as LidoContainer$1, d as defineCustomElement$1 } from './p-27bfb88f.js';
2
2
 
3
3
  const LidoContainer = LidoContainer$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoFlash, d as defineCustomElement$1 } from './p-8f082c62.js';
1
+ import { L as LidoFlash, d as defineCustomElement$1 } from './p-2fedf56d.js';
2
2
 
3
3
  const LidoFlashCard = LidoFlash;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoFloat$1, d as defineCustomElement$1 } from './p-b867548e.js';
1
+ import { L as LidoFloat$1, d as defineCustomElement$1 } from './p-df6042b0.js';
2
2
 
3
3
  const LidoFloat = LidoFloat$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoHome$1, d as defineCustomElement$1 } from './p-de45dcab.js';
1
+ import { L as LidoHome$1, d as defineCustomElement$1 } from './p-8632f479.js';
2
2
 
3
3
  const LidoHome = LidoHome$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoImage$1, d as defineCustomElement$1 } from './p-16604098.js';
1
+ import { L as LidoImage$1, d as defineCustomElement$1 } from './p-6bee9883.js';
2
2
 
3
3
  const LidoImage = LidoImage$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoKeyboard$1, d as defineCustomElement$1 } from './p-74c270d2.js';
1
+ import { L as LidoKeyboard$1, d as defineCustomElement$1 } from './p-4c1d15df.js';
2
2
 
3
3
  const LidoKeyboard = LidoKeyboard$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoMathMatrix$1, d as defineCustomElement$1 } from './p-93acfbb2.js';
1
+ import { L as LidoMathMatrix$1, d as defineCustomElement$1 } from './p-2b0ef6d4.js';
2
2
 
3
3
  const LidoMathMatrix = LidoMathMatrix$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoPos$1, d as defineCustomElement$1 } from './p-c90d92db.js';
1
+ import { L as LidoPos$1, d as defineCustomElement$1 } from './p-2ce1503f.js';
2
2
 
3
3
  const LidoPos = LidoPos$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoRandom$1, d as defineCustomElement$1 } from './p-8c0667eb.js';
1
+ import { L as LidoRandom$1, d as defineCustomElement$1 } from './p-d28496a9.js';
2
2
 
3
3
  const LidoRandom = LidoRandom$1;
4
4
  const defineCustomElement = defineCustomElement$1;