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 +1 -1
- package/web/css/messages.css +23 -27
- package/web/views/messages.js +12 -1
package/package.json
CHANGED
package/web/css/messages.css
CHANGED
|
@@ -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
|
-
/*
|
|
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
|
-
|
|
566
|
-
|
|
567
|
-
.
|
|
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
|
-
|
|
573
|
-
.
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
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:
|
|
597
|
-
height:
|
|
592
|
+
width: 28px;
|
|
593
|
+
height: 28px;
|
|
598
594
|
}
|
|
599
595
|
|
|
600
596
|
.user-actions .icon-btn svg {
|
package/web/views/messages.js
CHANGED
|
@@ -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
|
-
/**
|
|
321
|
+
/** 只有最后一条回复默认显示底部操作栏,前面的在桌面 hover、触屏点击时显示 */
|
|
311
322
|
function markLatestAi() {
|
|
312
323
|
let latest = null;
|
|
313
324
|
for (let i = S.items.length - 1; i >= 0; i--) {
|