lido-player 0.0.2-alpha-55-dev → 0.0.2-alpha-57-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 (96) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/lido-avatar_22.cjs.entry.js +138 -22
  3. package/dist/cjs/lido-player.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{utils-4b44610b.js → utils-a61cfc6b.js} +18 -10
  6. package/dist/collection/components/home/lido-home.js +35 -6
  7. package/dist/collection/components/mathMatrix/lido-math-matrix.js +8 -6
  8. package/dist/collection/components/shape/lido-shape.css +90 -0
  9. package/dist/collection/components/shape/lido-shape.js +41 -6
  10. package/dist/collection/components/slideFill/lido-slide-fill.js +1 -1
  11. package/dist/collection/components/text/lido-text.js +26 -1
  12. package/dist/collection/components/trace/lido-trace.js +57 -4
  13. package/dist/collection/components/wrap/lido-wrap.js +1 -1
  14. package/dist/collection/stories/Templates/balancing/balancing.stories.js +1 -1
  15. package/dist/collection/stories/Templates/balloonPop/balloonPop.stories.js +2 -2
  16. package/dist/collection/stories/Templates/blender/blender.stories.js +3 -3
  17. package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +6 -4
  18. package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +38 -32
  19. package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +2 -2
  20. package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +68 -60
  21. package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +6 -5
  22. package/dist/collection/stories/Templates/quizMaths/quizMaths.stories.js +991 -0
  23. package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +8 -8
  24. package/dist/collection/stories/Templates/tenBox/tenBox.stories.js +144 -0
  25. package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +8 -4
  26. package/dist/collection/utils/constants.js +2 -0
  27. package/dist/collection/utils/utils.js +5 -1
  28. package/dist/collection/utils/utilsHandlers/clickHandler.js +1 -1
  29. package/dist/collection/utils/utilsHandlers/dragDropHandler.js +4 -1
  30. package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +4 -5
  31. package/dist/components/index.js +1 -1
  32. package/dist/components/lido-avatar.js +1 -1
  33. package/dist/components/lido-balance.js +1 -1
  34. package/dist/components/lido-calculator.js +1 -1
  35. package/dist/components/lido-canvas.js +1 -1
  36. package/dist/components/lido-cell.js +1 -1
  37. package/dist/components/lido-col.js +1 -1
  38. package/dist/components/lido-container.js +1 -1
  39. package/dist/components/lido-flash-card.js +1 -1
  40. package/dist/components/lido-float.js +1 -1
  41. package/dist/components/lido-home.js +1 -1
  42. package/dist/components/lido-image.js +1 -1
  43. package/dist/components/lido-keyboard.js +1 -1
  44. package/dist/components/lido-math-matrix.js +1 -1
  45. package/dist/components/lido-pos.js +1 -1
  46. package/dist/components/lido-random.js +1 -1
  47. package/dist/components/lido-root.js +22 -22
  48. package/dist/components/lido-row.js +1 -1
  49. package/dist/components/lido-shape.js +1 -1
  50. package/dist/components/lido-slide-fill.js +1 -1
  51. package/dist/components/lido-text.js +1 -1
  52. package/dist/components/lido-trace.js +1 -1
  53. package/dist/components/lido-wrap.js +1 -1
  54. package/dist/components/{p-36c2e21a.js → p-0712a27e.js} +17 -11
  55. package/dist/components/{p-2c518dbe.js → p-0a41b2f8.js} +1 -1
  56. package/dist/components/{p-ca8aea4b.js → p-17f84b2f.js} +1 -1
  57. package/dist/components/{p-590ce2c9.js → p-21852d55.js} +1 -1
  58. package/dist/components/{p-de2193c5.js → p-2829c82c.js} +1 -1
  59. package/dist/components/{p-bc5202db.js → p-330caab8.js} +2 -2
  60. package/dist/components/{p-9acf0fcc.js → p-480f708a.js} +1 -1
  61. package/dist/components/{p-3fc01453.js → p-4d332eab.js} +1 -1
  62. package/dist/components/{p-2e023f67.js → p-4e041807.js} +2 -2
  63. package/dist/components/{p-0be6b5d5.js → p-7ab0a273.js} +26 -2
  64. package/dist/components/{p-67a24ad4.js → p-882b291d.js} +2 -2
  65. package/dist/components/{p-43d79c61.js → p-9104d427.js} +1 -1
  66. package/dist/components/{p-b847f269.js → p-b9875116.js} +57 -4
  67. package/dist/components/{p-73b2bd74.js → p-c4739621.js} +3 -3
  68. package/dist/components/p-cca36777.js +128 -0
  69. package/dist/components/{p-5078599e.js → p-d1b5079b.js} +1 -1
  70. package/dist/components/{p-b0dbee97.js → p-e1ba0c44.js} +38 -26
  71. package/dist/components/{p-72d6a594.js → p-eab0ebb7.js} +1 -1
  72. package/dist/components/{p-b095de27.js → p-f2b53e8e.js} +2 -2
  73. package/dist/components/{p-c296051d.js → p-f3bc4577.js} +1 -1
  74. package/dist/components/{p-c69ef266.js → p-ff801ba1.js} +1 -1
  75. package/dist/components/{p-e534ea52.js → p-ffc40642.js} +7 -5
  76. package/dist/esm/index.js +1 -1
  77. package/dist/esm/lido-avatar_22.entry.js +138 -22
  78. package/dist/esm/lido-player.js +1 -1
  79. package/dist/esm/loader.js +1 -1
  80. package/dist/esm/{utils-ae1eb036.js → utils-7ed76799.js} +17 -11
  81. package/dist/lido-player/index.esm.js +1 -1
  82. package/dist/lido-player/lido-player.esm.js +1 -1
  83. package/dist/lido-player/{p-a632e2ce.js → p-17d93181.js} +2 -2
  84. package/dist/lido-player/p-fa9dfdf8.entry.js +1 -0
  85. package/dist/types/components/home/lido-home.d.ts +3 -0
  86. package/dist/types/components/shape/lido-shape.d.ts +8 -2
  87. package/dist/types/components/text/lido-text.d.ts +1 -0
  88. package/dist/types/components/trace/lido-trace.d.ts +2 -1
  89. package/dist/types/components.d.ts +2 -0
  90. package/dist/types/stories/Templates/fillAnswer/fill-answer.stories.d.ts +1 -1
  91. package/dist/types/stories/Templates/quizMaths/quizMaths.stories.d.ts +16 -0
  92. package/dist/types/stories/Templates/tenBox/tenBox.stories.d.ts +4 -0
  93. package/dist/types/utils/constants.d.ts +2 -0
  94. package/package.json +1 -1
  95. package/dist/components/p-f8c00485.js +0 -100
  96. package/dist/lido-player/p-f1b879f6.entry.js +0 -1
