lido-player 0.0.2-alpha-59-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 +73 -29
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-03573882.js → utils-9cf49b55.js} +121 -58
- package/dist/collection/components/container/lido-container.js +24 -19
- 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 +80 -0
- 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 +3 -3
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.js +3 -5
- 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 +103 -0
- 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 +75 -0
- package/dist/collection/stories/Templates/palEgra_build_word/palEgra_build_word.stories.js +77 -0
- package/dist/collection/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.js +22 -19
- package/dist/collection/stories/Templates/palStorytale/palStorytale.stories.js +35 -0
- package/dist/collection/stories/Templates/pictureClues/pictureClues.stories.js +10 -10
- 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 +27 -53
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +2 -2
- 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-ad0f335e.js → p-0f54f212.js} +2 -2
- package/dist/components/{p-33b83222.js → p-16a6a6f6.js} +1 -1
- package/dist/components/{p-5c990168.js → p-27bfb88f.js} +25 -21
- package/dist/components/{p-6bbad90f.js → p-2b0ef6d4.js} +1 -1
- package/dist/components/{p-5aa24314.js → p-2ce1503f.js} +1 -1
- package/dist/components/{p-6819005f.js → p-2fedf56d.js} +1 -1
- package/dist/components/{p-356e56bd.js → p-3c9dd098.js} +1 -1
- package/dist/components/{p-3513b1f3.js → p-40afd35f.js} +121 -59
- package/dist/components/{p-f9426cbe.js → p-4a1af1bb.js} +1 -1
- package/dist/components/{p-4d9462ab.js → p-4c1d15df.js} +2 -2
- package/dist/components/{p-e8e9250e.js → p-4ec94e44.js} +1 -1
- package/dist/components/{p-d9b17242.js → p-572f8490.js} +1 -1
- package/dist/components/{p-84302365.js → p-6bee9883.js} +1 -1
- package/dist/components/{p-99fcbae4.js → p-76947363.js} +1 -1
- package/dist/components/{p-73e4bb01.js → p-8632f479.js} +25 -25
- package/dist/components/{p-aff68c41.js → p-97ca067d.js} +3 -3
- package/dist/components/{p-de62d08e.js → p-be063cbd.js} +1 -1
- package/dist/components/{p-9b35082a.js → p-d28496a9.js} +1 -1
- package/dist/components/{p-f238004e.js → p-df6042b0.js} +1 -1
- package/dist/components/{p-5eeaccab.js → p-dfa70e99.js} +1 -1
- package/dist/components/{p-2bb1f74d.js → p-e4b71ba1.js} +47 -7
- package/dist/components/{p-49ccf573.js → p-f241ab97.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +73 -29
- package/dist/esm/lido-player.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-3995d2d5.js → utils-01d6cbb5.js} +121 -59
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/{p-aee89fba.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/imageMatch/imageMatch.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgraOptionWithAudio/palEgraOptionWithAudio.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgra_arrange_pictures/palEgra_arrange_pictures.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palEgra_build_word/palEgra_build_word.stories.d.ts +4 -0
- package/dist/types/stories/Templates/palStorytale/palStorytale.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-75daccb0.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: ["
|
|
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="
|
|
29
|
-
|
|
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.
|
|
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
|
-
},
|
|
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
|
|
608
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
221
|
-
|
|
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
|
|
231
|
-
|
|
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
|
|
281
|
-
|
|
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
|
|
294
|
-
|
|
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
|
-
|
|
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
|
|
487
|
-
|
|
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
|
});
|
|
@@ -502,16 +481,18 @@ export async function onElementDropComplete(dragElement, dropElement) {
|
|
|
502
481
|
const dragSelectedData = JSON.stringify(buildDragSelectedMapFromDOM());
|
|
503
482
|
const dropSelectedDataobject = buildDragSelectedMapFromDOM();
|
|
504
483
|
const dropSelectedData = JSON.stringify(dropSelectedDataobject);
|
|
505
|
-
console.log("dragggedddd elem", { value: dragElement.getAttribute("value") });
|
|
506
484
|
let dropHasDrag = buildDropHasDragFromDOM();
|
|
507
485
|
if (!dropElement) {
|
|
508
486
|
handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
|
|
509
487
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
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
|
+
}
|
|
515
496
|
}
|
|
516
497
|
const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
|
|
517
498
|
if (isAllowOnlyCorrect) {
|
|
@@ -545,7 +526,6 @@ export async function onElementDropComplete(dragElement, dropElement) {
|
|
|
545
526
|
dragElement.style.transition = 'transform 0.5s ease';
|
|
546
527
|
animateDragToTarget(dragElement, dropElement, container);
|
|
547
528
|
const onInCorrect = dropElement.getAttribute('onInCorrect');
|
|
548
|
-
console.log("onincorrectttt", onInCorrect);
|
|
549
529
|
await executeActions(onInCorrect, dropElement, dragElement);
|
|
550
530
|
setTimeout(() => {
|
|
551
531
|
dragElement.style.transform = 'translate(0, 0)';
|
|
@@ -652,21 +632,13 @@ export async function onElementDropComplete(dragElement, dropElement) {
|
|
|
652
632
|
const storedTabIndexes = Object.keys(dropObject).map(Number);
|
|
653
633
|
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
654
634
|
if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
|
|
655
|
-
if (otherElement
|
|
656
|
-
// otherElement.style.border = ''; // Reset border
|
|
657
|
-
// otherElement.style.backgroundColor = 'transparent'; // Reset background color
|
|
658
|
-
}
|
|
659
|
-
if (otherElement.tagName.toLowerCase() === 'lido-image') {
|
|
635
|
+
if (otherElement) {
|
|
660
636
|
otherElement.style.opacity = '0';
|
|
661
637
|
}
|
|
662
638
|
}
|
|
663
639
|
}
|
|
664
640
|
else {
|
|
665
|
-
if (otherElement
|
|
666
|
-
// otherElement.style.border = ''; // Reset border
|
|
667
|
-
// otherElement.style.backgroundColor = ''; // Reset background color
|
|
668
|
-
}
|
|
669
|
-
if (otherElement.tagName.toLowerCase() === 'lido-image' || 'lido-cell') {
|
|
641
|
+
if (otherElement) {
|
|
670
642
|
otherElement.style.opacity = '1';
|
|
671
643
|
}
|
|
672
644
|
}
|
|
@@ -742,6 +714,7 @@ export function updateDropBorder(element) {
|
|
|
742
714
|
if (dragSelectedElements.length > 0) {
|
|
743
715
|
element.classList.add('filled');
|
|
744
716
|
element.classList.remove('empty');
|
|
717
|
+
element.classList.remove('highlight-element');
|
|
745
718
|
}
|
|
746
719
|
else {
|
|
747
720
|
if (!element.classList.contains('math-matrix')) {
|
|
@@ -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'))
|
|
@@ -120,7 +120,7 @@ export function highlightElement() {
|
|
|
120
120
|
}
|
|
121
121
|
// Highlight corresponding drag elements if mistakes are more than 2
|
|
122
122
|
const dragElements = container.querySelectorAll(`[type="drag"]`);
|
|
123
|
-
if (countOfMistakes > 2) {
|
|
123
|
+
if (countOfMistakes > 2 && container.getAttribute("is-continue-on-correct") === "true") {
|
|
124
124
|
dragElements.forEach(dragEl => {
|
|
125
125
|
dragEl.classList.remove('highlight-element');
|
|
126
126
|
if (dragEl.getAttribute('value') === dropEle.getAttribute('value')) {
|
|
@@ -137,7 +137,7 @@ export function highlightElement() {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
else {
|
|
140
|
-
if (countOfMistakes <= 2)
|
|
140
|
+
if (countOfMistakes <= 2 || container.getAttribute("is-continue-on-correct") === "false")
|
|
141
141
|
return;
|
|
142
142
|
const clickTemplate = container.querySelectorAll("[type='click']");
|
|
143
143
|
clickTemplate.forEach(clickEl => {
|
|
@@ -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
|
|
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 =
|
|
57
|
-
const rightVal =
|
|
55
|
+
const leftVal = balanceEl.leftVal;
|
|
56
|
+
const rightVal = balanceEl.rightVal;
|
|
58
57
|
const hasLeft = !isNaN(leftVal);
|
|
59
58
|
const hasRight = !isNaN(rightVal);
|
|
60
|
-
if (
|
|
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
|
+
}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { f as format, g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-
|
|
1
|
+
export { f as format, g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-40afd35f.js';
|