@hansenexus/hud 0.5.2 → 0.7.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.
Files changed (85) hide show
  1. package/README.md +64 -14
  2. package/dist/{a11y-B5DUaiCs.js → a11y-BGWw4jBr.js} +14 -2
  3. package/dist/{a11y-panel-p_t4eD7p.js → a11y-panel-DcfXnPHk.js} +1 -1
  4. package/dist/{access-D_ewAEJG.d.ts → access-Bc709qpl.d.ts} +1 -1
  5. package/dist/{access-panel-CEfTr9ZI.js → access-panel-grAsMEDk.js} +1 -1
  6. package/dist/auto/runtime.d.ts +9 -9
  7. package/dist/auto.d.ts +2 -2
  8. package/dist/auto.js +5 -5
  9. package/dist/{data-panel-BmcHCQnM.js → data-panel-B6WPNmV6.js} +1 -1
  10. package/dist/{data-store-ChF1td_P.js → data-store-FNTQKMkG.js} +1 -1
  11. package/dist/{define-hud-CHPedaQ5.d.ts → define-hud-DTv3njuU.d.ts} +15 -5
  12. package/dist/{design-D0kGgPoP.js → design-BXG1a4we.js} +21 -5
  13. package/dist/{dispatch-panel-B-xr_Giy.js → dispatch-panel-BDHgMhOk.js} +1 -1
  14. package/dist/{force-state-panel-_otVYh9i.js → force-state-panel-mu-txJnA.js} +1 -1
  15. package/dist/{handler-BpVhxEmU.js → handler-BKzaOhlJ.js} +1 -1
  16. package/dist/{handler-DtYVCZY6.d.ts → handler-DMzSTqyG.d.ts} +1 -1
  17. package/dist/icons-ByDyNq_E.js +71 -0
  18. package/dist/{index-BnQ0dTZf.d.ts → index-B1vHAY9p.d.ts} +2 -1
  19. package/dist/{index-DstI_ike.d.ts → index-BJJoAXJ2.d.ts} +5 -1
  20. package/dist/{index-BAV_1W8a.d.ts → index-BNoPbSYD.d.ts} +3 -1
  21. package/dist/{index-CwfX-W87.d.ts → index-BR5OB7DO.d.ts} +3 -0
  22. package/dist/index-C3wzZS3o.d.ts +116 -0
  23. package/dist/{index-DcH9V3cU.d.ts → index-CQXiuMZQ.d.ts} +3 -0
  24. package/dist/{index-Hhh7OXzU.d.ts → index-Caohnz3B.d.ts} +7 -1
  25. package/dist/{index-ReFbhQ9p.d.ts → index-D-hI-DRJ.d.ts} +5 -0
  26. package/dist/{index-DqOyNf1u.d.ts → index-DLCSLWW4.d.ts} +4 -2
  27. package/dist/index.d.ts +4 -4
  28. package/dist/index.js +1230 -88
  29. package/dist/{inspect-C9Ft8fqn.js → inspect-CSkm8tn3.js} +14 -2
  30. package/dist/{inspect-root-BkaupBMp.js → inspect-root-CmiFX0e5.js} +1 -1
  31. package/dist/next.d.ts +1 -1
  32. package/dist/{observe-CdDnDBRP.js → observe-CBNLU148.js} +12 -2
  33. package/dist/{observe-panel-Cgp1M8oT.js → observe-panel-zU5LD-U9.js} +1 -1
  34. package/dist/{ops-panel-CEqDe_UT.js → ops-panel-DHhAnChL.js} +1 -1
  35. package/dist/plugins/a11y.d.ts +1 -1
  36. package/dist/plugins/a11y.js +1 -1
  37. package/dist/plugins/access/server.d.ts +3 -3
  38. package/dist/plugins/access/server.js +1 -1
  39. package/dist/plugins/access.d.ts +5 -2
  40. package/dist/plugins/access.js +18 -5
  41. package/dist/plugins/agent/server.js +1 -1
  42. package/dist/plugins/agent.d.ts +4 -2
  43. package/dist/plugins/agent.js +6 -3
  44. package/dist/plugins/capture/server.js +1 -1
  45. package/dist/plugins/capture.d.ts +2 -2
  46. package/dist/plugins/capture.js +1 -1
  47. package/dist/plugins/data/server.d.ts +1 -1
  48. package/dist/plugins/data/server.js +1 -1
  49. package/dist/plugins/data.d.ts +1 -1
  50. package/dist/plugins/data.js +30 -9
  51. package/dist/plugins/design/server.d.ts +1 -1
  52. package/dist/plugins/design/server.js +1 -1
  53. package/dist/plugins/design.d.ts +1 -1
  54. package/dist/plugins/design.js +1 -1
  55. package/dist/plugins/inspect.d.ts +1 -1
  56. package/dist/plugins/inspect.js +1 -1
  57. package/dist/plugins/observe.d.ts +1 -1
  58. package/dist/plugins/observe.js +1 -1
  59. package/dist/plugins/ops/server.d.ts +1 -1
  60. package/dist/plugins/ops/server.js +1 -1
  61. package/dist/plugins/ops.d.ts +5 -1
  62. package/dist/plugins/ops.js +16 -4
  63. package/dist/plugins/routes/server.js +1 -1
  64. package/dist/plugins/routes.d.ts +1 -1
  65. package/dist/plugins/routes.js +3 -1
  66. package/dist/plugins/seo.d.ts +1 -1
  67. package/dist/plugins/seo.js +1 -1
  68. package/dist/plugins/vitals.d.ts +1 -1
  69. package/dist/plugins/vitals.js +9 -1
  70. package/dist/{plugins-BZvDqGx5.d.ts → plugins-BZT-1LBe.d.ts} +32 -3
  71. package/dist/{plugins-DVy_vaYr.js → plugins-CcW_K7c2.js} +9 -1
  72. package/dist/{poll-CjKsWZi8.js → poll-Dm0OijM4.js} +1 -1
  73. package/dist/{seo-Dq9q_QkO.js → seo-BnnGq_vj.js} +13 -2
  74. package/dist/{seo-panel-CfiY-TnT.js → seo-panel-BThx56KM.js} +1 -1
  75. package/dist/server.d.ts +2 -2
  76. package/dist/server.js +2 -2
  77. package/dist/{sessions-panel-COvhPAzv.js → sessions-panel-MknKsTge.js} +1 -1
  78. package/dist/store.d.ts +1 -1
  79. package/dist/store.js +1 -1
  80. package/dist/{unlock-store-4V3vR4Eg.js → unlock-store-CrGXQx1V.js} +1 -1
  81. package/dist/{variants-panel-BDoSkwBJ.js → variants-panel-B6zWcknV.js} +1 -1
  82. package/dist/vite.d.ts +2 -2
  83. package/dist/vite.js +1 -1
  84. package/package.json +1 -1
  85. package/dist/index-gCZBO53s.d.ts +0 -73
