agent-loft 0.2.54 → 0.2.55

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-loft",
3
- "version": "0.2.54",
3
+ "version": "0.2.55",
4
4
  "type": "module",
5
5
  "description": "多个 agent 的工作台:把本机 Claude Code / Codex 放到一处统一管理,用飞书和 Web 页面随时驱动——会话、审批、模型切换都共用",
6
6
  "keywords": [
@@ -547,54 +547,50 @@ a.att-file:hover {
547
547
  color: var(--fg);
548
548
  }
549
549
 
550
- .ai-actions {
550
+ .ai-actions,
551
+ .user-actions {
551
552
  display: flex;
552
553
  gap: 4px;
553
554
  align-items: center;
554
- /* 只有最后一条回复默认显示,前面的 hover 时才出来;用 opacity 占着位置,免得 hover 时内容跳动 */
555
+ /* 两类消息预留相同高度,隐藏时也占位,展开操作栏不会改变消息间距。 */
556
+ min-height: 28px;
555
557
  opacity: 0;
558
+ pointer-events: none;
556
559
  transition: opacity 0.15s;
557
560
  }
558
561
 
559
- .msg-ai.latest .ai-actions,
560
- .msg-ai:hover .ai-actions,
561
- .ai-actions:focus-within {
562
+ .msg-ai.latest .ai-actions {
562
563
  opacity: 1;
564
+ pointer-events: auto;
563
565
  }
564
566
 
565
- /* 触屏没有 hover:都显示,否则前面的回复就没法复制 / 分叉了 */
566
- @media (hover: none) {
567
- .ai-actions {
567
+ @media (hover: hover) {
568
+ .msg-ai:hover .ai-actions,
569
+ .msg-user-group:hover .user-actions,
570
+ .ai-actions:focus-within,
571
+ .user-actions:focus-within {
568
572
  opacity: 1;
573
+ pointer-events: auto;
569
574
  }
570
575
  }
571
576
 
572
- /* 用户消息下面的复制:hover 时才出来,和回复的操作栏一样用 opacity 占着位置 */
573
- .user-actions {
574
- display: flex;
575
- margin-top: -4px;
576
- opacity: 0;
577
- transition: opacity 0.15s;
577
+ @media (hover: none) {
578
+ .msg-ai.actions-open .ai-actions,
579
+ .msg-user-group.actions-open .user-actions,
580
+ .ai-actions:has(:focus-visible),
581
+ .user-actions:has(:focus-visible) {
582
+ opacity: 1;
583
+ pointer-events: auto;
584
+ }
578
585
  }
579
586
 
580
587
  .user-actions[hidden] {
581
588
  display: none;
582
589
  }
583
590
 
584
- .msg-user-group:hover .user-actions,
585
- .user-actions:focus-within {
586
- opacity: 1;
587
- }
588
-
589
- @media (hover: none) {
590
- .user-actions {
591
- opacity: 1;
592
- }
593
- }
594
-
595
591
  .user-actions .icon-btn {
596
- width: 26px;
597
- height: 26px;
592
+ width: 28px;
593
+ height: 28px;
598
594
  }
599
595
 
600
596
  .user-actions .icon-btn svg {
@@ -301,13 +301,24 @@ export function bindScrollWatch() {
301
301
  if (["PageUp", "PageDown", "ArrowUp", "ArrowDown", "Home", "End", " "].includes(e.key)) userScrolled();
302
302
  });
303
303
  m.addEventListener("scroll", updateToBottomBtn, { passive: true });
304
+ // 触屏点消息才展开操作栏;点其它消息或空白处收起,链接、按钮和选中文字保持原来的行为。
305
+ document.addEventListener("click", (e) => {
306
+ if (!matchMedia("(hover: none)").matches) return;
307
+ const message = m.contains(e.target) ? e.target.closest(".msg-user-group, .msg-ai") : null;
308
+ if (message && (e.target.closest("button, a, input, textarea, select, summary, [role='button'], [contenteditable], .ai-actions, .user-actions") || window.getSelection()?.isCollapsed === false)) return;
309
+ const wasOpen = message?.classList.contains("actions-open");
310
+ for (const el of m.querySelectorAll(".actions-open")) el.classList.remove("actions-open");
311
+ if (!wasOpen && message && !message.classList.contains("latest") && message.querySelector(".ai-actions, .user-actions:not([hidden])")) {
312
+ message.classList.add("actions-open");
313
+ }
314
+ });
304
315
  // 消息区变高(发送后输入框清空变矮)、内容变高都要重算留白;窗口 resize 管不到元素自己变尺寸
305
316
  const ro = new ResizeObserver(() => afterLayout());
306
317
  ro.observe(m);
307
318
  ro.observe(ui.msgInner);
308
319
  }
309
320
 
310
- /** 只有最后一条回复默认显示底部的操作栏(复制 / 分叉 / 用时…),前面的 hover 才出来 */
321
+ /** 只有最后一条回复默认显示底部操作栏,前面的在桌面 hover、触屏点击时显示 */
311
322
  function markLatestAi() {
312
323
  let latest = null;
313
324
  for (let i = S.items.length - 1; i >= 0; i--) {