lido-player 0.0.2-alpha-84 → 0.0.2-alpha-86
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-DcCOGYxt.js → decode-DIUvWF6N.js} +1 -1
- package/dist/cjs/{index-BmGzuXUP.js → index-Cfl2KMDg.js} +14 -4
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +25 -9
- package/dist/collection/components/calculator/lido-calculator.js +18 -5
- package/dist/collection/components/home/lido-home.js +3 -0
- package/dist/collection/components/scale/lido-balance.js +5 -5
- package/dist/collection/utils/constants.js +1 -0
- package/dist/collection/utils/utils.js +10 -2
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +1 -1
- 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-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-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-1PmJa9_u.js +1 -0
- package/dist/components/{p-BgobUKTe.js → p-B97yn0-n.js} +1 -1
- package/dist/components/{p-D03VKJGo.js → p-BLx2hZ8d.js} +1 -1
- package/dist/components/p-BOTEFjDY.js +1 -0
- package/dist/components/{p-ltnEAOTv.js → p-BRbyZYnO.js} +1 -1
- package/dist/components/{p-BbmL31D0.js → p-BVjdl5J1.js} +1 -1
- package/dist/components/{p-C-VpLebJ.js → p-BkQGpxcR.js} +1 -1
- package/dist/components/{p-B3HgEpJG.js → p-CfdL3fZ9.js} +1 -1
- package/dist/components/{p-IcMu8wni.js → p-CusU-d3G.js} +1 -1
- package/dist/components/{p-td_1ZVnU.js → p-D4JZI_JB.js} +1 -1
- package/dist/components/p-DFnbzZUc.js +1 -0
- package/dist/components/p-DWBY6jC3.js +1 -0
- package/dist/components/{p-0px10m_v.js → p-De6WHLEQ.js} +1 -1
- package/dist/components/p-DgBmezg8.js +1 -0
- package/dist/components/{p-Dx2gO6sh.js → p-DnN6oHI6.js} +1 -1
- package/dist/components/{p-CLKF3KKQ.js → p-DqskvXvD.js} +1 -1
- package/dist/components/{p-CFm5fhyW.js → p-Dr5sh_El.js} +1 -1
- package/dist/components/{p-DkUS6PPi.js → p-JtdpRTRi.js} +1 -1
- package/dist/components/{p-D9NAzHjN.js → p-NUpSLJ0I.js} +1 -1
- package/dist/components/{p-BdmwURgL.js → p-WP-EeUIB.js} +1 -1
- package/dist/components/{p-DABXleaM.js → p-jt8Ishvd.js} +1 -1
- package/dist/esm/{decode-DINMHb4l.js → decode-D8gAeIM7.js} +1 -1
- package/dist/esm/{index-CrVvfO2B.js → index-DazuHWZm.js} +14 -5
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +25 -9
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-75b0ae79.entry.js +1 -0
- package/dist/lido-player/p-Kx5tRAEh.js +1 -0
- package/dist/lido-player/{p-CWmrkq9f.js → p-g3lu02Fa.js} +1 -1
- package/dist/types/components/calculator/lido-calculator.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +2 -1
- package/package.json +1 -1
- package/dist/components/p-BVzB_wMB.js +0 -1
- package/dist/components/p-Bo_qoxns.js +0 -1
- package/dist/components/p-DBU82Fut.js +0 -1
- package/dist/components/p-DY8oDVo1.js +0 -1
- package/dist/components/p-hMN8yrUc.js +0 -1
- package/dist/lido-player/p-19ce1c24.entry.js +0 -1
- package/dist/lido-player/p-CadDPr02.js +0 -1
|
@@ -21,6 +21,7 @@ const LidoContainer = 'lido-container';
|
|
|
21
21
|
const LIDO_COMMON_AUDIO_PATH = '__LIDO_COMMON_AUDIO_PATH__';
|
|
22
22
|
const LIDO_COMMON_AUDIO_READY_EVENT = 'lidoCommonAudioPathReady';
|
|
23
23
|
const TemplateID = 'template-id';
|
|
24
|
+
const CalculatorOk = 'calculator-ok';
|
|
24
25
|
exports.TraceMode = void 0;
|
|
25
26
|
(function (TraceMode) {
|
|
26
27
|
TraceMode["NoFlow"] = "noFlow";
|
|
@@ -554,12 +555,12 @@ function enableDraggingWithScaling(element) {
|
|
|
554
555
|
let mostOverlappedElement = findMostoverlappedElement$1(element, 'drop');
|
|
555
556
|
if (!mostOverlappedElement) {
|
|
556
557
|
// build current selection/drop maps so reset logic can update counts correctly
|
|
557
|
-
|
|
558
|
-
|
|
558
|
+
(_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : "[]";
|
|
559
|
+
JSON.stringify(buildDragSelectedMapFromDOM());
|
|
559
560
|
const dropSelectedDataObject = buildDragSelectedMapFromDOM();
|
|
560
561
|
JSON.stringify(dropSelectedDataObject);
|
|
561
562
|
const dropHasDrag = buildDropHasDragFromDOM();
|
|
562
|
-
handleResetDragElement(element, null, dropHasDrag,
|
|
563
|
+
handleResetDragElement(element, null, dropHasDrag, null, null);
|
|
563
564
|
return;
|
|
564
565
|
}
|
|
565
566
|
onElementDropComplete(element, mostOverlappedElement);
|
|
@@ -72640,7 +72641,10 @@ const countPatternWords = (pattern) => {
|
|
|
72640
72641
|
return wordCount;
|
|
72641
72642
|
};
|
|
72642
72643
|
let countOfMistakes = 0;
|
|
72643
|
-
const storingEachActivityScore = (flag) => {
|
|
72644
|
+
const storingEachActivityScore = (flag, scoreTrigger) => {
|
|
72645
|
+
const hasCalculator = document.querySelector('lido-calculator') !== null;
|
|
72646
|
+
if (hasCalculator && scoreTrigger !== CalculatorOk)
|
|
72647
|
+
return;
|
|
72644
72648
|
if (flag) {
|
|
72645
72649
|
gameScore.rightMoves += 1;
|
|
72646
72650
|
countOfMistakes = 0;
|
|
@@ -72654,6 +72658,11 @@ const storingEachActivityScore = (flag) => {
|
|
|
72654
72658
|
console.log('Wrong Moves : ', gameScore.wrongMoves);
|
|
72655
72659
|
};
|
|
72656
72660
|
const calculateScore = () => {
|
|
72661
|
+
const container = document.getElementById(LidoContainer);
|
|
72662
|
+
const hasCalculator = document.querySelector('lido-calculator') !== null;
|
|
72663
|
+
if (hasCalculator && container && container.getAttribute('game-completed') !== 'true') {
|
|
72664
|
+
return;
|
|
72665
|
+
}
|
|
72657
72666
|
const rightMoves = gameScore.rightMoves;
|
|
72658
72667
|
const wrongMoves = gameScore.wrongMoves;
|
|
72659
72668
|
let finalScore = Math.floor((rightMoves / (rightMoves + wrongMoves)) * 100);
|
|
@@ -73533,6 +73542,7 @@ const updateCalculatorAnswer = (el) => {
|
|
|
73533
73542
|
|
|
73534
73543
|
exports.ActivityScoreKey = ActivityScoreKey;
|
|
73535
73544
|
exports.AudioPlayer = AudioPlayer;
|
|
73545
|
+
exports.CalculatorOk = CalculatorOk;
|
|
73536
73546
|
exports.LIDO_COMMON_AUDIO_PATH = LIDO_COMMON_AUDIO_PATH;
|
|
73537
73547
|
exports.LIDO_COMMON_AUDIO_READY_EVENT = LIDO_COMMON_AUDIO_READY_EVENT;
|
|
73538
73548
|
exports.LidoContainer = LidoContainer;
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-7Dh-uOww.js');
|
|
4
|
-
var index$1 = require('./index-
|
|
4
|
+
var index$1 = require('./index-Cfl2KMDg.js');
|
|
5
5
|
|
|
6
6
|
var rive$1 = {exports: {}};
|
|
7
7
|
|
|
@@ -8412,9 +8412,9 @@ const LidoBalance = class {
|
|
|
8412
8412
|
}
|
|
8413
8413
|
async componentWillLoad() {
|
|
8414
8414
|
this.updateStyles();
|
|
8415
|
-
this.pivotSvg = await this.fetchAndApplyFill(this.pivotimage);
|
|
8416
|
-
this.scaleSvg = await this.fetchAndApplyFill(this.scaleimage);
|
|
8417
|
-
this.handlerSvg = await this.fetchAndApplyFill(this.handlerimage);
|
|
8415
|
+
this.pivotSvg = await this.fetchAndApplyFill(index$1.convertUrlToRelative(this.pivotimage));
|
|
8416
|
+
this.scaleSvg = await this.fetchAndApplyFill(index$1.convertUrlToRelative(this.scaleimage));
|
|
8417
|
+
this.handlerSvg = await this.fetchAndApplyFill(index$1.convertUrlToRelative(this.handlerimage));
|
|
8418
8418
|
}
|
|
8419
8419
|
componentDidLoad() {
|
|
8420
8420
|
this.animateBalance();
|
|
@@ -8499,7 +8499,7 @@ const LidoBalance = class {
|
|
|
8499
8499
|
};
|
|
8500
8500
|
}
|
|
8501
8501
|
render() {
|
|
8502
|
-
return (index.h(index.Host, { key: '
|
|
8502
|
+
return (index.h(index.Host, { key: 'aded73152903b2a187a50c7caa8c50bc1a495ca8', id: "lido-balance", "bg-color": "red", onEntry: this.onEntry, class: "lido-balance", tilt: this.tilt.toString(), style: this.style, operation: this.operation.toString(), "pivot-image": this.pivotSvg, "scale-image": this.scaleSvg, "handler-image": this.handlerSvg }, index.h("div", { key: '81e70bbf6773194baff114ab17035a5c029d10fb', innerHTML: this.pivotSvg, id: "pivotimg", class: "pivot" }), index.h("div", { key: '9dd77bb25e1fc0f4e14303a687945147f5b20caf', innerHTML: this.scaleSvg, id: "scaleimg", class: "scale", ref: (el) => (this.scaleEl = el) }), index.h("div", { key: '0afcb89a2b8641f1268c0cb77796d2948339a32e', innerHTML: this.handlerSvg, id: "handlerimg", class: "handler", ref: (el) => (this.leftHandleEl = el) }), index.h("div", { key: 'f2d66362fb858602df1ac44a8e987aa9aa558e58', innerHTML: this.handlerSvg, id: "handimg", class: "hand", ref: (el) => (this.rightHandleEl = el) }), index.h("div", { key: '996d1211f5c35abe2531b46947d6015fc61a327f', id: "balanceSymbol", class: "lido-balance-symbol", "aria-hidden": !this.showSymbol }, this.showSymbol ? this.balanceSymbol : '')));
|
|
8503
8503
|
}
|
|
8504
8504
|
get el() { return index.getElement(this); }
|
|
8505
8505
|
static get watchers() { return {
|
|
@@ -8542,6 +8542,7 @@ const LidoCalculator = class {
|
|
|
8542
8542
|
/** Inline style object for dynamic positioning and layout control */
|
|
8543
8543
|
this.style = {};
|
|
8544
8544
|
this.userAnswers = []; // store all calculator inputs
|
|
8545
|
+
this.tempInputs = []; // store inputs before clearing display
|
|
8545
8546
|
}
|
|
8546
8547
|
updateValueAttr() {
|
|
8547
8548
|
this.el.setAttribute('value', this.displayValue);
|
|
@@ -8571,6 +8572,7 @@ const LidoCalculator = class {
|
|
|
8571
8572
|
this.updateValueAttr();
|
|
8572
8573
|
}
|
|
8573
8574
|
async verifyAnswer() {
|
|
8575
|
+
var _a;
|
|
8574
8576
|
const userInput = this.displayValue.trim();
|
|
8575
8577
|
if (!userInput)
|
|
8576
8578
|
return;
|
|
@@ -8620,9 +8622,20 @@ const LidoCalculator = class {
|
|
|
8620
8622
|
this.onOk.emit(isCorrect);
|
|
8621
8623
|
const okbtn = document.getElementById("btn-11");
|
|
8622
8624
|
if (isCorrect) {
|
|
8625
|
+
container.setAttribute("game-completed", "true");
|
|
8626
|
+
this.tempInputs.push(userInput);
|
|
8627
|
+
const existingSelected = JSON.parse((_a = container.getAttribute(index$1.SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
8628
|
+
const cleanedSelected = Array.isArray(existingSelected)
|
|
8629
|
+
? existingSelected.filter(v => String(v).trim() !== '')
|
|
8630
|
+
: [];
|
|
8631
|
+
const tempValue = this.tempInputs[this.tempInputs.length - 1];
|
|
8632
|
+
if (String(tempValue).trim() !== '') {
|
|
8633
|
+
cleanedSelected.push(tempValue);
|
|
8634
|
+
}
|
|
8635
|
+
container.setAttribute(index$1.SelectedValuesKey, JSON.stringify(cleanedSelected));
|
|
8623
8636
|
okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
|
|
8624
8637
|
this.displayValue = "";
|
|
8625
|
-
index$1.storingEachActivityScore(isCorrect);
|
|
8638
|
+
index$1.storingEachActivityScore(isCorrect, index$1.CalculatorOk);
|
|
8626
8639
|
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
8627
8640
|
await index$1.executeActions(onCorrect, container);
|
|
8628
8641
|
const hasScrollAction = onCorrect.includes('scrollCellAfterEquationSolved');
|
|
@@ -8645,7 +8658,7 @@ const LidoCalculator = class {
|
|
|
8645
8658
|
else {
|
|
8646
8659
|
okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
|
|
8647
8660
|
this.displayValue = "";
|
|
8648
|
-
index$1.storingEachActivityScore(isCorrect);
|
|
8661
|
+
index$1.storingEachActivityScore(isCorrect, index$1.CalculatorOk);
|
|
8649
8662
|
const onInCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onInCorrect')) || '';
|
|
8650
8663
|
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
8651
8664
|
const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
|
|
@@ -8664,7 +8677,7 @@ const LidoCalculator = class {
|
|
|
8664
8677
|
}
|
|
8665
8678
|
render() {
|
|
8666
8679
|
const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
|
|
8667
|
-
return (index.h(index.Host, { key: '
|
|
8680
|
+
return (index.h(index.Host, { key: '3142741f9712fec62b3094504a689ab10a8a4adc', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, index.h("lido-cell", { key: '977a41823d740f1eaf24c6296c366ee2f070fc75', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: '8a16f2f6bf09e5a87cc9d08acf3ab2cf50a09876', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, index.h("img", { key: 'dabdc13613fc5f6a8ad73c933a6de69f320dc626', src: index$1.convertUrlToRelative(this.penIcon), alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: '27a068eee1580b397709c274f1f29b626d681e17', class: "lido-calculator-displayParent" }, index.h("div", { key: 'dd430c1e6366101ad8e9822961c06a92e52a7173', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: 'ab7db4a88676205492e84cb241ce759eab93404d', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
|
|
8668
8681
|
'lido-calculator-btn-special': num === '←' || num === 'OK',
|
|
8669
8682
|
'lido-calculator-btn-default': num !== '←' && num !== 'OK'
|
|
8670
8683
|
}, onClick: () => this.handleClick(num) }))))));
|
|
@@ -12920,7 +12933,7 @@ const LidoHome = class {
|
|
|
12920
12933
|
}
|
|
12921
12934
|
// Pure-JS fallback (no wasm asset required)
|
|
12922
12935
|
try {
|
|
12923
|
-
const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-
|
|
12936
|
+
const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-DIUvWF6N.js'); }).then(function (n) { return n.decode; });
|
|
12924
12937
|
const brotliDecompressBuffer = brotliDecodeModule.BrotliDecompressBuffer ||
|
|
12925
12938
|
((_a = brotliDecodeModule.default) === null || _a === void 0 ? void 0 : _a.BrotliDecompressBuffer);
|
|
12926
12939
|
if (typeof brotliDecompressBuffer !== 'function') {
|
|
@@ -13208,6 +13221,9 @@ const LidoHome = class {
|
|
|
13208
13221
|
index$1.triggerNextContainer();
|
|
13209
13222
|
}
|
|
13210
13223
|
}
|
|
13224
|
+
else if (container.getAttribute("game-completed") === 'true') {
|
|
13225
|
+
index$1.triggerNextContainer();
|
|
13226
|
+
}
|
|
13211
13227
|
else {
|
|
13212
13228
|
console.log('Not yet filled ');
|
|
13213
13229
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { executeActions, equationCheck, storingEachActivityScore, calculateScore, triggerNextContainer } from "../../utils/utils";
|
|
3
|
-
import { NextContainerKey } from "../../utils/constants";
|
|
2
|
+
import { executeActions, equationCheck, storingEachActivityScore, calculateScore, triggerNextContainer, convertUrlToRelative } from "../../utils/utils";
|
|
3
|
+
import { NextContainerKey, SelectedValuesKey, CalculatorOk } from "../../utils/constants";
|
|
4
4
|
export class LidoCalculator {
|
|
5
5
|
constructor() {
|
|
6
6
|
/** Width of the calculator component (default: '479px') */
|
|
@@ -29,6 +29,7 @@ export class LidoCalculator {
|
|
|
29
29
|
/** Inline style object for dynamic positioning and layout control */
|
|
30
30
|
this.style = {};
|
|
31
31
|
this.userAnswers = []; // store all calculator inputs
|
|
32
|
+
this.tempInputs = []; // store inputs before clearing display
|
|
32
33
|
}
|
|
33
34
|
updateValueAttr() {
|
|
34
35
|
this.el.setAttribute('value', this.displayValue);
|
|
@@ -58,6 +59,7 @@ export class LidoCalculator {
|
|
|
58
59
|
this.updateValueAttr();
|
|
59
60
|
}
|
|
60
61
|
async verifyAnswer() {
|
|
62
|
+
var _a;
|
|
61
63
|
const userInput = this.displayValue.trim();
|
|
62
64
|
if (!userInput)
|
|
63
65
|
return;
|
|
@@ -110,9 +112,20 @@ export class LidoCalculator {
|
|
|
110
112
|
this.onOk.emit(isCorrect);
|
|
111
113
|
const okbtn = document.getElementById("btn-11");
|
|
112
114
|
if (isCorrect) {
|
|
115
|
+
container.setAttribute("game-completed", "true");
|
|
116
|
+
this.tempInputs.push(userInput);
|
|
117
|
+
const existingSelected = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
|
|
118
|
+
const cleanedSelected = Array.isArray(existingSelected)
|
|
119
|
+
? existingSelected.filter(v => String(v).trim() !== '')
|
|
120
|
+
: [];
|
|
121
|
+
const tempValue = this.tempInputs[this.tempInputs.length - 1];
|
|
122
|
+
if (String(tempValue).trim() !== '') {
|
|
123
|
+
cleanedSelected.push(tempValue);
|
|
124
|
+
}
|
|
125
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(cleanedSelected));
|
|
113
126
|
okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
|
|
114
127
|
this.displayValue = "";
|
|
115
|
-
storingEachActivityScore(isCorrect);
|
|
128
|
+
storingEachActivityScore(isCorrect, CalculatorOk);
|
|
116
129
|
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
117
130
|
await executeActions(onCorrect, container);
|
|
118
131
|
const hasScrollAction = onCorrect.includes('scrollCellAfterEquationSolved');
|
|
@@ -135,7 +148,7 @@ export class LidoCalculator {
|
|
|
135
148
|
else {
|
|
136
149
|
okbtn.style.pointerEvents = 'none'; // Disable OK button to prevent multiple clicks
|
|
137
150
|
this.displayValue = "";
|
|
138
|
-
storingEachActivityScore(isCorrect);
|
|
151
|
+
storingEachActivityScore(isCorrect, CalculatorOk);
|
|
139
152
|
const onInCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onInCorrect')) || '';
|
|
140
153
|
const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
|
|
141
154
|
const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
|
|
@@ -154,7 +167,7 @@ export class LidoCalculator {
|
|
|
154
167
|
}
|
|
155
168
|
render() {
|
|
156
169
|
const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
|
|
157
|
-
return (h(Host, { key: '
|
|
170
|
+
return (h(Host, { key: '3142741f9712fec62b3094504a689ab10a8a4adc', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, h("lido-cell", { key: '977a41823d740f1eaf24c6296c366ee2f070fc75', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: '8a16f2f6bf09e5a87cc9d08acf3ab2cf50a09876', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: 'dabdc13613fc5f6a8ad73c933a6de69f320dc626', src: convertUrlToRelative(this.penIcon), alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: '27a068eee1580b397709c274f1f29b626d681e17', class: "lido-calculator-displayParent" }, h("div", { key: 'dd430c1e6366101ad8e9822961c06a92e52a7173', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: 'ab7db4a88676205492e84cb241ce759eab93404d', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
|
|
158
171
|
'lido-calculator-btn-special': num === '←' || num === 'OK',
|
|
159
172
|
'lido-calculator-btn-default': num !== '←' && num !== 'OK'
|
|
160
173
|
}, onClick: () => this.handleClick(num) }))))));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { initEventsForElement, parseProp } from "../../utils/utils";
|
|
2
|
+
import { initEventsForElement, convertUrlToRelative, parseProp } from "../../utils/utils";
|
|
3
3
|
export class LidoBalance {
|
|
4
4
|
constructor() {
|
|
5
5
|
/**
|
|
@@ -125,9 +125,9 @@ export class LidoBalance {
|
|
|
125
125
|
}
|
|
126
126
|
async componentWillLoad() {
|
|
127
127
|
this.updateStyles();
|
|
128
|
-
this.pivotSvg = await this.fetchAndApplyFill(this.pivotimage);
|
|
129
|
-
this.scaleSvg = await this.fetchAndApplyFill(this.scaleimage);
|
|
130
|
-
this.handlerSvg = await this.fetchAndApplyFill(this.handlerimage);
|
|
128
|
+
this.pivotSvg = await this.fetchAndApplyFill(convertUrlToRelative(this.pivotimage));
|
|
129
|
+
this.scaleSvg = await this.fetchAndApplyFill(convertUrlToRelative(this.scaleimage));
|
|
130
|
+
this.handlerSvg = await this.fetchAndApplyFill(convertUrlToRelative(this.handlerimage));
|
|
131
131
|
}
|
|
132
132
|
componentDidLoad() {
|
|
133
133
|
this.animateBalance();
|
|
@@ -212,7 +212,7 @@ export class LidoBalance {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
render() {
|
|
215
|
-
return (h(Host, { key: '
|
|
215
|
+
return (h(Host, { key: 'aded73152903b2a187a50c7caa8c50bc1a495ca8', id: "lido-balance", "bg-color": "red", onEntry: this.onEntry, class: "lido-balance", tilt: this.tilt.toString(), style: this.style, operation: this.operation.toString(), "pivot-image": this.pivotSvg, "scale-image": this.scaleSvg, "handler-image": this.handlerSvg }, h("div", { key: '81e70bbf6773194baff114ab17035a5c029d10fb', innerHTML: this.pivotSvg, id: "pivotimg", class: "pivot" }), h("div", { key: '9dd77bb25e1fc0f4e14303a687945147f5b20caf', innerHTML: this.scaleSvg, id: "scaleimg", class: "scale", ref: (el) => (this.scaleEl = el) }), h("div", { key: '0afcb89a2b8641f1268c0cb77796d2948339a32e', innerHTML: this.handlerSvg, id: "handlerimg", class: "handler", ref: (el) => (this.leftHandleEl = el) }), h("div", { key: 'f2d66362fb858602df1ac44a8e987aa9aa558e58', innerHTML: this.handlerSvg, id: "handimg", class: "hand", ref: (el) => (this.rightHandleEl = el) }), h("div", { key: '996d1211f5c35abe2531b46947d6015fc61a327f', id: "balanceSymbol", class: "lido-balance-symbol", "aria-hidden": !this.showSymbol }, this.showSymbol ? this.balanceSymbol : '')));
|
|
216
216
|
}
|
|
217
217
|
static get is() { return "lido-balance"; }
|
|
218
218
|
static get originalStyleUrls() {
|
|
@@ -20,6 +20,7 @@ export const LangChangeEvent = 'languageChanged';
|
|
|
20
20
|
export const LIDO_COMMON_AUDIO_PATH = '__LIDO_COMMON_AUDIO_PATH__';
|
|
21
21
|
export const LIDO_COMMON_AUDIO_READY_EVENT = 'lidoCommonAudioPathReady';
|
|
22
22
|
export const TemplateID = 'template-id';
|
|
23
|
+
export const CalculatorOk = 'calculator-ok';
|
|
23
24
|
export var TraceMode;
|
|
24
25
|
(function (TraceMode) {
|
|
25
26
|
TraceMode["NoFlow"] = "noFlow";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActivityScoreKey, DragMapKey, SelectedValuesKey, DropMode, DropToAttr, DropTimeAttr, LidoContainer, DropAction, } from "./constants";
|
|
1
|
+
import { ActivityScoreKey, DragMapKey, SelectedValuesKey, DropMode, DropToAttr, DropTimeAttr, LidoContainer, DropAction, CalculatorOk } from "./constants";
|
|
2
2
|
import { dispatchActivityEndEvent, dispatchLessonEndEvent, dispatchNextContainerEvent, dispatchPrevContainerEvent } from "./customEvents";
|
|
3
3
|
import GameScore from "./constants";
|
|
4
4
|
import { RiveService } from "./rive-service";
|
|
@@ -563,7 +563,10 @@ export const countPatternWords = (pattern) => {
|
|
|
563
563
|
return wordCount;
|
|
564
564
|
};
|
|
565
565
|
export let countOfMistakes = 0;
|
|
566
|
-
export const storingEachActivityScore = (flag) => {
|
|
566
|
+
export const storingEachActivityScore = (flag, scoreTrigger) => {
|
|
567
|
+
const hasCalculator = document.querySelector('lido-calculator') !== null;
|
|
568
|
+
if (hasCalculator && scoreTrigger !== CalculatorOk)
|
|
569
|
+
return;
|
|
567
570
|
if (flag) {
|
|
568
571
|
gameScore.rightMoves += 1;
|
|
569
572
|
countOfMistakes = 0;
|
|
@@ -577,6 +580,11 @@ export const storingEachActivityScore = (flag) => {
|
|
|
577
580
|
console.log('Wrong Moves : ', gameScore.wrongMoves);
|
|
578
581
|
};
|
|
579
582
|
export const calculateScore = () => {
|
|
583
|
+
const container = document.getElementById(LidoContainer);
|
|
584
|
+
const hasCalculator = document.querySelector('lido-calculator') !== null;
|
|
585
|
+
if (hasCalculator && container && container.getAttribute('game-completed') !== 'true') {
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
580
588
|
const rightMoves = gameScore.rightMoves;
|
|
581
589
|
const wrongMoves = gameScore.wrongMoves;
|
|
582
590
|
let finalScore = Math.floor((rightMoves / (rightMoves + wrongMoves)) * 100);
|
|
@@ -292,7 +292,7 @@ export function enableDraggingWithScaling(element) {
|
|
|
292
292
|
const dropSelectedDataObject = buildDragSelectedMapFromDOM();
|
|
293
293
|
const dropSelectedData = JSON.stringify(dropSelectedDataObject);
|
|
294
294
|
const dropHasDrag = buildDropHasDragFromDOM();
|
|
295
|
-
handleResetDragElement(element, null, dropHasDrag,
|
|
295
|
+
handleResetDragElement(element, null, dropHasDrag, null, null, null);
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
298
|
onElementDropComplete(element, mostOverlappedElement);
|