Merge branch 'feature/hub-bubble-front-spawn-faces' into unify/skills-20261112-night
This commit is contained in:
commit
3e7873bb42
6 files changed
+551
-11
No files matched your search
@@ -1,5 +1,6 @@
|
||||
const gateStage = {items: [], drag: null};
|
||||
const DRAG_SLOP = 6;
|
||||
const AGENT_R = {dot: 9, face: 13};
|
||||
|
||||
function stageGate(key, change) {
|
||||
gateStage.items = gateStage.items.filter((item) => item.key !== key);
|
||||
@@ -140,16 +141,22 @@
|
||||
};
|
||||
return ancestryChart(plan, "Ancestry: operator, chair, sessions, subagents", {
|
||||
edge: (link, d) => s("path", {class: "ancestry-edge", d, "data-child": link.child, "data-parent": link.parent}),
|
||||
node: (node) => s("g", {
|
||||
class: `node ancestry-node k-${node.kind}`, transform: `translate(${fixed(node.x)} ${fixed(node.y)})`, tabindex: 0, role: "button", "aria-label": node.label,
|
||||
"data-agent": node.id, "data-kind": node.kind, "data-generation": node.generation,
|
||||
on: {click: () => open(node), keydown: (event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
open(node);
|
||||
}
|
||||
}},
|
||||
}, s("title", {}, `${node.label} · ${NODE_KINDS[node.kind] || "Subagent"}`), s("circle", {r: 9}), s("text", {class: "label", y: 26, "text-anchor": "middle"}, short(node.label).slice(0, 24))),
|
||||
node: (node) => {
|
||||
const faced = look.faces && Object.hasOwn(TOP, node.kind);
|
||||
const r = faced ? AGENT_R.face : AGENT_R.dot;
|
||||
return s("g", {
|
||||
class: `node ancestry-node k-${node.kind}`, transform: `translate(${fixed(node.x)} ${fixed(node.y)})`, tabindex: 0, role: "button", "aria-label": node.label,
|
||||
"data-agent": node.id, "data-kind": node.kind, "data-generation": node.generation, "data-face": faced ? node.id : null,
|
||||
on: {click: () => open(node), keydown: (event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
open(node);
|
||||
}
|
||||
}},
|
||||
}, s("title", {}, `${node.label} · ${NODE_KINDS[node.kind] || "Subagent"}`), s("circle", {r}),
|
||||
faced ? s("g", {class: "face-art", transform: `translate(${-r} ${-r}) scale(${(2 * r) / Faces.SIZE})`}, faceParts(node.id)) : null,
|
||||
s("text", {class: "label", y: r + 17, "text-anchor": "middle"}, short(node.label).slice(0, 24)));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,36 @@
|
||||
return box.width > 0 && box.height > 0 && box.left + box.width > 0 && box.top + box.height > 0 && box.left < window.innerWidth && box.top < window.innerHeight;
|
||||
}
|
||||
|
||||
function clipped(box, frame) {
|
||||
const left = Math.max(box.left, frame.left);
|
||||
const top = Math.max(box.top, frame.top);
|
||||
return {left, top, width: Math.min(box.left + box.width, frame.left + frame.width) - left, height: Math.min(box.top + box.height, frame.top + frame.height) - top};
|
||||
}
|
||||
|
||||
function clipsOf(node) {
|
||||
const frames = [];
|
||||
for (let at = node; at.parentElement && at.parentElement !== document.body && getComputedStyle(at).position !== "fixed"; at = at.parentElement) {
|
||||
const style = getComputedStyle(at.parentElement);
|
||||
if (style.display !== "contents" && style.display !== "inline" && (style.overflowX !== "visible" || style.overflowY !== "visible")) {
|
||||
frames.push(at.parentElement.getBoundingClientRect());
|
||||
}
|
||||
}
|
||||
return frames;
|
||||
}
|
||||
|
||||
function anchorOf(key) {
|
||||
const projected = g3.tab === "agents" ? anchor3d(key)() : null;
|
||||
if (projected && inView(projected)) {
|
||||
return projected;
|
||||
}
|
||||
return [...document.querySelectorAll(`[data-face="${CSS.escape(key)}"]`)].map((node) => node.getBoundingClientRect()).find(inView) || null;
|
||||
for (const node of document.querySelectorAll(`[data-face="${CSS.escape(key)}"]`)) {
|
||||
const box = node.getBoundingClientRect();
|
||||
const shown = inView(box) ? clipsOf(node).reduce(clipped, box) : null;
|
||||
if (shown && inView(shown)) {
|
||||
return shown;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function bubbleNode(item) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
.speech-bubble::before { margin-left: -9px; border-width: 12px 9px 0; border-top-color: var(--text); }
|
||||
.speech-bubble::after { margin-left: -6px; border-width: 8px 6px 0; border-top-color: var(--panel); }
|
||||
.speech-bubble.leaving { opacity: 0; }
|
||||
.speech-bubble[data-state="speaking"]:not(.leaving) { z-index: 1; }
|
||||
.bubble-words { display: block; max-height: calc(6 * 1.35em); overflow: hidden; overflow-wrap: anywhere; scroll-behavior: smooth; }
|
||||
.speech-bubble[data-state="waiting"] .bubble-words { letter-spacing: .12em; }
|
||||
.bubble-who { display: none; color: var(--muted); font: 650 var(--fs-xs)/1.2 var(--sans); }
|
||||
|
||||
Reference in new issue
Block a user