lido-player 0.0.2-alpha-96 → 0.0.2-alpha-98

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-qIQYfLu7.js');
3
+ var index = require('./index-DMfHwNdL.js');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  m.forEach(function (e) {
@@ -335,6 +335,7 @@ function enableDraggingWithScaling(element) {
335
335
  let mutationFlag = false;
336
336
  // Fetch the container element
337
337
  const container = document.getElementById(LidoContainer);
338
+ const templateId = container.getAttribute("template-id");
338
339
  if (!container) {
339
340
  console.error(`Container with ID "container" not found.`);
340
341
  return;
@@ -489,11 +490,14 @@ function enableDraggingWithScaling(element) {
489
490
  const dropObject = buildDragSelectedMapFromDOM();
490
491
  const storedTabIndexes = Object.keys(dropObject).map(Number);
491
492
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
492
- if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
493
+ if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) && container.getAttribute("template-id") !== "blender") {
493
494
  if (otherElement) {
494
495
  otherElement.style.opacity = "0.3";
495
496
  }
496
497
  }
498
+ if (otherElement !== mostOverlappedElement) {
499
+ otherElement.style.opacity = "1";
500
+ }
497
501
  }
498
502
  else {
499
503
  if (otherElement) {
@@ -564,6 +568,13 @@ function enableDraggingWithScaling(element) {
564
568
  return;
565
569
  }
566
570
  onElementDropComplete(element, mostOverlappedElement);
571
+ if (templateId === "blender" && element && mostOverlappedElement) {
572
+ const allElements = document.querySelectorAll(`*`);
573
+ allElements.forEach(el => {
574
+ removeHighlight(el);
575
+ });
576
+ mostOverlappedElement.classList.add("highlight-element");
577
+ }
567
578
  executeActions("this.updateCountBlender='true'", container);
568
579
  if (((_b = element.getAttribute('dropAttr')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === DropMode.Diagonal) {
569
580
  if (mostOverlappedElement) {
@@ -1007,7 +1018,7 @@ function updateDropBorder(element) {
1007
1018
  }
1008
1019
  const dropId = element.id;
1009
1020
  const dragSelectedElements = document.querySelectorAll(`[${DropToAttr}="${dropId}"]`);
1010
- if (dragSelectedElements.length > 0) {
1021
+ if (dragSelectedElements.length > 0 && container.getAttribute("template-id") !== "blender") {
1011
1022
  element.classList.add('filled');
1012
1023
  element.classList.remove('empty');
1013
1024
  element.classList.remove('highlight-element');
@@ -1089,10 +1100,12 @@ async function onClickDropOrDragElement(element, type) {
1089
1100
  // Move the drag element to the drop position
1090
1101
  selectedDragElement.style.transform = `translate(${translateX}px, ${translateY}px)`;
1091
1102
  // Remove highlights after moving the element
1092
- const allElements = document.querySelectorAll(`*`);
1093
- allElements.forEach(el => {
1094
- removeHighlight(el);
1095
- });
1103
+ if (container.getAttribute("template-id") !== "blender") {
1104
+ const allElements = document.querySelectorAll(`*`);
1105
+ allElements.forEach(el => {
1106
+ removeHighlight(el);
1107
+ });
1108
+ }
1096
1109
  // await new Promise(resolve => setTimeout(resolve, 500));
1097
1110
  await onElementDropComplete(selectedDragElement, selectedDropElement);
1098
1111
  // ensure count update for click-to-drop flow
@@ -1280,6 +1293,8 @@ function stopHighlightForSpeakingElement(element) {
1280
1293
  }
1281
1294
  function highlightElement() {
1282
1295
  const container = document.querySelector(LidoContainer);
1296
+ if (container.getAttribute("template-id") === "blender")
1297
+ return;
1283
1298
  if (!container)
1284
1299
  return;
1285
1300
  const dropElements = buildDropHasDragFromDOM();
@@ -73660,14 +73675,30 @@ function placeElementInDropZone(dropElement, dragElement, orientation, dropAttr)
73660
73675
  targetY = startY + (dropCount * stepY);
73661
73676
  }
73662
73677
  // ------------ APPLY TRANSFORM SMOOTHLY --------------
73678
+ // reset size first so centering and final placement use the resized bounds
73679
+ dragElement.style.width = "auto";
73680
+ dragElement.style.height = "auto";
73681
+ // ------------ APPLY TRANSFORM SMOOTHLY --------------
73663
73682
  const dx = (targetX - dragRect.left) / scale;
73664
73683
  const dy = (targetY - dragRect.top) / scale;
73665
73684
  dragElement.style.transition = "transform .2s ease-out";
73666
73685
  dragElement.style.transform = `translate(${dx}px, ${dy}px)`;
73686
+ const resizedDragRect = dragElement.getBoundingClientRect();
73687
+ const dropCenterX = dropRect.left + dropWidth / 2;
73688
+ const dropCenterY = dropRect.top + dropHeight / 2;
73689
+ const resizedDragCenterX = resizedDragRect.left + resizedDragRect.width / 2;
73690
+ const resizedDragCenterY = resizedDragRect.top + resizedDragRect.height / 2;
73691
+ const centerDx = (dropCenterX - resizedDragCenterX) / scale;
73692
+ const centerDy = (dropCenterY - resizedDragCenterY) / scale;
73693
+ dragElement.style.transition = "none";
73694
+ dragElement.style.transform = `translate(${centerDx}px, ${centerDy}px)`;
73695
+ // Force the browser to apply the centered position before animating to the stack slot.
73696
+ dragElement.getBoundingClientRect();
73697
+ requestAnimationFrame(() => {
73698
+ dragElement.style.transition = "transform .2s ease-out";
73699
+ dragElement.style.transform = `translate(${dx}px, ${dy}px)`;
73700
+ });
73667
73701
  dropElement.dataset.dropCount = String(dropCount + 1);
73668
- // reset size
73669
- dragElement.style.width = "auto";
73670
- dragElement.style.height = "auto";
73671
73702
  }
73672
73703
  const updateCalculatorAnswer = (el) => {
73673
73704
  const container = document.getElementById(LidoContainer);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-qIQYfLu7.js');
3
+ var index = require('./index-DMfHwNdL.js');
4
4
  require('./index-Dl8SlqP-.js');
5
5
 
6
6
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-Dl8SlqP-.js');
4
- var index$1 = require('./index-qIQYfLu7.js');
4
+ var index$1 = require('./index-DMfHwNdL.js');
5
5
 
6
6
  var rive$1 = {exports: {}};
7
7
 
@@ -12874,7 +12874,7 @@ const LidoHome = class {
12874
12874
  }
12875
12875
  // Pure-JS fallback (no wasm asset required)
12876
12876
  try {
12877
- const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-BMS5SH1_.js'); }).then(function (n) { return n.decode; });
12877
+ const brotliDecodeModule = await Promise.resolve().then(function () { return require('./decode-afeNWInB.js'); }).then(function (n) { return n.decode; });
12878
12878
  const brotliDecompressBuffer = brotliDecodeModule.BrotliDecompressBuffer || ((_a = brotliDecodeModule.default) === null || _a === void 0 ? void 0 : _a.BrotliDecompressBuffer);
12879
12879
  if (typeof brotliDecompressBuffer !== 'function') {
12880
12880
  throw new Error('BrotliDecompressBuffer function not found in brotli/dec/decode');
@@ -1524,14 +1524,30 @@ function placeElementInDropZone(dropElement, dragElement, orientation, dropAttr)
1524
1524
  targetY = startY + (dropCount * stepY);
1525
1525
  }
1526
1526
  // ------------ APPLY TRANSFORM SMOOTHLY --------------
1527
+ // reset size first so centering and final placement use the resized bounds
1528
+ dragElement.style.width = "auto";
1529
+ dragElement.style.height = "auto";
1530
+ // ------------ APPLY TRANSFORM SMOOTHLY --------------
1527
1531
  const dx = (targetX - dragRect.left) / scale;
1528
1532
  const dy = (targetY - dragRect.top) / scale;
1529
1533
  dragElement.style.transition = "transform .2s ease-out";
1530
1534
  dragElement.style.transform = `translate(${dx}px, ${dy}px)`;
1535
+ const resizedDragRect = dragElement.getBoundingClientRect();
1536
+ const dropCenterX = dropRect.left + dropWidth / 2;
1537
+ const dropCenterY = dropRect.top + dropHeight / 2;
1538
+ const resizedDragCenterX = resizedDragRect.left + resizedDragRect.width / 2;
1539
+ const resizedDragCenterY = resizedDragRect.top + resizedDragRect.height / 2;
1540
+ const centerDx = (dropCenterX - resizedDragCenterX) / scale;
1541
+ const centerDy = (dropCenterY - resizedDragCenterY) / scale;
1542
+ dragElement.style.transition = "none";
1543
+ dragElement.style.transform = `translate(${centerDx}px, ${centerDy}px)`;
1544
+ // Force the browser to apply the centered position before animating to the stack slot.
1545
+ dragElement.getBoundingClientRect();
1546
+ requestAnimationFrame(() => {
1547
+ dragElement.style.transition = "transform .2s ease-out";
1548
+ dragElement.style.transform = `translate(${dx}px, ${dy}px)`;
1549
+ });
1531
1550
  dropElement.dataset.dropCount = String(dropCount + 1);
1532
- // reset size
1533
- dragElement.style.width = "auto";
1534
- dragElement.style.height = "auto";
1535
1551
  }
1536
1552
  export const updateCalculatorAnswer = (el) => {
1537
1553
  const container = document.getElementById(LidoContainer);
@@ -61,6 +61,7 @@ export function enableDraggingWithScaling(element) {
61
61
  let mutationFlag = false;
62
62
  // Fetch the container element
63
63
  const container = document.getElementById(LidoContainer);
64
+ const templateId = container.getAttribute("template-id");
64
65
  if (!container) {
65
66
  console.error(`Container with ID "container" not found.`);
66
67
  return;
@@ -221,11 +222,14 @@ export function enableDraggingWithScaling(element) {
221
222
  const dropObject = buildDragSelectedMapFromDOM();
222
223
  const storedTabIndexes = Object.keys(dropObject).map(Number);
223
224
  if (storedTabIndexes.includes(JSON.parse(otherElement.getAttribute('tab-index')))) {
224
- if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal)) {
225
+ if (!(((_a = element.getAttribute('dropAttr')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === DropMode.Diagonal) && container.getAttribute("template-id") !== "blender") {
225
226
  if (otherElement) {
226
227
  otherElement.style.opacity = "0.3";
227
228
  }
228
229
  }
230
+ if (otherElement !== mostOverlappedElement) {
231
+ otherElement.style.opacity = "1";
232
+ }
229
233
  }
230
234
  else {
231
235
  if (otherElement) {
@@ -296,6 +300,13 @@ export function enableDraggingWithScaling(element) {
296
300
  return;
297
301
  }
298
302
  onElementDropComplete(element, mostOverlappedElement);
303
+ if (templateId === "blender" && element && mostOverlappedElement) {
304
+ const allElements = document.querySelectorAll(`*`);
305
+ allElements.forEach(el => {
306
+ removeHighlight(el);
307
+ });
308
+ mostOverlappedElement.classList.add("highlight-element");
309
+ }
299
310
  executeActions("this.updateCountBlender='true'", container);
300
311
  if (((_b = element.getAttribute('dropAttr')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === DropMode.Diagonal) {
301
312
  if (mostOverlappedElement) {
@@ -740,7 +751,7 @@ export function updateDropBorder(element) {
740
751
  }
741
752
  const dropId = element.id;
742
753
  const dragSelectedElements = document.querySelectorAll(`[${DropToAttr}="${dropId}"]`);
743
- if (dragSelectedElements.length > 0) {
754
+ if (dragSelectedElements.length > 0 && container.getAttribute("template-id") !== "blender") {
744
755
  element.classList.add('filled');
745
756
  element.classList.remove('empty');
746
757
  element.classList.remove('highlight-element');
@@ -825,10 +836,12 @@ export async function onClickDropOrDragElement(element, type) {
825
836
  // Move the drag element to the drop position
826
837
  selectedDragElement.style.transform = `translate(${translateX}px, ${translateY}px)`;
827
838
  // Remove highlights after moving the element
828
- const allElements = document.querySelectorAll(`*`);
829
- allElements.forEach(el => {
830
- removeHighlight(el);
831
- });
839
+ if (container.getAttribute("template-id") !== "blender") {
840
+ const allElements = document.querySelectorAll(`*`);
841
+ allElements.forEach(el => {
842
+ removeHighlight(el);
843
+ });
844
+ }
832
845
  // await new Promise(resolve => setTimeout(resolve, 500));
833
846
  await onElementDropComplete(selectedDragElement, selectedDropElement);
834
847
  // ensure count update for click-to-drop flow
@@ -105,6 +105,8 @@ export function stopHighlightForSpeakingElement(element) {
105
105
  }
106
106
  export function highlightElement() {
107
107
  const container = document.querySelector(LidoContainer);
108
+ if (container.getAttribute("template-id") === "blender")
109
+ return;
108
110
  if (!container)
109
111
  return;
110
112
  const dropElements = buildDropHasDragFromDOM();