lido-player 0.0.2-beta-24 → 0.0.2-beta-25-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{decode-BCvdWRyT.js → decode-BSImuLEU.js} +1 -1
- package/dist/cjs/{index-DjM03fsg.js → index-DRw2yVbg.js} +112 -27
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +117 -17
- package/dist/cjs/lido-player.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/container/lido-container.css +24 -0
- package/dist/collection/components/container/lido-container.js +48 -2
- package/dist/collection/components/flashCard/lido-flash-card.js +14 -5
- package/dist/collection/components/home/lido-home.js +3 -6
- package/dist/collection/components/root/lido-root.js +1 -1
- package/dist/collection/components/text/lido-text.js +1 -1
- package/dist/collection/utils/audioPlayer.js +3 -1
- package/dist/collection/utils/utils.js +50 -7
- package/dist/collection/utils/utilsHandlers/slideHandler.js +58 -19
- package/dist/components/index.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-container.js +1 -1
- package/dist/components/lido-flash-card.js +1 -1
- package/dist/components/lido-float.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-image.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-math-matrix.js +1 -1
- package/dist/components/lido-root.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/p-AaE392x7.js +1 -0
- package/dist/components/p-B-mIxynb.js +1 -0
- package/dist/components/{p-CFPSty2U.js → p-BSWrnLbC.js} +1 -1
- package/dist/components/{p-Bv1hunWk.js → p-BW0855oZ.js} +1 -1
- package/dist/components/{p-CFWohOId.js → p-BfJG1wmU.js} +1 -1
- package/dist/components/{p-B8nzzM8c.js → p-CK9M0Kcf.js} +1 -1
- package/dist/components/{p-DLyacZap.js → p-CSxwfvl3.js} +1 -1
- package/dist/components/{p-Bh_vemY3.js → p-CVZEVfip.js} +1 -1
- package/dist/components/{p-C5jvgiPE.js → p-Cf85Nc-6.js} +1 -1
- package/dist/components/{p-C-pHQRbp.js → p-CuDMRxx_.js} +1 -1
- package/dist/components/{p-Gwko4CTL.js → p-DPGOqpde.js} +1 -1
- package/dist/components/p-i3W5bJbL.js +12 -0
- package/dist/esm/{decode-BxzUG5XP.js → decode-D2f5bktc.js} +1 -1
- package/dist/esm/{index-C_uxZLF-.js → index-BB56Mo3L.js} +112 -28
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +117 -17
- package/dist/esm/lido-player.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-53d245b0.entry.js +12 -0
- package/dist/lido-player/p-DKuh-2gv.js +1 -0
- package/dist/lido-player/{p-CsCr7DlS.js → p-DSlo480E.js} +1 -1
- package/dist/types/components/container/lido-container.d.ts +7 -0
- package/dist/types/utils/utils.d.ts +7 -0
- package/dist/types/utils/utilsHandlers/slideHandler.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p-CgBwmr9A.js +0 -12
- package/dist/components/p-Ckb8QhUV.js +0 -1
- package/dist/components/p-DDwqmTYM.js +0 -1
- package/dist/lido-player/p-00993d1a.entry.js +0 -12
- package/dist/lido-player/p-v3GBrpv9.js +0 -1
|
@@ -160,6 +160,7 @@ export function slidingWithScaling(element) {
|
|
|
160
160
|
};
|
|
161
161
|
// Start observing the element
|
|
162
162
|
observer.observe(parentElement, observerConfig);
|
|
163
|
+
let mostOverlappedElement;
|
|
163
164
|
const onMove = (event) => {
|
|
164
165
|
if (!isDragging)
|
|
165
166
|
return;
|
|
@@ -180,12 +181,14 @@ export function slidingWithScaling(element) {
|
|
|
180
181
|
// Get the dimensions and scale-corrected position of the container and element
|
|
181
182
|
const containerRect = parentElement.getBoundingClientRect();
|
|
182
183
|
const elementRect = element.getBoundingClientRect();
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
const
|
|
188
|
-
const
|
|
184
|
+
// Firefox serializes translate(x, 0) as translate(x), so parsing the
|
|
185
|
+
// inline string can lose Y and produce NaN. Read the computed matrix instead.
|
|
186
|
+
const transform = window.getComputedStyle(element).transform;
|
|
187
|
+
const translation = new DOMMatrixReadOnly(transform === 'none' ? undefined : transform);
|
|
188
|
+
const initialElementLeftPx = elementRect.left / parentElementScale - translation.m41;
|
|
189
|
+
const initialElementTopPx = elementRect.top - translation.m42;
|
|
190
|
+
const initialElementRightPx = elementRect.right / parentElementScale - translation.m41;
|
|
191
|
+
const initialElementBottomPx = elementRect.bottom - translation.m42;
|
|
189
192
|
const maxRight = containerRect.right - initialElementRightPx;
|
|
190
193
|
const maxLeft = containerRect.left - initialElementLeftPx;
|
|
191
194
|
const maxTop = containerRect.top - initialElementTopPx;
|
|
@@ -195,7 +198,7 @@ export function slidingWithScaling(element) {
|
|
|
195
198
|
// Apply transform with translation within boundaries
|
|
196
199
|
element.style.transform = `translate(${newLeftClamp}px, ${newTopClamp}px)`;
|
|
197
200
|
// Check for overlaps and highlight only the most overlapping element
|
|
198
|
-
|
|
201
|
+
mostOverlappedElement = findMostoverlappedElement(element, 'slide');
|
|
199
202
|
// Apply styles only to the most overlapped element
|
|
200
203
|
if (mostOverlappedElement) {
|
|
201
204
|
if (mostOverlappedElement != element) {
|
|
@@ -256,6 +259,7 @@ export function slidingWithScaling(element) {
|
|
|
256
259
|
setTimeout(() => {
|
|
257
260
|
if (overlapElement) {
|
|
258
261
|
void slideCompleted(element);
|
|
262
|
+
updateReorderCorrectness(container, element, mostOverlappedElement);
|
|
259
263
|
overlapElement = false;
|
|
260
264
|
}
|
|
261
265
|
}, 300);
|
|
@@ -298,18 +302,50 @@ export const isArrangeLettersComplete = (slideValues, objectiveString) => {
|
|
|
298
302
|
return slideValues.length === objectiveValues.length
|
|
299
303
|
&& slideValues.every((value, index) => value === objectiveValues[index]);
|
|
300
304
|
};
|
|
301
|
-
export const updateReorderCorrectness = (container,
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
305
|
+
export const updateReorderCorrectness = (container, slideElement, overlappedElement) => {
|
|
306
|
+
const allSlideElements = Array.from(container.querySelectorAll('[type="slide"]'));
|
|
307
|
+
const elementIndex = allSlideElements.indexOf(slideElement);
|
|
308
|
+
const overlappedElementIndex = allSlideElements.indexOf(overlappedElement);
|
|
309
|
+
const objectiveString = document.getElementById(LidoContainer)['objective'];
|
|
310
|
+
const objectiveArray = objectiveString.split(',');
|
|
311
|
+
const slideValues = getSlideValuesForValidation(container, allSlideElements);
|
|
312
|
+
const isCorrect = elementIndex >= 0 && elementIndex < objectiveArray.length
|
|
313
|
+
? matchStringPattern(slideValues[elementIndex], [objectiveArray[elementIndex].trim()])
|
|
314
|
+
: false;
|
|
315
|
+
const isCorrectOverlap = overlappedElementIndex >= 0 && overlappedElementIndex < objectiveArray.length
|
|
316
|
+
? matchStringPattern(slideValues[overlappedElementIndex], [objectiveArray[overlappedElementIndex].trim()])
|
|
317
|
+
: false;
|
|
318
|
+
if (isCorrect && isCorrectOverlap) {
|
|
319
|
+
updateElementCategoryClass(slideElement, true);
|
|
320
|
+
updateElementCategoryClass(overlappedElement, true);
|
|
321
|
+
}
|
|
322
|
+
else if (isCorrect) {
|
|
323
|
+
updateElementCategoryClass(slideElement, true);
|
|
324
|
+
updateElementCategoryClass(overlappedElement, false);
|
|
325
|
+
}
|
|
326
|
+
else if (isCorrectOverlap) {
|
|
327
|
+
updateElementCategoryClass(slideElement, false);
|
|
328
|
+
updateElementCategoryClass(overlappedElement, true);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
updateElementCategoryClass(slideElement, false);
|
|
332
|
+
updateElementCategoryClass(overlappedElement, false);
|
|
333
|
+
}
|
|
312
334
|
};
|
|
335
|
+
function updateElementCategoryClass(element, isCorrect) {
|
|
336
|
+
if (!element)
|
|
337
|
+
return;
|
|
338
|
+
const correctClass = 'category-dropped-onCorrect';
|
|
339
|
+
const incorrectClass = 'category-dropped-onInCorrect';
|
|
340
|
+
if (isCorrect) {
|
|
341
|
+
element.classList.add(correctClass);
|
|
342
|
+
element.classList.remove(incorrectClass);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
element.classList.add(incorrectClass);
|
|
346
|
+
element.classList.remove(correctClass);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
313
349
|
export const isReorderComplete = (slideValues, objectiveString) => {
|
|
314
350
|
if (!objectiveString)
|
|
315
351
|
return false;
|
|
@@ -337,7 +373,10 @@ const slideCompleted = async (slideElement) => {
|
|
|
337
373
|
updateArrangeLettersCorrectness(container, slideValues, objectiveArray);
|
|
338
374
|
}
|
|
339
375
|
else if (isReorderContainer(container)) {
|
|
340
|
-
|
|
376
|
+
if (isReorderComplete(slideValues, objectiveString)) {
|
|
377
|
+
allSlideElements.forEach(item => updateElementCategoryClass(item, true));
|
|
378
|
+
}
|
|
379
|
+
// updateReorderCorrectness(container, slideValues, objectiveArray);
|
|
341
380
|
}
|
|
342
381
|
if (container.getAttribute('is-continue-on-correct') === 'true') {
|
|
343
382
|
storingEachActivityScore(true);
|