lido-player 0.0.2-beta-22-dev → 0.0.2-beta-24-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/LICENSE +21 -21
- package/dist/cjs/{decode-Cr5DANqc.js → decode-B7mZm_nK.js} +1 -1
- package/dist/cjs/{index-0BvcfeCt.js → index-BCRDjbaz.js} +276 -98
- package/dist/cjs/{index-DnaH8sO-.js → index-DBCFoh1I.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/lido-avatar_22.cjs.entry.js +231 -59
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/avatar/lido-avatar.css +4 -4
- package/dist/collection/components/avatar/lido-avatar.js +9 -2
- package/dist/collection/components/avatar/lido-avatar.tsx +214 -207
- package/dist/collection/components/avatar/readme.md +49 -49
- package/dist/collection/components/calculator/lido-calculator.css +89 -89
- package/dist/collection/components/calculator/lido-calculator.js +2 -2
- package/dist/collection/components/canvas/lido-canvas.css +33 -33
- package/dist/collection/components/canvas/lido-canvas.js +1 -1
- package/dist/collection/components/cell/lido-cell.css +100 -100
- package/dist/collection/components/cell/lido-cell.js +12 -12
- package/dist/collection/components/column/lido-col.css +19 -19
- package/dist/collection/components/column/lido-col.js +6 -6
- package/dist/collection/components/container/lido-container.css +34 -10
- package/dist/collection/components/container/lido-container.js +39 -8
- package/dist/collection/components/flashCard/lido-flash-card.css +72 -46
- package/dist/collection/components/flashCard/lido-flash-card.js +156 -15
- package/dist/collection/components/float/lido-float.css +30 -30
- package/dist/collection/components/float/lido-float.js +2 -2
- package/dist/collection/components/home/lido-home.css +309 -309
- package/dist/collection/components/home/lido-home.js +5 -5
- package/dist/collection/components/image/lido-image.css +17 -17
- package/dist/collection/components/image/lido-image.js +6 -6
- package/dist/collection/components/keyboard/lido-keyboard.css +38 -38
- package/dist/collection/components/keyboard/lido-keyboard.js +3 -3
- package/dist/collection/components/mathMatrix/lido-math-matrix.css +56 -56
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +1 -1
- package/dist/collection/components/position/lido-pos.css +16 -16
- package/dist/collection/components/position/lido-pos.js +2 -2
- package/dist/collection/components/random/lido-random.css +8 -8
- package/dist/collection/components/random/lido-random.js +2 -2
- package/dist/collection/components/root/lido-root.js +5 -5
- package/dist/collection/components/row/lido-row.css +10 -10
- package/dist/collection/components/row/lido-row.js +6 -6
- package/dist/collection/components/scale/assets/Shadow.svg +9 -9
- package/dist/collection/components/scale/lido-balance.css +174 -174
- package/dist/collection/components/scale/lido-balance.js +13 -13
- package/dist/collection/components/shape/lido-shape.css +216 -216
- package/dist/collection/components/shape/lido-shape.js +6 -6
- package/dist/collection/components/slideFill/lido-slide-fill.css +3 -3
- package/dist/collection/components/slideFill/lido-slide-fill.js +13 -13
- package/dist/collection/components/text/lido-text.css +53 -53
- package/dist/collection/components/text/lido-text.js +5 -5
- package/dist/collection/components/trace/assets/Tracing-hand.svg +8 -8
- package/dist/collection/components/trace/lido-trace.css +97 -97
- package/dist/collection/components/trace/lido-trace.js +7 -14
- package/dist/collection/components/wrap/lido-wrap.css +18 -18
- package/dist/collection/components/wrap/lido-wrap.js +6 -6
- package/dist/collection/css/animation.css +211 -211
- package/dist/collection/css/index.css +323 -323
- package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +61 -61
- package/dist/collection/stories/Templates/LetterPairing/LetterPairing.stories.js +123 -123
- package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +48 -48
- package/dist/collection/stories/Templates/Tag/tagGame.stories.js +39 -39
- package/dist/collection/stories/Templates/arrangeLetters/arrangeLetters.stories.js +44 -44
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +35 -35
- package/dist/collection/stories/Templates/balloonPop/balloonPop.stories.js +38 -38
- package/dist/collection/stories/Templates/blender/blender.stories.js +59 -59
- package/dist/collection/stories/Templates/bubbleType/bubbleType.stories.js +42 -42
- package/dist/collection/stories/Templates/calculator/calculator.stories.js +28 -28
- package/dist/collection/stories/Templates/categorize/categorize.stories.js +37 -37
- package/dist/collection/stories/Templates/categorize2/categorize2.stories.js +67 -67
- package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +29 -29
- package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +13 -13
- package/dist/collection/stories/Templates/create-sentence/createSentence.stories.js +74 -74
- package/dist/collection/stories/Templates/dragAndDrop/drag-drop.stories.js +69 -69
- package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +43 -43
- package/dist/collection/stories/Templates/fillBlank/fill-blank.stories.js +282 -282
- package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +35 -35
- package/dist/collection/stories/Templates/grid/grid.stories.js +118 -118
- package/dist/collection/stories/Templates/gridGame/grid-game.stories.js +57 -57
- package/dist/collection/stories/Templates/imageMatch/imageMatch.stories.js +44 -44
- package/dist/collection/stories/Templates/jumpSentence/jumpSentence.stories.js +41 -41
- package/dist/collection/stories/Templates/letterboard/letterboard.stories.js +183 -183
- package/dist/collection/stories/Templates/makeSentence/make-sentence.stories.js +36 -36
- package/dist/collection/stories/Templates/matchBox/matchBox.stories.js +69 -69
- package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +84 -84
- package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +31 -31
- package/dist/collection/stories/Templates/multipleOption/mcqWithQuestionImage.stories.js +112 -112
- package/dist/collection/stories/Templates/multipleOption/multiple-option.stories.js +47 -47
- package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +57 -57
- package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +53 -53
- package/dist/collection/stories/Templates/numberBoard/numberBoard.stories.js +46 -46
- package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +45 -45
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationimageTotext.stories.js +56 -56
- package/dist/collection/stories/Templates/numberIdentification/numberIdentificationtextTotext.stories.js +53 -53
- package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +127 -127
- package/dist/collection/stories/Templates/openwindow/openwindow.stories.js +47 -47
- package/dist/collection/stories/Templates/openwindow/openwindow2.stories.js +38 -38
- package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +97 -97
- package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +90 -90
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaMultiOption.stories.js +63 -63
- package/dist/collection/stories/Templates/palEgmaCalculateSum/palEgmaSumTogether.stories.js +45 -45
- package/dist/collection/stories/Templates/palEgmaPatternMatching/palEgmaPatternMatching.stories.js +63 -63
- package/dist/collection/stories/Templates/palEgmaWordProblem/palEgmaWordProblem.stories.js +79 -79
- package/dist/collection/stories/Templates/palEgraInventedSpelling/pal_egra_invented_spelling_schema.stories.js +32 -32
- package/dist/collection/stories/Templates/palEgraMCQWithImage/palEgraMCQWithImage.stories.js +42 -42
- package/dist/collection/stories/Templates/palEgraOptionWithAudio/palEgraOptionWithAudio.stories.js +63 -63
- package/dist/collection/stories/Templates/palEgraStoryMaking/pal_egra_story_making.stories.js +44 -44
- package/dist/collection/stories/Templates/palEgraTemplate1/palEgraLetterIdentification.stories.js +34 -34
- package/dist/collection/stories/Templates/palEgraWordMatch/palEgraWordMatch.stories.js +52 -52
- package/dist/collection/stories/Templates/palEgra_OddOneOut/palEgra_oddOneOut.stories.js +33 -33
- package/dist/collection/stories/Templates/palEgra_arrange_pictures/palEgra_arrange_pictures.stories.js +40 -40
- package/dist/collection/stories/Templates/palEgra_build_word/palEgra_build_word.stories.js +48 -48
- package/dist/collection/stories/Templates/palEgra_word_formation/palEgra_WordFormation.stories.js +48 -48
- package/dist/collection/stories/Templates/palStorytale/palStorytale.stories.js +18 -18
- package/dist/collection/stories/Templates/phonic-tractor/phonic-tractor.stories.js +44 -44
- package/dist/collection/stories/Templates/pictureClues/pictureClues.stories.js +34 -34
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch1.stories.js +36 -36
- package/dist/collection/stories/Templates/pictureWordMatch/pictureWordMatch2.stories.js +30 -30
- package/dist/collection/stories/Templates/picturemeaning/pictureMeaningCocos.stories.js +20 -20
- package/dist/collection/stories/Templates/puzzleGame/puzzleGame.stories.js +17 -17
- package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +58 -58
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracy.stories.js +50 -50
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWithText.stories.js +36 -36
- package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWord.stories.js +43 -43
- package/dist/collection/stories/Templates/quizMaths/quizMaths.stories.js +631 -631
- package/dist/collection/stories/Templates/reorder/reorder.stories.js +63 -63
- package/dist/collection/stories/Templates/rowBlocks/rowBlocks.stories.js +47 -47
- package/dist/collection/stories/Templates/sentenceMatch/sentenceMatch.stories.js +29 -29
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +64 -64
- package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +62 -62
- package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +106 -106
- package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +50 -50
- package/dist/collection/stories/Templates/spellDoor/spellDoor.stories.js +41 -41
- package/dist/collection/stories/Templates/storyTale/storyTale.stories.js +39 -39
- package/dist/collection/stories/Templates/substraction/substractionWithimg.stories.js +62 -62
- package/dist/collection/stories/Templates/substraction/substractionWithoutImg.stories.js +42 -42
- package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +50 -50
- package/dist/collection/stories/Templates/tenBox/tenBox.stories.js +88 -88
- package/dist/collection/stories/Templates/total/total.stories.js +28 -28
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithimg.stories.js +35 -35
- package/dist/collection/stories/Templates/wordBuilding/wordBuildingwithoutimg.stories.js +34 -34
- package/dist/collection/stories/Templates/writeCard/writeCard.stories.js +31 -31
- package/dist/collection/stories/Templates/writeLetter/writeLetter.stories.js +58 -58
- package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +44 -44
- package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +31 -31
- package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +34 -34
- package/dist/collection/stories/components/flash-card.stories.js +48 -48
- package/dist/collection/stories/components/keyboard.stories.js +10 -10
- package/dist/collection/stories/components/slider.stories.js +4 -4
- package/dist/collection/stories/components/trace.stories.js +5 -5
- package/dist/collection/utils/audioPlayer.js +7 -4
- package/dist/collection/utils/utils.js +70 -14
- package/dist/collection/utils/utilsHandlers/clickHandler.js +4 -3
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +137 -28
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +56 -56
- package/dist/collection/utils/utilsHandlers/slideHandler.js +17 -8
- package/dist/collection/utils/utilsHandlers/sortHandler.js +10 -10
- 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-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 +1 -1
- 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-B-mIxynb.js +1 -0
- package/dist/components/{p-DdQ1eqJr.js → p-B8nzzM8c.js} +1 -1
- package/dist/components/{p-D2GhaM-T.js → p-Bv1hunWk.js} +1 -1
- package/dist/components/{p-DDS30M3y.js → p-C-pHQRbp.js} +1 -1
- package/dist/components/{p-CPYnt0P-.js → p-C5WmmkI6.js} +1 -1
- package/dist/components/{p-useuhkjH.js → p-C70ykycD.js} +1 -1
- package/dist/components/{p-CFzvgrMa.js → p-CFPSty2U.js} +1 -1
- package/dist/components/p-CFWohOId.js +1 -0
- package/dist/components/{p-BfwUqpXc.js → p-CTlcpv4a.js} +1 -1
- package/dist/components/{p-CyGxEcn7.js → p-CXHPZN3m.js} +1 -1
- package/dist/components/{p-Bw-OC9iR.js → p-CgsPIpg0.js} +1 -1
- package/dist/components/{p-ChfVUoX4.js → p-CsDu4kiC.js} +1 -1
- package/dist/components/{p-CwDTdXe5.js → p-DG0KR2iN.js} +1 -1
- package/dist/components/p-DLyacZap.js +1 -0
- package/dist/components/{p-BiBt9LGP.js → p-DNo3iX_r.js} +1 -1
- package/dist/components/p-DONbWJGn.js +1 -0
- package/dist/components/p-DXy70SGv.js +1 -0
- package/dist/components/{p-CkxAm8rY.js → p-DfjbSSI2.js} +2 -2
- package/dist/components/{p-BJiyBHYT.js → p-Gwko4CTL.js} +1 -1
- package/dist/components/p-uuyVO2B1.js +1 -0
- package/dist/esm/{decode-DkSXjv7K.js → decode-CyhHNDvT.js} +1 -1
- package/dist/esm/{index-D9-TTsdZ.js → index-CndbFQ5I.js} +276 -98
- package/dist/esm/{index-Dvjbti-h.js → index-mMpK8062.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/lido-avatar_22.entry.js +231 -59
- package/dist/esm/lido-player.js +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/lido-player/assets/Shadow.svg +9 -9
- package/dist/lido-player/assets/Tracing-hand.svg +8 -8
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-avatar.css +4 -4
- package/dist/lido-player/lido-avatar.tsx +214 -207
- package/dist/lido-player/lido-player.css +7 -7
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-77iyGppv.js +1 -0
- package/dist/lido-player/p-d760e67b.entry.js +12 -0
- package/dist/lido-player/{p-Dc8j8Hxw.js → p-etMb7U6W.js} +1 -1
- package/dist/lido-player/p-mMpK8062.js +2 -0
- package/dist/lido-player/readme.md +49 -49
- package/dist/types/components/container/lido-container.d.ts +4 -0
- package/dist/types/components/flashCard/lido-flash-card.d.ts +17 -0
- package/dist/types/types/json.d.ts +3 -3
- package/dist/types/utils/audioPlayer.d.ts +2 -1
- package/dist/types/utils/utils.d.ts +5 -1
- package/dist/types/utils/utilsHandlers/clickHandler.d.ts +1 -0
- package/dist/types/utils/utilsHandlers/slideHandler.d.ts +1 -1
- package/package.json +73 -74
- package/readme.md +113 -113
- package/dist/components/p-BUfCIPRa.js +0 -1
- package/dist/components/p-DP6jQ5ML.js +0 -1
- package/dist/components/p-DZRNZCPt.js +0 -1
- package/dist/components/p-DbR5sNOj.js +0 -1
- package/dist/components/p-leIEepjl.js +0 -1
- package/dist/components/p-u3czV7QM.js +0 -1
- package/dist/lido-player/p-35fa0b8b.entry.js +0 -12
- package/dist/lido-player/p-D2iINRNN.js +0 -1
- package/dist/lido-player/p-Dvjbti-h.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$1 = require('./index-
|
|
3
|
+
var index$1 = require('./index-DBCFoh1I.js');
|
|
4
4
|
|
|
5
5
|
const DragMapKey = 'lidoDragMap';
|
|
6
6
|
const SelectedValuesKey = 'lidoSelectedValues';
|
|
@@ -453,6 +453,19 @@ function enableDraggingWithScaling(element) {
|
|
|
453
453
|
let clone = null;
|
|
454
454
|
let duplicateElement = null;
|
|
455
455
|
let mutationFlag = false;
|
|
456
|
+
let pendingMoveFrame = null;
|
|
457
|
+
let latestClientX = 0;
|
|
458
|
+
let latestClientY = 0;
|
|
459
|
+
let hasPendingMove = false;
|
|
460
|
+
let touchTransformUpdated = false;
|
|
461
|
+
let touchDragScale = 1;
|
|
462
|
+
let touchDragScaleY = 1;
|
|
463
|
+
let touchOffsetX = 0;
|
|
464
|
+
let touchOffsetY = 0;
|
|
465
|
+
let touchStartElementLeft = 0;
|
|
466
|
+
let touchStartElementTop = 0;
|
|
467
|
+
let touchStartRect = null;
|
|
468
|
+
let isTouchDragging = false;
|
|
456
469
|
// Fetch the container element
|
|
457
470
|
const container = document.getElementById(LidoContainer);
|
|
458
471
|
if (!container) {
|
|
@@ -463,6 +476,33 @@ function enableDraggingWithScaling(element) {
|
|
|
463
476
|
return;
|
|
464
477
|
handlingElementFlexibleWidth(element, 'drag');
|
|
465
478
|
let dragingElementTransform;
|
|
479
|
+
const getContainerScale = () => {
|
|
480
|
+
const transform = window.getComputedStyle(container).transform;
|
|
481
|
+
const matrix3dMatch = transform.match(/matrix3d\(([^)]+)\)/);
|
|
482
|
+
const matrixMatch = transform.match(/matrix\(([^)]+)\)/);
|
|
483
|
+
if (matrix3dMatch) {
|
|
484
|
+
const values = matrix3dMatch[1].split(',').map(value => parseFloat(value.trim()));
|
|
485
|
+
return {
|
|
486
|
+
scaleX: Math.sqrt(values[0] ** 2 + values[1] ** 2) || 1,
|
|
487
|
+
scaleY: Math.sqrt(values[4] ** 2 + values[5] ** 2) || 1,
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
if (matrixMatch) {
|
|
491
|
+
const values = matrixMatch[1].split(',').map(value => parseFloat(value.trim()));
|
|
492
|
+
return {
|
|
493
|
+
scaleX: Math.sqrt(values[0] ** 2 + values[1] ** 2) || 1,
|
|
494
|
+
scaleY: Math.sqrt(values[2] ** 2 + values[3] ** 2) || 1,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
return { scaleX: 1, scaleY: 1 };
|
|
498
|
+
};
|
|
499
|
+
const updateTouchDragScale = () => {
|
|
500
|
+
if (isTouchDragging) {
|
|
501
|
+
const { scaleX, scaleY } = getContainerScale();
|
|
502
|
+
touchDragScale = scaleX;
|
|
503
|
+
touchDragScaleY = scaleY;
|
|
504
|
+
}
|
|
505
|
+
};
|
|
466
506
|
const onStart = (event) => {
|
|
467
507
|
var _a, _b;
|
|
468
508
|
if (container && container.getAttribute("game-completed") === "true")
|
|
@@ -479,17 +519,29 @@ function enableDraggingWithScaling(element) {
|
|
|
479
519
|
if (event instanceof MouseEvent) {
|
|
480
520
|
startX = event.clientX;
|
|
481
521
|
startY = event.clientY;
|
|
522
|
+
touchStartRect = null;
|
|
482
523
|
}
|
|
483
524
|
else {
|
|
484
525
|
startX = event.touches[0].clientX;
|
|
485
526
|
startY = event.touches[0].clientY;
|
|
527
|
+
isTouchDragging = true;
|
|
528
|
+
touchStartRect = element.getBoundingClientRect();
|
|
529
|
+
touchOffsetX = startX - touchStartRect.left;
|
|
530
|
+
touchOffsetY = startY - touchStartRect.top;
|
|
531
|
+
touchStartElementLeft = touchStartRect.left;
|
|
532
|
+
touchStartElementTop = touchStartRect.top;
|
|
533
|
+
const { scaleX, scaleY } = getContainerScale();
|
|
534
|
+
touchDragScale = scaleX;
|
|
535
|
+
touchDragScaleY = scaleY;
|
|
536
|
+
element.style.willChange = 'transform';
|
|
537
|
+
window.addEventListener('resize', updateTouchDragScale);
|
|
486
538
|
}
|
|
487
539
|
// Apply dragging styles to the element
|
|
488
540
|
element.style.opacity = '1';
|
|
489
541
|
element.style.cursor = 'grabbing';
|
|
490
542
|
if (((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) {
|
|
491
543
|
const computedStyle = window.getComputedStyle(element);
|
|
492
|
-
const rect = element.getBoundingClientRect();
|
|
544
|
+
const rect = touchStartRect || element.getBoundingClientRect();
|
|
493
545
|
if (!clone) {
|
|
494
546
|
clone = element.cloneNode(true);
|
|
495
547
|
clone.style.left = `${rect.left}px`;
|
|
@@ -508,7 +560,7 @@ function enableDraggingWithScaling(element) {
|
|
|
508
560
|
const imgElement = element.querySelector('img');
|
|
509
561
|
const src = imgElement === null || imgElement === void 0 ? void 0 : imgElement.getAttribute('src');
|
|
510
562
|
const computedStyle = window.getComputedStyle(element);
|
|
511
|
-
const rect = element.getBoundingClientRect();
|
|
563
|
+
const rect = touchStartRect || element.getBoundingClientRect();
|
|
512
564
|
if (!duplicateElement) {
|
|
513
565
|
duplicateElement = element.cloneNode(false);
|
|
514
566
|
duplicateElement.setAttribute('src', src);
|
|
@@ -581,31 +633,31 @@ function enableDraggingWithScaling(element) {
|
|
|
581
633
|
target.style.opacity = value;
|
|
582
634
|
}
|
|
583
635
|
};
|
|
584
|
-
const
|
|
585
|
-
|
|
636
|
+
const processMove = () => {
|
|
637
|
+
pendingMoveFrame = null;
|
|
638
|
+
if (!isDragging || !hasPendingMove)
|
|
586
639
|
return;
|
|
640
|
+
hasPendingMove = false;
|
|
641
|
+
const deferTouchDropValidation = touchTransformUpdated;
|
|
587
642
|
if (isDraggingDisabled) {
|
|
588
643
|
isDragging = false;
|
|
644
|
+
touchTransformUpdated = false;
|
|
589
645
|
return;
|
|
590
646
|
}
|
|
591
|
-
isClicked = false;
|
|
592
647
|
element.style.transition = 'none';
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
const newTop = initialY + dy;
|
|
607
|
-
// Apply transform with translation without boundaries
|
|
608
|
-
element.style.transform = `translate(${newLeft}px, ${newTop}px)`;
|
|
648
|
+
if (!touchTransformUpdated) {
|
|
649
|
+
const containerScale = calculateScale();
|
|
650
|
+
const dx = (latestClientX - startX) / containerScale;
|
|
651
|
+
const dy = (latestClientY - startY) / containerScale;
|
|
652
|
+
// Calculate the new position considering scaling
|
|
653
|
+
const newLeft = initialX + dx;
|
|
654
|
+
const newTop = initialY + dy;
|
|
655
|
+
// Apply transform with translation without boundaries
|
|
656
|
+
element.style.transform = `translate(${newLeft}px, ${newTop}px)`;
|
|
657
|
+
}
|
|
658
|
+
touchTransformUpdated = false;
|
|
659
|
+
if (deferTouchDropValidation)
|
|
660
|
+
return;
|
|
609
661
|
// Check for overlaps and highlight only the most overlapping element
|
|
610
662
|
let mostOverlappedElement = findMostoverlappedElement$1(element, 'drop');
|
|
611
663
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
@@ -644,6 +696,44 @@ function enableDraggingWithScaling(element) {
|
|
|
644
696
|
}
|
|
645
697
|
}
|
|
646
698
|
};
|
|
699
|
+
const onMove = (event) => {
|
|
700
|
+
if (!isDragging)
|
|
701
|
+
return;
|
|
702
|
+
if (isDraggingDisabled) {
|
|
703
|
+
isDragging = false;
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
if (event instanceof MouseEvent) {
|
|
707
|
+
touchTransformUpdated = false;
|
|
708
|
+
latestClientX = event.clientX;
|
|
709
|
+
latestClientY = event.clientY;
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
const touch = event.touches[0];
|
|
713
|
+
if (!touch)
|
|
714
|
+
return;
|
|
715
|
+
latestClientX = touch.clientX;
|
|
716
|
+
latestClientY = touch.clientY;
|
|
717
|
+
}
|
|
718
|
+
if (!(event instanceof MouseEvent)) {
|
|
719
|
+
element.style.transition = 'none';
|
|
720
|
+
const desiredLeft = latestClientX - touchOffsetX;
|
|
721
|
+
const desiredTop = latestClientY - touchOffsetY;
|
|
722
|
+
const dx = (desiredLeft - touchStartElementLeft) / touchDragScale;
|
|
723
|
+
const dy = (desiredTop - touchStartElementTop) / touchDragScaleY;
|
|
724
|
+
const newLeft = initialX + dx;
|
|
725
|
+
const newTop = initialY + dy;
|
|
726
|
+
element.style.transform = `translate3d(${newLeft}px, ${newTop}px, 0)`;
|
|
727
|
+
touchTransformUpdated = true;
|
|
728
|
+
}
|
|
729
|
+
isClicked = false;
|
|
730
|
+
if (event instanceof MouseEvent) {
|
|
731
|
+
hasPendingMove = true;
|
|
732
|
+
if (pendingMoveFrame === null) {
|
|
733
|
+
pendingMoveFrame = requestAnimationFrame(processMove);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
};
|
|
647
737
|
let lastOverlappedElement = null;
|
|
648
738
|
const removeDocumentDragListeners = () => {
|
|
649
739
|
document.removeEventListener('mousemove', onMove);
|
|
@@ -651,9 +741,19 @@ function enableDraggingWithScaling(element) {
|
|
|
651
741
|
document.removeEventListener('touchmove', onMove);
|
|
652
742
|
document.removeEventListener('touchend', onEnd);
|
|
653
743
|
};
|
|
744
|
+
const flushPendingMove = () => {
|
|
745
|
+
if (pendingMoveFrame === null)
|
|
746
|
+
return;
|
|
747
|
+
cancelAnimationFrame(pendingMoveFrame);
|
|
748
|
+
processMove();
|
|
749
|
+
};
|
|
654
750
|
const onEnd = (endEv) => {
|
|
655
751
|
var _a, _b, _c;
|
|
752
|
+
flushPendingMove();
|
|
656
753
|
isDragging = false;
|
|
754
|
+
isTouchDragging = false;
|
|
755
|
+
element.style.willChange = '';
|
|
756
|
+
window.removeEventListener('resize', updateTouchDragScale);
|
|
657
757
|
removeDocumentDragListeners();
|
|
658
758
|
if (isClicked) {
|
|
659
759
|
if (clone) {
|
|
@@ -759,6 +859,15 @@ function enableDraggingWithScaling(element) {
|
|
|
759
859
|
};
|
|
760
860
|
const cleanup = () => {
|
|
761
861
|
isDragging = false;
|
|
862
|
+
isTouchDragging = false;
|
|
863
|
+
element.style.willChange = '';
|
|
864
|
+
window.removeEventListener('resize', updateTouchDragScale);
|
|
865
|
+
if (pendingMoveFrame !== null) {
|
|
866
|
+
cancelAnimationFrame(pendingMoveFrame);
|
|
867
|
+
pendingMoveFrame = null;
|
|
868
|
+
}
|
|
869
|
+
hasPendingMove = false;
|
|
870
|
+
touchTransformUpdated = false;
|
|
762
871
|
observer.disconnect();
|
|
763
872
|
removeDocumentDragListeners();
|
|
764
873
|
element.removeEventListener('mousedown', onStart);
|
|
@@ -1242,14 +1351,14 @@ async function onClickDropOrDragElement(element, type) {
|
|
|
1242
1351
|
if (!document.querySelector('#dynamic-highlight-style')) {
|
|
1243
1352
|
const style = document.createElement('style');
|
|
1244
1353
|
style.id = 'dynamic-highlight-style';
|
|
1245
|
-
style.innerHTML = `
|
|
1246
|
-
.highlight {
|
|
1247
|
-
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
1248
|
-
// border-radius: 12px; /* Larger rounded corners */
|
|
1249
|
-
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
1250
|
-
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
1251
|
-
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
1252
|
-
}
|
|
1354
|
+
style.innerHTML = `
|
|
1355
|
+
.highlight {
|
|
1356
|
+
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
1357
|
+
// border-radius: 12px; /* Larger rounded corners */
|
|
1358
|
+
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
1359
|
+
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
1360
|
+
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
1361
|
+
}
|
|
1253
1362
|
`;
|
|
1254
1363
|
document.head.appendChild(style);
|
|
1255
1364
|
}
|
|
@@ -1437,34 +1546,34 @@ function highlightSpeakingElement(element) {
|
|
|
1437
1546
|
if (!document.getElementById(styleId)) {
|
|
1438
1547
|
const style = document.createElement('style');
|
|
1439
1548
|
style.id = styleId;
|
|
1440
|
-
style.innerHTML = `
|
|
1441
|
-
.speaking-highlight {
|
|
1442
|
-
--base-transform: ${element.style.transform};
|
|
1443
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
|
|
1444
|
-
// border: 3px solid green !important;
|
|
1445
|
-
// transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
|
|
1446
|
-
// transform: scale(1.05); /* Subtle scale effect to pop the element */
|
|
1447
|
-
// animation: pulseEffect 1.5s infinite; /* Pulsing animation */
|
|
1448
|
-
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
@keyframes pulseEffect {
|
|
1452
|
-
0% {
|
|
1453
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1454
|
-
// transform: var(--base-transform) scale(1.05);
|
|
1455
|
-
// background-color: #FFFF0B;
|
|
1456
|
-
}
|
|
1457
|
-
50% {
|
|
1458
|
-
box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
|
|
1459
|
-
// transform: var(--base-transform) scale(1.1);
|
|
1460
|
-
// background-color: #FFFF0B;
|
|
1461
|
-
}
|
|
1462
|
-
100% {
|
|
1463
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1464
|
-
// transform: var(--base-transform) scale(1.05);
|
|
1465
|
-
// background-color: #FFFF0B;
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1549
|
+
style.innerHTML = `
|
|
1550
|
+
.speaking-highlight {
|
|
1551
|
+
--base-transform: ${element.style.transform};
|
|
1552
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
|
|
1553
|
+
// border: 3px solid green !important;
|
|
1554
|
+
// transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
|
|
1555
|
+
// transform: scale(1.05); /* Subtle scale effect to pop the element */
|
|
1556
|
+
// animation: pulseEffect 1.5s infinite; /* Pulsing animation */
|
|
1557
|
+
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
@keyframes pulseEffect {
|
|
1561
|
+
0% {
|
|
1562
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1563
|
+
// transform: var(--base-transform) scale(1.05);
|
|
1564
|
+
// background-color: #FFFF0B;
|
|
1565
|
+
}
|
|
1566
|
+
50% {
|
|
1567
|
+
box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
|
|
1568
|
+
// transform: var(--base-transform) scale(1.1);
|
|
1569
|
+
// background-color: #FFFF0B;
|
|
1570
|
+
}
|
|
1571
|
+
100% {
|
|
1572
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1573
|
+
// transform: var(--base-transform) scale(1.05);
|
|
1574
|
+
// background-color: #FFFF0B;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1468
1577
|
`;
|
|
1469
1578
|
document.head.appendChild(style);
|
|
1470
1579
|
}
|
|
@@ -1481,10 +1590,10 @@ function stopHighlightForSpeakingElement(element) {
|
|
|
1481
1590
|
}
|
|
1482
1591
|
function highlightElement() {
|
|
1483
1592
|
const container = document.querySelector(LidoContainer);
|
|
1484
|
-
if (container.getAttribute("template-id") === "blender")
|
|
1485
|
-
return;
|
|
1486
1593
|
if (!container)
|
|
1487
1594
|
return;
|
|
1595
|
+
if (container.getAttribute("template-id") === "blender")
|
|
1596
|
+
return;
|
|
1488
1597
|
const dropElements = buildDropHasDragFromDOM();
|
|
1489
1598
|
const dropEls = container.querySelectorAll(`[type="drop"]`);
|
|
1490
1599
|
dropEls.forEach(dropEl => {
|
|
@@ -1541,6 +1650,7 @@ class AudioPlayer {
|
|
|
1541
1650
|
this.currentTargetElement = null;
|
|
1542
1651
|
this.pendingReplayElement = null;
|
|
1543
1652
|
this.playbackHasStarted = false;
|
|
1653
|
+
this.playbackSequence = 0;
|
|
1544
1654
|
this.highlightOverlay = null;
|
|
1545
1655
|
this.wordRects = [];
|
|
1546
1656
|
this.activeWordIndex = -1;
|
|
@@ -1639,7 +1749,7 @@ class AudioPlayer {
|
|
|
1639
1749
|
return el;
|
|
1640
1750
|
return el.closest('lido-text');
|
|
1641
1751
|
}
|
|
1642
|
-
async play(targetElement, suppressHighlight = false) {
|
|
1752
|
+
async play(targetElement, suppressHighlight = false, playbackContext) {
|
|
1643
1753
|
this.registerVisibilityEvents();
|
|
1644
1754
|
this.playbackHasStarted = false;
|
|
1645
1755
|
if (!this.isWindowVisible()) {
|
|
@@ -1651,6 +1761,7 @@ class AudioPlayer {
|
|
|
1651
1761
|
}
|
|
1652
1762
|
this.pendingReplayElement = null;
|
|
1653
1763
|
}
|
|
1764
|
+
const playbackId = ++this.playbackSequence;
|
|
1654
1765
|
// Stop any currently playing audio first if target element has audio given
|
|
1655
1766
|
try {
|
|
1656
1767
|
await AudioPlayer.getI().stop();
|
|
@@ -1674,7 +1785,7 @@ class AudioPlayer {
|
|
|
1674
1785
|
targetElement = textElement;
|
|
1675
1786
|
}
|
|
1676
1787
|
this.currentTargetElement = targetElement;
|
|
1677
|
-
window.dispatchEvent(new CustomEvent('lidoAudioStarted', { detail: { target: targetElement } }));
|
|
1788
|
+
window.dispatchEvent(new CustomEvent('lidoAudioStarted', { detail: { target: targetElement, playbackId, playbackContext } }));
|
|
1678
1789
|
// then play the target element audio.
|
|
1679
1790
|
let audioUrl = targetElement.getAttribute('audio') || '';
|
|
1680
1791
|
// If no direct audio attribute, check childrens for audio
|
|
@@ -1693,6 +1804,7 @@ class AudioPlayer {
|
|
|
1693
1804
|
this.audioElement.src = audioUrl;
|
|
1694
1805
|
this.audioElement.onplaying = () => {
|
|
1695
1806
|
this.playbackHasStarted = true;
|
|
1807
|
+
window.dispatchEvent(new CustomEvent('lidoAudioPlaying', { detail: { target: targetElement, playbackId, playbackContext } }));
|
|
1696
1808
|
};
|
|
1697
1809
|
this.audioElement.onpause = () => {
|
|
1698
1810
|
if (this.playbackHasStarted && !this.audioElement.ended) {
|
|
@@ -1771,13 +1883,13 @@ class AudioPlayer {
|
|
|
1771
1883
|
await this.waitUntilWindowIsVisible();
|
|
1772
1884
|
if (this.pendingReplayElement === targetElement) {
|
|
1773
1885
|
this.pendingReplayElement = null;
|
|
1774
|
-
return this.play(targetElement);
|
|
1886
|
+
return this.play(targetElement, suppressHighlight, playbackContext);
|
|
1775
1887
|
}
|
|
1776
1888
|
}
|
|
1777
1889
|
if (this.currentTargetElement === targetElement) {
|
|
1778
1890
|
this.currentTargetElement = null;
|
|
1779
1891
|
}
|
|
1780
|
-
window.dispatchEvent(new CustomEvent('lidoAudioEnded', { detail: { target: targetElement } }));
|
|
1892
|
+
window.dispatchEvent(new CustomEvent('lidoAudioEnded', { detail: { target: targetElement, playbackId, playbackContext } }));
|
|
1781
1893
|
}
|
|
1782
1894
|
// GLOBAL STOP EVENTS (container change, activity change…)
|
|
1783
1895
|
registerGlobalStopEvents() {
|
|
@@ -2170,11 +2282,11 @@ function enableReorderDrag(element) {
|
|
|
2170
2282
|
onDropToCategory(element, category);
|
|
2171
2283
|
}
|
|
2172
2284
|
if (divEl) {
|
|
2173
|
-
const keyframes = `
|
|
2174
|
-
@keyframes widthDecrease {
|
|
2175
|
-
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
2176
|
-
100% { width: 0px; height: 0px;}
|
|
2177
|
-
}
|
|
2285
|
+
const keyframes = `
|
|
2286
|
+
@keyframes widthDecrease {
|
|
2287
|
+
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
2288
|
+
100% { width: 0px; height: 0px;}
|
|
2289
|
+
}
|
|
2178
2290
|
`;
|
|
2179
2291
|
const styleSheet = document.styleSheets[0];
|
|
2180
2292
|
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
|
|
@@ -2397,11 +2509,11 @@ function moveWithAnimation(target, overlapped) {
|
|
|
2397
2509
|
const dummy = createDummyElement(target);
|
|
2398
2510
|
dummy.style.visibility = 'hidden';
|
|
2399
2511
|
dummy.setAttribute('type', 'dummy');
|
|
2400
|
-
const keyframes = `
|
|
2401
|
-
@keyframes widthIncrease {
|
|
2402
|
-
0% { width: 0px; height: 0px; }
|
|
2403
|
-
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
2404
|
-
}
|
|
2512
|
+
const keyframes = `
|
|
2513
|
+
@keyframes widthIncrease {
|
|
2514
|
+
0% { width: 0px; height: 0px; }
|
|
2515
|
+
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
2516
|
+
}
|
|
2405
2517
|
`;
|
|
2406
2518
|
if (!overlapped) {
|
|
2407
2519
|
const overlapCategory = findMostoverlappedElement(target, 'category');
|
|
@@ -2494,6 +2606,20 @@ async function onDropToCategory(dragElement, categoryElement) {
|
|
|
2494
2606
|
}
|
|
2495
2607
|
|
|
2496
2608
|
const delay = (ms) => new Promise(res => setTimeout(res, ms));
|
|
2609
|
+
const isArrangeLettersContainer = (container) => container.getAttribute('template-id') === 'arrangeLetters';
|
|
2610
|
+
const isReorderContainer = (container) => container.getAttribute('template-id') === 'reorder';
|
|
2611
|
+
const getSlideValuesForValidation = (container, slideElements) => {
|
|
2612
|
+
if (isReorderContainer(container)) {
|
|
2613
|
+
return slideElements.map(element => element.id);
|
|
2614
|
+
}
|
|
2615
|
+
return slideElements.map(element => element['value']);
|
|
2616
|
+
};
|
|
2617
|
+
const syncSlideOrder = (container) => {
|
|
2618
|
+
const slideElements = Array.from(container.querySelectorAll("[type='slide']"));
|
|
2619
|
+
const slideOrder = getSlideValuesForValidation(container, slideElements);
|
|
2620
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(slideOrder));
|
|
2621
|
+
return slideOrder;
|
|
2622
|
+
};
|
|
2497
2623
|
const slideAnimation = async () => {
|
|
2498
2624
|
const container = document.getElementById(LidoContainer);
|
|
2499
2625
|
if (!container)
|
|
@@ -2554,6 +2680,9 @@ function slidingWithScaling(element) {
|
|
|
2554
2680
|
const container = document.getElementById(LidoContainer);
|
|
2555
2681
|
if (container.getAttribute('canplay') === 'false')
|
|
2556
2682
|
return;
|
|
2683
|
+
// Slide activities can start in the correct order. Keep their initial DOM
|
|
2684
|
+
// order available to the Next/check validation before the first swap occurs.
|
|
2685
|
+
syncSlideOrder(container);
|
|
2557
2686
|
const onStart = (event) => {
|
|
2558
2687
|
const templateId = container.getAttribute('template-id');
|
|
2559
2688
|
if ((templateId === 'arrangeLetters' || templateId === 'reorder') && container.getAttribute('game-completed') === 'true')
|
|
@@ -2729,14 +2858,6 @@ function slidingWithScaling(element) {
|
|
|
2729
2858
|
element.addEventListener('touchstart', onStart);
|
|
2730
2859
|
element.addEventListener(LIDO_INTERACTION_CLEANUP_EVENT, cleanup);
|
|
2731
2860
|
}
|
|
2732
|
-
const isArrangeLettersContainer = (container) => container.getAttribute('template-id') === 'arrangeLetters';
|
|
2733
|
-
const isReorderContainer = (container) => container.getAttribute('template-id') === 'reorder';
|
|
2734
|
-
const getSlideValuesForValidation = (container, slideElements) => {
|
|
2735
|
-
if (isReorderContainer(container)) {
|
|
2736
|
-
return slideElements.map(element => element.id);
|
|
2737
|
-
}
|
|
2738
|
-
return slideElements.map(element => element['value']);
|
|
2739
|
-
};
|
|
2740
2861
|
const updateArrangeLettersCorrectness = (container, slideValues, objectiveValues) => {
|
|
2741
2862
|
const slideElements = Array.from(container.querySelectorAll('[type="slide"]'));
|
|
2742
2863
|
slideElements.forEach((element, index) => {
|
|
@@ -4317,11 +4438,12 @@ function addClickListenerForClickType(element) {
|
|
|
4317
4438
|
}, 50);
|
|
4318
4439
|
}
|
|
4319
4440
|
});
|
|
4320
|
-
|
|
4441
|
+
initializeClickableElementStyle(element);
|
|
4321
4442
|
}
|
|
4322
|
-
const
|
|
4443
|
+
const initializeClickableElementStyle = (element) => {
|
|
4323
4444
|
var _a;
|
|
4324
|
-
const
|
|
4445
|
+
const elementHeight = Number.isFinite(element.offsetHeight) ? element.offsetHeight : 0;
|
|
4446
|
+
const elementShadow = elementHeight * 0.08;
|
|
4325
4447
|
const backGroundColor = ((_a = element.style) === null || _a === void 0 ? void 0 : _a.backgroundColor) || '#FFB742';
|
|
4326
4448
|
element.style.setProperty('--btn-bg-color', backGroundColor);
|
|
4327
4449
|
element.style.setProperty('--btn-shadow-px', `0px ${elementShadow}px 0px`);
|
|
@@ -72755,6 +72877,34 @@ function getSortedValuesArrayFromMap(map) {
|
|
|
72755
72877
|
function format(first, middle, last) {
|
|
72756
72878
|
return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
|
|
72757
72879
|
}
|
|
72880
|
+
// These actions have side effects beyond declarative element styling. They must
|
|
72881
|
+
// not run while the player is being displayed in edit mode.
|
|
72882
|
+
const nonVisualActions = new Set([
|
|
72883
|
+
'revealImageValue',
|
|
72884
|
+
'scrollCellAfterEquationSolved',
|
|
72885
|
+
'alignMatch',
|
|
72886
|
+
'removeClone',
|
|
72887
|
+
'speak',
|
|
72888
|
+
'fill-slide',
|
|
72889
|
+
'nextBtn',
|
|
72890
|
+
'prevBtn',
|
|
72891
|
+
'stop',
|
|
72892
|
+
'sleep',
|
|
72893
|
+
'avatarAnimate',
|
|
72894
|
+
'cellBorderAnimate',
|
|
72895
|
+
'vibrate',
|
|
72896
|
+
'highlightStarsAndDisapper',
|
|
72897
|
+
'boxAnimationOneByOne',
|
|
72898
|
+
'questionBoxAnimate',
|
|
72899
|
+
'slideAnimation',
|
|
72900
|
+
'showBalanceSymbol',
|
|
72901
|
+
'hideBalanceSymbol',
|
|
72902
|
+
'sumTogetherAnimation',
|
|
72903
|
+
'addText',
|
|
72904
|
+
'disableType',
|
|
72905
|
+
'updateCountBlender',
|
|
72906
|
+
'updateCalculatorAnswer',
|
|
72907
|
+
]);
|
|
72758
72908
|
const initEventsForElement = async (element, type) => {
|
|
72759
72909
|
const container = document.getElementById(LidoContainer);
|
|
72760
72910
|
if (!container) {
|
|
@@ -72764,10 +72914,29 @@ const initEventsForElement = async (element, type) => {
|
|
|
72764
72914
|
return;
|
|
72765
72915
|
}
|
|
72766
72916
|
const onEntry = element.getAttribute('onEntry');
|
|
72767
|
-
|
|
72917
|
+
const canPlay = container.getAttribute('canplay') !== 'false';
|
|
72918
|
+
await executeActions(onEntry, element, undefined, { visualOnly: !canPlay });
|
|
72919
|
+
// Free movement is an editor interaction and is intentionally available in
|
|
72920
|
+
// edit mode; all gameplay handlers below remain disabled there.
|
|
72768
72921
|
if (element.getAttribute('move') === 'true') {
|
|
72769
72922
|
enableFreeMove(element);
|
|
72770
72923
|
}
|
|
72924
|
+
// The click visual treatment is independent from the click listener. Edit
|
|
72925
|
+
// mode needs the class and custom properties that draw the configured button
|
|
72926
|
+
// background/shadow, but must not install answer-selection behavior.
|
|
72927
|
+
if (!canPlay && type === 'click') {
|
|
72928
|
+
initializeClickableElementStyle(element);
|
|
72929
|
+
}
|
|
72930
|
+
// Edit mode still needs visual initialization, but must not install any
|
|
72931
|
+
// gameplay or touch handlers. In play mode, avoid duplicating listeners if a
|
|
72932
|
+
// component invokes its load hook more than once.
|
|
72933
|
+
if (!canPlay)
|
|
72934
|
+
return;
|
|
72935
|
+
const initializedElement = element;
|
|
72936
|
+
const initializationKey = `${type || ''}:${canPlay}`;
|
|
72937
|
+
if (initializedElement.__lidoInitializationKey === initializationKey)
|
|
72938
|
+
return;
|
|
72939
|
+
initializedElement.__lidoInitializationKey = initializationKey;
|
|
72771
72940
|
switch (type) {
|
|
72772
72941
|
case 'drag': {
|
|
72773
72942
|
enableDraggingWithScaling(element);
|
|
@@ -72805,12 +72974,14 @@ const initEventsForElement = async (element, type) => {
|
|
|
72805
72974
|
onTouchListenerForOnTouch(element);
|
|
72806
72975
|
};
|
|
72807
72976
|
// Function to execute actions parsed from the onMatch string
|
|
72808
|
-
const executeActions = async (actionsString, thisElement, element) => {
|
|
72809
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
72977
|
+
const executeActions = async (actionsString, thisElement, element, options = {}) => {
|
|
72978
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
72810
72979
|
const actions = parseActions(actionsString);
|
|
72811
72980
|
// body.style.pointerEvents = 'none';
|
|
72812
72981
|
for (let i = 0; i < actions.length; i++) {
|
|
72813
72982
|
const action = actions[i];
|
|
72983
|
+
if (options.visualOnly && nonVisualActions.has(action.action))
|
|
72984
|
+
continue;
|
|
72814
72985
|
const queriedElement = document.querySelector(action.actor);
|
|
72815
72986
|
const targetElement = action.actor === 'this' ? thisElement : action.actor === 'element' ? element : queriedElement ? queriedElement : document.getElementById(action.actor);
|
|
72816
72987
|
if (targetElement) {
|
|
@@ -72931,7 +73102,14 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
72931
73102
|
const riveService = RiveService.getInstance();
|
|
72932
73103
|
const riveInstance = riveService.getRiveInstance();
|
|
72933
73104
|
if (riveInstance && action.value) {
|
|
72934
|
-
riveInstance
|
|
73105
|
+
const input = (_b = riveInstance
|
|
73106
|
+
.stateMachineInputs('State Machine 1')) === null || _b === void 0 ? void 0 : _b.find(input => input.name === action.value);
|
|
73107
|
+
if (input) {
|
|
73108
|
+
input.fire();
|
|
73109
|
+
}
|
|
73110
|
+
else {
|
|
73111
|
+
console.warn(`Avatar reaction input "${action.value}" was not found in State Machine 1.`);
|
|
73112
|
+
}
|
|
72935
73113
|
}
|
|
72936
73114
|
break;
|
|
72937
73115
|
}
|
|
@@ -72978,8 +73156,8 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
72978
73156
|
const balanceEl = document.querySelector('lido-balance');
|
|
72979
73157
|
if (!balanceEl)
|
|
72980
73158
|
break;
|
|
72981
|
-
const leftVal = Number((
|
|
72982
|
-
const rightVal = Number((
|
|
73159
|
+
const leftVal = Number((_c = balanceEl.leftVal) !== null && _c !== void 0 ? _c : Number((_e = (_d = balanceEl.dataset) === null || _d === void 0 ? void 0 : _d.leftVal) !== null && _e !== void 0 ? _e : 0));
|
|
73160
|
+
const rightVal = Number((_f = balanceEl.rightVal) !== null && _f !== void 0 ? _f : Number((_h = (_g = balanceEl.dataset) === null || _g === void 0 ? void 0 : _g.rightVal) !== null && _h !== void 0 ? _h : 0));
|
|
72983
73161
|
const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
|
|
72984
73162
|
balanceEl.balanceSymbol = symbol;
|
|
72985
73163
|
balanceEl.dataset.balanceSymbol = symbol;
|
|
@@ -73099,11 +73277,11 @@ const afterDropDragHandling = (dragElement, dropElement) => {
|
|
|
73099
73277
|
}
|
|
73100
73278
|
dummyElement.setAttribute('id', dragElement.getAttribute('id'));
|
|
73101
73279
|
dragElement.replaceWith(dummyElement);
|
|
73102
|
-
const keyframes = `
|
|
73103
|
-
@keyframes widthDecrease {
|
|
73104
|
-
0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
|
|
73105
|
-
100% { width: 0px; height: 0px; margin: 0px;}
|
|
73106
|
-
}
|
|
73280
|
+
const keyframes = `
|
|
73281
|
+
@keyframes widthDecrease {
|
|
73282
|
+
0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
|
|
73283
|
+
100% { width: 0px; height: 0px; margin: 0px;}
|
|
73284
|
+
}
|
|
73107
73285
|
`;
|
|
73108
73286
|
if (!isInfinite) {
|
|
73109
73287
|
dummyElement.style.width = element.style.width;
|
|
@@ -73454,7 +73632,7 @@ const storeActivityScore = (score) => {
|
|
|
73454
73632
|
activityScore[activityScoreKey] = score;
|
|
73455
73633
|
//send Custom Event to parent
|
|
73456
73634
|
// window.dispatchEvent(new CustomEvent(ActivityEndKey, { detail: { index: index, totalIndex: totalIndex, score: score } }));
|
|
73457
|
-
const actualActivitySeconds =
|
|
73635
|
+
const actualActivitySeconds = Number((Timer.getI().getElapsed() / 1000).toFixed(1));
|
|
73458
73636
|
ACTIVYTY_TIME_SPEND_ARRAY.push(actualActivitySeconds);
|
|
73459
73637
|
console.log(`[Utils][Activity Time] Activity ${index + 1}/${totalIndex} - Time spent: ${actualActivitySeconds}s`);
|
|
73460
73638
|
const lessonTrackingParams = getLessonTrackingParams();
|
|
@@ -73466,7 +73644,7 @@ const storeActivityScore = (score) => {
|
|
|
73466
73644
|
gameScore.finalScore = Math.floor(finalScore);
|
|
73467
73645
|
console.log('Total Score : ', gameScore.finalScore);
|
|
73468
73646
|
// window.dispatchEvent(new CustomEvent(LessonEndKey, { detail: { score: finalScore } }));
|
|
73469
|
-
const timeSpendForLesson = ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0);
|
|
73647
|
+
const timeSpendForLesson = Number(ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0).toFixed(1));
|
|
73470
73648
|
console.log(`[Utils][Lesson Time] Total lesson time spent: ${timeSpendForLesson}s`);
|
|
73471
73649
|
dispatchLessonEndEvent(totalIndex, gameScore.totalRightMovesCount, gameScore.totalWrongMovesCount, finalScore, timeSpendForLesson, lessonTrackingParams);
|
|
73472
73650
|
gameScore.totalRightMovesCount = 0;
|
|
@@ -22,7 +22,7 @@ const NAMESPACE = 'lido-player';
|
|
|
22
22
|
const BUILD = /* lido-player */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, slotRelocation: true, state: true, updatable: true};
|
|
23
23
|
|
|
24
24
|
const globalScripts = () => {};
|
|
25
|
-
const globalStyles = "@font-face{font-family:'Baloo Bhai 2';font-style:normal;font-weight:400 800;font-display:swap;src:url('../assets/offline-assets/fonts/Baloo-Bhai-2/Baloo-Bhai-2-Variable.woff2') format('woff2')}body{overflow:hidden;background-position:center;background-size:cover;background-repeat:no-repeat;height:100vh}*{user-select:none}.lido-disable-check-button{pointer-events:none;background-color:#9393935c !important;color:white}.lido-element-selected{border:2px solid;background-color:#ffdf7d !important}.diagonal-target,.diagonal-drop *{transform:scale(0.8) !important;opacity:1 !important}.cloned-element{display:flex !important;position:absolute !important;filter:grayscale(100%);pointer-events:none}.removeShadow{box-shadow:0px 0px 0px 0px #ff8900 !important}.highlight-element{border:2px solid white;box-shadow:rgb(243, 77, 8) 0px 0px 40px !important}.drop-element.empty{border:4px dashed #f34d08 !important}.drop-element.filled{border:'none' !important}.drag-element{box-shadow:0px 15px 11px rgba(43, 0, 0, 0.3) !important}.drag-element.dropped{box-shadow:none !important}.click-element{background-color:var(--btn-bg-color, rgba(255, 172, 76, 1)) !important;box-shadow:var(--btn-shadow-px) var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;cursor:pointer;transition:box-shadow 0.1s ease-out, transform 0.2s ease-out;}.click-element:active{box-shadow:0px 0px 0px var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;transform:translateY(var(--btn-active));}.click-element:focus{outline:2px solid dodgerblue;outline-offset:3px}.after-drop-popup-container{width:200%;height:200%;background-color:rgba(0, 0, 0, 0.8);position:absolute;display:flex;flex-direction:row-reverse;align-items:center;justify-content:center !important;gap:80px}.after-drop-popup-drag-element{scale:1.5;border-radius:8px;transform:none !important;position:unset !important}.after-drop-popup-drop-element{scale:1.5;border:unset;border-radius:8px;transform:none !important;position:unset !important}@keyframes zoomFadeIn{0%{transform:scale(0.6);opacity:0}100%{transform:scale(1);opacity:1}}.zoom-fade-in{animation:zoomFadeIn 0.8s ease-out forwards}@keyframes zoomFadeOut{0%{transform:scale(1);opacity:1}100%{transform:scale(0.6);opacity:0}}.zoom-fade-out{animation:zoomFadeOut 0.8s ease-in forwards}.slide-numbers{width:70px;height:70px;border:1px solid #f57139;background-color:white;font-weight:500;color:#f57139;font-size:44px;border-radius:40px;display:flex;align-items:center;justify-content:center;font-family:'Baloo Bhai 2', serif}.slide-numbers-bottom{position:absolute;display:flex;justify-content:space-around;align-items:center;bottom:-25px;width:100%;height:50px}.slide-numbers-left{position:absolute;display:flex;flex-direction:column;justify-content:space-around;height:100%;width:50px;left:-25px;bottom:0px}.lido-speak-icon{width:56px;height:56px;position:absolute;top:-25px;right:-25px;z-index:10;background-color:white;border:4px solid #F34D08;border-radius:16px;box-shadow:0px 4px 0px 0px #F34D08;background-size:contain;background-repeat:no-repeat;cursor:pointer}.lido-speak-icon:active{transform:translateY(8px);box-shadow:0px 0px 0px 0px !important}.lido-strong-shake{animation:strongShake 0.3s ease}.lido-scaled-shake{animation:scaledShake 0.6s ease-in-out}.lido-horizontal-shake{animation:horizontalShake 0.6s ease-in-out;border-radius:20px}.lido-vertical-shake{animation:verticalShake 0.6s ease-in-out;border-radius:20px}.lido-diagonal-shake{animation:diagonalShake 0.5s ease-in-out;border-radius:20px;will-change:transform}.lido-glow{animation:glowPulse 1s infinite alternate;transition:opacity 0.5s ease-in-out}.lido-box-highlight{animation:topToPlace 0.3s linear}.lido-display-hiddenvalue{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:80px;font-weight:1000;color:brown;-webkit-text-stroke:2px white;font-family:'Baloo Bhai 2', sans-serif;pointer-events:none}.lido-image-colorize{position:relative;display:inline-block}.lido-image-colorize::after{content:'';position:absolute;inset:0;background:var(--tint-color);mix-blend-mode:multiply;opacity:0.8;pointer-events:none;mask-image:var(--mask-url);mask-size:cover;mask-repeat:no-repeat;mask-position:center}.lido-tts-highlight-overlay{position:fixed;left:0;top:0;pointer-events:none;z-index:9999;background:linear-gradient(\
|
|
25
|
+
const globalStyles = "@font-face{font-family:'Baloo Bhai 2';font-style:normal;font-weight:400 800;font-display:swap;src:url('../assets/offline-assets/fonts/Baloo-Bhai-2/Baloo-Bhai-2-Variable.woff2') format('woff2')}body{overflow:hidden;background-position:center;background-size:cover;background-repeat:no-repeat;height:100vh}*{user-select:none}.lido-disable-check-button{pointer-events:none;background-color:#9393935c !important;color:white}.lido-element-selected{border:2px solid;background-color:#ffdf7d !important}.diagonal-target,.diagonal-drop *{transform:scale(0.8) !important;opacity:1 !important}.cloned-element{display:flex !important;position:absolute !important;filter:grayscale(100%);pointer-events:none}.removeShadow{box-shadow:0px 0px 0px 0px #ff8900 !important}.highlight-element{border:2px solid white;box-shadow:rgb(243, 77, 8) 0px 0px 40px !important}.drop-element.empty{border:4px dashed #f34d08 !important}.drop-element.filled{border:'none' !important}.drag-element{box-shadow:0px 15px 11px rgba(43, 0, 0, 0.3) !important}.drag-element.dropped{box-shadow:none !important}.click-element{background-color:var(--btn-bg-color, rgba(255, 172, 76, 1)) !important;box-shadow:var(--btn-shadow-px) var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;cursor:pointer;transition:box-shadow 0.1s ease-out, transform 0.2s ease-out;}.click-element:active{box-shadow:0px 0px 0px var(--btn-shadow-color, rgba(225, 121, 76, 1)) !important;transform:translateY(var(--btn-active));}.click-element:focus{outline:2px solid dodgerblue;outline-offset:3px}.after-drop-popup-container{width:200%;height:200%;background-color:rgba(0, 0, 0, 0.8);position:absolute;display:flex;flex-direction:row-reverse;align-items:center;justify-content:center !important;gap:80px}.after-drop-popup-drag-element{scale:1.5;border-radius:8px;transform:none !important;position:unset !important}.after-drop-popup-drop-element{scale:1.5;border:unset;border-radius:8px;transform:none !important;position:unset !important}@keyframes zoomFadeIn{0%{transform:scale(0.6);opacity:0}100%{transform:scale(1);opacity:1}}.zoom-fade-in{animation:zoomFadeIn 0.8s ease-out forwards}@keyframes zoomFadeOut{0%{transform:scale(1);opacity:1}100%{transform:scale(0.6);opacity:0}}.zoom-fade-out{animation:zoomFadeOut 0.8s ease-in forwards}.slide-numbers{width:70px;height:70px;border:1px solid #f57139;background-color:white;font-weight:500;color:#f57139;font-size:44px;border-radius:40px;display:flex;align-items:center;justify-content:center;font-family:'Baloo Bhai 2', serif}.slide-numbers-bottom{position:absolute;display:flex;justify-content:space-around;align-items:center;bottom:-25px;width:100%;height:50px}.slide-numbers-left{position:absolute;display:flex;flex-direction:column;justify-content:space-around;height:100%;width:50px;left:-25px;bottom:0px}.lido-speak-icon{width:56px;height:56px;position:absolute;top:-25px;right:-25px;z-index:10;background-color:white;border:4px solid #F34D08;border-radius:16px;box-shadow:0px 4px 0px 0px #F34D08;background-size:contain;background-repeat:no-repeat;cursor:pointer}.lido-speak-icon:active{transform:translateY(8px);box-shadow:0px 0px 0px 0px !important}.lido-strong-shake{animation:strongShake 0.3s ease}.lido-scaled-shake{animation:scaledShake 0.6s ease-in-out}.lido-horizontal-shake{animation:horizontalShake 0.6s ease-in-out;border-radius:20px}.lido-vertical-shake{animation:verticalShake 0.6s ease-in-out;border-radius:20px}.lido-diagonal-shake{animation:diagonalShake 0.5s ease-in-out;border-radius:20px;will-change:transform}.lido-glow{animation:glowPulse 1s infinite alternate;transition:opacity 0.5s ease-in-out}.lido-box-highlight{animation:topToPlace 0.3s linear}.lido-display-hiddenvalue{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-size:80px;font-weight:1000;color:brown;-webkit-text-stroke:2px white;font-family:'Baloo Bhai 2', sans-serif;pointer-events:none}.lido-image-colorize{position:relative;display:inline-block}.lido-image-colorize::after{content:'';position:absolute;inset:0;background:var(--tint-color);mix-blend-mode:multiply;opacity:0.8;pointer-events:none;mask-image:var(--mask-url);mask-size:cover;mask-repeat:no-repeat;mask-position:center}.lido-tts-highlight-overlay{position:fixed;left:0;top:0;pointer-events:none;z-index:9999;background:linear-gradient(\n 180deg,\n rgba(255, 235, 59, 0.95),\n rgba(255, 214, 0, 0.95)\n );border-radius:6px;box-shadow:0 2px 6px rgba(0, 0, 0, 0.18),\n inset 0 -1px 0 rgba(255, 255, 255, 0.25);transition:width 25ms ease-out,\n height 25ms ease-out,\n opacity 80ms ease-out;opacity:0.95;will-change:transform, width, height;contain:layout paint style}.category-dropped-onCorrect{box-shadow:rgba(129, 193, 39, 1) 0px 8px 8px 0px !important}.category-dropped-onInCorrect{box-shadow:rgba(255, 4, 16, 1) 0px 8px 8px 0px !important}";
|
|
26
26
|
|
|
27
27
|
/*
|
|
28
28
|
Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com
|