lido-player 0.0.2-alpha-75 → 0.0.2-alpha-77
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-DeCNGGv1.js → index-BzToe3fj.js} +144 -111
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +50 -35
- package/dist/collection/components/calculator/lido-calculator.js +2 -2
- package/dist/collection/components/canvas/lido-canvas.css +2 -1
- package/dist/collection/components/canvas/lido-canvas.js +4 -4
- package/dist/collection/components/keyboard/lido-keyboard.js +43 -28
- package/dist/collection/stories/Templates/Tag/tagGame.stories.js +16 -6
- package/dist/collection/stories/Templates/arrangeLetters/arrangeLetters.stories.js +5 -3
- package/dist/collection/stories/Templates/bubbleType/bubbleType.stories.js +1 -1
- package/dist/collection/stories/Templates/calculator/calculator.stories.js +7 -3
- package/dist/collection/utils/customEvents.js +4 -5
- package/dist/collection/utils/utils.js +28 -12
- package/dist/collection/utils/utilsHandlers/clickHandler.js +2 -1
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +46 -20
- package/dist/collection/utils/utilsHandlers/floatHandler.js +2 -0
- package/dist/collection/utils/utilsHandlers/slideHandler.js +3 -2
- package/dist/collection/utils/utilsHandlers/sortHandler.js +4 -6
- package/dist/collection/utils/utilsHandlers/timer.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-canvas.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-root.js +1 -1
- package/dist/components/p-BjoUTnNL.js +1 -0
- package/dist/components/p-DSkkWl5m.js +1 -0
- package/dist/components/{p-BG6u4Q7r.js → p-Dcl0piAw.js} +1 -1
- package/dist/components/p-DfHouhaY.js +1 -0
- package/dist/esm/{index-sENBGO-5.js → index-BJX71XlO.js} +144 -111
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +50 -35
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-2154e489.entry.js +1 -0
- package/dist/lido-player/p-CyN4EavN.js +1 -0
- package/dist/types/components/keyboard/lido-keyboard.d.ts +2 -2
- package/dist/types/utils/customEvents.d.ts +2 -2
- package/dist/types/utils/utilsHandlers/timer.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-DMdTR2aP.js +0 -1
- package/dist/components/p-DV0uOy6-.js +0 -1
- package/dist/components/p-xluptNe4.js +0 -1
- package/dist/lido-player/p-DrASbtDm.js +0 -1
- package/dist/lido-player/p-ae318367.entry.js +0 -1
|
@@ -108,70 +108,16 @@ const LANGUAGE_PROFILES = {
|
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
class Timer {
|
|
112
|
-
constructor() {
|
|
113
|
-
this.startTime = 0;
|
|
114
|
-
this.elapsedTime = 0;
|
|
115
|
-
this.intervalId = null;
|
|
116
|
-
}
|
|
117
|
-
static getI(onTick) {
|
|
118
|
-
if (!Timer.instance) {
|
|
119
|
-
Timer.instance = new Timer();
|
|
120
|
-
}
|
|
121
|
-
if (onTick) {
|
|
122
|
-
Timer.instance.onTick = onTick;
|
|
123
|
-
}
|
|
124
|
-
return Timer.instance;
|
|
125
|
-
}
|
|
126
|
-
start() {
|
|
127
|
-
if (this.intervalId)
|
|
128
|
-
return;
|
|
129
|
-
this.startTime = Date.now() - this.elapsedTime;
|
|
130
|
-
this.intervalId = window.setInterval(() => {
|
|
131
|
-
var _a;
|
|
132
|
-
this.elapsedTime = Date.now() - this.startTime;
|
|
133
|
-
(_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, this.elapsedTime);
|
|
134
|
-
}, 1000);
|
|
135
|
-
}
|
|
136
|
-
pause() {
|
|
137
|
-
if (!this.intervalId)
|
|
138
|
-
return;
|
|
139
|
-
clearInterval(this.intervalId);
|
|
140
|
-
this.intervalId = null;
|
|
141
|
-
this.elapsedTime = Date.now() - this.startTime;
|
|
142
|
-
}
|
|
143
|
-
resume() {
|
|
144
|
-
if (this.intervalId)
|
|
145
|
-
return;
|
|
146
|
-
this.start();
|
|
147
|
-
}
|
|
148
|
-
stop() {
|
|
149
|
-
var _a;
|
|
150
|
-
if (this.intervalId) {
|
|
151
|
-
clearInterval(this.intervalId);
|
|
152
|
-
this.intervalId = null;
|
|
153
|
-
}
|
|
154
|
-
this.startTime = 0;
|
|
155
|
-
this.elapsedTime = 0;
|
|
156
|
-
(_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, 0);
|
|
157
|
-
}
|
|
158
|
-
getElapsed() {
|
|
159
|
-
return this.intervalId
|
|
160
|
-
? Date.now() - this.startTime
|
|
161
|
-
: this.elapsedTime;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
111
|
function dispatchCustomEvent(eventName, detail) {
|
|
166
112
|
console.log("👍Event Name : ", eventName, "Detail : ", detail.toString());
|
|
167
113
|
const event = new CustomEvent(eventName, { detail });
|
|
168
114
|
window.dispatchEvent(event);
|
|
169
115
|
}
|
|
170
|
-
function dispatchActivityEndEvent(totalIndex, currentIndex, score, rightMoves, wrongMoves) {
|
|
171
|
-
dispatchCustomEvent(ActivityEndKey, { currentIndex, totalIndex, score, rightMoves, wrongMoves });
|
|
116
|
+
function dispatchActivityEndEvent(totalIndex, currentIndex, score, rightMoves, wrongMoves, timeSpentForActivity) {
|
|
117
|
+
dispatchCustomEvent(ActivityEndKey, { currentIndex, totalIndex, score, rightMoves, wrongMoves, timeSpentForActivity });
|
|
172
118
|
}
|
|
173
|
-
function dispatchLessonEndEvent(totalIndex, rightMoves, wrongMoves, finalScore) {
|
|
174
|
-
dispatchCustomEvent(LessonEndKey, { totalIndex, rightMoves, wrongMoves, finalScore,
|
|
119
|
+
function dispatchLessonEndEvent(totalIndex, rightMoves, wrongMoves, finalScore, timeSpendForLesson) {
|
|
120
|
+
dispatchCustomEvent(LessonEndKey, { totalIndex, rightMoves, wrongMoves, finalScore, timeSpendForLesson });
|
|
175
121
|
}
|
|
176
122
|
function dispatchNextContainerEvent() {
|
|
177
123
|
dispatchCustomEvent(NextContainerKey, {});
|
|
@@ -392,7 +338,8 @@ function enableDraggingWithScaling(element) {
|
|
|
392
338
|
console.error(`Container with ID "container" not found.`);
|
|
393
339
|
return;
|
|
394
340
|
}
|
|
395
|
-
|
|
341
|
+
if (container.getAttribute("canplay") === "false")
|
|
342
|
+
return;
|
|
396
343
|
handlingElementFlexibleWidth(element, 'drag');
|
|
397
344
|
const onStart = (event) => {
|
|
398
345
|
var _a, _b;
|
|
@@ -567,7 +514,7 @@ function enableDraggingWithScaling(element) {
|
|
|
567
514
|
};
|
|
568
515
|
let lastOverlappedElement = null;
|
|
569
516
|
const onEnd = (endEv) => {
|
|
570
|
-
var _a, _b;
|
|
517
|
+
var _a, _b, _c;
|
|
571
518
|
isDragging = false;
|
|
572
519
|
if (isClicked) {
|
|
573
520
|
if (clone) {
|
|
@@ -604,12 +551,18 @@ function enableDraggingWithScaling(element) {
|
|
|
604
551
|
// Check for overlaps and log the most overlapping element
|
|
605
552
|
let mostOverlappedElement = findMostoverlappedElement$1(element, 'drop');
|
|
606
553
|
if (!mostOverlappedElement) {
|
|
607
|
-
|
|
554
|
+
// build current selection/drop maps so reset logic can update counts correctly
|
|
555
|
+
const selectedValueData = (_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : "[]";
|
|
556
|
+
const dragSelectedData = JSON.stringify(buildDragSelectedMapFromDOM());
|
|
557
|
+
const dropSelectedDataObject = buildDragSelectedMapFromDOM();
|
|
558
|
+
JSON.stringify(dropSelectedDataObject);
|
|
559
|
+
const dropHasDrag = buildDropHasDragFromDOM();
|
|
560
|
+
handleResetDragElement(element, null, dropHasDrag, selectedValueData, dragSelectedData);
|
|
608
561
|
return;
|
|
609
562
|
}
|
|
610
563
|
onElementDropComplete(element, mostOverlappedElement);
|
|
611
564
|
executeActions("this.updateCountBlender='true'", container);
|
|
612
|
-
if (((
|
|
565
|
+
if (((_b = element.getAttribute('dropAttr')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === DropMode.Diagonal) {
|
|
613
566
|
if (mostOverlappedElement) {
|
|
614
567
|
if (element) {
|
|
615
568
|
element.classList.add('diagonal-drop');
|
|
@@ -634,7 +587,7 @@ function enableDraggingWithScaling(element) {
|
|
|
634
587
|
// const computedStyle = window.getComputedStyle(element);
|
|
635
588
|
// mostOverlappedElement.style.width = computedStyle.width;
|
|
636
589
|
// }
|
|
637
|
-
if (((
|
|
590
|
+
if (((_c = element.getAttribute('dropAttr')) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === DropMode.InfiniteDrop) {
|
|
638
591
|
if (mostOverlappedElement) {
|
|
639
592
|
mostOverlappedElement.style.opacity = '0';
|
|
640
593
|
}
|
|
@@ -757,9 +710,10 @@ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, sel
|
|
|
757
710
|
dragToDropMap.delete(dragElement);
|
|
758
711
|
}
|
|
759
712
|
if (selectedValueData) {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
713
|
+
// Instead of filtering stale selectedValueData, rebuild selected values from DOM
|
|
714
|
+
const rebuiltMap = buildDragSelectedMapFromDOM();
|
|
715
|
+
const sortedValues = getSortedValuesArrayFromMap(rebuiltMap);
|
|
716
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(sortedValues));
|
|
763
717
|
}
|
|
764
718
|
if (dragSelectedData) {
|
|
765
719
|
let dragSelected = JSON.parse(dragSelectedData);
|
|
@@ -770,6 +724,10 @@ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, sel
|
|
|
770
724
|
// container.setAttribute(DragSelectedMapKey, JSON.stringify(dragSelected));
|
|
771
725
|
dragElement.removeAttribute(DropToAttr);
|
|
772
726
|
updateDropBorder(currentDrop);
|
|
727
|
+
// rebuild counts & balance after removing mapping
|
|
728
|
+
const rebuiltMap2 = buildDragSelectedMapFromDOM();
|
|
729
|
+
const sortedValues2 = getSortedValuesArrayFromMap(rebuiltMap2);
|
|
730
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(sortedValues2));
|
|
773
731
|
updateBalanceOnDrop();
|
|
774
732
|
}
|
|
775
733
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
@@ -791,9 +749,7 @@ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, sel
|
|
|
791
749
|
}
|
|
792
750
|
});
|
|
793
751
|
// Update counts when a drag is reset/removed from a drop
|
|
794
|
-
|
|
795
|
-
await executeActions("this.updateCountBlender='true'", container);
|
|
796
|
-
}
|
|
752
|
+
await executeActions("this.updateCountBlender='true'", container);
|
|
797
753
|
handleShowCheck();
|
|
798
754
|
highlightElement();
|
|
799
755
|
}
|
|
@@ -842,13 +798,19 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
842
798
|
}
|
|
843
799
|
else {
|
|
844
800
|
//strings
|
|
845
|
-
|
|
801
|
+
if (dropValue.includes(',')) {
|
|
802
|
+
isCorrect = dropValue.toLowerCase().includes(dragValue.toLowerCase());
|
|
803
|
+
}
|
|
804
|
+
else {
|
|
805
|
+
isCorrect = dropValue.toLowerCase() === dragValue.toLowerCase();
|
|
806
|
+
}
|
|
846
807
|
}
|
|
847
808
|
if (!isCorrect) {
|
|
848
809
|
dragElement.style.transition = 'transform 0.5s ease';
|
|
849
810
|
animateDragToTarget(dragElement, dropElement, container);
|
|
850
811
|
const onInCorrect = dropElement.getAttribute('onInCorrect');
|
|
851
812
|
await executeActions(onInCorrect, dropElement, dragElement);
|
|
813
|
+
storingEachActivityScore(false);
|
|
852
814
|
setTimeout(() => {
|
|
853
815
|
dragElement.style.transform = 'translate(0, 0)';
|
|
854
816
|
// storingEachActivityScore(false);
|
|
@@ -1062,9 +1024,9 @@ function handleDropElement(element) {
|
|
|
1062
1024
|
updateDropBorder(element);
|
|
1063
1025
|
}
|
|
1064
1026
|
async function onClickDropOrDragElement(element, type) {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1027
|
+
const container = document.getElementById(LidoContainer);
|
|
1028
|
+
if (container.getAttribute('canplay') === 'false')
|
|
1029
|
+
return;
|
|
1068
1030
|
// Remove the highlight class from elements matching the selector
|
|
1069
1031
|
const highlightedElements = document.querySelectorAll(`[type='${type}']`);
|
|
1070
1032
|
highlightedElements.forEach(el => {
|
|
@@ -1144,6 +1106,7 @@ async function onClickDragElement(element) {
|
|
|
1144
1106
|
return;
|
|
1145
1107
|
}
|
|
1146
1108
|
let firstFalse = Object.values(dropElements).find(item => !item.isFull);
|
|
1109
|
+
console.log('🚀 ~ onClickDragElement ~ firstFalse:', firstFalse);
|
|
1147
1110
|
if (firstFalse) {
|
|
1148
1111
|
const dropEl = document.querySelector(`#${firstFalse.drop}`);
|
|
1149
1112
|
dragEl.style.transition = 'transform 0.5s ease';
|
|
@@ -1157,26 +1120,35 @@ const appendingDragElementsInDrop = () => {
|
|
|
1157
1120
|
const dropItems = document.querySelectorAll("[type='drop']");
|
|
1158
1121
|
if (!dragItems || !dropItems)
|
|
1159
1122
|
return;
|
|
1123
|
+
const container = document.getElementById(LidoContainer);
|
|
1124
|
+
const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
|
|
1125
|
+
const appendedDragIds = new Set();
|
|
1160
1126
|
dropItems.forEach(dropElement => {
|
|
1161
|
-
dragItems.
|
|
1127
|
+
for (let i = 0; i < dragItems.length; i++) {
|
|
1128
|
+
const dragElement = dragItems[i];
|
|
1129
|
+
// Skip if already appended to another drop element
|
|
1130
|
+
if (appendedDragIds.has(dragElement.id))
|
|
1131
|
+
continue;
|
|
1162
1132
|
const drag = dragElement;
|
|
1163
1133
|
const drop = dropElement;
|
|
1164
|
-
const container = document.getElementById(LidoContainer);
|
|
1165
|
-
const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
|
|
1166
1134
|
if (isAllowOnlyCorrect === true) {
|
|
1167
1135
|
if (drop['value'] === drag['value']) {
|
|
1168
1136
|
drag.style.transform = 'translate(0,0)';
|
|
1169
1137
|
drop.appendChild(drag);
|
|
1138
|
+
appendedDragIds.add(drag.id);
|
|
1139
|
+
drag.style.pointerEvents = 'none';
|
|
1140
|
+
break;
|
|
1170
1141
|
}
|
|
1171
1142
|
}
|
|
1172
1143
|
else {
|
|
1173
1144
|
if (drop['value'].includes(drag['value'])) {
|
|
1174
1145
|
drag.style.transform = 'translate(0,0)';
|
|
1175
1146
|
drop.appendChild(drag);
|
|
1147
|
+
appendedDragIds.add(drag.id);
|
|
1148
|
+
drag.style.pointerEvents = 'none';
|
|
1176
1149
|
}
|
|
1177
1150
|
}
|
|
1178
|
-
|
|
1179
|
-
});
|
|
1151
|
+
}
|
|
1180
1152
|
});
|
|
1181
1153
|
};
|
|
1182
1154
|
const container = document.getElementById(LidoContainer);
|
|
@@ -1697,9 +1669,8 @@ function enableReorderDrag(element) {
|
|
|
1697
1669
|
let startX = 0;
|
|
1698
1670
|
let startY = 0;
|
|
1699
1671
|
const container = document.getElementById(LidoContainer);
|
|
1700
|
-
if (!container)
|
|
1672
|
+
if (!container || container.getAttribute("canplay") === "false")
|
|
1701
1673
|
return;
|
|
1702
|
-
// if(!container || container.getAttribute("canplay") === "false") return;
|
|
1703
1674
|
Array.from(element.children).forEach(child => {
|
|
1704
1675
|
child.style.pointerEvents = 'none';
|
|
1705
1676
|
});
|
|
@@ -1885,7 +1856,8 @@ function enableReorderDrag(element) {
|
|
|
1885
1856
|
};
|
|
1886
1857
|
const onClickElement = (element) => {
|
|
1887
1858
|
const container = document.getElementById(LidoContainer);
|
|
1888
|
-
|
|
1859
|
+
if (container.getAttribute('canplay') === 'false')
|
|
1860
|
+
return;
|
|
1889
1861
|
if (elementType === 'option') {
|
|
1890
1862
|
const categoryArr = container.querySelectorAll('[type="category"]');
|
|
1891
1863
|
let category = Array.from(categoryArr).find(el => el.parentElement.className.includes('highlight-element'));
|
|
@@ -1958,9 +1930,7 @@ function enableReorderDrag(element) {
|
|
|
1958
1930
|
};
|
|
1959
1931
|
element.style.cursor = 'move';
|
|
1960
1932
|
element.classList.add('drag-element');
|
|
1961
|
-
|
|
1962
|
-
element.addEventListener('mousedown', onStart);
|
|
1963
|
-
element.addEventListener('touchstart', onStart, { passive: false });
|
|
1933
|
+
element.addEventListener('pointerdown', onStart);
|
|
1964
1934
|
}
|
|
1965
1935
|
const resetElementStyles = (el) => {
|
|
1966
1936
|
el.style.opacity = '';
|
|
@@ -2160,7 +2130,9 @@ function slidingWithScaling(element) {
|
|
|
2160
2130
|
console.error(`Parent element not found.`);
|
|
2161
2131
|
return;
|
|
2162
2132
|
}
|
|
2163
|
-
document.getElementById(LidoContainer);
|
|
2133
|
+
const container = document.getElementById(LidoContainer);
|
|
2134
|
+
if (container.getAttribute('canplay') === 'false')
|
|
2135
|
+
return;
|
|
2164
2136
|
const onStart = (event) => {
|
|
2165
2137
|
removeHighlight(element);
|
|
2166
2138
|
isDragging = true;
|
|
@@ -2333,24 +2305,12 @@ const slideCompleted = (slideElement) => {
|
|
|
2333
2305
|
const isCorrect = matchStringPattern(slideElement['value'], [objectiveArray[elementIndex].trim()]);
|
|
2334
2306
|
if (container.getAttribute('is-continue-on-correct') === 'true') {
|
|
2335
2307
|
storingEachActivityScore(true);
|
|
2336
|
-
validationForSlideHandler();
|
|
2308
|
+
// validationForSlideHandler();
|
|
2337
2309
|
}
|
|
2338
2310
|
else {
|
|
2339
2311
|
storingEachActivityScore(isCorrect);
|
|
2340
2312
|
}
|
|
2341
2313
|
};
|
|
2342
|
-
const validationForSlideHandler = async () => {
|
|
2343
|
-
var _a, _b;
|
|
2344
|
-
const container = document.getElementById(LidoContainer);
|
|
2345
|
-
if (!container)
|
|
2346
|
-
return;
|
|
2347
|
-
const objectiveArray = (_b = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]')) !== null && _b !== void 0 ? _b : [];
|
|
2348
|
-
const objectiveString = document.getElementById(LidoContainer)['objective'];
|
|
2349
|
-
const res = matchStringPattern(objectiveString, objectiveArray);
|
|
2350
|
-
if (res) {
|
|
2351
|
-
await executeActions(container.getAttribute('onCorrect'), container);
|
|
2352
|
-
}
|
|
2353
|
-
};
|
|
2354
2314
|
|
|
2355
2315
|
// This file is autogenerated. It's used to publish ESM to npm.
|
|
2356
2316
|
function _typeof$1(obj) {
|
|
@@ -3584,7 +3544,8 @@ function onTouchListenerForOnTouch(element) {
|
|
|
3584
3544
|
function addClickListenerForClickType(element) {
|
|
3585
3545
|
handlingElementFlexibleWidth(element, 'click');
|
|
3586
3546
|
const container = document.getElementById(LidoContainer);
|
|
3587
|
-
|
|
3547
|
+
if (container.getAttribute('canplay') === 'false')
|
|
3548
|
+
return;
|
|
3588
3549
|
element.style.cursor = 'pointer';
|
|
3589
3550
|
if (!element) {
|
|
3590
3551
|
console.error('No element provided.');
|
|
@@ -71538,6 +71499,8 @@ function handleFloatElementPosition(element) {
|
|
|
71538
71499
|
element.style.position = 'absolute';
|
|
71539
71500
|
if (direction === 'leftToRight') {
|
|
71540
71501
|
const containerHeight = floatContainer.offsetHeight;
|
|
71502
|
+
// Add class for bubble elements to identify them later for input matching and scoring
|
|
71503
|
+
element.classList.add("bubble-element");
|
|
71541
71504
|
element.style.left = 'unset';
|
|
71542
71505
|
element.style.right = `${window.innerWidth + document.body.getBoundingClientRect().width}px`;
|
|
71543
71506
|
// element.style.top = isFirstEntry ? `${entryValue}%` : `${Math.floor(Math.random() * (containerHeight - element.clientHeight))}px`;
|
|
@@ -71992,6 +71955,61 @@ function generateDoubleSquares(count = 16) {
|
|
|
71992
71955
|
return pairs;
|
|
71993
71956
|
}
|
|
71994
71957
|
|
|
71958
|
+
class Timer {
|
|
71959
|
+
constructor() {
|
|
71960
|
+
this.startTime = 0;
|
|
71961
|
+
this.elapsedTime = 0;
|
|
71962
|
+
this.intervalId = null;
|
|
71963
|
+
}
|
|
71964
|
+
static getI(onTick) {
|
|
71965
|
+
if (!Timer.instance) {
|
|
71966
|
+
Timer.instance = new Timer();
|
|
71967
|
+
}
|
|
71968
|
+
if (onTick) {
|
|
71969
|
+
Timer.instance.onTick = onTick;
|
|
71970
|
+
}
|
|
71971
|
+
return Timer.instance;
|
|
71972
|
+
}
|
|
71973
|
+
start() {
|
|
71974
|
+
if (this.intervalId)
|
|
71975
|
+
return;
|
|
71976
|
+
this.startTime = Date.now() - this.elapsedTime;
|
|
71977
|
+
this.intervalId = window.setInterval(() => {
|
|
71978
|
+
var _a;
|
|
71979
|
+
this.elapsedTime = Date.now() - this.startTime;
|
|
71980
|
+
(_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, this.elapsedTime);
|
|
71981
|
+
}, 1000);
|
|
71982
|
+
}
|
|
71983
|
+
pause() {
|
|
71984
|
+
if (!this.intervalId)
|
|
71985
|
+
return;
|
|
71986
|
+
clearInterval(this.intervalId);
|
|
71987
|
+
this.intervalId = null;
|
|
71988
|
+
this.elapsedTime = Date.now() - this.startTime;
|
|
71989
|
+
}
|
|
71990
|
+
resume() {
|
|
71991
|
+
if (this.intervalId)
|
|
71992
|
+
return;
|
|
71993
|
+
this.start();
|
|
71994
|
+
}
|
|
71995
|
+
stop() {
|
|
71996
|
+
var _a;
|
|
71997
|
+
if (this.intervalId) {
|
|
71998
|
+
clearInterval(this.intervalId);
|
|
71999
|
+
this.intervalId = null;
|
|
72000
|
+
}
|
|
72001
|
+
this.startTime = 0;
|
|
72002
|
+
this.elapsedTime = 0;
|
|
72003
|
+
(_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, 0);
|
|
72004
|
+
}
|
|
72005
|
+
getElapsed() {
|
|
72006
|
+
return this.intervalId
|
|
72007
|
+
? Date.now() - this.startTime
|
|
72008
|
+
: this.elapsedTime;
|
|
72009
|
+
}
|
|
72010
|
+
}
|
|
72011
|
+
let ACTIVYTY_TIME_SPEND_ARRAY = [];
|
|
72012
|
+
|
|
71995
72013
|
const gameScore = new GameScore();
|
|
71996
72014
|
function buildDragSelectedMapFromDOM() {
|
|
71997
72015
|
const map = {};
|
|
@@ -72161,7 +72179,8 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
72161
72179
|
}
|
|
72162
72180
|
case 'nextBtn': {
|
|
72163
72181
|
const container = document.getElementById(LidoContainer);
|
|
72164
|
-
|
|
72182
|
+
if (container.getAttribute('canplay') === 'false')
|
|
72183
|
+
return;
|
|
72165
72184
|
if (container.getAttribute('is-continue-on-correct') !== 'true') {
|
|
72166
72185
|
targetElement.style.pointerEvents = 'none';
|
|
72167
72186
|
AudioPlayer.getI().stop();
|
|
@@ -72620,7 +72639,9 @@ const storeActivityScore = (score) => {
|
|
|
72620
72639
|
activityScore[activityScoreKey] = score;
|
|
72621
72640
|
//send Custom Event to parent
|
|
72622
72641
|
// window.dispatchEvent(new CustomEvent(ActivityEndKey, { detail: { index: index, totalIndex: totalIndex, score: score } }));
|
|
72623
|
-
|
|
72642
|
+
const timeSpendForActivity = Math.floor(Timer.getI().getElapsed() / 1000);
|
|
72643
|
+
ACTIVYTY_TIME_SPEND_ARRAY.push(timeSpendForActivity);
|
|
72644
|
+
dispatchActivityEndEvent(totalIndex, index, score, gameScore.rightMoves, gameScore.wrongMoves, timeSpendForActivity);
|
|
72624
72645
|
localStorage.setItem(ActivityScoreKey, JSON.stringify(activityScore));
|
|
72625
72646
|
if (totalIndex - 1 == index) {
|
|
72626
72647
|
const scoresArray = Object.values(activityScore);
|
|
@@ -72628,7 +72649,8 @@ const storeActivityScore = (score) => {
|
|
|
72628
72649
|
gameScore.finalScore = Math.floor(finalScore);
|
|
72629
72650
|
console.log('Total Score : ', gameScore.finalScore);
|
|
72630
72651
|
// window.dispatchEvent(new CustomEvent(LessonEndKey, { detail: { score: finalScore } }));
|
|
72631
|
-
|
|
72652
|
+
const timeSpendForLesson = ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0);
|
|
72653
|
+
dispatchLessonEndEvent(totalIndex, gameScore.rightMoves, gameScore.wrongMoves, finalScore, timeSpendForLesson);
|
|
72632
72654
|
localStorage.removeItem(ActivityScoreKey);
|
|
72633
72655
|
}
|
|
72634
72656
|
};
|
|
@@ -73199,14 +73221,14 @@ const animateBoxCells = async (element, value) => {
|
|
|
73199
73221
|
await new Promise(resolve => setTimeout(resolve, 600)); // Adjust delay as needed
|
|
73200
73222
|
cell.classList.remove('lido-box-highlight');
|
|
73201
73223
|
}
|
|
73202
|
-
// checkout parent cell first then pick the
|
|
73224
|
+
// checkout parent cell first then pick the second text child inside cell
|
|
73203
73225
|
const parentCell = document.getElementById(LidoContainer);
|
|
73204
73226
|
if (!parentCell)
|
|
73205
73227
|
return;
|
|
73206
|
-
const
|
|
73207
|
-
if (
|
|
73228
|
+
const instructionText = parentCell.children[2];
|
|
73229
|
+
if (instructionText) {
|
|
73208
73230
|
// play the text child inside parent cell
|
|
73209
|
-
await AudioPlayer.getI().play(
|
|
73231
|
+
await AudioPlayer.getI().play(instructionText);
|
|
73210
73232
|
}
|
|
73211
73233
|
// Now select each box cell's text child and play them one by one
|
|
73212
73234
|
for (const box of boxCells) {
|
|
@@ -73247,9 +73269,9 @@ const SumTogetherAnimation = async (element, value) => {
|
|
|
73247
73269
|
if (!value)
|
|
73248
73270
|
return;
|
|
73249
73271
|
// Expecting structure: [_, TopRow, questionRow, optionRow, ...]
|
|
73250
|
-
const TopRow = Array.from(element.children)[
|
|
73251
|
-
const questionRow = Array.from(element.children)[
|
|
73252
|
-
const optionRow = Array.from(element.children)[
|
|
73272
|
+
const TopRow = Array.from(element.children)[3];
|
|
73273
|
+
const questionRow = Array.from(element.children)[4];
|
|
73274
|
+
const optionRow = Array.from(element.children)[5];
|
|
73253
73275
|
if (!TopRow || !questionRow || !optionRow)
|
|
73254
73276
|
return;
|
|
73255
73277
|
const topRowChildren = Array.from(TopRow.children);
|
|
@@ -73356,8 +73378,19 @@ function placeElementInDropZone(dropElement, dragElement, orientation, dropAttr)
|
|
|
73356
73378
|
console.log("🌄 Landscape waterfall");
|
|
73357
73379
|
const shiftX = dropWidth * 0.02; // proportional (5% of width)
|
|
73358
73380
|
const shiftY = dropHeight * 0.02; // proportional (5% of height)
|
|
73359
|
-
|
|
73360
|
-
|
|
73381
|
+
let startX, startY;
|
|
73382
|
+
if (dropElement.id === "unitsDrop") {
|
|
73383
|
+
startX = dropRect.left + dropWidth * 0.15; // 15% from left for better centering of multiple items
|
|
73384
|
+
startY = dropRect.top + dropHeight * -0.1; // slightly above
|
|
73385
|
+
}
|
|
73386
|
+
else if (dropElement.id === "tensDrop") {
|
|
73387
|
+
startX = dropRect.left + dropWidth * 0.40; // 40% from left for better centering of multiple items
|
|
73388
|
+
startY = dropRect.top + dropHeight * -0.1; // slightly above
|
|
73389
|
+
}
|
|
73390
|
+
else {
|
|
73391
|
+
startX = dropRect.left + dropWidth * 0.10; // 10% from left for better centering of multiple items
|
|
73392
|
+
startY = dropRect.top + dropHeight * -0.1; // slightly above
|
|
73393
|
+
}
|
|
73361
73394
|
targetX = startX + (dropCount * shiftX);
|
|
73362
73395
|
targetY = startY + (dropCount * shiftY);
|
|
73363
73396
|
}
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-BrME-8br.js');
|
|
4
|
-
var index$1 = require('./index-
|
|
4
|
+
var index$1 = require('./index-BzToe3fj.js');
|
|
5
5
|
|
|
6
6
|
var rive$1 = {exports: {}};
|
|
7
7
|
|
|
@@ -8580,7 +8580,7 @@ const LidoCalculator = class {
|
|
|
8580
8580
|
return;
|
|
8581
8581
|
if (this.objective && this.objective != '' && !this.objective.includes(',')) {
|
|
8582
8582
|
console.log("hi iscorrect verified");
|
|
8583
|
-
isCorrect = userInput === this.objective;
|
|
8583
|
+
isCorrect = Number(userInput) === Number(this.objective);
|
|
8584
8584
|
}
|
|
8585
8585
|
// --- Multiple Objectives ---
|
|
8586
8586
|
else if (this.objective && this.objective.includes(',')) {
|
|
@@ -8653,7 +8653,7 @@ const LidoCalculator = class {
|
|
|
8653
8653
|
}
|
|
8654
8654
|
render() {
|
|
8655
8655
|
const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
|
|
8656
|
-
return (index.h(index.Host, { key: '
|
|
8656
|
+
return (index.h(index.Host, { key: '29f91af1bedaa8be605cdf82fddf74b5622eff6e', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, index.h("lido-cell", { key: '1ac0f61986e688603db21b2eb1bb52bbcabca1ca', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: '3bdacbcb2ea2f371b11a2ed05eb271e0a75c5e09', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, index.h("img", { key: '5f7bb3c09bccdb21c2bda00ae99234409bad7eda', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: '0891cd4b5929861d264c29684ef260f61e65004b', class: "lido-calculator-displayParent" }, index.h("div", { key: 'ac5861ca1a9ebaee9eb7d729f8d2b88933b733d5', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: 'f80c85a89462fd96630a4bf8a304284e4546fe72', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
|
|
8657
8657
|
'lido-calculator-btn-special': num === '←' || num === 'OK',
|
|
8658
8658
|
'lido-calculator-btn-default': num !== '←' && num !== 'OK'
|
|
8659
8659
|
}, onClick: () => this.handleClick(num) }))))));
|
|
@@ -8662,7 +8662,7 @@ const LidoCalculator = class {
|
|
|
8662
8662
|
};
|
|
8663
8663
|
LidoCalculator.style = lidoCalculatorCss();
|
|
8664
8664
|
|
|
8665
|
-
const lidoCanvasCss = () => `:host{display:flex;justify-content:center;align-items:center}.lido-canvas{background:red;border:2px solid #ccc;border-radius:8px;display:flex;flex-direction:column;overflow:hidden;position:relative}#lido-exit-button{padding:6px 14px;border:none;background:transparent;color:#fff;border-radius:6px;cursor:pointer;font-size:14px;position:relative;top:-43%;left:18%;z-index:
|
|
8665
|
+
const lidoCanvasCss = () => `:host{display:flex;justify-content:center;align-items:center}.lido-canvas{background:red;border:2px solid #ccc;border-radius:8px;display:flex;flex-direction:column;overflow:hidden;position:relative}#lido-exit-button{padding:6px 14px;border:none;background:transparent;color:#fff;border-radius:6px;cursor:pointer;font-size:14px;position:relative;top:-43%;left:18%;z-index:15}canvas{touch-action:none;display:block;z-index:10}`;
|
|
8666
8666
|
|
|
8667
8667
|
const LidoCanvas = class {
|
|
8668
8668
|
constructor(hostRef) {
|
|
@@ -8697,7 +8697,7 @@ const LidoCanvas = class {
|
|
|
8697
8697
|
this.ctx.lineWidth = 10;
|
|
8698
8698
|
this.ctx.lineCap = 'round';
|
|
8699
8699
|
this.ctx.lineJoin = 'round';
|
|
8700
|
-
this.loadBackground();
|
|
8700
|
+
// this.loadBackground();
|
|
8701
8701
|
}
|
|
8702
8702
|
}
|
|
8703
8703
|
componentDidLoad() {
|
|
@@ -8708,7 +8708,7 @@ const LidoCanvas = class {
|
|
|
8708
8708
|
this.ctx.lineCap = 'round';
|
|
8709
8709
|
this.ctx.lineJoin = 'round';
|
|
8710
8710
|
this.updateStyles();
|
|
8711
|
-
this.loadBackground();
|
|
8711
|
+
// this.loadBackground();
|
|
8712
8712
|
this.canvas.addEventListener('pointerdown', e => this.start(e));
|
|
8713
8713
|
this.canvas.addEventListener('pointermove', e => this.move(e));
|
|
8714
8714
|
window.addEventListener('pointerup', () => this.stop());
|
|
@@ -8752,10 +8752,10 @@ const LidoCanvas = class {
|
|
|
8752
8752
|
this.ctx.closePath();
|
|
8753
8753
|
}
|
|
8754
8754
|
clearCanvas() {
|
|
8755
|
-
this.
|
|
8755
|
+
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
8756
8756
|
}
|
|
8757
8757
|
render() {
|
|
8758
|
-
return (index.h(index.Host, { key: '
|
|
8758
|
+
return (index.h(index.Host, { key: '6bf53fed345682fdfd21cc466703cce3964526a0', id: "lido-canvas", class: "lido-canvas", style: this.style }, index.h("button", { key: '75b307dab33a24f27bf10605e1b0138b5eecfa40', id: "lido-exit-button", onClick: () => this.clearCanvas() }, index.h("lido-text", { key: '2f636e7e049cb5a9e87106487b54b7b0aacb03c4', visible: "true", height: "92px", width: "43px", id: "lido-exit-icon", "font-color": "white", onEntry: "this.font-weight='900';", "font-size": "96px", string: 'X' })), index.h("canvas", { key: '74bc43e76913256f1c7bc5334e5148c512741a9f', id: "lido-canvas", style: { width: this.style.width, height: this.style.height, } })));
|
|
8759
8759
|
}
|
|
8760
8760
|
get el() { return index.getElement(this); }
|
|
8761
8761
|
};
|
|
@@ -16186,8 +16186,8 @@ const LidoKeyboard = class {
|
|
|
16186
16186
|
/** Number of columns in the keyboard layout (default: "10") */
|
|
16187
16187
|
this.columns = '10';
|
|
16188
16188
|
/**
|
|
16189
|
-
|
|
16190
|
-
|
|
16189
|
+
* When set to true, disables the speak functionality of long press for this component and its children.
|
|
16190
|
+
*/
|
|
16191
16191
|
this.disableSpeak = false;
|
|
16192
16192
|
/** Tracks the number of keys clicked by the user */
|
|
16193
16193
|
this.numberOfClick = 0;
|
|
@@ -16199,38 +16199,53 @@ const LidoKeyboard = class {
|
|
|
16199
16199
|
async inputValidation(e) {
|
|
16200
16200
|
if (this.type !== 'click')
|
|
16201
16201
|
return;
|
|
16202
|
-
let
|
|
16203
|
-
selcetedValue = this.inputString;
|
|
16204
|
-
localStorage.setItem(index$1.SelectedValuesKey, JSON.stringify(selcetedValue));
|
|
16202
|
+
let isOverlapping = false;
|
|
16205
16203
|
const container = document.getElementById(index$1.LidoContainer);
|
|
16206
|
-
const
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16211
|
-
|
|
16204
|
+
const clickedValue = e.target.getAttribute('value');
|
|
16205
|
+
if (!clickedValue)
|
|
16206
|
+
return;
|
|
16207
|
+
let selectedValue = JSON.parse(localStorage.getItem(index$1.SelectedValuesKey)) || '';
|
|
16208
|
+
localStorage.setItem(index$1.SelectedValuesKey, JSON.stringify(selectedValue));
|
|
16209
|
+
// Get all word bubbles (make sure bubbles have class "bubble-element")
|
|
16210
|
+
const bubbles = Array.from(container.querySelectorAll('.bubble-element'));
|
|
16211
|
+
// Find a bubble whose word starts with current progress + clicked letter
|
|
16212
|
+
const matchedBubble = bubbles.find(bubble => {
|
|
16213
|
+
const word = bubble.getAttribute('value'); // full word like "one"
|
|
16214
|
+
const element = word === null || word === void 0 ? void 0 : word.startsWith(this.inputString.toLowerCase());
|
|
16215
|
+
return element;
|
|
16216
|
+
});
|
|
16217
|
+
if (matchedBubble) {
|
|
16212
16218
|
const bodyRect = document.body.getBoundingClientRect();
|
|
16213
|
-
const elemRect =
|
|
16219
|
+
const elemRect = matchedBubble.getBoundingClientRect();
|
|
16220
|
+
// Ciheck if the matched bubble is overlapping with the target area (you can define the target area as needed, here we use the entire viewport)
|
|
16214
16221
|
isOverlapping = elemRect.left < bodyRect.right && elemRect.right > bodyRect.left && elemRect.top < bodyRect.bottom && elemRect.bottom > bodyRect.top;
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
filteredElement.style.animation = 'none';
|
|
16218
|
-
this.numberOfClick++;
|
|
16219
|
-
if (this.numberOfClick === this.letterLength) {
|
|
16220
|
-
const onCorrrect = container.getAttribute('onCorrect');
|
|
16221
|
-
container.style.pointerEvents = 'none';
|
|
16222
|
-
await index$1.executeActions(onCorrrect, this.el);
|
|
16223
|
-
index$1.triggerNextContainer();
|
|
16224
|
-
}
|
|
16225
|
-
else {
|
|
16226
|
-
index$1.handleFloatElementPosition(filteredElement);
|
|
16222
|
+
// If full word completed
|
|
16223
|
+
if (this.inputString.toLowerCase() === matchedBubble.getAttribute('value').toLowerCase() && isOverlapping) {
|
|
16227
16224
|
index$1.storingEachActivityScore(true);
|
|
16225
|
+
matchedBubble.style.animation = 'none';
|
|
16226
|
+
matchedBubble.style.pointerEvents = 'none';
|
|
16227
|
+
this.numberOfClick++;
|
|
16228
|
+
setTimeout(() => { this.inputString = ''; }, 1000);
|
|
16229
|
+
localStorage.removeItem(index$1.SelectedValuesKey);
|
|
16230
|
+
if (this.numberOfClick === this.letterLength) {
|
|
16231
|
+
index$1.calculateScore();
|
|
16232
|
+
const onCorrrect = container.getAttribute('onCorrect');
|
|
16233
|
+
container.style.pointerEvents = 'none';
|
|
16234
|
+
await index$1.executeActions(onCorrrect, this.el);
|
|
16235
|
+
index$1.triggerNextContainer();
|
|
16236
|
+
}
|
|
16237
|
+
else {
|
|
16238
|
+
index$1.handleFloatElementPosition(matchedBubble);
|
|
16239
|
+
}
|
|
16228
16240
|
}
|
|
16229
16241
|
}
|
|
16230
16242
|
else {
|
|
16243
|
+
// ❌ Incorrect click
|
|
16244
|
+
index$1.storingEachActivityScore(false);
|
|
16245
|
+
setTimeout(() => { this.inputString = ''; }, 1000);
|
|
16246
|
+
localStorage.removeItem(index$1.SelectedValuesKey);
|
|
16231
16247
|
const onInCorrrect = container.getAttribute('onInCorrect');
|
|
16232
16248
|
await index$1.executeActions(onInCorrrect, this.el);
|
|
16233
|
-
index$1.storingEachActivityScore(false);
|
|
16234
16249
|
}
|
|
16235
16250
|
}
|
|
16236
16251
|
componentDidLoad() {
|
|
@@ -16281,10 +16296,10 @@ const LidoKeyboard = class {
|
|
|
16281
16296
|
const keysArray = this.keys.split(',').map(k => k.trim());
|
|
16282
16297
|
const container = document.getElementById(index$1.LidoContainer);
|
|
16283
16298
|
const showCheck = container.getAttribute('show-check') === 'true';
|
|
16284
|
-
return (index.h(index.Host, { key: '
|
|
16299
|
+
return (index.h(index.Host, { key: 'c628b4412414cb77bf6596b302deb91f13626f53', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (index.h("div", { key: '3081daf25caa5ca0390b78567e0f46c8fecd0933', class: "input-area" }, index.h("input", { key: 'a21b93f86abb42afc45811d560400deb58da09fe', type: "text", value: this.inputString, class: "input-area", readonly: true }), index.h("lido-text", { key: '3486ddf43feb30d595a4e854761de41c0f963690', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
|
|
16285
16300
|
this.inputString = this.inputString.slice(0, -1);
|
|
16286
16301
|
this.inputValidation(event);
|
|
16287
|
-
} }), index.h("lido-text", { key: '
|
|
16302
|
+
} }), index.h("lido-text", { key: '3a619b53a9c0a6e511adfbdff3f2e8b89692431b', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (index.h("lido-text", { key: '0a780c4a4669edb5bf7f51190ddb6345a724fd43', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), index.h("div", { key: '49f04eacdfbdc93ffcd3749531b90b4acd655d50', class: "keyboard-wrapper", style: {
|
|
16288
16303
|
display: 'flex',
|
|
16289
16304
|
flexWrap: 'wrap',
|
|
16290
16305
|
justifyContent: 'center',
|