lido-player 0.0.2-beta-21-dev → 0.0.2-beta-23-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-Buln7Iaf.js → decode-BDs2S8om.js} +1 -1
- package/dist/cjs/{index-Bb_TFgTA.js → index-D5olYRJo.js} +274 -89
- package/dist/cjs/{index-DBCFoh1I.js → index-DnaH8sO-.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/lido-avatar_22.cjs.entry.js +190 -46
- package/dist/cjs/lido-player.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/avatar/lido-avatar.css +4 -4
- package/dist/collection/components/avatar/lido-avatar.js +1 -1
- package/dist/collection/components/avatar/lido-avatar.tsx +207 -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 +10 -10
- package/dist/collection/components/container/lido-container.js +8 -8
- package/dist/collection/components/flashCard/lido-flash-card.css +46 -28
- package/dist/collection/components/flashCard/lido-flash-card.js +158 -14
- 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 +9 -6
- 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 -145
- package/dist/collection/components/scale/lido-balance.js +54 -14
- 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 +3 -3
- 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 +9 -12
- package/dist/collection/utils/utils.js +24 -8
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +145 -30
- package/dist/collection/utils/utilsHandlers/highlightHandler.js +54 -54
- package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +58 -1
- 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-BOQDbCrm.js → p-BJiyBHYT.js} +1 -1
- package/dist/components/{p-CTlcpv4a.js → p-BfwUqpXc.js} +1 -1
- package/dist/components/p-BiBt9LGP.js +1 -0
- package/dist/components/{p-CgsPIpg0.js → p-Bw-OC9iR.js} +1 -1
- package/dist/components/{p-B4YAipq-.js → p-CFzvgrMa.js} +1 -1
- package/dist/components/{p-C5WmmkI6.js → p-CPYnt0P-.js} +1 -1
- package/dist/components/{p-CCR42e0i.js → p-ChfVUoX4.js} +1 -1
- package/dist/components/{p-BeRr8u5m.js → p-CwDTdXe5.js} +1 -1
- package/dist/components/{p-CXHPZN3m.js → p-CyGxEcn7.js} +1 -1
- package/dist/components/p-D0cGjo5e.js +1 -0
- package/dist/components/{p-BJMjg5wu.js → p-D2GhaM-T.js} +1 -1
- package/dist/components/{p-BBHM059l.js → p-DDS30M3y.js} +1 -1
- package/dist/components/p-DP6jQ5ML.js +1 -0
- package/dist/components/{p-CljvnHkI.js → p-DZRNZCPt.js} +1 -1
- package/dist/components/p-DbR5sNOj.js +1 -0
- package/dist/components/{p-B8nzzM8c.js → p-DdQ1eqJr.js} +1 -1
- package/dist/components/{p-wF7SBGpr.js → p-Ds-d6wd0.js} +2 -2
- package/dist/components/p-Lg85waqZ.js +1 -0
- package/dist/components/p-leIEepjl.js +1 -0
- package/dist/components/{p-C70ykycD.js → p-useuhkjH.js} +1 -1
- package/dist/esm/{decode-B_VrYFdJ.js → decode-CAwfe7ub.js} +1 -1
- package/dist/esm/{index-mMpK8062.js → index-Dvjbti-h.js} +1 -1
- package/dist/esm/{index-B-VyHxJa.js → index-bo7729YG.js} +274 -89
- package/dist/esm/index.js +2 -2
- package/dist/esm/lido-avatar_22.entry.js +190 -46
- package/dist/esm/lido-player.js +3 -3
- package/dist/esm/loader.js +3 -3
- 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 +207 -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-461a3d23.entry.js +12 -0
- package/dist/lido-player/{p-Cw84dpIR.js → p-D4kAEWCU.js} +1 -1
- package/dist/lido-player/p-Dvjbti-h.js +2 -0
- package/dist/lido-player/p-VRJMO_sg.js +1 -0
- package/dist/lido-player/readme.md +49 -49
- package/dist/types/components/flashCard/lido-flash-card.d.ts +14 -0
- package/dist/types/components/scale/lido-balance.d.ts +5 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/types/types/json.d.ts +3 -3
- package/dist/types/utils/audioPlayer.d.ts +1 -1
- package/dist/types/utils/utilsHandlers/lidoBalanceHandler.d.ts +10 -0
- package/package.json +74 -74
- package/readme.md +113 -113
- package/dist/components/p-BAfFgI9q.js +0 -1
- package/dist/components/p-BfqihbR6.js +0 -1
- package/dist/components/p-CwIlwnQk.js +0 -1
- package/dist/components/p-DLyacZap.js +0 -1
- package/dist/components/p-DONbWJGn.js +0 -1
- package/dist/components/p-DVTigdH_.js +0 -1
- package/dist/lido-player/p-744dee1c.entry.js +0 -12
- package/dist/lido-player/p-BK926Rl3.js +0 -1
- package/dist/lido-player/p-mMpK8062.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as getAssetPath } from './index-
|
|
1
|
+
import { c as getAssetPath } from './index-Dvjbti-h.js';
|
|
2
2
|
|
|
3
3
|
const DragMapKey = 'lidoDragMap';
|
|
4
4
|
const SelectedValuesKey = 'lidoSelectedValues';
|
|
@@ -197,7 +197,51 @@ class RiveService {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Mount a drag item on a balance plate without using the generic
|
|
202
|
+
* `drop-action="move"` flow. The generic flow creates a new source placeholder
|
|
203
|
+
* for every move, which makes a previously used plate become the item's source.
|
|
204
|
+
*
|
|
205
|
+
* A balance item gets exactly one home placeholder: its original source. It can
|
|
206
|
+
* then move freely between plate parents while continuing to inherit the plate's
|
|
207
|
+
* tilt translation.
|
|
208
|
+
*/
|
|
209
|
+
function placeDragOnBalancePlate(dragElement, dropElement) {
|
|
210
|
+
var _a;
|
|
211
|
+
const balanceEl = document.querySelector('lido-balance');
|
|
212
|
+
const plateParent = dropElement === null || dropElement === void 0 ? void 0 : dropElement.parentElement;
|
|
213
|
+
if (!balanceEl || !plateParent)
|
|
214
|
+
return;
|
|
215
|
+
const drag = dragElement;
|
|
216
|
+
if (!((_a = drag.__lidoBalanceHome) === null || _a === void 0 ? void 0 : _a.isConnected)) {
|
|
217
|
+
const home = document.createElement('div');
|
|
218
|
+
home.className = 'lido-balance-source-placeholder';
|
|
219
|
+
home.setAttribute('aria-hidden', 'true');
|
|
220
|
+
drag.replaceWith(home);
|
|
221
|
+
drag.__lidoBalanceHome = home;
|
|
222
|
+
}
|
|
223
|
+
// Appending an existing element moves it; it does not leave a second
|
|
224
|
+
// placeholder in the previous plate.
|
|
225
|
+
plateParent.append(drag);
|
|
226
|
+
drag.style.position = 'absolute';
|
|
227
|
+
drag.style.zIndex = '1';
|
|
228
|
+
// The generic drag handler also uses transform. Disable transitions while
|
|
229
|
+
// changing parents and calculating the new local offset so this is one
|
|
230
|
+
// placement, rather than a right/left correction animation.
|
|
231
|
+
drag.style.transition = 'none';
|
|
232
|
+
drag.style.transform = 'translate(0, 0)';
|
|
233
|
+
const dropRect = dropElement.getBoundingClientRect();
|
|
234
|
+
const dragRect = drag.getBoundingClientRect();
|
|
235
|
+
const scale = calculateScale() || 1;
|
|
236
|
+
const x = (dropRect.left + dropRect.width / 2 - (dragRect.left + dragRect.width / 2)) / scale;
|
|
237
|
+
const y = (dropRect.top + dropRect.height / 2 - (dragRect.top + dragRect.height / 2)) / scale;
|
|
238
|
+
drag.style.transform = `translate(${x}px, ${y}px)`;
|
|
239
|
+
requestAnimationFrame(() => {
|
|
240
|
+
drag.style.transition = '';
|
|
241
|
+
});
|
|
242
|
+
}
|
|
200
243
|
function updateBalanceOnDrop(dragElement, dropElement) {
|
|
244
|
+
var _a, _b;
|
|
201
245
|
const balanceEl = document.querySelector('lido-balance');
|
|
202
246
|
if (!balanceEl)
|
|
203
247
|
return;
|
|
@@ -205,7 +249,20 @@ function updateBalanceOnDrop(dragElement, dropElement) {
|
|
|
205
249
|
const rightDrag = Array.from(document.querySelectorAll('[drop-to^="righthandle"]'));
|
|
206
250
|
balanceEl.leftVal = calculateValue(leftDrag, balanceEl.operation);
|
|
207
251
|
balanceEl.rightVal = calculateValue(rightDrag, balanceEl.operation);
|
|
252
|
+
const container = document.getElementById('lido-container');
|
|
253
|
+
const objectiveString = (_b = (_a = container === null || container === void 0 ? void 0 : container['objective']) !== null && _a !== void 0 ? _a : container === null || container === void 0 ? void 0 : container.getAttribute('objective')) !== null && _b !== void 0 ? _b : '';
|
|
254
|
+
const isCorrect = !!container && balanceResult(container, objectiveString);
|
|
255
|
+
const dropElements = container ? Array.from(container.querySelectorAll('[type="drop"]')) : [];
|
|
256
|
+
const filledDropCount = dropElements.filter(drop => !!(container === null || container === void 0 ? void 0 : container.querySelector(`[drop-to="${drop.id}"]`))).length;
|
|
257
|
+
const allDropsFilled = dropElements.length > 0 && filledDropCount === dropElements.length;
|
|
258
|
+
if (balanceEl.setFeedbackColor) {
|
|
259
|
+
balanceEl.setFeedbackColor(allDropsFilled && isCorrect ? '#81C127' : allDropsFilled ? '#FF0410' : '');
|
|
260
|
+
}
|
|
208
261
|
if (balanceEl.updateTilt) {
|
|
262
|
+
if (!isCorrect) {
|
|
263
|
+
balanceEl.updateTilt(0, 0);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
209
266
|
balanceEl.updateTilt(balanceEl.leftVal, balanceEl.rightVal);
|
|
210
267
|
}
|
|
211
268
|
}
|
|
@@ -394,6 +451,19 @@ function enableDraggingWithScaling(element) {
|
|
|
394
451
|
let clone = null;
|
|
395
452
|
let duplicateElement = null;
|
|
396
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;
|
|
397
467
|
// Fetch the container element
|
|
398
468
|
const container = document.getElementById(LidoContainer);
|
|
399
469
|
if (!container) {
|
|
@@ -404,6 +474,33 @@ function enableDraggingWithScaling(element) {
|
|
|
404
474
|
return;
|
|
405
475
|
handlingElementFlexibleWidth(element, 'drag');
|
|
406
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
|
+
};
|
|
407
504
|
const onStart = (event) => {
|
|
408
505
|
var _a, _b;
|
|
409
506
|
if (container && container.getAttribute("game-completed") === "true")
|
|
@@ -420,17 +517,29 @@ function enableDraggingWithScaling(element) {
|
|
|
420
517
|
if (event instanceof MouseEvent) {
|
|
421
518
|
startX = event.clientX;
|
|
422
519
|
startY = event.clientY;
|
|
520
|
+
touchStartRect = null;
|
|
423
521
|
}
|
|
424
522
|
else {
|
|
425
523
|
startX = event.touches[0].clientX;
|
|
426
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);
|
|
427
536
|
}
|
|
428
537
|
// Apply dragging styles to the element
|
|
429
538
|
element.style.opacity = '1';
|
|
430
539
|
element.style.cursor = 'grabbing';
|
|
431
540
|
if (((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) {
|
|
432
541
|
const computedStyle = window.getComputedStyle(element);
|
|
433
|
-
const rect = element.getBoundingClientRect();
|
|
542
|
+
const rect = touchStartRect || element.getBoundingClientRect();
|
|
434
543
|
if (!clone) {
|
|
435
544
|
clone = element.cloneNode(true);
|
|
436
545
|
clone.style.left = `${rect.left}px`;
|
|
@@ -449,7 +558,7 @@ function enableDraggingWithScaling(element) {
|
|
|
449
558
|
const imgElement = element.querySelector('img');
|
|
450
559
|
const src = imgElement === null || imgElement === void 0 ? void 0 : imgElement.getAttribute('src');
|
|
451
560
|
const computedStyle = window.getComputedStyle(element);
|
|
452
|
-
const rect = element.getBoundingClientRect();
|
|
561
|
+
const rect = touchStartRect || element.getBoundingClientRect();
|
|
453
562
|
if (!duplicateElement) {
|
|
454
563
|
duplicateElement = element.cloneNode(false);
|
|
455
564
|
duplicateElement.setAttribute('src', src);
|
|
@@ -522,31 +631,31 @@ function enableDraggingWithScaling(element) {
|
|
|
522
631
|
target.style.opacity = value;
|
|
523
632
|
}
|
|
524
633
|
};
|
|
525
|
-
const
|
|
526
|
-
|
|
634
|
+
const processMove = () => {
|
|
635
|
+
pendingMoveFrame = null;
|
|
636
|
+
if (!isDragging || !hasPendingMove)
|
|
527
637
|
return;
|
|
638
|
+
hasPendingMove = false;
|
|
639
|
+
const deferTouchDropValidation = touchTransformUpdated;
|
|
528
640
|
if (isDraggingDisabled) {
|
|
529
641
|
isDragging = false;
|
|
642
|
+
touchTransformUpdated = false;
|
|
530
643
|
return;
|
|
531
644
|
}
|
|
532
|
-
isClicked = false;
|
|
533
645
|
element.style.transition = 'none';
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
const newTop = initialY + dy;
|
|
548
|
-
// Apply transform with translation without boundaries
|
|
549
|
-
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;
|
|
550
659
|
// Check for overlaps and highlight only the most overlapping element
|
|
551
660
|
let mostOverlappedElement = findMostoverlappedElement$1(element, 'drop');
|
|
552
661
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
@@ -585,6 +694,44 @@ function enableDraggingWithScaling(element) {
|
|
|
585
694
|
}
|
|
586
695
|
}
|
|
587
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
|
+
};
|
|
588
735
|
let lastOverlappedElement = null;
|
|
589
736
|
const removeDocumentDragListeners = () => {
|
|
590
737
|
document.removeEventListener('mousemove', onMove);
|
|
@@ -592,9 +739,19 @@ function enableDraggingWithScaling(element) {
|
|
|
592
739
|
document.removeEventListener('touchmove', onMove);
|
|
593
740
|
document.removeEventListener('touchend', onEnd);
|
|
594
741
|
};
|
|
742
|
+
const flushPendingMove = () => {
|
|
743
|
+
if (pendingMoveFrame === null)
|
|
744
|
+
return;
|
|
745
|
+
cancelAnimationFrame(pendingMoveFrame);
|
|
746
|
+
processMove();
|
|
747
|
+
};
|
|
595
748
|
const onEnd = (endEv) => {
|
|
596
749
|
var _a, _b, _c;
|
|
750
|
+
flushPendingMove();
|
|
597
751
|
isDragging = false;
|
|
752
|
+
isTouchDragging = false;
|
|
753
|
+
element.style.willChange = '';
|
|
754
|
+
window.removeEventListener('resize', updateTouchDragScale);
|
|
598
755
|
removeDocumentDragListeners();
|
|
599
756
|
if (isClicked) {
|
|
600
757
|
if (clone) {
|
|
@@ -700,6 +857,15 @@ function enableDraggingWithScaling(element) {
|
|
|
700
857
|
};
|
|
701
858
|
const cleanup = () => {
|
|
702
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;
|
|
703
869
|
observer.disconnect();
|
|
704
870
|
removeDocumentDragListeners();
|
|
705
871
|
element.removeEventListener('mousedown', onStart);
|
|
@@ -773,7 +939,8 @@ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, sel
|
|
|
773
939
|
dragElement.classList.remove('dropped');
|
|
774
940
|
const container = document.getElementById(LidoContainer);
|
|
775
941
|
const cloneArray = container.querySelectorAll(`#${dragElement.id}`);
|
|
776
|
-
const
|
|
942
|
+
const balanceHome = dragElement.__lidoBalanceHome;
|
|
943
|
+
const cloneDragElement = ((balanceHome === null || balanceHome === void 0 ? void 0 : balanceHome.isConnected) ? balanceHome : Array.from(cloneArray).find(item => dragElement !== item && !item.classList.contains('dropped')));
|
|
777
944
|
dragElement.style.transition = 'transform 0.5s ease';
|
|
778
945
|
if (cloneDragElement) {
|
|
779
946
|
animateDragToTarget(dragElement, cloneDragElement, container);
|
|
@@ -790,6 +957,7 @@ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, sel
|
|
|
790
957
|
dragElement.style.transform = 'translate(0,0)';
|
|
791
958
|
dragElement.style.position = 'unset';
|
|
792
959
|
cloneDragElement.replaceWith(dragElement);
|
|
960
|
+
delete dragElement.__lidoBalanceHome;
|
|
793
961
|
}, 500);
|
|
794
962
|
}
|
|
795
963
|
else {
|
|
@@ -1112,6 +1280,10 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
1112
1280
|
}
|
|
1113
1281
|
highlightElement();
|
|
1114
1282
|
await onActivityComplete(dragElement, dropElement);
|
|
1283
|
+
const dropAction = container.getAttribute('drop-action');
|
|
1284
|
+
if (container.querySelector('lido-balance') && dropAction !== DropAction.Move && dropAction !== DropAction.InfiniteDrop) {
|
|
1285
|
+
placeDragOnBalancePlate(dragElement, dropElement);
|
|
1286
|
+
}
|
|
1115
1287
|
}
|
|
1116
1288
|
function updateDropBorder(element) {
|
|
1117
1289
|
var _a;
|
|
@@ -1177,14 +1349,14 @@ async function onClickDropOrDragElement(element, type) {
|
|
|
1177
1349
|
if (!document.querySelector('#dynamic-highlight-style')) {
|
|
1178
1350
|
const style = document.createElement('style');
|
|
1179
1351
|
style.id = 'dynamic-highlight-style';
|
|
1180
|
-
style.innerHTML = `
|
|
1181
|
-
.highlight {
|
|
1182
|
-
// border: 4px solid #e74c3c; /* Thicker red border for more visibility */
|
|
1183
|
-
// border-radius: 12px; /* Larger rounded corners */
|
|
1184
|
-
// background-color: rgba(231, 76, 60, 0.3); /* Stronger, more noticeable background */
|
|
1185
|
-
// box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.2); /* Stronger shadow */
|
|
1186
|
-
// outline: 4px solid rgba(231, 76, 60, 0.6); /* Glow effect */
|
|
1187
|
-
}
|
|
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
|
+
}
|
|
1188
1360
|
`;
|
|
1189
1361
|
document.head.appendChild(style);
|
|
1190
1362
|
}
|
|
@@ -1372,34 +1544,34 @@ function highlightSpeakingElement(element) {
|
|
|
1372
1544
|
if (!document.getElementById(styleId)) {
|
|
1373
1545
|
const style = document.createElement('style');
|
|
1374
1546
|
style.id = styleId;
|
|
1375
|
-
style.innerHTML = `
|
|
1376
|
-
.speaking-highlight {
|
|
1377
|
-
--base-transform: ${element.style.transform};
|
|
1378
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9) !important; /* Stronger orange glow effect */
|
|
1379
|
-
// border: 3px solid green !important;
|
|
1380
|
-
// transition: box-shadow 0.5s ease-in-out, transform 0.5s ease-in-out;
|
|
1381
|
-
// transform: scale(1.05); /* Subtle scale effect to pop the element */
|
|
1382
|
-
// animation: pulseEffect 1.5s infinite; /* Pulsing animation */
|
|
1383
|
-
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
@keyframes pulseEffect {
|
|
1387
|
-
0% {
|
|
1388
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1389
|
-
// transform: var(--base-transform) scale(1.05);
|
|
1390
|
-
// background-color: #FFFF0B;
|
|
1391
|
-
}
|
|
1392
|
-
50% {
|
|
1393
|
-
box-shadow: 0 0 30px 15px rgba(255, 165, 0, 1);
|
|
1394
|
-
// transform: var(--base-transform) scale(1.1);
|
|
1395
|
-
// background-color: #FFFF0B;
|
|
1396
|
-
}
|
|
1397
|
-
100% {
|
|
1398
|
-
box-shadow: 0 0 20px 10px rgba(255, 165, 0, 0.9);
|
|
1399
|
-
// transform: var(--base-transform) scale(1.05);
|
|
1400
|
-
// background-color: #FFFF0B;
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
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
|
+
}
|
|
1403
1575
|
`;
|
|
1404
1576
|
document.head.appendChild(style);
|
|
1405
1577
|
}
|
|
@@ -1574,7 +1746,7 @@ class AudioPlayer {
|
|
|
1574
1746
|
return el;
|
|
1575
1747
|
return el.closest('lido-text');
|
|
1576
1748
|
}
|
|
1577
|
-
async play(targetElement) {
|
|
1749
|
+
async play(targetElement, suppressHighlight = false) {
|
|
1578
1750
|
this.registerVisibilityEvents();
|
|
1579
1751
|
this.playbackHasStarted = false;
|
|
1580
1752
|
if (!this.isWindowVisible()) {
|
|
@@ -1598,11 +1770,6 @@ class AudioPlayer {
|
|
|
1598
1770
|
console.warn('[AudioPlayer] No lido-container found');
|
|
1599
1771
|
return;
|
|
1600
1772
|
}
|
|
1601
|
-
// Check if speaking is disabled on the target element or its closest lido-text parent
|
|
1602
|
-
targetElement.closest('lido-text');
|
|
1603
|
-
// if(text && text.getAttribute('disable-speak')==='true'){
|
|
1604
|
-
// return;
|
|
1605
|
-
// }
|
|
1606
1773
|
if (container.getAttribute('highlight-word-by-word') === 'true') {
|
|
1607
1774
|
const textElement = this.getLidoTextElement(targetElement);
|
|
1608
1775
|
if (!textElement) {
|
|
@@ -1614,6 +1781,7 @@ class AudioPlayer {
|
|
|
1614
1781
|
targetElement = textElement;
|
|
1615
1782
|
}
|
|
1616
1783
|
this.currentTargetElement = targetElement;
|
|
1784
|
+
window.dispatchEvent(new CustomEvent('lidoAudioStarted', { detail: { target: targetElement } }));
|
|
1617
1785
|
// then play the target element audio.
|
|
1618
1786
|
let audioUrl = targetElement.getAttribute('audio') || '';
|
|
1619
1787
|
// If no direct audio attribute, check childrens for audio
|
|
@@ -1663,7 +1831,8 @@ class AudioPlayer {
|
|
|
1663
1831
|
this.wordRects = this.computeWordRects(targetElement);
|
|
1664
1832
|
}
|
|
1665
1833
|
else {
|
|
1666
|
-
|
|
1834
|
+
if (!suppressHighlight)
|
|
1835
|
+
highlightSpeakingElement(targetElement);
|
|
1667
1836
|
}
|
|
1668
1837
|
// PLAY ONCE
|
|
1669
1838
|
await this.audioElement.play();
|
|
@@ -1687,18 +1856,17 @@ class AudioPlayer {
|
|
|
1687
1856
|
this.audioElement.onended = null; // cleanup
|
|
1688
1857
|
setDraggingDisabled(false);
|
|
1689
1858
|
if (container.getAttribute('highlight-word-by-word') !== 'true') {
|
|
1690
|
-
|
|
1859
|
+
if (!suppressHighlight)
|
|
1860
|
+
stopHighlightForSpeakingElement(targetElement);
|
|
1691
1861
|
}
|
|
1692
1862
|
}
|
|
1693
1863
|
}
|
|
1694
1864
|
// If no audio, use text-to-speech
|
|
1695
1865
|
else if (targetElement.textContent) {
|
|
1696
1866
|
try {
|
|
1697
|
-
|
|
1698
|
-
|
|
1867
|
+
if (!suppressHighlight)
|
|
1868
|
+
highlightSpeakingElement(targetElement);
|
|
1699
1869
|
await speakText(targetElement.textContent, targetElement);
|
|
1700
|
-
document.querySelectorAll('.speaking-highlight');
|
|
1701
|
-
// highlightedElements.forEach(element => stopHighlightForSpeakingElement(element as HTMLElement));
|
|
1702
1870
|
}
|
|
1703
1871
|
catch (error) { }
|
|
1704
1872
|
finally {
|
|
@@ -1716,6 +1884,7 @@ class AudioPlayer {
|
|
|
1716
1884
|
if (this.currentTargetElement === targetElement) {
|
|
1717
1885
|
this.currentTargetElement = null;
|
|
1718
1886
|
}
|
|
1887
|
+
window.dispatchEvent(new CustomEvent('lidoAudioEnded', { detail: { target: targetElement } }));
|
|
1719
1888
|
}
|
|
1720
1889
|
// GLOBAL STOP EVENTS (container change, activity change…)
|
|
1721
1890
|
registerGlobalStopEvents() {
|
|
@@ -2108,11 +2277,11 @@ function enableReorderDrag(element) {
|
|
|
2108
2277
|
onDropToCategory(element, category);
|
|
2109
2278
|
}
|
|
2110
2279
|
if (divEl) {
|
|
2111
|
-
const keyframes = `
|
|
2112
|
-
@keyframes widthDecrease {
|
|
2113
|
-
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
2114
|
-
100% { width: 0px; height: 0px;}
|
|
2115
|
-
}
|
|
2280
|
+
const keyframes = `
|
|
2281
|
+
@keyframes widthDecrease {
|
|
2282
|
+
0% { width: ${divEl.offsetWidth}px; height: ${divEl.offsetHeight}px; }
|
|
2283
|
+
100% { width: 0px; height: 0px;}
|
|
2284
|
+
}
|
|
2116
2285
|
`;
|
|
2117
2286
|
const styleSheet = document.styleSheets[0];
|
|
2118
2287
|
styleSheet.insertRule(keyframes, styleSheet.cssRules.length);
|
|
@@ -2335,11 +2504,11 @@ function moveWithAnimation(target, overlapped) {
|
|
|
2335
2504
|
const dummy = createDummyElement(target);
|
|
2336
2505
|
dummy.style.visibility = 'hidden';
|
|
2337
2506
|
dummy.setAttribute('type', 'dummy');
|
|
2338
|
-
const keyframes = `
|
|
2339
|
-
@keyframes widthIncrease {
|
|
2340
|
-
0% { width: 0px; height: 0px; }
|
|
2341
|
-
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
2342
|
-
}
|
|
2507
|
+
const keyframes = `
|
|
2508
|
+
@keyframes widthIncrease {
|
|
2509
|
+
0% { width: 0px; height: 0px; }
|
|
2510
|
+
100% { width: ${target.offsetWidth}px; height: ${target.offsetHeight}px;}
|
|
2511
|
+
}
|
|
2343
2512
|
`;
|
|
2344
2513
|
if (!overlapped) {
|
|
2345
2514
|
const overlapCategory = findMostoverlappedElement(target, 'category');
|
|
@@ -73037,11 +73206,11 @@ const afterDropDragHandling = (dragElement, dropElement) => {
|
|
|
73037
73206
|
}
|
|
73038
73207
|
dummyElement.setAttribute('id', dragElement.getAttribute('id'));
|
|
73039
73208
|
dragElement.replaceWith(dummyElement);
|
|
73040
|
-
const keyframes = `
|
|
73041
|
-
@keyframes widthDecrease {
|
|
73042
|
-
0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
|
|
73043
|
-
100% { width: 0px; height: 0px; margin: 0px;}
|
|
73044
|
-
}
|
|
73209
|
+
const keyframes = `
|
|
73210
|
+
@keyframes widthDecrease {
|
|
73211
|
+
0% { width: ${dragElement.style.width}; height: ${dragElement.style.height}; margin: ${dragElement.style.margin}; }
|
|
73212
|
+
100% { width: 0px; height: 0px; margin: 0px;}
|
|
73213
|
+
}
|
|
73045
73214
|
`;
|
|
73046
73215
|
if (!isInfinite) {
|
|
73047
73216
|
dummyElement.style.width = element.style.width;
|
|
@@ -73251,7 +73420,16 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
73251
73420
|
if (!container)
|
|
73252
73421
|
return;
|
|
73253
73422
|
const isBlender = container.getAttribute('template-id') === 'blender';
|
|
73254
|
-
|
|
73423
|
+
const isBalancing = !!container.querySelector('lido-balance');
|
|
73424
|
+
const usesBalancePlacement = isBalancing
|
|
73425
|
+
&& container.getAttribute('drop-action') !== DropAction.Move
|
|
73426
|
+
&& container.getAttribute('drop-action') !== DropAction.InfiniteDrop;
|
|
73427
|
+
// Balance plates perform their own single placement pass after this method.
|
|
73428
|
+
// Running alignMatch first makes two transforms compete and produces a visible
|
|
73429
|
+
// horizontal drift as the item is re-parented.
|
|
73430
|
+
if (!usesBalancePlacement) {
|
|
73431
|
+
await executeActions("this.alignMatch='true'", dropElement, dragElement);
|
|
73432
|
+
}
|
|
73255
73433
|
if (dragElement && dropElement) {
|
|
73256
73434
|
let isCorrect = dropElement['value'].toLowerCase().includes(dragElement['value'].toLowerCase());
|
|
73257
73435
|
if (isBlender) {
|
|
@@ -73274,7 +73452,7 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
73274
73452
|
const onCorrect = ((_b = container.getAttribute('dropAttr')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === DropMode.EnableAnimation.toLowerCase()
|
|
73275
73453
|
? ''
|
|
73276
73454
|
: dropElement.getAttribute('onCorrect');
|
|
73277
|
-
if (onCorrect && !isBlender) {
|
|
73455
|
+
if (onCorrect && !isBlender && !isBalancing) {
|
|
73278
73456
|
await executeActions(onCorrect, dropElement, dragElement);
|
|
73279
73457
|
}
|
|
73280
73458
|
//for multiply beeds
|
|
@@ -73313,7 +73491,7 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
73313
73491
|
}, 2000);
|
|
73314
73492
|
}
|
|
73315
73493
|
const onInCorrect = dropElement.getAttribute('onInCorrect');
|
|
73316
|
-
if (onInCorrect && !isBlender) {
|
|
73494
|
+
if (onInCorrect && !isBlender && !isBalancing) {
|
|
73317
73495
|
await executeActions(onInCorrect, dropElement, dragElement);
|
|
73318
73496
|
}
|
|
73319
73497
|
}
|
|
@@ -73481,6 +73659,13 @@ const validateObjectiveStatus = async () => {
|
|
|
73481
73659
|
else {
|
|
73482
73660
|
res = matchStringPattern(objectiveString, objectiveArray);
|
|
73483
73661
|
}
|
|
73662
|
+
const isBalancing = !!container.querySelector('lido-balance');
|
|
73663
|
+
if (isBalancing && !res) {
|
|
73664
|
+
const dropElements = Array.from(container.querySelectorAll('[type="drop"]'));
|
|
73665
|
+
const filledDropCount = dropElements.filter(drop => !!container.querySelector(`[drop-to="${drop.id}"]`)).length;
|
|
73666
|
+
if (filledDropCount < dropElements.length)
|
|
73667
|
+
return;
|
|
73668
|
+
}
|
|
73484
73669
|
if (res) {
|
|
73485
73670
|
container.setAttribute("game-completed", "true");
|
|
73486
73671
|
const attach = container.getAttribute('appendToDropOnCompletion');
|
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-bo7729YG.js';
|
|
2
|
+
import './index-Dvjbti-h.js';
|