lido-player 0.0.2-alpha-76 → 0.0.2-alpha-77
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/{index-BeLWDohk.js → index-BzToe3fj.js} +121 -91
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/lido-avatar_22.cjs.entry.js +48 -33
- package/dist/collection/components/canvas/lido-canvas.css +2 -1
- package/dist/collection/components/canvas/lido-canvas.js +4 -4
- package/dist/collection/components/keyboard/lido-keyboard.js +43 -28
- package/dist/collection/stories/Templates/Tag/tagGame.stories.js +16 -6
- package/dist/collection/stories/Templates/arrangeLetters/arrangeLetters.stories.js +5 -3
- package/dist/collection/stories/Templates/bubbleType/bubbleType.stories.js +1 -1
- package/dist/collection/stories/Templates/calculator/calculator.stories.js +7 -3
- package/dist/collection/utils/customEvents.js +4 -5
- package/dist/collection/utils/utils.js +19 -4
- package/dist/collection/utils/utilsHandlers/dragDropHandler.js +42 -17
- package/dist/collection/utils/utilsHandlers/floatHandler.js +2 -0
- package/dist/collection/utils/utilsHandlers/slideHandler.js +1 -1
- package/dist/collection/utils/utilsHandlers/timer.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/lido-canvas.js +1 -1
- package/dist/components/lido-home.js +1 -1
- package/dist/components/lido-keyboard.js +1 -1
- package/dist/components/lido-root.js +1 -1
- package/dist/components/p-BjoUTnNL.js +1 -0
- package/dist/components/{p-ub5lP9Pu.js → p-Dcl0piAw.js} +1 -1
- package/dist/components/p-DfHouhaY.js +1 -0
- package/dist/esm/{index-CJ1E0Gjh.js → index-BJX71XlO.js} +121 -91
- package/dist/esm/index.js +1 -1
- package/dist/esm/lido-avatar_22.entry.js +48 -33
- package/dist/lido-player/index.esm.js +1 -1
- package/dist/lido-player/lido-player.esm.js +1 -1
- package/dist/lido-player/p-2154e489.entry.js +1 -0
- package/dist/lido-player/p-CyN4EavN.js +1 -0
- package/dist/types/components/keyboard/lido-keyboard.d.ts +2 -2
- package/dist/types/utils/customEvents.d.ts +2 -2
- package/dist/types/utils/utilsHandlers/timer.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/p-DMdTR2aP.js +0 -1
- package/dist/components/p-xluptNe4.js +0 -1
- package/dist/lido-player/p-4df627ef.entry.js +0 -1
- package/dist/lido-player/p-CB2sCeWD.js +0 -1
|
@@ -108,70 +108,16 @@ const LANGUAGE_PROFILES = {
|
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
class Timer {
|
|
112
|
-
constructor() {
|
|
113
|
-
this.startTime = 0;
|
|
114
|
-
this.elapsedTime = 0;
|
|
115
|
-
this.intervalId = null;
|
|
116
|
-
}
|
|
117
|
-
static getI(onTick) {
|
|
118
|
-
if (!Timer.instance) {
|
|
119
|
-
Timer.instance = new Timer();
|
|
120
|
-
}
|
|
121
|
-
if (onTick) {
|
|
122
|
-
Timer.instance.onTick = onTick;
|
|
123
|
-
}
|
|
124
|
-
return Timer.instance;
|
|
125
|
-
}
|
|
126
|
-
start() {
|
|
127
|
-
if (this.intervalId)
|
|
128
|
-
return;
|
|
129
|
-
this.startTime = Date.now() - this.elapsedTime;
|
|
130
|
-
this.intervalId = window.setInterval(() => {
|
|
131
|
-
var _a;
|
|
132
|
-
this.elapsedTime = Date.now() - this.startTime;
|
|
133
|
-
(_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, this.elapsedTime);
|
|
134
|
-
}, 1000);
|
|
135
|
-
}
|
|
136
|
-
pause() {
|
|
137
|
-
if (!this.intervalId)
|
|
138
|
-
return;
|
|
139
|
-
clearInterval(this.intervalId);
|
|
140
|
-
this.intervalId = null;
|
|
141
|
-
this.elapsedTime = Date.now() - this.startTime;
|
|
142
|
-
}
|
|
143
|
-
resume() {
|
|
144
|
-
if (this.intervalId)
|
|
145
|
-
return;
|
|
146
|
-
this.start();
|
|
147
|
-
}
|
|
148
|
-
stop() {
|
|
149
|
-
var _a;
|
|
150
|
-
if (this.intervalId) {
|
|
151
|
-
clearInterval(this.intervalId);
|
|
152
|
-
this.intervalId = null;
|
|
153
|
-
}
|
|
154
|
-
this.startTime = 0;
|
|
155
|
-
this.elapsedTime = 0;
|
|
156
|
-
(_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, 0);
|
|
157
|
-
}
|
|
158
|
-
getElapsed() {
|
|
159
|
-
return this.intervalId
|
|
160
|
-
? Date.now() - this.startTime
|
|
161
|
-
: this.elapsedTime;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
111
|
function dispatchCustomEvent(eventName, detail) {
|
|
166
112
|
console.log("👍Event Name : ", eventName, "Detail : ", detail.toString());
|
|
167
113
|
const event = new CustomEvent(eventName, { detail });
|
|
168
114
|
window.dispatchEvent(event);
|
|
169
115
|
}
|
|
170
|
-
function dispatchActivityEndEvent(totalIndex, currentIndex, score, rightMoves, wrongMoves) {
|
|
171
|
-
dispatchCustomEvent(ActivityEndKey, { currentIndex, totalIndex, score, rightMoves, wrongMoves });
|
|
116
|
+
function dispatchActivityEndEvent(totalIndex, currentIndex, score, rightMoves, wrongMoves, timeSpentForActivity) {
|
|
117
|
+
dispatchCustomEvent(ActivityEndKey, { currentIndex, totalIndex, score, rightMoves, wrongMoves, timeSpentForActivity });
|
|
172
118
|
}
|
|
173
|
-
function dispatchLessonEndEvent(totalIndex, rightMoves, wrongMoves, finalScore) {
|
|
174
|
-
dispatchCustomEvent(LessonEndKey, { totalIndex, rightMoves, wrongMoves, finalScore,
|
|
119
|
+
function dispatchLessonEndEvent(totalIndex, rightMoves, wrongMoves, finalScore, timeSpendForLesson) {
|
|
120
|
+
dispatchCustomEvent(LessonEndKey, { totalIndex, rightMoves, wrongMoves, finalScore, timeSpendForLesson });
|
|
175
121
|
}
|
|
176
122
|
function dispatchNextContainerEvent() {
|
|
177
123
|
dispatchCustomEvent(NextContainerKey, {});
|
|
@@ -568,7 +514,7 @@ function enableDraggingWithScaling(element) {
|
|
|
568
514
|
};
|
|
569
515
|
let lastOverlappedElement = null;
|
|
570
516
|
const onEnd = (endEv) => {
|
|
571
|
-
var _a, _b;
|
|
517
|
+
var _a, _b, _c;
|
|
572
518
|
isDragging = false;
|
|
573
519
|
if (isClicked) {
|
|
574
520
|
if (clone) {
|
|
@@ -605,12 +551,18 @@ function enableDraggingWithScaling(element) {
|
|
|
605
551
|
// Check for overlaps and log the most overlapping element
|
|
606
552
|
let mostOverlappedElement = findMostoverlappedElement$1(element, 'drop');
|
|
607
553
|
if (!mostOverlappedElement) {
|
|
608
|
-
|
|
554
|
+
// build current selection/drop maps so reset logic can update counts correctly
|
|
555
|
+
const selectedValueData = (_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : "[]";
|
|
556
|
+
const dragSelectedData = JSON.stringify(buildDragSelectedMapFromDOM());
|
|
557
|
+
const dropSelectedDataObject = buildDragSelectedMapFromDOM();
|
|
558
|
+
JSON.stringify(dropSelectedDataObject);
|
|
559
|
+
const dropHasDrag = buildDropHasDragFromDOM();
|
|
560
|
+
handleResetDragElement(element, null, dropHasDrag, selectedValueData, dragSelectedData);
|
|
609
561
|
return;
|
|
610
562
|
}
|
|
611
563
|
onElementDropComplete(element, mostOverlappedElement);
|
|
612
564
|
executeActions("this.updateCountBlender='true'", container);
|
|
613
|
-
if (((
|
|
565
|
+
if (((_b = element.getAttribute('dropAttr')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === DropMode.Diagonal) {
|
|
614
566
|
if (mostOverlappedElement) {
|
|
615
567
|
if (element) {
|
|
616
568
|
element.classList.add('diagonal-drop');
|
|
@@ -635,7 +587,7 @@ function enableDraggingWithScaling(element) {
|
|
|
635
587
|
// const computedStyle = window.getComputedStyle(element);
|
|
636
588
|
// mostOverlappedElement.style.width = computedStyle.width;
|
|
637
589
|
// }
|
|
638
|
-
if (((
|
|
590
|
+
if (((_c = element.getAttribute('dropAttr')) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === DropMode.InfiniteDrop) {
|
|
639
591
|
if (mostOverlappedElement) {
|
|
640
592
|
mostOverlappedElement.style.opacity = '0';
|
|
641
593
|
}
|
|
@@ -758,9 +710,10 @@ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, sel
|
|
|
758
710
|
dragToDropMap.delete(dragElement);
|
|
759
711
|
}
|
|
760
712
|
if (selectedValueData) {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
713
|
+
// Instead of filtering stale selectedValueData, rebuild selected values from DOM
|
|
714
|
+
const rebuiltMap = buildDragSelectedMapFromDOM();
|
|
715
|
+
const sortedValues = getSortedValuesArrayFromMap(rebuiltMap);
|
|
716
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(sortedValues));
|
|
764
717
|
}
|
|
765
718
|
if (dragSelectedData) {
|
|
766
719
|
let dragSelected = JSON.parse(dragSelectedData);
|
|
@@ -771,6 +724,10 @@ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, sel
|
|
|
771
724
|
// container.setAttribute(DragSelectedMapKey, JSON.stringify(dragSelected));
|
|
772
725
|
dragElement.removeAttribute(DropToAttr);
|
|
773
726
|
updateDropBorder(currentDrop);
|
|
727
|
+
// rebuild counts & balance after removing mapping
|
|
728
|
+
const rebuiltMap2 = buildDragSelectedMapFromDOM();
|
|
729
|
+
const sortedValues2 = getSortedValuesArrayFromMap(rebuiltMap2);
|
|
730
|
+
container.setAttribute(SelectedValuesKey, JSON.stringify(sortedValues2));
|
|
774
731
|
updateBalanceOnDrop();
|
|
775
732
|
}
|
|
776
733
|
const allElements = document.querySelectorAll("[type='drop']");
|
|
@@ -792,9 +749,7 @@ async function handleResetDragElement(dragElement, dropElement, dropHasDrag, sel
|
|
|
792
749
|
}
|
|
793
750
|
});
|
|
794
751
|
// Update counts when a drag is reset/removed from a drop
|
|
795
|
-
|
|
796
|
-
await executeActions("this.updateCountBlender='true'", container);
|
|
797
|
-
}
|
|
752
|
+
await executeActions("this.updateCountBlender='true'", container);
|
|
798
753
|
handleShowCheck();
|
|
799
754
|
highlightElement();
|
|
800
755
|
}
|
|
@@ -843,13 +798,19 @@ async function onElementDropComplete(dragElement, dropElement) {
|
|
|
843
798
|
}
|
|
844
799
|
else {
|
|
845
800
|
//strings
|
|
846
|
-
|
|
801
|
+
if (dropValue.includes(',')) {
|
|
802
|
+
isCorrect = dropValue.toLowerCase().includes(dragValue.toLowerCase());
|
|
803
|
+
}
|
|
804
|
+
else {
|
|
805
|
+
isCorrect = dropValue.toLowerCase() === dragValue.toLowerCase();
|
|
806
|
+
}
|
|
847
807
|
}
|
|
848
808
|
if (!isCorrect) {
|
|
849
809
|
dragElement.style.transition = 'transform 0.5s ease';
|
|
850
810
|
animateDragToTarget(dragElement, dropElement, container);
|
|
851
811
|
const onInCorrect = dropElement.getAttribute('onInCorrect');
|
|
852
812
|
await executeActions(onInCorrect, dropElement, dragElement);
|
|
813
|
+
storingEachActivityScore(false);
|
|
853
814
|
setTimeout(() => {
|
|
854
815
|
dragElement.style.transform = 'translate(0, 0)';
|
|
855
816
|
// storingEachActivityScore(false);
|
|
@@ -1145,6 +1106,7 @@ async function onClickDragElement(element) {
|
|
|
1145
1106
|
return;
|
|
1146
1107
|
}
|
|
1147
1108
|
let firstFalse = Object.values(dropElements).find(item => !item.isFull);
|
|
1109
|
+
console.log('🚀 ~ onClickDragElement ~ firstFalse:', firstFalse);
|
|
1148
1110
|
if (firstFalse) {
|
|
1149
1111
|
const dropEl = document.querySelector(`#${firstFalse.drop}`);
|
|
1150
1112
|
dragEl.style.transition = 'transform 0.5s ease';
|
|
@@ -1158,26 +1120,35 @@ const appendingDragElementsInDrop = () => {
|
|
|
1158
1120
|
const dropItems = document.querySelectorAll("[type='drop']");
|
|
1159
1121
|
if (!dragItems || !dropItems)
|
|
1160
1122
|
return;
|
|
1123
|
+
const container = document.getElementById(LidoContainer);
|
|
1124
|
+
const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
|
|
1125
|
+
const appendedDragIds = new Set();
|
|
1161
1126
|
dropItems.forEach(dropElement => {
|
|
1162
|
-
dragItems.
|
|
1127
|
+
for (let i = 0; i < dragItems.length; i++) {
|
|
1128
|
+
const dragElement = dragItems[i];
|
|
1129
|
+
// Skip if already appended to another drop element
|
|
1130
|
+
if (appendedDragIds.has(dragElement.id))
|
|
1131
|
+
continue;
|
|
1163
1132
|
const drag = dragElement;
|
|
1164
1133
|
const drop = dropElement;
|
|
1165
|
-
const container = document.getElementById(LidoContainer);
|
|
1166
|
-
const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
|
|
1167
1134
|
if (isAllowOnlyCorrect === true) {
|
|
1168
1135
|
if (drop['value'] === drag['value']) {
|
|
1169
1136
|
drag.style.transform = 'translate(0,0)';
|
|
1170
1137
|
drop.appendChild(drag);
|
|
1138
|
+
appendedDragIds.add(drag.id);
|
|
1139
|
+
drag.style.pointerEvents = 'none';
|
|
1140
|
+
break;
|
|
1171
1141
|
}
|
|
1172
1142
|
}
|
|
1173
1143
|
else {
|
|
1174
1144
|
if (drop['value'].includes(drag['value'])) {
|
|
1175
1145
|
drag.style.transform = 'translate(0,0)';
|
|
1176
1146
|
drop.appendChild(drag);
|
|
1147
|
+
appendedDragIds.add(drag.id);
|
|
1148
|
+
drag.style.pointerEvents = 'none';
|
|
1177
1149
|
}
|
|
1178
1150
|
}
|
|
1179
|
-
|
|
1180
|
-
});
|
|
1151
|
+
}
|
|
1181
1152
|
});
|
|
1182
1153
|
};
|
|
1183
1154
|
const container = document.getElementById(LidoContainer);
|
|
@@ -2334,24 +2305,12 @@ const slideCompleted = (slideElement) => {
|
|
|
2334
2305
|
const isCorrect = matchStringPattern(slideElement['value'], [objectiveArray[elementIndex].trim()]);
|
|
2335
2306
|
if (container.getAttribute('is-continue-on-correct') === 'true') {
|
|
2336
2307
|
storingEachActivityScore(true);
|
|
2337
|
-
validationForSlideHandler();
|
|
2308
|
+
// validationForSlideHandler();
|
|
2338
2309
|
}
|
|
2339
2310
|
else {
|
|
2340
2311
|
storingEachActivityScore(isCorrect);
|
|
2341
2312
|
}
|
|
2342
2313
|
};
|
|
2343
|
-
const validationForSlideHandler = async () => {
|
|
2344
|
-
var _a, _b;
|
|
2345
|
-
const container = document.getElementById(LidoContainer);
|
|
2346
|
-
if (!container)
|
|
2347
|
-
return;
|
|
2348
|
-
const objectiveArray = (_b = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]')) !== null && _b !== void 0 ? _b : [];
|
|
2349
|
-
const objectiveString = document.getElementById(LidoContainer)['objective'];
|
|
2350
|
-
const res = matchStringPattern(objectiveString, objectiveArray);
|
|
2351
|
-
if (res) {
|
|
2352
|
-
await executeActions(container.getAttribute('onCorrect'), container);
|
|
2353
|
-
}
|
|
2354
|
-
};
|
|
2355
2314
|
|
|
2356
2315
|
// This file is autogenerated. It's used to publish ESM to npm.
|
|
2357
2316
|
function _typeof$1(obj) {
|
|
@@ -71540,6 +71499,8 @@ function handleFloatElementPosition(element) {
|
|
|
71540
71499
|
element.style.position = 'absolute';
|
|
71541
71500
|
if (direction === 'leftToRight') {
|
|
71542
71501
|
const containerHeight = floatContainer.offsetHeight;
|
|
71502
|
+
// Add class for bubble elements to identify them later for input matching and scoring
|
|
71503
|
+
element.classList.add("bubble-element");
|
|
71543
71504
|
element.style.left = 'unset';
|
|
71544
71505
|
element.style.right = `${window.innerWidth + document.body.getBoundingClientRect().width}px`;
|
|
71545
71506
|
// element.style.top = isFirstEntry ? `${entryValue}%` : `${Math.floor(Math.random() * (containerHeight - element.clientHeight))}px`;
|
|
@@ -71994,6 +71955,61 @@ function generateDoubleSquares(count = 16) {
|
|
|
71994
71955
|
return pairs;
|
|
71995
71956
|
}
|
|
71996
71957
|
|
|
71958
|
+
class Timer {
|
|
71959
|
+
constructor() {
|
|
71960
|
+
this.startTime = 0;
|
|
71961
|
+
this.elapsedTime = 0;
|
|
71962
|
+
this.intervalId = null;
|
|
71963
|
+
}
|
|
71964
|
+
static getI(onTick) {
|
|
71965
|
+
if (!Timer.instance) {
|
|
71966
|
+
Timer.instance = new Timer();
|
|
71967
|
+
}
|
|
71968
|
+
if (onTick) {
|
|
71969
|
+
Timer.instance.onTick = onTick;
|
|
71970
|
+
}
|
|
71971
|
+
return Timer.instance;
|
|
71972
|
+
}
|
|
71973
|
+
start() {
|
|
71974
|
+
if (this.intervalId)
|
|
71975
|
+
return;
|
|
71976
|
+
this.startTime = Date.now() - this.elapsedTime;
|
|
71977
|
+
this.intervalId = window.setInterval(() => {
|
|
71978
|
+
var _a;
|
|
71979
|
+
this.elapsedTime = Date.now() - this.startTime;
|
|
71980
|
+
(_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, this.elapsedTime);
|
|
71981
|
+
}, 1000);
|
|
71982
|
+
}
|
|
71983
|
+
pause() {
|
|
71984
|
+
if (!this.intervalId)
|
|
71985
|
+
return;
|
|
71986
|
+
clearInterval(this.intervalId);
|
|
71987
|
+
this.intervalId = null;
|
|
71988
|
+
this.elapsedTime = Date.now() - this.startTime;
|
|
71989
|
+
}
|
|
71990
|
+
resume() {
|
|
71991
|
+
if (this.intervalId)
|
|
71992
|
+
return;
|
|
71993
|
+
this.start();
|
|
71994
|
+
}
|
|
71995
|
+
stop() {
|
|
71996
|
+
var _a;
|
|
71997
|
+
if (this.intervalId) {
|
|
71998
|
+
clearInterval(this.intervalId);
|
|
71999
|
+
this.intervalId = null;
|
|
72000
|
+
}
|
|
72001
|
+
this.startTime = 0;
|
|
72002
|
+
this.elapsedTime = 0;
|
|
72003
|
+
(_a = this.onTick) === null || _a === void 0 ? void 0 : _a.call(this, 0);
|
|
72004
|
+
}
|
|
72005
|
+
getElapsed() {
|
|
72006
|
+
return this.intervalId
|
|
72007
|
+
? Date.now() - this.startTime
|
|
72008
|
+
: this.elapsedTime;
|
|
72009
|
+
}
|
|
72010
|
+
}
|
|
72011
|
+
let ACTIVYTY_TIME_SPEND_ARRAY = [];
|
|
72012
|
+
|
|
71997
72013
|
const gameScore = new GameScore();
|
|
71998
72014
|
function buildDragSelectedMapFromDOM() {
|
|
71999
72015
|
const map = {};
|
|
@@ -72623,7 +72639,9 @@ const storeActivityScore = (score) => {
|
|
|
72623
72639
|
activityScore[activityScoreKey] = score;
|
|
72624
72640
|
//send Custom Event to parent
|
|
72625
72641
|
// window.dispatchEvent(new CustomEvent(ActivityEndKey, { detail: { index: index, totalIndex: totalIndex, score: score } }));
|
|
72626
|
-
|
|
72642
|
+
const timeSpendForActivity = Math.floor(Timer.getI().getElapsed() / 1000);
|
|
72643
|
+
ACTIVYTY_TIME_SPEND_ARRAY.push(timeSpendForActivity);
|
|
72644
|
+
dispatchActivityEndEvent(totalIndex, index, score, gameScore.rightMoves, gameScore.wrongMoves, timeSpendForActivity);
|
|
72627
72645
|
localStorage.setItem(ActivityScoreKey, JSON.stringify(activityScore));
|
|
72628
72646
|
if (totalIndex - 1 == index) {
|
|
72629
72647
|
const scoresArray = Object.values(activityScore);
|
|
@@ -72631,7 +72649,8 @@ const storeActivityScore = (score) => {
|
|
|
72631
72649
|
gameScore.finalScore = Math.floor(finalScore);
|
|
72632
72650
|
console.log('Total Score : ', gameScore.finalScore);
|
|
72633
72651
|
// window.dispatchEvent(new CustomEvent(LessonEndKey, { detail: { score: finalScore } }));
|
|
72634
|
-
|
|
72652
|
+
const timeSpendForLesson = ACTIVYTY_TIME_SPEND_ARRAY.reduce((sum, current) => sum + current, 0);
|
|
72653
|
+
dispatchLessonEndEvent(totalIndex, gameScore.rightMoves, gameScore.wrongMoves, finalScore, timeSpendForLesson);
|
|
72635
72654
|
localStorage.removeItem(ActivityScoreKey);
|
|
72636
72655
|
}
|
|
72637
72656
|
};
|
|
@@ -73359,8 +73378,19 @@ function placeElementInDropZone(dropElement, dragElement, orientation, dropAttr)
|
|
|
73359
73378
|
console.log("🌄 Landscape waterfall");
|
|
73360
73379
|
const shiftX = dropWidth * 0.02; // proportional (5% of width)
|
|
73361
73380
|
const shiftY = dropHeight * 0.02; // proportional (5% of height)
|
|
73362
|
-
|
|
73363
|
-
|
|
73381
|
+
let startX, startY;
|
|
73382
|
+
if (dropElement.id === "unitsDrop") {
|
|
73383
|
+
startX = dropRect.left + dropWidth * 0.15; // 15% from left for better centering of multiple items
|
|
73384
|
+
startY = dropRect.top + dropHeight * -0.1; // slightly above
|
|
73385
|
+
}
|
|
73386
|
+
else if (dropElement.id === "tensDrop") {
|
|
73387
|
+
startX = dropRect.left + dropWidth * 0.40; // 40% from left for better centering of multiple items
|
|
73388
|
+
startY = dropRect.top + dropHeight * -0.1; // slightly above
|
|
73389
|
+
}
|
|
73390
|
+
else {
|
|
73391
|
+
startX = dropRect.left + dropWidth * 0.10; // 10% from left for better centering of multiple items
|
|
73392
|
+
startY = dropRect.top + dropHeight * -0.1; // slightly above
|
|
73393
|
+
}
|
|
73364
73394
|
targetX = startX + (dropCount * shiftX);
|
|
73365
73395
|
targetY = startY + (dropCount * shiftY);
|
|
73366
73396
|
}
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-BrME-8br.js');
|
|
4
|
-
var index$1 = require('./index-
|
|
4
|
+
var index$1 = require('./index-BzToe3fj.js');
|
|
5
5
|
|
|
6
6
|
var rive$1 = {exports: {}};
|
|
7
7
|
|
|
@@ -8662,7 +8662,7 @@ const LidoCalculator = class {
|
|
|
8662
8662
|
};
|
|
8663
8663
|
LidoCalculator.style = lidoCalculatorCss();
|
|
8664
8664
|
|
|
8665
|
-
const lidoCanvasCss = () => `:host{display:flex;justify-content:center;align-items:center}.lido-canvas{background:red;border:2px solid #ccc;border-radius:8px;display:flex;flex-direction:column;overflow:hidden;position:relative}#lido-exit-button{padding:6px 14px;border:none;background:transparent;color:#fff;border-radius:6px;cursor:pointer;font-size:14px;position:relative;top:-43%;left:18%;z-index:
|
|
8665
|
+
const lidoCanvasCss = () => `:host{display:flex;justify-content:center;align-items:center}.lido-canvas{background:red;border:2px solid #ccc;border-radius:8px;display:flex;flex-direction:column;overflow:hidden;position:relative}#lido-exit-button{padding:6px 14px;border:none;background:transparent;color:#fff;border-radius:6px;cursor:pointer;font-size:14px;position:relative;top:-43%;left:18%;z-index:15}canvas{touch-action:none;display:block;z-index:10}`;
|
|
8666
8666
|
|
|
8667
8667
|
const LidoCanvas = class {
|
|
8668
8668
|
constructor(hostRef) {
|
|
@@ -8697,7 +8697,7 @@ const LidoCanvas = class {
|
|
|
8697
8697
|
this.ctx.lineWidth = 10;
|
|
8698
8698
|
this.ctx.lineCap = 'round';
|
|
8699
8699
|
this.ctx.lineJoin = 'round';
|
|
8700
|
-
this.loadBackground();
|
|
8700
|
+
// this.loadBackground();
|
|
8701
8701
|
}
|
|
8702
8702
|
}
|
|
8703
8703
|
componentDidLoad() {
|
|
@@ -8708,7 +8708,7 @@ const LidoCanvas = class {
|
|
|
8708
8708
|
this.ctx.lineCap = 'round';
|
|
8709
8709
|
this.ctx.lineJoin = 'round';
|
|
8710
8710
|
this.updateStyles();
|
|
8711
|
-
this.loadBackground();
|
|
8711
|
+
// this.loadBackground();
|
|
8712
8712
|
this.canvas.addEventListener('pointerdown', e => this.start(e));
|
|
8713
8713
|
this.canvas.addEventListener('pointermove', e => this.move(e));
|
|
8714
8714
|
window.addEventListener('pointerup', () => this.stop());
|
|
@@ -8752,10 +8752,10 @@ const LidoCanvas = class {
|
|
|
8752
8752
|
this.ctx.closePath();
|
|
8753
8753
|
}
|
|
8754
8754
|
clearCanvas() {
|
|
8755
|
-
this.
|
|
8755
|
+
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
8756
8756
|
}
|
|
8757
8757
|
render() {
|
|
8758
|
-
return (index.h(index.Host, { key: '
|
|
8758
|
+
return (index.h(index.Host, { key: '6bf53fed345682fdfd21cc466703cce3964526a0', id: "lido-canvas", class: "lido-canvas", style: this.style }, index.h("button", { key: '75b307dab33a24f27bf10605e1b0138b5eecfa40', id: "lido-exit-button", onClick: () => this.clearCanvas() }, index.h("lido-text", { key: '2f636e7e049cb5a9e87106487b54b7b0aacb03c4', visible: "true", height: "92px", width: "43px", id: "lido-exit-icon", "font-color": "white", onEntry: "this.font-weight='900';", "font-size": "96px", string: 'X' })), index.h("canvas", { key: '74bc43e76913256f1c7bc5334e5148c512741a9f', id: "lido-canvas", style: { width: this.style.width, height: this.style.height, } })));
|
|
8759
8759
|
}
|
|
8760
8760
|
get el() { return index.getElement(this); }
|
|
8761
8761
|
};
|
|
@@ -16186,8 +16186,8 @@ const LidoKeyboard = class {
|
|
|
16186
16186
|
/** Number of columns in the keyboard layout (default: "10") */
|
|
16187
16187
|
this.columns = '10';
|
|
16188
16188
|
/**
|
|
16189
|
-
|
|
16190
|
-
|
|
16189
|
+
* When set to true, disables the speak functionality of long press for this component and its children.
|
|
16190
|
+
*/
|
|
16191
16191
|
this.disableSpeak = false;
|
|
16192
16192
|
/** Tracks the number of keys clicked by the user */
|
|
16193
16193
|
this.numberOfClick = 0;
|
|
@@ -16199,38 +16199,53 @@ const LidoKeyboard = class {
|
|
|
16199
16199
|
async inputValidation(e) {
|
|
16200
16200
|
if (this.type !== 'click')
|
|
16201
16201
|
return;
|
|
16202
|
-
let
|
|
16203
|
-
selcetedValue = this.inputString;
|
|
16204
|
-
localStorage.setItem(index$1.SelectedValuesKey, JSON.stringify(selcetedValue));
|
|
16202
|
+
let isOverlapping = false;
|
|
16205
16203
|
const container = document.getElementById(index$1.LidoContainer);
|
|
16206
|
-
const
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16211
|
-
|
|
16204
|
+
const clickedValue = e.target.getAttribute('value');
|
|
16205
|
+
if (!clickedValue)
|
|
16206
|
+
return;
|
|
16207
|
+
let selectedValue = JSON.parse(localStorage.getItem(index$1.SelectedValuesKey)) || '';
|
|
16208
|
+
localStorage.setItem(index$1.SelectedValuesKey, JSON.stringify(selectedValue));
|
|
16209
|
+
// Get all word bubbles (make sure bubbles have class "bubble-element")
|
|
16210
|
+
const bubbles = Array.from(container.querySelectorAll('.bubble-element'));
|
|
16211
|
+
// Find a bubble whose word starts with current progress + clicked letter
|
|
16212
|
+
const matchedBubble = bubbles.find(bubble => {
|
|
16213
|
+
const word = bubble.getAttribute('value'); // full word like "one"
|
|
16214
|
+
const element = word === null || word === void 0 ? void 0 : word.startsWith(this.inputString.toLowerCase());
|
|
16215
|
+
return element;
|
|
16216
|
+
});
|
|
16217
|
+
if (matchedBubble) {
|
|
16212
16218
|
const bodyRect = document.body.getBoundingClientRect();
|
|
16213
|
-
const elemRect =
|
|
16219
|
+
const elemRect = matchedBubble.getBoundingClientRect();
|
|
16220
|
+
// Ciheck if the matched bubble is overlapping with the target area (you can define the target area as needed, here we use the entire viewport)
|
|
16214
16221
|
isOverlapping = elemRect.left < bodyRect.right && elemRect.right > bodyRect.left && elemRect.top < bodyRect.bottom && elemRect.bottom > bodyRect.top;
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
filteredElement.style.animation = 'none';
|
|
16218
|
-
this.numberOfClick++;
|
|
16219
|
-
if (this.numberOfClick === this.letterLength) {
|
|
16220
|
-
const onCorrrect = container.getAttribute('onCorrect');
|
|
16221
|
-
container.style.pointerEvents = 'none';
|
|
16222
|
-
await index$1.executeActions(onCorrrect, this.el);
|
|
16223
|
-
index$1.triggerNextContainer();
|
|
16224
|
-
}
|
|
16225
|
-
else {
|
|
16226
|
-
index$1.handleFloatElementPosition(filteredElement);
|
|
16222
|
+
// If full word completed
|
|
16223
|
+
if (this.inputString.toLowerCase() === matchedBubble.getAttribute('value').toLowerCase() && isOverlapping) {
|
|
16227
16224
|
index$1.storingEachActivityScore(true);
|
|
16225
|
+
matchedBubble.style.animation = 'none';
|
|
16226
|
+
matchedBubble.style.pointerEvents = 'none';
|
|
16227
|
+
this.numberOfClick++;
|
|
16228
|
+
setTimeout(() => { this.inputString = ''; }, 1000);
|
|
16229
|
+
localStorage.removeItem(index$1.SelectedValuesKey);
|
|
16230
|
+
if (this.numberOfClick === this.letterLength) {
|
|
16231
|
+
index$1.calculateScore();
|
|
16232
|
+
const onCorrrect = container.getAttribute('onCorrect');
|
|
16233
|
+
container.style.pointerEvents = 'none';
|
|
16234
|
+
await index$1.executeActions(onCorrrect, this.el);
|
|
16235
|
+
index$1.triggerNextContainer();
|
|
16236
|
+
}
|
|
16237
|
+
else {
|
|
16238
|
+
index$1.handleFloatElementPosition(matchedBubble);
|
|
16239
|
+
}
|
|
16228
16240
|
}
|
|
16229
16241
|
}
|
|
16230
16242
|
else {
|
|
16243
|
+
// ❌ Incorrect click
|
|
16244
|
+
index$1.storingEachActivityScore(false);
|
|
16245
|
+
setTimeout(() => { this.inputString = ''; }, 1000);
|
|
16246
|
+
localStorage.removeItem(index$1.SelectedValuesKey);
|
|
16231
16247
|
const onInCorrrect = container.getAttribute('onInCorrect');
|
|
16232
16248
|
await index$1.executeActions(onInCorrrect, this.el);
|
|
16233
|
-
index$1.storingEachActivityScore(false);
|
|
16234
16249
|
}
|
|
16235
16250
|
}
|
|
16236
16251
|
componentDidLoad() {
|
|
@@ -16281,10 +16296,10 @@ const LidoKeyboard = class {
|
|
|
16281
16296
|
const keysArray = this.keys.split(',').map(k => k.trim());
|
|
16282
16297
|
const container = document.getElementById(index$1.LidoContainer);
|
|
16283
16298
|
const showCheck = container.getAttribute('show-check') === 'true';
|
|
16284
|
-
return (index.h(index.Host, { key: '
|
|
16299
|
+
return (index.h(index.Host, { key: 'c628b4412414cb77bf6596b302deb91f13626f53', class: "lido-keyboard", style: { width: this.style.width, height: this.style.height, position: 'relative', margin: this.style.margin, zIndex: this.z } }, this.keyboardInput && (index.h("div", { key: '3081daf25caa5ca0390b78567e0f46c8fecd0933', class: "input-area" }, index.h("input", { key: 'a21b93f86abb42afc45811d560400deb58da09fe', type: "text", value: this.inputString, class: "input-area", readonly: true }), index.h("lido-text", { key: '3486ddf43feb30d595a4e854761de41c0f963690', visible: showCheck ? 'true' : 'false', string: "<<", "bg-color": "black", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "100px", height: "70px", type: "click", onClick: () => {
|
|
16285
16300
|
this.inputString = this.inputString.slice(0, -1);
|
|
16286
16301
|
this.inputValidation(event);
|
|
16287
|
-
} }), index.h("lido-text", { key: '
|
|
16302
|
+
} }), index.h("lido-text", { key: '3a619b53a9c0a6e511adfbdff3f2e8b89692431b', visible: showCheck ? 'true' : 'false', id: "lido-checkButton", string: "Enter", "bg-color": "green", "font-color": "white", "border-radius": "20px", "font-size": "30px", width: "150px", height: "70px", type: "click" }))), this.letterLength && (index.h("lido-text", { key: '0a780c4a4669edb5bf7f51190ddb6345a724fd43', visible: "true", string: `${this.numberOfClick}/${this.letterLength}`, "font-size": "60px", "font-color": "white", onEntry: "this.position='absolute'; this.right='0'; this.fontWeight='800';", x: "unset" })), index.h("div", { key: '49f04eacdfbdc93ffcd3749531b90b4acd655d50', class: "keyboard-wrapper", style: {
|
|
16288
16303
|
display: 'flex',
|
|
16289
16304
|
flexWrap: 'wrap',
|
|
16290
16305
|
justifyContent: 'center',
|
|
@@ -32,7 +32,7 @@ export class LidoCanvas {
|
|
|
32
32
|
this.ctx.lineWidth = 10;
|
|
33
33
|
this.ctx.lineCap = 'round';
|
|
34
34
|
this.ctx.lineJoin = 'round';
|
|
35
|
-
this.loadBackground();
|
|
35
|
+
// this.loadBackground();
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
componentDidLoad() {
|
|
@@ -43,7 +43,7 @@ export class LidoCanvas {
|
|
|
43
43
|
this.ctx.lineCap = 'round';
|
|
44
44
|
this.ctx.lineJoin = 'round';
|
|
45
45
|
this.updateStyles();
|
|
46
|
-
this.loadBackground();
|
|
46
|
+
// this.loadBackground();
|
|
47
47
|
this.canvas.addEventListener('pointerdown', e => this.start(e));
|
|
48
48
|
this.canvas.addEventListener('pointermove', e => this.move(e));
|
|
49
49
|
window.addEventListener('pointerup', () => this.stop());
|
|
@@ -87,10 +87,10 @@ export class LidoCanvas {
|
|
|
87
87
|
this.ctx.closePath();
|
|
88
88
|
}
|
|
89
89
|
clearCanvas() {
|
|
90
|
-
this.
|
|
90
|
+
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
91
91
|
}
|
|
92
92
|
render() {
|
|
93
|
-
return (h(Host, { key: '
|
|
93
|
+
return (h(Host, { key: '6bf53fed345682fdfd21cc466703cce3964526a0', id: "lido-canvas", class: "lido-canvas", style: this.style }, h("button", { key: '75b307dab33a24f27bf10605e1b0138b5eecfa40', id: "lido-exit-button", onClick: () => this.clearCanvas() }, h("lido-text", { key: '2f636e7e049cb5a9e87106487b54b7b0aacb03c4', visible: "true", height: "92px", width: "43px", id: "lido-exit-icon", "font-color": "white", onEntry: "this.font-weight='900';", "font-size": "96px", string: 'X' })), h("canvas", { key: '74bc43e76913256f1c7bc5334e5148c512741a9f', id: "lido-canvas", style: { width: this.style.width, height: this.style.height, } })));
|
|
94
94
|
}
|
|
95
95
|
static get is() { return "lido-canvas"; }
|
|
96
96
|
static get encapsulation() { return "shadow"; }
|