viz: ui prereqs for hierarchical rewrites (#12799)

This commit is contained in:
qazal
2025-10-20 12:15:15 +08:00
committed by GitHub
parent 357dac8425
commit 339e6edb7d
2 changed files with 11 additions and 5 deletions
+7 -3
View File
@@ -41,11 +41,13 @@
}
ul {
padding: 0;
opacity: 0.6;
white-space: nowrap;
cursor: pointer;
}
ul.active {
ul > p {
opacity: 0.6;
}
ul.active > p {
opacity: 1;
}
ul > ul {
@@ -54,8 +56,10 @@
ul.expanded > ul {
display: block;
}
ul.disabled {
ul.disabled > p {
opacity: 0.4;
}
ul.disabled {
pointer-events: none;
}
label {
+4 -2
View File
@@ -608,7 +608,8 @@ async function main() {
for (const [j,u] of steps.entries()) {
const inner = ul.appendChild(document.createElement("ul"));
inner.id = `step-${i}-${j}`;
inner.innerText = `${u.name}`+(u.match_count ? ` - ${u.match_count}` : '');
const p = inner.appendChild(document.createElement("p"));
p.innerText = `${u.name}`+(u.match_count ? ` - ${u.match_count}` : '');
inner.style.marginLeft = `${8*u.depth}px`;
inner.onclick = (e) => {
e.stopPropagation();
@@ -706,8 +707,9 @@ async function main() {
rewriteList.className = "rewrite-list";
for (let s=0; s<=step.match_count; s++) {
const ul = rewriteList.appendChild(document.createElement("ul"));
ul.innerText = s;
ul.id = `rewrite-${s}`;
const p = ul.appendChild(document.createElement("p"));
p.innerText = s;
ul.onclick = () => setState({ currentRewrite:s });
ul.className = s > ret.length-1 ? "disabled" : s === currentRewrite ? "active" : "";
if (s > 0 && s === currentRewrite) {