lido-player 0.0.2-alpha-49 → 0.0.2-alpha-43-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.
Files changed (159) hide show
  1. package/dist/cjs/{index-fe562525.js → index-6a69c33a.js} +36 -3
  2. package/dist/cjs/index.cjs.js +2 -2
  3. package/dist/cjs/{lido-avatar_19.cjs.entry.js → lido-avatar_21.cjs.entry.js} +431 -180
  4. package/dist/cjs/lido-player.cjs.js +2 -2
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/{utils-96ce5641.js → utils-079a5e7d.js} +1032 -165
  7. package/dist/collection/collection-manifest.json +2 -0
  8. package/dist/collection/components/calculator/lido-calculator.css +87 -0
  9. package/dist/collection/components/calculator/lido-calculator.js +321 -0
  10. package/dist/collection/components/cell/lido-cell.js +1 -1
  11. package/dist/collection/components/column/lido-col.js +1 -1
  12. package/dist/collection/components/container/lido-container.js +20 -1
  13. package/dist/collection/components/flashCard/lido-flash-card.js +1 -1
  14. package/dist/collection/components/float/lido-float.js +1 -1
  15. package/dist/collection/components/home/lido-home.js +9 -29
  16. package/dist/collection/components/keyboard/lido-keyboard.js +2 -2
  17. package/dist/collection/components/mathMatrix/lido-math-matrix.css +10 -2
  18. package/dist/collection/components/mathMatrix/lido-math-matrix.js +226 -20
  19. package/dist/collection/components/position/lido-pos.js +1 -1
  20. package/dist/collection/components/random/lido-random.js +1 -1
  21. package/dist/collection/components/row/lido-row.js +1 -1
  22. package/dist/collection/components/scale/lido-balance.css +114 -0
  23. package/dist/collection/components/scale/lido-balance.js +549 -0
  24. package/dist/collection/components/shape/lido-shape.js +1 -1
  25. package/dist/collection/components/slideFill/lido-slide-fill.js +1 -1
  26. package/dist/collection/components/text/lido-text.js +1 -1
  27. package/dist/collection/components/trace/lido-trace.js +49 -128
  28. package/dist/collection/components/wrap/lido-wrap.js +1 -1
  29. package/dist/collection/css/animation.css +21 -0
  30. package/dist/collection/css/index.css +45 -0
  31. package/dist/collection/stories/Templates/Fill-Up/fill-up.stories.js +24 -25
  32. package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +0 -3
  33. package/dist/collection/stories/Templates/balancing/balancing.stories.js +67 -0
  34. package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +156 -0
  35. package/dist/collection/stories/Templates/checkerBlock/checkerBlock.stories.js +49 -0
  36. package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +66 -0
  37. package/dist/collection/stories/Templates/foodJar/food-jar.stories.js +65 -0
  38. package/dist/collection/stories/Templates/matchBox/matchBox.stories.js +105 -0
  39. package/dist/collection/stories/Templates/matchBox/matchBox2.stories.js +92 -0
  40. package/dist/collection/stories/Templates/matchingCard/matching-card.stories.js +47 -0
  41. package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +59 -0
  42. package/dist/collection/stories/Templates/nimbleTable/nimbleTable.stories.js +93 -0
  43. package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +100 -0
  44. package/dist/collection/stories/Templates/numberPair/numberPair.stories.js +212 -0
  45. package/dist/collection/stories/Templates/order-tractor/order-tractor-ascending-order.stories.js +6 -7
  46. package/dist/collection/stories/Templates/order-tractor/order-tractor.stories.js +6 -7
  47. package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +158 -0
  48. package/dist/collection/stories/Templates/sequenceBox/sequenceBox1.stories.js +102 -0
  49. package/dist/collection/stories/Templates/sequenceBox/sequenceBox2.stories.js +94 -0
  50. package/dist/collection/stories/Templates/shapePair/shape-pair.stories.js +184 -0
  51. package/dist/collection/stories/Templates/shapeTractor/shape-tractor.stories.js +213 -0
  52. package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +109 -0
  53. package/dist/collection/stories/Templates/total/total.stories.js +59 -0
  54. package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +96 -0
  55. package/dist/collection/stories/Templates/writeSet/writeSet.stories.js +55 -0
  56. package/dist/collection/stories/Templates/writeWord/writeWord.stories.js +5 -6
  57. package/dist/collection/utils/utils.js +439 -81
  58. package/dist/collection/utils/utilsHandlers/clickHandler.js +21 -25
  59. package/dist/collection/utils/utilsHandlers/dragDropHandler.js +95 -42
  60. package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +67 -0
  61. package/dist/collection/utils/utilsHandlers/lidoCalculatorHandler.js +94 -0
  62. package/dist/collection/utils/utilsHandlers/matrixHandler.js +298 -0
  63. package/dist/collection/utils/utilsHandlers/slideHandler.js +4 -2
  64. package/dist/collection/utils/utilsHandlers/sortHandler.js +21 -12
  65. package/dist/components/index.js +1 -1
  66. package/dist/components/lido-avatar.js +1 -1
  67. package/dist/components/lido-balance.d.ts +11 -0
  68. package/dist/components/lido-balance.js +6 -0
  69. package/dist/components/lido-calculator.d.ts +11 -0
  70. package/dist/components/lido-calculator.js +6 -0
  71. package/dist/components/lido-cell.js +1 -1
  72. package/dist/components/lido-col.js +1 -1
  73. package/dist/components/lido-container.js +1 -1
  74. package/dist/components/lido-flash-card.js +1 -1
  75. package/dist/components/lido-float.js +1 -1
  76. package/dist/components/lido-home.js +1 -1
  77. package/dist/components/lido-image.js +1 -1
  78. package/dist/components/lido-keyboard.js +1 -1
  79. package/dist/components/lido-math-matrix.js +1 -1
  80. package/dist/components/lido-pos.js +1 -1
  81. package/dist/components/lido-random.js +1 -1
  82. package/dist/components/lido-root.js +32 -20
  83. package/dist/components/lido-row.js +1 -1
  84. package/dist/components/lido-shape.js +1 -1
  85. package/dist/components/lido-slide-fill.js +1 -1
  86. package/dist/components/lido-text.js +1 -1
  87. package/dist/components/lido-trace.js +1 -1
  88. package/dist/components/lido-wrap.js +1 -1
  89. package/dist/components/p-08d0deab.js +254 -0
  90. package/dist/components/{p-b5b6ad27.js → p-15971ede.js} +1 -1
  91. package/dist/components/{p-0bf92c7f.js → p-1fbdb431.js} +2 -2
  92. package/dist/components/{p-b43ce4e1.js → p-29bdd953.js} +2 -2
  93. package/dist/components/{p-b8af26e6.js → p-322acda6.js} +40 -48
  94. package/dist/components/{p-51943db6.js → p-3f406017.js} +2 -2
  95. package/dist/components/p-44808985.js +186 -0
  96. package/dist/components/{p-4cabbf28.js → p-52844fa4.js} +2 -2
  97. package/dist/components/{p-4882df37.js → p-73e31a86.js} +2 -2
  98. package/dist/components/{p-af54a485.js → p-74849cdd.js} +4 -4
  99. package/dist/components/{p-9c56f378.js → p-7f7e5672.js} +2 -2
  100. package/dist/components/{p-4dbae73b.js → p-835b973d.js} +2 -2
  101. package/dist/components/{p-b55af747.js → p-90465904.js} +50 -129
  102. package/dist/components/{p-cae021c6.js → p-904711c8.js} +2 -2
  103. package/dist/components/{p-e735dce9.js → p-9be56729.js} +5 -3
  104. package/dist/components/{p-cac6c8bf.js → p-afbc196f.js} +2 -2
  105. package/dist/components/{p-cfa2aec8.js → p-bed94c37.js} +1047 -164
  106. package/dist/components/{p-7f11a624.js → p-cbac3cbc.js} +1 -1
  107. package/dist/components/{p-61d97438.js → p-d37ab4dc.js} +2 -2
  108. package/dist/components/p-e36ddcc1.js +166 -0
  109. package/dist/components/{p-03e4cafe.js → p-e4e42677.js} +2 -2
  110. package/dist/esm/{index-f47852d4.js → index-170e58c7.js} +36 -4
  111. package/dist/esm/index.js +2 -2
  112. package/dist/esm/{lido-avatar_19.entry.js → lido-avatar_21.entry.js} +430 -181
  113. package/dist/esm/lido-player.js +3 -3
  114. package/dist/esm/loader.js +3 -3
  115. package/dist/esm/{utils-9ce243d8.js → utils-5df09162.js} +1031 -164
  116. package/dist/lido-player/index.esm.js +1 -1
  117. package/dist/lido-player/lido-player.css +1 -1
  118. package/dist/lido-player/lido-player.esm.js +1 -1
  119. package/dist/lido-player/p-137c99ce.js +2 -0
  120. package/dist/lido-player/p-7556e652.js +9 -0
  121. package/dist/lido-player/p-eb956325.entry.js +1 -0
  122. package/dist/types/components/calculator/lido-calculator.d.ts +40 -0
  123. package/dist/types/components/container/lido-container.d.ts +4 -0
  124. package/dist/types/components/home/lido-home.d.ts +0 -1
  125. package/dist/types/components/mathMatrix/lido-math-matrix.d.ts +24 -4
  126. package/dist/types/components/scale/lido-balance.d.ts +160 -0
  127. package/dist/types/components/trace/lido-trace.d.ts +0 -1
  128. package/dist/types/components.d.ts +342 -14
  129. package/dist/types/stories/Templates/balancing/balancing.stories.d.ts +4 -0
  130. package/dist/types/stories/Templates/checker-block/checkerBlock.stories.d.ts +4 -0
  131. package/dist/types/stories/Templates/checkerBlock/checkerBlock.stories.d.ts +4 -0
  132. package/dist/types/stories/Templates/fillAnswer/fill-answer.stories.d.ts +4 -0
  133. package/dist/types/stories/Templates/foodJar/food-jar.stories.d.ts +4 -0
  134. package/dist/types/stories/Templates/matchBox/matchBox.stories.d.ts +4 -0
  135. package/dist/types/stories/Templates/matchBox/matchBox2.stories.d.ts +4 -0
  136. package/dist/types/stories/Templates/matchingCard/matching-card.stories.d.ts +4 -0
  137. package/dist/types/stories/Templates/multiplyBeeds/multiplyBeeds.stories.d.ts +9 -0
  138. package/dist/types/stories/Templates/nimbleTable/nimbleTable.stories.d.ts +4 -0
  139. package/dist/types/stories/Templates/numberBoardTwo/numberBoardTwo.stories.d.ts +4 -0
  140. package/dist/types/stories/Templates/numberPair/numberPair.stories.d.ts +4 -0
  141. package/dist/types/stories/Templates/questionBoard/questionBoard.stories.d.ts +15 -0
  142. package/dist/types/stories/Templates/sequenceBox/sequenceBox1.stories.d.ts +11 -0
  143. package/dist/types/stories/Templates/sequenceBox/sequenceBox2.stories.d.ts +11 -0
  144. package/dist/types/stories/Templates/shapePair/shape-pair.stories.d.ts +4 -0
  145. package/dist/types/stories/Templates/shapeTractor/shape-tractor.stories.d.ts +12 -0
  146. package/dist/types/stories/Templates/sumTogether/sumTogether.stories.d.ts +11 -0
  147. package/dist/types/stories/Templates/total/total.stories.d.ts +4 -0
  148. package/dist/types/stories/Templates/writeNumber/writeNumber.stories.d.ts +13 -0
  149. package/dist/types/stories/Templates/writeSet/writeSet.stories.d.ts +4 -0
  150. package/dist/types/utils/utils.d.ts +8 -2
  151. package/dist/types/utils/utilsHandlers/dragDropHandler.d.ts +4 -0
  152. package/dist/types/utils/utilsHandlers/lidoBalanceHandler.d.ts +2 -0
  153. package/dist/types/utils/utilsHandlers/lidoCalculatorHandler.d.ts +1 -0
  154. package/dist/types/utils/utilsHandlers/matrixHandler.d.ts +1 -0
  155. package/package.json +1 -1
  156. package/dist/components/p-a8ab771b.js +0 -160
  157. package/dist/lido-player/p-90212aa9.js +0 -9
  158. package/dist/lido-player/p-d3911ee1.entry.js +0 -1
  159. package/dist/lido-player/p-ddf627b0.js +0 -2
