advaisor-chatbot 1.2.0 → 1.3.0
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/testchatbot.js +34 -13
- package/package.json +1 -1
package/dist/testchatbot.js
CHANGED
|
@@ -1443,10 +1443,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
1443
1443
|
border-radius: 12px;
|
|
1444
1444
|
width: 400px;
|
|
1445
1445
|
max-width: 90vw;
|
|
1446
|
-
height:
|
|
1446
|
+
height: 85vh;
|
|
1447
1447
|
overflow: hidden;
|
|
1448
|
-
min-width:
|
|
1449
|
-
min-height:
|
|
1448
|
+
min-width: min(300px, 85vw);
|
|
1449
|
+
min-height: min(450px, 85vw);
|
|
1450
1450
|
transition: width 0.2s ease, height 0.2s ease;
|
|
1451
1451
|
}
|
|
1452
1452
|
|
|
@@ -1570,6 +1570,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
1570
1570
|
.header {
|
|
1571
1571
|
cursor: move;
|
|
1572
1572
|
user-select: none;
|
|
1573
|
+
touch-action: none;
|
|
1573
1574
|
}
|
|
1574
1575
|
|
|
1575
1576
|
.history-btn {
|
|
@@ -1746,30 +1747,50 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
1746
1747
|
let isDragging = false;
|
|
1747
1748
|
let offsetX = 0;
|
|
1748
1749
|
let offsetY = 0;
|
|
1749
|
-
|
|
1750
|
+
function getEventPosition(e) {
|
|
1751
|
+
if (e.touches && e.touches.length > 0) {
|
|
1752
|
+
return {
|
|
1753
|
+
x: e.touches[0].clientX,
|
|
1754
|
+
y: e.touches[0].clientY
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1757
|
+
return {
|
|
1758
|
+
x: e.clientX,
|
|
1759
|
+
y: e.clientY
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
function startDrag(e) {
|
|
1750
1763
|
isDragging = true;
|
|
1764
|
+
const pos = getEventPosition(e);
|
|
1751
1765
|
const rect = windowEl.getBoundingClientRect();
|
|
1752
|
-
offsetX =
|
|
1753
|
-
offsetY =
|
|
1766
|
+
offsetX = pos.x - rect.left;
|
|
1767
|
+
offsetY = pos.y - rect.top;
|
|
1754
1768
|
windowEl.style.right = "auto";
|
|
1755
1769
|
windowEl.style.bottom = "auto";
|
|
1756
1770
|
windowEl.style.left = rect.left + "px";
|
|
1757
1771
|
windowEl.style.top = rect.top + "px";
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1772
|
+
}
|
|
1773
|
+
header.addEventListener("mousedown", startDrag);
|
|
1774
|
+
header.addEventListener("touchstart", startDrag);
|
|
1775
|
+
function onDrag(e) {
|
|
1760
1776
|
if (!isDragging) return;
|
|
1761
|
-
|
|
1762
|
-
let
|
|
1777
|
+
const pos = getEventPosition(e);
|
|
1778
|
+
let x2 = pos.x - offsetX;
|
|
1779
|
+
let y2 = pos.y - offsetY;
|
|
1763
1780
|
const maxX = window.innerWidth - windowEl.offsetWidth;
|
|
1764
1781
|
const maxY = window.innerHeight - windowEl.offsetHeight;
|
|
1765
1782
|
x2 = Math.max(0, Math.min(x2, maxX));
|
|
1766
1783
|
y2 = Math.max(0, Math.min(y2, maxY));
|
|
1767
1784
|
windowEl.style.left = x2 + "px";
|
|
1768
1785
|
windowEl.style.top = y2 + "px";
|
|
1769
|
-
}
|
|
1770
|
-
document.addEventListener("
|
|
1786
|
+
}
|
|
1787
|
+
document.addEventListener("mousemove", onDrag);
|
|
1788
|
+
document.addEventListener("touchmove", onDrag);
|
|
1789
|
+
function stopDrag() {
|
|
1771
1790
|
isDragging = false;
|
|
1772
|
-
}
|
|
1791
|
+
}
|
|
1792
|
+
document.addEventListener("mouseup", stopDrag);
|
|
1793
|
+
document.addEventListener("touchend", stopDrag);
|
|
1773
1794
|
windowEl.addEventListener("click", (e) => {
|
|
1774
1795
|
const sidebar2 = this.shadowRoot.getElementById("sidebar");
|
|
1775
1796
|
const historyBtn2 = this.shadowRoot.getElementById("history");
|