@crvouga/mockingbird-service-google-maps 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/dist/{chunk-EC2N5KBB.js → chunk-OXERG4FV.js} +2 -2
- package/dist/{chunk-KOTM4DOF.js → chunk-R6B7E6A7.js} +370 -25
- package/dist/chunk-R6B7E6A7.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.js +1 -1
- package/dist/server.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-KOTM4DOF.js.map +0 -7
- /package/dist/{chunk-EC2N5KBB.js.map → chunk-OXERG4FV.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-google-maps
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.8.0 (2026-10-01)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- record SQL timelines and serve the admin explorer ([8ced17a](https://github.com/crvouga/mockingbird/commit/8ced17ac398e386ef4e9d7e01fc7744c34b95d07))
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
- `@crvouga/mockingbird-service-sqlite`
|
|
12
|
+
|
|
13
|
+
## 1.7.1 (2026-09-30)
|
|
14
|
+
|
|
15
|
+
### Fixes and improvements
|
|
16
|
+
|
|
17
|
+
- keep validated address lines within 80 characters ([2ba2574](https://github.com/crvouga/mockingbird/commit/2ba2574450c6900155e7b25a09891052faf7ba6f))
|
|
18
|
+
- keep admin buttons pressed until the action finishes ([0aabfcb](https://github.com/crvouga/mockingbird/commit/0aabfcb5f392aa51e193f9c3f817d5877d92bc6a))
|
|
19
|
+
- size admin select fields like the text inputs beside them ([0fb3ef2](https://github.com/crvouga/mockingbird/commit/0fb3ef2ddbf43376c93a2ae6d87c6c9bf890dafc))
|
|
20
|
+
- keep admin section tabs wired when boot is renamed ([4eda25e](https://github.com/crvouga/mockingbird/commit/4eda25eacd59da048d196f7cc8369d7a02b47bfc))
|
|
21
|
+
|
|
22
|
+
## 1.7.0 (2026-09-29)
|
|
4
23
|
|
|
5
24
|
### Features
|
|
6
25
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R6B7E6A7.js";
|
|
4
4
|
|
|
5
5
|
// ../../adapters/node/dist/cli.js
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
@@ -360,4 +360,4 @@ export {
|
|
|
360
360
|
createServer2 as createServer,
|
|
361
361
|
serveTarget
|
|
362
362
|
};
|
|
363
|
-
//# sourceMappingURL=chunk-
|
|
363
|
+
//# sourceMappingURL=chunk-OXERG4FV.js.map
|
|
@@ -1648,6 +1648,167 @@ function faultPresetList(value) {
|
|
|
1648
1648
|
})
|
|
1649
1649
|
};
|
|
1650
1650
|
}
|
|
1651
|
+
function mountSqlExplorer(root, api) {
|
|
1652
|
+
const cell = (value) => {
|
|
1653
|
+
if (value === null || value === void 0)
|
|
1654
|
+
return "";
|
|
1655
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1656
|
+
return String(value);
|
|
1657
|
+
}
|
|
1658
|
+
return JSON.stringify(value) ?? "";
|
|
1659
|
+
};
|
|
1660
|
+
root.replaceChildren();
|
|
1661
|
+
const layout = document.createElement("div");
|
|
1662
|
+
layout.className = "sql-layout";
|
|
1663
|
+
const tables = document.createElement("div");
|
|
1664
|
+
tables.className = "sql-tables";
|
|
1665
|
+
const stack = document.createElement("div");
|
|
1666
|
+
stack.className = "stack";
|
|
1667
|
+
const banner = document.createElement("p");
|
|
1668
|
+
banner.className = "banner";
|
|
1669
|
+
const grid = document.createElement("div");
|
|
1670
|
+
const input = document.createElement("textarea");
|
|
1671
|
+
input.className = "sql-input";
|
|
1672
|
+
input.spellcheck = false;
|
|
1673
|
+
input.placeholder = "SELECT * FROM ...";
|
|
1674
|
+
const actions = document.createElement("div");
|
|
1675
|
+
actions.className = "row-actions";
|
|
1676
|
+
const run = document.createElement("button");
|
|
1677
|
+
run.type = "button";
|
|
1678
|
+
run.textContent = "Run";
|
|
1679
|
+
actions.append(run);
|
|
1680
|
+
const result = document.createElement("pre");
|
|
1681
|
+
stack.append(banner, grid, input, actions, result);
|
|
1682
|
+
layout.append(tables, stack);
|
|
1683
|
+
root.append(layout);
|
|
1684
|
+
const showError = (error) => {
|
|
1685
|
+
banner.textContent = error instanceof Error ? error.message : String(error);
|
|
1686
|
+
banner.classList.add("show");
|
|
1687
|
+
};
|
|
1688
|
+
const clearError = () => {
|
|
1689
|
+
banner.textContent = "";
|
|
1690
|
+
banner.classList.remove("show");
|
|
1691
|
+
};
|
|
1692
|
+
const renderGrid = (columns, rows) => {
|
|
1693
|
+
grid.replaceChildren();
|
|
1694
|
+
if (columns.length === 0) {
|
|
1695
|
+
const empty = document.createElement("p");
|
|
1696
|
+
empty.className = "empty";
|
|
1697
|
+
empty.textContent = "No rows.";
|
|
1698
|
+
grid.append(empty);
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
const table = document.createElement("table");
|
|
1702
|
+
const head = document.createElement("thead");
|
|
1703
|
+
const headRow = document.createElement("tr");
|
|
1704
|
+
for (const column of columns) {
|
|
1705
|
+
const th = document.createElement("th");
|
|
1706
|
+
th.textContent = column;
|
|
1707
|
+
headRow.append(th);
|
|
1708
|
+
}
|
|
1709
|
+
head.append(headRow);
|
|
1710
|
+
const body = document.createElement("tbody");
|
|
1711
|
+
for (const row2 of rows) {
|
|
1712
|
+
const tr = document.createElement("tr");
|
|
1713
|
+
for (const column of columns) {
|
|
1714
|
+
const td = document.createElement("td");
|
|
1715
|
+
td.dataset.label = column;
|
|
1716
|
+
td.textContent = cell(row2[column]);
|
|
1717
|
+
tr.append(td);
|
|
1718
|
+
}
|
|
1719
|
+
body.append(tr);
|
|
1720
|
+
}
|
|
1721
|
+
table.append(head, body);
|
|
1722
|
+
grid.append(table);
|
|
1723
|
+
};
|
|
1724
|
+
const rowsOf = (value) => {
|
|
1725
|
+
if (!isRecord2(value) || !Array.isArray(value.rows))
|
|
1726
|
+
return [];
|
|
1727
|
+
return value.rows.flatMap((row2) => isRecord2(row2) ? [row2] : []);
|
|
1728
|
+
};
|
|
1729
|
+
const columnsOf = (value, rows) => {
|
|
1730
|
+
if (isRecord2(value) && Array.isArray(value.columns)) {
|
|
1731
|
+
const named = value.columns.flatMap((column) => typeof column === "string" ? [column] : []);
|
|
1732
|
+
if (named.length > 0)
|
|
1733
|
+
return named;
|
|
1734
|
+
}
|
|
1735
|
+
const first = rows[0];
|
|
1736
|
+
return first === void 0 ? [] : Object.keys(first);
|
|
1737
|
+
};
|
|
1738
|
+
let selected = "";
|
|
1739
|
+
const loadPage = async (schema, name) => {
|
|
1740
|
+
selected = `${schema}.${name}`;
|
|
1741
|
+
const page = await api.get(`/sql/tables/${encodeURIComponent(schema)}/${encodeURIComponent(name)}?limit=50`);
|
|
1742
|
+
const rows = rowsOf(page);
|
|
1743
|
+
renderGrid(columnsOf(page, rows), rows);
|
|
1744
|
+
const total = isRecord2(page) && typeof page.total === "number" ? page.total : rows.length;
|
|
1745
|
+
result.textContent = `${selected} \xB7 ${total} rows`;
|
|
1746
|
+
for (const button of tables.querySelectorAll("button")) {
|
|
1747
|
+
if (!(button instanceof HTMLButtonElement))
|
|
1748
|
+
continue;
|
|
1749
|
+
button.setAttribute("aria-current", button.dataset.schema === schema && button.dataset.table === name ? "true" : "false");
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
const loadTables = async () => {
|
|
1753
|
+
const payload = await api.get("/sql/tables");
|
|
1754
|
+
const listed = isRecord2(payload) && Array.isArray(payload.tables) ? payload.tables : [];
|
|
1755
|
+
tables.replaceChildren();
|
|
1756
|
+
if (listed.length === 0) {
|
|
1757
|
+
const empty = document.createElement("p");
|
|
1758
|
+
empty.className = "empty";
|
|
1759
|
+
empty.textContent = "No tables.";
|
|
1760
|
+
tables.append(empty);
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
for (const item of listed) {
|
|
1764
|
+
if (!isRecord2(item) || typeof item.schema !== "string" || typeof item.name !== "string")
|
|
1765
|
+
continue;
|
|
1766
|
+
const button = document.createElement("button");
|
|
1767
|
+
button.type = "button";
|
|
1768
|
+
button.dataset.schema = item.schema;
|
|
1769
|
+
button.dataset.table = item.name;
|
|
1770
|
+
button.textContent = `${item.schema}.${item.name}`;
|
|
1771
|
+
tables.append(button);
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
tables.addEventListener("click", (event) => {
|
|
1775
|
+
const target = event.target;
|
|
1776
|
+
if (!(target instanceof Element))
|
|
1777
|
+
return;
|
|
1778
|
+
const button = target.closest("button");
|
|
1779
|
+
if (!(button instanceof HTMLButtonElement))
|
|
1780
|
+
return;
|
|
1781
|
+
const schema = button.dataset.schema;
|
|
1782
|
+
const name = button.dataset.table;
|
|
1783
|
+
if (schema === void 0 || name === void 0)
|
|
1784
|
+
return;
|
|
1785
|
+
clearError();
|
|
1786
|
+
loadPage(schema, name).catch(showError);
|
|
1787
|
+
});
|
|
1788
|
+
run.addEventListener("click", () => {
|
|
1789
|
+
const sql = input.value.trim();
|
|
1790
|
+
if (sql === "") {
|
|
1791
|
+
showError(new Error("Enter a statement"));
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
clearError();
|
|
1795
|
+
api.send("POST", "/sql/query", { sql }).then((payload) => {
|
|
1796
|
+
const rows = rowsOf(payload);
|
|
1797
|
+
renderGrid(columnsOf(payload, rows), rows);
|
|
1798
|
+
const count = isRecord2(payload) && typeof payload.rowCount === "number" ? payload.rowCount : rows.length;
|
|
1799
|
+
const truncated = isRecord2(payload) && payload.truncated === true ? " (truncated)" : "";
|
|
1800
|
+
result.textContent = `${count} rows${truncated}`;
|
|
1801
|
+
}).catch(showError);
|
|
1802
|
+
});
|
|
1803
|
+
const namespace = document.getElementById("namespace");
|
|
1804
|
+
if (namespace) {
|
|
1805
|
+
namespace.addEventListener("change", () => {
|
|
1806
|
+
clearError();
|
|
1807
|
+
loadTables().catch(showError);
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
loadTables().catch(showError);
|
|
1811
|
+
}
|
|
1651
1812
|
function bootAdmin(config) {
|
|
1652
1813
|
const fieldKinds = ["string", "number", "boolean", "null", "object", "array", "unknown"];
|
|
1653
1814
|
const sources = ["declared", "inferred", "mixed"];
|
|
@@ -2088,6 +2249,50 @@ function bootAdmin(config) {
|
|
|
2088
2249
|
if (render)
|
|
2089
2250
|
await render();
|
|
2090
2251
|
}
|
|
2252
|
+
const delay = (ms) => new Promise((resolve2) => {
|
|
2253
|
+
window.setTimeout(resolve2, ms);
|
|
2254
|
+
});
|
|
2255
|
+
const confirmAction = async (button, pending, done, work) => {
|
|
2256
|
+
if (button.dataset.pending === "1")
|
|
2257
|
+
return;
|
|
2258
|
+
const label = button.textContent ?? "";
|
|
2259
|
+
const width = button.offsetWidth;
|
|
2260
|
+
button.dataset.pending = "1";
|
|
2261
|
+
button.classList.add("pressed");
|
|
2262
|
+
button.setAttribute("aria-busy", "true");
|
|
2263
|
+
button.style.minWidth = `${width}px`;
|
|
2264
|
+
button.textContent = pending;
|
|
2265
|
+
try {
|
|
2266
|
+
await work();
|
|
2267
|
+
button.textContent = done;
|
|
2268
|
+
await delay(1e3);
|
|
2269
|
+
} catch (error) {
|
|
2270
|
+
showError(error);
|
|
2271
|
+
} finally {
|
|
2272
|
+
button.textContent = label;
|
|
2273
|
+
button.style.minWidth = "";
|
|
2274
|
+
button.classList.remove("pressed");
|
|
2275
|
+
button.removeAttribute("aria-busy");
|
|
2276
|
+
delete button.dataset.pending;
|
|
2277
|
+
}
|
|
2278
|
+
};
|
|
2279
|
+
document.addEventListener("click", (event) => {
|
|
2280
|
+
const target = event.target;
|
|
2281
|
+
if (!(target instanceof Element))
|
|
2282
|
+
return;
|
|
2283
|
+
const button = target.closest("button");
|
|
2284
|
+
if (!(button instanceof HTMLButtonElement) || button.dataset.pending === "1")
|
|
2285
|
+
return;
|
|
2286
|
+
button.classList.add("pressed");
|
|
2287
|
+
const token = String(Date.now());
|
|
2288
|
+
button.dataset.press = token;
|
|
2289
|
+
window.setTimeout(() => {
|
|
2290
|
+
if (button.dataset.press !== token || button.dataset.pending === "1")
|
|
2291
|
+
return;
|
|
2292
|
+
button.classList.remove("pressed");
|
|
2293
|
+
delete button.dataset.press;
|
|
2294
|
+
}, 450);
|
|
2295
|
+
});
|
|
2091
2296
|
el("namespace", HTMLSelectElement).addEventListener("change", () => {
|
|
2092
2297
|
state.namespace = el("namespace", HTMLSelectElement).value;
|
|
2093
2298
|
refresh().catch(showError);
|
|
@@ -2098,7 +2303,7 @@ function bootAdmin(config) {
|
|
|
2098
2303
|
refresh().catch(showError);
|
|
2099
2304
|
});
|
|
2100
2305
|
el("refresh", HTMLButtonElement).addEventListener("click", () => {
|
|
2101
|
-
refresh().catch(showError);
|
|
2306
|
+
confirmAction(el("refresh", HTMLButtonElement), "Refreshing...", "Updated", () => refresh()).catch(showError);
|
|
2102
2307
|
});
|
|
2103
2308
|
el("collections", HTMLElement).addEventListener("click", (event) => {
|
|
2104
2309
|
const target = event.target;
|
|
@@ -2221,10 +2426,10 @@ function bootAdmin(config) {
|
|
|
2221
2426
|
}).then(() => renderFaults()).catch(showError);
|
|
2222
2427
|
});
|
|
2223
2428
|
el("fault-clear", HTMLButtonElement).addEventListener("click", () => {
|
|
2224
|
-
api("DELETE", "/faults").then(() => renderFaults()).catch(showError);
|
|
2429
|
+
confirmAction(el("fault-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/faults").then(() => renderFaults())).catch(showError);
|
|
2225
2430
|
});
|
|
2226
2431
|
el("journal-clear", HTMLButtonElement).addEventListener("click", () => {
|
|
2227
|
-
api("DELETE", "/requests").then(() => renderJournal()).catch(showError);
|
|
2432
|
+
confirmAction(el("journal-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/requests").then(() => renderJournal())).catch(showError);
|
|
2228
2433
|
});
|
|
2229
2434
|
el("route-list", HTMLElement).addEventListener("click", (event) => {
|
|
2230
2435
|
const target = event.target;
|
|
@@ -2280,6 +2485,22 @@ function bootAdmin(config) {
|
|
|
2280
2485
|
panel.script = value.script;
|
|
2281
2486
|
return panel;
|
|
2282
2487
|
};
|
|
2488
|
+
const decodeExtension = (value) => {
|
|
2489
|
+
if (!isRecord2(value))
|
|
2490
|
+
return void 0;
|
|
2491
|
+
if (value.kind === "sql") {
|
|
2492
|
+
return {
|
|
2493
|
+
kind: "sql",
|
|
2494
|
+
id: typeof value.id === "string" && value.id !== "" ? value.id : "sql",
|
|
2495
|
+
title: typeof value.title === "string" && value.title !== "" ? value.title : "SQL",
|
|
2496
|
+
description: typeof value.description === "string" ? value.description : "Browse tables and run queries."
|
|
2497
|
+
};
|
|
2498
|
+
}
|
|
2499
|
+
if (value.kind !== "panel")
|
|
2500
|
+
return void 0;
|
|
2501
|
+
const panel = decodePanel(value);
|
|
2502
|
+
return panel === void 0 ? void 0 : { kind: "panel", ...panel };
|
|
2503
|
+
};
|
|
2283
2504
|
const mountPanels = (panels) => {
|
|
2284
2505
|
const nav = el("nav", HTMLElement);
|
|
2285
2506
|
const views = el("views", HTMLElement);
|
|
@@ -2333,15 +2554,57 @@ function bootAdmin(config) {
|
|
|
2333
2554
|
return decoded === void 0 ? [] : [decoded];
|
|
2334
2555
|
});
|
|
2335
2556
|
mountPanels(panels);
|
|
2557
|
+
const extensions = requireList(isRecord2(manifest) ? manifest.extensions : void 0, "Extensions").flatMap((extension) => {
|
|
2558
|
+
const decoded = decodeExtension(extension);
|
|
2559
|
+
return decoded === void 0 ? [] : [decoded];
|
|
2560
|
+
});
|
|
2561
|
+
const extensionPanels = extensions.flatMap((extension) => extension.kind === "panel" ? [extension] : []);
|
|
2562
|
+
mountPanels(extensionPanels);
|
|
2563
|
+
for (const extension of extensions) {
|
|
2564
|
+
if (extension.kind !== "sql")
|
|
2565
|
+
continue;
|
|
2566
|
+
const nav = el("nav", HTMLElement);
|
|
2567
|
+
const views = el("views", HTMLElement);
|
|
2568
|
+
const button = document.createElement("button");
|
|
2569
|
+
button.type = "button";
|
|
2570
|
+
button.dataset.view = extension.id;
|
|
2571
|
+
button.textContent = extension.title;
|
|
2572
|
+
nav.append(button);
|
|
2573
|
+
const section = document.createElement("section");
|
|
2574
|
+
section.className = "view";
|
|
2575
|
+
section.id = `view-${extension.id}`;
|
|
2576
|
+
section.hidden = true;
|
|
2577
|
+
const title = document.createElement("h2");
|
|
2578
|
+
title.textContent = extension.title;
|
|
2579
|
+
const lede = document.createElement("p");
|
|
2580
|
+
lede.className = "lede";
|
|
2581
|
+
lede.textContent = extension.description;
|
|
2582
|
+
const body = document.createElement("div");
|
|
2583
|
+
body.className = "panel-body";
|
|
2584
|
+
section.append(title, lede, body);
|
|
2585
|
+
views.append(section);
|
|
2586
|
+
mountSqlExplorer(body, panelApi);
|
|
2587
|
+
}
|
|
2336
2588
|
return refresh();
|
|
2337
2589
|
}).catch(showError);
|
|
2338
2590
|
}
|
|
2339
|
-
var clientPrelude = [
|
|
2591
|
+
var clientPrelude = [
|
|
2592
|
+
isRecord2,
|
|
2593
|
+
mountAdminBrand,
|
|
2594
|
+
startAdminBrand,
|
|
2595
|
+
faultPresetList,
|
|
2596
|
+
mountSqlExplorer,
|
|
2597
|
+
bootAdmin
|
|
2598
|
+
].map((fn) => fn.toString()).join("\n");
|
|
2340
2599
|
var adminClientSource = (config) => {
|
|
2341
2600
|
const payload = JSON.stringify(config).replace(/</g, "\\u003c");
|
|
2601
|
+
const entry = bootAdmin.name;
|
|
2602
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(entry)) {
|
|
2603
|
+
throw new Error("admin client cannot call its boot function");
|
|
2604
|
+
}
|
|
2342
2605
|
return `<script>
|
|
2343
2606
|
${clientPrelude}
|
|
2344
|
-
|
|
2607
|
+
${entry}(${payload});
|
|
2345
2608
|
</script>`;
|
|
2346
2609
|
};
|
|
2347
2610
|
|
|
@@ -2382,19 +2645,33 @@ var STANDARD_ADMIN_ROUTES = [
|
|
|
2382
2645
|
"GET /ui/manifest"
|
|
2383
2646
|
];
|
|
2384
2647
|
var PANEL_ID = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
|
|
2648
|
+
var RESERVED_VIEWS = /* @__PURE__ */ new Set(["overview", "state", "clock", "faults", "journal", "routes"]);
|
|
2649
|
+
var checkPanel = (panel, seen, label) => {
|
|
2650
|
+
if (!PANEL_ID.test(panel.id)) {
|
|
2651
|
+
throw new RangeError(`${label} id must match ${PANEL_ID}: ${JSON.stringify(panel.id)}`);
|
|
2652
|
+
}
|
|
2653
|
+
if (RESERVED_VIEWS.has(panel.id)) {
|
|
2654
|
+
throw new RangeError(`${label} id ${panel.id} is reserved by the admin shell`);
|
|
2655
|
+
}
|
|
2656
|
+
if (seen.has(panel.id))
|
|
2657
|
+
throw new RangeError(`duplicate admin view id ${panel.id}`);
|
|
2658
|
+
seen.add(panel.id);
|
|
2659
|
+
if (panel.title.trim() === "")
|
|
2660
|
+
throw new RangeError(`${label} ${panel.id} needs a title`);
|
|
2661
|
+
};
|
|
2385
2662
|
var assertAdminUi = (ui) => {
|
|
2386
|
-
if (!ui
|
|
2663
|
+
if (!ui)
|
|
2387
2664
|
return;
|
|
2388
2665
|
const seen = /* @__PURE__ */ new Set();
|
|
2389
|
-
for (const panel of ui.panels)
|
|
2390
|
-
|
|
2391
|
-
|
|
2666
|
+
for (const panel of ui.panels ?? [])
|
|
2667
|
+
checkPanel(panel, seen, "admin panel");
|
|
2668
|
+
for (const extension of ui.extensions ?? []) {
|
|
2669
|
+
if (extension.kind === "panel") {
|
|
2670
|
+
checkPanel(extension, seen, "admin extension");
|
|
2671
|
+
continue;
|
|
2392
2672
|
}
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
seen.add(panel.id);
|
|
2396
|
-
if (panel.title.trim() === "")
|
|
2397
|
-
throw new RangeError(`admin panel ${panel.id} needs a title`);
|
|
2673
|
+
const id = extension.id ?? "sql";
|
|
2674
|
+
checkPanel({ id, title: extension.title ?? "SQL" }, seen, "admin extension");
|
|
2398
2675
|
}
|
|
2399
2676
|
};
|
|
2400
2677
|
|
|
@@ -2555,9 +2832,24 @@ var renderAdminDocument = (service) => {
|
|
|
2555
2832
|
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
|
2556
2833
|
label.field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--faint); }
|
|
2557
2834
|
label.field input, label.field select, .controls input[type="password"] {
|
|
2558
|
-
background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
|
|
2559
|
-
padding: 7px 8px; min-height: 36px;
|
|
2560
|
-
}
|
|
2835
|
+
background-color: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
|
|
2836
|
+
padding: 7px 8px; min-height: 36px; line-height: 1.2;
|
|
2837
|
+
}
|
|
2838
|
+
/* A native menu ignores min-height, so Preset rendered about half as tall as
|
|
2839
|
+
the text fields in the same form. Paint it like those fields. */
|
|
2840
|
+
label.field select {
|
|
2841
|
+
-webkit-appearance: none; appearance: none;
|
|
2842
|
+
padding-right: 28px;
|
|
2843
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2371717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
|
|
2844
|
+
background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 12px;
|
|
2845
|
+
}
|
|
2846
|
+
.stack > .field > input,
|
|
2847
|
+
.stack > .field > select,
|
|
2848
|
+
.stack > .field > textarea,
|
|
2849
|
+
dialog .field > input,
|
|
2850
|
+
dialog .field > select,
|
|
2851
|
+
dialog .field > textarea { width: 100%; }
|
|
2852
|
+
.icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger, nav.side button { cursor: pointer; }
|
|
2561
2853
|
.icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger {
|
|
2562
2854
|
border-radius: 9px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line);
|
|
2563
2855
|
background: var(--bg-elev);
|
|
@@ -2565,6 +2857,14 @@ var renderAdminDocument = (service) => {
|
|
|
2565
2857
|
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
|
|
2566
2858
|
.btn-quiet { background: transparent; }
|
|
2567
2859
|
.btn-danger { color: var(--err); }
|
|
2860
|
+
/* Held after mouseup. Clearing an empty journal changes nothing on screen,
|
|
2861
|
+
so the press itself has to stay visible. */
|
|
2862
|
+
.icon-btn:active, .btn:active, .btn-quiet:active, .btn-danger:active, nav.side button:active,
|
|
2863
|
+
.icon-btn.pressed, .btn.pressed, .btn-quiet.pressed, .btn-danger.pressed, nav.side button.pressed {
|
|
2864
|
+
background: var(--bg-inset); border-color: var(--line-strong); color: var(--ink);
|
|
2865
|
+
}
|
|
2866
|
+
.btn-danger:active, .btn-danger.pressed { background: var(--err-soft); color: var(--err); }
|
|
2867
|
+
.btn-primary:active, .btn-primary.pressed { filter: brightness(0.88); color: var(--accent-ink); }
|
|
2568
2868
|
/* minmax(0, 1fr): a 1fr column will not shrink below its content, so a long
|
|
2569
2869
|
record or the full nav row would widen the page past the viewport. */
|
|
2570
2870
|
.layout {
|
|
@@ -2605,6 +2905,12 @@ var renderAdminDocument = (service) => {
|
|
|
2605
2905
|
border-radius: 999px; padding: 4px 8px;
|
|
2606
2906
|
}
|
|
2607
2907
|
.chip i { color: var(--faint); font-style: normal; }
|
|
2908
|
+
.sql-layout {
|
|
2909
|
+
display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); gap: 16px;
|
|
2910
|
+
}
|
|
2911
|
+
.sql-tables { display: flex; flex-direction: column; gap: 4px; max-height: 28rem; overflow: auto; }
|
|
2912
|
+
.sql-tables button { text-align: left; }
|
|
2913
|
+
.sql-input { font-family: var(--mono); min-height: 7rem; width: 100%; }
|
|
2608
2914
|
table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
2609
2915
|
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
2610
2916
|
th { color: var(--faint); font-weight: 600; font-size: 12px; }
|
|
@@ -2653,14 +2959,22 @@ var renderAdminDocument = (service) => {
|
|
|
2653
2959
|
input, select, textarea { font-size: 16px; }
|
|
2654
2960
|
.brand, .vendor, .controls { width: 100%; }
|
|
2655
2961
|
label.field, label.field select, label.field input { flex: 1; min-width: 0; }
|
|
2656
|
-
|
|
2962
|
+
/* The layout fills the screen. A single-column grid stretches every auto
|
|
2963
|
+
row, so the tab bar grew with the leftover height and the buttons floated
|
|
2964
|
+
in the middle of it. The bar stays one row; the page below takes the rest. */
|
|
2965
|
+
.layout {
|
|
2966
|
+
grid-template-columns: minmax(0, 1fr);
|
|
2967
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
2968
|
+
align-content: start;
|
|
2969
|
+
}
|
|
2657
2970
|
nav.side {
|
|
2971
|
+
align-self: start; height: auto;
|
|
2658
2972
|
flex-direction: row; align-items: center; overflow-x: auto; min-width: 0;
|
|
2659
2973
|
border-right: 0; border-bottom: 1px solid var(--line);
|
|
2660
2974
|
padding: 8px;
|
|
2661
2975
|
}
|
|
2662
2976
|
nav.side button { white-space: nowrap; flex: none; }
|
|
2663
|
-
.split { grid-template-columns: minmax(0, 1fr); }
|
|
2977
|
+
.split, .sql-layout { grid-template-columns: minmax(0, 1fr); }
|
|
2664
2978
|
main { padding: 14px; }
|
|
2665
2979
|
table, thead, tbody, tr, th, td { display: block; }
|
|
2666
2980
|
thead { display: none; }
|
|
@@ -2831,6 +3145,24 @@ var json2 = (body) => new Response(JSON.stringify(body), {
|
|
|
2831
3145
|
status: 200,
|
|
2832
3146
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
2833
3147
|
});
|
|
3148
|
+
var describeExtension = (extension) => {
|
|
3149
|
+
if (extension.kind === "sql") {
|
|
3150
|
+
return {
|
|
3151
|
+
kind: "sql",
|
|
3152
|
+
id: extension.id ?? "sql",
|
|
3153
|
+
title: extension.title ?? "SQL",
|
|
3154
|
+
...extension.description !== void 0 ? { description: extension.description } : {}
|
|
3155
|
+
};
|
|
3156
|
+
}
|
|
3157
|
+
return {
|
|
3158
|
+
kind: "panel",
|
|
3159
|
+
id: extension.id,
|
|
3160
|
+
title: extension.title,
|
|
3161
|
+
...extension.description !== void 0 ? { description: extension.description } : {},
|
|
3162
|
+
html: extension.html,
|
|
3163
|
+
...extension.script !== void 0 ? { script: extension.script } : {}
|
|
3164
|
+
};
|
|
3165
|
+
};
|
|
2834
3166
|
var adminUiRoutes = (service, ui) => {
|
|
2835
3167
|
const shell = () => renderAdminDocument(service);
|
|
2836
3168
|
const document3 = () => ui?.render ? ui.render({ service, defaultHtml: shell }) : shell();
|
|
@@ -2845,7 +3177,8 @@ var adminUiRoutes = (service, ui) => {
|
|
|
2845
3177
|
...panel.description !== void 0 ? { description: panel.description } : {},
|
|
2846
3178
|
html: panel.html,
|
|
2847
3179
|
...panel.script !== void 0 ? { script: panel.script } : {}
|
|
2848
|
-
}))
|
|
3180
|
+
})),
|
|
3181
|
+
extensions: (ui?.extensions ?? []).map(describeExtension)
|
|
2849
3182
|
})
|
|
2850
3183
|
};
|
|
2851
3184
|
};
|
|
@@ -3448,7 +3781,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
3448
3781
|
};
|
|
3449
3782
|
|
|
3450
3783
|
// ../core/dist/version.js
|
|
3451
|
-
var PACKAGE_VERSION = true ? "1.
|
|
3784
|
+
var PACKAGE_VERSION = true ? "1.8.0" : UNRELEASED_VERSION;
|
|
3452
3785
|
|
|
3453
3786
|
// ../core/dist/signing.js
|
|
3454
3787
|
var encoder = new TextEncoder();
|
|
@@ -5266,6 +5599,14 @@ var POSTAL_ADDRESS = /* @__PURE__ */ new Set([
|
|
|
5266
5599
|
var MAX_INPUT_LENGTH = 280;
|
|
5267
5600
|
var MAX_ADDRESS_LINES = 3;
|
|
5268
5601
|
var MAX_ADDRESS_LINE_LENGTH = 80;
|
|
5602
|
+
var MAX_BARE_UNIT_LENGTH = 8;
|
|
5603
|
+
var postalLines = (parts) => {
|
|
5604
|
+
const pieces = parts.map((part) => part.trim()).filter(Boolean);
|
|
5605
|
+
if (pieces.length === 0) return [];
|
|
5606
|
+
const joined = pieces.join(" ");
|
|
5607
|
+
if (joined.length <= MAX_ADDRESS_LINE_LENGTH) return [joined];
|
|
5608
|
+
return pieces.map((part) => part.slice(0, MAX_ADDRESS_LINE_LENGTH)).slice(0, MAX_ADDRESS_LINES);
|
|
5609
|
+
};
|
|
5269
5610
|
var isRecord6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5270
5611
|
var optionalString = (value, field) => {
|
|
5271
5612
|
if (value === void 0 || value === null) return void 0;
|
|
@@ -5447,7 +5788,10 @@ var resolve = (input, rows) => {
|
|
|
5447
5788
|
const second = rest.join(" ").trim();
|
|
5448
5789
|
if (second) {
|
|
5449
5790
|
const only = UNIT_ONLY.exec(second);
|
|
5450
|
-
|
|
5791
|
+
const value = only?.[2];
|
|
5792
|
+
if (only && value && (only[1] !== void 0 || value.length <= MAX_BARE_UNIT_LENGTH)) {
|
|
5793
|
+
unit = parseUnit(only[1], value);
|
|
5794
|
+
}
|
|
5451
5795
|
}
|
|
5452
5796
|
} else {
|
|
5453
5797
|
const joined = input.addressLines.join(", ");
|
|
@@ -5610,13 +5954,14 @@ var validateAddress = (request, rows, options = {}) => {
|
|
|
5610
5954
|
hasInferred = input.regionCode === void 0;
|
|
5611
5955
|
unconfirmed = components.filter((c) => c.confirmationLevel !== "CONFIRMED").map((c) => c.componentType);
|
|
5612
5956
|
const line = [streetText, unit ? unitText(unit) : ""].filter(Boolean).join(" ");
|
|
5957
|
+
const lines = postalLines([streetText, unit ? unitText(unit) : ""]);
|
|
5613
5958
|
postalAddress = compact({
|
|
5614
5959
|
regionCode: region,
|
|
5615
5960
|
languageCode: "en",
|
|
5616
5961
|
postalCode: input.postalCode,
|
|
5617
5962
|
administrativeArea: state,
|
|
5618
5963
|
locality: input.locality,
|
|
5619
|
-
addressLines:
|
|
5964
|
+
addressLines: lines.length > 0 ? lines : void 0
|
|
5620
5965
|
});
|
|
5621
5966
|
formattedAddress2 = [
|
|
5622
5967
|
line,
|
|
@@ -5700,7 +6045,7 @@ var validateAddress = (request, rows, options = {}) => {
|
|
|
5700
6045
|
postalCode: zip,
|
|
5701
6046
|
administrativeArea: row2.state,
|
|
5702
6047
|
locality: row2.city,
|
|
5703
|
-
addressLines: [
|
|
6048
|
+
addressLines: postalLines([street, r.unit ? unitText(r.unit) : ""])
|
|
5704
6049
|
};
|
|
5705
6050
|
formattedAddress2 = `${line}, ${row2.city}, ${row2.state} ${zip}, USA`;
|
|
5706
6051
|
const place = r.inCorpus ? { placeId: corpusPlaceId(row2), lat: row2.lat, lng: row2.lng } : synthesize(street, row2);
|
|
@@ -6294,4 +6639,4 @@ export {
|
|
|
6294
6639
|
keyCredential,
|
|
6295
6640
|
GoogleMapsAPI
|
|
6296
6641
|
};
|
|
6297
|
-
//# sourceMappingURL=chunk-
|
|
6642
|
+
//# sourceMappingURL=chunk-R6B7E6A7.js.map
|