lido-player 0.0.2-alpha-53-dev → 0.0.2-alpha-56-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 (99) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/lido-avatar_22.cjs.entry.js +141 -23
  3. package/dist/cjs/lido-player.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{utils-3c1ce74e.js → utils-a61cfc6b.js} +41 -12
  6. package/dist/collection/components/calculator/lido-calculator.js +4 -2
  7. package/dist/collection/components/home/lido-home.js +35 -6
  8. package/dist/collection/components/mathMatrix/lido-math-matrix.js +8 -6
  9. package/dist/collection/components/shape/lido-shape.css +90 -0
  10. package/dist/collection/components/shape/lido-shape.js +41 -6
  11. package/dist/collection/components/slideFill/lido-slide-fill.js +1 -1
  12. package/dist/collection/components/text/lido-text.js +26 -1
  13. package/dist/collection/components/trace/lido-trace.js +57 -4
  14. package/dist/collection/components/wrap/lido-wrap.js +1 -1
  15. package/dist/collection/stories/Templates/balancing/balancing.stories.js +1 -1
  16. package/dist/collection/stories/Templates/balloonPop/balloonPop.stories.js +2 -2
  17. package/dist/collection/stories/Templates/blender/blender.stories.js +3 -3
  18. package/dist/collection/stories/Templates/checker-block/checkerBlock.stories.js +6 -4
  19. package/dist/collection/stories/Templates/fillAnswer/fill-answer.stories.js +38 -32
  20. package/dist/collection/stories/Templates/multiplyBeeds/multiplyBeeds.stories.js +2 -2
  21. package/dist/collection/stories/Templates/numberBoardTwo/numberBoardTwo.stories.js +68 -60
  22. package/dist/collection/stories/Templates/questionBoard/questionBoard.stories.js +6 -5
  23. package/dist/collection/stories/Templates/quizMaths/quizMaths.stories.js +991 -0
  24. package/dist/collection/stories/Templates/sumTogether/sumTogether.stories.js +8 -8
  25. package/dist/collection/stories/Templates/tenBox/tenBox.stories.js +144 -0
  26. package/dist/collection/stories/Templates/writeNumber/writeNumber.stories.js +8 -4
  27. package/dist/collection/utils/constants.js +2 -0
  28. package/dist/collection/utils/customEvents.js +1 -0
  29. package/dist/collection/utils/utils.js +7 -1
  30. package/dist/collection/utils/utilsHandlers/animationHandler.js +21 -1
  31. package/dist/collection/utils/utilsHandlers/clickHandler.js +1 -1
  32. package/dist/collection/utils/utilsHandlers/dragDropHandler.js +4 -3
  33. package/dist/collection/utils/utilsHandlers/lidoBalanceHandler.js +4 -5
  34. package/dist/components/index.js +1 -1
  35. package/dist/components/lido-avatar.js +1 -1
  36. package/dist/components/lido-balance.js +1 -1
  37. package/dist/components/lido-calculator.js +1 -1
  38. package/dist/components/lido-canvas.js +1 -1
  39. package/dist/components/lido-cell.js +1 -1
  40. package/dist/components/lido-col.js +1 -1
  41. package/dist/components/lido-container.js +1 -1
  42. package/dist/components/lido-flash-card.js +1 -1
  43. package/dist/components/lido-float.js +1 -1
  44. package/dist/components/lido-home.js +1 -1
  45. package/dist/components/lido-image.js +1 -1
  46. package/dist/components/lido-keyboard.js +1 -1
  47. package/dist/components/lido-math-matrix.js +1 -1
  48. package/dist/components/lido-pos.js +1 -1
  49. package/dist/components/lido-random.js +1 -1
  50. package/dist/components/lido-root.js +22 -22
  51. package/dist/components/lido-row.js +1 -1
  52. package/dist/components/lido-shape.js +1 -1
  53. package/dist/components/lido-slide-fill.js +1 -1
  54. package/dist/components/lido-text.js +1 -1
  55. package/dist/components/lido-trace.js +1 -1
  56. package/dist/components/lido-wrap.js +1 -1
  57. package/dist/components/{p-511377d2.js → p-0712a27e.js} +39 -13
  58. package/dist/components/{p-df1af62c.js → p-0a41b2f8.js} +1 -1
  59. package/dist/components/{p-d568d595.js → p-17f84b2f.js} +1 -1
  60. package/dist/components/{p-09b3b152.js → p-21852d55.js} +1 -1
  61. package/dist/components/{p-561908ec.js → p-2829c82c.js} +1 -1
  62. package/dist/components/{p-71ded596.js → p-330caab8.js} +2 -2
  63. package/dist/components/{p-8774f517.js → p-480f708a.js} +1 -1
  64. package/dist/components/{p-cca545f9.js → p-4d332eab.js} +1 -1
  65. package/dist/components/{p-92b9ae9e.js → p-4e041807.js} +2 -2
  66. package/dist/components/{p-b3e67e7f.js → p-7ab0a273.js} +26 -2
  67. package/dist/components/{p-567983a9.js → p-882b291d.js} +2 -2
  68. package/dist/components/{p-875c1411.js → p-9104d427.js} +1 -1
  69. package/dist/components/{p-3e8ae1c5.js → p-b9875116.js} +57 -4
  70. package/dist/components/{p-004adc43.js → p-c4739621.js} +6 -4
  71. package/dist/components/p-cca36777.js +128 -0
  72. package/dist/components/{p-9ea1a67d.js → p-d1b5079b.js} +1 -1
  73. package/dist/components/{p-057fb7b8.js → p-e1ba0c44.js} +38 -26
  74. package/dist/components/{p-3f0e4436.js → p-eab0ebb7.js} +1 -1
  75. package/dist/components/{p-90f7dd48.js → p-f2b53e8e.js} +2 -2
  76. package/dist/components/{p-d2fe2bb6.js → p-f3bc4577.js} +1 -1
  77. package/dist/components/{p-6beee44b.js → p-ff801ba1.js} +1 -1
  78. package/dist/components/{p-23549651.js → p-ffc40642.js} +7 -5
  79. package/dist/esm/index.js +1 -1
  80. package/dist/esm/lido-avatar_22.entry.js +141 -23
  81. package/dist/esm/lido-player.js +1 -1
  82. package/dist/esm/loader.js +1 -1
  83. package/dist/esm/{utils-eefe4a1c.js → utils-7ed76799.js} +39 -13
  84. package/dist/lido-player/index.esm.js +1 -1
  85. package/dist/lido-player/lido-player.esm.js +1 -1
  86. package/dist/lido-player/{p-589fc3b8.js → p-17d93181.js} +2 -2
  87. package/dist/lido-player/p-fa9dfdf8.entry.js +1 -0
  88. package/dist/types/components/home/lido-home.d.ts +3 -0
  89. package/dist/types/components/shape/lido-shape.d.ts +8 -2
  90. package/dist/types/components/text/lido-text.d.ts +1 -0
  91. package/dist/types/components/trace/lido-trace.d.ts +2 -1
  92. package/dist/types/components.d.ts +2 -0
  93. package/dist/types/stories/Templates/fillAnswer/fill-answer.stories.d.ts +1 -1
  94. package/dist/types/stories/Templates/quizMaths/quizMaths.stories.d.ts +16 -0
  95. package/dist/types/stories/Templates/tenBox/tenBox.stories.d.ts +4 -0
  96. package/dist/types/utils/constants.d.ts +2 -0
  97. package/package.json +1 -1
  98. package/dist/components/p-0733b277.js +0 -100
  99. package/dist/lido-player/p-4d9ad047.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";
