lido-player 0.0.2-beta-16-dev → 0.0.2-beta-17-dev
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/{decode-C08Ujimj.js → decode-DUZYNXIv.js} +1 -1
- package/dist/cjs/{index-BkBqiwe8.js → index-BEjUmVtH.js} +189 -53
- package/dist/cjs/{index-Dy19zuTX.js → index-DnqQXD5x.js} +53 -12
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/lido-avatar_22.cjs.entry.js +60 -54
- package/dist/cjs/lido-player.cjs.js +3 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/calculator/lido-calculator.js +3 -3
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +12 -2
- package/dist/collection/components/scale/assets/Shadow.svg +9 -0
- package/dist/collection/components/scale/lido-balance.css +1 -1
- package/dist/collection/components/scale/lido-balance.js +13 -11
- package/dist/collection/components/text/lido-text.js +28 -2
- package/dist/collection/components/trace/assets/Tracing-hand.svg +8 -0
- package/dist/collection/components/trace/lido-trace.js +25 -38
- package/dist/collection/css/index.css +7 -4
- package/dist/collection/stories/Templates/blender/blender.stories.js +9 -5
- package/dist/collection/utils/audioPlayer.js +31 -9
- package/dist/collection/utils/utils.js +20 -10
- package/dist/collection/utils/utilsHandlers/animationHandler.js +9 -2
- package/dist/collection/utils/utilsHandlers/clickHandler.js +8 -0
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +28 -8
- package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +12 -15
- package/dist/collection/utils/utilsHandlers/slideHandler.js +76 -17
- package/dist/components/index.js +1 -1
- package/dist/components/lido-balance.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-container.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-math-matrix.js +1 -1
- package/dist/components/lido-root.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/lido-trace.js +1 -1
- package/dist/components/p-BNNX1Pew.js +12 -0
- package/dist/components/p-CTlwn9r7.js +1 -0
- package/dist/components/{p-C2p0KZh4.js → p-Cj-6tqzU.js} +1 -1
- package/dist/components/p-CjdDpXfk.js +1 -0
- package/dist/components/{p-Uluc7jQ7.js → p-D54c-ybm.js} +1 -1
- package/dist/components/p-DdQ1eqJr.js +1 -0
- package/dist/components/{p-D-IYWSAa.js → p-SPZTb5fI.js} +1 -1
- package/dist/components/p-yT7udDfd.js +1 -0
- package/dist/esm/{decode-CGJIPA4t.js → decode-BgBfbPZu.js} +1 -1
- package/dist/esm/{index-Dq-Z8Dx0.js → index-BeHFCsWf.js} +54 -13
- package/dist/esm/{index-C854B63S.js → index-D-29PaRa.js} +189 -53
- package/dist/esm/index.js +2 -2
- package/dist/esm/lido-avatar_22.entry.js +60 -54
- package/dist/esm/lido-player.js +4 -4
- package/dist/esm/loader.js +3 -3
- package/dist/lido-player/assets/Shadow.svg +9 -0
- package/dist/lido-player/assets/Tracing-hand.svg +8 -0
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.css +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-856e1956.entry.js +12 -0
- package/dist/lido-player/{p-Bg5mBsd9.js → p-BA2X6O7O.js} +1 -1
- package/dist/lido-player/p-BeHFCsWf.js +3 -0
- package/dist/lido-player/p-TuBmCgtK.js +1 -0
- package/dist/types/components/scale/lido-balance.d.ts +2 -2
- package/dist/types/components/text/lido-text.d.ts +6 -1
- package/dist/types/components/trace/lido-trace.d.ts +1 -1
- package/dist/types/components.d.ts +21 -10
- package/dist/types/stencil-public-runtime.d.ts +12 -0
- package/dist/types/utils/audioPlayer.d.ts +2 -0
- package/dist/types/utils/utilsHandlers/slideHandler.d.ts +5 -0
- package/loader/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p-C7U1h9gI.js +0 -1
- package/dist/components/p-CS6iRQJh.js +0 -1
- package/dist/components/p-DGvzMlyn.js +0 -12
- package/dist/components/p-DPAlnts-.js +0 -1
- package/dist/components/p-DYs8s-uh.js +0 -1
- package/dist/lido-player/p-C4OTDhbr.js +0 -1
- package/dist/lido-player/p-Dq-Z8Dx0.js +0 -2
- package/dist/lido-player/p-f0e333c6.entry.js +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as getAssetPath } from './index-BeHFCsWf.js';
|
|
2
2
|
|
|
3
3
|
const DragMapKey = 'lidoDragMap';
|
|
4
4
|
const SelectedValuesKey = 'lidoSelectedValues';
|
|
@@ -319,7 +319,7 @@ function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
319
319
|
dropElement.classList.remove('zoom-fade-in');
|
|
320
320
|
dragElement.classList.add('zoom-fade-out');
|
|
321
321
|
dropElement.classList.add('zoom-fade-out');
|
|
322
|
-
|
|
322
|
+
const cleanup = () => {
|
|
323
323
|
div.remove();
|
|
324
324
|
container.style.pointerEvents = 'auto';
|
|
325
325
|
if (isObjectiveComplete) {
|
|
@@ -327,10 +327,18 @@ function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
327
327
|
triggerNextContainer();
|
|
328
328
|
container.removeAttribute(AnimationVanishedValuesKey);
|
|
329
329
|
}
|
|
330
|
-
}
|
|
330
|
+
};
|
|
331
|
+
const templateId = (container.getAttribute('template-id') || '').toLowerCase();
|
|
332
|
+
if (templateId === 'letterpairing' || templateId === 'numberpair') {
|
|
333
|
+
cleanup();
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
setTimeout(cleanup, 800); // match animation duration
|
|
337
|
+
}
|
|
331
338
|
}, 250);
|
|
332
339
|
}
|
|
333
340
|
|
|
341
|
+
const isBlenderTemplate = (container) => (container === null || container === void 0 ? void 0 : container.getAttribute('template-id')) === 'blender';
|
|
334
342
|
function buildDropHasDragFromDOM() {
|
|
335
343
|
const dropHasDrag = {};
|
|
336
344
|
const dropElements = document.querySelectorAll("[type='drop']");
|
|
@@ -388,7 +396,6 @@ function enableDraggingWithScaling(element) {
|
|
|
388
396
|
let mutationFlag = false;
|
|
389
397
|
// Fetch the container element
|
|
390
398
|
const container = document.getElementById(LidoContainer);
|
|
391
|
-
const templateId = container.getAttribute("template-id");
|
|
392
399
|
if (!container) {
|
|
393
400
|
console.error(`Container with ID "container" not found.`);
|
|
394
401
|
return;
|
|
@@ -549,7 +556,7 @@ function enableDraggingWithScaling(element) {
|
|
|
549
556
|
allElements.forEach(otherElement => {
|
|
550
557
|
var _a;
|
|
551
558
|
if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
|
|
552
|
-
if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) && container
|
|
559
|
+
if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) && !isBlenderTemplate(container)) {
|
|
553
560
|
if (otherElement) {
|
|
554
561
|
setOpacityIfChanged(otherElement, "0.3");
|
|
555
562
|
}
|
|
@@ -637,7 +644,7 @@ function enableDraggingWithScaling(element) {
|
|
|
637
644
|
else {
|
|
638
645
|
onElementDropComplete(element, mostOverlappedElement);
|
|
639
646
|
}
|
|
640
|
-
if (
|
|
647
|
+
if (isBlenderTemplate(container) && element && mostOverlappedElement) {
|
|
641
648
|
const allElements = document.querySelectorAll(`*`);
|
|
642
649
|
allElements.forEach(el => {
|
|
643
650
|
removeHighlight(el);
|
|
@@ -865,7 +872,7 @@ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, sel
|
|
|
865
872
|
highlightElement();
|
|
866
873
|
}
|
|
867
874
|
async function onElementDropComplete(dragElement, dropElement) {
|
|
868
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
875
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
869
876
|
const container = document.getElementById(LidoContainer);
|
|
870
877
|
const selectedValueData = (_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : "[]";
|
|
871
878
|
const dragSelectedData = JSON.stringify(buildDragSelectedMapFromDOM());
|
|
@@ -1087,28 +1094,48 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
1087
1094
|
// Add pulse and highlight effect for a successful match
|
|
1088
1095
|
const isCorrect = dropElement['value'].toLowerCase().includes(dragElement['value'].toLowerCase());
|
|
1089
1096
|
dispatchElementDropEvent(dragElement, dropElement, isCorrect);
|
|
1090
|
-
if (container
|
|
1097
|
+
if (!isBlenderTemplate(container)) {
|
|
1091
1098
|
storingEachActivityScore(isCorrect);
|
|
1092
1099
|
}
|
|
1093
1100
|
dragElement.style.opacity = '1';
|
|
1094
1101
|
const allDropElements = document.querySelectorAll('.drop-element');
|
|
1095
1102
|
allDropElements.forEach(el => updateDropBorder(el));
|
|
1103
|
+
if (isBlenderTemplate(container)) {
|
|
1104
|
+
const requiredDrops = Number((_j = dropElement.getAttribute('required-drops')) !== null && _j !== void 0 ? _j : 0);
|
|
1105
|
+
const placedDrops = document.querySelectorAll(`[${DropToAttr}="${dropElement.id}"]`).length;
|
|
1106
|
+
const action = placedDrops > 0 && placedDrops <= requiredDrops
|
|
1107
|
+
? dropElement.getAttribute('onCorrect')
|
|
1108
|
+
: dropElement.getAttribute('onInCorrect');
|
|
1109
|
+
if (action) {
|
|
1110
|
+
await executeActions(action, dropElement, dragElement);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1096
1113
|
highlightElement();
|
|
1097
1114
|
await onActivityComplete(dragElement, dropElement);
|
|
1098
1115
|
}
|
|
1099
1116
|
function updateDropBorder(element) {
|
|
1117
|
+
var _a;
|
|
1100
1118
|
if (!element || !element.classList.contains('drop-element'))
|
|
1101
1119
|
return;
|
|
1102
1120
|
const container = document.getElementById(LidoContainer);
|
|
1103
1121
|
if (!container)
|
|
1104
1122
|
return;
|
|
1105
1123
|
const showBorder = container.getAttribute('show-drop-border');
|
|
1106
|
-
if (showBorder !== 'true') {
|
|
1124
|
+
if (showBorder !== 'true' && !isBlenderTemplate(container)) {
|
|
1107
1125
|
return;
|
|
1108
1126
|
}
|
|
1109
1127
|
const dropId = element.id;
|
|
1110
1128
|
const dragSelectedElements = document.querySelectorAll(`[${DropToAttr}="${dropId}"]`);
|
|
1111
|
-
if (
|
|
1129
|
+
if (isBlenderTemplate(container)) {
|
|
1130
|
+
const requiredDrops = Number((_a = element.getAttribute('required-drops')) !== null && _a !== void 0 ? _a : 0);
|
|
1131
|
+
const placedDrops = dragSelectedElements.length;
|
|
1132
|
+
const showCorrectBorder = placedDrops > 0 && placedDrops <= requiredDrops;
|
|
1133
|
+
element.classList.toggle('empty', !showCorrectBorder);
|
|
1134
|
+
element.classList.remove('filled');
|
|
1135
|
+
element.style.setProperty('border', showCorrectBorder ? '5px dashed green' : '5px dashed #f34d08', 'important');
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
if (dragSelectedElements.length > 0 && !isBlenderTemplate(container)) {
|
|
1112
1139
|
element.classList.add('filled');
|
|
1113
1140
|
element.classList.remove('empty');
|
|
1114
1141
|
element.classList.remove('highlight-element');
|
|
@@ -1195,7 +1222,7 @@ async function onClickDropOrDragElement(element, type) {
|
|
|
1195
1222
|
// Move the drag element to the drop position
|
|
1196
1223
|
selectedDragElement.style.transform = `translate(${translateX}px, ${translateY}px)`;
|
|
1197
1224
|
// Remove highlights after moving the element
|
|
1198
|
-
if (container
|
|
1225
|
+
if (!isBlenderTemplate(container)) {
|
|
1199
1226
|
const allElements = document.querySelectorAll(`*`);
|
|
1200
1227
|
allElements.forEach(el => {
|
|
1201
1228
|
removeHighlight(el);
|
|
@@ -1437,9 +1464,18 @@ function highlightElement() {
|
|
|
1437
1464
|
}
|
|
1438
1465
|
|
|
1439
1466
|
class AudioPlayer {
|
|
1467
|
+
resolvePlaybackWait() {
|
|
1468
|
+
if (!this.endPromiseResolve) {
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
const resolve = this.endPromiseResolve;
|
|
1472
|
+
this.endPromiseResolve = null;
|
|
1473
|
+
resolve();
|
|
1474
|
+
}
|
|
1440
1475
|
constructor() {
|
|
1441
1476
|
this.currentTargetElement = null;
|
|
1442
1477
|
this.pendingReplayElement = null;
|
|
1478
|
+
this.playbackHasStarted = false;
|
|
1443
1479
|
this.highlightOverlay = null;
|
|
1444
1480
|
this.wordRects = [];
|
|
1445
1481
|
this.activeWordIndex = -1;
|
|
@@ -1497,15 +1533,12 @@ class AudioPlayer {
|
|
|
1497
1533
|
window.speechSynthesis.cancel();
|
|
1498
1534
|
}
|
|
1499
1535
|
// Resolve any pending "ended" wait so callers can continue.
|
|
1500
|
-
|
|
1501
|
-
const resolve = this.endPromiseResolve;
|
|
1502
|
-
this.endPromiseResolve = null;
|
|
1503
|
-
resolve();
|
|
1504
|
-
}
|
|
1536
|
+
this.resolvePlaybackWait();
|
|
1505
1537
|
if (!preserveReplay) {
|
|
1506
1538
|
this.pendingReplayElement = null;
|
|
1507
1539
|
}
|
|
1508
1540
|
this.currentTargetElement = null;
|
|
1541
|
+
this.playbackHasStarted = false;
|
|
1509
1542
|
this.audioElement.pause();
|
|
1510
1543
|
this.audioElement.currentTime = 0;
|
|
1511
1544
|
this.audioElement.src = '';
|
|
@@ -1543,6 +1576,7 @@ class AudioPlayer {
|
|
|
1543
1576
|
}
|
|
1544
1577
|
async play(targetElement) {
|
|
1545
1578
|
this.registerVisibilityEvents();
|
|
1579
|
+
this.playbackHasStarted = false;
|
|
1546
1580
|
if (!this.isWindowVisible()) {
|
|
1547
1581
|
this.pendingReplayElement = targetElement;
|
|
1548
1582
|
await this.stop(true);
|
|
@@ -1596,6 +1630,24 @@ class AudioPlayer {
|
|
|
1596
1630
|
if (audioUrl) {
|
|
1597
1631
|
audioUrl = convertUrlToRelative(audioUrl);
|
|
1598
1632
|
this.audioElement.src = audioUrl;
|
|
1633
|
+
this.audioElement.onplaying = () => {
|
|
1634
|
+
this.playbackHasStarted = true;
|
|
1635
|
+
};
|
|
1636
|
+
this.audioElement.onpause = () => {
|
|
1637
|
+
if (this.playbackHasStarted && !this.audioElement.ended) {
|
|
1638
|
+
this.resolvePlaybackWait();
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
this.audioElement.onstalled = () => {
|
|
1642
|
+
if (this.playbackHasStarted) {
|
|
1643
|
+
this.resolvePlaybackWait();
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
this.audioElement.onerror = () => {
|
|
1647
|
+
if (this.playbackHasStarted) {
|
|
1648
|
+
this.resolvePlaybackWait();
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1599
1651
|
try {
|
|
1600
1652
|
// setDraggingDisabled(true);
|
|
1601
1653
|
const language = container.getAttribute('Lang') || 'en';
|
|
@@ -1625,10 +1677,7 @@ class AudioPlayer {
|
|
|
1625
1677
|
await new Promise(resolve => {
|
|
1626
1678
|
this.endPromiseResolve = resolve;
|
|
1627
1679
|
this.audioElement.onended = () => {
|
|
1628
|
-
|
|
1629
|
-
this.endPromiseResolve = null;
|
|
1630
|
-
}
|
|
1631
|
-
resolve();
|
|
1680
|
+
this.resolvePlaybackWait();
|
|
1632
1681
|
};
|
|
1633
1682
|
});
|
|
1634
1683
|
}
|
|
@@ -2411,6 +2460,9 @@ function slidingWithScaling(element) {
|
|
|
2411
2460
|
if (container.getAttribute('canplay') === 'false')
|
|
2412
2461
|
return;
|
|
2413
2462
|
const onStart = (event) => {
|
|
2463
|
+
const templateId = container.getAttribute('template-id');
|
|
2464
|
+
if ((templateId === 'arrangeLetters' || templateId === 'reorder') && container.getAttribute('game-completed') === 'true')
|
|
2465
|
+
return;
|
|
2414
2466
|
removeHighlight(element);
|
|
2415
2467
|
isDragging = true;
|
|
2416
2468
|
elementRect = element.getBoundingClientRect();
|
|
@@ -2558,7 +2610,7 @@ function slidingWithScaling(element) {
|
|
|
2558
2610
|
element.style.transform = 'translate(0, 0)';
|
|
2559
2611
|
setTimeout(() => {
|
|
2560
2612
|
if (overlapElement) {
|
|
2561
|
-
slideCompleted(element);
|
|
2613
|
+
void slideCompleted(element);
|
|
2562
2614
|
overlapElement = false;
|
|
2563
2615
|
}
|
|
2564
2616
|
}, 300);
|
|
@@ -2582,27 +2634,95 @@ function slidingWithScaling(element) {
|
|
|
2582
2634
|
element.addEventListener('touchstart', onStart);
|
|
2583
2635
|
element.addEventListener(LIDO_INTERACTION_CLEANUP_EVENT, cleanup);
|
|
2584
2636
|
}
|
|
2585
|
-
const
|
|
2637
|
+
const isArrangeLettersContainer = (container) => container.getAttribute('template-id') === 'arrangeLetters';
|
|
2638
|
+
const isReorderContainer = (container) => container.getAttribute('template-id') === 'reorder';
|
|
2639
|
+
const getSlideValuesForValidation = (container, slideElements) => {
|
|
2640
|
+
if (isReorderContainer(container)) {
|
|
2641
|
+
return slideElements.map(element => element.id);
|
|
2642
|
+
}
|
|
2643
|
+
return slideElements.map(element => element['value']);
|
|
2644
|
+
};
|
|
2645
|
+
const updateArrangeLettersCorrectness = (container, slideValues, objectiveValues) => {
|
|
2646
|
+
const slideElements = Array.from(container.querySelectorAll('[type="slide"]'));
|
|
2647
|
+
slideElements.forEach((element, index) => {
|
|
2648
|
+
const isCorrect = index < objectiveValues.length && slideValues[index] === objectiveValues[index].trim();
|
|
2649
|
+
if (isCorrect) {
|
|
2650
|
+
applyBorderToClickableCell(element, '#65BC46');
|
|
2651
|
+
}
|
|
2652
|
+
else {
|
|
2653
|
+
element.style.removeProperty('box-shadow');
|
|
2654
|
+
}
|
|
2655
|
+
});
|
|
2656
|
+
};
|
|
2657
|
+
const isArrangeLettersComplete = (slideValues, objectiveString) => {
|
|
2658
|
+
if (!objectiveString)
|
|
2659
|
+
return false;
|
|
2660
|
+
const objectiveValues = objectiveString.split(',').map(value => value.trim());
|
|
2661
|
+
return slideValues.length === objectiveValues.length
|
|
2662
|
+
&& slideValues.every((value, index) => value === objectiveValues[index]);
|
|
2663
|
+
};
|
|
2664
|
+
const updateReorderCorrectness = (container, slideValues, objectiveValues) => {
|
|
2665
|
+
const slideElements = Array.from(container.querySelectorAll('[type="slide"]'));
|
|
2666
|
+
slideElements.forEach((element, index) => {
|
|
2667
|
+
const isCorrect = index < objectiveValues.length && slideValues[index] === objectiveValues[index].trim();
|
|
2668
|
+
if (isCorrect) {
|
|
2669
|
+
applyBorderToClickableCell(element, '#65BC46');
|
|
2670
|
+
}
|
|
2671
|
+
else {
|
|
2672
|
+
element.style.removeProperty('box-shadow');
|
|
2673
|
+
}
|
|
2674
|
+
});
|
|
2675
|
+
};
|
|
2676
|
+
const isReorderComplete = (slideValues, objectiveString) => {
|
|
2677
|
+
if (!objectiveString)
|
|
2678
|
+
return false;
|
|
2679
|
+
const objectiveValues = objectiveString.split(',').map(value => value.trim());
|
|
2680
|
+
return slideValues.length === objectiveValues.length
|
|
2681
|
+
&& slideValues.every((value, index) => value === objectiveValues[index]);
|
|
2682
|
+
};
|
|
2683
|
+
const slideCompleted = async (slideElement) => {
|
|
2586
2684
|
var _a;
|
|
2587
2685
|
const container = document.getElementById(LidoContainer);
|
|
2588
2686
|
const slideArr = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
2589
|
-
const allSlideElements = document.querySelectorAll("[type='slide']");
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
slideArr[index
|
|
2687
|
+
const allSlideElements = Array.from(document.querySelectorAll("[type='slide']"));
|
|
2688
|
+
const slideValues = getSlideValuesForValidation(container, allSlideElements);
|
|
2689
|
+
slideValues.forEach((value, index) => {
|
|
2690
|
+
slideArr[index] = value;
|
|
2593
2691
|
});
|
|
2594
2692
|
container.setAttribute(SelectedValuesKey, JSON.stringify(slideArr));
|
|
2595
2693
|
const objectiveString = document.getElementById(LidoContainer)['objective'];
|
|
2596
2694
|
const objectiveArray = objectiveString.split(',');
|
|
2597
|
-
const elementIndex =
|
|
2598
|
-
const isCorrect =
|
|
2695
|
+
const elementIndex = allSlideElements.indexOf(slideElement);
|
|
2696
|
+
const isCorrect = elementIndex >= 0 && elementIndex < objectiveArray.length
|
|
2697
|
+
? matchStringPattern(slideValues[elementIndex], [objectiveArray[elementIndex].trim()])
|
|
2698
|
+
: false;
|
|
2699
|
+
if (isArrangeLettersContainer(container)) {
|
|
2700
|
+
updateArrangeLettersCorrectness(container, slideValues, objectiveArray);
|
|
2701
|
+
}
|
|
2702
|
+
else if (isReorderContainer(container)) {
|
|
2703
|
+
updateReorderCorrectness(container, slideValues, objectiveArray);
|
|
2704
|
+
}
|
|
2599
2705
|
if (container.getAttribute('is-continue-on-correct') === 'true') {
|
|
2600
2706
|
storingEachActivityScore(true);
|
|
2601
|
-
// validationForSlideHandler();
|
|
2602
2707
|
}
|
|
2603
2708
|
else {
|
|
2604
2709
|
storingEachActivityScore(isCorrect);
|
|
2605
2710
|
}
|
|
2711
|
+
if (isArrangeLettersContainer(container) || isReorderContainer(container)) {
|
|
2712
|
+
await validationForSlideHandler(slideValues);
|
|
2713
|
+
}
|
|
2714
|
+
};
|
|
2715
|
+
const validationForSlideHandler = async (slideValues) => {
|
|
2716
|
+
const container = document.getElementById(LidoContainer);
|
|
2717
|
+
if (!container || (!isArrangeLettersContainer(container) && !isReorderContainer(container)) || container.getAttribute('game-completed') === 'true')
|
|
2718
|
+
return;
|
|
2719
|
+
const objectiveString = document.getElementById(LidoContainer)['objective'];
|
|
2720
|
+
const isComplete = isArrangeLettersContainer(container)
|
|
2721
|
+
? isArrangeLettersComplete(slideValues, objectiveString)
|
|
2722
|
+
: isReorderComplete(slideValues, objectiveString);
|
|
2723
|
+
if (isComplete) {
|
|
2724
|
+
await validateObjectiveStatus();
|
|
2725
|
+
}
|
|
2606
2726
|
};
|
|
2607
2727
|
|
|
2608
2728
|
const getContainerScale = (container) => {
|
|
@@ -3955,6 +4075,14 @@ function addClickListenerForClickType(element) {
|
|
|
3955
4075
|
const container = document.getElementById(LidoContainer);
|
|
3956
4076
|
if (container.getAttribute('canplay') === 'false')
|
|
3957
4077
|
return;
|
|
4078
|
+
const isBubbleTypeKeyboardKey = (container === null || container === void 0 ? void 0 : container.getAttribute('template-id')) === 'bubbleType' &&
|
|
4079
|
+
element.closest('lido-keyboard') !== null;
|
|
4080
|
+
// BubbleType manages key clicks and audio in lido-keyboard.tsx directly.
|
|
4081
|
+
// Letting the generic click handler attach here creates a competing stop/play
|
|
4082
|
+
// path that can interrupt the first bubble audio.
|
|
4083
|
+
if (isBubbleTypeKeyboardKey) {
|
|
4084
|
+
return;
|
|
4085
|
+
}
|
|
3958
4086
|
element.style.cursor = 'pointer';
|
|
3959
4087
|
if (!element) {
|
|
3960
4088
|
console.error('No element provided.');
|
|
@@ -72043,27 +72171,24 @@ const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
|
72043
72171
|
/* ------------------ animation ------------------ */
|
|
72044
72172
|
const animationToRemoveEquationSolvedCellForNimbleTable = (activeCell, container) => {
|
|
72045
72173
|
return new Promise((resolve) => {
|
|
72046
|
-
|
|
72047
|
-
|
|
72048
|
-
|
|
72049
|
-
|
|
72050
|
-
|
|
72051
|
-
|
|
72052
|
-
|
|
72053
|
-
|
|
72054
|
-
}`;
|
|
72055
|
-
const styleSheet = document.styleSheets[0];
|
|
72056
|
-
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
|
|
72057
|
-
activeCell.style.animation = `widthDecrease 0s`;
|
|
72058
|
-
activeCell.addEventListener("animationend", () => {
|
|
72059
|
-
activeCell.remove();
|
|
72174
|
+
let removed = false;
|
|
72175
|
+
const removeActiveCell = () => {
|
|
72176
|
+
if (removed)
|
|
72177
|
+
return;
|
|
72178
|
+
removed = true;
|
|
72179
|
+
if (activeCell.isConnected) {
|
|
72180
|
+
activeCell.remove();
|
|
72181
|
+
}
|
|
72060
72182
|
// Trigger next container only after the last calculate cell is removed
|
|
72061
72183
|
const remainingCalculateTypes = container.querySelectorAll("[type='calculate']");
|
|
72062
72184
|
if (remainingCalculateTypes.length === 0) {
|
|
72063
72185
|
setTimeout(() => triggerNextContainer(), 2000);
|
|
72064
72186
|
}
|
|
72065
72187
|
resolve();
|
|
72066
|
-
}
|
|
72188
|
+
};
|
|
72189
|
+
// Nimble uses a zero-duration removal; remove synchronously so progression
|
|
72190
|
+
// does not depend on a browser animationend event.
|
|
72191
|
+
removeActiveCell();
|
|
72067
72192
|
});
|
|
72068
72193
|
};
|
|
72069
72194
|
/* ------------------ PRACTICE MODE ------------------ */
|
|
@@ -72817,9 +72942,11 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
72817
72942
|
if (dropTo === "hundredsDrop")
|
|
72818
72943
|
hundreds++;
|
|
72819
72944
|
});
|
|
72820
|
-
|
|
72821
|
-
|
|
72822
|
-
const
|
|
72945
|
+
// Blender displays the number of blocks placed in each column.
|
|
72946
|
+
// Blender's drag/drop values are also the required block counts.
|
|
72947
|
+
const unitsValue = units;
|
|
72948
|
+
const tensValue = tens;
|
|
72949
|
+
const hundredsValue = hundreds;
|
|
72823
72950
|
// ✅ Update Lido Text Boxes
|
|
72824
72951
|
const unitsBox = document.getElementById("units");
|
|
72825
72952
|
const tensBox = document.getElementById("tens");
|
|
@@ -73080,18 +73207,27 @@ const calculateScore = () => {
|
|
|
73080
73207
|
gameScore.totalRightMovesCount += rightMoves;
|
|
73081
73208
|
gameScore.totalWrongMovesCount += wrongMoves;
|
|
73082
73209
|
let finalScore = Math.floor((rightMoves / (rightMoves + wrongMoves)) * 100);
|
|
73210
|
+
console.log('[Activity Score]', { rightMoves, wrongMoves, activityScore: finalScore });
|
|
73083
73211
|
storeActivityScore(finalScore);
|
|
73084
73212
|
gameScore.rightMoves = 0;
|
|
73085
73213
|
gameScore.wrongMoves = 0;
|
|
73086
73214
|
};
|
|
73087
73215
|
async function onActivityComplete(dragElement, dropElement) {
|
|
73088
|
-
var _a, _b;
|
|
73216
|
+
var _a, _b, _c;
|
|
73089
73217
|
const container = document.getElementById(LidoContainer);
|
|
73090
73218
|
if (!container)
|
|
73091
73219
|
return;
|
|
73220
|
+
const isBlender = container.getAttribute('template-id') === 'blender';
|
|
73092
73221
|
await executeActions("this.alignMatch='true'", dropElement, dragElement);
|
|
73093
73222
|
if (dragElement && dropElement) {
|
|
73094
|
-
|
|
73223
|
+
let isCorrect = dropElement['value'].toLowerCase().includes(dragElement['value'].toLowerCase());
|
|
73224
|
+
if (isBlender) {
|
|
73225
|
+
const requiredDrops = Number((_a = dropElement.getAttribute('required-drops')) !== null && _a !== void 0 ? _a : 0);
|
|
73226
|
+
const placedDrops = document.querySelectorAll(`[drop-to="${dropElement.id}"]`).length;
|
|
73227
|
+
// Blender accepts every count from 1 through the required count.
|
|
73228
|
+
// Zero or an overfilled drop zone uses the incorrect action.
|
|
73229
|
+
isCorrect = placedDrops > 0 && placedDrops <= requiredDrops;
|
|
73230
|
+
}
|
|
73095
73231
|
// storing each activity score based on isCorrect for (all drag-drop events)
|
|
73096
73232
|
// storingEachActivityScore(isCorrect);
|
|
73097
73233
|
if (isCorrect) {
|
|
@@ -73100,10 +73236,10 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
73100
73236
|
console.log("Right Moves : ", gameScore.rightMoves);
|
|
73101
73237
|
console.log("Wrong Moves : ", gameScore.wrongMoves);
|
|
73102
73238
|
}
|
|
73103
|
-
const onCorrect = ((
|
|
73239
|
+
const onCorrect = ((_b = container.getAttribute('dropAttr')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === DropMode.EnableAnimation.toLowerCase()
|
|
73104
73240
|
? ''
|
|
73105
73241
|
: dropElement.getAttribute('onCorrect');
|
|
73106
|
-
if (onCorrect) {
|
|
73242
|
+
if (onCorrect && !isBlender) {
|
|
73107
73243
|
await executeActions(onCorrect, dropElement, dragElement);
|
|
73108
73244
|
}
|
|
73109
73245
|
//for multiply beeds
|
|
@@ -73118,7 +73254,7 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
73118
73254
|
console.log("Wrong Moves : ", gameScore.wrongMoves);
|
|
73119
73255
|
}
|
|
73120
73256
|
const onInCorrect = dropElement.getAttribute('onInCorrect');
|
|
73121
|
-
if (onInCorrect) {
|
|
73257
|
+
if (onInCorrect && !isBlender) {
|
|
73122
73258
|
await executeActions(onInCorrect, dropElement, dragElement);
|
|
73123
73259
|
}
|
|
73124
73260
|
}
|
|
@@ -73127,7 +73263,7 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
73127
73263
|
const sortedValues = getSortedValuesArrayFromMap(dragScore);
|
|
73128
73264
|
container.setAttribute(SelectedValuesKey, JSON.stringify(sortedValues));
|
|
73129
73265
|
//localStorage
|
|
73130
|
-
let drag = JSON.parse((
|
|
73266
|
+
let drag = JSON.parse((_c = localStorage.getItem(DragMapKey)) !== null && _c !== void 0 ? _c : '{}');
|
|
73131
73267
|
const index = dropElement.getAttribute('tab-index');
|
|
73132
73268
|
if (!drag[index]) {
|
|
73133
73269
|
drag[index] = [];
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { $ as format } from './index-
|
|
2
|
-
import './index-
|
|
1
|
+
export { $ as format } from './index-D-29PaRa.js';
|
|
2
|
+
import './index-BeHFCsWf.js';
|