lido-player 0.0.2-alpha-75 → 0.0.2-alpha-76

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.
@@ -392,7 +392,8 @@ function enableDraggingWithScaling(element) {
392
392
  console.error(`Container with ID "container" not found.`);
393
393
  return;
394
394
  }
395
- // if(container.getAttribute("canplay") === "false")return;
395
+ if (container.getAttribute("canplay") === "false")
396
+ return;
396
397
  handlingElementFlexibleWidth(element, 'drag');
397
398
  const onStart = (event) => {
398
399
  var _a, _b;
@@ -1062,9 +1063,9 @@ function handleDropElement(element) {
1062
1063
  updateDropBorder(element);
1063
1064
  }
1064
1065
  async function onClickDropOrDragElement(element, type) {
1065
- AudioPlayer.getI().stop();
1066
- document.getElementById(LidoContainer);
1067
- // if(container.getAttribute('canplay') === 'false') return;
1066
+ const container = document.getElementById(LidoContainer);
1067
+ if (container.getAttribute('canplay') === 'false')
1068
+ return;
1068
1069
  // Remove the highlight class from elements matching the selector
1069
1070
  const highlightedElements = document.querySelectorAll(`[type='${type}']`);
1070
1071
  highlightedElements.forEach(el => {
@@ -1697,9 +1698,8 @@ function enableReorderDrag(element) {
1697
1698
  let startX = 0;
1698
1699
  let startY = 0;
1699
1700
  const container = document.getElementById(LidoContainer);
1700
- if (!container)
1701
+ if (!container || container.getAttribute("canplay") === "false")
1701
1702
  return;
1702
- // if(!container || container.getAttribute("canplay") === "false") return;
1703
1703
  Array.from(element.children).forEach(child => {
1704
1704
  child.style.pointerEvents = 'none';
1705
1705
  });
@@ -1885,7 +1885,8 @@ function enableReorderDrag(element) {
1885
1885
  };
1886
1886
  const onClickElement = (element) => {
1887
1887
  const container = document.getElementById(LidoContainer);
1888
- // if(container.getAttribute('canplay') === 'false')return;
1888
+ if (container.getAttribute('canplay') === 'false')
1889
+ return;
1889
1890
  if (elementType === 'option') {
1890
1891
  const categoryArr = container.querySelectorAll('[type="category"]');
1891
1892
  let category = Array.from(categoryArr).find(el => el.parentElement.className.includes('highlight-element'));
@@ -1958,9 +1959,7 @@ function enableReorderDrag(element) {
1958
1959
  };
1959
1960
  element.style.cursor = 'move';
1960
1961
  element.classList.add('drag-element');
1961
- // element.addEventListener('pointerdown', onStart);
1962
- element.addEventListener('mousedown', onStart);
1963
- element.addEventListener('touchstart', onStart, { passive: false });
1962
+ element.addEventListener('pointerdown', onStart);
1964
1963
  }
1965
1964
  const resetElementStyles = (el) => {
1966
1965
  el.style.opacity = '';
@@ -2160,7 +2159,9 @@ function slidingWithScaling(element) {
2160
2159
  console.error(`Parent element not found.`);
2161
2160
  return;
2162
2161
  }
2163
- document.getElementById(LidoContainer);
2162
+ const container = document.getElementById(LidoContainer);
2163
+ if (container.getAttribute('canplay') === 'false')
2164
+ return;
2164
2165
  const onStart = (event) => {
2165
2166
  removeHighlight(element);
2166
2167
  isDragging = true;
@@ -3584,7 +3585,8 @@ function onTouchListenerForOnTouch(element) {
3584
3585
  function addClickListenerForClickType(element) {
3585
3586
  handlingElementFlexibleWidth(element, 'click');
3586
3587
  const container = document.getElementById(LidoContainer);
3587
- // if(container.getAttribute('canplay') === 'false')return;
3588
+ if (container.getAttribute('canplay') === 'false')
3589
+ return;
3588
3590
  element.style.cursor = 'pointer';
3589
3591
  if (!element) {
3590
3592
  console.error('No element provided.');
@@ -72161,7 +72163,8 @@ const executeActions = async (actionsString, thisElement, element) => {
72161
72163
  }
72162
72164
  case 'nextBtn': {
72163
72165
  const container = document.getElementById(LidoContainer);
72164
- // if(container.getAttribute('canplay') === 'false')return;
72166
+ if (container.getAttribute('canplay') === 'false')
72167
+ return;
72165
72168
  if (container.getAttribute('is-continue-on-correct') !== 'true') {
72166
72169
  targetElement.style.pointerEvents = 'none';
72167
72170
  AudioPlayer.getI().stop();
@@ -73199,14 +73202,14 @@ const animateBoxCells = async (element, value) => {
73199
73202
  await new Promise(resolve => setTimeout(resolve, 600)); // Adjust delay as needed
73200
73203
  cell.classList.remove('lido-box-highlight');
73201
73204
  }
73202
- // checkout parent cell first then pick the first text child inside cell
73205
+ // checkout parent cell first then pick the second text child inside cell
73203
73206
  const parentCell = document.getElementById(LidoContainer);
73204
73207
  if (!parentCell)
73205
73208
  return;
73206
- const firstTextChild = parentCell.querySelector('lido-text');
73207
- if (firstTextChild) {
73209
+ const instructionText = parentCell.children[2];
73210
+ if (instructionText) {
73208
73211
  // play the text child inside parent cell
73209
- await AudioPlayer.getI().play(firstTextChild);
73212
+ await AudioPlayer.getI().play(instructionText);
73210
73213
  }
73211
73214
  // Now select each box cell's text child and play them one by one
73212
73215
  for (const box of boxCells) {
@@ -73247,9 +73250,9 @@ const SumTogetherAnimation = async (element, value) => {
73247
73250
  if (!value)
73248
73251
  return;
73249
73252
  // Expecting structure: [_, TopRow, questionRow, optionRow, ...]
73250
- const TopRow = Array.from(element.children)[2];
73251
- const questionRow = Array.from(element.children)[3];
73252
- const optionRow = Array.from(element.children)[4];
73253
+ const TopRow = Array.from(element.children)[3];
73254
+ const questionRow = Array.from(element.children)[4];
73255
+ const optionRow = Array.from(element.children)[5];
73253
73256
  if (!TopRow || !questionRow || !optionRow)
73254
73257
  return;
73255
73258
  const topRowChildren = Array.from(TopRow.children);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DeCNGGv1.js');
3
+ var index = require('./index-BeLWDohk.js');
4
4
  require('./index-BrME-8br.js');
5
5
 
6
6
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-BrME-8br.js');
4
- var index$1 = require('./index-DeCNGGv1.js');
4
+ var index$1 = require('./index-BeLWDohk.js');
5
5
 
6
6
  var rive$1 = {exports: {}};
7
7
 
@@ -8580,7 +8580,7 @@ const LidoCalculator = class {
8580
8580
  return;
8581
8581
  if (this.objective && this.objective != '' && !this.objective.includes(',')) {
8582
8582
  console.log("hi iscorrect verified");
8583
- isCorrect = userInput === this.objective;
8583
+ isCorrect = Number(userInput) === Number(this.objective);
8584
8584
  }
8585
8585
  // --- Multiple Objectives ---
8586
8586
  else if (this.objective && this.objective.includes(',')) {
@@ -8653,7 +8653,7 @@ const LidoCalculator = class {
8653
8653
  }
8654
8654
  render() {
8655
8655
  const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
8656
- return (index.h(index.Host, { key: '595c92e80baed8e1709c51302aa427d672b3a9e0', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, index.h("lido-cell", { key: '4a2966a46fd008d66fedeb5f44e0ee2c5e8c083a', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: '35e38f7412be8489b668ba0aab927b7ba3d98f29', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, index.h("img", { key: '926def912022a30a27f5419d98348beb84fc1a42', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: '41a69c7aa7d1dfbeea19b1a1ef095b97d2c953ba', class: "lido-calculator-displayParent" }, index.h("div", { key: '047dfc84e8b02739a982287f82b1df2b7f552dcd', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: '41cd91f2c9aa40f6adcf6b0318e07e394bc3b38e', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
8656
+ return (index.h(index.Host, { key: '29f91af1bedaa8be605cdf82fddf74b5622eff6e', onEntry: this.onEntry, id: "lidoCalculator", style: { width: this.width, height: this.height, backgroundColor: this.bgColor, left: this.x, top: this.y } }, index.h("lido-cell", { key: '1ac0f61986e688603db21b2eb1bb52bbcabca1ca', visible: "true", height: "94px", width: "60px" }, index.h("lido-text", { key: '3bdacbcb2ea2f371b11a2ed05eb271e0a75c5e09', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, index.h("img", { key: '5f7bb3c09bccdb21c2bda00ae99234409bad7eda', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), index.h("div", { key: '0891cd4b5929861d264c29684ef260f61e65004b', class: "lido-calculator-displayParent" }, index.h("div", { key: 'ac5861ca1a9ebaee9eb7d729f8d2b88933b733d5', class: "lido-calculator-display" }, this.displayValue)), index.h("div", { key: 'f80c85a89462fd96630a4bf8a304284e4546fe72', class: "lido-calculator-buttons" }, numbers.map((num, i) => (index.h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
8657
8657
  'lido-calculator-btn-special': num === '←' || num === 'OK',
8658
8658
  'lido-calculator-btn-default': num !== '←' && num !== 'OK'
8659
8659
  }, onClick: () => this.handleClick(num) }))))));
@@ -67,7 +67,7 @@ export class LidoCalculator {
67
67
  return;
68
68
  if (this.objective && this.objective != '' && !this.objective.includes(',')) {
69
69
  console.log("hi iscorrect verified");
70
- isCorrect = userInput === this.objective;
70
+ isCorrect = Number(userInput) === Number(this.objective);
71
71
  }
72
72
  // --- Multiple Objectives ---
73
73
  else if (this.objective && this.objective.includes(',')) {
@@ -143,7 +143,7 @@ export class LidoCalculator {
143
143
  }
144
144
  render() {
145
145
  const numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '←', '0', 'OK'];
146
- return (h(Host, { key: '595c92e80baed8e1709c51302aa427d672b3a9e0', 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: '4a2966a46fd008d66fedeb5f44e0ee2c5e8c083a', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: '35e38f7412be8489b668ba0aab927b7ba3d98f29', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: '926def912022a30a27f5419d98348beb84fc1a42', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: '41a69c7aa7d1dfbeea19b1a1ef095b97d2c953ba', class: "lido-calculator-displayParent" }, h("div", { key: '047dfc84e8b02739a982287f82b1df2b7f552dcd', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: '41cd91f2c9aa40f6adcf6b0318e07e394bc3b38e', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
146
+ return (h(Host, { key: '29f91af1bedaa8be605cdf82fddf74b5622eff6e', 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: '1ac0f61986e688603db21b2eb1bb52bbcabca1ca', visible: "true", height: "94px", width: "60px" }, h("lido-text", { key: '3bdacbcb2ea2f371b11a2ed05eb271e0a75c5e09', visible: "true", id: "lido-calculator-penIcon", type: "click", height: "80px", x: "176%", width: "89px", onEntry: "this.position='relative';", class: "top-icon" }, h("img", { key: '5f7bb3c09bccdb21c2bda00ae99234409bad7eda', src: this.penIcon, alt: "pen", style: { width: '100%', height: '100%' } }))), h("div", { key: '0891cd4b5929861d264c29684ef260f61e65004b', class: "lido-calculator-displayParent" }, h("div", { key: 'ac5861ca1a9ebaee9eb7d729f8d2b88933b733d5', class: "lido-calculator-display" }, this.displayValue)), h("div", { key: 'f80c85a89462fd96630a4bf8a304284e4546fe72', class: "lido-calculator-buttons" }, numbers.map((num, i) => (h("lido-text", { id: `btn-${i}`, string: num, visible: "true", type: "click", class: {
147
147
  'lido-calculator-btn-special': num === '←' || num === 'OK',
148
148
  'lido-calculator-btn-default': num !== '←' && num !== 'OK'
149
149
  }, onClick: () => this.handleClick(num) }))))));
@@ -185,7 +185,8 @@ export const executeActions = async (actionsString, thisElement, element) => {
185
185
  }
186
186
  case 'nextBtn': {
187
187
  const container = document.getElementById(LidoContainer);
188
- // if(container.getAttribute('canplay') === 'false')return;
188
+ if (container.getAttribute('canplay') === 'false')
189
+ return;
189
190
  if (container.getAttribute('is-continue-on-correct') !== 'true') {
190
191
  targetElement.style.pointerEvents = 'none';
191
192
  AudioPlayer.getI().stop();
@@ -1225,14 +1226,14 @@ export const animateBoxCells = async (element, value) => {
1225
1226
  await new Promise(resolve => setTimeout(resolve, 600)); // Adjust delay as needed
1226
1227
  cell.classList.remove('lido-box-highlight');
1227
1228
  }
1228
- // checkout parent cell first then pick the first text child inside cell
1229
+ // checkout parent cell first then pick the second text child inside cell
1229
1230
  const parentCell = document.getElementById(LidoContainer);
1230
1231
  if (!parentCell)
1231
1232
  return;
1232
- const firstTextChild = parentCell.querySelector('lido-text');
1233
- if (firstTextChild) {
1233
+ const instructionText = parentCell.children[2];
1234
+ if (instructionText) {
1234
1235
  // play the text child inside parent cell
1235
- await AudioPlayer.getI().play(firstTextChild);
1236
+ await AudioPlayer.getI().play(instructionText);
1236
1237
  }
1237
1238
  // Now select each box cell's text child and play them one by one
1238
1239
  for (const box of boxCells) {
@@ -1273,9 +1274,9 @@ export const SumTogetherAnimation = async (element, value) => {
1273
1274
  if (!value)
1274
1275
  return;
1275
1276
  // Expecting structure: [_, TopRow, questionRow, optionRow, ...]
1276
- const TopRow = Array.from(element.children)[2];
1277
- const questionRow = Array.from(element.children)[3];
1278
- const optionRow = Array.from(element.children)[4];
1277
+ const TopRow = Array.from(element.children)[3];
1278
+ const questionRow = Array.from(element.children)[4];
1279
+ const optionRow = Array.from(element.children)[5];
1279
1280
  if (!TopRow || !questionRow || !optionRow)
1280
1281
  return;
1281
1282
  const topRowChildren = Array.from(TopRow.children);
@@ -58,7 +58,8 @@ export function onTouchListenerForOnTouch(element) {
58
58
  export function addClickListenerForClickType(element) {
59
59
  handlingElementFlexibleWidth(element, 'click');
60
60
  const container = document.getElementById(LidoContainer);
61
- // if(container.getAttribute('canplay') === 'false')return;
61
+ if (container.getAttribute('canplay') === 'false')
62
+ return;
62
63
  element.style.cursor = 'pointer';
63
64
  if (!element) {
64
65
  console.error('No element provided.');
@@ -65,7 +65,8 @@ export function enableDraggingWithScaling(element) {
65
65
  console.error(`Container with ID "container" not found.`);
66
66
  return;
67
67
  }
68
- // if(container.getAttribute("canplay") === "false")return;
68
+ if (container.getAttribute("canplay") === "false")
69
+ return;
69
70
  handlingElementFlexibleWidth(element, 'drag');
70
71
  let verticalDistance;
71
72
  let horizontalDistance;
@@ -745,9 +746,9 @@ export function handleDropElement(element) {
745
746
  updateDropBorder(element);
746
747
  }
747
748
  export async function onClickDropOrDragElement(element, type) {
748
- AudioPlayer.getI().stop();
749
749
  const container = document.getElementById(LidoContainer);
750
- // if(container.getAttribute('canplay') === 'false') return;
750
+ if (container.getAttribute('canplay') === 'false')
751
+ return;
751
752
  // Remove the highlight class from elements matching the selector
752
753
  const highlightedElements = document.querySelectorAll(`[type='${type}']`);
753
754
  highlightedElements.forEach(el => {
@@ -76,7 +76,8 @@ export function slidingWithScaling(element) {
76
76
  return;
77
77
  }
78
78
  const container = document.getElementById(LidoContainer);
79
- // if(container.getAttribute('canplay') === 'false')return;
79
+ if (container.getAttribute('canplay') === 'false')
80
+ return;
80
81
  let verticalDistance;
81
82
  let horizontalDistance;
82
83
  const onStart = (event) => {
@@ -41,9 +41,8 @@ export function enableReorderDrag(element) {
41
41
  let startX = 0;
42
42
  let startY = 0;
43
43
  const container = document.getElementById(LidoContainer);
44
- if (!container)
44
+ if (!container || container.getAttribute("canplay") === "false")
45
45
  return;
46
- // if(!container || container.getAttribute("canplay") === "false") return;
47
46
  Array.from(element.children).forEach(child => {
48
47
  child.style.pointerEvents = 'none';
49
48
  });
@@ -229,7 +228,8 @@ export function enableReorderDrag(element) {
229
228
  };
230
229
  const onClickElement = (element) => {
231
230
  const container = document.getElementById(LidoContainer);
232
- // if(container.getAttribute('canplay') === 'false')return;
231
+ if (container.getAttribute('canplay') === 'false')
232
+ return;
233
233
  if (elementType === 'option') {
234
234
  const categoryArr = container.querySelectorAll('[type="category"]');
235
235
  let category = Array.from(categoryArr).find(el => el.parentElement.className.includes('highlight-element'));
@@ -302,9 +302,7 @@ export function enableReorderDrag(element) {
302
302
  };
303
303
  element.style.cursor = 'move';
304
304
  element.classList.add('drag-element');
305
- // element.addEventListener('pointerdown', onStart);
306
- element.addEventListener('mousedown', onStart);
307
- element.addEventListener('touchstart', onStart, { passive: false });
305
+ element.addEventListener('pointerdown', onStart);
308
306
  }
309
307
  const resetElementStyles = (el) => {
310
308
  el.style.opacity = '';