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.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +70 -28
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-28faa755.js → utils-9cf49b55.js} +118 -55
- package/dist/collection/components/container/lido-container.js +21 -18
- package/dist/collection/components/home/lido-home.js +4 -4
- package/dist/collection/components/root/lido-root.js +5 -5
- package/dist/collection/components/text/lido-text.js +3 -2
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +1 -1
- package/dist/collection/stories/Templates/imageMatch/imageMatch.stories.js +16 -15
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationimageTotext.stories.js +9 -7
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationtextTotext.stories.js +8 -6
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaMultiOption.stories.js +2 -2
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.js +1 -1
- package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +31 -18
- package/dist/collection/stories/Templates/palEgmaWordProblem/palEgmaWordProblem.stories.js +5 -5
- package/dist/collection/stories/Templates/palEgraInventedSpelling/pal_egra_invented_spelling_schema.stories.js +10 -7
- package/dist/collection/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.js +10 -6
- package/dist/collection/stories/Templates/palEgraOptionWithAudio/palEgraOptionWithAudio.stories.js +19 -14
- package/dist/collection/stories/Templates/palEgraStoryMaking/pal_egra_story_making.stories.js +8 -8
- package/dist/collection/stories/Templates/palEgraTemplate1/palEgraLetterIdentification.stories.js +17 -10
- package/dist/collection/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.js +97 -0
- package/dist/collection/stories/Templates/palEgra_OddOneOut/palEgra_oddOneOut.stories.js +6 -6
- package/dist/collection/stories/Templates/palEgra_arrange_pictures/palEgra_arrange_pictures.stories.js +16 -19
- package/dist/collection/stories/Templates/palEgra_build_word/palEgra_build_word.stories.js +17 -18
- package/dist/collection/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.js +22 -19
- package/dist/collection/stories/Templates/palStorytale/palStorytale.stories.js +9 -9
- package/dist/collection/stories/Templates/pictureClues/pictureClues.stories.js +9 -9
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch1.stories.js +13 -13
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch2.stories.js +9 -9
- package/dist/collection/stories/Templates/sentenceMatch/sentenceMatch.stories.js +63 -0
- package/dist/collection/stories/Templates/substraction/substractionWithimg.stories.js +7 -7
- package/dist/collection/stories/Templates/substraction/substractionWithoutImg.stories.js +13 -13
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithimg.stories.js +7 -7
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.js +1 -1
- package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +6 -5
- package/dist/collection/utils/audioPlayer.js +10 -0
- package/dist/collection/utils/customEvents.js +2 -1
- package/dist/collection/utils/i18n.js +2 -0
- package/dist/collection/utils/utils.js +4 -11
- package/dist/collection/utils/utilsHandlers/clickHandler.js +12 -7
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +26 -52
- package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +4 -5
- package/dist/collection/utils/utilsHandlers/timer.js +53 -0
- package/dist/components/index.js +1 -1
- package/dist/components/lido-avatar.js +1 -1
- package/dist/components/lido-balance.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-canvas.js +1 -1
- package/dist/components/lido-cell.js +1 -1
- package/dist/components/lido-col.js +1 -1
- package/dist/components/lido-container.js +1 -1
- package/dist/components/lido-flash-card.js +1 -1
- package/dist/components/lido-float.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-image.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-math-matrix.js +1 -1
- package/dist/components/lido-pos.js +1 -1
- package/dist/components/lido-random.js +1 -1
- package/dist/components/lido-root.js +27 -27
- package/dist/components/lido-row.js +1 -1
- package/dist/components/lido-shape.js +1 -1
- package/dist/components/lido-slide-fill.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/lido-trace.js +1 -1
- package/dist/components/lido-wrap.js +1 -1
- package/dist/components/{p-354f7b19.js → p-0f54f212.js} +2 -2
- package/dist/components/{p-3acada8c.js → p-16a6a6f6.js} +1 -1
- package/dist/components/{p-b151457d.js → p-27bfb88f.js} +22 -20
- package/dist/components/{p-93acfbb2.js → p-2b0ef6d4.js} +1 -1
- package/dist/components/{p-c90d92db.js → p-2ce1503f.js} +1 -1
- package/dist/components/{p-8f082c62.js → p-2fedf56d.js} +1 -1
- package/dist/components/{p-a182c9a2.js → p-3c9dd098.js} +1 -1
- package/dist/components/{p-235091a1.js → p-40afd35f.js} +118 -56
- package/dist/components/{p-57400ebc.js → p-4a1af1bb.js} +1 -1
- package/dist/components/{p-74c270d2.js → p-4c1d15df.js} +2 -2
- package/dist/components/{p-5e7c6afa.js → p-4ec94e44.js} +1 -1
- package/dist/components/{p-3acd9a2e.js → p-572f8490.js} +1 -1
- package/dist/components/{p-16604098.js → p-6bee9883.js} +1 -1
- package/dist/components/{p-4d01394c.js → p-76947363.js} +1 -1
- package/dist/components/{p-de45dcab.js → p-8632f479.js} +25 -25
- package/dist/components/{p-db2a05f5.js → p-97ca067d.js} +3 -3
- package/dist/components/{p-8a32f7cb.js → p-be063cbd.js} +1 -1
- package/dist/components/{p-8c0667eb.js → p-d28496a9.js} +1 -1
- package/dist/components/{p-b867548e.js → p-df6042b0.js} +1 -1
- package/dist/components/{p-06cecca5.js → p-dfa70e99.js} +1 -1
- package/dist/components/{p-37c86a94.js → p-e4b71ba1.js} +47 -7
- package/dist/components/{p-32c89979.js → p-f241ab97.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +70 -28
- package/dist/esm/lido-player.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-2edeb213.js → utils-01d6cbb5.js} +118 -56
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/{p-add7f36e.js → p-c5ca9462.js} +2 -2
- package/dist/lido-player/p-e4d5dabf.entry.js +1 -0
- package/dist/types/components/container/lido-container.d.ts +1 -1
- package/dist/types/components/home/lido-home.d.ts +1 -1
- package/dist/types/components/root/lido-root.d.ts +1 -1
- package/dist/types/components.d.ts +24 -24
- package/dist/types/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.d.ts +4 -0
- package/dist/types/stories/Templates/sentenceMatch/sentenceMatch.stories.d.ts +4 -0
- package/dist/types/utils/audioPlayer.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +4 -5
- package/dist/types/utils/utilsHandlers/timer.d.ts +14 -0
- package/package.json +1 -1
- 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
|
|
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 =
|
|
163
|
-
const rightVal =
|
|
164
|
-
|
|
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
|
|
438
|
-
|
|
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
|
|
445
|
-
|
|
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
|
|
489
|
-
|
|
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
|
|
499
|
-
|
|
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
|
-
|
|
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
|
|
687
|
-
|
|
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
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
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
|
|
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
|
|
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));
|
|
@@ -3199,7 +3259,7 @@ function onTouchListenerForOnTouch(element) {
|
|
|
3199
3259
|
setDraggingDisabled(false);
|
|
3200
3260
|
};
|
|
3201
3261
|
const onPointerDown = (event) => {
|
|
3202
|
-
event.stopPropagation();
|
|
3262
|
+
// event.stopPropagation();
|
|
3203
3263
|
onholdTriggered = false;
|
|
3204
3264
|
onholdTimer = setTimeout(() => {
|
|
3205
3265
|
playAudio();
|
|
@@ -3207,13 +3267,18 @@ function onTouchListenerForOnTouch(element) {
|
|
|
3207
3267
|
};
|
|
3208
3268
|
const onPointerUp = async (event) => {
|
|
3209
3269
|
clearTimeout(onholdTimer);
|
|
3210
|
-
|
|
3270
|
+
// If long-press happened → do nothing else
|
|
3271
|
+
if (onholdTriggered) {
|
|
3272
|
+
setDraggingDisabled(false);
|
|
3273
|
+
return;
|
|
3274
|
+
}
|
|
3275
|
+
// If an onTouch action is defined, execute it on tap.
|
|
3276
|
+
if (onTouch) {
|
|
3211
3277
|
await executeActions(onTouch, element);
|
|
3212
3278
|
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
}
|
|
3279
|
+
const type = element.getAttribute('type') || '';
|
|
3280
|
+
if (['category', 'option', 'click'].includes(type)) {
|
|
3281
|
+
element.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
|
|
3217
3282
|
}
|
|
3218
3283
|
setDraggingDisabled(false);
|
|
3219
3284
|
};
|
|
@@ -3259,7 +3324,7 @@ function addClickListenerForClickType(element) {
|
|
|
3259
3324
|
container.setAttribute(SelectedValuesKey, JSON.stringify([element['value']]));
|
|
3260
3325
|
const isCorrect = objective.includes(element['value']);
|
|
3261
3326
|
dispatchClickEvent(element, isCorrect);
|
|
3262
|
-
if (isCorrect) {
|
|
3327
|
+
if (isCorrect || container.getAttribute('is-continue-on-correct') === 'false') {
|
|
3263
3328
|
const onCorrect = element.getAttribute('onCorrect');
|
|
3264
3329
|
if (!(element.id && element.id.startsWith('key-button'))) {
|
|
3265
3330
|
element.style.pointerEvents = 'none';
|
|
@@ -68720,6 +68785,7 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
68720
68785
|
const container = document.getElementById(LidoContainer);
|
|
68721
68786
|
if (container.getAttribute('is-continue-on-correct') !== 'true') {
|
|
68722
68787
|
targetElement.style.pointerEvents = 'none';
|
|
68788
|
+
AudioPlayer.getI().stop();
|
|
68723
68789
|
}
|
|
68724
68790
|
await validateObjectiveStatus();
|
|
68725
68791
|
break;
|
|
@@ -68951,7 +69017,7 @@ const afterDropDragHandling = (dragElement, dropElement) => {
|
|
|
68951
69017
|
const scaledLeft = (dropCenterX - dragCenterX) / containerScale;
|
|
68952
69018
|
const scaledTop = (dropCenterY - dragCenterY) / containerScale;
|
|
68953
69019
|
dragElement.style.transform = `translate(${scaledLeft}px, ${scaledTop}px)`;
|
|
68954
|
-
},
|
|
69020
|
+
}, 700);
|
|
68955
69021
|
}
|
|
68956
69022
|
};
|
|
68957
69023
|
// function cloneElementWithComputedStyles(originalEl: HTMLElement): HTMLElement {
|
|
@@ -69135,18 +69201,14 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
69135
69201
|
const storedTabIndexes = Object.keys(dragScore).map(Number);
|
|
69136
69202
|
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
69137
69203
|
if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
|
|
69138
|
-
if (otherElement
|
|
69139
|
-
|
|
69140
|
-
otherElement.style.opacity = '0';
|
|
69141
|
-
otherElement.style.backgroundColor = 'transparent';
|
|
69204
|
+
if (otherElement) {
|
|
69205
|
+
otherElement.style.opacity = "0";
|
|
69142
69206
|
}
|
|
69143
69207
|
}
|
|
69144
69208
|
}
|
|
69145
69209
|
else {
|
|
69146
|
-
if (otherElement.tagName.toLowerCase() === 'lido-text')
|
|
69147
|
-
if (otherElement.tagName.toLowerCase() === 'lido-image') {
|
|
69210
|
+
if (otherElement.tagName.toLowerCase() === 'lido-text') {
|
|
69148
69211
|
otherElement.style.opacity = '1';
|
|
69149
|
-
otherElement.style.backgroundColor = 'transparent';
|
|
69150
69212
|
}
|
|
69151
69213
|
}
|
|
69152
69214
|
});
|
|
@@ -69947,6 +70009,7 @@ exports.PrevContainerKey = PrevContainerKey;
|
|
|
69947
70009
|
exports.RiveService = RiveService;
|
|
69948
70010
|
exports.SelectedValuesKey = SelectedValuesKey;
|
|
69949
70011
|
exports.TemplateID = TemplateID;
|
|
70012
|
+
exports.Timer = Timer;
|
|
69950
70013
|
exports.attachSpeakIcon = attachSpeakIcon;
|
|
69951
70014
|
exports.calculateScale = calculateScale;
|
|
69952
70015
|
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.
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
95
|
-
return this.
|
|
96
|
-
const xmlLang = this.el.getAttribute('
|
|
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.
|
|
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: '
|
|
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
|
-
"
|
|
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": "
|
|
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": "
|
|
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.
|
|
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
|
-
"
|
|
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": "
|
|
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": "
|
|
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.
|
|
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.
|
|
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
|
-
"
|
|
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": "
|
|
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": "
|
|
268
|
+
"propName": "Lang",
|
|
269
269
|
"methodName": "onLangChange"
|
|
270
270
|
}];
|
|
271
271
|
}
|
|
@@ -82,7 +82,8 @@ export class LidoText {
|
|
|
82
82
|
const base = window[LIDO_COMMON_AUDIO_PATH];
|
|
83
83
|
if (!base || !this.string)
|
|
84
84
|
return null;
|
|
85
|
-
const fileName = this.string
|
|
85
|
+
const fileName = this.string;
|
|
86
|
+
console.log(fileName, "filename😂");
|
|
86
87
|
return `${base}/${fileName}.mp3`;
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
@@ -149,7 +150,7 @@ export class LidoText {
|
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
render() {
|
|
152
|
-
return (h(Host, { key: '
|
|
153
|
+
return (h(Host, { key: '7b3c230890775e489b3d2bc2abca683078211377', class: "lido-text", value: this.value, type: this.type, "tab-index": this.tabIndex, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, minDrops: this.minDrops, maxDrops: this.maxDrops, id: this.id, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, "span-type": this.spanType, "disable-speak": this.disableSpeak }, this.spanType !== '' ? h("div", { class: "lido-text-content" }, " ", i18next.t(this.string)) : i18next.t(this.string)));
|
|
153
154
|
}
|
|
154
155
|
static get is() { return "lido-text"; }
|
|
155
156
|
static get originalStyleUrls() {
|
|
@@ -46,7 +46,7 @@ function getContainerXml(args) {
|
|
|
46
46
|
</lido-text>
|
|
47
47
|
</lido-pos>
|
|
48
48
|
<!-- question -->
|
|
49
|
-
<lido-text visible="true" tab-index="12" height="landscape.100px,portrait.175px" font-family="'Baloo Bhai 2'" font-size="60px" width="landscape.auto,portrait.86%" string="Drop the elements to match the given symbol '${objective}'" font-color="black" bg-color="white" y="landscape.0%,portrait.-12%" onEntry="this.font-weight='600'; this.position='relative';">
|
|
49
|
+
<lido-text visible="true" audio="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/fill-in-the-blanks/fill-upAudio.mp3" id="heading" tab-index="12" height="landscape.100px,portrait.175px" font-family="'Baloo Bhai 2'" font-size="60px" width="landscape.auto,portrait.86%" string="Drop the elements to match the given symbol '${objective}'" font-color="black" bg-color="white" y="landscape.0%,portrait.-12%" onEntry="this.speak='true';this.font-weight='600'; this.position='relative';">
|
|
50
50
|
</lido-text>
|
|
51
51
|
<lido-balance tilt="0" operation="add" visible="true" height="landscape.456px,portrait.500px" y="landscape.4%,portrait.0%" width="landscape.1136px,portrait.876px">
|
|
52
52
|
<!-- drop Element -->
|