@aiyiran/myclaw 1.1.160 → 1.1.161

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.
@@ -1431,52 +1431,39 @@ btn.addEventListener("click", function () {
1431
1431
  });
1432
1432
  }
1433
1433
 
1434
- function hideNativeNewSessionBtn(nativeBtn) {
1435
- nativeBtn.style.setProperty("display", "none", "important");
1436
- }
1437
-
1438
1434
  function createNewSessionButton() {
1439
- var nativeBtn = findNativeNewSessionBtn();
1440
- if (!nativeBtn) {
1441
- setTimeout(createNewSessionButton, 500);
1442
- return;
1443
- }
1444
-
1445
- // 已经替换过,不重复插入
1446
- if (nativeBtn.parentNode && nativeBtn.parentNode.querySelector("#myclaw-newsession-btn")) return;
1435
+ if (document.querySelector("#myclaw-newsession-btn")) return;
1447
1436
 
1448
- // 隐藏原生按钮
1449
- hideNativeNewSessionBtn(nativeBtn);
1450
-
1451
- // 复用原生按钮的 class + innerHTML,外观完全一致
1452
- var btn = document.createElement("button");
1437
+ var btn = document.createElement("div");
1453
1438
  btn.id = "myclaw-newsession-btn";
1454
- btn.className = nativeBtn.className;
1455
- btn.innerHTML = nativeBtn.innerHTML;
1439
+ btn.style.cssText = [
1440
+ "position: fixed",
1441
+ "bottom: 8px",
1442
+ "right: 335px",
1443
+ "padding: 3px 10px",
1444
+ "background: rgba(139, 92, 246, 0.85)",
1445
+ "color: #fff",
1446
+ "font-size: 11px",
1447
+ "font-weight: bold",
1448
+ "font-family: monospace",
1449
+ "border-radius: 4px",
1450
+ "z-index: 99999",
1451
+ "user-select: none",
1452
+ "cursor: pointer",
1453
+ "transition: all 0.2s",
1454
+ "letter-spacing: 0.5px",
1455
+ ].join(";");
1456
+ btn.textContent = "🆕 新会话";
1456
1457
  btn.title = "创建新会话(可中文命名)";
1457
1458
 
1459
+ btn.onmouseenter = function () { btn.style.background = "rgba(124, 58, 237, 1)"; btn.style.transform = "scale(1.05)"; };
1460
+ btn.onmouseleave = function () { btn.style.background = "rgba(139, 92, 246, 0.85)"; btn.style.transform = "scale(1)"; };
1458
1461
  btn.onclick = function (e) {
1459
1462
  e.stopPropagation();
1460
- e.preventDefault();
1461
1463
  if (newSessionOpen) { closeNewSessionModal(); } else { openNewSessionModal(); }
1462
1464
  };
1463
1465
 
1464
- nativeBtn.parentNode.insertBefore(btn, nativeBtn);
1465
-
1466
- // 监听 shadow DOM 变化:防止 Lit 重渲染后原生按钮恢复显示或我们的按钮被移除
1467
- var shadowRoot = nativeBtn.getRootNode();
1468
- if (shadowRoot && shadowRoot !== document) {
1469
- new MutationObserver(function () {
1470
- var ourBtn = shadowRoot.querySelector("#myclaw-newsession-btn");
1471
- if (!ourBtn) {
1472
- // 被重渲染移除了,重新插入
1473
- createNewSessionButton();
1474
- return;
1475
- }
1476
- var native = shadowRoot.querySelector(".sidebar-new-session:not(#myclaw-newsession-btn)");
1477
- if (native) hideNativeNewSessionBtn(native);
1478
- }).observe(shadowRoot, { childList: true, subtree: true });
1479
- }
1466
+ document.body.appendChild(btn);
1480
1467
  }
1481
1468
 
1482
1469
  function closeNewSessionModal() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.1.160",
3
+ "version": "1.1.161",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {