lido-player 0.0.2-beta-15-dev → 0.0.2-beta-16-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-Xh5IDmFh.js → decode-C08Ujimj.js} +1 -1
- package/dist/cjs/{index-B9AON0kM.js → index-BkBqiwe8.js} +20 -8
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +2 -2
- package/dist/collection/utils/constants.js +1 -0
- package/dist/collection/utils/utilsHandlers/animationHandler.js +20 -9
- package/dist/components/index.js +1 -1
- package/dist/esm/{decode-C-vVYHke.js → decode-CGJIPA4t.js} +1 -1
- package/dist/esm/{index-BswlHnsY.js → index-C854B63S.js} +20 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +2 -2
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/{p-CYMdg2_E.js → p-Bg5mBsd9.js} +1 -1
- package/dist/lido-player/p-C4OTDhbr.js +1 -0
- package/dist/lido-player/{p-b2c60372.entry.js → p-f0e333c6.entry.js} +2 -2
- package/dist/types/utils/constants.d.ts +1 -0
- package/package.json +1 -1
- package/dist/lido-player/p-0l6uR1lH.js +0 -1
|
@@ -4,6 +4,7 @@ var index$1 = require('./index-Dy19zuTX.js');
|
|
|
4
4
|
|
|
5
5
|
const DragMapKey = 'lidoDragMap';
|
|
6
6
|
const SelectedValuesKey = 'lidoSelectedValues';
|
|
7
|
+
const AnimationVanishedValuesKey = 'data-animation-vanished-values';
|
|
7
8
|
const ActivityScoreKey = 'lidoActivityScore';
|
|
8
9
|
const ActivityEndKey = 'lidoActivityEnd';
|
|
9
10
|
const LessonEndKey = 'lidoLessonEnd';
|
|
@@ -260,11 +261,20 @@ function balanceResult(container, objectiveString) {
|
|
|
260
261
|
return res;
|
|
261
262
|
}
|
|
262
263
|
|
|
263
|
-
const
|
|
264
|
+
const readVanishedValues = (container) => {
|
|
265
|
+
var _a;
|
|
266
|
+
try {
|
|
267
|
+
const values = JSON.parse((_a = container.getAttribute(AnimationVanishedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
268
|
+
return Array.isArray(values) ? values : [];
|
|
269
|
+
}
|
|
270
|
+
catch (_b) {
|
|
271
|
+
return [];
|
|
272
|
+
}
|
|
273
|
+
};
|
|
264
274
|
function dragDropAnimation(container, dragElement, dropElement) {
|
|
265
275
|
container.style.pointerEvents = "none";
|
|
266
276
|
setTimeout(async () => {
|
|
267
|
-
var _a, _b
|
|
277
|
+
var _a, _b;
|
|
268
278
|
const div = document.createElement('div');
|
|
269
279
|
container.append(div);
|
|
270
280
|
div.classList.add('after-drop-popup-container');
|
|
@@ -273,10 +283,11 @@ function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
273
283
|
const allDragElements = container.querySelectorAll('[type="drag"]');
|
|
274
284
|
const dragParents = Array.from(allDragElements).map(el => el.parentElement);
|
|
275
285
|
const allSameParent = dragParents.every(parent => parent === dragElement.parentElement);
|
|
276
|
-
|
|
277
|
-
const vanishedValue = (
|
|
286
|
+
const vanishedValues = readVanishedValues(container);
|
|
287
|
+
const vanishedValue = (_a = dragElement.getAttribute('value')) !== null && _a !== void 0 ? _a : (_b = dragElement.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
278
288
|
if (vanishedValue) {
|
|
279
|
-
|
|
289
|
+
vanishedValues.push(vanishedValue);
|
|
290
|
+
container.setAttribute(AnimationVanishedValuesKey, JSON.stringify(vanishedValues));
|
|
280
291
|
}
|
|
281
292
|
// Remove from old parents
|
|
282
293
|
if (allSameParent) {
|
|
@@ -294,9 +305,10 @@ function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
294
305
|
div.appendChild(dropElement);
|
|
295
306
|
dropElement.classList.remove('empty');
|
|
296
307
|
const objective = container.getAttribute('objective');
|
|
308
|
+
const normalizedVanishedValues = vanishedValues.map(v => v.trim()).sort().join(',');
|
|
309
|
+
const normalizedObjective = objective === null || objective === void 0 ? void 0 : objective.split(',').map(v => v.trim()).sort().join(',');
|
|
297
310
|
const isObjectiveComplete = !!objective &&
|
|
298
|
-
|
|
299
|
-
objective.split(',').map(v => v.trim()).sort().join(',');
|
|
311
|
+
normalizedVanishedValues === normalizedObjective;
|
|
300
312
|
if (dropElement.getAttribute('type') === 'drop') {
|
|
301
313
|
const dropOnCorrect = dropElement.getAttribute('onCorrect') || '';
|
|
302
314
|
await executeActions(dropOnCorrect, dropElement, dragElement);
|
|
@@ -315,7 +327,7 @@ function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
315
327
|
if (isObjectiveComplete) {
|
|
316
328
|
calculateScore();
|
|
317
329
|
triggerNextContainer();
|
|
318
|
-
|
|
330
|
+
container.removeAttribute(AnimationVanishedValuesKey);
|
|
319
331
|
}
|
|
320
332
|
}, 800); // match animation duration
|
|
321
333
|
}, 250);
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-Dy19zuTX.js');
|
|
4
|
-
var index$1 = require('./index-
|
|
4
|
+
var index$1 = require('./index-BkBqiwe8.js');
|
|
5
5
|
|
|
6
6
|
var rive$1 = {exports: {}};
|
|
7
7
|
|
|
@@ -12952,7 +12952,7 @@ const LidoHome = class {
|
|
|
12952
12952
|
}
|
|
12953
12953
|
// Pure-JS fallback (no wasm asset required)
|
|
12954
12954
|
try {
|
|
12955
|
-
const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-
|
|
12955
|
+
const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-C08Ujimj.js'); }).then(function (n) { return n.decode; });
|
|
12956
12956
|
const brotliDecompressBuffer = brotliDecodeModule.BrotliDecompressBuffer || ((_a = brotliDecodeModule.default) === null || _a === void 0 ? void 0 : _a.BrotliDecompressBuffer);
|
|
12957
12957
|
if (typeof brotliDecompressBuffer !== 'function') {
|
|
12958
12958
|
throw new Error('BrotliDecompressBuffer function not found in brotli/dec/decode');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const DragSelectedMapKey = 'lidoDragSelectedMap';
|
|
2
2
|
export const DragMapKey = 'lidoDragMap';
|
|
3
3
|
export const SelectedValuesKey = 'lidoSelectedValues';
|
|
4
|
+
export const AnimationVanishedValuesKey = 'data-animation-vanished-values';
|
|
4
5
|
export const ActivityScoreKey = 'lidoActivityScore';
|
|
5
6
|
export const ActivityEndKey = 'lidoActivityEnd';
|
|
6
7
|
export const LessonEndKey = 'lidoLessonEnd';
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnimationVanishedValuesKey } from "../constants";
|
|
2
2
|
import { calculateScore, executeActions, triggerNextContainer } from "../utils";
|
|
3
|
-
const
|
|
3
|
+
const readVanishedValues = (container) => {
|
|
4
|
+
var _a;
|
|
5
|
+
try {
|
|
6
|
+
const values = JSON.parse((_a = container.getAttribute(AnimationVanishedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
7
|
+
return Array.isArray(values) ? values : [];
|
|
8
|
+
}
|
|
9
|
+
catch (_b) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
4
13
|
export function dragDropAnimation(container, dragElement, dropElement) {
|
|
5
14
|
container.style.pointerEvents = "none";
|
|
6
15
|
setTimeout(async () => {
|
|
7
|
-
var _a, _b
|
|
16
|
+
var _a, _b;
|
|
8
17
|
const div = document.createElement('div');
|
|
9
18
|
container.append(div);
|
|
10
19
|
div.classList.add('after-drop-popup-container');
|
|
@@ -13,10 +22,11 @@ export function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
13
22
|
const allDragElements = container.querySelectorAll('[type="drag"]');
|
|
14
23
|
const dragParents = Array.from(allDragElements).map(el => el.parentElement);
|
|
15
24
|
const allSameParent = dragParents.every(parent => parent === dragElement.parentElement);
|
|
16
|
-
const
|
|
17
|
-
const vanishedValue = (
|
|
25
|
+
const vanishedValues = readVanishedValues(container);
|
|
26
|
+
const vanishedValue = (_a = dragElement.getAttribute('value')) !== null && _a !== void 0 ? _a : (_b = dragElement.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
18
27
|
if (vanishedValue) {
|
|
19
|
-
|
|
28
|
+
vanishedValues.push(vanishedValue);
|
|
29
|
+
container.setAttribute(AnimationVanishedValuesKey, JSON.stringify(vanishedValues));
|
|
20
30
|
}
|
|
21
31
|
// Remove from old parents
|
|
22
32
|
if (allSameParent) {
|
|
@@ -34,9 +44,10 @@ export function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
34
44
|
div.appendChild(dropElement);
|
|
35
45
|
dropElement.classList.remove('empty');
|
|
36
46
|
const objective = container.getAttribute('objective');
|
|
47
|
+
const normalizedVanishedValues = vanishedValues.map(v => v.trim()).sort().join(',');
|
|
48
|
+
const normalizedObjective = objective === null || objective === void 0 ? void 0 : objective.split(',').map(v => v.trim()).sort().join(',');
|
|
37
49
|
const isObjectiveComplete = !!objective &&
|
|
38
|
-
|
|
39
|
-
objective.split(',').map(v => v.trim()).sort().join(',');
|
|
50
|
+
normalizedVanishedValues === normalizedObjective;
|
|
40
51
|
if (dropElement.getAttribute('type') === 'drop') {
|
|
41
52
|
const dropOnCorrect = dropElement.getAttribute('onCorrect') || '';
|
|
42
53
|
await executeActions(dropOnCorrect, dropElement, dragElement);
|
|
@@ -55,7 +66,7 @@ export function dragDropAnimation(container, dragElement, dropElement) {
|
|
|
55
66
|
if (isObjectiveComplete) {
|
|
56
67
|
calculateScore();
|
|
57
68
|
triggerNextContainer();
|
|
58
|
-
|
|
69
|
+
container.removeAttribute(AnimationVanishedValuesKey);
|
|
59
70
|
}
|
|
60
71
|
}, 800); // match animation duration
|
|
61
72
|
}, 250);
|