package/README.md CHANGED
@@ -67,8 +67,9 @@ export const HudLoader = createHudLoader(
67
67
  );
68
68
  ```
69
69
 
70
- Render `<HudLoader />` in the root layout. Plugin routes mount through one catch-all route, fed
71
- the plugins' server halves:
70
+ Render `<HudLoader />` in the root layout. The HUD then docks as an icon rail on the right edge,
71
+ as its DEV chip until clicked (see [Dock](#dock-rail-and-pill)). Plugin routes mount through
72
+ one catch-all route, fed the plugins' server halves:
72
73
 
73
74
  ```ts
74
75
  // src/app/api/hud/[...hud]/route.ts
@@ -279,8 +280,8 @@ In the playground, `?env=staging` runs this flow with the password `playground`.
279
280
 
280
281
  ## Write a plugin
281
282
 
282
- A plugin is `{ id, title?, capability?, panel?, pill?, pillPriority?, commands?, routes? }`, shipped as two
283
- halves with the same `id`: the client half (`panel`, `pill`, `commands`) and the server half
283
+ A plugin is `{ id, title?, capability?, icon?, badge?, panel?, pill?, pillPriority?, commands?, routes? }`,
284
+ shipped as two halves with the same `id`: the client half (`panel`, `pill`, `icon`, `badge`, `commands`) and the server half
284
285
  (`routes`), so route code never reaches a client bundle. The panel is a plain React component
285
286
  receiving `ctx`. Make it a dynamic import, so its code loads on first open and the pill stays
286
287
  light; the shell shows "Loading…" meanwhile and contains a panel that fails to load or throws:
