lido-player 0.0.2-alpha-26 → 0.0.2-alpha-28

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 (58) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/lido-avatar_18.cjs.entry.js +2 -2
  3. package/dist/cjs/{utils-dc70b21f.js → utils-0c09d26d.js} +61 -36
  4. package/dist/collection/components/home/lido-home.js +1 -1
  5. package/dist/collection/stories/Templates/RocketGame/rocketGame.stories.js +1 -1
  6. package/dist/collection/stories/Templates/jumpSentence/jumpSentence.stories.js +1 -1
  7. package/dist/collection/stories/Templates/phonic-tractor/phonic-tractor.stories.js +7 -6
  8. package/dist/collection/stories/Templates/quizLiteracy/quizLiteracy.stories.js +9 -9
  9. package/dist/collection/stories/Templates/quizLiteracy/quizLiteracyImageWord.stories.js +7 -7
  10. package/dist/collection/utils/utils.js +9 -10
  11. package/dist/collection/utils/utilsHandlers/dragDropHandler.js +46 -20
  12. package/dist/components/index.js +1 -1
  13. package/dist/components/lido-avatar.js +1 -1
  14. package/dist/components/lido-cell.js +1 -1
  15. package/dist/components/lido-col.js +1 -1
  16. package/dist/components/lido-container.js +1 -1
  17. package/dist/components/lido-flash-card.js +1 -1
  18. package/dist/components/lido-float.js +1 -1
  19. package/dist/components/lido-home.js +1 -1
  20. package/dist/components/lido-image.js +1 -1
  21. package/dist/components/lido-keyboard.js +1 -1
  22. package/dist/components/lido-pos.js +1 -1
  23. package/dist/components/lido-random.js +1 -1
  24. package/dist/components/lido-root.js +18 -18
  25. package/dist/components/lido-row.js +1 -1
  26. package/dist/components/lido-shape.js +1 -1
  27. package/dist/components/lido-slide-fill.js +1 -1
  28. package/dist/components/lido-text.js +1 -1
  29. package/dist/components/lido-trace.js +1 -1
  30. package/dist/components/lido-wrap.js +1 -1
  31. package/dist/components/{p-dd9976f6.js → p-0ba556d0.js} +1 -1
  32. package/dist/components/{p-c156534f.js → p-1f5fb263.js} +1 -1
  33. package/dist/components/{p-a6e5e670.js → p-258a62fd.js} +1 -1
  34. package/dist/components/{p-b11e6d2c.js → p-2ad42ff6.js} +1 -1
  35. package/dist/components/{p-6efa0fcc.js → p-3b573a3a.js} +1 -1
  36. package/dist/components/{p-9001096f.js → p-432b0664.js} +1 -1
  37. package/dist/components/{p-1207d601.js → p-5052cdfe.js} +1 -1
  38. package/dist/components/{p-ffe626ce.js → p-7b450f84.js} +2 -2
  39. package/dist/components/{p-dad02bf5.js → p-8cfa45d4.js} +1 -1
  40. package/dist/components/{p-a45a529d.js → p-8f9011c1.js} +1 -1
  41. package/dist/components/{p-b633cb0b.js → p-996087bc.js} +1 -1
  42. package/dist/components/{p-5a8fec7f.js → p-9db82913.js} +1 -1
  43. package/dist/components/{p-e92d87e9.js → p-b5b10d9e.js} +1 -1
  44. package/dist/components/{p-240a7803.js → p-bc0301c2.js} +1 -1
  45. package/dist/components/{p-06985aa0.js → p-c1df8ab6.js} +61 -36
  46. package/dist/components/{p-a3009d71.js → p-c7b72293.js} +1 -1
  47. package/dist/components/{p-49ae22a0.js → p-cc2f200f.js} +1 -1
  48. package/dist/components/{p-b4ab7d08.js → p-eefeb600.js} +18 -18
  49. package/dist/esm/index.js +1 -1
  50. package/dist/esm/lido-avatar_18.entry.js +2 -2
  51. package/dist/esm/{utils-3013a6cc.js → utils-9f655741.js} +61 -36
  52. package/dist/lido-player/index.esm.js +1 -1
  53. package/dist/lido-player/lido-player.esm.js +1 -1
  54. package/dist/lido-player/p-b29cf347.js +9 -0
  55. package/dist/lido-player/{p-6d21a635.entry.js → p-e9fb9e4d.entry.js} +1 -1
  56. package/dist/types/utils/utilsHandlers/dragDropHandler.d.ts +1 -0
  57. package/package.json +1 -1
  58. package/dist/lido-player/p-21ed6faf.js +0 -9
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const utils = require('./utils-dc70b21f.js');
5
+ const utils = require('./utils-0c09d26d.js');
6
6
  require('./index-fe562525.js');
7
7
 
8
8
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-fe562525.js');
6
- const utils = require('./utils-dc70b21f.js');
6
+ const utils = require('./utils-0c09d26d.js');
7
7
 
8
8
  var rive = {exports: {}};
9
9
 
@@ -7124,7 +7124,7 @@ const LidoHome = class {
7124
7124
  // const event = new CustomEvent('gameCompleted');
7125
7125
  // window.dispatchEvent(event);
7126
7126
  utils.dispatchGameCompletedEvent();
7127
- this.currentContainerIndex = 0;
7127
+ // this.currentContainerIndex = 0;
7128
7128
  }
7129
7129
  // Reset the containers array to trigger a re-render
7130
7130
  this.containers = [...this.containers];
@@ -1029,12 +1029,13 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
1029
1029
  dragElement.classList.remove('dropped');
1030
1030
  const container = document.getElementById(LidoContainer);
