@crvouga/mockingbird-service-aha 1.6.0 → 1.6.1

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 CHANGED
@@ -1,6 +1,14 @@
1
1
  # Changelog — @crvouga/mockingbird-service-aha
2
2
 
3
- ## 1.6.0 (2026-09-30)
3
+ ## 1.6.1 (2026-09-30)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - keep admin buttons pressed until the action finishes ([0aabfcb](https://github.com/crvouga/mockingbird/commit/0aabfcb5f392aa51e193f9c3f817d5877d92bc6a))
8
+ - size admin select fields like the text inputs beside them ([0fb3ef2](https://github.com/crvouga/mockingbird/commit/0fb3ef2ddbf43376c93a2ae6d87c6c9bf890dafc))
9
+ - keep admin section tabs wired when boot is renamed ([4eda25e](https://github.com/crvouga/mockingbird/commit/4eda25eacd59da048d196f7cc8369d7a02b47bfc))
10
+
11
+ ## 1.6.0 (2026-09-29)
4
12
 
5
13
  ### Features
6
14
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createRuntime
3
- } from "./chunk-NAZV2NIY.js";
3
+ } from "./chunk-O6ESJ7KQ.js";
4
4
 
5
5
  // ../../adapters/node/dist/cli.js
6
6
  import { readFile } from "node:fs/promises";
@@ -399,4 +399,4 @@ export {
399
399
  createServer2 as createServer,
400
400
  serveTarget
401
401
  };
402
- //# sourceMappingURL=chunk-BWCUTHOM.js.map
402
+ //# sourceMappingURL=chunk-7EBK3RTE.js.map
@@ -2358,6 +2358,50 @@ function bootAdmin(config) {
2358
2358
  if (render)
2359
2359
  await render();
2360
2360
  }
2361
+ const delay = (ms) => new Promise((resolve) => {
2362
+ window.setTimeout(resolve, ms);
2363
+ });
2364
+ const confirmAction = async (button, pending, done, work) => {
2365
+ if (button.dataset.pending === "1")
2366
+ return;
2367
+ const label = button.textContent ?? "";
2368
+ const width = button.offsetWidth;
2369
+ button.dataset.pending = "1";
2370
+ button.classList.add("pressed");
2371
+ button.setAttribute("aria-busy", "true");
2372
+ button.style.minWidth = `${width}px`;
2373
+ button.textContent = pending;
2374
+ try {
2375
+ await work();
2376
+ button.textContent = done;
2377
+ await delay(1e3);
2378
+ } catch (error2) {
2379
+ showError(error2);
2380
+ } finally {
2381
+ button.textContent = label;
2382
+ button.style.minWidth = "";
2383
+ button.classList.remove("pressed");
2384
+ button.removeAttribute("aria-busy");
2385
+ delete button.dataset.pending;
2386
+ }
2387
+ };
2388
+ document.addEventListener("click", (event) => {
2389
+ const target = event.target;
2390
+ if (!(target instanceof Element))
2391
+ return;
2392
+ const button = target.closest("button");
2393
+ if (!(button instanceof HTMLButtonElement) || button.dataset.pending === "1")
2394
+ return;
2395
+ button.classList.add("pressed");
2396
+ const token = String(Date.now());
2397
+ button.dataset.press = token;
2398
+ window.setTimeout(() => {
2399
+ if (button.dataset.press !== token || button.dataset.pending === "1")
2400
+ return;
2401
+ button.classList.remove("pressed");
2402
+ delete button.dataset.press;
2403
+ }, 450);
2404
+ });
2361
2405
  el("namespace", HTMLSelectElement).addEventListener("change", () => {
2362
2406
  state.namespace = el("namespace", HTMLSelectElement).value;
2363
2407
  refresh().catch(showError);
@@ -2368,7 +2412,7 @@ function bootAdmin(config) {
2368
2412
  refresh().catch(showError);
2369
2413
  });
2370
2414
  el("refresh", HTMLButtonElement).addEventListener("click", () => {
2371
- refresh().catch(showError);
2415
+ confirmAction(el("refresh", HTMLButtonElement), "Refreshing...", "Updated", () => refresh()).catch(showError);
2372
2416
  });
2373
2417
  el("collections", HTMLElement).addEventListener("click", (event) => {
2374
2418
  const target = event.target;
@@ -2491,10 +2535,10 @@ function bootAdmin(config) {
2491
2535
  }).then(() => renderFaults()).catch(showError);
2492
2536
  });
2493
2537
  el("fault-clear", HTMLButtonElement).addEventListener("click", () => {
2494
- api("DELETE", "/faults").then(() => renderFaults()).catch(showError);
2538
+ confirmAction(el("fault-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/faults").then(() => renderFaults())).catch(showError);
2495
2539
  });
2496
2540
  el("journal-clear", HTMLButtonElement).addEventListener("click", () => {
2497
- api("DELETE", "/requests").then(() => renderJournal()).catch(showError);
2541
+ confirmAction(el("journal-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/requests").then(() => renderJournal())).catch(showError);
2498
2542
  });
2499
2543
  el("route-list", HTMLElement).addEventListener("click", (event) => {
2500
2544
  const target = event.target;
@@ -2609,9 +2653,13 @@ function bootAdmin(config) {
2609
2653
  var clientPrelude = [isRecord2, mountAdminBrand, startAdminBrand, faultPresetList, bootAdmin].map((fn) => fn.toString()).join("\n");
2610
2654
  var adminClientSource = (config) => {
2611
2655
  const payload = JSON.stringify(config).replace(/</g, "\\u003c");
2656
+ const entry = bootAdmin.name;
2657
+ if (!/^[A-Za-z_$][\w$]*$/.test(entry)) {
2658
+ throw new Error("admin client cannot call its boot function");
2659
+ }
2612
2660
  return `<script>
2613
2661
  ${clientPrelude}
2614
- bootAdmin(${payload});
2662
+ ${entry}(${payload});
2615
2663
  </script>`;
2616
2664
  };
2617
2665
 
@@ -2825,9 +2873,24 @@ var renderAdminDocument = (service) => {
2825
2873
  .controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
2826
2874
  label.field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--faint); }
2827
2875
  label.field input, label.field select, .controls input[type="password"] {
2828
- background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
2829
- padding: 7px 8px; min-height: 36px;
2830
- }
2876
+ background-color: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
2877
+ padding: 7px 8px; min-height: 36px; line-height: 1.2;
2878
+ }
2879
+ /* A native menu ignores min-height, so Preset rendered about half as tall as
2880
+ the text fields in the same form. Paint it like those fields. */
2881
+ label.field select {
2882
+ -webkit-appearance: none; appearance: none;
2883
+ padding-right: 28px;
2884
+ 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");
2885
+ background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 12px;
2886
+ }
2887
+ .stack > .field > input,
2888
+ .stack > .field > select,
2889
+ .stack > .field > textarea,
2890
+ dialog .field > input,
2891
+ dialog .field > select,
2892
+ dialog .field > textarea { width: 100%; }
2893
+ .icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger, nav.side button { cursor: pointer; }
2831
2894
  .icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger {
2832
2895
  border-radius: 9px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line);
2833
2896
  background: var(--bg-elev);
@@ -2835,6 +2898,14 @@ var renderAdminDocument = (service) => {
2835
2898
  .btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
2836
2899
  .btn-quiet { background: transparent; }
2837
2900
  .btn-danger { color: var(--err); }
2901
+ /* Held after mouseup. Clearing an empty journal changes nothing on screen,
2902
+ so the press itself has to stay visible. */
2903
+ .icon-btn:active, .btn:active, .btn-quiet:active, .btn-danger:active, nav.side button:active,
2904
+ .icon-btn.pressed, .btn.pressed, .btn-quiet.pressed, .btn-danger.pressed, nav.side button.pressed {
2905
+ background: var(--bg-inset); border-color: var(--line-strong); color: var(--ink);
2906
+ }
2907
+ .btn-danger:active, .btn-danger.pressed { background: var(--err-soft); color: var(--err); }
2908
+ .btn-primary:active, .btn-primary.pressed { filter: brightness(0.88); color: var(--accent-ink); }
2838
2909
  /* minmax(0, 1fr): a 1fr column will not shrink below its content, so a long
2839
2910
  record or the full nav row would widen the page past the viewport. */
2840
2911
  .layout {
@@ -2923,8 +2994,16 @@ var renderAdminDocument = (service) => {
2923
2994
  input, select, textarea { font-size: 16px; }
2924
2995
  .brand, .vendor, .controls { width: 100%; }
2925
2996
  label.field, label.field select, label.field input { flex: 1; min-width: 0; }
2926
- .layout { grid-template-columns: minmax(0, 1fr); }
2997
+ /* The layout fills the screen. A single-column grid stretches every auto
2998
+ row, so the tab bar grew with the leftover height and the buttons floated
2999
+ in the middle of it. The bar stays one row; the page below takes the rest. */
3000
+ .layout {
3001
+ grid-template-columns: minmax(0, 1fr);
3002
+ grid-template-rows: auto minmax(0, 1fr);
3003
+ align-content: start;
3004
+ }
2927
3005
  nav.side {
3006
+ align-self: start; height: auto;
2928
3007
  flex-direction: row; align-items: center; overflow-x: auto; min-width: 0;
2929
3008
  border-right: 0; border-bottom: 1px solid var(--line);
2930
3009
  padding: 8px;
@@ -3802,7 +3881,7 @@ var stateAdminRoutes = (routes) => {
3802
3881
  };
3803
3882
 
3804
3883
  // ../core/dist/version.js
3805
- var PACKAGE_VERSION = true ? "1.6.0" : UNRELEASED_VERSION;
3884
+ var PACKAGE_VERSION = true ? "1.6.1" : UNRELEASED_VERSION;
3806
3885
 
3807
3886
  // ../core/dist/signing.js
3808
3887
  var encoder = new TextEncoder();
@@ -5522,4 +5601,4 @@ export {
5522
5601
  apiKeyCredential,
5523
5602
  AhaAPI
5524
5603
  };
5525
- //# sourceMappingURL=chunk-NAZV2NIY.js.map
5604
+ //# sourceMappingURL=chunk-O6ESJ7KQ.js.map