diff --git a/src/lib/components/ProofTree.svelte b/src/lib/components/ProofTree.svelte index 667d54f..87fc6f3 100644 --- a/src/lib/components/ProofTree.svelte +++ b/src/lib/components/ProofTree.svelte @@ -141,6 +141,28 @@ return "unknown"; } + // Returns the status of a virtual node's branch based on its descendants + function virtualStatus(index: number): "open" | "closed" | "mixed" { + let hasOpen = false; + let hasClosed = false; + const currentDepth = nodes[index]?.depth ?? 0; + + for (let i = index + 1; i < nodes.length; i++) { + const item = nodes[i]; + if (item.depth <= currentDepth) break; + if (item.kind !== "real") continue; + + const s = statusFromName(item.node.name); + if (s === "open") hasOpen = true; + if (s === "closed") hasClosed = true; + if (hasOpen && hasClosed) return "mixed"; + } + + if (hasOpen) return "open"; + if (hasClosed) return "closed"; + return "open"; // fallback: treat unknown as open + } + function isLeaf(index: number) { const currentDepth = nodes[index]?.depth ?? 0; const nextDepth = nodes[index + 1]?.depth ?? -1; @@ -362,7 +384,7 @@ {Number(item.node.id.nodeId)}: {item.node.name} {:else} -
{item.label}
+
{item.label}
{/if} {/if} @@ -540,6 +562,22 @@ background: rgba(255, 255, 255, 0.04); font-weight: 600; } + + .virtual.open { + border-color: rgba(255, 100, 100, 0.45); + background: rgba(255, 80, 80, 0.1); + } + + .virtual.closed { + border-color: rgba(80, 200, 120, 0.45); + background: rgba(80, 200, 120, 0.1); + } + + .virtual.mixed { + border-color: rgba(255, 180, 60, 0.45); + background: rgba(255, 180, 60, 0.08); + } + .collapse-icon { display: inline-flex; diff --git a/src/lib/components/TermTree.svelte b/src/lib/components/TermTree.svelte index fcd1877..c809c66 100644 --- a/src/lib/components/TermTree.svelte +++ b/src/lib/components/TermTree.svelte @@ -1,19 +1,15 @@
@@ -180,6 +215,7 @@ onmouseout={(e) => onMouseOut(index)} onclick={(e) => onClick(e, index)} class:span-hover={isMarked(index)} + class={hljsClassForSpan(span)} > {span.content} @@ -190,23 +226,15 @@ class="ctx-menu" style="top: {contextMenuState.y}px; left: {contextMenuState.x}px;" > -
- applyAction(action.commandId)} - /> - applyAction(action.commandId)} - /> - applyAction(action.commandId)} - /> -
+
{/if} @@ -231,6 +259,10 @@ background-color: gray; } + .span-hover { + background-color: gray; + } + .ctx-menu { position: absolute; background: #1f1f1f; @@ -241,8 +273,9 @@ z-index: 1000; } - .action-list { - display: flex; - overflow: scroll; + .ctx-menu ul { + list-style-type: none; + padding: 0; + margin: 0; }