1031
1031
  const cloneArray = container.querySelectorAll(`#${dragElement.id}`);
1032
- const cloneDragElement = Array.from(cloneArray).find(item => dragElement !== item);
1032
+ const cloneDragElement = Array.from(cloneArray).find(item => dragElement !== item && !item.classList.contains('dropped'));
1033
1033
  dragElement.style.transition = 'transform 0.5s ease';
1034
1034
  if (cloneDragElement) {
1035
1035
  animateDragToTarget(dragElement, cloneDragElement, container);
1036
1036
  setTimeout(() => {
1037
1037
  if (container.getAttribute('drop-action') === exports.DropAction.InfiniteDrop) {
1038
+ dragElement.removeAttribute('hasDummy');
1038
1039
  dragElement.style.width = cloneDragElement.style.width;
1039
1040
  dragElement.style.height = cloneDragElement.style.height;
1040
1041
  }
@@ -1052,7 +1053,6 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
1052
1053
  }
1053
1054
  let currentDrop = dragToDropMap.get(dragElement);
1054
1055
  if (currentDrop) {
1055
- dragElement.removeAttribute(DropToAttr);
1056
1056
  dragToDropMap.delete(dragElement);
1057
1057
  updateDropBorder(currentDrop);
1058
1058
  if (((_a = currentDrop === null || currentDrop === void 0 ? void 0 : currentDrop.getAttribute('drop-attr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Stretch) {
@@ -1080,19 +1080,13 @@ function handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedV
1080
1080
  }
1081
1081
  if (dragSelectedData) {
1082
1082
  let dragSelected = JSON.parse(dragSelectedData);
1083
- let dropSelected = JSON.parse(dropSelectedData);
1084
- for (const key in dragSelected) {
1085
- if (dragSelected[key].includes(dragElement['value'])) {
1086
- for (const key in dropSelected) {
1087
- if (dropSelected[key].includes(dragElement.id)) {
1088
- delete dropSelected[key];
1089
- }
1090
- }
1091
- delete dragSelected[key];
1092
- }
1083
+ const dragPreDropElement = container.querySelector(`#${dragElement.getAttribute(DropToAttr)}`);
1084
+ if (dragPreDropElement) {
1085
+ delete dragSelected[dragPreDropElement.getAttribute('tab-index')];
1093
1086
  }
1094
1087
  localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragSelected));
1095
- // localStorage.setItem(DragMapKey, JSON.stringify(dropSelected));
1088
+ dragElement.removeAttribute(DropToAttr);
1089
+ updateDropBorder(currentDrop);
1096
1090
  }
1097
1091
  const allElements = document.querySelectorAll("[type='drop']");
1098
1092
  allElements.forEach(otherElement => {
@@ -1126,16 +1120,16 @@ async function onElementDropComplete(dragElement, dropElement) {
1126
1120
  var _a, _b, _c;
1127
1121
  const selectedValueData = localStorage.getItem(SelectedValuesKey) || '';
1128
1122
  const dragSelectedData = localStorage.getItem(DragSelectedMapKey);
1129
- const dropSelectedData = localStorage.getItem(DragMapKey);
1123
+ localStorage.getItem(DragMapKey);
1130
1124
  let dropHasDrag = JSON.parse(localStorage.getItem(DropHasDrag) || ' {}');
1131
1125
  const container = document.getElementById(LidoContainer);
1132
1126
  if (!dropElement) {
1133
- handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
1127
+ handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
1134
1128
  return;
1135
1129
  }
1136
1130
  const dropTabIndex = dropElement.getAttribute('tab-index');
1137
1131
  if ((_a = dropHasDrag[dropTabIndex]) === null || _a === void 0 ? void 0 : _a.isFull) {
1138
- handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
1132
+ handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
1139
1133
  return;
1140
1134
  }
1141
1135
  const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
@@ -1143,10 +1137,10 @@ async function onElementDropComplete(dragElement, dropElement) {
1143
1137
  if (!dropElement) {
1144
1138
  dragElement.style.transition = 'transform 0.5s ease';
1145
1139
  dragElement.style.transform = 'translate(0, 0)';
1146
- handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
1140
+ handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
1147
1141
  return;
1148
1142
  }
1149
- const isCorrect = dropElement['value'].includes(dragElement['value']);
1143
+ const isCorrect = dropElement.getAttribute('value').toLowerCase().includes(dragElement.getAttribute('value').toLowerCase());
1150
1144
  if (!isCorrect) {
1151
1145
  const localStorageKey = `${LidoContainer}_dropData`;
1152
1146
  dragElement.style.transition = 'transform 0.5s ease';
@@ -1161,7 +1155,7 @@ async function onElementDropComplete(dragElement, dropElement) {
1161
1155
  delete stored[oldDropIndex];
1162
1156
  localStorage.setItem(localStorageKey, JSON.stringify(stored));
1163
1157
  }
1164
- handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
1158
+ handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
1165
1159
  }, 100);
1166
1160
  if (dragElement['type'] === 'option') {
1167
1161
  const childs = Array.from(container.querySelectorAll(`[value="${dragElement['value']}"]`));
@@ -1184,7 +1178,7 @@ async function onElementDropComplete(dragElement, dropElement) {
1184
1178
  div.classList.add('after-drop-popup-container');
1185
1179
  const hasType = dragElement.nextElementSibling;
1186
1180
  // Remove from old parents
1187
- if (hasType && hasType.getAttribute("type") === 'drag') {
1181
+ if (hasType && hasType.getAttribute('type') === 'drag') {
1188
1182
  dragElement.remove();
1189
1183
  dropElement.remove();
1190
1184
  }
@@ -1229,7 +1223,6 @@ async function onElementDropComplete(dragElement, dropElement) {
1229
1223
  const dragWidth = dragElement.offsetWidth;
1230
1224
  dropElement.style.width = `${dragWidth}px`;
1231
1225
  }
1232
- dragElement.classList.add('dropped');
1233
1226
  if (!(((_b = dropElement.getAttribute('dropAttr')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === DropMode.Diagonal) && (dropElement.getAttribute('minDrops') === '1' || !dropElement.getAttribute('minDrops'))) {
1234
1227
  const isisFull = Object.values(dropHasDrag).find(item => document.getElementById(item.drop) === dropElement);
1235
1228
  if (isisFull) {
@@ -1242,12 +1235,13 @@ async function onElementDropComplete(dragElement, dropElement) {
1242
1235
  if (dragSelectedData) {
1243
1236
  let dragSelected = JSON.parse(dragSelectedData);
1244
1237
  for (const key in dragSelected) {
1245
- if (dragSelected[key].includes(dragElement['value'])) {
1238
+ if (dragSelected[key].includes(dragElement['value']) && dragElement.classList.contains('dropped')) {
1246
1239
  delete dragSelected[key];
1247
1240
  }
1248
1241
  }
1249
1242
  localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragSelected));
1250
1243
  }
1244
+ dragElement.classList.add('dropped');
1251
1245
  // Check for overlaps and highlight only the most overlapping element
1252
1246
  if (dropElement && !((_c = dropHasDrag[dropTabIndex]) === null || _c === void 0 ? void 0 : _c.isFull)) {
1253
1247
  let mostOverlappedElement = findMostoverlappedElement(dragElement, 'drag');
@@ -1287,7 +1281,7 @@ async function onElementDropComplete(dragElement, dropElement) {
1287
1281
  }
1288
1282
  }
1289
1283
  if (!dropElement) {
1290
- handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
1284
+ handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData);
1291
1285
  return;
1292
1286
  }
1293
1287
  if (dragSelectedData) {
@@ -1347,7 +1341,7 @@ async function onElementDropComplete(dragElement, dropElement) {
1347
1341
  allDropElements.forEach(el => updateDropBorder(el));
1348
1342
  }
1349
1343
  function updateDropBorder(element) {
1350
- if (!element.classList.contains('drop-element'))
1344
+ if (!element || !element.classList.contains('drop-element'))
1351
1345
  return;
1352
1346
  const container = document.getElementById(LidoContainer);
1353
1347
  if (!container)
@@ -1477,16 +1471,22 @@ const appendingDragElementsInDrop = () => {
1477
1471
  const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
1478
1472
  if (isAllowOnlyCorrect === true) {
1479
1473
  if (drop['value'] === drag['value']) {
1474
+ // Get original dimensions of the drag element
1475
+ const originalWidth = drag.offsetWidth;
1476
+ const originalHeight = drag.offsetHeight;
1480
1477
  drag.style.transform = 'translate(0,0)';
1481
1478
  drop.appendChild(drag);
1482
- // drag.style.boxShadow = 'none';
1479
+ resizeDragAndDropElementsForRocket(drag, drop, originalWidth, originalHeight);
1483
1480
  }
1484
1481
  }
1485
1482
  else {
1486
1483
  if (drop['value'].includes(drag['value'])) {
1484
+ // Get original dimensions of the drag element
1485
+ const originalWidth = drag.offsetWidth;
1486
+ const originalHeight = drag.offsetHeight;
1487
1487
  drag.style.transform = 'translate(0,0)';
1488
1488
  drop.appendChild(drag);
1489
- // drag.style.boxShadow = 'none';
1489
+ resizeDragAndDropElementsForRocket(drag, drop, originalWidth, originalHeight);
1490
1490
  }
1491
1491
  }
1492
1492
  });
@@ -1510,6 +1510,32 @@ const reduceSizeToOriginal = () => {
1510
1510
  }
1511
1511
  });
1512
1512
  };
1513
+ const resizeDragAndDropElementsForRocket = (drag, drop, width, height) => {
1514
+ const container = document.getElementById(LidoContainer);
1515
+ if (!container)
1516
+ return;
1517
+ const Rocket = document.getElementById("fullRrocket");
1518
+ if (!Rocket)
1519
+ return;
1520
+ // Get the scale of the container
1521
+ const containerScale = getElementScale(container);
1522
+ // Hide child image inside lido-image
1523
+ const childImage = drop.querySelector('img');
1524
+ if (childImage) {
1525
+ // Set the opacity to 1 for the drop element
1526
+ drop.style.opacity = '1';
1527
+ // Hide child image inside lido-image
1528
+ childImage.remove(); // remove the child image
1529
+ // Ensure dropped lido-text remains visible
1530
+ const childText = drop.querySelector('lido-text');
1531
+ if (childText) {
1532
+ childText.style.opacity = '1';
1533
+ }
1534
+ // Ensure dropped text retains its original size
1535
+ drag.style.width = `${width / containerScale}px`;
1536
+ drag.style.height = `${height}px`;
1537
+ }
1538
+ };
1513
1539
 
1514
1540
  const delay = (ms) => new Promise(res => setTimeout(res, ms));
1515
1541
  const slideAnimation = async () => {
@@ -67925,6 +67951,8 @@ const executeActions = async (actionsString, thisElement, element) => {
67925
67951
  else {
67926
67952
  dragElement.style.transform = `translate(${scaledLeft}px, ${scaledTop}px)`;
67927
67953
  }
67954
+ if (dragElement.getAttribute("hasDummy") === "true")
67955
+ return;
67928
67956
  afterDropDragHandling(dragElement, dropElement);
67929
67957
  break;
67930
67958
  }
@@ -68018,15 +68046,13 @@ const afterDropDragHandling = (dragElement, dropElement) => {
68018
68046
  dragElement.style.transition = '';
68019
68047
  let dummyElement = document.createElement('div');
68020
68048
  if (isInfinite) {
68021
- const allDummy = container.querySelectorAll(`[id=${dragElement.id}]`);
68022
- if (allDummy.length === 1) {
68023
- dummyElement = cloneElementWithComputedStyles(dragElement);
68024
- dummyElement.classList.remove('dropped');
68025
- dummyElement.removeAttribute('drop-to');
68026
- dummyElement.removeAttribute('drop-time');
68027
- dragElement.style.width = dropElement.style.width;
68028
- dragElement.style.height = dropElement.style.height;
68029
- }
68049
+ dummyElement = cloneElementWithComputedStyles(dragElement);
68050
+ dummyElement.classList.remove('dropped');
68051
+ dummyElement.removeAttribute('drop-to');
68052
+ dummyElement.removeAttribute('drop-time');
68053
+ dragElement.style.width = dropElement.style.width;
68054
+ dragElement.style.height = dropElement.style.height;
68055
+ dragElement.setAttribute("hasDummy", "true");
68030
68056
  }
68031
68057
  dummyElement.setAttribute('id', dragElement.getAttribute('id'));
68032
68058
  dragElement.replaceWith(dummyElement);
@@ -68065,7 +68091,6 @@ const afterDropDragHandling = (dragElement, dropElement) => {
68065
68091
  }
68066
68092
  };
68067
68093
  function cloneElementWithComputedStyles(originalEl) {
68068
- console.log(originalEl.outerHTML);
68069
68094
  let clone = document.createElement('div');
68070
68095
  clone.innerHTML = originalEl.outerHTML;
68071
68096
  clone = clone.firstChild;
@@ -38,7 +38,7 @@ export class LidoHome {
38
38
  // const event = new CustomEvent('gameCompleted');
39
39
  // window.dispatchEvent(event);
40
40
  dispatchGameCompletedEvent();
41
- this.currentContainerIndex = 0;
41
+ // this.currentContainerIndex = 0;
42
42
  }
43
43
  // Reset the containers array to trigger a re-render
44
44
  this.containers = [...this.containers];
@@ -115,7 +115,7 @@ function getContainerXml(args) {
115
115
  .join('');
116
116
  return `
117
117
  <main>
118
- <lido-container id="lido-container" objective="${args.correct1}, ${args.correct2}, ${args.correct3}" appendToDropOnCompletion="true" show-drop-border="false" tab-index="1" is-continue-on-correct="true" onCorrect="fullRrocket.animation='placeToLeft 2.5s linear'; this.sleep='2000';" show-check="false" bg-image="${args.backgroundImage}" visible="true" onEntry="this.overflowY='hidden'; this.overflowX='hidden'; this.background-color='transparent';" onInCorrect="lido-avatar.avatarAnimate='Fail'; this.sleep='2000';" after-drop="false">
118
+ <lido-container id="lido-container" objective="${args.correct1}, ${args.correct2}, ${args.correct3}" appendToDropOnCompletion="true" show-drop-border="false" tab-index="1" is-allow-only-correct="true" is-continue-on-correct="true" onCorrect="fullRrocket.animation='placeToLeft 3s linear'; this.sleep='2000';" show-check="false" bg-image="${args.backgroundImage}" visible="true" onEntry="this.overflowY='hidden'; this.overflowX='hidden'; this.background-color='transparent';" onInCorrect="lido-avatar.avatarAnimate='Fail'; this.sleep='2000';" after-drop="false">
119
119
  <lido-cell layout="pos" id="pos1" disable-edit="true" tab-index="2" value="pos2" height="305px" width="227px" x="landscape.1274px, portrait.541px" y="landscape.-60px, portrait.250px" aria-hidden="true" z="1" bg-color="transparent" visible="true" onEntry="this.animation='rightToPlace 2.5s linear';">
120
120
  <lido-avatar id="lido-avatar" disable-edit="true" visible="true" height="462px" width="356px" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp2/chimplecharacter.riv" alt-text="{chimpleCharacterRive}">
121
121
  </lido-avatar>
@@ -49,7 +49,7 @@ function getContainerXml(args) {
49
49
  onInCorrect="lido-avatar.avatarAnimate='Fail'; this.sleep='2000';"
50
50
  is-continue-on-correct="true" bg-color="transparent"
51
51
  bg-image="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/trace/Underwater.png"
52
- drop-action="infinite-drop">
52
+ drop-action="infinite-drop" is-allow-only-correct="true">
53
53
 
54
54
  <lido-cell layout="pos" id="pos1" disable-edit="true" value="pos2"
55
55
  height="landscape.500px, portrait.600px" width="landscape.350px, portrait.450px"
@@ -20,24 +20,25 @@ export const PhonicTractor = {
20
20
  },
21
21
  };
22
22
  function getContainerXml(args) {
23
+ let tabCounter = 1;
23
24
  const { text1, options = [], answers = [] } = args;
24
25
  const trolleyCells = answers
25
- .map((answer, index) => {
26
+ .map((answer) => {
26
27
  return `
27
28
  <!-- drop and trolley -->
28
29
  <lido-cell height="237px" width="200px" visible="true" bg-color="transparent" layout="col" >
29
- <lido-text id="t${index + 1}" type="drop" tab-index="${index + 2}" bg-color="transparent" height="132px" width="132px" value="${answer}" is-allow-only-one-drop="true" margin="-25px 0px 16px 0px" onEntry=" this.borderRadius='6px';">
30
+ <lido-text id="drop${tabCounter}" type="drop" tab-index="${tabCounter++}" bg-color="transparent" height="132px" width="132px" value="${answer}" is-allow-only-one-drop="true" margin="-25px 0px 16px 0px" onEntry=" this.borderRadius='6px';this.display='flex'; this.alignItems='center'; this.justifyContent='center';">
30
31
  </lido-text>
31
- <lido-image id="img${index + 4}" visible="true" disable-edit="true" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/phonic-tractor/phonictractor_tractor_holder.png" height="97px" width="220px" >
32
+ <lido-image id="img${tabCounter}" visible="true" disable-edit="true" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/phonic-tractor/phonictractor_tractor_holder.png" height="97px" width="220px" >
32
33
  </lido-image>
33
34
  </lido-cell>
34
35
  `;
35
36
  })
36
37
  .join('');
37
38
  const optionCells = options
38
- .map((option, index) => {
39
+ .map((option) => {
39
40
  return `
40
- <lido-text id="option${index + 1}" tab-index="${index + 5}" width="132px" height="132px" value="${option}" visible="true" string="${option}" font-family="'Baloo Bhai 2'" font-color="white" type="drag" font-size="landscape.96px, portrait.96px" bg-color="transparent" onEntry=" this.fontWeight='600';this.borderRadius='10px';" margin="landscape.150px 0px 112px 0px, portrait.0px 0px 0px 0px" border-image="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/phonic-tractor/box.png" onTouch="" show-speak-icon="true" >
41
+ <lido-text id="option${tabCounter}" tab-index="${tabCounter++}" width="132px" height="132px" value="${option}" visible="true" string="${option}" font-family="'Baloo Bhai 2'" font-color="white" type="drag" font-size="landscape.96px, portrait.96px" bg-color="transparent" onEntry=" this.fontWeight='600';this.borderRadius='10px';" margin="landscape.150px 0px 112px 0px, portrait.0px 0px 0px 0px" border-image="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/phonic-tractor/box.png" onTouch="" show-speak-icon="true" >
41
42
  </lido-text>
42
43
  `;
43
44
  })
@@ -63,7 +64,7 @@ function getContainerXml(args) {
63
64
  <!-- tractor -->
64
65
  <lido-cell layout="row" id="b1" visible="true" width="landscape.100%, portrait.850px" height="landscape.245px, portrait.30%" bg-color="transparent" onEntry="this.align-items='center'; this.animation='rightToPlace 3s linear'; this.justifyContent='center';" margin="landscape.215px 0px 0px 0px, portrait.0px 0px 0px 0px">
65
66
  <!-- tractor head -->
66
- <lido-image id="img2" visible="true" disable-edit="true" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/phonic-tractor/phonictractor_tractor_head.png" height="landscape.154px, portrait.154px" width="197px" onEntry="" margin="landscape.80px 0px 0px 0px, portrait.80px 0px 0px 0px" >
67
+ <lido-image id="img2" visible="true" disable-edit="true" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/phonic-tractor/phonictractor_tractor_head.png" height="landscape.154px, portrait.154px" width="197px" onEntry="" margin="landscape.86px -11px 0px 89px, portrait.80px 0px 0px 0px" >
67
68
  </lido-image>
68
69
  ${trolleyCells}
69
70
  </lido-cell>
@@ -13,12 +13,12 @@ const meta = {
13
13
  export default meta;
14
14
  export const quizLiteracy = {
15
15
  args: {
16
- option1: "n",
17
- option2: "a",
18
- option3: "f",
19
- option4: "b",
20
- text: "n",
21
- answers: "n",
16
+ option1: "Tiger",
17
+ option2: "Horse",
18
+ option3: "Sloth",
19
+ option4: "Whale",
20
+ text: "Tiger",
21
+ answers: "Tiger",
22
22
  image: "https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/template/audioIcon.png",
23
23
  },
24
24
  render: args => {
@@ -30,10 +30,10 @@ function getContainerXml(args) {
30
30
  let tabCounter = 1;
31
31
  return `<main>
32
32
  <lido-container id="lido-container" value="maincontainer" visible="true" objective="${args.answers}" bg-image="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/grid/Underwater.png" onEntry="" is-Continue-On-Correct="true" onInCorrect="lido-avatar.avatarAnimate='Fail'; this.sleep='2000';" onCorrect="lido-avatar.avatarAnimate='Success'; this.sleep='2000';">
33
- <lido-cell layout="pos" id="pos1" disable-edit="true" value="pos1" height="landscape.290px,portrait.476px" width="landscape.278px,portrait.467px" x="landscape.64%, portrait.24%" y="landscape.228px, portrait.66%" aria-hidden="true" z="2" bg-color="transparent" type="" visible="true" audio="" onTouch="" onCorrect="">
33
+ <lido-cell layout="pos" id="pos1" disable-edit="true" value="pos1" height="landscape.290px,portrait.364px" width="landscape.278px,portrait.386px" x="landscape.64%, portrait.63%" y="landscape.228px, portrait.-1%" aria-hidden="true" z="2" bg-color="transparent" type="" visible="true" audio="" onTouch="" onCorrect="">
34
34
  <lido-avatar id="lido-avatar" disable-edit="true" visible="true" height="100%" width="100%" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp1/chimplecharacter.riv" alt-text="{chimpleCharacterRive}" bg-color="transparent">
35
35
  </lido-avatar>
36
- <lido-image id="image1" disable-edit="true" value="image1" visible="true" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp1/Shadow.png" bg-color="transparent" width="165px" height="30px" x="landscape.54px,portrait.125px" y="landscape.239px,portrait.400px" alt-text="{shadowImgae}">
36
+ <lido-image id="image1" disable-edit="true" value="image1" visible="true" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp1/Shadow.png" bg-color="transparent" width="165px" height="30px" x="landscape.54px,portrait.109px" y="landscape.239px,portrait.314px" alt-text="{shadowImgae}">
37
37
  </lido-image>
38
38
  </lido-cell>
39
39
  <lido-cell layout="col" visible="true" bg-Color="transparent" width="90%" height="68%">
@@ -66,7 +66,7 @@ function getContainerXml(args) {
66
66
  </lido-cell>
67
67
 
68
68
 
69
- <lido-cell layout="flex" visible="true" margin="landscape.0px,portrait.-424px 0px 407px 0px" width="landscape.100%,portrait.77%" height="216px" bg-Color="transparent" onEntry="this.align-items='center'; this.justify-content='center'; this.gap='40px';">
69
+ <lido-cell layout="landscape.row,portrait.col" visible="true" margin="landscape.0px,portrait.0px 0px 0px 0px" width="landscape.140%,portrait.77%" height="216px" bg-Color="transparent" onEntry="this.align-items='center'; this.justify-content='center'; this.gap='40px';">
70
70
 
71
71
  <lido-text visible="true" audio="" show-speak-icon="true" id="drag${tabCounter}" tab-index="${tabCounter++}" font-size="140px" border-radius="12px" font-color="black" height="205px" width="auto" string="${args.option1}" value="${args.option1}" type="click" onEntry="this.font-weight='500';this.padding='0px 64px 0px 64px';">
72
72
  </lido-text>
@@ -8,10 +8,10 @@ const meta = {
8
8
  export default meta;
9
9
  export const quizLiteracyImageWord = {
10
10
  args: {
11
- option1: "Elephant",
12
- option2: "Fish",
13
- option3: "Egg",
14
- option4: "Nest",
11
+ option1: "Hippopotamus",
12
+ option2: "Elephant",
13
+ option3: "Grandmother",
14
+ option4: "Sunflower",
15
15
  answers: "Elephant",
16
16
  image: ['https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/LetterPair/Cat.png'],
17
17
  },
@@ -24,10 +24,10 @@ function getContainerXml(args) {
24
24
  let tabCounter = 1;
25
25
  return `<main>
26
26
  <lido-container id="lido-container" value="maincontainer" visible="true" objective="${args.answers}" bg-image="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/grid/Underwater.png" onEntry="" is-Continue-On-Correct="true" onInCorrect="lido-avatar.avatarAnimate='Fail'; this.sleep='2000';" onCorrect="lido-avatar.avatarAnimate='Success'; this.sleep='2000';">
27
- <lido-cell layout="pos" id="pos1" disable-edit="true" value="pos1" height="landscape.290px,portrait.476px" width="landscape.278px,portrait.467px" x="landscape.78%, portrait.24%" y="landscape.228px, portrait.66%" aria-hidden="true" z="2" bg-color="transparent" type="" visible="true" audio="" onTouch="" onCorrect="">
27
+ <lido-cell layout="pos" id="pos1" disable-edit="true" value="pos1" height="landscape.290px,portrait.434px" width="landscape.278px,portrait.437px" x="landscape.78%, portrait.24%" y="landscape.228px, portrait.75%" aria-hidden="true" z="2" bg-color="transparent" type="" visible="true" audio="" onTouch="" onCorrect="">
28
28
  <lido-avatar id="lido-avatar" disable-edit="true" visible="true" height="100%" width="100%" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp1/chimplecharacter.riv" alt-text="{chimpleCharacterRive}" bg-color="transparent">
29
29
  </lido-avatar>
30
- <lido-image id="image1" disable-edit="true" value="image1" visible="true" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp1/Shadow.png" bg-color="transparent" width="landscape.165px,portrait.200px" height="landscape.30px,portrait.48px" x="landscape.54px,portrait.125px" y="landscape.239px,portrait.400px" alt-text="{shadowImgae}">
30
+ <lido-image id="image1" disable-edit="true" value="image1" visible="true" src="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/temp1/Shadow.png" bg-color="transparent" width="landscape.165px,portrait.200px" height="landscape.30px,portrait.48px" x="landscape.54px,portrait.108px" y="landscape.239px,portrait.361px" alt-text="{shadowImgae}">
31
31
  </lido-image>
32
32
  </lido-cell>
33
33
  <lido-cell layout="col" visible="true" bg-Color="transparent" width="90%" height="68%">
@@ -49,7 +49,7 @@ function getContainerXml(args) {
49
49
  </lido-cell>
50
50
 
51
51
 
52
- <lido-cell layout="flex" visible="true" margin="landscape.0px,portrait.-34px 0px 364px" width="landscape.67%,portrait.100%" height="216px" bg-Color="transparent" onEntry="this.align-items='center'; this.justify-content='center'; this.gap='40px';">
52
+ <lido-cell layout="landscape.wrap,portrait.col" visible="true" margin="landscape.0px,portrait.214px 0px 271px" width="landscape.67%,portrait.100%" height="216px" bg-Color="transparent" onEntry=" this.gridTemplateColumns = 'repeat(2, 1fr)'; this.gridTemplateRows = 'repeat(2, 1fr)';this.align-items='center'; this.justify-content='center'; this.gap='40px';">
53
53
 
54
54
  <lido-text visible="true" audio="" show-speak-icon="true" id="drag${tabCounter}" tab-index="${tabCounter++}" font-size="80px" border-radius="12px" font-color="black" height="148px" width="auto" string="${args.option1}" value="${args.option1}" type="click" onEntry="this.font-weight='500';this.padding='0px 64px 0px 64px';">
55
55
  </lido-text>
@@ -94,6 +94,8 @@ export const executeActions = async (actionsString, thisElement, element) => {
94
94
  else {
95
95
  dragElement.style.transform = `translate(${scaledLeft}px, ${scaledTop}px)`;
96
96
  }
97
+ if (dragElement.getAttribute("hasDummy") === "true")
98
+ return;
97
99
  afterDropDragHandling(dragElement, dropElement);
98
100
  break;
99
101
  }
@@ -187,15 +189,13 @@ const afterDropDragHandling = (dragElement, dropElement) => {
187
189
  dragElement.style.transition = '';
188
190
  let dummyElement = document.createElement('div');
189
191
  if (isInfinite) {
190
- const allDummy = container.querySelectorAll(`[id=${dragElement.id}]`);
191
- if (allDummy.length === 1) {
192
- dummyElement = cloneElementWithComputedStyles(dragElement);
193
- dummyElement.classList.remove('dropped');
194
- dummyElement.removeAttribute('drop-to');
195
- dummyElement.removeAttribute('drop-time');
196
- dragElement.style.width = dropElement.style.width;
197
- dragElement.style.height = dropElement.style.height;
198
- }
192
+ dummyElement = cloneElementWithComputedStyles(dragElement);
193
+ dummyElement.classList.remove('dropped');
194
+ dummyElement.removeAttribute('drop-to');
195
+ dummyElement.removeAttribute('drop-time');
196
+ dragElement.style.width = dropElement.style.width;
197
+ dragElement.style.height = dropElement.style.height;
198
+ dragElement.setAttribute("hasDummy", "true");
199
199
  }
200
200
  dummyElement.setAttribute('id', dragElement.getAttribute('id'));
201
201
  dragElement.replaceWith(dummyElement);
@@ -234,7 +234,6 @@ const afterDropDragHandling = (dragElement, dropElement) => {
234
234
  }
235
235
  };
236
236
  function cloneElementWithComputedStyles(originalEl) {
237
- console.log(originalEl.outerHTML);
238
237
  let clone = document.createElement('div');
239
238
  clone.innerHTML = originalEl.outerHTML;
240
239
  clone = clone.firstChild;
@@ -376,12 +376,13 @@ export function handleResetDragElement(dragElement, dropElement, dropHasDrag, se
376
376
  dragElement.classList.remove('dropped');
377
377
  const container = document.getElementById(LidoContainer);
378
378
  const cloneArray = container.querySelectorAll(`#${dragElement.id}`);
379
- const cloneDragElement = Array.from(cloneArray).find(item => dragElement !== item);
379
+ const cloneDragElement = Array.from(cloneArray).find(item => dragElement !== item && !item.classList.contains('dropped'));
380
380
  dragElement.style.transition = 'transform 0.5s ease';
381
381
  if (cloneDragElement) {
382
382
  animateDragToTarget(dragElement, cloneDragElement, container);
383
383
  setTimeout(() => {
384
384
  if (container.getAttribute('drop-action') === DropAction.InfiniteDrop) {
385
+ dragElement.removeAttribute('hasDummy');
385
386
  dragElement.style.width = cloneDragElement.style.width;
386
387
  dragElement.style.height = cloneDragElement.style.height;
387
388
  }
@@ -399,7 +400,6 @@ export function handleResetDragElement(dragElement, dropElement, dropHasDrag, se
399
400
  }
400
401
  let currentDrop = dragToDropMap.get(dragElement);
401
402
  if (currentDrop) {
402
- dragElement.removeAttribute(DropToAttr);
403
403
  dragToDropMap.delete(dragElement);
404
404
  updateDropBorder(currentDrop);
405
405
  if (((_a = currentDrop === null || currentDrop === void 0 ? void 0 : currentDrop.getAttribute('drop-attr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Stretch) {
@@ -427,19 +427,13 @@ export function handleResetDragElement(dragElement, dropElement, dropHasDrag, se
427
427
  }
428
428
  if (dragSelectedData) {
429
429
  let dragSelected = JSON.parse(dragSelectedData);
430
- let dropSelected = JSON.parse(dropSelectedData);
431
- for (const key in dragSelected) {
432
- if (dragSelected[key].includes(dragElement['value'])) {
433
- for (const key in dropSelected) {
434
- if (dropSelected[key].includes(dragElement.id)) {
435
- delete dropSelected[key];
436
- }
437
- }
438
- delete dragSelected[key];
439
- }
430
+ const dragPreDropElement = container.querySelector(`#${dragElement.getAttribute(DropToAttr)}`);
431
+ if (dragPreDropElement) {
432
+ delete dragSelected[dragPreDropElement.getAttribute('tab-index')];
440
433
  }
441
434
  localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragSelected));
442
- // localStorage.setItem(DragMapKey, JSON.stringify(dropSelected));
435
+ dragElement.removeAttribute(DropToAttr);
436
+ updateDropBorder(currentDrop);
443
437
  }
444
438
  const allElements = document.querySelectorAll("[type='drop']");
445
439
  allElements.forEach(otherElement => {
@@ -493,7 +487,7 @@ export async function onElementDropComplete(dragElement, dropElement) {
493
487
  handleResetDragElement(dragElement, dropElement, dropHasDrag, selectedValueData, dragSelectedData, dropSelectedData);
494
488
  return;
495
489
  }
496
- const isCorrect = dropElement['value'].includes(dragElement['value']);
490
+ const isCorrect = dropElement.getAttribute('value').toLowerCase().includes(dragElement.getAttribute('value').toLowerCase());
497
491
  if (!isCorrect) {
498
492
  const localStorageKey = `${LidoContainer}_dropData`;
499
493
  dragElement.style.transition = 'transform 0.5s ease';
@@ -531,7 +525,7 @@ export async function onElementDropComplete(dragElement, dropElement) {
531
525
  div.classList.add('after-drop-popup-container');
532
526
  const hasType = dragElement.nextElementSibling;
533
527
  // Remove from old parents
534
- if (hasType && hasType.getAttribute("type") === 'drag') {
528
+ if (hasType && hasType.getAttribute('type') === 'drag') {
535
529
  dragElement.remove();
536
530
  dropElement.remove();
537
531
  }
@@ -576,7 +570,6 @@ export async function onElementDropComplete(dragElement, dropElement) {
576
570
  const dragWidth = dragElement.offsetWidth;
577
571
  dropElement.style.width = `${dragWidth}px`;
578
572
  }
579
- dragElement.classList.add('dropped');
580
573
  if (!(((_b = dropElement.getAttribute('dropAttr')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === DropMode.Diagonal) && (dropElement.getAttribute('minDrops') === '1' || !dropElement.getAttribute('minDrops'))) {
581
574
  const isisFull = Object.values(dropHasDrag).find(item => document.getElementById(item.drop) === dropElement);
582
575
  if (isisFull) {
@@ -589,12 +582,13 @@ export async function onElementDropComplete(dragElement, dropElement) {
589
582
  if (dragSelectedData) {
590
583
  let dragSelected = JSON.parse(dragSelectedData);
591
584
  for (const key in dragSelected) {
592
- if (dragSelected[key].includes(dragElement['value'])) {
585
+ if (dragSelected[key].includes(dragElement['value']) && dragElement.classList.contains('dropped')) {
593
586
  delete dragSelected[key];
594
587
  }
595
588
  }
596
589
  localStorage.setItem(DragSelectedMapKey, JSON.stringify(dragSelected));
597
590
  }
591
+ dragElement.classList.add('dropped');
598
592
  // Check for overlaps and highlight only the most overlapping element
599
593
  if (dropElement && !((_c = dropHasDrag[dropTabIndex]) === null || _c === void 0 ? void 0 : _c.isFull)) {
600
594
  let mostOverlappedElement = findMostoverlappedElement(dragElement, 'drag');
@@ -694,7 +688,7 @@ export async function onElementDropComplete(dragElement, dropElement) {
694
688
  allDropElements.forEach(el => updateDropBorder(el));
695
689
  }
696
690
  export function updateDropBorder(element) {
697
- if (!element.classList.contains('drop-element'))
691
+ if (!element || !element.classList.contains('drop-element'))
698
692
  return;
699
693
  const container = document.getElementById(LidoContainer);
700
694
  if (!container)
@@ -824,16 +818,22 @@ export const appendingDragElementsInDrop = () => {
824
818
  const isAllowOnlyCorrect = container.getAttribute('is-allow-only-correct') === 'true';
825
819
  if (isAllowOnlyCorrect === true) {
826
820
  if (drop['value'] === drag['value']) {
821
+ // Get original dimensions of the drag element
822
+ const originalWidth = drag.offsetWidth;
823
+ const originalHeight = drag.offsetHeight;
827
824
  drag.style.transform = 'translate(0,0)';
828
825
  drop.appendChild(drag);
829
- // drag.style.boxShadow = 'none';
826
+ resizeDragAndDropElementsForRocket(drag, drop, originalWidth, originalHeight);
830
827
  }
831
828
  }
832
829
  else {
833
830
  if (drop['value'].includes(drag['value'])) {
831
+ // Get original dimensions of the drag element
832
+ const originalWidth = drag.offsetWidth;
833
+ const originalHeight = drag.offsetHeight;
834
834
  drag.style.transform = 'translate(0,0)';
835
835
  drop.appendChild(drag);
836
- // drag.style.boxShadow = 'none';
836
+ resizeDragAndDropElementsForRocket(drag, drop, originalWidth, originalHeight);
837
837
  }
838
838
  }
839
839
  });
@@ -857,3 +857,29 @@ export const reduceSizeToOriginal = () => {
857
857
  }
858
858
  });
859
859
  };
860
+ export const resizeDragAndDropElementsForRocket = (drag, drop, width, height) => {
861
+ const container = document.getElementById(LidoContainer);
862
+ if (!container)
863
+ return;
864
+ const Rocket = document.getElementById("fullRrocket");
865
+ if (!Rocket)
866
+ return;
867
+ // Get the scale of the container
868
+ const containerScale = getElementScale(container);
869
+ // Hide child image inside lido-image
870
+ const childImage = drop.querySelector('img');
871
+ if (childImage) {
872
+ // Set the opacity to 1 for the drop element
873
+ drop.style.opacity = '1';
874
+ // Hide child image inside lido-image
875
+ childImage.remove(); // remove the child image
876
+ // Ensure dropped lido-text remains visible
877
+ const childText = drop.querySelector('lido-text');
878
+ if (childText) {
879
+ childText.style.opacity = '1';
880
+ }
881
+ // Ensure dropped text retains its original size
882
+ drag.style.width = `${width / containerScale}px`;
883
+ drag.style.height = `${height}px`;
884
+ }
885
+ };
@@ -1 +1 @@
1
- export { f as format, g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-06985aa0.js';
1
+ export { f as format, g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-c1df8ab6.js';