Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions site/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ function graphHtml(name, pair, marks) {
? `<button type="button" class="${cls}${m(node)}" data-node="${e(node.name)}"${node.by ? ` data-by="${node.by}"` : ""} aria-pressed="false">${inner}</button>`
: `<span class="${cls}${m(node)}">${inner}</span>`;
const end = (node, cls = "ep") => `<span class="${cls}${m(node)}">${e(node.text || "end")}</span>`;
const fork = (branches) => `<div class="fork${branches.every((b) => b.ends) ? " stop" : ""}" style="--n:${branches.length}">` +
branches.map((b) => `<div class="br">${ED}<span class="lbl">${e(b.outcome)}</span>${block(b.children ?? [])}${b.ends ? "" : ED}</div>`).join("") + "</div>";
// --a and --b: the first and the last branch that goes on; the bottom bar joins only those, not a branch that ends
const fork = (branches) => { const on = branches.flatMap((b, i) => b.ends ? [] : [i]); return `<div class="fork${on.length ? "" : " stop"}" style="--n:${branches.length};--a:${on[0] ?? 0};--b:${on.at(-1) ?? 0}">` +
branches.map((b) => `<div class="br">${ED}<span class="lbl">${e(b.outcome)}</span>${block(b.children ?? [])}${b.ends ? "" : ED}</div>`).join("") + "</div>"; };
const failRow = (caught) => {
const ends = caught.children.filter((kid) => kid.kind === "end"), rest = caught.children.filter((kid) => kid.kind !== "end");
return (rest.length ? `<div class="z">${block(rest)}</div>` : "") +
Expand Down
Loading