@@ -305,22 +306,71 @@ follows this split, see [Bundle budget](#bundle-budget).
305
306
  | `open()` | open the panel |
306
307
  | `grab` | the element grabber: `start()`, `cancel()`, `clear()`, `amend(patch)`, `highlight(el, label)`, `clearHighlight()`; read it with `useGrab(ctx.grab)` |
307
308
 
309
+ On the rail a plugin shows as an icon with a status badge. `icon` is any 24×24 SVG component;
310
+ `hudIcon("database")` picks one of the built-in lucide shapes (`bug`, `database`, `git-branch`,
311
+ `send`, `terminal`, `palette`, `layers`, `toggle`, `crosshair`, `gauge`, `lock`, `search`,
312
+ `accessibility`, `activity`, `route`, `plug`, …; `HUD_ICON_NAMES` lists them), rendered from one
313
+ sprite, so no icon library ships. Without an icon the rail shows a plug. `badge` is called like a
314
+ component (hooks allowed) and returns `{ tone: "good" | "warn" | "poor" | "off", count? }` or
315
+ `null`: a dot in that tone, or a count bubble. `ratingTone()` maps a `.dot[data-rating]` rating.
316
+ `pill` keeps working unchanged as the tooltip text, so a plugin written for the pill needs no
317
+ change:
318
+
319
+ ```tsx
320
+ definePlugin({
321
+ id: "data",
322
+ title: "Data",
323
+ icon: hudIcon("database"),
324
+ badge: () => (useMode() === "mock" ? { tone: "warn" } : { tone: "good" }),
325
+ pill: () => <>{useMode()}</>,
326
+ });
327
+ ```
328
+
308
329
  Routes are keyed by path, then method: `routes: { "/runs/:id": { GET: (req, { params }) => ... } }`.
309
330
  An unknown path answers 404, a known path with another method 405.
310
331
 
311
332
  `playground/src/plugins/server-info` is a working example: the playground serves its routes
312
333
  through MSW with the same `createHudHandler` an app mounts.
313
334
 
314
- ## Pill
315
-
316
- - The pill starts bottom-left. It scans the page for `position: fixed` and `sticky` elements
317
- (cookie banners, chat launchers, booking CTAs, sticky navs) and takes the first corner none of
318
- them covers; when every corner is covered, it shifts off the edge that needs the smallest move,
319
- bottom corners preferred. Backdrops covering more than half the viewport are ignored.
335
+ ## Dock: rail and pill
336
+
337
+ The HUD docks as a vertical **edge rail** by default: one icon per plugin stacked on the right
338
+ edge, status as a badge on the icon (a dot in good/warn/poor/off, or a count), the plugin's title
339
+ and its live `pill` text in a tooltip beside the rail. Dark graphite chrome whatever the OS theme;
340
+ the panels keep following it. The rail reserves no page space and never crosses the content column.
341
+
342
+ - Three **detail levels**, cycled by the DEV chip and `⌘⇧D` (Ctrl+Shift+D elsewhere, `hud.detail`):
343
+ the chip alone with three summary dots (the badges of the three highest-priority plugins:
344
+ `access` 30, `observe` (errors) 20, `ops` (CI) 10, then rail order), the icon strip with tooltips,
345
+ and the labelled strip with title and live pill text per row. At the strip levels the rail runs
346
+ flat down the whole edge, square, no shadow, in three sections: the chip at the top edge, the
347
+ plugin rows aligned under it (they scroll when the window is short), the tools (Grab element,
348
+ `⋯`) at the bottom edge, on either side. Tooltips and the `⋯` menu share the look: tinted
349
+ section heads behind hairlines. The level is kept per `appSlug`; the first load is the chip.
350
+ - On a page that scrolls under an overlay scrollbar (macOS, mobile) the right-docked rail keeps a
351
+ 12 px lane free at the edge, so the thumb never paints over an icon or badge. A classic scrollbar
352
+ has its own gutter, and the rail sits inside it.
353
+ - **Customise rail** (`⋯` menu): every row shows a grip to drag it into place, arrows, and a switch
354
+ that takes it off the rail. Hidden plugins keep running and stay one menu entry away. Order and
355
+ hidden rows are kept per app; `Reset layout` forgets them.
356
+ - **Side**: `⋯ → Dock left / Dock right`, or drag the chip past the middle of the window. Kept per
357
+ app; panels open beside the rail on its side. `⋯ → Reset layout` forgets it.
358
+ - The rows sit centred on the edge and move up or down off the host's `position: fixed` and
359
+ `sticky` elements (cookie banners, chat launchers, booking CTAs), scored like the pill's shift.
360
+ - Below 900 px the rail is one 44 px round button bottom-right with a count badge; a tap opens a
361
+ two-column sheet of every plugin above it. Panels still open as the bottom sheet below 768 px.
362
+ - `prefers-reduced-motion` turns the level and tooltip transitions off.
363
+
364
+ `defineHud({ dock: "pill" })` (or `dock` on the mounted component) brings back the horizontal
365
+ **corner pill**:
366
+
367
+ - The pill starts bottom-left. It scans the page for `position: fixed` and `sticky` elements and
368
+ takes the first corner none of them covers; when every corner is covered, it shifts off the edge
369
+ that needs the smallest move, bottom corners preferred. Backdrops covering more than half the
370
+ viewport are ignored.
320
371
  - When the pill is wider than the viewport, items move into the `⋯` menu (the badge counts
321
- them). `pillPriority` decides what stays: `access` 30, `observe` (errors) 20, `ops` (CI) 10,
322
- everything else 0, then pill order. When no corner is free even after shifting, the pill
323
- turns compact and keeps only prioritised items.
372
+ them). `pillPriority` decides what stays, then pill order. When no corner is free even after
373
+ shifting, the pill turns compact and keeps only prioritised items.
324
374
  - Drag the env badge to another corner to keep the pill there; it still shifts within that
325
375
  corner to clear host elements. `⋯ → Reset layout` forgets the corner.
326
376
  - On a phone, a page wider than the screen grows the layout viewport past what is visible; the
@@ -328,7 +378,7 @@ through MSW with the same `createHudHandler` an app mounts.
328
378
 
329
379
  ## Panels and shortcuts
330
380
 
331
- - Open panels from the pill (`⋯` lists every panel and command). Drag by the title bar; a click
381
+ - Open panels from the dock (`⋯` lists every panel and command). Drag by the title bar; a click
332
382
  raises a panel.
333
383
  - Pin a panel with ◧ ⬓ ◨ or by dropping it at the left, right or bottom edge. Pinning pushes the
334
384
  page (padding on `<html>`) instead of covering it; pins on one edge stack. The host's
@@ -1,5 +1,6 @@
1
+ import { i as hudIcon } from "./icons-ByDyNq_E.js";
1
2
  import { n as HUD_HOST_TAG } from "./marker-uZYPOJ4M.js";
2
- import { i as definePlugin } from "./plugins-DVy_vaYr.js";
3
+ import { a as ratingTone, i as definePlugin } from "./plugins-CcW_K7c2.js";
3
4
  import { lazy, useSyncExternalStore } from "react";
