btc-wallet 0.5.57-beta → 0.5.59-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 +115 -76
- package/dist/index.js.map +2 -2
- package/esm/index.js +115 -76
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
package/esm/index.js
CHANGED
@@ -4391,7 +4391,7 @@ function setupWalletButton({
|
|
4391
4391
|
}
|
4392
4392
|
const iframe = createIframe({
|
4393
4393
|
iframeUrl: walletUrl || walletConfig[env].walletUrl,
|
4394
|
-
iframeStyle: { width: "400px", height: "650px" }
|
4394
|
+
iframeStyle: isMobile() ? { width: "calc(100% - 40px)", height: "80%" } : { width: "400px", height: "650px" }
|
4395
4395
|
});
|
4396
4396
|
iframe.addEventListener("mouseenter", () => {
|
4397
4397
|
var _a;
|
@@ -4432,15 +4432,20 @@ function createFloatingButtonWithIframe({
|
|
4432
4432
|
position: "fixed",
|
4433
4433
|
bottom: `${bottom}px`,
|
4434
4434
|
right: `${right}px`,
|
4435
|
-
zIndex: "
|
4435
|
+
zIndex: "100000",
|
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"
|
4442
|
-
pointerEvents: "auto"
|
4441
|
+
touchAction: "none"
|
4443
4442
|
});
|
4443
|
+
if (isMobile()) {
|
4444
|
+
Object.assign(button.style, {
|
4445
|
+
width: "40px",
|
4446
|
+
height: "40px"
|
4447
|
+
});
|
4448
|
+
}
|
4444
4449
|
document.body.appendChild(button);
|
4445
4450
|
updateIframePosition(iframe, right, bottom, windowWidth, windowHeight);
|
4446
4451
|
let isDragging = false;
|
@@ -4449,21 +4454,6 @@ function createFloatingButtonWithIframe({
|
|
4449
4454
|
let initialRight = 0;
|
4450
4455
|
let initialBottom = 0;
|
4451
4456
|
let dragStartTime = 0;
|
4452
|
-
const handleMouseDown = (e) => {
|
4453
|
-
startDrag(e.clientX, e.clientY);
|
4454
|
-
e.preventDefault();
|
4455
|
-
e.stopPropagation();
|
4456
|
-
};
|
4457
|
-
const handleTouchStart = (e) => {
|
4458
|
-
if (e.touches.length === 1) {
|
4459
|
-
const touch = e.touches[0];
|
4460
|
-
startDrag(touch.clientX, touch.clientY);
|
4461
|
-
e.preventDefault();
|
4462
|
-
e.stopPropagation();
|
4463
|
-
}
|
4464
|
-
};
|
4465
|
-
button.addEventListener("mousedown", handleMouseDown, { capture: true });
|
4466
|
-
button.addEventListener("touchstart", handleTouchStart, { capture: true });
|
4467
4457
|
function startDrag(clientX, clientY) {
|
4468
4458
|
isDragging = true;
|
4469
4459
|
startX = clientX;
|
@@ -4474,23 +4464,75 @@ function createFloatingButtonWithIframe({
|
|
4474
4464
|
button.style.cursor = "grabbing";
|
4475
4465
|
button.style.transition = "none";
|
4476
4466
|
}
|
4477
|
-
|
4478
|
-
|
4479
|
-
|
4480
|
-
|
4481
|
-
|
4482
|
-
|
4483
|
-
|
4484
|
-
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
|
4489
|
-
|
4490
|
-
|
4491
|
-
|
4492
|
-
|
4493
|
-
|
4467
|
+
function toggleWallet() {
|
4468
|
+
const isCurrentlyVisible = iframe.style.display === "block";
|
4469
|
+
button.style.transform = "scale(0.8)";
|
4470
|
+
setTimeout(() => {
|
4471
|
+
button.style.transform = "scale(1)";
|
4472
|
+
}, 150);
|
4473
|
+
const newVisibleState = !isCurrentlyVisible;
|
4474
|
+
iframe.style.display = newVisibleState ? "block" : "none";
|
4475
|
+
button.src = newVisibleState ? closeImageUrl : openImageUrl;
|
4476
|
+
storage4 == null ? void 0 : storage4.set("visible", newVisibleState);
|
4477
|
+
setTimeout(() => {
|
4478
|
+
if (newVisibleState) {
|
4479
|
+
iframe.focus();
|
4480
|
+
}
|
4481
|
+
}, 0);
|
4482
|
+
}
|
4483
|
+
button.addEventListener(
|
4484
|
+
"click",
|
4485
|
+
(e) => {
|
4486
|
+
if (!isDragging) {
|
4487
|
+
toggleWallet();
|
4488
|
+
}
|
4489
|
+
e.preventDefault();
|
4490
|
+
e.stopPropagation();
|
4491
|
+
},
|
4492
|
+
{ capture: true }
|
4493
|
+
);
|
4494
|
+
button.addEventListener(
|
4495
|
+
"mousedown",
|
4496
|
+
(e) => {
|
4497
|
+
startDrag(e.clientX, e.clientY);
|
4498
|
+
e.preventDefault();
|
4499
|
+
e.stopPropagation();
|
4500
|
+
},
|
4501
|
+
{ capture: true }
|
4502
|
+
);
|
4503
|
+
button.addEventListener(
|
4504
|
+
"touchstart",
|
4505
|
+
(e) => {
|
4506
|
+
if (e.touches.length === 1) {
|
4507
|
+
const touch = e.touches[0];
|
4508
|
+
startDrag(touch.clientX, touch.clientY);
|
4509
|
+
e.preventDefault();
|
4510
|
+
e.stopPropagation();
|
4511
|
+
}
|
4512
|
+
},
|
4513
|
+
{ capture: true }
|
4514
|
+
);
|
4515
|
+
document.addEventListener(
|
4516
|
+
"mousemove",
|
4517
|
+
(e) => {
|
4518
|
+
if (!isDragging)
|
4519
|
+
return;
|
4520
|
+
moveButton(e.clientX, e.clientY);
|
4521
|
+
e.preventDefault();
|
4522
|
+
},
|
4523
|
+
{ capture: true }
|
4524
|
+
);
|
4525
|
+
document.addEventListener(
|
4526
|
+
"touchmove",
|
4527
|
+
(e) => {
|
4528
|
+
if (!isDragging || e.touches.length !== 1)
|
4529
|
+
return;
|
4530
|
+
const touch = e.touches[0];
|
4531
|
+
moveButton(touch.clientX, touch.clientY);
|
4532
|
+
e.preventDefault();
|
4533
|
+
},
|
4534
|
+
{ capture: true }
|
4535
|
+
);
|
4494
4536
|
function moveButton(clientX, clientY) {
|
4495
4537
|
const deltaX = startX - clientX;
|
4496
4538
|
const deltaY = startY - clientY;
|
@@ -4514,28 +4556,43 @@ function createFloatingButtonWithIframe({
|
|
4514
4556
|
button.style.bottom = `${newBottom}px`;
|
4515
4557
|
updateIframePosition(iframe, newRight, newBottom, windowWidth, windowHeight);
|
4516
4558
|
}
|
4517
|
-
|
4518
|
-
|
4519
|
-
|
4520
|
-
|
4521
|
-
|
4522
|
-
|
4523
|
-
|
4524
|
-
|
4525
|
-
|
4526
|
-
|
4527
|
-
|
4528
|
-
|
4529
|
-
|
4530
|
-
|
4531
|
-
|
4532
|
-
|
4533
|
-
|
4559
|
+
document.addEventListener(
|
4560
|
+
"mouseup",
|
4561
|
+
(e) => {
|
4562
|
+
if (isDragging) {
|
4563
|
+
e.preventDefault();
|
4564
|
+
e.stopPropagation();
|
4565
|
+
}
|
4566
|
+
endDrag();
|
4567
|
+
},
|
4568
|
+
{ capture: true }
|
4569
|
+
);
|
4570
|
+
document.addEventListener(
|
4571
|
+
"touchend",
|
4572
|
+
(e) => {
|
4573
|
+
if (isDragging) {
|
4574
|
+
e.preventDefault();
|
4575
|
+
e.stopPropagation();
|
4576
|
+
}
|
4577
|
+
endDrag();
|
4578
|
+
const dragEndTime = Date.now();
|
4579
|
+
const dragDuration = dragEndTime - dragStartTime;
|
4580
|
+
if (dragDuration < 200 && Math.abs(parseInt(button.style.right) - initialRight) < 5 && Math.abs(parseInt(button.style.bottom) - initialBottom) < 5) {
|
4581
|
+
toggleWallet();
|
4582
|
+
}
|
4583
|
+
},
|
4584
|
+
{ capture: true }
|
4585
|
+
);
|
4586
|
+
document.addEventListener(
|
4587
|
+
"touchcancel",
|
4588
|
+
() => {
|
4589
|
+
endDrag();
|
4590
|
+
},
|
4591
|
+
{ capture: true }
|
4592
|
+
);
|
4534
4593
|
function endDrag() {
|
4535
4594
|
if (!isDragging)
|
4536
4595
|
return;
|
4537
|
-
const dragEndTime = Date.now();
|
4538
|
-
const isDragEvent = dragEndTime - dragStartTime > 200;
|
4539
4596
|
isDragging = false;
|
4540
4597
|
button.style.cursor = "grab";
|
4541
4598
|
button.style.transition = "transform 0.15s ease";
|
@@ -4543,25 +4600,8 @@ function createFloatingButtonWithIframe({
|
|
4543
4600
|
right: button.style.right,
|
4544
4601
|
bottom: button.style.bottom
|
4545
4602
|
});
|
4546
|
-
if (!isDragEvent) {
|
4547
|
-
handleButtonClick();
|
4548
|
-
}
|
4549
4603
|
}
|
4550
4604
|
const handleButtonClick = () => {
|
4551
|
-
const isCurrentlyVisible = iframe.style.display === "block";
|
4552
|
-
button.style.transform = "scale(0.8)";
|
4553
|
-
setTimeout(() => {
|
4554
|
-
button.style.transform = "scale(1)";
|
4555
|
-
}, 150);
|
4556
|
-
const newVisibleState = !isCurrentlyVisible;
|
4557
|
-
iframe.style.display = newVisibleState ? "block" : "none";
|
4558
|
-
button.src = newVisibleState ? closeImageUrl : openImageUrl;
|
4559
|
-
storage4 == null ? void 0 : storage4.set("visible", newVisibleState);
|
4560
|
-
setTimeout(() => {
|
4561
|
-
if (newVisibleState) {
|
4562
|
-
iframe.focus();
|
4563
|
-
}
|
4564
|
-
}, 0);
|
4565
4605
|
};
|
4566
4606
|
button.onclick = null;
|
4567
4607
|
return button;
|
@@ -4580,12 +4620,11 @@ function createIframe({
|
|
4580
4620
|
position: "fixed",
|
4581
4621
|
bottom: "90px",
|
4582
4622
|
right: "20px",
|
4583
|
-
zIndex: "
|
4623
|
+
zIndex: "100000",
|
4584
4624
|
boxShadow: "0 0 10px rgba(0, 0, 0, 0.1)",
|
4585
4625
|
borderRadius: "10px",
|
4586
4626
|
display: isVisible ? "block" : "none",
|
4587
|
-
border: "none"
|
4588
|
-
pointerEvents: "auto"
|
4627
|
+
border: "none"
|
4589
4628
|
}, iframeStyle));
|
4590
4629
|
document.body.appendChild(iframe);
|
4591
4630
|
return iframe;
|
@@ -5099,7 +5138,7 @@ function getGroup(state) {
|
|
5099
5138
|
|
5100
5139
|
// src/index.ts
|
5101
5140
|
var getVersion = () => {
|
5102
|
-
return "0.5.
|
5141
|
+
return "0.5.59-beta";
|
5103
5142
|
};
|
5104
5143
|
if (typeof window !== "undefined") {
|
5105
5144
|
window.__BTC_WALLET_VERSION = getVersion();
|