@@ -0,0 +1,298 @@
1
+ import { LidoContainer } from "../constants";
2
+ import { getElementScale } from "./dragDropHandler";
3
+ export function handlingMatrix(element) {
4
+ const container = document.querySelector(LidoContainer);
5
+ if (!container)
6
+ return;
7
+ const defualtMatrix = element;
8
+ adjustSizeForSlots(container, defualtMatrix);
9
+ splitSlots(container, defualtMatrix);
10
+ }
11
+ const splitSlots = (container, defualtMatrix) => {
12
+ const defualtElements = defualtMatrix.querySelectorAll('.slot');
13
+ const allDropMatrixes = container.querySelectorAll('lido-math-matrix[type="drop"]');
14
+ const allDragMatrixes = container.querySelectorAll('lido-math-matrix[type="drag"]');
15
+ let slot = 1;
16
+ for (let i = 0; i < allDropMatrixes.length; i++) {
17
+ const el = allDropMatrixes[i];
18
+ const rowCount = el.getAttribute('rows') ? parseInt(el.getAttribute('rows')) : 1;
19
+ const colCount = el.getAttribute('cols') ? parseInt(el.getAttribute('cols')) : 1;
20
+ if (rowCount === 1 || colCount === 1) {
21
+ if (rowCount === colCount) {
22
+ const numbers = Array.from({ length: 100 }, (_, i) => i + 1)
23
+ .sort(() => Math.random() - 0.5) // Shuffle
24
+ .slice(0, 10); // Take first 10 unique numbers
25
+ allDropMatrixes.forEach((item, index) => {
26
+ const dropElement = item;
27
+ const dropPosition = defualtElements[numbers[index]];
28
+ // Safeguard if index > available numbers
29
+ if (!dropPosition)
30
+ return;
31
+ postioningDropElement(dropElement, dropPosition);
32
+ const dragElement = allDragMatrixes[index];
33
+ dragElement.setAttribute('text', (numbers[index] + 1).toString());
34
+ });
35
+ // return;
36
+ }
37
+ if (rowCount === 2 && colCount === 1) {
38
+ const pairs = generateDoubleSquares(10);
39
+ console.log('pairs double : ', pairs);
40
+ allDropMatrixes.forEach((item, index) => {
41
+ const dropElement = item;
42
+ const dropPosition = defualtElements[pairs[index][0] - 1];
43
+ postioningDropElement(dropElement, dropPosition);
44
+ });
45
+ allDragMatrixes.forEach((item, index) => {
46
+ const dragElement = item;
47
+ dragElement.setAttribute('text', pairs[index].toString());
48
+ });
49
+ break;
50
+ }
51
+ if (rowCount === 5) {
52
+ const dropPositionElements = generateHalfHorizontalStripes(i);
53
+ const dropPosition = defualtElements[dropPositionElements[0] - 1];
54
+ const dragElement = allDragMatrixes[i];
55
+ dragElement.setAttribute('text', dropPositionElements.toString());
56
+ postioningDropElement(el, dropPosition);
57
+ }
58
+ if (rowCount === 10) {
59
+ const dropPosition = defualtElements[slot];
60
+ const dragElement = allDragMatrixes[i];
61
+ dragElement.setAttribute('text', Array.from({ length: 10 }, (_, i) => slot + 1 + i * 10).toString());
62
+ postioningDropElement(el, dropPosition);
63
+ slot = slot + 2;
64
+ }
65
+ else if (colCount === 10) {
66
+ const dropPosition = defualtElements[10 + (slot - 1)];
67
+ const dragElement = allDragMatrixes[i];
68
+ dragElement.setAttribute('text', Array.from({ length: 10 }, (_, i) => i + 10 + slot).toString());
69
+ postioningDropElement(el, dropPosition);
70
+ slot = slot + 20;
71
+ }
72
+ }
73
+ else if (rowCount === 3 || colCount === 3) {
74
+ const slotCell = generateSlotsFromDrops(container);
75
+ const cellNumbers = Object.keys(slotCell).map(key => slotCell[key].cells);
76
+ allDragMatrixes.forEach((matrix, index) => {
77
+ const dragElement = matrix;
78
+ // let dragTextAttr = dragElement.getAttribute('text');
79
+ if (dragElement) {
80
+ dragElement.setAttribute('text', cellNumbers[index].toString());
81
+ }
82
+ });
83
+ allDropMatrixes.forEach((matrix, index) => {
84
+ const dropElement = matrix;
85
+ const dropPosition = defualtElements[slotCell[`slot-${index + 1}`].cells[0] - 1];
86
+ postioningDropElement(dropElement, dropPosition);
87
+ });
88
+ break; // stops the loop immediately
89
+ }
90
+ else if (rowCount === 2 || colCount === 2) {
91
+ if (rowCount === colCount) {
92
+ const pairs = generate2by2Squares(10);
93
+ allDropMatrixes.forEach((item, index) => {
94
+ const dropElement = item;
95
+ const dropPosition = defualtElements[pairs[index][0] - 1];
96
+ postioningDropElement(dropElement, dropPosition);
97
+ });
98
+ allDragMatrixes.forEach((item, index) => {
99
+ const dragElement = item;
100
+ dragElement.setAttribute('text', pairs[index].toString());
101
+ });
102
+ break;
103
+ }
104
+ }
105
+ }
106
+ };
107
+ function generateSlotsFromDrops(container) {
108
+ const gridSize = 10;
109
+ let availableCells = Array.from({ length: 100 }, (_, i) => i + 1);
110
+ const occupied = new Set();
111
+ const slots = {};
112
+ let generated = 0;
113
+ const getCell = (row, col) => row * gridSize + col + 1;
114
+ // Get all <lido-math-matrix type="drop">
115
+ const allDropMatrixes = container.querySelectorAll('lido-math-matrix[type="drop"]');
116
+ for (const matrix of Array.from(allDropMatrixes)) {
117
+ const width = parseInt(matrix.getAttribute('cols') || '1');
118
+ const height = parseInt(matrix.getAttribute('rows') || '1');
119
+ const possiblePositions = [];
120
+ // generate all possible top-left positions
121
+ for (let row = 0; row <= gridSize - height; row++) {
122
+ for (let col = 0; col <= gridSize - width; col++) {
123
+ const cells = [];
124
+ let canPlace = true;
125
+ for (let r = 0; r < height; r++) {
126
+ for (let c = 0; c < width; c++) {
127
+ const cell = getCell(row + r, col + c);
128
+ if (occupied.has(cell)) {
129
+ canPlace = false;
130
+ break;
131
+ }
132
+ cells.push(cell);
133
+ }
134
+ if (!canPlace)
135
+ break;
136
+ }
137
+ if (canPlace)
138
+ possiblePositions.push(cells);
139
+ }
140
+ }
141
+ if (possiblePositions.length === 0) {
142
+ console.warn(`No space left for matrix ${generated + 1}`);
143
+ continue;
144
+ }
145
+ // Pick a random valid position
146
+ const randomCells = possiblePositions[Math.floor(Math.random() * possiblePositions.length)];
147
+ // Mark as occupied & remove from available
148
+ randomCells.forEach(c => {
149
+ occupied.add(c);
150
+ availableCells = availableCells.filter(x => x !== c);
151
+ });
152
+ generated++;
153
+ slots[`slot-${generated}`] = { cells: randomCells, width, height };
154
+ }
155
+ return slots;
156
+ }
157
+ const postioningDropElement = (dropElement, dropPosition) => {
158
+ const container = document.getElementById(LidoContainer);
159
+ const containerScale = getElementScale(container);
160
+ dropElement.style.transform = 'translate(0,0)';
161
+ const posRect = dropPosition.getBoundingClientRect();
162
+ const dropRect = dropElement.getBoundingClientRect();
163
+ const posCenterX = posRect.left + posRect.width / 2;
164
+ const posCenterY = posRect.top + posRect.height / 2;
165
+ const dropCenterX = dropRect.left + dropRect.width / 2;
166
+ const dropCenterY = dropRect.top + dropRect.height / 2;
167
+ const scaledLeft = (posCenterX - dropCenterX) / containerScale;
168
+ const scaledTop = (posCenterY - dropCenterY) / containerScale;
169
+ const rowCount = dropElement.getAttribute('rows') ? parseInt(dropElement.getAttribute('rows')) : 1;
170
+ const colCount = dropElement.getAttribute('cols') ? parseInt(dropElement.getAttribute('cols')) : 1;
171
+ const elementWidth = parseInt(dropPosition.style.width);
172
+ if (rowCount === 1 || colCount === 1) {
173
+ if (rowCount === colCount) {
174
+ dropElement.style.transform = `translate(${scaledLeft}px, ${scaledTop}px)`;
175
+ return;
176
+ }
177
+ else if (rowCount > colCount) {
178
+ if (rowCount === 10) {
179
+ dropElement.style.transform = `translate(${scaledLeft + (elementWidth * 4 + elementWidth / 2)}px, ${scaledTop}px)`;
180
+ }
181
+ else if (rowCount === 5) {
182
+ dropElement.style.transform = `translate(${scaledLeft + elementWidth * 2}px, ${scaledTop}px)`;
183
+ }
184
+ else if (rowCount === 2) {
185
+ dropElement.style.transform = `translate(${scaledLeft + elementWidth / 2}px, ${scaledTop}px)`;
186
+ }
187
+ }
188
+ else if (rowCount < colCount) {
189
+ if (colCount === 10) {
190
+ dropElement.style.transform = `translate(${scaledLeft}px, ${scaledTop + elementWidth * 4 + elementWidth * 0.2 + elementWidth / 2}px)`;
191
+ }
192
+ else if (colCount === 5) {
193
+ dropElement.style.transform = `translate(${scaledLeft}px, ${scaledTop + elementWidth * 2 + elementWidth * 0.0921}px)`;
194
+ }
195
+ }
196
+ return;
197
+ }
198
+ if (rowCount === colCount) {
199
+ if (rowCount === 2) {
200
+ dropElement.style.transform = `translate(${scaledLeft + elementWidth / 2}px, ${scaledTop + elementWidth / 2 + 4}px)`;
201
+ return;
202
+ }
203
+ dropElement.style.transform = `translate(${scaledLeft + elementWidth}px, ${scaledTop + elementWidth + 4}px)`;
204
+ return;
205
+ }
206
+ if (rowCount === 3) {
207
+ if (colCount === 2) {
208
+ dropElement.style.transform = `translate(${scaledLeft + elementWidth}px, ${scaledTop + elementWidth / 2 + 4}px)`;
209
+ return;
210
+ }
211
+ else if (colCount === 1) {
212
+ dropElement.style.transform = `translate(${scaledLeft + elementWidth}px, ${scaledTop}px)`;
213
+ return;
214
+ }
215
+ }
216
+ if (rowCount === 2) {
217
+ if (colCount === 3) {
218
+ dropElement.style.transform = `translate(${scaledLeft + elementWidth / 2}px, ${scaledTop + elementWidth + 4}px)`;
219
+ return;
220
+ }
221
+ else if (colCount === 1) {
222
+ dropElement.style.transform = `translate(${scaledLeft + elementWidth / 2}px, ${scaledTop}px)`;
223
+ return;
224
+ }
225
+ }
226
+ };
227
+ const adjustSizeForSlots = (container, defualtMatrix) => {
228
+ const defualtElement = defualtMatrix.querySelector('.slot');
229
+ const width = defualtElement.style.width;
230
+ const allDropMatrixes = container.querySelectorAll('lido-math-matrix[type="drop"]');
231
+ const allDragMatrixes = container.querySelectorAll('lido-math-matrix[type="drag"]');
232
+ allDragMatrixes.forEach(item => {
233
+ const el = item;
234
+ Array.from(el.querySelectorAll('.slot')).forEach(slot => {
235
+ const slotEl = slot;
236
+ slotEl.parentElement.style.width = width;
237
+ slotEl.style.width = width;
238
+ slotEl.style.height = width;
239
+ });
240
+ });
241
+ allDropMatrixes.forEach(item => {
242
+ const el = item;
243
+ Array.from(el.querySelectorAll('.slot')).forEach(slot => {
244
+ const slotEl = slot;
245
+ slotEl.parentElement.style.width = width;
246
+ slotEl.style.width = width;
247
+ slotEl.style.height = width;
248
+ });
249
+ });
250
+ };
251
+ function generateHalfHorizontalStripes(index) {
252
+ const numbers = Array.from({ length: 10 }, (_, i) => index + 1 + i * 10);
253
+ const randomPlace = Math.floor(Math.random() * 6);
254
+ const startSlot = numbers[randomPlace];
255
+ console.log('kedachuruchu', Array.from({ length: 5 }, (_, i) => startSlot + i * 10));
256
+ return Array.from({ length: 5 }, (_, i) => startSlot + i * 10);
257
+ }
258
+ function generate2by2Squares(count = 16) {
259
+ const gridSize = 10;
260
+ const squares = [];
261
+ const usedCells = new Set();
262
+ function getCell(row, col) {
263
+ return (row - 1) * gridSize + col;
264
+ }
265
+ while (squares.length < count) {
266
+ const row = Math.floor(Math.random() * (gridSize - 1)) + 1; // 1–9
267
+ const col = Math.floor(Math.random() * (gridSize - 1)) + 1; // 1–9
268
+ const square = [getCell(row, col), getCell(row, col + 1), getCell(row + 1, col), getCell(row + 1, col + 1)];
269
+ // Skip if overlapping with previous
270
+ if (square.some(cell => usedCells.has(cell)))
271
+ continue;
272
+ // Mark cells as used
273
+ square.forEach(cell => usedCells.add(cell));
274
+ squares.push(square);
275
+ }
276
+ return squares;
277
+ }
278
+ function generateDoubleSquares(count = 16) {
279
+ const gridSize = 10;
280
+ const pairs = [];
281
+ const usedCells = new Set();
282
+ function getCell(row, col) {
283
+ return (row - 1) * gridSize + col;
284
+ }
285
+ while (pairs.length < count) {
286
+ const row = Math.floor(Math.random() * (gridSize - 1)) + 1; // 1–9
287
+ const col = Math.floor(Math.random() * gridSize) + 1; // 1–10
288
+ const top = getCell(row, col);
289
+ const bottom = getCell(row + 1, col);
290
+ // Skip if already used
291
+ if (usedCells.has(top) || usedCells.has(bottom))
292
+ continue;
293
+ pairs.push([top, bottom]);
294
+ usedCells.add(top);
295
+ usedCells.add(bottom);
296
+ }
297
+ return pairs;
298
+ }
@@ -242,13 +242,15 @@ export function slidingWithScaling(element) {
242
242
  });
