feat(n7web): refine spatial UI and NFC-gated extension routing

This commit is contained in:
Miayui
2026-09-16 16:14:10 +08:00
parent 0e4328f548
commit 75ce391312
16 changed files with 925 additions and 106 deletions
+22
View File
@@ -722,6 +722,19 @@
return "binary";
}
function focusLatestDispatchedControls(container) {
requestAnimationFrame(() => {
const transcript = $("#assistantMessages");
const activeCard = container?.matches?.(".assistant-dispatched-controls")
? container
: $(".assistant-dispatched-controls", container);
if (!transcript || !activeCard) return;
transcript.querySelectorAll(".assistant-dispatched-controls").forEach((card) => {
card.open = card === activeCard;
});
});
}
function appendDispatchedControls(message, result = {}) {
if (!message?.body || !result || typeof result !== "object") return;
const previous = message.dispatchedControlResult || {};
@@ -766,6 +779,7 @@
if (vueRenderer(host, viewCommands)) {
host.dataset.commandSignature = signature;
message.article?.classList.add("assistant-message-with-dispatched-controls");
focusLatestDispatchedControls(host);
followLatest(true);
return;
}
@@ -777,6 +791,13 @@
card = document.createElement("details");
card.className = "assistant-dispatched-controls";
card.open = true;
card.addEventListener("toggle", () => {
if (!card.open) return;
const transcript = $("#assistantMessages");
transcript?.querySelectorAll(".assistant-dispatched-controls[open]").forEach((otherCard) => {
if (otherCard !== card) otherCard.open = false;
});
});
const summary = document.createElement("summary");
const headingIcon = document.createElement("span");
headingIcon.className = "assistant-dispatched-controls-heading-icon";
@@ -828,6 +849,7 @@
list.append(row);
});
message.article?.classList.add("assistant-message-with-dispatched-controls");
focusLatestDispatchedControls(card);
window.lucide?.createIcons({ attrs: { "aria-hidden": "true" } });
followLatest(true);
}