4
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
6
  //#region src/plugins/a11y/axe.ts
@@ -205,7 +206,7 @@ function pillRating(snapshot) {
205
206
  }
206
207
  //#endregion
207
208
  //#region src/plugins/a11y/index.tsx
208
- const A11yPanel = lazy(() => import("./a11y-panel-p_t4eD7p.js"));
209
+ const A11yPanel = lazy(() => import("./a11y-panel-DcfXnPHk.js"));
209
210
  /**
210
211
  * On-demand axe-core audit. Nothing is fetched until Run: axe-core comes from
211
212
  * `axeUrl` (jsDelivr, pinned) or your own `load` (`() => import("axe-core")`).
@@ -227,9 +228,20 @@ function a11y(options = {}) {
227
228
  options
228
229
  });
229
230
  }
231
+ function useA11yBadge() {
232
+ const snapshot = useA11y();
233
+ const tone = ratingTone(pillRating(snapshot));
234
+ if (!tone) return null;
235
+ return snapshot.findings.length > 0 ? {
236
+ tone,
237
+ count: snapshot.findings.length
238
+ } : { tone };
239
+ }
230
240
  return definePlugin({
231
241
  id: "a11y",
232
242
  title: "A11y",
243
+ icon: hudIcon("accessibility"),
244
+ badge: useA11yBadge,
233
245
  pill: A11yPill,
234
246
  panel: Panel,
235
247
  commands: [{
@@ -1,5 +1,5 @@
1
1
  import { n as useGrab } from "./store-Ync9eb1G.js";
2
- import { c as targetLabel, n as runAudit, o as IMPACT_ORDER, r as useA11y, s as resolveTarget } from "./a11y-B5DUaiCs.js";
2
+ import { c as targetLabel, n as runAudit, o as IMPACT_ORDER, r as useA11y, s as resolveTarget } from "./a11y-BGWw4jBr.js";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/plugins/a11y/styles.ts
@@ -1,4 +1,4 @@
1
- import { r as HudCapability } from "./plugins-BZvDqGx5.js";
1
+ import { a as HudCapability } from "./plugins-BZT-1LBe.js";
2
2
  import { t as HudEnv } from "./env-CApnbI0r.js";
3
3
  //#region src/plugins/access/capabilities.d.ts
4
4
  /** The capability vocabulary of the default matrix. Development grants these and any other. */
@@ -1,5 +1,5 @@
1
1
  import { i as hudUnlockTtlMs, o as resolveHudAccess } from "./access-C7zlaqj6.js";
2
- import { n as useUnlockState, t as submitPassword } from "./unlock-store-4V3vR4Eg.js";
2
+ import { n as useUnlockState, t as submitPassword } from "./unlock-store-CrGXQx1V.js";
3
3
  import { useState } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/plugins/access/access-panel.tsx
@@ -1,17 +1,17 @@
1
1
  import { t as HudAutoDetected } from "../detect-BxHZ0pxW.js";
2
- import { o as HudPlugin } from "../plugins-BZvDqGx5.js";
3
- import { n as a11y, t as A11yOptions } from "../index-DqOyNf1u.js";
4
- import { n as data } from "../index-DstI_ike.js";
5
- import { t as forceState } from "../index-Hhh7OXzU.js";
2
+ import { c as HudPlugin } from "../plugins-BZT-1LBe.js";
3
+ import { n as a11y, t as A11yOptions } from "../index-DLCSLWW4.js";
4
+ import { n as data } from "../index-BJJoAXJ2.js";
5
+ import { t as forceState } from "../index-Caohnz3B.js";
6
6
  import { t as InspectAdapter } from "../adapter-BYoxPYTI.js";
7
- import { n as InspectOptions, r as inspect } from "../index-CwfX-W87.js";
7
+ import { n as InspectOptions, r as inspect } from "../index-BR5OB7DO.js";
8
8
  import { r as inspectConvex, t as ConvexClientLike } from "../index-BJ26pse9.js";
9
9
  import { i as inspectReactQuery, n as QueryClientLike } from "../index-RgXfMBuW.js";
10
10
  import { o as inspectSwr, t as InspectSwrOptions } from "../index-Dxz4fn4j.js";
11
- import { n as observe, t as ObserveOptions } from "../index-BAV_1W8a.js";
12
- import { t as routes } from "../index-BnQ0dTZf.js";
13
- import { t as seo } from "../index-DcH9V3cU.js";
14
- import { t as vitals } from "../index-ReFbhQ9p.js";
11
+ import { n as observe, t as ObserveOptions } from "../index-BNoPbSYD.js";
12
+ import { t as routes } from "../index-B1vHAY9p.js";
13
+ import { t as seo } from "../index-CQXiuMZQ.js";
14
+ import { t as vitals } from "../index-D-hI-DRJ.js";
15
15
  //#region src/auto/runtime.d.ts