243
243
  }
244
244
  const slideCompleted = (slideElement) => {
245
- const slideArr = JSON.parse(localStorage.getItem(SelectedValuesKey)) || [];
245
+ var _a;
246
+ const container = document.getElementById(LidoContainer);
247
+ const slideArr = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
246
248
  const allSlideElements = document.querySelectorAll("[type='slide']");
247
249
  let index = 0;
248
250
  allSlideElements.forEach(item => {
249
251
  slideArr[index++] = item['value'];
250
252
  });
251
- localStorage.setItem(SelectedValuesKey, JSON.stringify(slideArr));
253
+ container.setAttribute(SelectedValuesKey, JSON.stringify(slideArr));
252
254
  const objectiveString = document.getElementById(LidoContainer)['objective'];
253
255
  const objectiveArray = objectiveString.split(',');
254
256
  const elementIndex = slideArr.indexOf(slideElement['value']);
@@ -1,5 +1,5 @@
1
- import { DragSelectedMapKey, LidoContainer, SelectedValuesKey } from "../constants";
2
- import { calculateScale, executeActions, handleShowCheck, matchStringPattern, onActivityComplete, storingEachActivityScore } from "../utils";
1
+ import { LidoContainer, SelectedValuesKey, DropToAttr } from "../constants";
2
+ import { buildDragSelectedMapFromDOM, executeActions, handleShowCheck, matchStringPattern, onActivityComplete, storingEachActivityScore } from "../utils";
3
3
  let preOverlap;
4
4
  function getElementScale(element) {
5
5
  const transform = window.getComputedStyle(element).transform;
@@ -106,7 +106,7 @@ export function enableReorderDrag(element) {
106
106
  isClicked = false;
107
107
  event.preventDefault();
108
108
  const containerRect = container.getBoundingClientRect();
109
- const containerScale = calculateScale();
109
+ const containerScale = getElementScale(container);
110
110
  const newLeft = (point.clientX - containerRect.left - offsetXInElement) / containerScale;
111
111
  const newTop = (point.clientY - containerRect.top - offsetYInElement) / containerScale;
112
112
  element.style.left = `${newLeft}px`;
@@ -173,16 +173,18 @@ export function enableReorderDrag(element) {
173
173
  else {
174
174
  if (element.parentElement['type'] !== 'category') {
175
175
  executeActions('this.alignMatch=true', divEl, element);
176
- divEl.replaceWith(element);
176
+ setTimeout(() => {
177
+ divEl.replaceWith(element);
178
+ }, 500);
177
179
  }
178
180
  else {
179
181
  const categoryElement = element.parentElement;
180
- const dragValues = JSON.parse(localStorage.getItem(DragSelectedMapKey)) || {};
182
+ const dragValues = buildDragSelectedMapFromDOM();
181
183
  const tabKey = categoryElement.getAttribute('tab-index');
182
184
  const targetValue = element['value'];
183
185
  if (dragValues[tabKey]) {
184
186
  dragValues[tabKey] = dragValues[tabKey].filter((el) => el !== targetValue);
185
- localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragValues));
187
+ // localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragValues));
186
188
  }
187
189
  optionArea.scrollTo({
188
190
  top: optionArea.scrollHeight,
@@ -190,6 +192,7 @@ export function enableReorderDrag(element) {
190
192
  });
191
193
  optionArea.appendChild(element);
192
194
  element.classList.remove('dropped');
195
+ element.removeAttribute('drop-to');
193
196
  if (dummy) {
194
197
  dummy.remove();
195
198
  }
@@ -228,12 +231,12 @@ export function enableReorderDrag(element) {
228
231
  category = categoryArr[0];
229
232
  }
230
233
  if (element.parentElement.getAttribute('type') === 'category') {
231
- const dragValues = JSON.parse(localStorage.getItem(DragSelectedMapKey)) || {};
234
+ const dragValues = buildDragSelectedMapFromDOM();
232
235
  const tabKey = category.getAttribute('tab-index');
233
236
  const targetValue = element['value'];
234
237
  if (dragValues[tabKey]) {
235
238
  dragValues[tabKey] = dragValues[tabKey].filter((el) => el !== targetValue);
236
- localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragValues));
239
+ // localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragValues));
237
240
  }
238
241
  const dummy = createDummyElement(element);
239
242
  optionArea.appendChild(dummy);
@@ -247,6 +250,7 @@ export function enableReorderDrag(element) {
247
250
  resetElementStyles(element);
248
251
  dummy.replaceWith(element);
249
252
  element.classList.remove('dropped');
253
+ element.removeAttribute('drop-to');
250
254
  }, 100);
251
255
  return;
252
256
  }
@@ -395,13 +399,15 @@ function moveWithAnimation(target, overlapped) {
395
399
  }
396
400
  // Drop Completed
397
401
  const wordDropComplete = (block, element) => {
402
+ var _a;
403
+ console.log("worddrop");
398
404
  const container = document.getElementById(LidoContainer);
399
405
  const objective = container.getAttribute('objective');
400
406
  const objectiveArray = objective.split(',');
401
- let wordArray = JSON.parse(localStorage.getItem(SelectedValuesKey)) || [];
407
+ let wordArray = JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
402
408
  const wordBlock = block.children;
403
409
  wordArray = Array.from(wordBlock).map(child => child.getAttribute('value'));
404
- localStorage.setItem(SelectedValuesKey, JSON.stringify(wordArray));
410
+ container.setAttribute(SelectedValuesKey, JSON.stringify(wordArray));
405
411
  const elementIndex = wordArray.indexOf(element['value']);
406
412
  if (elementIndex >= 0) {
407
413
  const res = matchStringPattern(element['value'], [objectiveArray[elementIndex].trim()]);
@@ -416,7 +422,7 @@ const wordDropComplete = (block, element) => {
416
422
  };
417
423
  async function onDropToCategory(dragElement, categoryElement) {
418
424
  dragElement.classList.add('dropped');
419
- let dragSelected = JSON.parse(localStorage.getItem(DragSelectedMapKey)) || {};
425
+ let dragSelected = buildDragSelectedMapFromDOM();
420
426
  let elementArr = dragSelected[categoryElement.getAttribute('tab-index')];
421
427
  if (Array.isArray(elementArr)) {
422
428
  if (elementArr.includes(dragElement['value']))
@@ -428,6 +434,9 @@ async function onDropToCategory(dragElement, categoryElement) {
428
434
  dragSelected[key].splice(index, 1);
429
435
  }
430
436
  }
431
- localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragSelected));
437
+ if (categoryElement === null || categoryElement === void 0 ? void 0 : categoryElement.id) {
438
+ dragElement.setAttribute(DropToAttr, categoryElement.id);
439
+ }
440
+ // localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragSelected));
432
441
  await onActivityComplete(dragElement, categoryElement);
433
442
  }
@@ -1 +1 @@
1
- export { f as format, g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-cfa2aec8.js';
1
+ export { f as format, g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-bed94c37.js';
@@ -1,4 +1,4 @@
1
- import { L as LidoAvatar$1, d as defineCustomElement$1 } from './p-7f11a624.js';
1
+ import { L as LidoAvatar$1, d as defineCustomElement$1 } from './p-cbac3cbc.js';
2
2
 
3
3
  const LidoAvatar = LidoAvatar$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface LidoBalance extends Components.LidoBalance, HTMLElement {}
4
+ export const LidoBalance: {
5
+ prototype: LidoBalance;
6
+ new (): LidoBalance;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { L as LidoBalance$1, d as defineCustomElement$1 } from './p-44808985.js';
2
+
3
+ const LidoBalance = LidoBalance$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { LidoBalance, defineCustomElement };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface LidoCalculator extends Components.LidoCalculator, HTMLElement {}
4
+ export const LidoCalculator: {
5
+ prototype: LidoCalculator;
6
+ new (): LidoCalculator;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { L as LidoCalculator$1, d as defineCustomElement$1 } from './p-e36ddcc1.js';
2
+
3
+ const LidoCalculator = LidoCalculator$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { LidoCalculator, defineCustomElement };
@@ -1,4 +1,4 @@
1
- import { L as LidoCell$1, d as defineCustomElement$1 } from './p-b43ce4e1.js';
1
+ import { L as LidoCell$1, d as defineCustomElement$1 } from './p-29bdd953.js';
2
2
 
3
3
  const LidoCell = LidoCell$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoCol$1, d as defineCustomElement$1 } from './p-4cabbf28.js';
1
+ import { L as LidoCol$1, d as defineCustomElement$1 } from './p-52844fa4.js';
2
2
 
3
3
  const LidoCol = LidoCol$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoContainer$1, d as defineCustomElement$1 } from './p-e735dce9.js';
1
+ import { L as LidoContainer$1, d as defineCustomElement$1 } from './p-9be56729.js';
2
2
 
3
3
  const LidoContainer = LidoContainer$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoFlash, d as defineCustomElement$1 } from './p-03e4cafe.js';
1
+ import { L as LidoFlash, d as defineCustomElement$1 } from './p-e4e42677.js';
2
2
 
3
3
  const LidoFlashCard = LidoFlash;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoFloat$1, d as defineCustomElement$1 } from './p-0bf92c7f.js';
1
+ import { L as LidoFloat$1, d as defineCustomElement$1 } from './p-1fbdb431.js';
2
2
 
3
3
  const LidoFloat = LidoFloat$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoHome$1, d as defineCustomElement$1 } from './p-b8af26e6.js';
1
+ import { L as LidoHome$1, d as defineCustomElement$1 } from './p-322acda6.js';
2
2
 
3
3
  const LidoHome = LidoHome$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoImage$1, d as defineCustomElement$1 } from './p-b5b6ad27.js';
