btc-wallet 0.5.56-beta → 0.5.58-beta

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.
package/dist/index.js CHANGED
@@ -4502,13 +4502,14 @@ function createFloatingButtonWithIframe({
4502
4502
  position: "fixed",
4503
4503
  bottom: `${bottom}px`,
4504
4504
  right: `${right}px`,
4505
- zIndex: "100000",
4505
+ zIndex: "2147483647",
4506
4506
  width: "60px",
4507
4507
  height: "60px",
4508
4508
  cursor: "grab",
4509
4509
  transition: "transform 0.15s ease",
4510
4510
  userSelect: "none",
4511
- touchAction: "none"
4511
+ touchAction: "none",
4512
+ pointerEvents: "auto"
4512
4513
  });
4513
4514
  document.body.appendChild(button);
4514
4515
  updateIframePosition(iframe, right, bottom, windowWidth, windowHeight);
@@ -4517,40 +4518,71 @@ function createFloatingButtonWithIframe({
4517
4518
  let startY = 0;
4518
4519
  let initialRight = 0;
4519
4520
  let initialBottom = 0;
4520
- let dragStartTime = 0;
4521
- button.addEventListener("mousedown", (e) => {
4521
+ let isLongPress = false;
4522
+ button.addEventListener(
4523
+ "click",
4524
+ (e) => {
4525
+ if (isLongPress) {
4526
+ isLongPress = false;
4527
+ return;
4528
+ }
4529
+ handleButtonClick();
4530
+ e.preventDefault();
4531
+ e.stopPropagation();
4532
+ },
4533
+ { capture: true }
4534
+ );
4535
+ const handleMouseDown = (e) => {
4522
4536
  startDrag(e.clientX, e.clientY);
4523
4537
  e.preventDefault();
4524
- });
4525
- button.addEventListener("touchstart", (e) => {
4538
+ e.stopPropagation();
4539
+ };
4540
+ const handleTouchStart = (e) => {
4526
4541
  if (e.touches.length === 1) {
4527
4542
  const touch = e.touches[0];
4528
4543
  startDrag(touch.clientX, touch.clientY);
4529
4544
  e.preventDefault();
4545
+ e.stopPropagation();
4530
4546
  }
4531
- });
4547
+ };
4548
+ button.addEventListener("mousedown", handleMouseDown, { capture: true });
4549
+ button.addEventListener("touchstart", handleTouchStart, { capture: true });
4532
4550
  function startDrag(clientX, clientY) {
4533
4551
  isDragging = true;
4534
4552
  startX = clientX;
4535
4553
  startY = clientY;
4536
4554
  initialRight = parseInt(button.style.right);
4537
4555
  initialBottom = parseInt(button.style.bottom);
4538
- dragStartTime = Date.now();
4539
4556
  button.style.cursor = "grabbing";
4540
4557
  button.style.transition = "none";
4541
4558
  }
4542
- document.addEventListener("mousemove", (e) => {
4559
+ const handleMouseMove = (e) => {
4543
4560
  if (!isDragging)
4544
4561
  return;
4562
+ const deltaX = Math.abs(startX - e.clientX);
4563
+ const deltaY = Math.abs(startY - e.clientY);
4564
+ if (deltaX > 5 || deltaY > 5) {
4565
+ isLongPress = true;
4566
+ }
4545
4567
  moveButton(e.clientX, e.clientY);
4546
- });
4547
- document.addEventListener("touchmove", (e) => {
4568
+ e.preventDefault();
4569
+ e.stopPropagation();
4570
+ };
4571
+ const handleTouchMove = (e) => {
4548
4572
  if (!isDragging || e.touches.length !== 1)
4549
4573
  return;
4550
4574
  const touch = e.touches[0];
4575
+ const deltaX = Math.abs(startX - touch.clientX);
4576
+ const deltaY = Math.abs(startY - touch.clientY);
4577
+ if (deltaX > 5 || deltaY > 5) {
4578
+ isLongPress = true;
4579
+ }
4551
4580
  moveButton(touch.clientX, touch.clientY);
4552
4581
  e.preventDefault();
4553
- });
4582
+ e.stopPropagation();
4583
+ };
4584
+ document.addEventListener("mousemove", handleMouseMove, { capture: true });
4585
+ document.addEventListener("touchmove", handleTouchMove, { capture: true });
4554
4586
  function moveButton(clientX, clientY) {
4555
4587
  const deltaX = startX - clientX;
4556
4588
  const deltaY = startY - clientY;
@@ -4574,20 +4606,26 @@ function createFloatingButtonWithIframe({
4574
4606
  button.style.bottom = `${newBottom}px`;
4575
4607
  updateIframePosition(iframe, newRight, newBottom, windowWidth, windowHeight);
4576
4608
  }
4577
- document.addEventListener("mouseup", () => {
4578
- endDrag();
4579
- });
4580
- document.addEventListener("touchend", () => {
4609
+ const handleMouseUp = (e) => {
4610
+ if (isDragging) {
4611
+ e.preventDefault();
4612
+ e.stopPropagation();
4613
+ }
4581
4614
  endDrag();
4582
- });
4583
- document.addEventListener("touchcancel", () => {
4615
+ };
4616
+ const handleTouchEnd = (e) => {
4617
+ if (isDragging) {
4618
+ e.preventDefault();
4619
+ e.stopPropagation();
4620
+ }
4584
4621
  endDrag();
4585
- });
4622
+ };
4623
+ document.addEventListener("mouseup", handleMouseUp, { capture: true });
4624
+ document.addEventListener("touchend", handleTouchEnd, { capture: true });
4625
+ document.addEventListener("touchcancel", handleTouchEnd, { capture: true });
4586
4626
  function endDrag() {
4587
4627
  if (!isDragging)
4588
4628
  return;
4589
- const dragEndTime = Date.now();
4590
- const isDragEvent = dragEndTime - dragStartTime > 200;
4591
4629
  isDragging = false;
4592
4630
  button.style.cursor = "grab";
4593
4631
  button.style.transition = "transform 0.15s ease";
@@ -4595,9 +4633,6 @@ function createFloatingButtonWithIframe({
4595
4633
  right: button.style.right,
4596
4634
  bottom: button.style.bottom
4597
4635
  });
4598
- if (!isDragEvent) {
4599
- handleButtonClick();
4600
- }
4601
4636
  }
4602
4637
  const handleButtonClick = () => {
4603
4638
  const isCurrentlyVisible = iframe.style.display === "block";
@@ -4632,11 +4667,12 @@ function createIframe({
4632
4667
  position: "fixed",
4633
4668
  bottom: "90px",
4634
4669
  right: "20px",
4635
- zIndex: "100000",
4670
+ zIndex: "2147483646",
4636
4671
  boxShadow: "0 0 10px rgba(0, 0, 0, 0.1)",
4637
4672
  borderRadius: "10px",
4638
4673
  display: isVisible ? "block" : "none",
4639
- border: "none"
4674
+ border: "none",
4675
+ pointerEvents: "auto"
4640
4676
  }, iframeStyle));
4641
4677
  document.body.appendChild(iframe);
4642
4678
  return iframe;
@@ -5148,7 +5184,7 @@ function getGroup(state) {
5148
5184
 
5149
5185
  // src/index.ts
5150
5186
  var getVersion = () => {
5151
- return "0.5.56-beta";
5187
+ return "0.5.58-beta";
5152
5188
  };
5153
5189
  if (typeof window !== "undefined") {
5154
5190
  window.__BTC_WALLET_VERSION = getVersion();