@crvouga/mockingbird-service-paddle 0.3.0 → 0.4.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 +19 -1
- package/dist/{chunk-YFGZYQKB.js → chunk-LPIE6CZL.js} +2 -2
- package/dist/{chunk-2LDOLWZ5.js → chunk-RJQUGROO.js} +355 -22
- package/dist/chunk-RJQUGROO.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-2LDOLWZ5.js.map +0 -7
- /package/dist/{chunk-YFGZYQKB.js.map → chunk-LPIE6CZL.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-paddle
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.4.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
|
+
## 0.3.1 (2026-09-30)
|
|
14
|
+
|
|
15
|
+
### Fixes and improvements
|
|
16
|
+
|
|
17
|
+
- keep admin buttons pressed until the action finishes ([0aabfcb](https://github.com/crvouga/mockingbird/commit/0aabfcb5f392aa51e193f9c3f817d5877d92bc6a))
|
|
18
|
+
- size admin select fields like the text inputs beside them ([0fb3ef2](https://github.com/crvouga/mockingbird/commit/0fb3ef2ddbf43376c93a2ae6d87c6c9bf890dafc))
|
|
19
|
+
- keep admin section tabs wired when boot is renamed ([4eda25e](https://github.com/crvouga/mockingbird/commit/4eda25eacd59da048d196f7cc8369d7a02b47bfc))
|
|
20
|
+
|
|
21
|
+
## 0.3.0 (2026-09-29)
|
|
4
22
|
|
|
5
23
|
### Features
|
|
6
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RJQUGROO.js";
|
|
4
4
|
|
|
5
5
|
// ../../adapters/node/dist/cli.js
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
@@ -370,4 +370,4 @@ export {
|
|
|
370
370
|
createServer2 as createServer,
|
|
371
371
|
serveTarget
|
|
372
372
|
};
|
|
373
|
-
//# sourceMappingURL=chunk-
|
|
373
|
+
//# sourceMappingURL=chunk-LPIE6CZL.js.map
|
|
@@ -1843,6 +1843,167 @@ function faultPresetList(value) {
|
|
|
1843
1843
|
})
|
|
1844
1844
|
};
|
|
1845
1845
|
}
|
|
1846
|
+
function mountSqlExplorer(root, api) {
|
|
1847
|
+
const cell = (value) => {
|
|
1848
|
+
if (value === null || value === void 0)
|
|
1849
|
+
return "";
|
|
1850
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1851
|
+
return String(value);
|
|
1852
|
+
}
|
|
1853
|
+
return JSON.stringify(value) ?? "";
|
|
1854
|
+
};
|
|
1855
|
+
root.replaceChildren();
|
|
1856
|
+
const layout = document.createElement("div");
|
|
1857
|
+
layout.className = "sql-layout";
|
|
1858
|
+
const tables = document.createElement("div");
|
|
1859
|
+
tables.className = "sql-tables";
|
|
1860
|
+
const stack = document.createElement("div");
|
|
1861
|
+
stack.className = "stack";
|
|
1862
|
+
const banner = document.createElement("p");
|
|
1863
|
+
banner.className = "banner";
|
|
1864
|
+
const grid = document.createElement("div");
|
|
1865
|
+
const input = document.createElement("textarea");
|
|
1866
|
+
input.className = "sql-input";
|
|
1867
|
+
input.spellcheck = false;
|
|
1868
|
+
input.placeholder = "SELECT * FROM ...";
|
|
1869
|
+
const actions = document.createElement("div");
|
|
1870
|
+
actions.className = "row-actions";
|
|
1871
|
+
const run = document.createElement("button");
|
|
1872
|
+
run.type = "button";
|
|
1873
|
+
run.textContent = "Run";
|
|
1874
|
+
actions.append(run);
|
|
1875
|
+
const result = document.createElement("pre");
|
|
1876
|
+
stack.append(banner, grid, input, actions, result);
|
|
1877
|
+
layout.append(tables, stack);
|
|
1878
|
+
root.append(layout);
|
|
1879
|
+
const showError = (error) => {
|
|
1880
|
+
banner.textContent = error instanceof Error ? error.message : String(error);
|
|
1881
|
+
banner.classList.add("show");
|
|
1882
|
+
};
|
|
1883
|
+
const clearError = () => {
|
|
1884
|
+
banner.textContent = "";
|
|
1885
|
+
banner.classList.remove("show");
|
|
1886
|
+
};
|
|
1887
|
+
const renderGrid = (columns, rows) => {
|
|
1888
|
+
grid.replaceChildren();
|
|
1889
|
+
if (columns.length === 0) {
|
|
1890
|
+
const empty = document.createElement("p");
|
|
1891
|
+
empty.className = "empty";
|
|
1892
|
+
empty.textContent = "No rows.";
|
|
1893
|
+
grid.append(empty);
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
const table = document.createElement("table");
|
|
1897
|
+
const head = document.createElement("thead");
|
|
1898
|
+
const headRow = document.createElement("tr");
|
|
1899
|
+
for (const column of columns) {
|
|
1900
|
+
const th = document.createElement("th");
|
|
1901
|
+
th.textContent = column;
|
|
1902
|
+
headRow.append(th);
|
|
1903
|
+
}
|
|
1904
|
+
head.append(headRow);
|
|
1905
|
+
const body = document.createElement("tbody");
|
|
1906
|
+
for (const row of rows) {
|
|
1907
|
+
const tr = document.createElement("tr");
|
|
1908
|
+
for (const column of columns) {
|
|
1909
|
+
const td = document.createElement("td");
|
|
1910
|
+
td.dataset.label = column;
|
|
1911
|
+
td.textContent = cell(row[column]);
|
|
1912
|
+
tr.append(td);
|
|
1913
|
+
}
|
|
1914
|
+
body.append(tr);
|
|
1915
|
+
}
|
|
1916
|
+
table.append(head, body);
|
|
1917
|
+
grid.append(table);
|
|
1918
|
+
};
|
|
1919
|
+
const rowsOf = (value) => {
|
|
1920
|
+
if (!isRecord2(value) || !Array.isArray(value.rows))
|
|
1921
|
+
return [];
|
|
1922
|
+
return value.rows.flatMap((row) => isRecord2(row) ? [row] : []);
|
|
1923
|
+
};
|
|
1924
|
+
const columnsOf = (value, rows) => {
|
|
1925
|
+
if (isRecord2(value) && Array.isArray(value.columns)) {
|
|
1926
|
+
const named = value.columns.flatMap((column) => typeof column === "string" ? [column] : []);
|
|
1927
|
+
if (named.length > 0)
|
|
1928
|
+
return named;
|
|
1929
|
+
}
|
|
1930
|
+
const first = rows[0];
|
|
1931
|
+
return first === void 0 ? [] : Object.keys(first);
|
|
1932
|
+
};
|
|
1933
|
+
let selected = "";
|
|
1934
|
+
const loadPage = async (schema, name) => {
|
|
1935
|
+
selected = `${schema}.${name}`;
|
|
1936
|
+
const page = await api.get(`/sql/tables/${encodeURIComponent(schema)}/${encodeURIComponent(name)}?limit=50`);
|
|
1937
|
+
const rows = rowsOf(page);
|
|
1938
|
+
renderGrid(columnsOf(page, rows), rows);
|
|
1939
|
+
const total = isRecord2(page) && typeof page.total === "number" ? page.total : rows.length;
|
|
1940
|
+
result.textContent = `${selected} \xB7 ${total} rows`;
|
|
1941
|
+
for (const button of tables.querySelectorAll("button")) {
|
|
1942
|
+
if (!(button instanceof HTMLButtonElement))
|
|
1943
|
+
continue;
|
|
1944
|
+
button.setAttribute("aria-current", button.dataset.schema === schema && button.dataset.table === name ? "true" : "false");
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
const loadTables = async () => {
|
|
1948
|
+
const payload = await api.get("/sql/tables");
|
|
1949
|
+
const listed = isRecord2(payload) && Array.isArray(payload.tables) ? payload.tables : [];
|
|
1950
|
+
tables.replaceChildren();
|
|
1951
|
+
if (listed.length === 0) {
|
|
1952
|
+
const empty = document.createElement("p");
|
|
1953
|
+
empty.className = "empty";
|
|
1954
|
+
empty.textContent = "No tables.";
|
|
1955
|
+
tables.append(empty);
|
|
1956
|
+
return;
|
|
1957
|
+
}
|
|
1958
|
+
for (const item of listed) {
|
|
1959
|
+
if (!isRecord2(item) || typeof item.schema !== "string" || typeof item.name !== "string")
|
|
1960
|
+
continue;
|
|
1961
|
+
const button = document.createElement("button");
|
|
1962
|
+
button.type = "button";
|
|
1963
|
+
button.dataset.schema = item.schema;
|
|
1964
|
+
button.dataset.table = item.name;
|
|
1965
|
+
button.textContent = `${item.schema}.${item.name}`;
|
|
1966
|
+
tables.append(button);
|
|
1967
|
+
}
|
|
1968
|
+
};
|
|
1969
|
+
tables.addEventListener("click", (event) => {
|
|
1970
|
+
const target = event.target;
|
|
1971
|
+
if (!(target instanceof Element))
|
|
1972
|
+
return;
|
|
1973
|
+
const button = target.closest("button");
|
|
1974
|
+
if (!(button instanceof HTMLButtonElement))
|
|
1975
|
+
return;
|
|
1976
|
+
const schema = button.dataset.schema;
|
|
1977
|
+
const name = button.dataset.table;
|
|
1978
|
+
if (schema === void 0 || name === void 0)
|
|
1979
|
+
return;
|
|
1980
|
+
clearError();
|
|
1981
|
+
loadPage(schema, name).catch(showError);
|
|
1982
|
+
});
|
|
1983
|
+
run.addEventListener("click", () => {
|
|
1984
|
+
const sql = input.value.trim();
|
|
1985
|
+
if (sql === "") {
|
|
1986
|
+
showError(new Error("Enter a statement"));
|
|
1987
|
+
return;
|
|
1988
|
+
}
|
|
1989
|
+
clearError();
|
|
1990
|
+
api.send("POST", "/sql/query", { sql }).then((payload) => {
|
|
1991
|
+
const rows = rowsOf(payload);
|
|
1992
|
+
renderGrid(columnsOf(payload, rows), rows);
|
|
1993
|
+
const count = isRecord2(payload) && typeof payload.rowCount === "number" ? payload.rowCount : rows.length;
|
|
1994
|
+
const truncated = isRecord2(payload) && payload.truncated === true ? " (truncated)" : "";
|
|
1995
|
+
result.textContent = `${count} rows${truncated}`;
|
|
1996
|
+
}).catch(showError);
|
|
1997
|
+
});
|
|
1998
|
+
const namespace = document.getElementById("namespace");
|
|
1999
|
+
if (namespace) {
|
|
2000
|
+
namespace.addEventListener("change", () => {
|
|
2001
|
+
clearError();
|
|
2002
|
+
loadTables().catch(showError);
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
2005
|
+
loadTables().catch(showError);
|
|
2006
|
+
}
|
|
1846
2007
|
function bootAdmin(config) {
|
|
1847
2008
|
const fieldKinds = ["string", "number", "boolean", "null", "object", "array", "unknown"];
|
|
1848
2009
|
const sources = ["declared", "inferred", "mixed"];
|
|
@@ -2283,6 +2444,50 @@ function bootAdmin(config) {
|
|
|
2283
2444
|
if (render)
|
|
2284
2445
|
await render();
|
|
2285
2446
|
}
|
|
2447
|
+
const delay = (ms) => new Promise((resolve) => {
|
|
2448
|
+
window.setTimeout(resolve, ms);
|
|
2449
|
+
});
|
|
2450
|
+
const confirmAction = async (button, pending, done, work) => {
|
|
2451
|
+
if (button.dataset.pending === "1")
|
|
2452
|
+
return;
|
|
2453
|
+
const label = button.textContent ?? "";
|
|
2454
|
+
const width = button.offsetWidth;
|
|
2455
|
+
button.dataset.pending = "1";
|
|
2456
|
+
button.classList.add("pressed");
|
|
2457
|
+
button.setAttribute("aria-busy", "true");
|
|
2458
|
+
button.style.minWidth = `${width}px`;
|
|
2459
|
+
button.textContent = pending;
|
|
2460
|
+
try {
|
|
2461
|
+
await work();
|
|
2462
|
+
button.textContent = done;
|
|
2463
|
+
await delay(1e3);
|
|
2464
|
+
} catch (error) {
|
|
2465
|
+
showError(error);
|
|
2466
|
+
} finally {
|
|
2467
|
+
button.textContent = label;
|
|
2468
|
+
button.style.minWidth = "";
|
|
2469
|
+
button.classList.remove("pressed");
|
|
2470
|
+
button.removeAttribute("aria-busy");
|
|
2471
|
+
delete button.dataset.pending;
|
|
2472
|
+
}
|
|
2473
|
+
};
|
|
2474
|
+
document.addEventListener("click", (event) => {
|
|
2475
|
+
const target = event.target;
|
|
2476
|
+
if (!(target instanceof Element))
|
|
2477
|
+
return;
|
|
2478
|
+
const button = target.closest("button");
|
|
2479
|
+
if (!(button instanceof HTMLButtonElement) || button.dataset.pending === "1")
|
|
2480
|
+
return;
|
|
2481
|
+
button.classList.add("pressed");
|
|
2482
|
+
const token = String(Date.now());
|
|
2483
|
+
button.dataset.press = token;
|
|
2484
|
+
window.setTimeout(() => {
|
|
2485
|
+
if (button.dataset.press !== token || button.dataset.pending === "1")
|
|
2486
|
+
return;
|
|
2487
|
+
button.classList.remove("pressed");
|
|
2488
|
+
delete button.dataset.press;
|
|
2489
|
+
}, 450);
|
|
2490
|
+
});
|
|
2286
2491
|
el("namespace", HTMLSelectElement).addEventListener("change", () => {
|
|
2287
2492
|
state.namespace = el("namespace", HTMLSelectElement).value;
|
|
2288
2493
|
refresh().catch(showError);
|
|
@@ -2293,7 +2498,7 @@ function bootAdmin(config) {
|
|
|
2293
2498
|
refresh().catch(showError);
|
|
2294
2499
|
});
|
|
2295
2500
|
el("refresh", HTMLButtonElement).addEventListener("click", () => {
|
|
2296
|
-
refresh().catch(showError);
|
|
2501
|
+
confirmAction(el("refresh", HTMLButtonElement), "Refreshing...", "Updated", () => refresh()).catch(showError);
|
|
2297
2502
|
});
|
|
2298
2503
|
el("collections", HTMLElement).addEventListener("click", (event) => {
|
|
2299
2504
|
const target = event.target;
|
|
@@ -2416,10 +2621,10 @@ function bootAdmin(config) {
|
|
|
2416
2621
|
}).then(() => renderFaults()).catch(showError);
|
|
2417
2622
|
});
|
|
2418
2623
|
el("fault-clear", HTMLButtonElement).addEventListener("click", () => {
|
|
2419
|
-
api("DELETE", "/faults").then(() => renderFaults()).catch(showError);
|
|
2624
|
+
confirmAction(el("fault-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/faults").then(() => renderFaults())).catch(showError);
|
|
2420
2625
|
});
|
|
2421
2626
|
el("journal-clear", HTMLButtonElement).addEventListener("click", () => {
|
|
2422
|
-
api("DELETE", "/requests").then(() => renderJournal()).catch(showError);
|
|
2627
|
+
confirmAction(el("journal-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/requests").then(() => renderJournal())).catch(showError);
|
|
2423
2628
|
});
|
|
2424
2629
|
el("route-list", HTMLElement).addEventListener("click", (event) => {
|
|
2425
2630
|
const target = event.target;
|
|
@@ -2475,6 +2680,22 @@ function bootAdmin(config) {
|
|
|
2475
2680
|
panel.script = value.script;
|
|
2476
2681
|
return panel;
|
|
2477
2682
|
};
|
|
2683
|
+
const decodeExtension = (value) => {
|
|
2684
|
+
if (!isRecord2(value))
|
|
2685
|
+
return void 0;
|
|
2686
|
+
if (value.kind === "sql") {
|
|
2687
|
+
return {
|
|
2688
|
+
kind: "sql",
|
|
2689
|
+
id: typeof value.id === "string" && value.id !== "" ? value.id : "sql",
|
|
2690
|
+
title: typeof value.title === "string" && value.title !== "" ? value.title : "SQL",
|
|
2691
|
+
description: typeof value.description === "string" ? value.description : "Browse tables and run queries."
|
|
2692
|
+
};
|
|
2693
|
+
}
|
|
2694
|
+
if (value.kind !== "panel")
|
|
2695
|
+
return void 0;
|
|
2696
|
+
const panel = decodePanel(value);
|
|
2697
|
+
return panel === void 0 ? void 0 : { kind: "panel", ...panel };
|
|
2698
|
+
};
|
|
2478
2699
|
const mountPanels = (panels) => {
|
|
2479
2700
|
const nav = el("nav", HTMLElement);
|
|
2480
2701
|
const views = el("views", HTMLElement);
|
|
@@ -2528,15 +2749,57 @@ function bootAdmin(config) {
|
|
|
2528
2749
|
return decoded === void 0 ? [] : [decoded];
|
|
2529
2750
|
});
|
|
2530
2751
|
mountPanels(panels);
|
|
2752
|
+
const extensions = requireList(isRecord2(manifest) ? manifest.extensions : void 0, "Extensions").flatMap((extension) => {
|
|
2753
|
+
const decoded = decodeExtension(extension);
|
|
2754
|
+
return decoded === void 0 ? [] : [decoded];
|
|
2755
|
+
});
|
|
2756
|
+
const extensionPanels = extensions.flatMap((extension) => extension.kind === "panel" ? [extension] : []);
|
|
2757
|
+
mountPanels(extensionPanels);
|
|
2758
|
+
for (const extension of extensions) {
|
|
2759
|
+
if (extension.kind !== "sql")
|
|
2760
|
+
continue;
|
|
2761
|
+
const nav = el("nav", HTMLElement);
|
|
2762
|
+
const views = el("views", HTMLElement);
|
|
2763
|
+
const button = document.createElement("button");
|
|
2764
|
+
button.type = "button";
|
|
2765
|
+
button.dataset.view = extension.id;
|
|
2766
|
+
button.textContent = extension.title;
|
|
2767
|
+
nav.append(button);
|
|
2768
|
+
const section = document.createElement("section");
|
|
2769
|
+
section.className = "view";
|
|
2770
|
+
section.id = `view-${extension.id}`;
|
|
2771
|
+
section.hidden = true;
|
|
2772
|
+
const title = document.createElement("h2");
|
|
2773
|
+
title.textContent = extension.title;
|
|
2774
|
+
const lede = document.createElement("p");
|
|
2775
|
+
lede.className = "lede";
|
|
2776
|
+
lede.textContent = extension.description;
|
|
2777
|
+
const body = document.createElement("div");
|
|
2778
|
+
body.className = "panel-body";
|
|
2779
|
+
section.append(title, lede, body);
|
|
2780
|
+
views.append(section);
|
|
2781
|
+
mountSqlExplorer(body, panelApi);
|
|
2782
|
+
}
|
|
2531
2783
|
return refresh();
|
|
2532
2784
|
}).catch(showError);
|
|
2533
2785
|
}
|
|
2534
|
-
var clientPrelude = [
|
|
2786
|
+
var clientPrelude = [
|
|
2787
|
+
isRecord2,
|
|
2788
|
+
mountAdminBrand,
|
|
2789
|
+
startAdminBrand,
|
|
2790
|
+
faultPresetList,
|
|
2791
|
+
mountSqlExplorer,
|
|
2792
|
+
bootAdmin
|
|
2793
|
+
].map((fn) => fn.toString()).join("\n");
|
|
2535
2794
|
var adminClientSource = (config) => {
|
|
2536
2795
|
const payload = JSON.stringify(config).replace(/</g, "\\u003c");
|
|
2796
|
+
const entry = bootAdmin.name;
|
|
2797
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(entry)) {
|
|
2798
|
+
throw new Error("admin client cannot call its boot function");
|
|
2799
|
+
}
|
|
2537
2800
|
return `<script>
|
|
2538
2801
|
${clientPrelude}
|
|
2539
|
-
|
|
2802
|
+
${entry}(${payload});
|
|
2540
2803
|
</script>`;
|
|
2541
2804
|
};
|
|
2542
2805
|
|
|
@@ -2577,19 +2840,33 @@ var STANDARD_ADMIN_ROUTES = [
|
|
|
2577
2840
|
"GET /ui/manifest"
|
|
2578
2841
|
];
|
|
2579
2842
|
var PANEL_ID = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
|
|
2843
|
+
var RESERVED_VIEWS = /* @__PURE__ */ new Set(["overview", "state", "clock", "faults", "journal", "routes"]);
|
|
2844
|
+
var checkPanel = (panel, seen, label) => {
|
|
2845
|
+
if (!PANEL_ID.test(panel.id)) {
|
|
2846
|
+
throw new RangeError(`${label} id must match ${PANEL_ID}: ${JSON.stringify(panel.id)}`);
|
|
2847
|
+
}
|
|
2848
|
+
if (RESERVED_VIEWS.has(panel.id)) {
|
|
2849
|
+
throw new RangeError(`${label} id ${panel.id} is reserved by the admin shell`);
|
|
2850
|
+
}
|
|
2851
|
+
if (seen.has(panel.id))
|
|
2852
|
+
throw new RangeError(`duplicate admin view id ${panel.id}`);
|
|
2853
|
+
seen.add(panel.id);
|
|
2854
|
+
if (panel.title.trim() === "")
|
|
2855
|
+
throw new RangeError(`${label} ${panel.id} needs a title`);
|
|
2856
|
+
};
|
|
2580
2857
|
var assertAdminUi = (ui) => {
|
|
2581
|
-
if (!ui
|
|
2858
|
+
if (!ui)
|
|
2582
2859
|
return;
|
|
2583
2860
|
const seen = /* @__PURE__ */ new Set();
|
|
2584
|
-
for (const panel of ui.panels)
|
|
2585
|
-
|
|
2586
|
-
|
|
2861
|
+
for (const panel of ui.panels ?? [])
|
|
2862
|
+
checkPanel(panel, seen, "admin panel");
|
|
2863
|
+
for (const extension of ui.extensions ?? []) {
|
|
2864
|
+
if (extension.kind === "panel") {
|
|
2865
|
+
checkPanel(extension, seen, "admin extension");
|
|
2866
|
+
continue;
|
|
2587
2867
|
}
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
seen.add(panel.id);
|
|
2591
|
-
if (panel.title.trim() === "")
|
|
2592
|
-
throw new RangeError(`admin panel ${panel.id} needs a title`);
|
|
2868
|
+
const id = extension.id ?? "sql";
|
|
2869
|
+
checkPanel({ id, title: extension.title ?? "SQL" }, seen, "admin extension");
|
|
2593
2870
|
}
|
|
2594
2871
|
};
|
|
2595
2872
|
|
|
@@ -2750,9 +3027,24 @@ var renderAdminDocument = (service) => {
|
|
|
2750
3027
|
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
|
2751
3028
|
label.field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--faint); }
|
|
2752
3029
|
label.field input, label.field select, .controls input[type="password"] {
|
|
2753
|
-
background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
|
|
2754
|
-
padding: 7px 8px; min-height: 36px;
|
|
2755
|
-
}
|
|
3030
|
+
background-color: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
|
|
3031
|
+
padding: 7px 8px; min-height: 36px; line-height: 1.2;
|
|
3032
|
+
}
|
|
3033
|
+
/* A native menu ignores min-height, so Preset rendered about half as tall as
|
|
3034
|
+
the text fields in the same form. Paint it like those fields. */
|
|
3035
|
+
label.field select {
|
|
3036
|
+
-webkit-appearance: none; appearance: none;
|
|
3037
|
+
padding-right: 28px;
|
|
3038
|
+
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");
|
|
3039
|
+
background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 12px;
|
|
3040
|
+
}
|
|
3041
|
+
.stack > .field > input,
|
|
3042
|
+
.stack > .field > select,
|
|
3043
|
+
.stack > .field > textarea,
|
|
3044
|
+
dialog .field > input,
|
|
3045
|
+
dialog .field > select,
|
|
3046
|
+
dialog .field > textarea { width: 100%; }
|
|
3047
|
+
.icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger, nav.side button { cursor: pointer; }
|
|
2756
3048
|
.icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger {
|
|
2757
3049
|
border-radius: 9px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line);
|
|
2758
3050
|
background: var(--bg-elev);
|
|
@@ -2760,6 +3052,14 @@ var renderAdminDocument = (service) => {
|
|
|
2760
3052
|
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
|
|
2761
3053
|
.btn-quiet { background: transparent; }
|
|
2762
3054
|
.btn-danger { color: var(--err); }
|
|
3055
|
+
/* Held after mouseup. Clearing an empty journal changes nothing on screen,
|
|
3056
|
+
so the press itself has to stay visible. */
|
|
3057
|
+
.icon-btn:active, .btn:active, .btn-quiet:active, .btn-danger:active, nav.side button:active,
|
|
3058
|
+
.icon-btn.pressed, .btn.pressed, .btn-quiet.pressed, .btn-danger.pressed, nav.side button.pressed {
|
|
3059
|
+
background: var(--bg-inset); border-color: var(--line-strong); color: var(--ink);
|
|
3060
|
+
}
|
|
3061
|
+
.btn-danger:active, .btn-danger.pressed { background: var(--err-soft); color: var(--err); }
|
|
3062
|
+
.btn-primary:active, .btn-primary.pressed { filter: brightness(0.88); color: var(--accent-ink); }
|
|
2763
3063
|
/* minmax(0, 1fr): a 1fr column will not shrink below its content, so a long
|
|
2764
3064
|
record or the full nav row would widen the page past the viewport. */
|
|
2765
3065
|
.layout {
|
|
@@ -2800,6 +3100,12 @@ var renderAdminDocument = (service) => {
|
|
|
2800
3100
|
border-radius: 999px; padding: 4px 8px;
|
|
2801
3101
|
}
|
|
2802
3102
|
.chip i { color: var(--faint); font-style: normal; }
|
|
3103
|
+
.sql-layout {
|
|
3104
|
+
display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); gap: 16px;
|
|
3105
|
+
}
|
|
3106
|
+
.sql-tables { display: flex; flex-direction: column; gap: 4px; max-height: 28rem; overflow: auto; }
|
|
3107
|
+
.sql-tables button { text-align: left; }
|
|
3108
|
+
.sql-input { font-family: var(--mono); min-height: 7rem; width: 100%; }
|
|
2803
3109
|
table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
2804
3110
|
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
2805
3111
|
th { color: var(--faint); font-weight: 600; font-size: 12px; }
|
|
@@ -2848,14 +3154,22 @@ var renderAdminDocument = (service) => {
|
|
|
2848
3154
|
input, select, textarea { font-size: 16px; }
|
|
2849
3155
|
.brand, .vendor, .controls { width: 100%; }
|
|
2850
3156
|
label.field, label.field select, label.field input { flex: 1; min-width: 0; }
|
|
2851
|
-
|
|
3157
|
+
/* The layout fills the screen. A single-column grid stretches every auto
|
|
3158
|
+
row, so the tab bar grew with the leftover height and the buttons floated
|
|
3159
|
+
in the middle of it. The bar stays one row; the page below takes the rest. */
|
|
3160
|
+
.layout {
|
|
3161
|
+
grid-template-columns: minmax(0, 1fr);
|
|
3162
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
3163
|
+
align-content: start;
|
|
3164
|
+
}
|
|
2852
3165
|
nav.side {
|
|
3166
|
+
align-self: start; height: auto;
|
|
2853
3167
|
flex-direction: row; align-items: center; overflow-x: auto; min-width: 0;
|
|
2854
3168
|
border-right: 0; border-bottom: 1px solid var(--line);
|
|
2855
3169
|
padding: 8px;
|
|
2856
3170
|
}
|
|
2857
3171
|
nav.side button { white-space: nowrap; flex: none; }
|
|
2858
|
-
.split { grid-template-columns: minmax(0, 1fr); }
|
|
3172
|
+
.split, .sql-layout { grid-template-columns: minmax(0, 1fr); }
|
|
2859
3173
|
main { padding: 14px; }
|
|
2860
3174
|
table, thead, tbody, tr, th, td { display: block; }
|
|
2861
3175
|
thead { display: none; }
|
|
@@ -3026,6 +3340,24 @@ var json2 = (body) => new Response(JSON.stringify(body), {
|
|
|
3026
3340
|
status: 200,
|
|
3027
3341
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
3028
3342
|
});
|
|
3343
|
+
var describeExtension = (extension) => {
|
|
3344
|
+
if (extension.kind === "sql") {
|
|
3345
|
+
return {
|
|
3346
|
+
kind: "sql",
|
|
3347
|
+
id: extension.id ?? "sql",
|
|
3348
|
+
title: extension.title ?? "SQL",
|
|
3349
|
+
...extension.description !== void 0 ? { description: extension.description } : {}
|
|
3350
|
+
};
|
|
3351
|
+
}
|
|
3352
|
+
return {
|
|
3353
|
+
kind: "panel",
|
|
3354
|
+
id: extension.id,
|
|
3355
|
+
title: extension.title,
|
|
3356
|
+
...extension.description !== void 0 ? { description: extension.description } : {},
|
|
3357
|
+
html: extension.html,
|
|
3358
|
+
...extension.script !== void 0 ? { script: extension.script } : {}
|
|
3359
|
+
};
|
|
3360
|
+
};
|
|
3029
3361
|
var adminUiRoutes = (service, ui) => {
|
|
3030
3362
|
const shell = () => renderAdminDocument(service);
|
|
3031
3363
|
const document3 = () => ui?.render ? ui.render({ service, defaultHtml: shell }) : shell();
|
|
@@ -3040,7 +3372,8 @@ var adminUiRoutes = (service, ui) => {
|
|
|
3040
3372
|
...panel.description !== void 0 ? { description: panel.description } : {},
|
|
3041
3373
|
html: panel.html,
|
|
3042
3374
|
...panel.script !== void 0 ? { script: panel.script } : {}
|
|
3043
|
-
}))
|
|
3375
|
+
})),
|
|
3376
|
+
extensions: (ui?.extensions ?? []).map(describeExtension)
|
|
3044
3377
|
})
|
|
3045
3378
|
};
|
|
3046
3379
|
};
|
|
@@ -3717,7 +4050,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
3717
4050
|
};
|
|
3718
4051
|
|
|
3719
4052
|
// ../core/dist/version.js
|
|
3720
|
-
var PACKAGE_VERSION = true ? "0.
|
|
4053
|
+
var PACKAGE_VERSION = true ? "0.4.0" : UNRELEASED_VERSION;
|
|
3721
4054
|
|
|
3722
4055
|
// ../core/dist/signing.js
|
|
3723
4056
|
var encoder = new TextEncoder();
|
|
@@ -7436,4 +7769,4 @@ export {
|
|
|
7436
7769
|
AUTH_TOKEN_TTL_MS,
|
|
7437
7770
|
PaddleAPI
|
|
7438
7771
|
};
|
|
7439
|
-
//# sourceMappingURL=chunk-
|
|
7772
|
+
//# sourceMappingURL=chunk-RJQUGROO.js.map
|