1
+ import { L as LidoImage$1, d as defineCustomElement$1 } from './p-15971ede.js';
2
2
 
3
3
  const LidoImage = LidoImage$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoKeyboard$1, d as defineCustomElement$1 } from './p-af54a485.js';
1
+ import { L as LidoKeyboard$1, d as defineCustomElement$1 } from './p-74849cdd.js';
2
2
 
3
3
  const LidoKeyboard = LidoKeyboard$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoMathMatrix$1, d as defineCustomElement$1 } from './p-a8ab771b.js';
1
+ import { L as LidoMathMatrix$1, d as defineCustomElement$1 } from './p-08d0deab.js';
2
2
 
3
3
  const LidoMathMatrix = LidoMathMatrix$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoPos$1, d as defineCustomElement$1 } from './p-61d97438.js';
1
+ import { L as LidoPos$1, d as defineCustomElement$1 } from './p-d37ab4dc.js';
2
2
 
3
3
  const LidoPos = LidoPos$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoRandom$1, d as defineCustomElement$1 } from './p-51943db6.js';
1
+ import { L as LidoRandom$1, d as defineCustomElement$1 } from './p-3f406017.js';
2
2
 
3
3
  const LidoRandom = LidoRandom$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,22 +1,24 @@
1
- import { p as proxyCustomElement, H, g as getAssetPath, h } from './p-cfa2aec8.js';
2
- import { d as defineCustomElement$j } from './p-7f11a624.js';
3
- import { d as defineCustomElement$i } from './p-b43ce4e1.js';
4
- import { d as defineCustomElement$h } from './p-4cabbf28.js';
5
- import { d as defineCustomElement$g } from './p-e735dce9.js';
6
- import { d as defineCustomElement$f } from './p-03e4cafe.js';
7
- import { d as defineCustomElement$e } from './p-0bf92c7f.js';
8
- import { d as defineCustomElement$d } from './p-b8af26e6.js';
9
- import { d as defineCustomElement$c } from './p-b5b6ad27.js';
10
- import { d as defineCustomElement$b } from './p-af54a485.js';
11
- import { d as defineCustomElement$a } from './p-a8ab771b.js';
12
- import { d as defineCustomElement$9 } from './p-61d97438.js';
13
- import { d as defineCustomElement$8 } from './p-51943db6.js';
14
- import { d as defineCustomElement$7 } from './p-9c56f378.js';
15
- import { d as defineCustomElement$6 } from './p-cae021c6.js';
16
- import { d as defineCustomElement$5 } from './p-4882df37.js';
17
- import { d as defineCustomElement$4 } from './p-cac6c8bf.js';
18
- import { d as defineCustomElement$3 } from './p-b55af747.js';
19
- import { d as defineCustomElement$2 } from './p-4dbae73b.js';
1
+ import { p as proxyCustomElement, H, g as getAssetPath, h } from './p-bed94c37.js';
2
+ import { d as defineCustomElement$l } from './p-cbac3cbc.js';
3
+ import { d as defineCustomElement$k } from './p-44808985.js';
4
+ import { d as defineCustomElement$j } from './p-e36ddcc1.js';
5
+ import { d as defineCustomElement$i } from './p-29bdd953.js';
6
+ import { d as defineCustomElement$h } from './p-52844fa4.js';
7
+ import { d as defineCustomElement$g } from './p-9be56729.js';
8
+ import { d as defineCustomElement$f } from './p-e4e42677.js';
9
+ import { d as defineCustomElement$e } from './p-1fbdb431.js';
10
+ import { d as defineCustomElement$d } from './p-322acda6.js';
11
+ import { d as defineCustomElement$c } from './p-15971ede.js';
12
+ import { d as defineCustomElement$b } from './p-74849cdd.js';
13
+ import { d as defineCustomElement$a } from './p-08d0deab.js';
14
+ import { d as defineCustomElement$9 } from './p-d37ab4dc.js';
15
+ import { d as defineCustomElement$8 } from './p-3f406017.js';
16
+ import { d as defineCustomElement$7 } from './p-7f7e5672.js';
17
+ import { d as defineCustomElement$6 } from './p-904711c8.js';
18
+ import { d as defineCustomElement$5 } from './p-73e31a86.js';
19
+ import { d as defineCustomElement$4 } from './p-afbc196f.js';
20
+ import { d as defineCustomElement$3 } from './p-90465904.js';
21
+ import { d as defineCustomElement$2 } from './p-835b973d.js';
20
22
 
