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,4 +1,4 @@
|
|
|
1
|
-
import { c as getAssetPath } from './index-
|
|
1
|
+
import { c as getAssetPath } from './index-mMpK8062.js';
|
|
2
2
|
|
|
3
3
|
const DragMapKey = 'lidoDragMap';
|
|
4
4
|
const SelectedValuesKey = 'lidoSelectedValues';
|
|
@@ -451,6 +451,19 @@ function enableDraggingWithScaling(element) {
|
|
|
451
451
|
let clone = null;
|
|
452
452
|
let duplicateElement = null;
|
|
453
453
|
let mutationFlag = false;
|
|
454
|
+
let pendingMoveFrame = null;
|
|
455
|
+
let latestClientX = 0;
|
|
456
|
+
let latestClientY = 0;
|
|
457
|
+
let hasPendingMove = false;
|
|
458
|
+
let touchTransformUpdated = false;
|
|
459
|
+
let touchDragScale = 1;
|
|
460
|
+
let touchDragScaleY = 1;
|
|
461
|
+
let touchOffsetX = 0;
|
|
462
|
+
let touchOffsetY = 0;
|
|
463
|
+
let touchStartElementLeft = 0;
|
|
464
|
+
let touchStartElementTop = 0;
|
|
465
|
+
let touchStartRect = null;
|
|
466
|
+
let isTouchDragging = false;
|
|
454
467
|
// Fetch the container element
|
|
455
468
|
const container = document.getElementById(LidoContainer);
|
|
456
469
|
if (!container) {
|
|
@@ -461,6 +474,33 @@ function enableDraggingWithScaling(element) {
|
|
|
461
474
|
return;
|
|
462
475
|
handlingElementFlexibleWidth(element, 'drag');
|
|
463
476
|
let dragingElementTransform;
|
|
477
|
+
const getContainerScale = () => {
|
|
478
|
+
const transform = window.getComputedStyle(container).transform;
|
|
479
|
+
const matrix3dMatch = transform.match(/matrix3d\(([^)]+)\)/);
|
|
480
|
+
const matrixMatch = transform.match(/matrix\(([^)]+)\)/);
|
|
481
|
+
if (matrix3dMatch) {
|
|
482
|
+
const values = matrix3dMatch[1].split(',').map(value => parseFloat(value.trim()));
|
|
483
|
+
return {
|
|
484
|
+
scaleX: Math.sqrt(values[0] ** 2 + values[1] ** 2) || 1,
|
|
485
|
+
scaleY: Math.sqrt(values[4] ** 2 + values[5] ** 2) || 1,
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
if (matrixMatch) {
|
|
489
|
+
const values = matrixMatch[1].split(',').map(value => parseFloat(value.trim()));
|
|
490
|
+
return {
|
|
491
|
+
scaleX: Math.sqrt(values[0] ** 2 + values[1] ** 2) || 1,
|
|
492
|
+
scaleY: Math.sqrt(values[2] ** 2 + values[3] ** 2) || 1,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
return { scaleX: 1, scaleY: 1 };
|
|
496
|
+
};
|
|
497
|
+
const updateTouchDragScale = () => {
|
|
498
|
+
if (isTouchDragging) {
|
|
499
|
+
const { scaleX, scaleY } = getContainerScale();
|
|
500
|
+
touchDragScale = scaleX;
|
|
501
|
+
touchDragScaleY = scaleY;
|
|
502
|
+
}
|
|
503
|
+
};
|
|
464
504
|
const onStart = (event) => {
|
|
465
505
|
var _a, _b;
|
|
466
506
|
if (container && container.getAttribute("game-completed") === "true")
|
|
@@ -477,17 +517,29 @@ function enableDraggingWithScaling(element) {
|
|
|
477
517
|
if (event instanceof MouseEvent) {
|
|
478
518
|
startX = event.clientX;
|
|
479
519
|
startY = event.clientY;
|
|
520
|
+
touchStartRect = null;
|
|
480
521
|
}
|
|
481
522
|
else {
|
|
482
523
|
startX = event.touches[0].clientX;
|
|
483
524
|
startY = event.touches[0].clientY;
|
|
525
|
+
isTouchDragging = true;
|
|
526
|
+
touchStartRect = element.getBoundingClientRect();
|
|
527
|
+
touchOffsetX = startX - touchStartRect.left;
|
|
528
|
+
touchOffsetY = startY - touchStartRect.top;
|
|
529
|
+
touchStartElementLeft = touchStartRect.left;
|
|
530
|
+
touchStartElementTop = touchStartRect.top;
|
|
531
|
+
const { scaleX, scaleY } = getContainerScale();
|
|
532
|
+
touchDragScale = scaleX;
|
|
533
|
+
touchDragScaleY = scaleY;
|
|
534
|
+
element.style.willChange = 'transform';
|
|
535
|
+
window.addEventListener('resize', updateTouchDragScale);
|
|
484
536
|
}
|
|
485
537
|
// Apply dragging styles to the element
|
|
486
538
|
element.style.opacity = '1';
|
|
487
539
|
element.style.cursor = 'grabbing';
|
|
488
540
|
if (((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) {
|
|
489
541
|
const computedStyle = window.getComputedStyle(element);
|
|
490
|
-
const rect = element.getBoundingClientRect();
|
|
542
|
+
const rect = touchStartRect || element.getBoundingClientRect();
|
|
491
543
|
if (!clone) {
|
|
492
544
|
clone = element.cloneNode(true);
|
|
493
545
|
clone.style.left = `${rect.left}px`;
|
|
@@ -506,7 +558,7 @@ function enableDraggingWithScaling(element) {
|
|
|
506
558
|
const imgElement = element.querySelector('img');
|
|
507
559
|
const src = imgElement === null || imgElement === void 0 ? void 0 : imgElement.getAttribute('src');
|
|
508
560
|
const computedStyle = window.getComputedStyle(element);
|
|
509
|
-
const rect = element.getBoundingClientRect();
|
|
561
|
+
const rect = touchStartRect || element.getBoundingClientRect();
|
|
510
562
|
if (!duplicateElement) {
|
|
511
563
|
duplicateElement = element.cloneNode(false);
|
|
512
564
|
duplicateElement.setAttribute('src', src);
|
|
@@ -579,31 +631,31 @@ function enableDraggingWithScaling(element) {
|
|
|
579
631
|
target.style.opacity = value;
|
|
580
632
|
}
|
|
581
633
|
};
|
|
582
|
-
const
|
|
583
|
-
|
|
634
|
+
const processMove = () => {
|
|
635
|
+
pendingMoveFrame = null;
|
|
636
|
+
if (!isDragging || !hasPendingMove)
|
|
584
637
|
return;
|
|
638
|
+
hasPendingMove = false;
|
|
639
|
+
const deferTouchDropValidation = touchTransformUpdated;
|
|
585
640
|
if (isDraggingDisabled) {
|
|
586
641
|
isDragging = false;
|
|
642
|
+
touchTransformUpdated = false;
|
|
587
643
|
return;
|
|
588
644
|
}
|
|
589
|
-
isClicked = false;
|
|
590
645
|
element.style.transition = 'none';
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
const newTop = initialY + dy;
|
|
605
|
-
// Apply transform with translation without boundaries
|
|
606
|
-
element.style.transform = `translate(${newLeft}px, ${newTop}px)`;
|
|
646
|
+
if (!touchTransformUpdated) {
|
|
647
|
+
const containerScale = calculateScale();
|
|
648
|
+
const dx = (latestClientX - startX) / containerScale;
|
|
649
|
+
const dy = (latestClientY - startY) / containerScale;
|
|
650
|
+
// Calculate the new position considering scaling
|
|
651
|
+
const newLeft = initialX + dx;
|
|
652
|
+
const newTop = initialY + dy;
|
|
653
|
+
// Apply transform with translation without boundaries
|
|
654
|
+
element.style.transform = `translate(${newLeft}px, ${newTop}px)`;
|
|
655
|
+
}
|
|
656
|
+
touchTransformUpdated = false;
|
|
657
|
+
if (deferTouchDropValidation)
|
|
658
|
+
return;
|
|
607
659
|
// Check for overlaps and highlight only the most overlapping element
|
|
608
660
|
let mostOverlappedElement = findMostoverlappedElement$1(element, 'drop');
|
|
609
661
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
@@ -642,6 +694,44 @@ function enableDraggingWithScaling(element) {
|
|
|
642
694
|
}
|
|
643
695
|
}
|
|
644
696
|
};
|
|
697
|
+
const onMove = (event) => {
|
|
698
|
+
if (!isDragging)
|
|
699
|
+
return;
|
|
700
|
+
if (isDraggingDisabled) {
|
|
701
|
+
isDragging = false;
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
if (event instanceof MouseEvent) {
|
|
705
|
+
touchTransformUpdated = false;
|
|
706
|
+
latestClientX = event.clientX;
|
|
707
|
+
latestClientY = event.clientY;
|
|
708
|
+
}
|
|
709
|
+
else {
|
|
710
|
+
const touch = event.touches[0];
|
|
711
|
+
if (!touch)
|
|
712
|
+
return;
|
|
713
|
+
latestClientX = touch.clientX;
|
|
714
|
+
latestClientY = touch.clientY;
|
|
715
|
+
}
|
|
716
|
+
if (!(event instanceof MouseEvent)) {
|
|
717
|
+
element.style.transition = 'none';
|
|
718
|
+
const desiredLeft = latestClientX - touchOffsetX;
|
|
719
|
+
const desiredTop = latestClientY - touchOffsetY;
|
|
720
|
+
const dx = (desiredLeft - touchStartElementLeft) / touchDragScale;
|
|
721
|
+
const dy = (desiredTop - touchStartElementTop) / touchDragScaleY;
|
|
722
|
+
const newLeft = initialX + dx;
|
|
723
|
+
const newTop = initialY + dy;
|
|
724
|
+
element.style.transform = `translate3d(${newLeft}px, ${newTop}px, 0)`;
|
|
725
|
+
touchTransformUpdated = true;
|
|
726
|
+
}
|
|
727
|
+
isClicked = false;
|
|
728
|
+
if (event instanceof MouseEvent) {
|
|
729
|
+
hasPendingMove = true;
|
|
730
|
+
if (pendingMoveFrame === null) {
|
|
731
|
+
pendingMoveFrame = requestAnimationFrame(processMove);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
};
|
|
645
735
|
let lastOverlappedElement = null;
|
|
646
736
|
const removeDocumentDragListeners = () => {
|
|
647
737
|
document.removeEventListener('mousemove', onMove);
|
|
@@ -649,9 +739,19 @@ function enableDraggingWithScaling(element) {
|
|
|
649
739
|
document.removeEventListener('touchmove', onMove);
|
|
650
740
|
document.removeEventListener('touchend', onEnd);
|
|
651
741
|
};
|
|
742
|
+
const flushPendingMove = () => {
|
|
743
|
+
if (pendingMoveFrame === null)
|
|
744
|
+
return;
|
|
745
|
+
cancelAnimationFrame(pendingMoveFrame);
|
|
746
|
+
processMove();
|
|
747
|
+
};
|
|
652
748
|
const onEnd = (endEv) => {
|
|
653
749
|
var _a, _b, _c;
|
|
750
|
+
flushPendingMove();
|
|
654
751
|
isDragging = false;
|
|
752
|
+
isTouchDragging = false;
|
|
753
|
+
element.style.willChange = '';
|
|
754
|
+
window.removeEventListener('resize', updateTouchDragScale);
|
|
655
755
|
removeDocumentDragListeners();
|
|
656
756
|
if (isClicked) {
|
|
657
757
|
if (clone) {
|
|
@@ -757,6 +857,15 @@ function enableDraggingWithScaling(element) {
|
|
|
757
857
|
};
|
|
758
858
|
const cleanup = () => {
|
|
759
859
|
isDragging = false;
|
|
860
|
+
isTouchDragging = false;
|
|
861
|
+
element.style.willChange = '';
|
|
862
|
+
window.removeEventListener('resize', updateTouchDragScale);
|
|
863
|
+
if (pendingMoveFrame !== null) {
|
|
864
|
+
cancelAnimationFrame(pendingMoveFrame);
|
|
865
|
+
pendingMoveFrame = null;
|
|
866
|
+
}
|
|
867
|
+
hasPendingMove = false;
|
|
868
|
+
touchTransformUpdated = false;
|
|
760
869
|
observer.disconnect();
|
|
761
870
|
removeDocumentDragListeners();
|
|
762
871
|
element.removeEventListener('mousedown', onStart);
|
|
@@ -1240,14 +1349,14 @@ async function onClickDropOrDragElement(element, type) {
|
|
|
1240
1349
|
if (!document.querySelector('#dynamic-highlight-style')) {
|
|
1241
1350
|
const style = document.createElement('style');
|
|
1242
1351
|
style.id = 'dynamic-highlight-style';
|
|
1243
|
-
style.innerHTML = `
|
|
1244
|
-
.highlight {
|
|
1245
|
-
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
1246
|
-
// border-radius: 12px; /* Larger rounded corners */
|
|
1247
|
-
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
1248
|
-
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
1249
|
-
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
1250
|
-
}
|
|
1352
|
+
style.innerHTML = `
|
|
1353
|
+
.highlight {
|
|
1354
|
+
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
1355
|
+
// border-radius: 12px; /* Larger rounded corners */
|
|
1356
|
+
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
1357
|
+
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
1358
|
+
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
1359
|
+
}
|
|
1251
1360
|
`;
|
|
1252
1361
|
document.head.appendChild(style);
|
|
1253
1362
|
}
|
|
@@ -1435,34 +1544,34 @@ function highlightSpeakingElement(element) {
|
|
|
1435
1544
|
if (!document.getElementById(styleId)) {
|
|
1436
1545
|
const style = document.createElement('style');
|
|
1437
1546
|
style.id = styleId;
|
|
1438
|
-
style.innerHTML = `
|
|
1439
|
-
.speaking-highlight {
|
|
1440
|
-
--base-transform: ${element.style.transform};
|
|
1441
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
|
|
1442
|
-
// border: 3px solid green !important;
|
|
1443
|
-
// transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
|
|
1444
|
-
// transform: scale(1.05); /* Subtle scale effect to pop the element */
|
|
1445
|
-
// animation: pulseEffect 1.5s infinite; /* Pulsing animation */
|
|
1446
|
-
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
@keyframes pulseEffect {
|
|
1450
|
-
0% {
|
|
1451
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1452
|
-
// transform: var(--base-transform) scale(1.05);
|
|
1453
|
-
// background-color: #FFFF0B;
|
|
1454
|
-
}
|
|
1455
|
-
50% {
|
|
1456
|
-
box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
|
|
1457
|
-
// transform: var(--base-transform) scale(1.1);
|
|
1458
|
-
// background-color: #FFFF0B;
|
|
1459
|
-
}
|
|
1460
|
-
100% {
|
|
1461
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1462
|
-
// transform: var(--base-transform) scale(1.05);
|
|
1463
|
-
// background-color: #FFFF0B;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1547
|
+
style.innerHTML = `
|
|
1548
|
+
.speaking-highlight {
|
|
1549
|
+
--base-transform: ${element.style.transform};
|
|
1550
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
|
|
1551
|
+
// border: 3px solid green !important;
|
|
1552
|
+
// transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
|
|
1553
|
+
// transform: scale(1.05); /* Subtle scale effect to pop the element */
|
|
1554
|
+
// animation: pulseEffect 1.5s infinite; /* Pulsing animation */
|
|
1555
|
+
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
@keyframes pulseEffect {
|
|
1559
|
+
0% {
|
|
1560
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1561
|
+
// transform: var(--base-transform) scale(1.05);
|
|
1562
|
+
// background-color: #FFFF0B;
|
|
1563
|
+
}
|
|
1564
|
+
50% {
|
|
1565
|
+
box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
|
|
1566
|
+
// transform: var(--base-transform) scale(1.1);
|
|
1567
|
+
// background-color: #FFFF0B;
|
|
1568
|
+
}
|
|
1569
|
+
100% {
|
|
1570
|
+
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1571
|
+
// transform: var(--base-transform) scale(1.05);
|
|
1572
|
+
// background-color: #FFFF0B;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1466
1575
|
`;
|
|
1467
1576
|
document.head.appendChild(style);
|
|
1468
1577
|
}
|
|
@@ -1479,10 +1588,10 @@ function stopHighlightForSpeakingElement(element) {
|
|
|
1479
1588
|
}
|
|
1480
1589
|
function highlightElement() {
|
|
1481
1590
|
const container = document.querySelector(LidoContainer);
|
|
1482
|
-
if (container.getAttribute("template-id") === "blender")
|
|
1483
|
-
return;
|
|
1484
1591
|
if (!container)
|
|
1485
1592
|
return;
|
|
1593
|
+
if (container.getAttribute("template-id") === "blender")
|
|
1594
|
+
return;
|
|
1486
1595
|
const dropElements = buildDropHasDragFromDOM();
|
|
1487
1596
|
const dropEls = container.querySelectorAll(`[type="drop"]`);
|
|
1488
1597
|
dropEls.forEach(dropEl => {
|
|
@@ -1539,6 +1648,7 @@ class AudioPlayer {
|
|
|
1539
1648
|
this.currentTargetElement = null;
|
|
1540
1649
|
this.pendingReplayElement = null;
|
|
1541
1650
|
this.playbackHasStarted = false;
|
|
1651
|
+
this.playbackSequence = 0;
|
|
1542
1652
|
this.highlightOverlay = null;
|
|
1543
1653
|
this.wordRects = [];
|
|
1544
1654
|
this.activeWordIndex = -1;
|
|
@@ -1637,7 +1747,7 @@ class AudioPlayer {
|
|
|
1637
1747
|
return el;
|
|
1638
1748
|
return el.closest('lido-text');
|
|
1639
1749
|
}
|
|
1640
|
-
async play(targetElement, suppressHighlight = false) {
|
|
1750
|
+
async play(targetElement, suppressHighlight = false, playbackContext) {
|
|
1641
1751
|
this.registerVisibilityEvents();
|
|
1642
1752
|
this.playbackHasStarted = false;
|
|
1643
1753
|
if (!this.isWindowVisible()) {
|
|
@@ -1649,6 +1759,7 @@ class AudioPlayer {
|
|
|
1649
1759
|
}
|
|
1650
1760
|
this.pendingReplayElement = null;
|
|
1651
1761
|
}
|
|
1762
|
+
const playbackId = ++this.playbackSequence;
|
|
1652
1763
|
// Stop any currently playing audio first if target element has audio given
|
|
1653
1764
|
try {
|
|
1654
1765
|
await AudioPlayer.getI().stop();
|
|
@@ -1672,7 +1783,7 @@ class AudioPlayer {
|
|
|
1672
1783
|
targetElement = textElement;
|
|
1673
1784
|
}
|
|
1674
1785
|
this.currentTargetElement = targetElement;
|
|
1675
|
-
window.dispatchEvent(new CustomEvent('lidoAudioStarted', { detail: { target: targetElement } }));
|
|
1786
|
+
window.dispatchEvent(new CustomEvent('lidoAudioStarted', { detail: { target: targetElement, playbackId, playbackContext } }));
|
|
1676
1787
|
// then play the target element audio.
|
|
1677
1788
|
let audioUrl = targetElement.getAttribute('audio') || '';
|
|
1678
1789
|
// If no direct audio attribute, check childrens for audio
|
|
@@ -1691,6 +1802,7 @@ class AudioPlayer {
|
|
|
1691
1802
|
this.audioElement.src = audioUrl;
|
|
1692
1803
|
this.audioElement.onplaying = () => {
|
|
1693
1804
|
this.playbackHasStarted = true;
|
|
1805
|
+
window.dispatchEvent(new CustomEvent('lidoAudioPlaying', { detail: { target: targetElement, playbackId, playbackContext } }));
|
|
1694
1806
|
};
|
|
1695
1807
|
this.audioElement.onpause = () => {
|
|
1696
1808
|
if (this.playbackHasStarted && !this.audioElement.ended) {
|
|
@@ -1769,13 +1881,13 @@ class AudioPlayer {
|
|
|
1769
1881
|
await this.waitUntilWindowIsVisible();
|
|
1770
1882
|
if (this.pendingReplayElement === targetElement) {
|
|
1771
1883
|
this.pendingReplayElement = null;
|
|
1772
|
-
return this.play(targetElement);
|
|
1884
|
+
return this.play(targetElement, suppressHighlight, playbackContext);
|
|
1773
1885
|
}
|
|
1774
1886
|
}
|
|
1775
1887
|
if (this.currentTargetElement === targetElement) {
|
|
1776
1888
|
this.currentTargetElement = null;
|
|
1777
1889
|
}
|
|
1778
|
-
window.dispatchEvent(new CustomEvent('lidoAudioEnded', { detail: { target: targetElement } }));
|
|
1890
|
+
window.dispatchEvent(new CustomEvent('lidoAudioEnded', { detail: { target: targetElement, playbackId, playbackContext } }));
|
|
1779
1891
|
}
|
|
1780
1892
|
// GLOBAL STOP EVENTS (container change, activity change…)
|
|
1781
1893
|
registerGlobalStopEvents() {
|
|
@@ -2168,11 +2280,11 @@ function enableReorderDrag(element) {
|
|
|
2168
2280
|
onDropToCategory(element, category);
|
|
2169
2281
|
}
|
|
2170
2282
|
if (divEl) {
|
|
2171
|
-
const keyframes = `
|
|
2172
|
-
@keyframes widthDecrease {
|
|
2173
|
-
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
2174
|
-
100% { width: 0px; height: 0px;}
|
|
2175
|
-
}
|
|
2283
|
+
const keyframes = `
|
|
2284
|
+
@keyframes widthDecrease {
|
|
2285
|
+
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
2286
|
+
100% { width: 0px; height: 0px;}
|
|
2287
|
+
}
|
|
2176
2288
|
`;
|
|
2177
2289
|
const styleSheet = document.styleSheets[0];
|
|
2178
2290
|
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
|
|
@@ -2395,11 +2507,11 @@ function moveWithAnimation(target, overlapped) {
|
|
|
2395
2507
|
const dummy = createDummyElement(target);
|
|
2396
2508
|
dummy.style.visibility = 'hidden';
|
|
2397
2509
|
dummy.setAttribute('type', 'dummy');
|
|
2398
|
-
const keyframes = `
|
|
2399
|
-
@keyframes widthIncrease {
|
|
2400
|
-
0% { width: 0px; height: 0px; }
|
|
2401
|
-
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
2402
|
-
}
|
|
2510
|
+
const keyframes = `
|
|
2511
|
+
@keyframes widthIncrease {
|
|
2512
|
+
0% { width: 0px; height: 0px; }
|
|
2513
|
+
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
2514
|
+
}
|
|
2403
2515
|
`;
|
|
2404
2516
|
if (!overlapped) {
|
|
2405
2517
|
const overlapCategory = findMostoverlappedElement(target, 'category');
|
|
@@ -2492,6 +2604,20 @@ async function onDropToCategory(dragElement, categoryElement) {
|
|
|
2492
2604
|
}
|
|
2493
2605
|
|
|
2494
2606
|
const delay = (ms) => new Promise(res => setTimeout(res, ms));
|
|
2607
|
+
const isArrangeLettersContainer = (container) => container.getAttribute('template-id') === 'arrangeLetters';
|
|
2608
|
+
const isReorderContainer = (container) => container.getAttribute('template-id') === 'reorder';
|
|
2609
|
+
const getSlideValuesForValidation = (container, slideElements) => {
|
|
2610
|
+
if (isReorderContainer(container)) {
|
|
2611
|
+
return slideElements.map(element => element.id);
|
|
2612
|
+
}
|
|
2613
|
+
return slideElements.map(element => element['value']);
|
|
2614
|
+
};
|
|
2615
|
+
const syncSlideOrder = (container) => {
|
|
2616
|
+
const slideElements = Array.from(container.querySelectorAll("[type='slide']"));
|
|
2617
|
+
const slideOrder = getSlideValuesForValidation(container, slideElements);
|
|
2618
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(slideOrder));
|
|
2619
|
+
return slideOrder;
|
|
2620
|
+
};
|
|
2495
2621
|
const slideAnimation = async () => {
|
|
2496
2622
|
const container = document.getElementById(LidoContainer);
|
|
2497
2623
|
if (!container)
|
|
@@ -2552,6 +2678,9 @@ function slidingWithScaling(element) {
|
|
|
2552
2678
|
const container = document.getElementById(LidoContainer);
|
|
2553
2679
|
if (container.getAttribute('canplay') === 'false')
|
|
2554
2680
|
return;
|
|
2681
|
+
// Slide activities can start in the correct order. Keep their initial DOM
|
|
2682
|
+
// order available to the Next/check validation before the first swap occurs.
|
|
2683
|
+
syncSlideOrder(container);
|
|
2555
2684
|
const onStart = (event) => {
|
|
2556
2685
|
const templateId = container.getAttribute('template-id');
|
|
2557
2686
|
if ((templateId === 'arrangeLetters' || templateId === 'reorder') && container.getAttribute('game-completed') === 'true')
|
|
@@ -2727,14 +2856,6 @@ function slidingWithScaling(element) {
|
|
|
2727
2856
|
element.addEventListener('touchstart', onStart);
|
|
2728
2857
|
element.addEventListener(LIDO_INTERACTION_CLEANUP_EVENT, cleanup);
|
|
2729
2858
|
}
|
|
2730
|
-
const isArrangeLettersContainer = (container) => container.getAttribute('template-id') === 'arrangeLetters';
|
|
2731
|
-
const isReorderContainer = (container) => container.getAttribute('template-id') === 'reorder';
|
|
2732
|
-
const getSlideValuesForValidation = (container, slideElements) => {
|
|
2733
|
-
if (isReorderContainer(container)) {
|
|
2734
|
-
return slideElements.map(element => element.id);
|
|
2735
|
-
}
|
|
2736
|
-
return slideElements.map(element => element['value']);
|
|
2737
|
-
};
|
|
2738
2859
|
const updateArrangeLettersCorrectness = (container, slideValues, objectiveValues) => {
|
|
2739
2860
|
const slideElements = Array.from(container.querySelectorAll('[type="slide"]'));
|
|
2740
2861
|
slideElements.forEach((element, index) => {
|
|
@@ -4315,11 +4436,12 @@ function addClickListenerForClickType(element) {
|
|
|
4315
4436
|
}, 50);
|
|
4316
4437
|
}
|
|
4317
4438
|
});
|
|
4318
|
-
|
|
4439
|
+
initializeClickableElementStyle(element);
|
|
4319
4440
|
}
|
|
4320
|
-
const
|
|
4441
|
+
const initializeClickableElementStyle = (element) => {
|
|
4321
4442
|
var _a;
|
|
4322
|
-
const
|
|
4443
|
+
const elementHeight = Number.isFinite(element.offsetHeight) ? element.offsetHeight : 0;
|
|
4444
|
+
const elementShadow = elementHeight * 0.08;
|
|
4323
4445
|
const backGroundColor = ((_a = element.style) === null || _a === void 0 ? void 0 : _a.backgroundColor) || '#FFB742';
|
|
4324
4446
|
element.style.setProperty('--btn-bg-color', backGroundColor);
|
|
4325
4447
|
element.style.setProperty('--btn-shadow-px', `0px ${elementShadow}px 0px`);
|
|
@@ -72753,6 +72875,34 @@ function getSortedValuesArrayFromMap(map) {
|
|
|
72753
72875
|
function format(first, middle, last) {
|
|
72754
72876
|
return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');
|
|
72755
72877
|
}
|
|
72878
|
+
// These actions have side effects beyond declarative element styling. They must
|
|
72879
|
+
// not run while the player is being displayed in edit mode.
|
|
72880
|
+
const nonVisualActions = new Set([
|
|
72881
|
+
'revealImageValue',
|
|
72882
|
+
'scrollCellAfterEquationSolved',
|
|
72883
|
+
'alignMatch',
|
|
72884
|
+
'removeClone',
|
|
72885
|
+
'speak',
|
|
72886
|
+
'fill-slide',
|
|
72887
|
+
'nextBtn',
|
|
72888
|
+
'prevBtn',
|
|
72889
|
+
'stop',
|
|
72890
|
+
'sleep',
|
|
72891
|
+
'avatarAnimate',
|
|
72892
|
+
'cellBorderAnimate',
|
|
72893
|
+
'vibrate',
|
|
72894
|
+
'highlightStarsAndDisapper',
|
|
72895
|
+
'boxAnimationOneByOne',
|
|
72896
|
+
'questionBoxAnimate',
|
|
72897
|
+
'slideAnimation',
|
|
72898
|
+
'showBalanceSymbol',
|
|
72899
|
+
'hideBalanceSymbol',
|
|
72900
|
+
'sumTogetherAnimation',
|
|
72901
|
+
'addText',
|
|
72902
|
+
'disableType',
|
|
72903
|
+
'updateCountBlender',
|
|
72904
|
+
'updateCalculatorAnswer',
|
|
72905
|
+
]);
|
|
72756
72906
|
const initEventsForElement = async (element, type) => {
|
|
72757
72907
|
const container = document.getElementById(LidoContainer);
|
|
72758
72908
|
if (!container) {
|
|
@@ -72762,10 +72912,29 @@ const initEventsForElement = async (element, type) => {
|
|
|
72762
72912
|
return;
|
|
72763
72913
|
}
|
|
72764
72914
|
const onEntry = element.getAttribute('onEntry');
|
|
72765
|
-
|
|
72915
|
+
const canPlay = container.getAttribute('canplay') !== 'false';
|
|
72916
|
+
await executeActions(onEntry, element, undefined, { visualOnly: !canPlay });
|
|
72917
|
+
// Free movement is an editor interaction and is intentionally available in
|
|
72918
|
+
// edit mode; all gameplay handlers below remain disabled there.
|
|
72766
72919
|
if (element.getAttribute('move') === 'true') {
|
|
72767
72920
|
enableFreeMove(element);
|
|
72768
72921
|
}
|
|
72922
|
+
// The click visual treatment is independent from the click listener. Edit
|
|
72923
|
+
// mode needs the class and custom properties that draw the configured button
|
|
72924
|
+
// background/shadow, but must not install answer-selection behavior.
|
|
72925
|
+
if (!canPlay && type === 'click') {
|
|
72926
|
+
initializeClickableElementStyle(element);
|
|
72927
|
+
}
|
|
72928
|
+
// Edit mode still needs visual initialization, but must not install any
|
|
72929
|
+
// gameplay or touch handlers. In play mode, avoid duplicating listeners if a
|
|
72930
|
+
// component invokes its load hook more than once.
|
|
72931
|
+
if (!canPlay)
|
|
72932
|
+
return;
|
|
72933
|
+
const initializedElement = element;
|
|
72934
|
+
const initializationKey = `${type || ''}:${canPlay}`;
|
|
72935
|
+
if (initializedElement.__lidoInitializationKey === initializationKey)
|
|
72936
|
+
return;
|
|
72937
|
+
initializedElement.__lidoInitializationKey = initializationKey;
|
|
72769
72938
|
switch (type) {
|
|
72770
72939
|
case 'drag': {
|
|
72771
72940
|
enableDraggingWithScaling(element);
|
|
@@ -72803,12 +72972,14 @@ const initEventsForElement = async (element, type) => {
|
|
|
72803
72972
|
onTouchListenerForOnTouch(element);
|
|
72804
72973
|
};
|
|
72805
72974
|
// Function to execute actions parsed from the onMatch string
|
|
72806
|
-
const executeActions = async (actionsString, thisElement, element) => {
|
|
72807
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
72975
|
+
const executeActions = async (actionsString, thisElement, element, options = {}) => {
|
|
72976
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
72808
72977
|
const actions = parseActions(actionsString);
|
|
72809
72978
|
// body.style.pointerEvents = 'none';
|
|
72810
72979
|
for (let i = 0; i < actions.length; i++) {
|
|
72811
72980
|
const action = actions[i];
|
|
72981
|
+
if (options.visualOnly && nonVisualActions.has(action.action))
|
|
72982
|
+
continue;
|
|
72812
72983
|
const queriedElement = document.querySelector(action.actor);
|
|
72813
72984
|
const targetElement = action.actor === 'this' ? thisElement : action.actor === 'element' ? element : queriedElement ? queriedElement : document.getElementById(action.actor);
|
|
72814
72985
|
if (targetElement) {
|
|
@@ -72929,7 +73100,14 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
72929
73100
|
const riveService = RiveService.getInstance();
|
|
72930
73101
|
const riveInstance = riveService.getRiveInstance();
|
|
72931
73102
|
if (riveInstance && action.value) {
|
|
72932
|
-
riveInstance
|
|
73103
|
+
const input = (_b = riveInstance
|
|
73104
|
+
.stateMachineInputs('State Machine 1')) === null || _b === void 0 ? void 0 : _b.find(input => input.name === action.value);
|
|
73105
|
+
if (input) {
|
|
73106
|
+
input.fire();
|
|
73107
|
+
}
|
|
73108
|
+
else {
|
|
73109
|
+
console.warn(`Avatar reaction input "${action.value}" was not found in State Machine 1.`);
|
|
73110
|
+
}
|
|
72933
73111
|
}
|
|
72934
73112
|
break;
|
|
72935
73113
|
}
|
|
@@ -72976,8 +73154,8 @@ const executeActions = async (actionsString, thisElement, element) => {
|
|
|
72976
73154
|
const balanceEl = document.querySelector('lido-balance');
|
|
72977
73155
|
if (!balanceEl)
|
|
72978
73156
|
break;
|
|
72979
|
-
const leftVal = Number((
|
|
72980
|
-
const rightVal = Number((
|
|
73157
|
+
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));
|
|
73158
|
+
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));
|
|
72981
73159
|
const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
|
|
72982
73160
|
balanceEl.balanceSymbol = symbol;
|
|
72983
73161
|
balanceEl.dataset.balanceSymbol = symbol;
|
|
@@ -73097,11 +73275,11 @@ const afterDropDragHandling = (dragElement, dropElement) => {
|
|
|
73097
73275
|
}
|
|
73098
73276
|
dummyElement.setAttribute('id', dragElement.getAttribute('id'));
|
|
73099
73277
|
dragElement.replaceWith(dummyElement);
|
|
73100
|
-
const keyframes = `
|
|
73101
|
-
@keyframes widthDecrease {
|
|
73102
|
-
0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
|
|
73103
|
-
100% { width: 0px; height: 0px; margin: 0px;}
|
|
73104
|
-
}
|
|
73278
|
+
const keyframes = `
|
|
73279
|
+
@keyframes widthDecrease {
|
|
73280
|
+
0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
|
|
73281
|
+
100% { width: 0px; height: 0px; margin: 0px;}
|
|
73282
|
+
}
|
|
73105
73283
|
`;
|
|
73106
73284
|
if (!isInfinite) {
|
|
73107
73285
|
dummyElement.style.width = element.style.width;
|
|
@@ -73452,7 +73630,7 @@ const storeActivityScore = (score) => {
|
|
|
73452
73630
|
activityScore[activityScoreKey] = score;
|
|
73453
73631
|
//send Custom Event to parent
|
|
73454
73632
|
// window.dispatchEvent(new CustomEvent(ActivityEndKey, { detail: { index: index, totalIndex: totalIndex, score: score } }));
|
|
73455
|
-
const actualActivitySeconds =
|
|
73633
|
+
const actualActivitySeconds = Number((Timer.getI().getElapsed() / 1000).toFixed(1));
|
|
73456
73634
|
ACTIVYTY_TIME_SPEND_ARRAY.push(actualActivitySeconds);
|
|
73457
73635
|
console.log(`[Utils][Activity Time] Activity ${index + 1}/${totalIndex} - Time spent: ${actualActivitySeconds}s`);
|
|
73458
73636
|
const lessonTrackingParams = getLessonTrackingParams();
|
|
@@ -73464,7 +73642,7 @@ const storeActivityScore = (score) => {
|
|
|
73464
73642
|
gameScore.finalScore = Math.floor(finalScore);
|
|
73465
73643
|
console.log('Total Score : ', gameScore.finalScore);
|
|
73466
73644
|
// window.dispatchEvent(new CustomEvent(LessonEndKey, { detail: { score: finalScore } }));
|
|
73467
|
-
const timeSpendForLesson = ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0);
|
|
73645
|
+
const timeSpendForLesson = Number(ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0).toFixed(1));
|
|
73468
73646
|
console.log(`[Utils][Lesson Time] Total lesson time spent: ${timeSpendForLesson}s`);
|
|
73469
73647
|
dispatchLessonEndEvent(totalIndex, gameScore.totalRightMovesCount, gameScore.totalWrongMovesCount, finalScore, timeSpendForLesson, lessonTrackingParams);
|
|
73470
73648
|
gameScore.totalRightMovesCount = 0;
|
|
@@ -2,7 +2,7 @@ const NAMESPACE = 'lido-player';
|
|
|
2
2
|
const BUILD = /* lido-player */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, slotRelocation: true, state: true, updatable: true};
|
|
3
3
|
|
|
4
4
|
const globalScripts = () => {};
|
|
5
|
-
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(\
|
|
5
|
+
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}";
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com
|
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-CndbFQ5I.js';
|
|
2
|
+
import './index-mMpK8062.js';
|