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/esm/index.js CHANGED
@@ -4432,13 +4432,14 @@ function createFloatingButtonWithIframe({
4432
4432
  position: "fixed",
4433
4433
  bottom: `${bottom}px`,
4434
4434
  right: `${right}px`,
4435
- zIndex: "100000",
4435
+ zIndex: "2147483647",
4436
4436
  width: "60px",
4437
4437
  height: "60px",
4438
4438
  cursor: "grab",
4439
4439
  transition: "transform 0.15s ease",
4440
4440
  userSelect: "none",
4441
- touchAction: "none"
4441
+ touchAction: "none",
4442
+ pointerEvents: "auto"
4442
4443
  });
4443
4444
  document.body.appendChild(button);
4444
4445
  updateIframePosition(iframe, right, bottom, windowWidth, windowHeight);
@@ -4447,40 +4448,71 @@ function createFloatingButtonWithIframe({
4447
4448
  let startY = 0;
4448
4449
  let initialRight = 0;
4449
4450
  let initialBottom = 0;
4450
- let dragStartTime = 0;
4451
- button.addEventListener("mousedown", (e) => {
4451
+ let isLongPress = false;
4452
+ button.addEventListener(
4453
+ "click",
4454
+ (e) => {
4455
+ if (isLongPress) {
4456
+ isLongPress = false;
4457
+ return;
4458
+ }
4459
+ handleButtonClick();
4460
+ e.preventDefault();
4461
+ e.stopPropagation();
4462
+ },
4463
+ { capture: true }
4464
+ );
4465
+ const handleMouseDown = (e) => {
4452
4466
  startDrag(e.clientX, e.clientY);
4453
4467
  e.preventDefault();
4454
- });
4455
- button.addEventListener("touchstart", (e) => {
4468
+ e.stopPropagation();
4469
+ };
4470
+ const handleTouchStart = (e) => {
4456
4471
  if (e.touches.length === 1) {
4457
4472
  const touch = e.touches[0];
4458
4473
  startDrag(touch.clientX, touch.clientY);
4459
4474
  e.preventDefault();
4475
+ e.stopPropagation();
4460
4476
  }
4461
- });
4477
+ };
4478
+ button.addEventListener("mousedown", handleMouseDown, { capture: true });
4479
+ button.addEventListener("touchstart", handleTouchStart, { capture: true });
4462
4480
  function startDrag(clientX, clientY) {
4463
4481
  isDragging = true;
4464
4482
  startX = clientX;
4465
4483
  startY = clientY;
4466
4484
  initialRight = parseInt(button.style.right);
4467
4485
  initialBottom = parseInt(button.style.bottom);
4468
- dragStartTime = Date.now();
4469
4486
  button.style.cursor = "grabbing";
4470
4487
  button.style.transition = "none";
4471
4488
  }
4472
- document.addEventListener("mousemove", (e) => {
4489
+ const handleMouseMove = (e) => {
4473
4490
  if (!isDragging)
4474
4491
  return;
4492
+ const deltaX = Math.abs(startX - e.clientX);
4493
+ const deltaY = Math.abs(startY - e.clientY);
4494
+ if (deltaX > 5 || deltaY > 5) {
4495
+ isLongPress = true;
4496
+ }
4475
4497
  moveButton(e.clientX, e.clientY);
4476
- });
4477
- document.addEventListener("touchmove", (e) => {
4498
+ e.preventDefault();
4499
+ e.stopPropagation();
4500
+ };
4501
+ const handleTouchMove = (e) => {
4478
4502
  if (!isDragging || e.touches.length !== 1)
4479
4503
  return;
4480
4504
  const touch = e.touches[0];
4505
+ const deltaX = Math.abs(startX - touch.clientX);
4506
+ const deltaY = Math.abs(startY - touch.clientY);
4507
+ if (deltaX > 5 || deltaY > 5) {
4508
+ isLongPress = true;
4509
+ }
4481
4510
  moveButton(touch.clientX, touch.clientY);
4482
4511
  e.preventDefault();
4483
- });
4512
+ e.stopPropagation();
4513
+ };
4514
+ document.addEventListener("mousemove", handleMouseMove, { capture: true });
4515
+ document.addEventListener("touchmove", handleTouchMove, { capture: true });
4484
4516
  function moveButton(clientX, clientY) {
4485
4517
  const deltaX = startX - clientX;
4486
4518
  const deltaY = startY - clientY;
@@ -4504,20 +4536,26 @@ function createFloatingButtonWithIframe({
4504
4536
  button.style.bottom = `${newBottom}px`;
4505
4537
  updateIframePosition(iframe, newRight, newBottom, windowWidth, windowHeight);
4506
4538
  }
4507
- document.addEventListener("mouseup", () => {
4508
- endDrag();
4509
- });
4510
- document.addEventListener("touchend", () => {
4539
+ const handleMouseUp = (e) => {
4540
+ if (isDragging) {
4541
+ e.preventDefault();
4542
+ e.stopPropagation();
4543
+ }
4511
4544
  endDrag();
4512
- });
4513
- document.addEventListener("touchcancel", () => {
4545
+ };
4546
+ const handleTouchEnd = (e) => {
4547
+ if (isDragging) {
4548
+ e.preventDefault();
4549
+ e.stopPropagation();
4550
+ }
4514
4551
  endDrag();
4515
- });
4552
+ };
4553
+ document.addEventListener("mouseup", handleMouseUp, { capture: true });
4554
+ document.addEventListener("touchend", handleTouchEnd, { capture: true });
4555
+ document.addEventListener("touchcancel", handleTouchEnd, { capture: true });
4516
4556
  function endDrag() {
4517
4557
  if (!isDragging)
4518
4558
  return;
4519
- const dragEndTime = Date.now();
4520
- const isDragEvent = dragEndTime - dragStartTime > 200;
4521
4559
  isDragging = false;
4522
4560
  button.style.cursor = "grab";
4523
4561
  button.style.transition = "transform 0.15s ease";
@@ -4525,9 +4563,6 @@ function createFloatingButtonWithIframe({
4525
4563
  right: button.style.right,
4526
4564
  bottom: button.style.bottom
4527
4565
  });
4528
- if (!isDragEvent) {
4529
- handleButtonClick();
4530
- }
4531
4566
  }
4532
4567
  const handleButtonClick = () => {
4533
4568
  const isCurrentlyVisible = iframe.style.display === "block";
@@ -4562,11 +4597,12 @@ function createIframe({
4562
4597
  position: "fixed",
4563
4598
  bottom: "90px",
4564
4599
  right: "20px",
4565
- zIndex: "100000",
4600
+ zIndex: "2147483646",
4566
4601
  boxShadow: "0 0 10px rgba(0, 0, 0, 0.1)",
4567
4602
  borderRadius: "10px",
4568
4603
  display: isVisible ? "block" : "none",
4569
- border: "none"
4604
+ border: "none",
4605
+ pointerEvents: "auto"
4570
4606
  }, iframeStyle));
4571
4607
  document.body.appendChild(iframe);
4572
4608
  return iframe;
@@ -5080,7 +5116,7 @@ function getGroup(state) {
5080
5116
 
5081
5117
  // src/index.ts
5082
5118
  var getVersion = () => {
5083
- return "0.5.56-beta";
5119
+ return "0.5.58-beta";
5084
5120
  };
5085
5121
  if (typeof window !== "undefined") {
5086
5122
  window.__BTC_WALLET_VERSION = getVersion();