21
23
  const LidoRoot$1 = /*@__PURE__*/ proxyCustomElement(class LidoRoot extends H {
22
24
  constructor() {
@@ -95,7 +97,7 @@ function defineCustomElement$1() {
95
97
  if (typeof customElements === "undefined") {
96
98
  return;
97
99
  }
98
- const components = ["lido-root", "lido-avatar", "lido-cell", "lido-col", "lido-container", "lido-flash-card", "lido-float", "lido-home", "lido-image", "lido-keyboard", "lido-math-matrix", "lido-pos", "lido-random", "lido-row", "lido-shape", "lido-slide-fill", "lido-text", "lido-trace", "lido-wrap"];
100
+ const components = ["lido-root", "lido-avatar", "lido-balance", "lido-calculator", "lido-cell", "lido-col", "lido-container", "lido-flash-card", "lido-float", "lido-home", "lido-image", "lido-keyboard", "lido-math-matrix", "lido-pos", "lido-random", "lido-row", "lido-shape", "lido-slide-fill", "lido-text", "lido-trace", "lido-wrap"];
99
101
  components.forEach(tagName => { switch (tagName) {
100
102
  case "lido-root":
101
103
  if (!customElements.get(tagName)) {
@@ -103,6 +105,16 @@ function defineCustomElement$1() {
103
105
  }
104
106
  break;
105
107
  case "lido-avatar":
108
+ if (!customElements.get(tagName)) {
109
+ defineCustomElement$l();
110
+ }
111
+ break;
112
+ case "lido-balance":
113
+ if (!customElements.get(tagName)) {
114
+ defineCustomElement$k();
115
+ }
116
+ break;
117
+ case "lido-calculator":
106
118
  if (!customElements.get(tagName)) {
107
119
  defineCustomElement$j();
108
120
  }
@@ -1,4 +1,4 @@
1
- import { L as LidoRow$1, d as defineCustomElement$1 } from './p-9c56f378.js';
1
+ import { L as LidoRow$1, d as defineCustomElement$1 } from './p-7f7e5672.js';
2
2
 
3
3
  const LidoRow = LidoRow$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoShape$1, d as defineCustomElement$1 } from './p-cae021c6.js';
1
+ import { L as LidoShape$1, d as defineCustomElement$1 } from './p-904711c8.js';
2
2
 
3
3
  const LidoShape = LidoShape$1;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { L as LidoSlideFill$1, d as defineCustomElement$1 } from './p-4882df37.js';
1
+ import { L as LidoSlideFill$1, d as defineCustomElement$1 } from './p-73e31a86.js';
2
2
 
3
3
  const LidoSlideFill = LidoSlideFill$1;
4
4
  const defineCustomElement = defineCustomElement$1;