lido-player 0.0.2-alpha-64 → 0.0.2-alpha-65
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 +17 -34
- package/dist/cjs/{utils-becabee2.js → utils-6fbaf604.js} +115 -91
- package/dist/collection/components/calculator/lido-calculator.js +12 -2
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +1 -1
- package/dist/collection/stories/Templates/blender/blender.stories.js +52 -47
- package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +7 -9
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationimageTotext.stories.js +4 -4
- package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +3 -5
- package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +1 -1
- package/dist/collection/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.js +10 -10
- package/dist/collection/stories/Templates/substraction/substractionWithimg.stories.js +4 -4
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithimg.stories.js +1 -1
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.js +1 -1
- package/dist/collection/utils/audioPlayer.js +0 -4
- package/dist/collection/utils/utils.js +22 -16
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +26 -21
- package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +5 -4
- package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +60 -46
- 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 +22 -22
- 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-eba44865.js → p-03e44e4a.js} +1 -1
- package/dist/components/{p-fd181d67.js → p-09a49b19.js} +1 -1
- package/dist/components/{p-5e01d929.js → p-0f72edb4.js} +1 -1
- package/dist/components/{p-86844c0d.js → p-1238f648.js} +1 -1
- package/dist/components/{p-2419ea86.js → p-342bed2e.js} +1 -1
- package/dist/components/{p-ba031294.js → p-4c026d99.js} +1 -1
- package/dist/components/{p-2ca8a79c.js → p-4c870db5.js} +1 -1
- package/dist/components/{p-26d79db2.js → p-50896aee.js} +1 -1
- package/dist/components/{p-e0149bae.js → p-50a2d817.js} +1 -1
- package/dist/components/{p-acd46f02.js → p-56a84433.js} +2 -2
- package/dist/components/{p-5b2e159e.js → p-5aeef0cc.js} +2 -2
- package/dist/components/{p-de8c9990.js → p-6b9fcb83.js} +2 -2
- package/dist/components/{p-6d65a7cd.js → p-80c422c2.js} +1 -1
- package/dist/components/{p-738d415b.js → p-873471c6.js} +115 -91
- package/dist/components/{p-b6f1e3fc.js → p-9f03a14c.js} +1 -1
- package/dist/components/{p-a88e9876.js → p-bb46f8e2.js} +1 -1
- package/dist/components/{p-d5c8eeff.js → p-c682e9ff.js} +15 -5
- package/dist/components/{p-5e2fb7e3.js → p-cf94b10e.js} +1 -1
- package/dist/components/{p-de4045c0.js → p-d0fc464d.js} +1 -1
- package/dist/components/{p-ee672850.js → p-d764f75c.js} +5 -32
- package/dist/components/{p-b4179933.js → p-dc616111.js} +1 -1
- package/dist/components/{p-64ba84fa.js → p-f0a5d487.js} +21 -21
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +17 -34
- package/dist/esm/{utils-fbfd097f.js → utils-db03cb43.js} +115 -91
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/{p-bc5f9140.js → p-5e0def71.js} +2 -2
- package/dist/lido-player/p-6192dda7.entry.js +1 -0
- package/dist/types/stories/Templates/blender/blender.stories.d.ts +1 -1
- package/dist/types/utils/audioPlayer.d.ts +0 -1
- package/dist/types/utils/utilsHandlers/dragDropHandler.d.ts +1 -1
- package/package.json +1 -1
- package/dist/lido-player/p-ded2bd49.entry.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-baff5c15.js');
|
|
6
|
-
const utils = require('./utils-
|
|
6
|
+
const utils = require('./utils-6fbaf604.js');
|
|
7
7
|
|
|
8
8
|
var rive = {exports: {}};
|
|
9
9
|
|
|
@@ -6828,7 +6828,9 @@ const LidoCalculator = class {
|
|
|
6828
6828
|
}
|
|
6829
6829
|
}
|
|
6830
6830
|
this.onOk.emit(isCorrect);
|
|
6831
|
+
const okbtn = document.getElementById("btn-11");
|
|
6831
6832
|
if (isCorrect) {
|
|
6833
|
+
okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
|
|
6832
6834
|
this.displayValue = "";
|
|
6833
6835
|
utils.storingEachActivityScore(isCorrect);
|
|
6834
6836
|
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
@@ -6845,15 +6847,23 @@ const LidoCalculator = class {
|
|
|
6845
6847
|
}
|
|
6846
6848
|
}
|
|
6847
6849
|
else {
|
|
6850
|
+
okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
|
|
6848
6851
|
this.displayValue = "";
|
|
6849
6852
|
utils.storingEachActivityScore(isCorrect);
|
|
6850
6853
|
const onInCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onInCorrect')) || '';
|
|
6851
|
-
|
|
6854
|
+
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
6855
|
+
if (container.getAttribute('is-continue-on-correct') === 'false') {
|
|
6856
|
+
await utils.executeActions(onCorrect, container);
|
|
6857
|
+
}
|
|
6858
|
+
else {
|
|
6859
|
+
await utils.executeActions(onInCorrect, container);
|
|
6860
|
+
}
|
|
6852
6861
|
}
|
|
6862
|
+
okbtn.style.pointerEvents = 'auto'; // Re-enable OK button after processing
|
|
6853
6863
|
}
|
|
6854
6864
|
render() {
|
|
6855
6865
|
const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
|
|
6856
|
-
return (index.h(index.Host, { key: '
|
|
6866
|
+
return (index.h(index.Host, { key: '595c92e80baed8e1709c51302aa427d672b3a9e0', 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: '4a2966a46fd008d66fedeb5f44e0ee2c5e8c083a', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: '35e38f7412be8489b668ba0aab927b7ba3d98f29', 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: '926def912022a30a27f5419d98348beb84fc1a42', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: '41a69c7aa7d1dfbeea19b1a1ef095b97d2c953ba', class: "lido-calculator-displayParent" }, index.h("div", { key: '047dfc84e8b02739a982287f82b1df2b7f552dcd', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: '41cd91f2c9aa40f6adcf6b0318e07e394bc3b38e', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
|
|
6857
6867
|
'lido-calculator-btn-special': num === '←' || num === 'OK',
|
|
6858
6868
|
'lido-calculator-btn-default': num !== '←' && num !== 'OK'
|
|
6859
6869
|
}, onClick: () => this.handleClick(num) }))))));
|
|
@@ -9969,37 +9979,10 @@ const port = {
|
|
|
9969
9979
|
};
|
|
9970
9980
|
|
|
9971
9981
|
const instruction = {
|
|
9972
|
-
dragAndDrop: "
|
|
9973
|
-
mcq: "
|
|
9974
|
-
tracing: "
|
|
9975
|
-
flashcards: "
|
|
9976
|
-
substractionWithImage: "substractionWithImageMaAudio ",
|
|
9977
|
-
substractionWithoutImage: "substractionWithoutImageMaAudio",
|
|
9978
|
-
numberIdentificationWithImage: "numberIdentificationWithImageMaAudio",
|
|
9979
|
-
numberIdentificationWithoutImage: "numberIdentificationWithoutImageMaAudio",
|
|
9980
|
-
wordBuildingWithImage: "wordBuildingWithImageMaAudio",
|
|
9981
|
-
wordBuildingWithoutImage: "wordBuildingWithoutImageMaAudio",
|
|
9982
|
-
pictureClues: "pictureCluesMaAudio",
|
|
9983
|
-
pictureWordMatchMultipleImages: "pictureWordMatchMultipleImagesMaAudio",
|
|
9984
|
-
pictureWordMatchSingleImage: "pictureWordMatchSingleImageMaAudio",
|
|
9985
|
-
sentenceMatch: "sentenceMatchMaAudio",
|
|
9986
|
-
imageMatch: "imageMatchMaAudio",
|
|
9987
|
-
palStoryTale: "palStoryTaleMaAudio",
|
|
9988
|
-
palEgmaPatternMatching: "palEgmaPatternMatchingMaAudio",
|
|
9989
|
-
palEgmaWordProblemDragnDrop: "palEgmaWordProblemDragnDropMaAudio",
|
|
9990
|
-
palEgmaWordProblemClick: "palEgmaWordProblemClickMaAudio",
|
|
9991
|
-
palEgraOddOneOut: "palEgraOddOneOutMaAudio",
|
|
9992
|
-
palEgraArrangePictures: "palEgraArrangePicturesMaAudio",
|
|
9993
|
-
palEgraBuildWord: "palEgraBuildWordMaAudio",
|
|
9994
|
-
palEgraWordFormation: "palEgraWordFormationMaAudio",
|
|
9995
|
-
palInventedSpelling: "palInventedSpellingMaAudio",
|
|
9996
|
-
palLetterIdentification: "palLetterIdentificationMaAudio",
|
|
9997
|
-
palStoryMaking: "palStoryMakingMaAudio",
|
|
9998
|
-
palegmasumtogether: "palegmasumtogetherMaAudio",
|
|
9999
|
-
palegmamultioption: "palegmamultioptionMaAudio",
|
|
10000
|
-
palegraoptionaudio: "palegraoptionaudioMaAudio",
|
|
10001
|
-
palegrawordmatch: "palegrawordmatchMaAudio",
|
|
10002
|
-
palegramcqimages: "palegramcqimagesMaAudio"
|
|
9982
|
+
dragAndDrop: "वस्तू योग्य ठिकाणी ओढून आणि सोडून जुळवा.",
|
|
9983
|
+
mcq: "दिलेल्या पर्यायांमधून योग्य उत्तर निवडा.",
|
|
9984
|
+
tracing: "रेषेचा काळजीपूर्वक मागोवा घेत आकृती काढा.",
|
|
9985
|
+
flashcards: "तुमचे शिक्षण मजबूत करण्यासाठी फ्लॅशकार्ड्स पाहा."
|
|
10003
9986
|
};
|
|
10004
9987
|
const ma = {
|
|
10005
9988
|
instruction: instruction
|
|
@@ -174,7 +174,7 @@ function updateBalanceOnDrop(dragElement, dropElement) {
|
|
|
174
174
|
}
|
|
175
175
|
function calculateValue(elements, operation) {
|
|
176
176
|
if (elements.length === 0)
|
|
177
|
-
return
|
|
177
|
+
return 0;
|
|
178
178
|
if (operation === "count") {
|
|
179
179
|
return elements.length;
|
|
180
180
|
}
|
|
@@ -206,15 +206,18 @@ function calculateValue(elements, operation) {
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
function balanceResult(container, objectiveString) {
|
|
209
|
+
var _a, _b, _c, _d, _e, _f;
|
|
209
210
|
const additionalCheck = container.getAttribute('equationCheck');
|
|
210
211
|
if (!additionalCheck)
|
|
211
212
|
return false;
|
|
212
213
|
const balanceEl = document.querySelector('lido-balance');
|
|
213
214
|
if (!balanceEl)
|
|
214
215
|
return false;
|
|
215
|
-
const leftVal = balanceEl.leftVal;
|
|
216
|
-
const rightVal = balanceEl.rightVal;
|
|
217
|
-
|
|
216
|
+
const leftVal = Number((_c = (_a = balanceEl.leftVal) !== null && _a !== void 0 ? _a : (_b = balanceEl.dataset) === null || _b === void 0 ? void 0 : _b.leftVal) !== null && _c !== void 0 ? _c : 0);
|
|
217
|
+
const rightVal = Number((_f = (_d = balanceEl.rightVal) !== null && _d !== void 0 ? _d : (_e = balanceEl.dataset) === null || _e === void 0 ? void 0 : _e.rightVal) !== null && _f !== void 0 ? _f : 0);
|
|
218
|
+
const hasLeft = !isNaN(leftVal);
|
|
219
|
+
const hasRight = !isNaN(rightVal);
|
|
220
|
+
if (!hasLeft || !hasRight) {
|
|
218
221
|
return false;
|
|
219
222
|
}
|
|
220
223
|
const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
|
|
@@ -533,29 +536,26 @@ function enableDraggingWithScaling(element) {
|
|
|
533
536
|
// Reset overlapping styles from all elements
|
|
534
537
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
535
538
|
allElements.forEach(otherElement => {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
if (
|
|
541
|
-
|
|
542
|
-
if (otherElement) {
|
|
543
|
-
otherElement.style.opacity = "0";
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
otherElement.style.opacity = '1';
|
|
547
|
-
}
|
|
548
|
-
}
|
|
539
|
+
var _a;
|
|
540
|
+
const dropObject = buildDragSelectedMapFromDOM();
|
|
541
|
+
const storedTabIndexes = Object.keys(dropObject).map(Number);
|
|
542
|
+
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
543
|
+
if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
|
|
544
|
+
otherElement.style.opacity = '1';
|
|
549
545
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
if (otherElement) {
|
|
549
|
+
otherElement.style.opacity = '1';
|
|
554
550
|
}
|
|
555
|
-
}
|
|
551
|
+
}
|
|
556
552
|
});
|
|
557
553
|
// Check for overlaps and log the most overlapping element
|
|
558
554
|
let mostOverlappedElement = findMostoverlappedElement$1(element, 'drop');
|
|
555
|
+
if (!mostOverlappedElement) {
|
|
556
|
+
handleResetDragElement(element, null, null, null, null);
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
559
|
onElementDropComplete(element, mostOverlappedElement);
|
|
560
560
|
executeActions("this.updateCountBlender='true'", container);
|
|
561
561
|
if (((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) {
|
|
@@ -651,7 +651,7 @@ function animateDragToTarget(dragElement, targetElement, container, transition =
|
|
|
651
651
|
dragElement.style.transition = 'transform 0.5s ease';
|
|
652
652
|
dragElement.style.transform = `translate(${finalX}px, ${finalY}px)`;
|
|
653
653
|
}
|
|
654
|
-
function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData) {
|
|
654
|
+
async function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData) {
|
|
655
655
|
var _a;
|
|
656
656
|
dragElement.classList.remove('dropped');
|
|
657
657
|
const container = document.getElementById(LidoContainer);
|
|
@@ -729,7 +729,7 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
|
|
|
729
729
|
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
730
730
|
if (!(((_a = otherElement.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
|
|
731
731
|
if (otherElement.tagName.toLowerCase() === 'lido-text') {
|
|
732
|
-
otherElement.style.opacity = "
|
|
732
|
+
otherElement.style.opacity = "1";
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
735
|
}
|
|
@@ -739,6 +739,10 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
|
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
});
|
|
742
|
+
// Update counts when a drag is reset/removed from a drop
|
|
743
|
+
if (container) {
|
|
744
|
+
await executeActions("this.updateCountBlender='true'", container);
|
|
745
|
+
}
|
|
742
746
|
handleShowCheck();
|
|
743
747
|
highlightElement();
|
|
744
748
|
}
|
|
@@ -1060,6 +1064,8 @@ async function onClickDropOrDragElement(element, type) {
|
|
|
1060
1064
|
});
|
|
1061
1065
|
// await new Promise(resolve => setTimeout(resolve, 500));
|
|
1062
1066
|
await onElementDropComplete(selectedDragElement, selectedDropElement);
|
|
1067
|
+
// ensure count update for click-to-drop flow
|
|
1068
|
+
await executeActions("this.updateCountBlender='true'", container);
|
|
1063
1069
|
// await new Promise(resolve => setTimeout(resolve, 500));
|
|
1064
1070
|
// selectedDragElement.style.transform = 'translate(0px, 0px)';
|
|
1065
1071
|
}
|
|
@@ -1087,7 +1093,9 @@ async function onClickDragElement(element) {
|
|
|
1087
1093
|
if (firstFalse) {
|
|
1088
1094
|
const dropEl = document.querySelector(`#${firstFalse.drop}`);
|
|
1089
1095
|
dragEl.style.transition = 'transform 0.5s ease';
|
|
1090
|
-
onElementDropComplete(dragEl, dropEl);
|
|
1096
|
+
await onElementDropComplete(dragEl, dropEl);
|
|
1097
|
+
const container = document.getElementById(LidoContainer);
|
|
1098
|
+
await executeActions("this.updateCountBlender='true'", container);
|
|
1091
1099
|
}
|
|
1092
1100
|
}
|
|
1093
1101
|
const appendingDragElementsInDrop = () => {
|
|
@@ -1245,10 +1253,6 @@ function highlightElement() {
|
|
|
1245
1253
|
}
|
|
1246
1254
|
|
|
1247
1255
|
class AudioPlayer {
|
|
1248
|
-
isSpeakDisabled(element) {
|
|
1249
|
-
const text = element.closest('lido-text');
|
|
1250
|
-
return (text === null || text === void 0 ? void 0 : text.getAttribute('disable-speak')) === 'true';
|
|
1251
|
-
}
|
|
1252
1256
|
constructor() {
|
|
1253
1257
|
this.handleUserClick = () => {
|
|
1254
1258
|
this.stop();
|
|
@@ -68224,7 +68228,9 @@ function calculateFill(input, currentFill = 0) {
|
|
|
68224
68228
|
return Math.max(0, Math.min(100, value));
|
|
68225
68229
|
}
|
|
68226
68230
|
|
|
68227
|
-
|
|
68231
|
+
/* ------------------ helpers ------------------ */
|
|
68232
|
+
const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
68233
|
+
/* ------------------ animation ------------------ */
|
|
68228
68234
|
const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalculateTypes) => {
|
|
68229
68235
|
return new Promise((resolve) => {
|
|
68230
68236
|
const keyframes = `
|
|
@@ -68233,88 +68239,100 @@ const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, allCalcul
|
|
|
68233
68239
|
background-color: ${activeCell.style.backgroundColor};
|
|
68234
68240
|
height: ${activeCell.style.height};
|
|
68235
68241
|
margin: ${activeCell.style.margin};
|
|
68236
|
-
${activeCell.innerHTML = ""}
|
|
68237
68242
|
}
|
|
68238
68243
|
100% { background-color: transparent; height: 0px; margin: 0px; }
|
|
68239
68244
|
}`;
|
|
68240
68245
|
const styleSheet = document.styleSheets[0];
|
|
68241
68246
|
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
|
|
68242
|
-
activeCell.style.animation = `widthDecrease
|
|
68243
|
-
activeCell.addEventListener(
|
|
68244
|
-
activeCell.style.height = '0px';
|
|
68245
|
-
activeCell.style.margin = '0px';
|
|
68246
|
-
activeCell.style.backgroundColor = 'transparent';
|
|
68247
|
+
activeCell.style.animation = `widthDecrease 0s`;
|
|
68248
|
+
activeCell.addEventListener("animationend", () => {
|
|
68247
68249
|
activeCell.remove();
|
|
68248
68250
|
// Trigger next container if last cell
|
|
68249
68251
|
if (allCalculateTypes.length === 1) {
|
|
68250
68252
|
setTimeout(() => triggerNextContainer(), 2000);
|
|
68251
68253
|
}
|
|
68252
68254
|
resolve();
|
|
68253
|
-
});
|
|
68255
|
+
}, { once: true });
|
|
68254
68256
|
});
|
|
68255
68257
|
};
|
|
68256
|
-
|
|
68258
|
+
/* ------------------ PRACTICE MODE ------------------ */
|
|
68257
68259
|
const checkEquationOfActiveCell = async (container) => {
|
|
68258
68260
|
var _a;
|
|
68259
|
-
const calculatorValue = (_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value");
|
|
68261
|
+
const calculatorValue = ((_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) || "";
|
|
68260
68262
|
const allCalculateTypes = document.querySelectorAll("[type='calculate']");
|
|
68261
68263
|
const activeCell = allCalculateTypes[0];
|
|
68264
|
+
if (!activeCell)
|
|
68265
|
+
return;
|
|
68262
68266
|
const activeCellValue = Number(activeCell["value"]);
|
|
68263
|
-
const
|
|
68264
|
-
if (
|
|
68267
|
+
const calculateValue = Number(calculatorValue);
|
|
68268
|
+
if (activeCellValue !== calculateValue)
|
|
68265
68269
|
return;
|
|
68266
68270
|
const equation = activeCell["string"];
|
|
68267
|
-
|
|
68268
|
-
//await new Promise(r => setTimeout(r, 200));
|
|
68269
|
-
activeCell.innerHTML = equation.replaceAll("?", calculteValue);
|
|
68271
|
+
const element1 = container.querySelector("#dummy111");
|
|
68270
68272
|
const element2 = container.querySelector("#dummy112");
|
|
68273
|
+
// 1. mascot animation
|
|
68274
|
+
await wait(3000);
|
|
68275
|
+
// Save previous element2 BEFORE overwriting
|
|
68276
|
+
const previousElement2Content = element2.innerHTML;
|
|
68277
|
+
// Replace ?
|
|
68278
|
+
activeCell.innerHTML = equation.replaceAll("?", calculateValue.toString());
|
|
68279
|
+
// Update element2 with NEW content
|
|
68271
68280
|
element2.innerHTML = activeCell.innerHTML;
|
|
68272
|
-
//
|
|
68281
|
+
// 3. animate out
|
|
68273
68282
|
await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
|
|
68283
|
+
// 4. update element1 ONLY from second equation onwards
|
|
68284
|
+
if (previousElement2Content) {
|
|
68285
|
+
element1.innerHTML = previousElement2Content;
|
|
68286
|
+
}
|
|
68274
68287
|
};
|
|
68275
|
-
|
|
68288
|
+
/* ------------------ MAIN HANDLER ------------------ */
|
|
68276
68289
|
let score = 0;
|
|
68277
68290
|
const handleSolvedEquationSubmissionAndScoreUpdate = async () => {
|
|
68278
68291
|
var _a;
|
|
68279
|
-
const container = document.getElementById(
|
|
68280
|
-
|
|
68292
|
+
const container = document.getElementById("lido-container");
|
|
68293
|
+
if (!container)
|
|
68294
|
+
return;
|
|
68295
|
+
const calculatorValue = ((_a = container.querySelector("#lidoCalculator")) === null || _a === void 0 ? void 0 : _a.getAttribute("value")) || "";
|
|
68296
|
+
if (!calculatorValue.length)
|
|
68297
|
+
return;
|
|
68281
68298
|
const allCalculateTypes = document.querySelectorAll("[type='calculate']");
|
|
68282
68299
|
const activeCell = allCalculateTypes[0];
|
|
68300
|
+
if (!activeCell)
|
|
68301
|
+
return;
|
|
68283
68302
|
const isContinueOnCorrect = container.getAttribute("is-continue-on-correct") === "true";
|
|
68284
68303
|
const activeCellValue = Number(activeCell["value"]);
|
|
68285
|
-
const
|
|
68304
|
+
const calculateValue = Number(calculatorValue);
|
|
68286
68305
|
const element1 = container.querySelector("#dummy111");
|
|
68287
68306
|
const element2 = container.querySelector("#dummy112");
|
|
68288
|
-
|
|
68307
|
+
/* ---------- PRACTICE MODE ---------- */
|
|
68289
68308
|
if (isContinueOnCorrect) {
|
|
68290
|
-
if (element2.innerHTML.length > 0 && activeCellValue === calculteValue) {
|
|
68291
|
-
element1.innerHTML = element2.innerHTML;
|
|
68292
|
-
}
|
|
68293
68309
|
await checkEquationOfActiveCell(container);
|
|
68310
|
+
return;
|
|
68311
|
+
}
|
|
68312
|
+
/* ---------- TEST MODE ---------- */
|
|
68313
|
+
// Score update
|
|
68314
|
+
if (activeCellValue === calculateValue) {
|
|
68315
|
+
score++;
|
|
68294
68316
|
}
|
|
68295
|
-
// TEST MODE (store all, animate regardless of correctness)
|
|
68296
68317
|
else {
|
|
68297
|
-
if (
|
|
68298
|
-
|
|
68299
|
-
|
|
68300
|
-
|
|
68301
|
-
|
|
68302
|
-
|
|
68303
|
-
|
|
68304
|
-
|
|
68305
|
-
|
|
68306
|
-
|
|
68307
|
-
|
|
68308
|
-
|
|
68309
|
-
|
|
68310
|
-
|
|
68311
|
-
|
|
68312
|
-
|
|
68313
|
-
|
|
68314
|
-
|
|
68315
|
-
// Animate
|
|
68316
|
-
await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
|
|
68317
|
-
}
|
|
68318
|
+
if (score > 0)
|
|
68319
|
+
score--;
|
|
68320
|
+
}
|
|
68321
|
+
console.log("SCORE:", score);
|
|
68322
|
+
const equation = activeCell["string"];
|
|
68323
|
+
//1. mascot animation
|
|
68324
|
+
await wait(3000);
|
|
68325
|
+
// Save previous element2 BEFORE overwrite
|
|
68326
|
+
const previousElement2Content = element2.innerHTML;
|
|
68327
|
+
// Replace ?
|
|
68328
|
+
activeCell.innerHTML = equation.replaceAll("?", calculateValue.toString());
|
|
68329
|
+
// Update element2 with new content
|
|
68330
|
+
element2.innerHTML = activeCell.innerHTML;
|
|
68331
|
+
//3. animate out
|
|
68332
|
+
await animationToRemoveEquationSolvedCellForNimbleTable(activeCell, allCalculateTypes);
|
|
68333
|
+
//4. update element1 ONLY after animation & only if previous exists
|
|
68334
|
+
if (previousElement2Content) {
|
|
68335
|
+
element1.innerHTML = previousElement2Content;
|
|
68318
68336
|
}
|
|
68319
68337
|
};
|
|
68320
68338
|
|
|
@@ -69080,6 +69098,7 @@ const parseActions = (input) => {
|
|
|
69080
69098
|
return actions;
|
|
69081
69099
|
};
|
|
69082
69100
|
const matchStringPattern = (pattern, arr) => {
|
|
69101
|
+
var _a;
|
|
69083
69102
|
const patternGroups = pattern.split(',').map(group => group.trim());
|
|
69084
69103
|
let arrIndex = 0;
|
|
69085
69104
|
let options = new Set();
|
|
@@ -69092,21 +69111,25 @@ const matchStringPattern = (pattern, arr) => {
|
|
|
69092
69111
|
}
|
|
69093
69112
|
for (const group of patternGroups) {
|
|
69094
69113
|
if (group.startsWith('(') && group.endsWith(')')) {
|
|
69095
|
-
//
|
|
69096
|
-
const choices = group
|
|
69097
|
-
|
|
69098
|
-
|
|
69099
|
-
|
|
69100
|
-
|
|
69101
|
-
|
|
69102
|
-
|
|
69103
|
-
.map(option => option.trim());
|
|
69104
|
-
|
|
69114
|
+
// Parenthesized group: treat choices as a set (order-insensitive)
|
|
69115
|
+
const choices = group.slice(1, -1).split('|').map(option => option.trim());
|
|
69116
|
+
const arrVal = (_a = arr[arrIndex]) !== null && _a !== void 0 ? _a : '';
|
|
69117
|
+
let arrChoice = [];
|
|
69118
|
+
if (arrVal.startsWith('(') && arrVal.endsWith(')')) {
|
|
69119
|
+
arrChoice = arrVal.slice(1, -1).split('|').map(option => option.trim());
|
|
69120
|
+
}
|
|
69121
|
+
else if (arrVal.includes('|')) {
|
|
69122
|
+
arrChoice = arrVal.split('|').map(option => option.trim());
|
|
69123
|
+
}
|
|
69124
|
+
else if (arrVal !== '') {
|
|
69125
|
+
arrChoice = [arrVal.trim()];
|
|
69126
|
+
}
|
|
69127
|
+
else {
|
|
69105
69128
|
return false;
|
|
69106
|
-
for (let i = 0; i < choices.length; i++) {
|
|
69107
|
-
if (!choices.includes(arrChoice[i]))
|
|
69108
|
-
return false;
|
|
69109
69129
|
}
|
|
69130
|
+
const normalize = (items) => items.map(s => s.trim()).sort().join('|');
|
|
69131
|
+
if (normalize(choices) !== normalize(arrChoice))
|
|
69132
|
+
return false;
|
|
69110
69133
|
arrIndex++;
|
|
69111
69134
|
}
|
|
69112
69135
|
else if (group.includes('|')) {
|
|
@@ -69118,8 +69141,9 @@ const matchStringPattern = (pattern, arr) => {
|
|
|
69118
69141
|
}
|
|
69119
69142
|
else {
|
|
69120
69143
|
// Exact match required
|
|
69121
|
-
if (arrIndex >= arr.length || arr[arrIndex] !== group)
|
|
69144
|
+
if (arrIndex >= arr.length || arr[arrIndex] !== group) {
|
|
69122
69145
|
return false;
|
|
69146
|
+
}
|
|
69123
69147
|
arrIndex++;
|
|
69124
69148
|
}
|
|
69125
69149
|
}
|
|
@@ -69328,6 +69352,7 @@ const validateObjectiveStatus = async () => {
|
|
|
69328
69352
|
}
|
|
69329
69353
|
await executeActions(onCorrect, container);
|
|
69330
69354
|
}
|
|
69355
|
+
calculateScore();
|
|
69331
69356
|
if (container.getAttribute('dropAttr') === 'EnableAnimation') {
|
|
69332
69357
|
setTimeout(() => {
|
|
69333
69358
|
triggerNextContainer();
|
|
@@ -69336,14 +69361,13 @@ const validateObjectiveStatus = async () => {
|
|
|
69336
69361
|
else {
|
|
69337
69362
|
triggerNextContainer();
|
|
69338
69363
|
}
|
|
69339
|
-
await calculateScore();
|
|
69340
69364
|
}
|
|
69341
69365
|
else {
|
|
69342
69366
|
const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
|
|
69343
69367
|
const onCorrect = container.getAttribute('onCorrect');
|
|
69344
69368
|
if (!isContinueOnCorrect) {
|
|
69345
|
-
await calculateScore();
|
|
69346
69369
|
storingEachActivityScore(false);
|
|
69370
|
+
calculateScore();
|
|
69347
69371
|
await executeActions(onCorrect, container);
|
|
69348
69372
|
triggerNextContainer();
|
|
69349
69373
|
}
|
|
@@ -94,7 +94,9 @@ export class LidoCalculator {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
this.onOk.emit(isCorrect);
|
|
97
|
+
const okbtn = document.getElementById("btn-11");
|
|
97
98
|
if (isCorrect) {
|
|
99
|
+
okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
|
|
98
100
|
this.displayValue = "";
|
|
99
101
|
storingEachActivityScore(isCorrect);
|
|
100
102
|
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
@@ -111,15 +113,23 @@ export class LidoCalculator {
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
else {
|
|
116
|
+
okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
|
|
114
117
|
this.displayValue = "";
|
|
115
118
|
storingEachActivityScore(isCorrect);
|
|
116
119
|
const onInCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onInCorrect')) || '';
|
|
117
|
-
|
|
120
|
+
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
121
|
+
if (container.getAttribute('is-continue-on-correct') === 'false') {
|
|
122
|
+
await executeActions(onCorrect, container);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
await executeActions(onInCorrect, container);
|
|
126
|
+
}
|
|
118
127
|
}
|
|
128
|
+
okbtn.style.pointerEvents = 'auto'; // Re-enable OK button after processing
|
|
119
129
|
}
|
|
120
130
|
render() {
|
|
121
131
|
const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
|
|
122
|
-
return (h(Host, { key: '
|
|
132
|
+
return (h(Host, { key: '595c92e80baed8e1709c51302aa427d672b3a9e0', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, h("lido-cell", { key: '4a2966a46fd008d66fedeb5f44e0ee2c5e8c083a', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: '35e38f7412be8489b668ba0aab927b7ba3d98f29', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: '926def912022a30a27f5419d98348beb84fc1a42', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: '41a69c7aa7d1dfbeea19b1a1ef095b97d2c953ba', class: "lido-calculator-displayParent" }, h("div", { key: '047dfc84e8b02739a982287f82b1df2b7f552dcd', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: '41cd91f2c9aa40f6adcf6b0318e07e394bc3b38e', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
|
|
123
133
|
'lido-calculator-btn-special': num === '←' || num === 'OK',
|
|
124
134
|
'lido-calculator-btn-default': num !== '←' && num !== 'OK'
|
|
125
135
|
}, onClick: () => this.handleClick(num) }))))));
|
|
@@ -46,7 +46,7 @@ function getContainerXml(args) {
|
|
|
46
46
|
</lido-text>
|
|
47
47
|
</lido-pos>
|
|
48
48
|
<!-- question -->
|
|
49
|
-
<lido-text visible="true"
|
|
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';">
|
|
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 -->
|