lido-player 0.0.2-alpha-89 → 0.0.2-alpha-91
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-BCtIYiSY.js → decode-Cxruqwoh.js} +1 -1
- package/dist/cjs/{index-BDnxAitU.js → index-CQUhGhpN.js} +124 -10
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +917 -864
- package/dist/collection/components/avatar/lido-avatar.js +2 -1
- package/dist/collection/components/avatar/lido-avatar.tsx +205 -0
- package/dist/collection/components/avatar/readme.md +49 -0
- package/dist/collection/components/avatar/rive.wasm +0 -0
- package/dist/collection/components/calculator/lido-calculator.js +19 -3
- package/dist/collection/components/mathMatrix/lido-math-matrix.js +12 -4
- package/dist/collection/stories/Templates/balancing/balancing.stories.js +1 -3
- package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +63 -38
- package/dist/collection/utils/utils.js +82 -1
- package/dist/collection/utils/utilsHandlers/clickHandler.js +15 -10
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +28 -0
- package/dist/components/index.js +1 -1
- package/dist/components/lido-avatar.js +1 -1
- package/dist/components/lido-calculator.js +1 -1
- package/dist/components/lido-canvas.js +1 -1
- package/dist/components/lido-container.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-root.js +1 -1
- package/dist/components/lido-text.js +1 -1
- package/dist/components/{p-BTz3EQ20.js → p-B4DP0itc.js} +1 -1
- package/dist/components/p-BLegTCI6.js +1 -0
- package/dist/components/p-Blfvc5ur.js +1 -0
- package/dist/components/{p-Rj3OoDuM.js → p-CEApiv2D.js} +1 -1
- package/dist/components/{p-DJRMkWry.js → p-CjVAmIbr.js} +1 -1
- package/dist/components/p-D4ANz_-F.js +1 -0
- package/dist/components/{p-CwFY1Z9W.js → p-Dbt0Faps.js} +1 -1
- package/dist/components/p-sQ9Xymmk.js +1 -0
- package/dist/esm/{decode-CT-ttsFh.js → decode-B3ARTCXB.js} +1 -1
- package/dist/esm/{index-Da41OKR1.js → index-DWzraGKf.js} +125 -11
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +917 -864
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-avatar.css +4 -0
- package/dist/lido-player/lido-avatar.tsx +205 -0
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-947c0aaf.entry.js +1 -0
- package/dist/lido-player/{p-DO-Y_QEx.js → p-BJJjJImf.js} +1 -1
- package/dist/lido-player/p-DvgXp0H2.js +1 -0
- package/dist/lido-player/readme.md +49 -0
- package/dist/lido-player/rive.wasm +0 -0
- package/dist/types/stories/Templates/multiplyBeeds/multiplyBeeds.stories.d.ts +2 -8
- package/dist/types/utils/utilsHandlers/dragDropHandler.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-BOHNyYPi.js +0 -1
- package/dist/components/p-D3xRBDKa.js +0 -1
- package/dist/components/p-jt8Ishvd.js +0 -1
- package/dist/components/p-jz0c9WDH.js +0 -1
- package/dist/lido-player/p-CspJVyn4.js +0 -1
- package/dist/lido-player/p-b3eca1a1.entry.js +0 -1
|
@@ -1180,6 +1180,34 @@ const reduceSizeToOriginal = () => {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
});
|
|
1182
1182
|
};
|
|
1183
|
+
const multiplyBeedsCalculation = (dropElement) => {
|
|
1184
|
+
var _a, _b;
|
|
1185
|
+
const container = document.getElementById("lido-container");
|
|
1186
|
+
const beedsTextPlace = container.querySelector("#beedsText");
|
|
1187
|
+
if (!beedsTextPlace)
|
|
1188
|
+
return;
|
|
1189
|
+
const colsText = (_a = dropElement.getAttribute("cols")) !== null && _a !== void 0 ? _a : "";
|
|
1190
|
+
if (colsText.trim() === "")
|
|
1191
|
+
return;
|
|
1192
|
+
const currentText = ((_b = beedsTextPlace.textContent) !== null && _b !== void 0 ? _b : "").trim();
|
|
1193
|
+
if (currentText === "") {
|
|
1194
|
+
beedsTextPlace.textContent = colsText;
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
// Keep the expression part before "=" if it already exists.
|
|
1198
|
+
const expression = currentText.split("=")[0].trim();
|
|
1199
|
+
const newExpression = expression ? `${expression}+${colsText}` : colsText;
|
|
1200
|
+
const sum = newExpression
|
|
1201
|
+
.split("+")
|
|
1202
|
+
.map(part => Number(part.trim()))
|
|
1203
|
+
.reduce((acc, val) => (Number.isNaN(val) ? NaN : acc + val), 0);
|
|
1204
|
+
if (Number.isNaN(sum)) {
|
|
1205
|
+
beedsTextPlace.textContent = newExpression;
|
|
1206
|
+
}
|
|
1207
|
+
else {
|
|
1208
|
+
beedsTextPlace.textContent = `${newExpression}=${sum}`;
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1183
1211
|
|
|
1184
1212
|
function removeHighlight(element) {
|
|
1185
1213
|
element.classList.remove('highlight-element');
|
|
@@ -3504,25 +3532,30 @@ function validateWCAG2Parms(parms) {
|
|
|
3504
3532
|
function onTouchListenerForOnTouch(element) {
|
|
3505
3533
|
if (!element)
|
|
3506
3534
|
return;
|
|
3507
|
-
const container = document.getElementById('lido-container');
|
|
3508
|
-
// const container = element.closest('lido-container') as HTMLElement;
|
|
3509
|
-
// if (container && container.getAttribute('disable-speak') === 'true') {
|
|
3510
|
-
// return;
|
|
3511
|
-
// }
|
|
3512
|
-
// if (element.closest('[disableSpeak="true"]')) {
|
|
3513
|
-
// return;
|
|
3514
|
-
// }
|
|
3515
3535
|
const onTouch = element.getAttribute('onTouch');
|
|
3516
3536
|
let onholdTimer = null;
|
|
3517
3537
|
let onholdTriggered = false;
|
|
3518
3538
|
const onholdTime = 1000;
|
|
3519
3539
|
const playAudio = async () => {
|
|
3520
|
-
|
|
3540
|
+
const container = document.getElementById(LidoContainer);
|
|
3541
|
+
if (element === container) {
|
|
3521
3542
|
return;
|
|
3522
3543
|
}
|
|
3544
|
+
const hasDisableSpeakAttribute = element.hasAttribute('disable-speak') || element.hasAttribute('disableSpeak');
|
|
3523
3545
|
onholdTriggered = true;
|
|
3524
3546
|
setDraggingDisabled(true);
|
|
3525
|
-
|
|
3547
|
+
// If container itself is NOT disabled → play normally
|
|
3548
|
+
if (!hasDisableSpeakAttribute) {
|
|
3549
|
+
await AudioPlayer.getI().play(element);
|
|
3550
|
+
setDraggingDisabled(false);
|
|
3551
|
+
return;
|
|
3552
|
+
}
|
|
3553
|
+
if (element.getAttribute('disable-speak') === 'true' || (element.hasAttribute('disable-speak') && element.getAttribute('disable-speak') !== 'false')) {
|
|
3554
|
+
return;
|
|
3555
|
+
}
|
|
3556
|
+
else {
|
|
3557
|
+
await AudioPlayer.getI().play(element);
|
|
3558
|
+
}
|
|
3526
3559
|
setDraggingDisabled(false);
|
|
3527
3560
|
};
|
|
3528
3561
|
const onPointerDown = (event) => {
|
|
@@ -72696,6 +72729,10 @@ async function onActivityComplete(dragElement, dropElement) {
|
|
|
72696
72729
|
if (onCorrect) {
|
|
72697
72730
|
await executeActions(onCorrect, dropElement, dragElement);
|
|
72698
72731
|
}
|
|
72732
|
+
//for multiply beeds
|
|
72733
|
+
if (container.getAttribute("template-id") === "multiplyBeeds") {
|
|
72734
|
+
multiplyBeedsCalculation(dropElement);
|
|
72735
|
+
}
|
|
72699
72736
|
}
|
|
72700
72737
|
else {
|
|
72701
72738
|
const onInCorrect = dropElement.getAttribute('onInCorrect');
|
|
@@ -72840,6 +72877,12 @@ const validateObjectiveStatus = async () => {
|
|
|
72840
72877
|
if (container.querySelectorAll("[type='click']").length > 0 || container.getAttribute("template-id") === "blender") {
|
|
72841
72878
|
storingEachActivityScore(true);
|
|
72842
72879
|
}
|
|
72880
|
+
if (container.getAttribute("template-id") === "multiplyBeeds") {
|
|
72881
|
+
const beedsTextPlace = container.querySelector("#beedsText");
|
|
72882
|
+
if (!beedsTextPlace)
|
|
72883
|
+
return;
|
|
72884
|
+
await animateMultiplyBeedsResult(beedsTextPlace);
|
|
72885
|
+
}
|
|
72843
72886
|
await executeActions(onCorrect, container);
|
|
72844
72887
|
}
|
|
72845
72888
|
calculateScore();
|
|
@@ -72870,6 +72913,77 @@ const validateObjectiveStatus = async () => {
|
|
|
72870
72913
|
}
|
|
72871
72914
|
}
|
|
72872
72915
|
};
|
|
72916
|
+
const parseMultiplyBeedsText = (text) => {
|
|
72917
|
+
const trimmed = text.trim();
|
|
72918
|
+
if (!trimmed)
|
|
72919
|
+
return null;
|
|
72920
|
+
const [expressionPart, resultPart] = trimmed.split("=");
|
|
72921
|
+
const expression = (expressionPart !== null && expressionPart !== void 0 ? expressionPart : "").trim();
|
|
72922
|
+
if (!expression)
|
|
72923
|
+
return null;
|
|
72924
|
+
const terms = expression
|
|
72925
|
+
.split("+")
|
|
72926
|
+
.map(part => part.trim())
|
|
72927
|
+
.filter(Boolean);
|
|
72928
|
+
if (terms.length === 0)
|
|
72929
|
+
return null;
|
|
72930
|
+
const firstValue = Number(terms[0]);
|
|
72931
|
+
if (Number.isNaN(firstValue))
|
|
72932
|
+
return null;
|
|
72933
|
+
const allSame = terms.every(term => Number(term) === firstValue);
|
|
72934
|
+
if (!allSame)
|
|
72935
|
+
return null;
|
|
72936
|
+
const resultText = (resultPart !== null && resultPart !== void 0 ? resultPart : "").trim();
|
|
72937
|
+
let total = resultText === "" ? NaN : Number(resultText);
|
|
72938
|
+
if (Number.isNaN(total)) {
|
|
72939
|
+
total = terms
|
|
72940
|
+
.map(term => Number(term))
|
|
72941
|
+
.reduce((acc, val) => (Number.isNaN(val) ? NaN : acc + val), 0);
|
|
72942
|
+
}
|
|
72943
|
+
if (Number.isNaN(total))
|
|
72944
|
+
return null;
|
|
72945
|
+
return {
|
|
72946
|
+
value: firstValue,
|
|
72947
|
+
count: terms.length,
|
|
72948
|
+
total,
|
|
72949
|
+
};
|
|
72950
|
+
};
|
|
72951
|
+
const animateMultiplyBeedsResult = (beedsTextPlace) => {
|
|
72952
|
+
var _a;
|
|
72953
|
+
const parsed = parseMultiplyBeedsText((_a = beedsTextPlace.textContent) !== null && _a !== void 0 ? _a : "");
|
|
72954
|
+
if (!parsed)
|
|
72955
|
+
return;
|
|
72956
|
+
const existingTimerIds = beedsTextPlace.getAttribute("data-multiply-timers");
|
|
72957
|
+
if (existingTimerIds) {
|
|
72958
|
+
existingTimerIds
|
|
72959
|
+
.split(",")
|
|
72960
|
+
.map(id => Number(id))
|
|
72961
|
+
.filter(id => Number.isFinite(id))
|
|
72962
|
+
.forEach(id => clearTimeout(id));
|
|
72963
|
+
}
|
|
72964
|
+
beedsTextPlace.removeAttribute("data-multiply-timers");
|
|
72965
|
+
const steps = [
|
|
72966
|
+
String(parsed.value),
|
|
72967
|
+
"X",
|
|
72968
|
+
String(parsed.count),
|
|
72969
|
+
"=",
|
|
72970
|
+
String(parsed.total),
|
|
72971
|
+
];
|
|
72972
|
+
const intervalMs = 1000;
|
|
72973
|
+
const timerIds = [];
|
|
72974
|
+
steps.forEach((step, index) => {
|
|
72975
|
+
const id = window.setTimeout(() => {
|
|
72976
|
+
var _a;
|
|
72977
|
+
if (index === 0) {
|
|
72978
|
+
beedsTextPlace.textContent = "";
|
|
72979
|
+
}
|
|
72980
|
+
const existing = ((_a = beedsTextPlace.textContent) !== null && _a !== void 0 ? _a : "").trim();
|
|
72981
|
+
beedsTextPlace.textContent = existing ? `${existing} ${step}` : step;
|
|
72982
|
+
}, intervalMs * (index + 1));
|
|
72983
|
+
timerIds.push(id);
|
|
72984
|
+
});
|
|
72985
|
+
beedsTextPlace.setAttribute("data-multiply-timers", timerIds.join(","));
|
|
72986
|
+
};
|
|
72873
72987
|
const triggerNextContainer = () => {
|
|
72874
72988
|
AudioPlayer.getI().stop();
|
|
72875
72989
|
// const event = new CustomEvent('nextContainer');
|