@@ -18,6 +18,8 @@ const DropLength = 'dropLength';
18
18
  const DropToAttr = 'drop-to';
19
19
  const DropTimeAttr = 'drop-time';
20
20
  const LidoContainer = 'lido-container';
21
+ const LIDO_COMMON_AUDIO_PATH = '__LIDO_COMMON_AUDIO_PATH__';
22
+ const LIDO_COMMON_AUDIO_READY_EVENT = 'lidoCommonAudioPathReady';
21
23
  exports.TraceMode = void 0;
22
24
  (function (TraceMode) {
23
25
  TraceMode["NoFlow"] = "noFlow";
@@ -175,7 +177,7 @@ function updateBalanceOnDrop(dragElement, dropElement) {
175
177
  }
176
178
  function calculateValue(elements, operation) {
177
179
  if (elements.length === 0)
178
- return 0;
180
+ return null;
179
181
  if (operation === "count") {
180
182
  return elements.length;
181
183
  }
@@ -207,18 +209,15 @@ function calculateValue(elements, operation) {
207
209
  }
208
210
  }
209
211
  function balanceResult(container, objectiveString) {
210
- var _a, _b, _c, _d, _e, _f;
211
212
  const additionalCheck = container.getAttribute('equationCheck');
212
213
  if (!additionalCheck)
213
214
  return false;
214
215
  const balanceEl = document.querySelector('lido-balance');
215
216
  if (!balanceEl)
216
217
  return false;
217
- const leftVal = Number((_c = (_a = balanceEl.leftVal) !== null && _a !== void 0 ? _a : (_b = balanceEl.dataset) === null || _b === void 0 ? void 0 : _b.leftVal) !== null && _c !== void 0 ? _c : 0);
218
- const rightVal = Number((_f = (_d = balanceEl.rightVal) !== null && _d !== void 0 ? _d : (_e = balanceEl.dataset) === null || _e === void 0 ? void 0 : _e.rightVal) !== null && _f !== void 0 ? _f : 0);
219
- const hasLeft = !isNaN(leftVal);
220
- const hasRight = !isNaN(rightVal);
221
- if (!hasLeft || !hasRight) {
218
+ const leftVal = balanceEl.leftVal;
219
+ const rightVal = balanceEl.rightVal;
220
+ if (leftVal == null || rightVal == null) {
222
221
  return false;
223
222
  }
224
223
  const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
@@ -553,9 +552,12 @@ function enableDraggingWithScaling(element) {
553
552
  otherElement.style.border = ''; // Reset border
554
553
  otherElement.style.backgroundColor = 'transparent'; // Reset background color
555
554
  }
556
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
555
+ else if (otherElement.tagName.toLowerCase() === 'lido-image') {
557
556
  otherElement.style.opacity = '0';
558
557
  }
558
+ else {
559
+ otherElement.style.opacity = '1';
560
+ }
559
561
  }
560
562
  }
561
563
  else {
@@ -3151,7 +3153,7 @@ function onTouchListenerForOnTouch(element) {
3151
3153
  return;
3152
3154
  const container = document.getElementById('lido-container');
3153
3155
  // const container = element.closest('lido-container') as HTMLElement;
3154
- if (container && container.getAttribute('disableSpeak') === 'true') {
3156
+ if (container && container.getAttribute('disable-speak') === 'true') {
3155
3157
  return;
3156
3158
  }
3157
3159
  // if (element.closest('[disableSpeak="true"]')) {
@@ -69222,6 +69224,7 @@ const validateObjectiveStatus = async () => {
69222
69224
  if (attach === 'true') {
69223
69225
  appendingDragElementsInDrop();
69224
69226
  }
69227
+ storingEachActivityScore(true);
69225
69228
  await executeActions(onCorrect, container);
69226
69229
  }
69227
69230
  if (container.getAttribute('dropAttr') === 'EnableAnimation') {
@@ -69237,12 +69240,12 @@ const validateObjectiveStatus = async () => {
69237
69240
  else {
69238
69241
  const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
69239
69242
  if (!isContinueOnCorrect) {
69240
- triggerNextContainer();
69241
69243
  await calculateScore();
69242
69244
  triggerNextContainer();
69243
69245
  }
69244
69246
  else {
69245
69247
  const onInCorrect = container.getAttribute('onInCorrect');
69248
+ storingEachActivityScore(false);
69246
69249
  await executeActions(onInCorrect, container);
69247
69250
  }
69248
69251
  }
@@ -69265,6 +69268,9 @@ function convertUrlToRelative(url) {
69265
69268
  if ((url === null || url === void 0 ? void 0 : url.startsWith('http')) || (url === null || url === void 0 ? void 0 : url.startsWith('blob')) || (url === null || url === void 0 ? void 0 : url.startsWith('data'))) {
69266
69269
  return url;
69267
69270
  }
69271
+ if (url.startsWith('/Lido-CommonAudios/')) {
69272
+ return url;
69273
+ }
69268
69274
  if (baseUrl) {
69269
69275
  const newUrl = url.startsWith('/') ? url.slice(1) : url;
69270
69276
  if (newUrl.startsWith(baseUrl.replace(/^\/+|\/+$/g, '')))
@@ -69899,6 +69905,8 @@ const updateCalculatorAnswer = (el) => {
69899
69905
 
69900
69906
  exports.ActivityScoreKey = ActivityScoreKey;
69901
69907
  exports.AudioPlayer = AudioPlayer;
69908
+ exports.LIDO_COMMON_AUDIO_PATH = LIDO_COMMON_AUDIO_PATH;
69909
+ exports.LIDO_COMMON_AUDIO_READY_EVENT = LIDO_COMMON_AUDIO_READY_EVENT;
69902
69910
  exports.LidoContainer = LidoContainer;
69903
69911
  exports.NextContainerKey = NextContainerKey;
69904
69912
  exports.PrevContainerKey = PrevContainerKey;
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from "@stencil/core";
2
- import { SelectedValuesKey, NextContainerKey, PrevContainerKey, LidoContainer, exitUrl, prevUrl, nextUrl, speakUrl, ActivityScoreKey, } from "../../utils/constants";
2
+ import { SelectedValuesKey, NextContainerKey, PrevContainerKey, LidoContainer, exitUrl, prevUrl, nextUrl, speakUrl, ActivityScoreKey, LIDO_COMMON_AUDIO_PATH } from "../../utils/constants";
3
3
  import { dispatchActivityChangeEvent, dispatchGameCompletedEvent, dispatchGameExitEvent } from "../../utils/customEvents";
4
4
  import { calculateScale, getCancelBtnPopup, setCancelBtnPopup, executeActions, triggerPrevcontainer, convertUrlToRelative, triggerNextContainer, matchStringPattern } from "../../utils/utils";
5
5
  import { AudioPlayer } from "../../utils/audioPlayer";
@@ -31,7 +31,6 @@ export class LidoHome {
31
31
  if (index != undefined && index < this.containers.length) {
32
32
  // Move to the next container
33
33
  this.currentContainerIndex = index;
34
- console.log('container index ; ', this.currentContainerIndex);
35
34
  // window.dispatchEvent(new CustomEvent('activityChange', { detail: { index: this.currentContainerIndex } }));
36
35
  dispatchActivityChangeEvent(this.currentContainerIndex);
37
36
  }
@@ -109,6 +108,7 @@ export class LidoHome {
109
108
  }
110
109
  }
111
110
  };
111
+ this.commonAudioPath = undefined;
112
112
  this.showNav = true;
113
113
  this.activeContainerIndexes = [];
114
114
  this.locale = '';
@@ -140,6 +140,9 @@ export class LidoHome {
140
140
  // Trigger re-render of containers to update <lido-text> dynamically
141
141
  this.containers = [...this.containers];
142
142
  }
143
+ onCommonAudioPathChange(path) {
144
+ this.publishCommonAudioPath(path);
145
+ }
143
146
  /**
144
147
  * Lifecycle method that runs before the component is loaded. It sets up event listeners for transitioning
145
148
  * between containers and parses the XML data into containers.
@@ -175,6 +178,7 @@ export class LidoHome {
175
178
  });
176
179
  }
177
180
  componentDidLoad() {
181
+ this.publishCommonAudioPath(this.commonAudioPath);
178
182
  setTimeout(() => {
179
183
  this.showDotsandbtn = true;
180
184
  }, 10);
@@ -190,6 +194,15 @@ export class LidoHome {
190
194
  this.scaleNavbarContainer(); // re-scale navbar on resize
191
195
  });
192
196
  }
197
+ publishCommonAudioPath(path) {
198
+ if (!path)
199
+ return;
200
+ const cleanPath = path.replace(/\/+$/, "");
201
+ window[LIDO_COMMON_AUDIO_PATH] = cleanPath;
202
+ console.log("[LidoHome] Published common audio path:", cleanPath);
203
+ // Dispatch a global event so LidoText knows the path is ready
204
+ window.dispatchEvent(new Event('lidoCommonAudioPathReady'));
205
+ }
193
206
  async handleIcons() {
194
207
  var _a;
195
208
  const checkUrl = async (url, containerUrl, fallback) => {
@@ -341,20 +354,16 @@ export class LidoHome {
341
354
  parseContainers(rootElement) {
342
355
  const containerElements = rootElement.querySelectorAll('lido-container');
343
356
  const containers = Array.from(containerElements).map((container, index) => {
344
- console.log("nammadhaaaaaaa", this.activeContainerIndexes.length && !this.activeContainerIndexes.includes(index));
345
357
  if (this.activeContainerIndexes.length && !this.activeContainerIndexes.includes(index))
346
358
  return;
347
359
  // Return a factory function that generates a fresh JSX node each time
348
360
  return () => this.parseElement(container);
349
361
  }).filter(Boolean); // Remove any undefined entries
350
362
  this.containers = containers;
351
- console.log("container :::", containers);
352
363
  }
353
364
  areAllDropsFilled() {
354
365
  const drops = Array.from(document.querySelectorAll('[type="drop"]'));
355
366
  const drags = Array.from(document.querySelectorAll('[type="drag"]')).filter(drag => drag.getAttribute('drop-to'));
356
- console.log('drops', drops);
357
- console.log('drags', drags);
358
367
  return drops.every(drop => {
359
368
  const dropId = drop.id;
360
369
  return drags.some(drag => drag.getAttribute('drop-to') === dropId);
@@ -473,6 +482,23 @@ export class LidoHome {
473
482
  }
474
483
  static get properties() {
475
484
  return {
485
+ "commonAudioPath": {
486
+ "type": "string",
487
+ "mutable": false,
488
+ "complexType": {
489
+ "original": "string",
490
+ "resolved": "string",
491
+ "references": {}
492
+ },
493
+ "required": false,
494
+ "optional": true,
495
+ "docs": {
496
+ "tags": [],
497
+ "text": ""
498
+ },
499
+ "attribute": "common-audio-path",
500
+ "reflect": false
501
+ },
476
502
  "showNav": {
477
503
  "type": "boolean",
478
504
  "mutable": false,
@@ -734,6 +760,9 @@ export class LidoHome {
734
760
  return [{
735
761
  "propName": "locale",
736
762
  "methodName": "onLangChange"
763
+ }, {
764
+ "propName": "commonAudioPath",
765
+ "methodName": "onCommonAudioPathChange"
737
766
  }, {
738
767
  "propName": "xmlData",
739
768
  "methodName": "onXmlDataChange"
@@ -2,8 +2,8 @@ import { Host, h } from "@stencil/core";
2
2
  import { convertUrlToRelative, initEventsForElement, parseProp, validateObjectiveStatus } from "../../utils/utils";
3
3
  export class LidoMathMatrix {
4
4
  constructor() {
5
- this.rows = "7";
6
- this.cols = "5";
5
+ this.rows = "10";
6
+ this.cols = "10";
7
7
  this.defualtFill = 0;
8
8
  this.leftIndex = false;
9
9
  this.topIndex = false;
@@ -80,8 +80,10 @@ export class LidoMathMatrix {
80
80
  const fristElement = this.el.querySelector('.slot');
81
81
  if (!slotElement.length || !fristElement)
82
82
  return;
83
- const slotMaxValues = fristElement.offsetWidth < fristElement.offsetHeight ? fristElement.offsetWidth : fristElement.offsetHeight;
83
+ const elementSize = Number(this.rows) < Number(this.cols) ? this.el.offsetHeight : this.el.offsetWidth;
84
+ const numberOfSlots = Number(this.rows) > Number(this.cols) ? Number(this.rows) : Number(this.cols);
84
85
  const slotParent = this.el.querySelectorAll('.slot-parent');
86
+ const slotMaxValues = elementSize / numberOfSlots;
85
87
  slotParent.forEach(parent => {
86
88
  parent.style.width = `${slotMaxValues}px`;
87
89
  Array.from(parent.children).forEach(el => {
@@ -185,7 +187,7 @@ export class LidoMathMatrix {
185
187
  render() {
186
188
  let slotNumber = 1;
187
189
  const slotData = this.getSlotData();
188
- return (h(Host, { key: '8232965fc3fb0b298233d21d7f50412508dc2256', class: "math-matrix", style: {
190
+ return (h(Host, { key: 'bbd76954f0a4b67cd89dd10e3c26ce4f7e7712bd', class: "math-matrix", style: {
189
191
  height: this.style.height,
190
192
  width: this.style.width,
191
193
  z: this.style.z,
@@ -230,7 +232,7 @@ export class LidoMathMatrix {
230
232
  },
231
233
  "attribute": "rows",
232
234
  "reflect": false,
233
- "defaultValue": "\"7\""
235
+ "defaultValue": "\"10\""
234
236
  },
235
237
  "cols": {
236
238
  "type": "string",
@@ -248,7 +250,7 @@ export class LidoMathMatrix {
248
250
  },
249
251
  "attribute": "cols",
250
252
  "reflect": false,
251
- "defaultValue": "\"5\""
253
+ "defaultValue": "\"10\""
252
254
  },
253
255
  "defualtFill": {
254
256
  "type": "number",
@@ -4,6 +4,8 @@
4
4
  left: var(--x);
5
5
  display: var(--display);
6
6
  z-index: var(--z);
7
+ justify-content: center;
8
+ align-items: center;
7
9
  }
8
10
 
9
11
  .lido-rectangle {
@@ -53,6 +55,52 @@
53
55
  transform: skew(20deg);
54
56
  }
55
57
 
58
+ .lido-trapezoid {
59
+ width: var(--trapezoidWidth);
60
+ height: var(--trapezoidHeight);
61
+ background-color: var(--bgColor);
62
+ clip-path: polygon(
63
+ 20% 0%, /* top left */
64
+ 80% 0%, /* top right */
65
+ 100% 100%,/* bottom right */
66
+ 0% 100% /* bottom left */
67
+ );
68
+ }
69
+
70
+ .lido-hexagon {
71
+ width: var(--hexagonWidth);
72
+ height: var(--hexagonHeight);
73
+ background-color: var(--bgColor);
74
+ clip-path: polygon(
75
+ 25% 0%, /* top left */
76
+ 75% 0%, /* top right */
77
+ 100% 50%, /* right */
78
+ 75% 100%, /* bottom right */
79
+ 25% 100%, /* bottom left */
80
+ 0% 50% /* left */
81
+ );
82
+ }
83
+
84
+ .lido-cone {
85
+ width: var(--coneWidth);
86
+ height: var(--coneHeight);
87
+ background-color: var(--bgColor);
88
+ clip-path: polygon(
89
+ /* Curved top (approximated arc) */
90
+ 15% 10%,
91
+ 25% 4%,
92
+ 35% 1%,
93
+ 50% 0%,
94
+ 65% 1%,
95
+ 75% 4%,
96
+ 85% 10%,
97
+
98
+ /* Bottom tip */
99
+ 50% 100%
100
+ );
101
+ }
102
+
103
+
56
104
  .lido-star {
57
105
  width: var(--starWidth);
58
106
  height: var(--starHeight);
@@ -94,3 +142,45 @@
94
142
  border-image: radial-gradient(var(--heartBgColor) 69%, #0000 70%) 84.5%/50%;
95
143
  clip-path: polygon(-41% 0, 50% 91%, 141% 0);
96
144
  }
145
+
146
+ /* cube */
147
+
148
+ .cube {
149
+ width: 100%;
150
+ height: 100%;
151
+ position: relative;
152
+ transform-style: preserve-3d;
153
+ /* animation: spin 6s infinite linear; */
154
+ transform: rotateX(-20deg) rotateY(45deg);
155
+ }
156
+
157
+ /* all faces */
158
+ .face {
159
+ position: absolute;
160
+ width: var(--face-width,150px);
161
+ height: var(--face-width,150px);
162
+ background: var(--face-bg-color,150px); /* cube color */
163
+ box-shadow: inset -20px -20px 40px rgba(0,0,0,0.3);
164
+ }
165
+
166
+ /* move faces into a cube shape */
167
+ .front { transform: rotateY( 0deg) translateZ(var(--face-translate, 75px)); }
168
+ .back { transform: rotateY(180deg) translateZ(var(--face-translate, 75px)); }
169
+ .right { transform: rotateY( 90deg) translateZ(var(--face-translate, 75px)); }
170
+ .left { transform: rotateY(-90deg) translateZ(var(--face-translate, 75px)); }
171
+ .top { transform: rotateX( 90deg) translateZ(var(--face-translate, 75px)); }
172
+ .bottom { transform: rotateX(-90deg) translateZ(var(--face-translate, 75px)); }
173
+
174
+
175
+
176
+ /* Cylinder */
177
+ .lido-cylinder {
178
+ /* whatever values/units you want */
179
+ width: var(--width);
180
+ height: var(--height);
181
+ border-radius: 100% / 80px;
182
+ background:
183
+ radial-gradient(50% 40px at 50% 40px, #0003 99.99%, #0000 0),
184
+ radial-gradient(50% 40px at 50% calc(100% - 40px), #fff3 99.99%, #0000 0),
185
+ red;
186
+ }
@@ -1,5 +1,5 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { initEventsForElement, setVisibilityWithDelay } from "../../utils/utils";
2
+ import { initEventsForElement, setVisibilityWithDelay, parseProp } from "../../utils/utils";
3
3
  /**
4
4
  * @component LidoShape
5
5
  *
@@ -33,6 +33,7 @@ export class LidoShape {
33
33
  this.margin = '';
34
34
  this.delayVisible = '';
35
35
  this.disableSpeak = false;
36
+ this.style = {};
36
37
  }
37
38
  /**
38
39
  * Lifecycle hook that runs after the component is loaded into the DOM.
@@ -41,20 +42,49 @@ export class LidoShape {
41
42
  componentDidLoad() {
42
43
  setVisibilityWithDelay(this.el, this.delayVisible);
43
44
  initEventsForElement(this.el, this.type);
45
+ this.updateStyles();
46
+ this.lido3DShapes();
47
+ }
48
+ updateStyles() {
49
+ const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
50
+ this.style = {
51
+ x: parseProp(`${this.x}`, orientation),
52
+ y: parseProp(`${this.y}`, orientation),
53
+ height: parseProp(`${this.height}`, orientation),
54
+ width: parseProp(`${this.width}`, orientation),
55
+ };
56
+ }
57
+ lido3DShapes() {
58
+ const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
59
+ if (this.shapeType === "lido-cube") {
60
+ const faces = this.el.querySelectorAll(".face");
61
+ faces.forEach(item => {
62
+ const face = item;
63
+ face.style.setProperty("--face-width", parseProp(`${this.width}`, orientation));
64
+ const translateValue = parseInt(parseProp(`${this.width}`, orientation)) / 2;
65
+ console.log("translate : ", translateValue);
66
+ face.style.setProperty("--face-translate", `${translateValue}px`);
67
+ face.style.setProperty("--face-bg-color", this.bgColor);
68
+ });
69
+ }
70
+ if (this.shapeType === "lido-cylinder") {
71
+ const orientation = window.innerHeight > window.innerWidth ? 'portrait' : 'landscape';
72
+ }
44
73
  }
45
74
  render() {
46
75
  // Inline styles to position and size the shape component
47
76
  const style = {
48
- height: this.shapeType !== 'polygon' ? this.height : undefined, // Set height unless it's a polygon
49
- width: this.shapeType !== 'polygon' ? this.width : undefined, // Set width unless it's a polygon
50
- top: this.y,
51
- left: this.x,
77
+ height: this.shapeType !== 'polygon' ? this.style.height : undefined, // Set height unless it's a polygon
78
+ width: this.shapeType !== 'polygon' ? this.style.width : undefined, // Set width unless it's a polygon
79
+ top: this.style.y,
80
+ left: this.style.x,
52
81
  display: this.visible ? 'block' : 'none', // Toggle visibility
53
82
  zIndex: this.z,
54
83
  backgroundColor: this.shapeType !== 'polygon' ? this.bgColor : 'transparent', // Apply background only if not a polygon
55
84
  margin: this.margin,
56
85
  };
57
- return (h(Host, { key: '7a626d9f00854cf190c08524153086d0e9f139af', class: `lido-shape ${this.shapeType}`, value: this.value, type: this.type, "tab-index": this.tabIndex, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, minDrops: this.minDrops, maxDrops: this.maxDrops, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, "disable-speak": this.disableSpeak }));
86
+ return (h(Host, { key: 'fde795dbc7c3a295a84bb1e5e74ff57cf3fe103a', class: `lido-shape ${this.shapeType}`, value: this.value, type: this.type, "tab-index": this.tabIndex, style: style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, minDrops: this.minDrops, maxDrops: this.maxDrops, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, "disable-speak": this.disableSpeak }, this.shapeType === "lido-cube" &&
87
+ h("div", { key: '620b82948d6eea342a2e00fab780696fcd2d6794', class: "cube" }, h("div", { key: 'b505a156896edd12c8d686966945168c5eb056d7', class: "face top" }), h("div", { key: '806b4d6aec720340d7a207854b20f910bb845829', class: "face bottom" }), h("div", { key: 'd2619804cabb2761e624139e33d759992d632468', class: "face left" }), h("div", { key: '3874ba7bcbe3eebc133b107a4bfefb38638eeb0f', class: "face right" }), h("div", { key: '0e19cfb0feba399b9a98336b0f6c349ff22e29ed', class: "face front" }), h("div", { key: '9b1d9d75d8897756f32bc023533eb1dc025d8e2f', class: "face back" }))));
58
88
  }
59
89
  static get is() { return "lido-shape"; }
60
90
  static get originalStyleUrls() {
@@ -503,5 +533,10 @@ export class LidoShape {
503
533
  }
504
534
  };
505
535
  }
536
+ static get states() {
537
+ return {
538
+ "style": {}
539
+ };
540
+ }
506
541
  static get elementRef() { return "el"; }
507
542
  }
@@ -190,7 +190,7 @@ export class LidoSlideFill {
190
190
  }
191
191
  }
192
192
  render() {
193
- return (h(Host, { key: '3918ed476b3de4977c53ff0bf576253f68e8c84f', id: this.id, class: "lido-slide-fill", src: this.src, fill: this.fill, fillDirection: this.fillDirection, slider: this.slider, style: this.style, min: this.min, max: this.max, division: this.division, numberType: this.numberType, onEntry: this.onEntry, type: this.type, "disable-speak": this.disableSpeak }, h("div", { key: '8f54b0e5de490a162aaa1d7ac9ed485d1628c484', innerHTML: this.svgContent, class: "svg-element" })));
193
+ return (h(Host, { key: '12b0ded699dde182bca178f2a58e5dea40536f18', id: this.id, class: "lido-slide-fill", src: this.src, fill: this.fill, fillDirection: this.fillDirection, slider: this.slider, style: this.style, min: this.min, max: this.max, division: this.division, numberType: this.numberType, onEntry: this.onEntry, type: this.type, "disable-speak": this.disableSpeak }, h("div", { key: '623f23b8b00bd4d83e99eb264dbb810aaf990ddd', innerHTML: this.svgContent, class: "svg-element" })));
194
194
  }
195
195
  static get is() { return "lido-slide-fill"; }
196
196
  static get originalStyleUrls() {
@@ -1,6 +1,7 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  import { initEventsForElement, convertUrlToRelative, parseProp, setVisibilityWithDelay, attachSpeakIcon } from "../../utils/utils";
3
3
  import i18next from "../../utils/i18n";
4
+ import { LIDO_COMMON_AUDIO_PATH, LIDO_COMMON_AUDIO_READY_EVENT } from "../../utils/constants";
4
5
  /**
5
6
  * @component LidoText
6
7
  *
@@ -59,6 +60,30 @@ export class LidoText {
59
60
  if (this.showSpeakIcon) {
60
61
  attachSpeakIcon(this.el);
61
62
  }
63
+ if (!this.audio || this.audio.trim() === "") {
64
+ const applyAutoAudio = () => {
65
+ const autoAudio = this.resolveAutoAudio();
66
+ if (autoAudio) {
67
+ this.audio = autoAudio;
68
+ console.log("[LidoText] Auto audio applied:", autoAudio);
69
+ }
70
+ };
71
+ // If path is already available, apply immediately
72
+ if (window.__LIDO_COMMON_AUDIO_PATH__) {
73
+ applyAutoAudio();
74
+ }
75
+ else {
76
+ // Otherwise, wait for it
77
+ window.addEventListener(LIDO_COMMON_AUDIO_READY_EVENT, applyAutoAudio, { once: true });
78
+ }
79
+ }
80
+ }
81
+ resolveAutoAudio() {
82
+ const base = window[LIDO_COMMON_AUDIO_PATH];
83
+ if (!base || !this.string)
84
+ return null;
85
+ const fileName = this.string.toLowerCase().trim().replace(/\s+/g, "_").replace(/[^\w-]/g, "");
86
+ return `${base}/${fileName}.mp3`;
62
87
  }
63
88
  /**
64
89
  * Lifecycle method that runs before the component is rendered.
@@ -124,7 +149,7 @@ export class LidoText {
124
149
  }
125
150
  }
126
151
  render() {
127
- return (h(Host, { key: '89ed432cbbf1f3ca2cdcaf4df80628350badef6d', class: "lido-text", value: this.value, type: this.type, "tab-index": this.tabIndex, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, minDrops: this.minDrops, maxDrops: this.maxDrops, id: this.id, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, "span-type": this.spanType, "disable-speak": this.disableSpeak }, this.spanType !== '' ? h("div", { class: "lido-text-content" }, " ", i18next.t(this.string)) : i18next.t(this.string)));
152
+ return (h(Host, { key: '87d82cc0bf52e1eaba8f44d1bdd80c98e896ddbf', class: "lido-text", value: this.value, type: this.type, "tab-index": this.tabIndex, audio: this.audio, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, minDrops: this.minDrops, maxDrops: this.maxDrops, id: this.id, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, "span-type": this.spanType, "disable-speak": this.disableSpeak }, this.spanType !== '' ? h("div", { class: "lido-text-content" }, " ", i18next.t(this.string)) : i18next.t(this.string)));
128
153
  }
129
154
  static get is() { return "lido-text"; }
130
155
  static get originalStyleUrls() {
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from "@stencil/core";
2
- import { convertUrlToRelative, executeActions, triggerNextContainer, speakIcon, setVisibilityWithDelay, parseProp } from "../../utils/utils";
2
+ import { convertUrlToRelative, executeActions, triggerNextContainer, speakIcon, setVisibilityWithDelay, parseProp, storingEachActivityScore, calculateScore } from "../../utils/utils";
3
3
  import { fingerUrl, LidoContainer, TraceMode } from "../../utils/constants";
4
4
  // Enum for different tracing modes
5
5
  export class LidoTrace {
@@ -386,7 +386,7 @@ export class LidoTrace {
386
386
  });
387
387
  }
388
388
  // Modified handlePointerMove function
389
- handlePointerMove(state) {
389
+ async handlePointerMove(state) {
390
390
  var _a, _b, _c, _d, _e, _f;
391
391
  if (!state.isDragging)
392
392
  return;
@@ -533,13 +533,15 @@ export class LidoTrace {
533
533
  }
534
534
  (_f = currentPath.greenPath) === null || _f === void 0 ? void 0 : _f.setAttribute('stroke-dashoffset', (state.totalPathLength - state.lastLength).toString());
535
535
  // Completion logic for closed paths: only allow completion if almost all points are traced
536
- const COMPLETION_THRESHOLD = 0.90; // 90% of the path must be traced
536
+ const COMPLETION_THRESHOLD = 0.95; // 95% of the path must be traced
537
537
  let percentComplete = state.lastLength / state.totalPathLength;
538
538
  let startPoint = currentPath.getPointAtLength(0);
539
539
  let endPoint = currentPath.getPointAtLength(currentPath.getTotalLength());
540
540
  let pathIsClosed = this.getDistanceSquared(startPoint, endPoint) < 200; // threshold for overlap
541
541
  if (pathIsClosed && state.totalPathLength > 50) {
542
542
  if (percentComplete >= COMPLETION_THRESHOLD) {
543
+ // Animate the draggable circle & green trace to the very end, then proceed
544
+ await this.animatePathToEnd(state, currentPath);
543
545
  if (state.currentPathIndex < state.paths.length - 1) {
544
546
  this.moveToNextPath(state);
545
547
  }
@@ -560,6 +562,55 @@ export class LidoTrace {
560
562
  }
561
563
  // this.resetIdleTimer(state); // ← keep timer alive
562
564
  }
565
+ // Smoothly animate the draggable circle + green stroke from current lastLength to totalPathLength
566
+ animatePathToEnd(state, path, duration = 300) {
567
+ if (!path || !state.svg)
568
+ return Promise.resolve();
569
+ if (state._animatingToEnd)
570
+ return Promise.resolve();
571
+ state._animatingToEnd = true;
572
+ const start = state.lastLength || 0;
573
+ const end = path.getTotalLength();
574
+ const startTime = performance.now();
575
+ // get greenPath safely: prefer the attached property, otherwise query by class near the original path
576
+ const greenPath = path.greenPath ||
577
+ (path.parentNode && path.parentNode.querySelector('.lido-trace-path-green'));
578
+ return new Promise(resolve => {
579
+ const step = (now) => {
580
+ const t = Math.min(1, (now - startTime) / duration);
581
+ const eased = t; // linear easing
582
+ const currentLen = start + (end - start) * eased;
583
+ state.lastLength = currentLen;
584
+ // update circle position and green path dashoffset
585
+ const pt = path.getPointAtLength(currentLen);
586
+ if (state.circle) {
587
+ state.circle.setAttribute('cx', pt.x.toString());
588
+ state.circle.setAttribute('cy', pt.y.toString());
589
+ }
590
+ if (greenPath) {
591
+ greenPath.setAttribute('stroke-dashoffset', (state.totalPathLength - currentLen).toString());
592
+ }
593
+ if (t < 1) {
594
+ requestAnimationFrame(step);
595
+ }
596
+ else {
597
+ // ensure fully complete
598
+ state.lastLength = end;
599
+ if (state.circle) {
600
+ const finalPt = path.getPointAtLength(end);
601
+ state.circle.setAttribute('cx', finalPt.x.toString());
602
+ state.circle.setAttribute('cy', finalPt.y.toString());
603
+ }
604
+ if (greenPath) {
605
+ greenPath.setAttribute('stroke-dashoffset', '0');
606
+ }
607
+ state._animatingToEnd = false;
608
+ resolve();
609
+ }
610
+ };
611
+ requestAnimationFrame(step);
612
+ });
613
+ }
563
614
  // Move to the next container after completing the current SVG
564
615
  async moveToNextContainer() {
565
616
  this.isDragging = false;
@@ -572,6 +623,7 @@ export class LidoTrace {
572
623
  if (this.animationTrace) {
573
624
  await this.playTraceAnimation();
574
625
  }
626
+ storingEachActivityScore(true);
575
627
  console.log(`Moving to next container after SVG index: ${this.currentSvgIndex}`);
576
628
  const delay = 1000; // milliseconds
577
629
  if (this.currentSvgIndex < this.svgUrls.length - 1) {
@@ -586,6 +638,7 @@ export class LidoTrace {
586
638
  if (this.el && this.onCorrect) {
587
639
  await executeActions(this.onCorrect, this.el);
588
640
  }
641
+ calculateScore();
589
642
  console.log('All SVGs completed, hiding component.');
590
643
  triggerNextContainer();
591
644
  }
@@ -786,7 +839,7 @@ export class LidoTrace {
786
839
  };
787
840
  }
788
841
  render() {
789
- return (h(Host, { key: '3f12119394502b6750874aaa50f43bf42e9f63cc', class: "lido-trace", id: this.id, audio: this.audio, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex, "disable-speak": this.disableSpeak }, h("div", { key: '4fddd90d12251c4020006690f8c769ab452c8f6a', style: this.style, id: "lido-svgContainer" })));
842
+ return (h(Host, { key: 'aef0bf373de0c1d6ac49e7782838d9679c2b093f', class: "lido-trace", id: this.id, audio: this.audio, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, tabindex: this.tabIndex, "disable-speak": this.disableSpeak }, h("div", { key: 'f5223ad78568213f7965b3ea7eeb56b1b965fe78', style: this.style, id: "lido-svgContainer" })));
790
843
  }
791
844
  static get is() { return "lido-trace"; }
792
845
  static get originalStyleUrls() {
@@ -80,7 +80,7 @@ export class LidoWrap {
80
80
  };
81
81
  }
82
82
  render() {
83
- return (h(Host, { key: '50bc5770105477d0ef7cb080957c8d00198c8b09', class: "lido-wrap", value: this.value, type: this.type, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, minDrops: this.minDrops, maxDrops: this.maxDrops, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, disableSpeak: this.disableSpeak }, h("slot", { key: 'fcd1f5801e34171d1925e39f6c543f229a5d42bd' })));
83
+ return (h(Host, { key: 'ba0767c8fb70d3c20dbcc0835794ec58d62078b3', class: "lido-wrap", value: this.value, type: this.type, "tab-index": this.tabIndex, style: this.style, "aria-label": this.ariaLabel, "aria-hidden": this.ariaHidden, audio: this.audio, minDrops: this.minDrops, maxDrops: this.maxDrops, onTouch: this.onTouch, onCorrect: this.onCorrect, onInCorrect: this.onInCorrect, onEntry: this.onEntry, disableSpeak: this.disableSpeak }, h("slot", { key: '359ff37390f0d20e650481cd8d531ad4da55b308' })));
84
84
  }
85
85
  static get is() { return "lido-wrap"; }
86
86
  static get originalStyleUrls() {
@@ -46,7 +46,7 @@ function getContainerXml(args) {
46
46
  </lido-text>
47
47
  </lido-pos>
48
48
  <!-- question -->
49
- <lido-text visible="true" tab-index="12" height="landscape.100px,portrait.175px" font-family="'Baloo Bhai 2'" font-size="60px" width="landscape.auto,portrait.86%" string="Drop the elements to match the given symbol '${objective}'" font-color="black" bg-color="white" y="landscape.0%,portrait.-12%" onEntry="this.font-weight='600'; this.position='relative';">
49
+ <lido-text visible="true" audio="https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/fill-in-the-blanks/fill-upAudio.mp3" id="heading" tab-index="12" height="landscape.100px,portrait.175px" font-family="'Baloo Bhai 2'" font-size="60px" width="landscape.auto,portrait.86%" string="Drop the elements to match the given symbol '${objective}'" font-color="black" bg-color="white" y="landscape.0%,portrait.-12%" onEntry="this.speak='true';this.font-weight='600'; this.position='relative';">
50
50
  </lido-text>
51
51
  <lido-balance tilt="0" operation="add" visible="true" height="landscape.456px,portrait.500px" y="landscape.4%,portrait.0%" width="landscape.1136px,portrait.876px">
52
52
  <!-- drop Element -->