16
16
  /**
17
17
  * What `auto()` takes: the instances a detected adapter wraps (a package can
package/dist/auto.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as HudAutoDetected } from "./detect-BxHZ0pxW.js";
2
- import { o as HudPlugin } from "./plugins-BZvDqGx5.js";
3
- import "./index-gCZBO53s.js";
2
+ import { c as HudPlugin } from "./plugins-BZT-1LBe.js";
3
+ import "./index-C3wzZS3o.js";
4
4
  import { HudAutoFactories, HudAutoOptions } from "./auto/runtime.js";
5
5
  //#region src/auto/index.d.ts
6
6
  /** Nothing detected: this is the stand-in (`configured: false`). */
package/dist/auto.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { t as NOTHING_DETECTED } from "./detect-CHZiSeZs.js";
2
- import { t as a11y } from "./a11y-B5DUaiCs.js";
3
- import { t as forceState } from "./design-D0kGgPoP.js";
4
- import { n as inspect } from "./inspect-C9Ft8fqn.js";
5
- import { t as observe } from "./observe-CdDnDBRP.js";
6
- import { t as seo } from "./seo-Dq9q_QkO.js";
2
+ import { t as a11y } from "./a11y-BGWw4jBr.js";
3
+ import { t as forceState } from "./design-BXG1a4we.js";
4
+ import { n as inspect } from "./inspect-CSkm8tn3.js";
5
+ import { t as observe } from "./observe-CBNLU148.js";
6
+ import { t as seo } from "./seo-BnnGq_vj.js";
7
7
  import { vitals } from "./plugins/vitals.js";
8
8
  import { assembleAuto } from "./auto/runtime.js";
9
9
  //#region src/auto/index.ts
@@ -1,5 +1,5 @@
1
1
  import { HUD_FLAG_SCOPES } from "./flags.js";
2
- import { a as useDataState, i as syncLocalOverrides, n as applyOverrides, r as errorMessage, s as useMockClientStatus, t as applyMocks } from "./data-store-ChF1td_P.js";
2
+ import { a as useDataState, i as syncLocalOverrides, n as applyOverrides, r as errorMessage, s as useMockClientStatus, t as applyMocks } from "./data-store-FNTQKMkG.js";
3
3
  import { useState } from "react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/plugins/data/styles.ts
@@ -1,4 +1,4 @@
1
- import { n as HudApiError } from "./plugins-DVy_vaYr.js";
1
+ import { n as HudApiError } from "./plugins-CcW_K7c2.js";
2
2
  import { FLAGS_STORAGE_KEY, serializeFlagOverrides } from "./flags.js";
3
3
  import { d as validateScenarios, i as createMockResolver } from "./mocks-ESiRqk9o.js";
4
4
  import { useEffect, useSyncExternalStore } from "react";
@@ -1,5 +1,11 @@
1
- import { o as HudPlugin, r as HudCapability } from "./plugins-BZvDqGx5.js";
2
- import { ComponentType } from "react";
1
+ import { a as HudCapability, c as HudPlugin } from "./plugins-BZT-1LBe.js";
2
+ import { ComponentType, ReactNode } from "react";
3
+ //#region src/shell/panels/types.d.ts
4
+ /** The viewport edge the rail docks to. */
5
+ type DockSide = "left" | "right";
6
+ /** How the HUD docks: the vertical edge rail (default) or the horizontal corner pill. */
7
+ type HudDock = "rail" | "pill";
8
+ //#endregion
3
9
  //#region src/core/define-hud.d.ts
4
10
  /** `auto` from `@hansenexus/hud/auto`: the list, or the function itself. */
5
11
  type HudAutoPlugins = readonly HudPlugin[] | (() => readonly HudPlugin[]);
@@ -24,16 +30,20 @@ interface DefineHudOptions {
24
30
  apiBase?: string;
25
31
  /** Capability check. Default: grant all (core assumes development). */
26
32
  can?: (capability: HudCapability) => boolean;
33
+ /** The edge rail (default) or the horizontal corner pill. */
34
+ dock?: HudDock;
27
35
  }
28
36
  /** Props the loader passes in at mount time. */
29
37
  interface HudMountProps {
30
- /** Badge at the start of the pill. Default "DEV". */
38
+ /** Label of the env chip. Default "DEV". */
31
39
  envLabel?: string;
32
40
  /**
33
41
  * Tier the loader resolved. Default "development". Any other tier renders
34
42
  * nothing unless a plugin brings `access`.
35
43
  */
36
44
  env?: string;
45
+ /** Overrides `defineHud({ dock })` for this mount. */
46
+ dock?: HudDock;
37
47
  }
38
48
  /**
39
49
  * The app's one HUD file:
@@ -45,6 +55,6 @@ interface HudMountProps {
45
55
  * Returns a component. The plugin list is frozen here, so the shell sees a
46
56
  * stable array across renders.
47
57
  */
48
- declare function defineHud({ app, plugins, auto, apiBase, can }: DefineHudOptions): ComponentType<HudMountProps>;
58
+ declare function defineHud({ app, plugins, auto, apiBase, can, dock }: DefineHudOptions): ComponentType<HudMountProps>;
49
59
  //#endregion
50
- export { defineHud as i, HudAutoPlugins as n, HudMountProps as r, DefineHudOptions as t };
60
+ export { DockSide as a, defineHud as i, HudAutoPlugins as n, HudDock as o, HudMountProps as r, DefineHudOptions as t };
@@ -1,4 +1,5 @@
1
- import { i as definePlugin } from "./plugins-DVy_vaYr.js";
1
+ import { i as hudIcon } from "./icons-ByDyNq_E.js";
2
+ import { i as definePlugin } from "./plugins-CcW_K7c2.js";
2
3
  import { a as getForceStateSnapshot, c as subscribeForceState, o as getForceStateStore, s as resolveForcedState } from "./force-state-BaqWsmrf.js";
