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/dist/index.js
CHANGED
@@ -4461,7 +4461,7 @@ function setupWalletButton({
|
|
4461
4461
|
}
|
4462
4462
|
const iframe = createIframe({
|
4463
4463
|
iframeUrl: walletUrl || walletConfig[env].walletUrl,
|
4464
|
-
iframeStyle: { width: "400px", height: "650px" }
|
4464
|
+
iframeStyle: isMobile() ? { width: "calc(100% - 40px)", height: "80%" } : { width: "400px", height: "650px" }
|
4465
4465
|
});
|
4466
4466
|
iframe.addEventListener("mouseenter", () => {
|
4467
4467
|
var _a;
|
@@ -4502,15 +4502,20 @@ function createFloatingButtonWithIframe({
|
|
4502
4502
|
position: "fixed",
|
4503
4503
|
bottom: `${bottom}px`,
|
4504
4504
|
right: `${right}px`,
|
4505
|
-
zIndex: "
|
4505
|
+
zIndex: "100000",
|
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"
|
4512
|
-
pointerEvents: "auto"
|
4511
|
+
touchAction: "none"
|
4513
4512
|
});
|
4513
|
+
if (isMobile()) {
|
4514
|
+
Object.assign(button.style, {
|
4515
|
+
width: "40px",
|
4516
|
+
height: "40px"
|
4517
|
+
});
|
4518
|
+
}
|
4514
4519
|
document.body.appendChild(button);
|
4515
4520
|
updateIframePosition(iframe, right, bottom, windowWidth, windowHeight);
|
4516
4521
|
let isDragging = false;
|
@@ -4519,21 +4524,6 @@ function createFloatingButtonWithIframe({
|
|
4519
4524
|
let initialRight = 0;
|
4520
4525
|
let initialBottom = 0;
|
4521
4526
|
let dragStartTime = 0;
|
4522
|
-
const handleMouseDown = (e) => {
|
4523
|
-
startDrag(e.clientX, e.clientY);
|
4524
|
-
e.preventDefault();
|
4525
|
-
e.stopPropagation();
|
4526
|
-
};
|
4527
|
-
const handleTouchStart = (e) => {
|
4528
|
-
if (e.touches.length === 1) {
|
4529
|
-
const touch = e.touches[0];
|
4530
|
-
startDrag(touch.clientX, touch.clientY);
|
4531
|
-
e.preventDefault();
|
4532
|
-
e.stopPropagation();
|
4533
|
-
}
|
4534
|
-
};
|
4535
|
-
button.addEventListener("mousedown", handleMouseDown, { capture: true });
|
4536
|
-
button.addEventListener("touchstart", handleTouchStart, { capture: true });
|
4537
4527
|
function startDrag(clientX, clientY) {
|
4538
4528
|
isDragging = true;
|
4539
4529
|
startX = clientX;
|
@@ -4544,23 +4534,75 @@ function createFloatingButtonWithIframe({
|
|
4544
4534
|
button.style.cursor = "grabbing";
|
4545
4535
|
button.style.transition = "none";
|
4546
4536
|
}
|
4547
|
-
|
4548
|
-
|
4549
|
-
|
4550
|
-
|
4551
|
-
|
4552
|
-
|
4553
|
-
|
4554
|
-
|
4555
|
-
|
4556
|
-
|
4557
|
-
|
4558
|
-
|
4559
|
-
|
4560
|
-
|
4561
|
-
|
4562
|
-
|
4563
|
-
|
4537
|
+
function toggleWallet() {
|
4538
|
+
const isCurrentlyVisible = iframe.style.display === "block";
|
4539
|
+
button.style.transform = "scale(0.8)";
|
4540
|
+
setTimeout(() => {
|
4541
|
+
button.style.transform = "scale(1)";
|
4542
|
+
}, 150);
|
4543
|
+
const newVisibleState = !isCurrentlyVisible;
|
4544
|
+
iframe.style.display = newVisibleState ? "block" : "none";
|
4545
|
+
button.src = newVisibleState ? closeImageUrl : openImageUrl;
|
4546
|
+
storage4 == null ? void 0 : storage4.set("visible", newVisibleState);
|
4547
|
+
setTimeout(() => {
|
4548
|
+
if (newVisibleState) {
|
4549
|
+
iframe.focus();
|
4550
|
+
}
|
4551
|
+
}, 0);
|
4552
|
+
}
|
4553
|
+
button.addEventListener(
|
4554
|
+
"click",
|
4555
|
+
(e) => {
|
4556
|
+
if (!isDragging) {
|
4557
|
+
toggleWallet();
|
4558
|
+
}
|
4559
|
+
e.preventDefault();
|
4560
|
+
e.stopPropagation();
|
4561
|
+
},
|
4562
|
+
{ capture: true }
|
4563
|
+
);
|
4564
|
+
button.addEventListener(
|
4565
|
+
"mousedown",
|
4566
|
+
(e) => {
|
4567
|
+
startDrag(e.clientX, e.clientY);
|
4568
|
+
e.preventDefault();
|
4569
|
+
e.stopPropagation();
|
4570
|
+
},
|
4571
|
+
{ capture: true }
|
4572
|
+
);
|
4573
|
+
button.addEventListener(
|
4574
|
+
"touchstart",
|
4575
|
+
(e) => {
|
4576
|
+
if (e.touches.length === 1) {
|
4577
|
+
const touch = e.touches[0];
|
4578
|
+
startDrag(touch.clientX, touch.clientY);
|
4579
|
+
e.preventDefault();
|
4580
|
+
e.stopPropagation();
|
4581
|
+
}
|
4582
|
+
},
|
4583
|
+
{ capture: true }
|
4584
|
+
);
|
4585
|
+
document.addEventListener(
|
4586
|
+
"mousemove",
|
4587
|
+
(e) => {
|
4588
|
+
if (!isDragging)
|
4589
|
+
return;
|
4590
|
+
moveButton(e.clientX, e.clientY);
|
4591
|
+
e.preventDefault();
|
4592
|
+
},
|
4593
|
+
{ capture: true }
|
4594
|
+
);
|
4595
|
+
document.addEventListener(
|
4596
|
+
"touchmove",
|
4597
|
+
(e) => {
|
4598
|
+
if (!isDragging || e.touches.length !== 1)
|
4599
|
+
return;
|
4600
|
+
const touch = e.touches[0];
|
4601
|
+
moveButton(touch.clientX, touch.clientY);
|
4602
|
+
e.preventDefault();
|
4603
|
+
},
|
4604
|
+
{ capture: true }
|
4605
|
+
);
|
4564
4606
|
function moveButton(clientX, clientY) {
|
4565
4607
|
const deltaX = startX - clientX;
|
4566
4608
|
const deltaY = startY - clientY;
|
@@ -4584,28 +4626,43 @@ function createFloatingButtonWithIframe({
|
|
4584
4626
|
button.style.bottom = `${newBottom}px`;
|
4585
4627
|
updateIframePosition(iframe, newRight, newBottom, windowWidth, windowHeight);
|
4586
4628
|
}
|
4587
|
-
|
4588
|
-
|
4589
|
-
|
4590
|
-
|
4591
|
-
|
4592
|
-
|
4593
|
-
|
4594
|
-
|
4595
|
-
|
4596
|
-
|
4597
|
-
|
4598
|
-
|
4599
|
-
|
4600
|
-
|
4601
|
-
|
4602
|
-
|
4603
|
-
|
4629
|
+
document.addEventListener(
|
4630
|
+
"mouseup",
|
4631
|
+
(e) => {
|
4632
|
+
if (isDragging) {
|
4633
|
+
e.preventDefault();
|
4634
|
+
e.stopPropagation();
|
4635
|
+
}
|
4636
|
+
endDrag();
|
4637
|
+
},
|
4638
|
+
{ capture: true }
|
4639
|
+
);
|
4640
|
+
document.addEventListener(
|
4641
|
+
"touchend",
|
4642
|
+
(e) => {
|
4643
|
+
if (isDragging) {
|
4644
|
+
e.preventDefault();
|
4645
|
+
e.stopPropagation();
|
4646
|
+
}
|
4647
|
+
endDrag();
|
4648
|
+
const dragEndTime = Date.now();
|
4649
|
+
const dragDuration = dragEndTime - dragStartTime;
|
4650
|
+
if (dragDuration < 200 && Math.abs(parseInt(button.style.right) - initialRight) < 5 && Math.abs(parseInt(button.style.bottom) - initialBottom) < 5) {
|
4651
|
+
toggleWallet();
|
4652
|
+
}
|
4653
|
+
},
|
4654
|
+
{ capture: true }
|
4655
|
+
);
|
4656
|
+
document.addEventListener(
|
4657
|
+
"touchcancel",
|
4658
|
+
() => {
|
4659
|
+
endDrag();
|
4660
|
+
},
|
4661
|
+
{ capture: true }
|
4662
|
+
);
|
4604
4663
|
function endDrag() {
|
4605
4664
|
if (!isDragging)
|
4606
4665
|
return;
|
4607
|
-
const dragEndTime = Date.now();
|
4608
|
-
const isDragEvent = dragEndTime - dragStartTime > 200;
|
4609
4666
|
isDragging = false;
|
4610
4667
|
button.style.cursor = "grab";
|
4611
4668
|
button.style.transition = "transform 0.15s ease";
|
@@ -4613,25 +4670,8 @@ function createFloatingButtonWithIframe({
|
|
4613
4670
|
right: button.style.right,
|
4614
4671
|
bottom: button.style.bottom
|
4615
4672
|
});
|
4616
|
-
if (!isDragEvent) {
|
4617
|
-
handleButtonClick();
|
4618
|
-
}
|
4619
4673
|
}
|
4620
4674
|
const handleButtonClick = () => {
|
4621
|
-
const isCurrentlyVisible = iframe.style.display === "block";
|
4622
|
-
button.style.transform = "scale(0.8)";
|
4623
|
-
setTimeout(() => {
|
4624
|
-
button.style.transform = "scale(1)";
|
4625
|
-
}, 150);
|
4626
|
-
const newVisibleState = !isCurrentlyVisible;
|
4627
|
-
iframe.style.display = newVisibleState ? "block" : "none";
|
4628
|
-
button.src = newVisibleState ? closeImageUrl : openImageUrl;
|
4629
|
-
storage4 == null ? void 0 : storage4.set("visible", newVisibleState);
|
4630
|
-
setTimeout(() => {
|
4631
|
-
if (newVisibleState) {
|
4632
|
-
iframe.focus();
|
4633
|
-
}
|
4634
|
-
}, 0);
|
4635
4675
|
};
|
4636
4676
|
button.onclick = null;
|
4637
4677
|
return button;
|
@@ -4650,12 +4690,11 @@ function createIframe({
|
|
4650
4690
|
position: "fixed",
|
4651
4691
|
bottom: "90px",
|
4652
4692
|
right: "20px",
|
4653
|
-
zIndex: "
|
4693
|
+
zIndex: "100000",
|
4654
4694
|
boxShadow: "0 0 10px rgba(0, 0, 0, 0.1)",
|
4655
4695
|
borderRadius: "10px",
|
4656
4696
|
display: isVisible ? "block" : "none",
|
4657
|
-
border: "none"
|
4658
|
-
pointerEvents: "auto"
|
4697
|
+
border: "none"
|
4659
4698
|
}, iframeStyle));
|
4660
4699
|
document.body.appendChild(iframe);
|
4661
4700
|
return iframe;
|
@@ -5167,7 +5206,7 @@ function getGroup(state) {
|
|
5167
5206
|
|
5168
5207
|
// src/index.ts
|
5169
5208
|
var getVersion = () => {
|
5170
|
-
return "0.5.
|
5209
|
+
return "0.5.59-beta";
|
5171
5210
|
};
|
5172
5211
|
if (typeof window !== "undefined") {
|
5173
5212
|
window.__BTC_WALLET_VERSION = getVersion();
|