@@ -53,6 +55,7 @@ const speakUrl = 'https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/pub
53
55
  const fingerUrl = 'https://aeakbcdznktpsbrfsgys.supabase.co/storage/v1/object/public/template-assets/trace/Tracing-hand.svg';
54
56
 
55
57
  function dispatchCustomEvent(eventName, detail) {
58
+ console.log("👍Event Name : ", eventName, "Detail : ", detail.toString());
56
59
  const event = new CustomEvent(eventName, { detail });
57
60
  window.dispatchEvent(event);
58
61
  }
@@ -174,7 +177,7 @@ function updateBalanceOnDrop(dragElement, dropElement) {
174
177
  }
175
178
  function calculateValue(elements, operation) {
176
179
  if (elements.length === 0)
177
- return 0;
180
+ return null;
178
181
  if (operation === "count") {
179
182
  return elements.length;
180
183
  }
@@ -206,18 +209,15 @@ function calculateValue(elements, operation) {
206
209
  }
207
210
  }
208
211
  function balanceResult(container, objectiveString) {
209
- var _a, _b, _c, _d, _e, _f;
210
212
  const additionalCheck = container.getAttribute('equationCheck');
211
213
  if (!additionalCheck)
212
214
  return false;
213
215
  const balanceEl = document.querySelector('lido-balance');
214
216
  if (!balanceEl)
215
217
  return false;
216
- 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);
217
- 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);
218
- const hasLeft = !isNaN(leftVal);
219
- const hasRight = !isNaN(rightVal);
220
- if (!hasLeft || !hasRight) {
218
+ const leftVal = balanceEl.leftVal;
219
+ const rightVal = balanceEl.rightVal;
220
+ if (leftVal == null || rightVal == null) {
221
221
  return false;
222
222
  }
223
223
  const symbol = leftVal > rightVal ? '>' : leftVal < rightVal ? '<' : '=';
@@ -226,9 +226,11 @@ function balanceResult(container, objectiveString) {
226
226
  return res;
227
227
  }
228
228
 
229
+ const tempVanishedValues = [];
229
230
  function dragDropAnimation(container, dragElement, dropElement) {
230
- container.style.pointerEvents = 'none';
231
+ container.style.pointerEvents = "none";
231
232
  setTimeout(() => {
233
+ var _a, _b, _c;
232
234
  const div = document.createElement('div');
233
235
  container.append(div);
234
236
  div.classList.add('after-drop-popup-container');
@@ -237,6 +239,11 @@ function dragDropAnimation(container, dragElement, dropElement) {
237
239
  const allDragElements = container.querySelectorAll('[type="drag"]');
238
240
  const dragParents = Array.from(allDragElements).map(el => el.parentElement);
239
241
  const allSameParent = dragParents.every(parent => parent === dragElement.parentElement);
242
+ JSON.parse((_a = container.getAttribute(SelectedValuesKey)) !== null && _a !== void 0 ? _a : '[]');
243
+ const vanishedValue = (_b = dragElement.getAttribute('value')) !== null && _b !== void 0 ? _b : (_c = dragElement.textContent) === null || _c === void 0 ? void 0 : _c.trim();
244
+ if (vanishedValue) {
245
+ tempVanishedValues.push(vanishedValue);
246
+ }
240
247
  // Remove from old parents
241
248
  if (allSameParent) {
242
249
  dragElement.remove();
@@ -260,6 +267,17 @@ function dragDropAnimation(container, dragElement, dropElement) {
260
267
  setTimeout(() => {
261
268
  div.remove();
262
269
  container.style.pointerEvents = 'auto';
270
+ const objective = container.getAttribute('objective');
271
+ if (objective && tempVanishedValues.map(v => v.trim()).sort().join(',') === objective.split(',').map(v => v.trim()).sort().join(',')) {
272
+ (async () => {
273
+ // isCorrect=true;
274
+ const onCorrect = (container === null || container === void 0 ? void 0 : container.getAttribute('onCorrect')) || '';
275
+ await executeActions(onCorrect, container);
276
+ window.dispatchEvent(new CustomEvent(NextContainerKey));
277
+ calculateScore();
278
+ tempVanishedValues.length = 0;
279
+ })();
280
+ }
263
281
  }, 800); // match animation duration
264
282
  }, 2000); // stay for 2 seconds
265
283
  }, 250);
@@ -534,9 +552,12 @@ function enableDraggingWithScaling(element) {
534
552
  otherElement.style.border = ''; // Reset border
535
553
  otherElement.style.backgroundColor = 'transparent'; // Reset background color
536
554
  }
537
- if (otherElement.tagName.toLowerCase() === 'lido-image') {
555
+ else if (otherElement.tagName.toLowerCase() === 'lido-image') {
538
556
  otherElement.style.opacity = '0';
539
557
  }
558
+ else {
559
+ otherElement.style.opacity = '1';
560
+ }
540
561
  }
541
562
  }
542
563
  else {
@@ -968,7 +989,6 @@ async function onElementDropComplete(dragElement, dropElement) {
968
989
  dispatchElementDropEvent(dragElement, dropElement, isCorrect);
969
990
  // storingEachActivityScore(isCorrect);
970
991
  dragElement.style.opacity = '1';
971
- await onActivityComplete(dragElement, dropElement);
972
992
  const allDropElements = document.querySelectorAll('.drop-element');
973
993
  allDropElements.forEach(el => updateDropBorder(el));
974
994
  await onActivityComplete(dragElement, dropElement);
@@ -3133,7 +3153,7 @@ function onTouchListenerForOnTouch(element) {
3133
3153
  return;
3134
3154
  const container = document.getElementById('lido-container');
3135
3155
  // const container = element.closest('lido-container') as HTMLElement;
3136
- if (container && container.getAttribute('disableSpeak') === 'true') {
3156
+ if (container && container.getAttribute('disable-speak') === 'true') {
3137
3157
  return;
3138
3158
  }
3139
3159
  // if (element.closest('[disableSpeak="true"]')) {
@@ -69056,6 +69076,8 @@ async function onActivityComplete(dragElement, dropElement) {
69056
69076
  await executeActions("this.alignMatch='true'", dropElement, dragElement);
69057
69077
  if (dragElement && dropElement) {
69058
69078
  const isCorrect = dropElement['value'].toLowerCase().includes(dragElement['value'].toLowerCase());
69079
+ // storing each activity score based on isCorrect for (all drag-drop events)
69080
+ storingEachActivityScore(isCorrect);
69059
69081
  if (isCorrect) {
69060
69082
  const onCorrect = dropElement.getAttribute('onCorrect');
69061
69083
  if (onCorrect) {
@@ -69202,6 +69224,7 @@ const validateObjectiveStatus = async () => {
69202
69224
  if (attach === 'true') {
69203
69225
  appendingDragElementsInDrop();
69204
69226
  }
69227
+ storingEachActivityScore(true);
69205
69228
  await executeActions(onCorrect, container);
69206
69229
  }
69207
69230
  if (container.getAttribute('dropAttr') === 'EnableAnimation') {
@@ -69217,12 +69240,12 @@ const validateObjectiveStatus = async () => {
69217
69240
  else {
69218
69241
  const isContinueOnCorrect = container.getAttribute('is-continue-on-correct') === 'true';
69219
69242
  if (!isContinueOnCorrect) {
69220
- triggerNextContainer();
69221
69243
  await calculateScore();
69222
69244
  triggerNextContainer();
69223
69245
  }
69224
69246
  else {
69225
69247
  const onInCorrect = container.getAttribute('onInCorrect');
69248
+ storingEachActivityScore(false);
69226
69249
  await executeActions(onInCorrect, container);
69227
69250
  }
69228
69251
  }
@@ -69245,6 +69268,9 @@ function convertUrlToRelative(url) {
69245
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'))) {
69246
69269
  return url;
69247
69270
  }
69271
+ if (url.startsWith('/Lido-CommonAudios/')) {
69272
+ return url;
69273
+ }
69248
69274
  if (baseUrl) {
69249
69275
  const newUrl = url.startsWith('/') ? url.slice(1) : url;
69250
69276
  if (newUrl.startsWith(baseUrl.replace(/^\/+|\/+$/g, '')))
@@ -69879,6 +69905,8 @@ const updateCalculatorAnswer = (el) => {
69879
69905
 
69880
69906
  exports.ActivityScoreKey = ActivityScoreKey;
69881
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;
69882
69910
  exports.LidoContainer = LidoContainer;
69883
69911
  exports.NextContainerKey = NextContainerKey;
69884
69912
  exports.PrevContainerKey = PrevContainerKey;
@@ -69886,6 +69914,7 @@ exports.RiveService = RiveService;
69886
69914
  exports.SelectedValuesKey = SelectedValuesKey;
69887
69915
  exports.attachSpeakIcon = attachSpeakIcon;
69888
69916
  exports.calculateScale = calculateScale;
69917
+ exports.calculateScore = calculateScore;
69889
69918
  exports.commonjsGlobal = commonjsGlobal;
69890
69919
  exports.convertUrlToRelative = convertUrlToRelative;
69891
69920
  exports.dispatchActivityChangeEvent = dispatchActivityChangeEvent;
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from "@stencil/core";
2
- import { executeActions, equationCheck, storingEachActivityScore } from "../../utils/utils";
2
+ import { executeActions, equationCheck, storingEachActivityScore, calculateScore } from "../../utils/utils";
3
3
  import { NextContainerKey } from "../../utils/constants";
4
4
  export class LidoCalculator {
5
5
  constructor() {
@@ -101,10 +101,12 @@ export class LidoCalculator {
101
101
  await executeActions(onCorrect, container);
102
102
  if (onCorrect.includes('scrollCellAfterEquationSolved')) {
103
103
  if (this.objective.length === 0) {
104
+ calculateScore();
104
105
  window.dispatchEvent(new CustomEvent(NextContainerKey));
105
106
  }
106
107
  }
107
108
  else {
109
+ calculateScore();
108
110
  window.dispatchEvent(new CustomEvent(NextContainerKey));
109
111
  }
110
112
  }
@@ -117,7 +119,7 @@ export class LidoCalculator {
117
119
  }
118
120
  render() {
119
121
  const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
120
- return (h(Host, { key: 'de394a3b14826c7fb6d6cf33fbbf1726238cbe3b', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, h("lido-cell", { key: '6dbc01d1032553ba6376d60d451b546851f5ebed', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: '353396c173bbdeb5f2fbb235e54fa900d2d0b771', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: '083b53c01a3d7bfff1c39a408ed064fd18d3e8a3', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: 'b0936ba134feda621d5f0f26b7de70db51f56cf8', class: "lido-calculator-displayParent" }, h("div", { key: '35507ac35c70c4bf515c904a402e5312dafeffc3', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: 'd7412b0d4c8971aa09d9ca22ee8d25f2773cd2c8', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
122
+ return (h(Host, { key: '394177b08965252a6008cce3284475c6176eca3d', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, h("lido-cell", { key: '1c79a951e666ad4171b686400f0ba391783e693f', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: '70da4a0990c7ae72367f8d61026c1d4e6f682d48', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: 'c510e7f1cc6ec5d34683030fff988054ac721225', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: '790d7bd307e296cc8e05e29705ebf4bfdda49906', class: "lido-calculator-displayParent" }, h("div", { key: 'f0195ce772bffdee06483da524f8a392dffdde38', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: '00fda79dab52a801acafe6006db0dd50923ea74b', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
121
123
  'lido-calculator-btn-special': num === '←' || num === 'OK',
122
124
  'lido-calculator-btn-default': num !== '←' && num !== 'OK'
123
125
  }, onClick: () => this.handleClick(num) }))))));
@@ -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() {