3
4
  import { lazy, useSyncExternalStore } from "react";
4
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -8,13 +9,16 @@ function useForceState() {
8
9
  }
9
10
  //#endregion
10
11
  //#region src/plugins/design/force-state-pill.tsx
12
+ function useForcedCount() {
13
+ const snapshot = useForceState();
14
+ return snapshot.boundaries.filter((b) => resolveForcedState(snapshot, b)).length;
15
+ }
11
16
  /**
12
17
  * Pill content: how many boundaries are forced, by toggle or param. Uses the
13
18
  * core `.dot`, since the plugin stylesheet only loads with the panel.
14
19
  */
15
20
  function ForceStatePill() {
16
- const snapshot = useForceState();
17
- const forced = snapshot.boundaries.filter((b) => resolveForcedState(snapshot, b)).length;
21
+ const forced = useForcedCount();
18
22
  if (forced === 0) return /* @__PURE__ */ jsx(Fragment, { children: "States" });
19
23
  return /* @__PURE__ */ jsxs(Fragment, { children: [
20
24
  /* @__PURE__ */ jsx("span", {
@@ -25,11 +29,19 @@ function ForceStatePill() {
25
29
  forced
26
30
  ] });
27
31
  }
32
+ /** The rail badge: the forced count, nothing while no boundary is forced. */
33
+ function useForceStateBadge() {
34
+ const forced = useForcedCount();
35
+ return forced > 0 ? {
36
+ tone: "warn",
37
+ count: forced
38
+ } : null;
39
+ }
28
40
  //#endregion
29
41
  //#region src/plugins/design/index.tsx
30
42
  const TokensPanel = lazy(() => import("./tokens-panel-CbMQfasZ.js"));
31
- const VariantsPanel = lazy(() => import("./variants-panel-BDoSkwBJ.js"));
32
- const ForceStatePanel = lazy(() => import("./force-state-panel-_otVYh9i.js"));
43
+ const VariantsPanel = lazy(() => import("./variants-panel-B6zWcknV.js"));
44
+ const ForceStatePanel = lazy(() => import("./force-state-panel-mu-txJnA.js"));
33
45
  /**
34
46
  * Live swatches of the host app's design tokens. Values are read from the
35
47
  * host document, outside the HUD's shadow root, so scoped and themed tokens
@@ -42,6 +54,7 @@ function tokens(adapter) {
42
54
  return definePlugin({
43
55
  id: "tokens",
44
56
  title: "Tokens",
57
+ icon: hudIcon("palette"),
45
58
  panel: Panel
46
59
  });
47
60
  }
@@ -62,6 +75,7 @@ function variants(adapter) {
62
75
  return definePlugin({
63
76
  id: "variants",
64
77
  title: "Variants",
78
+ icon: hudIcon("layers"),
65
79
  panel: Panel
66
80
  });
67
81
  }
@@ -74,6 +88,8 @@ function forceState() {
74
88
  id: "states",
75
89
  title: "States",
76
90
  capability: "state.force",
91
+ icon: hudIcon("toggle"),
92
+ badge: useForceStateBadge,
77
93
  pill: ForceStatePill,
78
94
  panel: ForceStatePanel,
79
95
  commands: [{
@@ -1,5 +1,5 @@
1
1
  import { n as useGrab } from "./store-Ync9eb1G.js";
2
- import { n as HudApiError } from "./plugins-DVy_vaYr.js";
2
+ import { n as HudApiError } from "./plugins-CcW_K7c2.js";
3
3
  import { i as parseShortcut, n as isApplePlatform, s as matchComponentHints, t as formatShortcut } from "./shortcut-s_mjGeU8.js";
4
4
  import { t as AGENT_CSS } from "./styles-DPpDPmzi.js";
5
5
  import { useEffect, useState, useSyncExternalStore } from "react";
@@ -1,5 +1,5 @@
1
1
  import { i as formatForceStateParam, o as getForceStateStore, r as FORCE_STATE_PARAM, s as resolveForcedState, t as FORCED_STATES } from "./force-state-BaqWsmrf.js";
2
- import { i as useForceState } from "./design-D0kGgPoP.js";
2
+ import { i as useForceState } from "./design-BXG1a4we.js";
3
3
  import { t as DESIGN_CSS } from "./styles-DKU_P8MH.js";
4
4
  import { useEffect } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { a as resolvePlugins, t as HUD_HTTP_METHODS } from "./plugins-DVy_vaYr.js";
1
+ import { o as resolvePlugins, t as HUD_HTTP_METHODS } from "./plugins-CcW_K7c2.js";
2
2
  //#region src/server/handler.ts
3
3
  function json(status, body, headers) {
4
4
  const res = Response.json(body, { status });
@@ -1,4 +1,4 @@
1
- import { a as HudHttpMethod, o as HudPlugin, r as HudCapability } from "./plugins-BZvDqGx5.js";
1
+ import { a as HudCapability, c as HudPlugin, s as HudHttpMethod } from "./plugins-BZT-1LBe.js";
2
2
  //#region src/server/handler.d.ts
3
3
  /**
4
4
  * Decides whether a request may reach a plugin route. Return a `Response` to
@@ -0,0 +1,71 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ //#region src/core/icons.tsx
3
+ /**
4
+ * The rail's icon set: lucide shapes as path data, one `<symbol>` each in a
5
+ * sprite the shell renders once inside its shadow root. No icon library: the
6
+ * core budget is 40 KB gzip and a plugin's icon is one `<use>`.
7
+ */
8
+ const HUD_ICON_PATHS = {
9
+ bug: "m8 2 1.88 1.88M14.12 3.88 16 2M9 7.13v-1a3.003 3.003 0 1 1 6 0v1M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6M12 20v-9M6.53 9C4.6 8.8 3 7.1 3 5M6 13H2M3 21c0-2.1 1.7-3.9 3.8-4M20.97 5c0 2.1-1.6 3.8-3.5 4M22 13h-4M17.2 17c2.1.1 3.8 1.9 3.8 4",
10
+ database: "M3 5a9 3 0 1 0 18 0 9 3 0 1 0-18 0M3 5v14a9 3 0 0 0 18 0V5M3 12a9 3 0 0 0 18 0",
11
+ "git-branch": "M6 3v12M18 9a9 9 0 0 1-9 9M21 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0",
12
+ send: "M14.5 10.5 22 3M22 3l-7 19-4-8.5L2 9z",
13
+ terminal: "m4 17 6-6-6-6M12 19h8",
14
+ palette: "M13.5 6.5h.01M17.5 10.5h.01M8.5 7.5h.01M6.5 12.5h.01M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.9 0 1.6-.7 1.6-1.6 0-.4-.2-.8-.4-1.1-.3-.3-.4-.7-.4-1.1 0-.9.7-1.6 1.6-1.6H16c3.3 0 6-2.7 6-6 0-4.9-4.5-8.6-10-8.6",
15
+ layers: "m12 2 9 4.5-9 4.5-9-4.5zM3 12l9 4.5 9-4.5M3 17l9 4.5 9-4.5",
16
+ toggle: "M8 6h8a6 6 0 0 1 0 12H8A6 6 0 0 1 8 6zM19 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0",
17
+ crosshair: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 3v4M12 17v4M3 12h4M17 12h4",
18
+ ellipsis: "M6 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0M13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0M20 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0",
19
+ plug: "M12 22v-5M9 8V2M15 8V2M18 8H6v5a6 6 0 0 0 12 0V8z",
20
+ gauge: "m12 14 4-4M3.34 19a10 10 0 1 1 17.32 0",
21
+ lock: "M7 11V7a5 5 0 0 1 10 0v4M5 11h14v10H5z",
22
+ search: "m21 21-4.35-4.35M17 11a6 6 0 1 1-12 0 6 6 0 0 1 12 0",
23
+ accessibility: "M17 4a1 1 0 1 1-2 0 1 1 0 0 1 2 0m1 15 1-7-6 1M5 8l3-3 5.5 3-2.36 3.5M4.24 14.5a5 5 0 0 0 6.88 6M13.76 17.5a5 5 0 0 0-6.88-6",
24
+ activity: "M22 12h-4l-3 9L9 3l-3 9H2",
25
+ route: "M9 19a3 3 0 1 1-6 0 3 3 0 0 1 6 0M21 5a3 3 0 1 1-6 0 3 3 0 0 1 6 0M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",
26
+ wrench: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94z",
27
+ x: "M18 6 6 18M6 6l12 12",
28
+ grip: "M10 6h.01M14 6h.01M10 12h.01M14 12h.01M10 18h.01M14 18h.01",
29
+ "chevron-up": "m18 15-6-6-6 6",
30
+ "chevron-down": "m6 9 6 6 6-6",
31
+ eye: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0",
32
+ "eye-off": "M10.7 5.1A10 10 0 0 1 12 5c6.5 0 10 7 10 7a17 17 0 0 1-2.3 3.2M6.6 6.6A16 16 0 0 0 2 12s3.5 7 10 7a10 10 0 0 0 5.4-1.6M2 2l20 20M9.9 9.9a3 3 0 1 0 4.2 4.2"
33
+ };
34
+ const HUD_ICON_NAMES = Object.keys(HUD_ICON_PATHS);
35
+ const symbolId = (name) => `hud-i-${name}`;
36
+ /** The sprite: every icon as a `<symbol>`, rendered once by the shell. */
37
+ function IconSprite() {
38
+ return /* @__PURE__ */ jsxs("svg", {
39
+ "aria-hidden": "true",
40
+ style: { display: "none" },
41
+ children: [/* @__PURE__ */ jsx("title", { children: "HUD icons" }), HUD_ICON_NAMES.map((name) => /* @__PURE__ */ jsx("symbol", {
42
+ id: symbolId(name),
43
+ viewBox: "0 0 24 24",
44
+ children: /* @__PURE__ */ jsx("path", { d: HUD_ICON_PATHS[name] })
45
+ }, name))]
46
+ });
47
+ }
48
+ /** One icon from the sprite. `<use>` resolves the id inside the shadow root. */
49
+ function HudIconGlyph({ name }) {
50
+ return /* @__PURE__ */ jsx("svg", {
51
+ className: "icon",
52
+ "aria-hidden": "true",
53
+ children: /* @__PURE__ */ jsx("use", { href: `#${symbolId(name)}` })
54
+ });
55
+ }
56
+ const components = /* @__PURE__ */ new Map();
57
+ /**
58
+ * A plugin `icon` from the built-in set: `definePlugin({ icon: hudIcon("database") })`.
59
+ * The same name returns the same component, so plugin objects stay comparable.
60
+ */
61
+ function hudIcon(name) {
62
+ let found = components.get(name);
63
+ if (!found) {
64
+ found = () => /* @__PURE__ */ jsx(HudIconGlyph, { name });
65
+ found.displayName = `HudIcon(${name})`;
66
+ components.set(name, found);
67
+ }
68
+ return found;
69
+ }
70
+ //#endregion
71
+ export { hudIcon as i, HudIconGlyph as n, IconSprite as r, HUD_ICON_NAMES as t };
@@ -1,4 +1,4 @@
1
- import { c as HudPluginProps } from "./plugins-BZvDqGx5.js";
1
+ import { u as HudPluginProps } from "./plugins-BZT-1LBe.js";
2
2
  //#region src/plugins/routes/routes-panel.d.ts
3
3
  declare function RoutesPanel({ ctx }: HudPluginProps): import("react").JSX.Element;
4
4
  //#endregion
@@ -13,6 +13,7 @@ declare function routes(): {
13
13
  readonly id: "routes";
14
14
  readonly title: "Routes";
15
15
  readonly capability: "routes.read";
16
+ readonly icon: import("react").ComponentType;
16
17
  readonly panel: typeof RoutesPanel;
17
18
  };
18
19
  //#endregion
@@ -1,4 +1,4 @@
1
- import { c as HudPluginProps } from "./plugins-BZvDqGx5.js";
1
+ import { r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
2
2
  import { s as HudMockScenario } from "./mocks-CA-wM2SB.js";
3
3
  import { n as HudMockWorkerModule, r as MockWorkerOptions } from "./msw-browser-wjaYgkB7.js";
4
4
  //#region src/plugins/data/data-panel.d.ts
@@ -14,6 +14,8 @@ declare function DataPanel({ ctx }: HudPluginProps): import("react").JSX.Element
14
14
  //#region src/plugins/data/data-pill.d.ts
15
15
  /** The pill item: who the page is signed in as, how many flags are overridden and how many endpoints are mocked. */
16
16
  declare function DataPill({ ctx }: HudPluginProps): import("react").JSX.Element;
17
+ /** The rail badge: warn while anything is overridden, counting the overrides and mocks. */
18
+ declare function useDataBadge({ ctx }: HudPluginProps): HudBadge | null;
17
19
  //#endregion
18
20
  //#region src/plugins/data/mocks-client.d.ts
19
21
  /** `data({ mocks })`: the scenarios and how to start the browser's MSW worker. */
@@ -59,6 +61,8 @@ declare function data({ mocks }?: DataOptions): {
59
61
  readonly id: "data";
60
62
  readonly title: "Data";
61
63
  readonly capability: "data.write";
64
+ readonly icon: import("react").ComponentType;
65
+ readonly badge: typeof useDataBadge;
62
66
  readonly pill: typeof DataPill;
63
67
  readonly panel: import("react").LazyExoticComponent<typeof DataPanel>;
64
68
  };
@@ -1,4 +1,4 @@
1
- import { c as HudPluginProps } from "./plugins-BZvDqGx5.js";
1
+ import { r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
2
2
  import { a as CaptureOptions } from "./requests-CJrUf465.js";
3
3
  //#region src/plugins/observe/info-tab.d.ts
4
4
  /** The signed-in user as the app knows it. Every field is optional. */
@@ -30,6 +30,8 @@ interface ObserveOptions extends CaptureOptions {
30
30
  declare function observe({ env, useUser, ignore }?: ObserveOptions): {
31
31
  readonly id: "observe";
32
32
  readonly title: "Observe";
33
+ readonly icon: import("react").ComponentType;
34
+ readonly badge: () => HudBadge;
33
35
  readonly pill: () => import("react").JSX.Element;
34
36
  readonly pillPriority: 20;
35
37
  readonly panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import { r as HudBadge } from "./plugins-BZT-1LBe.js";
1
2
  import { a as CaptureOptions, t as InspectRequest } from "./requests-CJrUf465.js";
2
3
  import { t as InspectAdapter } from "./adapter-BYoxPYTI.js";
3
4
  //#region src/plugins/observe/redact.d.ts
@@ -60,6 +61,8 @@ declare function inspect({ ignore, adapters }?: InspectOptions): {
60
61
  readonly id: "inspect";
61
62
  readonly title: "Inspect";
62
63
  readonly capability: "inspect.read";
64
+ readonly icon: import("react").ComponentType;
65
+ readonly badge: () => HudBadge;
63
66
  readonly pill: () => import("react").JSX.Element;
64
67
  readonly panel: () => import("react").JSX.Element;
65
68
  readonly commands: readonly [{