| 90 | // ── Controls builder (one per domain) ──────────────────────────────────── |
| 91 | |
| 92 | function buildDomainControls(tables) { |
| 93 | const wrap = document.createElement("div"); |
| 94 | Object.assign(wrap.style, { |
| 95 | display: "flex", |
| 96 | flexDirection: "column", |
| 97 | gap: "10px", |
| 98 | padding: "14px 18px", |
| 99 | margin: "18px 0 22px", |
| 100 | borderRadius: "8px", |
| 101 | border: "1px solid var(--md-default-fg-color--lightest, rgba(0,0,0,0.12))", |
| 102 | background: "var(--md-code-bg-color, rgba(0,0,0,0.03))", |
| 103 | }); |
| 104 | |
| 105 | // Search row |
| 106 | const searchRow = document.createElement("div"); |
| 107 | searchRow.style.cssText = "display:flex;align-items:center;gap:10px;"; |
| 108 | |
| 109 | const searchLabel = document.createElement("span"); |
| 110 | searchLabel.textContent = "Search:"; |
| 111 | searchLabel.style.cssText = "font-size:0.82em;opacity:0.6;white-space:nowrap;"; |
| 112 | |
| 113 | const searchInput = document.createElement("input"); |
| 114 | searchInput.type = "search"; |
| 115 | searchInput.placeholder = "Filter all tables in this domain…"; |
| 116 | Object.assign(searchInput.style, { |
| 117 | flex: "1", |
| 118 | maxWidth: "420px", |
| 119 | padding: "5px 12px", |
| 120 | borderRadius: "6px", |
| 121 | border: "1px solid var(--md-default-fg-color--lighter, #ccc)", |
| 122 | background: "transparent", |
| 123 | color: "inherit", |
| 124 | fontSize: "0.85em", |
| 125 | outline: "none", |
| 126 | }); |
| 127 | |
| 128 | searchRow.appendChild(searchLabel); |
| 129 | searchRow.appendChild(searchInput); |
| 130 | |
| 131 | // Level filter row |
| 132 | const filterRow = document.createElement("div"); |
| 133 | filterRow.style.cssText = "display:flex;gap:7px;flex-wrap:wrap;align-items:center;"; |
| 134 | |
| 135 | const filterLabel = document.createElement("span"); |
| 136 | filterLabel.textContent = "Level:"; |
| 137 | filterLabel.style.cssText = "font-size:0.82em;opacity:0.6;white-space:nowrap;margin-right:2px;"; |
| 138 | filterRow.appendChild(filterLabel); |
| 139 | |
| 140 | let activeLevel = "error"; |
| 141 | let searchText = ""; |
| 142 | |
| 143 | const levelBtns = new Map(); |
| 144 | |
| 145 | // "All" button — clears the level filter |
| 146 | const allBtn = document.createElement("button"); |
| 147 | allBtn.textContent = "all"; |
| 148 | styleBtn(allBtn, ALL_COLOR, activeLevel === ""); |
| 149 | levelBtns.set("", allBtn); |