@hansenexus/hud 0.7.0 → 0.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.
Files changed (66) hide show
  1. package/README.md +111 -14
  2. package/dist/{access-Bc709qpl.d.ts → access-CwPCPsv0.d.ts} +1 -1
  3. package/dist/auto/runtime.d.ts +9 -9
  4. package/dist/auto.d.ts +2 -2
  5. package/dist/auto.js +1 -1
  6. package/dist/cli.js +34 -1
  7. package/dist/{define-hud-DTv3njuU.d.ts → define-hud-B0aFXrcK.d.ts} +1 -1
  8. package/dist/{design-BXG1a4we.js → design-BIXY1-Ex.js} +26 -8
  9. package/dist/{force-state-panel-mu-txJnA.js → force-state-panel-D5oDydLs.js} +1 -1
  10. package/dist/{handler-DMzSTqyG.d.ts → handler-BmFhaA2D.d.ts} +1 -1
  11. package/dist/{index-C3wzZS3o.d.ts → index-5B7foZut.d.ts} +2 -2
  12. package/dist/{index-D-hI-DRJ.d.ts → index-B2KCKkN0.d.ts} +1 -1
  13. package/dist/index-B7qaEUgh.d.ts +44 -0
  14. package/dist/{index-CQXiuMZQ.d.ts → index-BGFyuJyN.d.ts} +1 -1
  15. package/dist/{index-Caohnz3B.d.ts → index-BeqWehuh.d.ts} +38 -10
  16. package/dist/{index-BJJoAXJ2.d.ts → index-BqKysxTq.d.ts} +1 -1
  17. package/dist/{index-DLCSLWW4.d.ts → index-D97Fnoie.d.ts} +2 -2
  18. package/dist/{index-BR5OB7DO.d.ts → index-DS0yT0c-.d.ts} +1 -1
  19. package/dist/{index-BNoPbSYD.d.ts → index-DvlCkGB1.d.ts} +1 -1
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +45 -196
  22. package/dist/navigation-CX6AXm7H.js +176 -0
  23. package/dist/next.d.ts +4 -1
  24. package/dist/next.js +12 -1
  25. package/dist/obstacles-CCmRFTcZ.js +176 -0
  26. package/dist/plugins/a11y.d.ts +1 -1
  27. package/dist/plugins/access/server.d.ts +3 -3
  28. package/dist/plugins/access.d.ts +2 -2
  29. package/dist/plugins/agent/server.js +1 -1
  30. package/dist/plugins/agent.d.ts +2 -2
  31. package/dist/plugins/capture.d.ts +2 -2
  32. package/dist/plugins/data/server.d.ts +1 -1
  33. package/dist/plugins/data/server.js +1 -1
  34. package/dist/plugins/data.d.ts +1 -1
  35. package/dist/plugins/design/server.d.ts +55 -15
  36. package/dist/plugins/design/server.js +187 -122
  37. package/dist/plugins/design.d.ts +3 -3
  38. package/dist/plugins/design.js +1 -1
  39. package/dist/plugins/inspect.d.ts +1 -1
  40. package/dist/plugins/observe.d.ts +1 -1
  41. package/dist/plugins/ops/server.d.ts +1 -1
  42. package/dist/plugins/ops.d.ts +1 -1
  43. package/dist/plugins/routes/server.d.ts +1 -1
  44. package/dist/plugins/routes.d.ts +3 -3
  45. package/dist/plugins/routes.js +381 -52
  46. package/dist/plugins/seo.d.ts +1 -1
  47. package/dist/plugins/vitals.d.ts +1 -1
  48. package/dist/{plugins-BZT-1LBe.d.ts → plugins-pL2CoWzI.d.ts} +7 -0
  49. package/dist/same-origin-BHuZO1_H.js +36 -0
  50. package/dist/server.d.ts +2 -2
  51. package/dist/store.d.ts +1 -1
  52. package/dist/store.js +1 -1
  53. package/dist/{meta-C_G7MB5w.d.ts → types-Dc6JWZR7.d.ts} +6 -6
  54. package/dist/variant-bar-BzZ0ln-C.js +768 -0
  55. package/dist/variant-picks-Byc0hC8a.js +144 -0
  56. package/dist/variants-export-vEtZ-OGC.js +75 -0
  57. package/dist/{variants-panel-B6zWcknV.js → variants-panel-D23v5KIp.js} +71 -54
  58. package/dist/variants-types-BOsZ5fDz.js +65 -0
  59. package/dist/variants-types-VkW7vFZF.d.ts +139 -0
  60. package/dist/variants.d.ts +1 -1
  61. package/dist/variants.js +1 -1
  62. package/dist/vite.d.ts +2 -2
  63. package/package.json +1 -1
  64. package/dist/index-B1vHAY9p.d.ts +0 -20
  65. package/dist/same-origin-BGet22CC.js +0 -21
  66. package/dist/variants-types-CcRf119M.d.ts +0 -63
package/README.md CHANGED
@@ -67,7 +67,9 @@ export const HudLoader = createHudLoader(
67
67
  );
68
68
  ```
69
69
 
70
- Render `<HudLoader />` in the root layout. The HUD then docks as an icon rail on the right edge,
70
+ Render `<HudLoader />` in the root layout. When the HUD's chunk does not load (a stale dev server, a
71
+ syntax error in `hud.tsx`), it renders nothing and warns once in the console; the page is
72
+ unaffected. The HUD then docks as an icon rail on the right edge,
71
73
  as its DEV chip until clicked (see [Dock](#dock-rail-and-pill)). Plugin routes mount through
72
74
  one catch-all route, fed the plugins' server halves:
73
75
 
@@ -280,8 +282,8 @@ In the playground, `?env=staging` runs this flow with the password `playground`.
280
282
 
281
283
  ## Write a plugin
282
284
 
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
285
+ A plugin is `{ id, title?, capability?, icon?, badge?, panel?, overlay?, pill?, pillPriority?, commands?, routes? }`,
286
+ shipped as two halves with the same `id`: the client half (`panel`, `overlay`, `pill`, `icon`, `badge`, `commands`) and the server half
285
287
  (`routes`), so route code never reaches a client bundle. The panel is a plain React component
286
288
  receiving `ctx`. Make it a dynamic import, so its code loads on first open and the pill stays
287
289
  light; the shell shows "Loading…" meanwhile and contains a panel that fails to load or throws:
@@ -326,6 +328,10 @@ definePlugin({
326
328
  });
327
329
  ```
328
330
 
331
+ `overlay` is a component on the page itself, next to the dock, for as long as the HUD is mounted
332
+ (the variant bar is one). It places itself and sets `pointer-events: auto` on what takes input; one
333
+ that fails to load or throws renders nothing. Keep it a dynamic import too.
334
+
329
335
  Routes are keyed by path, then method: `routes: { "/runs/:id": { GET: (req, { params }) => ... } }`.
330
336
  An unknown path answers 404, a known path with another method 405.
331
337
 
@@ -497,8 +503,25 @@ locale); an optional catch-all without a fixture resolves to its parent. A segme
497
503
  fixture leaves its route listed but unresolved. Capability: `routes.read` (development, staging,
498
504
  preview).
499
505
 
500
- The panel groups routes by route group, filters by path, marks the current page and navigates on
501
- click. `GET /api/hud/routes/routes` answers the same list as JSON.
506
+ The panel is a quick switcher. `⌘⇧R` (Ctrl+Shift+R elsewhere; the "Go to route" command, also in
507
+ the `⋯` menu) opens it with the filter focused and its text selected; ↓ ↑ move the highlight,
508
+ Enter navigates, Esc closes. Navigation goes through Next's router when the page has one
509
+ (`window.next.router`), else `location.assign`. The filter matches path, pattern and route group
510
+ and is fuzzy on segments: `dsys` finds `/de/dev/design-system`, `mark about` needs both words.
511
+ Routes are listed by route group; the current page is marked. Two sections come first while the
512
+ filter is empty: **Pinned** (the `pinned` globs plus the rows starred in the panel; the star on
513
+ every row toggles it, kept per app in `localStorage`) and **Recent** (the last eight routes
514
+ visited, most recent first, recorded by a navigation observer the plugin starts at HUD mount).
515
+ With a `[locale]` segment each route shows once, for the locale the page is on, the other locales
516
+ as chips behind the row. `GET /api/hud/routes/routes` answers the same list as JSON.
517
+
518
+ ```tsx
519
+ routes({
520
+ shortcut: "mod+shift+r", // the "Go to route" command; `mod` is ⌘ on Apple, Ctrl elsewhere
521
+ pinned: ["/*/dev/*"], // path globs listed first: `*` within a segment, `**` across segments
522
+ navigate: (url) => router.push(url), // replaces the default navigation
523
+ });
524
+ ```
502
525
 
503
526
  `hud sweep` visits that list headless and fails the build on a 5xx answer, an uncaught error or a
504
527
  console error on any page. It needs Playwright in the app (`playwright` or `@playwright/test`,
@@ -537,7 +560,7 @@ forceState();
537
560
  group's `scope` attribute), so themed and scoped tokens show what the page renders. It re-reads
538
561
  when `<html>`/`<body>` attributes, stylesheets or the OS color scheme change.
539
562
  - **Variants** lists the page's live variant groups (below) with a switcher, agent scores and
540
- Decide. An optional adapter (`variants({ categories, generate })`) adds the app's own variant
563
+ picks; `variants({ pages })` adds the [variant bar](#variant-bar). An optional adapter (`variants({ categories, generate })`) adds the app's own variant
541
564
  registry and the generate-brief queue (`variants.generate`).
542
565
  - **States** toggles every mounted `StateBoundary` between real, loading, empty and error. It
543
566
  needs `state.force`.
@@ -596,10 +619,10 @@ keyed `<group>:<id>`, which an agent writes by hand:
596
619
  }
597
620
  ```
598
621
 
599
- **Decide** (needs `variants.decide`, granted on development only by default) writes
600
- `status: "decided"` and `decidedAt` on the winner and `status: "rejected"` on the rest, then queues
601
- a cleanup brief ("inline the winner, delete the losers and the wrapper, run the checks") through
602
- the dispatch seam. The server half:
622
+ **Pick** (needs `variants.decide`, granted on development only by default) records the decision:
623
+ `status: "decided"` and `decidedAt` on the winner, `status: "rejected"` on the rest. A second click
624
+ takes it back. A pick only records; it queues nothing and starts no agent, whatever `dispatch` says.
625
+ The server half:
603
626
 
604
627
  ```ts
605
628
  import { variantsServer } from "@hansenexus/hud/plugins/design/server";
@@ -611,10 +634,84 @@ export const { GET, POST } = createHudHandler([
611
634
  ]);
612
635
  ```
613
636
 
614
- Without `dispatch` the decision is recorded and nothing is queued. `GET <apiBase>/variants/` lists
615
- the records, `POST <apiBase>/variants/<group>/decide` decides; both answer only to same-origin
616
- JSON requests. In the playground the hero is a variant group with seeded scores, and Decide logs
617
- the brief to the browser console through the echo provider.
637
+ `dispatch` is optional. With it the panel shows **Queue cleanup** next to a picked group: that
638
+ button, and only that button, sends the brief ("inline the winner, delete the losers and the
639
+ wrapper, run the checks") through the dispatch seam.
640
+
641
+ | route | does |
642
+ | --------------------------------------- | ---------------------------------------------------------------- |
643
+ | `GET <apiBase>/variants/` | lists the records, the notes and the logs |
644
+ | `POST <apiBase>/variants/<group>/pick` | `{ id, note }`: records the pick (`id: null` takes it back) and the note; a field left out stays as it is |
645
+ | `POST <apiBase>/variants/<group>/cleanup` | queues the brief for the picked variant; 409 without a pick or a provider |
646
+
647
+ Writes answer only to JSON requests from the app's own origin: by `Sec-Fetch-Site`, and where the
648
+ browser does not send it (plain http to another machine, such as a phone on the LAN address) the
649
+ `Origin` has to name the host the request went to. In the playground the hero is a variant group
650
+ with seeded scores, and Queue cleanup logs the brief to the browser console through the echo
651
+ provider.
652
+
653
+ ### Variant bar
654
+
655
+ A design round covers several pages. `pages` names them, and a bar at the bottom of the screen
656
+ steps through the pages and through the variants of the page it stands on, with a pick and a note
657
+ for each:
658
+
659
+ ```tsx
660
+ variants({
661
+ pages: [
662
+ { group: "hero", label: "Home", href: "/" },
663
+ { group: "plans", label: "Pricing", href: "/pricing" },
664
+ { group: "cluster", label: "Cluster", href: "#/estate/cluster" }, // a hash router
665
+ ],
666
+ });
667
+ ```
668
+
669
+ - `group` is the `VariantGroup` id the page decides. Where the address fits no page (a detail
670
+ page), the first mounted group on the list is the one the bar shows. Without `pages` there is no
671
+ bar.
672
+ - **Pages** open through Next's router when the page has one, else with a full load; a `#…` href is
673
+ the browser's own fragment navigation. `navigate: (href) => router.push(href)` replaces this. The
674
+ `?variant=` choices travel along.
675
+ - **Keys**: ⌥← ⌥→ step through the variants, ⌥↑ ⌥↓ through the pages, except while typing.
676
+ - **Pick** and **Note** go through the pick route above. A note saves with Save, with ⌘Enter, and
677
+ when the page changes under it; Escape drops the draft. A save that fails puts the recorded state
678
+ back and says why in the bar.
679
+ - × folds the bar to a pill with the score; that is kept per app in `localStorage`.
680
+ - The bar keeps clear of the HUD, of pinned panels and of fixed elements at the bottom of the page
681
+ (a bottom navigation, a chat bubble), and stays usable while a modal sheet is open: it is not
682
+ caught by `pointer-events: none` on `<body>`, by `inert` or by a focus trap, and pressing it does
683
+ not dismiss the sheet. The limit is a native `<dialog>` opened with `showModal()`, which the
684
+ browser puts above everything; there the keys still step, and picking waits until it is closed.
685
+ - **Development only.** The bar is its own chunk behind `process.env.NODE_ENV === "development"`;
686
+ `"data-hud-variant-bar"` is the string to grep production chunks for.
687
+
688
+ `.hud/variants.json` then holds, next to the variants, one entry per group with its note and a log
689
+ that only grows:
690
+
691
+ ```json
692
+ {
693
+ "hero": {
694
+ "label": "Hero",
695
+ "note": "Shorter claim, please",
696
+ "log": [
697
+ { "at": "2026-11-22T12:52:53.587Z", "pick": "bold", "note": "" },
698
+ { "at": "2026-11-22T12:53:10.101Z", "pick": "bold", "note": "Shorter claim, please" }
699
+ ]
700
+ },
701
+ "hero:bold": { "group": "hero", "id": "bold", "status": "decided", "decidedAt": "2026-11-22T12:52:53.587Z" }
702
+ }
703
+ ```
704
+
705
+ `hud variants` prints the decisions, for an agent or an issue:
706
+
707
+ ```sh
708
+ npx hud variants # Markdown, from .hud/ in the current directory
709
+ npx hud variants --json # the same as JSON
710
+ npx hud variants --dir apps/web/.hud # another directory
711
+ ```
712
+
713
+ `formatVariantsMarkdown(await readVariants(store))` from `@hansenexus/hud/plugins/design/server`
714
+ does the same for any other store.
618
715
 
619
716
  ## Storage seam
620
717
 
@@ -1,4 +1,4 @@
1
- import { a as HudCapability } from "./plugins-BZT-1LBe.js";
1
+ import { a as HudCapability } from "./plugins-pL2CoWzI.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,17 +1,17 @@
1
1
  import { t as HudAutoDetected } from "../detect-BxHZ0pxW.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";
2
+ import { c as HudPlugin } from "../plugins-pL2CoWzI.js";
3
+ import { n as a11y, t as A11yOptions } from "../index-D97Fnoie.js";
4
+ import { n as data } from "../index-BqKysxTq.js";
5
+ import { n as forceState } from "../index-BeqWehuh.js";
6
6
  import { t as InspectAdapter } from "../adapter-BYoxPYTI.js";
7
- import { n as InspectOptions, r as inspect } from "../index-BR5OB7DO.js";
7
+ import { n as InspectOptions, r as inspect } from "../index-DS0yT0c-.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-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";
11
+ import { n as observe, t as ObserveOptions } from "../index-DvlCkGB1.js";
12
+ import { n as routes } from "../index-B7qaEUgh.js";
13
+ import { t as seo } from "../index-BGFyuJyN.js";
14
+ import { t as vitals } from "../index-B2KCKkN0.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 { c as HudPlugin } from "./plugins-BZT-1LBe.js";
3
- import "./index-C3wzZS3o.js";
2
+ import { c as HudPlugin } from "./plugins-pL2CoWzI.js";
3
+ import "./index-5B7foZut.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,6 +1,6 @@
1
1
  import { t as NOTHING_DETECTED } from "./detect-CHZiSeZs.js";
2
2
  import { t as a11y } from "./a11y-BGWw4jBr.js";
3
- import { t as forceState } from "./design-BXG1a4we.js";
3
+ import { t as forceState } from "./design-BIXY1-Ex.js";
4
4
  import { n as inspect } from "./inspect-CSkm8tn3.js";
5
5
  import { t as observe } from "./observe-CBNLU148.js";
6
6
  import { t as seo } from "./seo-BnnGq_vj.js";
package/dist/cli.js CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { t as file } from "./file-xdSaQ2uR.js";
3
+ import { n as readVariants, t as formatVariantsMarkdown } from "./variants-export-vEtZ-OGC.js";
2
4
  import { r as isExcluded } from "./scan-DzJNXqOk.js";
3
5
  //#region src/plugins/routes/sweep.ts
4
6
  /** Console errors every dev server produces that never mean a broken page. */
@@ -164,7 +166,12 @@ const USAGE = `hud sweep --base <url> [options]
164
166
  Visits every route the running app's routes plugin lists, headless, and fails on
165
167
  a 5xx answer, an uncaught error or a console error.
166
168
 
167
- Options
169
+ hud variants [--json] [--dir <path>]
170
+
171
+ Prints the picks, notes and log of the variant bar from .hud/variants.json, as
172
+ Markdown for an issue or an agent.
173
+
174
+ Options of hud sweep
168
175
  --base <url> dev server origin, e.g. http://localhost:3000 (required)
169
176
  --api <path> where createHudHandler is mounted (default /api/hud)
170
177
  --json print the report as JSON instead of lines
@@ -173,6 +180,10 @@ Options
173
180
  --ignore-console <re> ignore console errors matching this pattern (repeatable)
174
181
  --exclude <path> skip a URL path or folder pattern, trailing * allowed (repeatable)
175
182
 
183
+ Options of hud variants
184
+ --json print JSON instead of Markdown
185
+ --dir <path> directory of the file store (default .hud)
186
+
176
187
  Exit codes: 0 clean, 1 at least one route failed, 2 usage or setup error.`;
177
188
  var UsageError = class extends Error {};
178
189
  function next(argv, i, flag) {
@@ -185,10 +196,27 @@ function integer(value, flag) {
185
196
  if (!Number.isInteger(n) || n < 0) throw new UsageError(`${flag} needs a non-negative integer`);
186
197
  return n;
187
198
  }
199
+ function parseVariants(rest) {
200
+ const args = {
201
+ command: "variants",
202
+ json: false
203
+ };
204
+ for (let i = 0; i < rest.length; i++) {
205
+ const flag = rest[i] ?? "";
206
+ if (flag === "--json") args.json = true;
207
+ else if (flag.startsWith("--dir=") && flag.length > 6) args.dir = flag.slice(6);
208
+ else if (flag === "--dir") {
209
+ args.dir = next(rest, i, flag);
210
+ i++;
211
+ } else throw new UsageError(`unknown option "${flag}"`);
212
+ }
213
+ return args;
214
+ }
188
215
  /** `argv` without the runtime and script. */
189
216
  function parseArgs(argv) {
190
217
  const [command, ...rest] = argv;
191
218
  if (command === void 0 || command === "--help" || command === "-h" || command === "help") return { command: "help" };
219
+ if (command === "variants") return parseVariants(rest);
192
220
  if (command !== "sweep") throw new UsageError(`unknown command "${command}"`);
193
221
  const args = {
194
222
  command: "sweep",
@@ -246,6 +274,11 @@ async function main(argv) {
246
274
  process.stdout.write(`${USAGE}\n`);
247
275
  return 0;
248
276
  }
277
+ if (args.command === "variants") {
278
+ const decisions = await readVariants(file(args.dir === void 0 ? {} : { dir: args.dir }));
279
+ process.stdout.write(`${args.json ? JSON.stringify(decisions, null, 2) : formatVariantsMarkdown(decisions)}\n`);
280
+ return 0;
281
+ }
249
282
  const quiet = args.json;
250
283
  const log = (line) => {
251
284
  if (!quiet) process.stdout.write(`${line}\n`);
@@ -1,4 +1,4 @@
1
- import { a as HudCapability, c as HudPlugin } from "./plugins-BZT-1LBe.js";
1
+ import { a as HudCapability, c as HudPlugin } from "./plugins-pL2CoWzI.js";
2
2
  import { ComponentType, ReactNode } from "react";
3
3
  //#region src/shell/panels/types.d.ts
4
4
  /** The viewport edge the rail docks to. */
@@ -40,8 +40,9 @@ function useForceStateBadge() {
40
40
  //#endregion
41
41
  //#region src/plugins/design/index.tsx
42
42
  const TokensPanel = lazy(() => import("./tokens-panel-CbMQfasZ.js"));
43
- const VariantsPanel = lazy(() => import("./variants-panel-B6zWcknV.js"));
44
- const ForceStatePanel = lazy(() => import("./force-state-panel-mu-txJnA.js"));
43
+ const VariantsPanel = lazy(() => import("./variants-panel-D23v5KIp.js"));
44
+ const ForceStatePanel = lazy(() => import("./force-state-panel-D5oDydLs.js"));
45
+ const VariantBar = process.env.NODE_ENV === "development" ? lazy(() => import("./variant-bar-BzZ0ln-C.js")) : void 0;
45
46
  /**
46
47
  * Live swatches of the host app's design tokens. Values are read from the
47
48
  * host document, outside the HUD's shadow root, so scoped and themed tokens
@@ -60,23 +61,40 @@ function tokens(adapter) {
60
61
  }
61
62
  /**
62
63
  * The page's live variant groups (`VariantGroup` from `@hansenexus/hud/variants`)
63
- * with a switcher, agent scores from the storage seam and Decide, which
64
- * needs `variants.decide` and `variantsServer()` from
65
- * `@hansenexus/hud/plugins/design/server`. An adapter adds the app's own
66
- * variant registry and the generate-brief queue (`variants.generate`). Client only.
64
+ * with a switcher and agent scores from the storage seam. `pages` adds the
65
+ * variant bar, which steps through them and records picks and notes. Picks
66
+ * need `variants.decide` and `variantsServer()` from
67
+ * `@hansenexus/hud/plugins/design/server`. The adapter fields add the app's
68
+ * own variant registry and the generate-brief queue (`variants.generate`).
69
+ * Client only.
67
70
  */
68
- function variants(adapter) {
71
+ function variants(options = {}) {
72
+ const { pages, navigate, ...adapter } = options;
69
73
  function Panel({ ctx }) {
70
74
  return /* @__PURE__ */ jsx(VariantsPanel, {
71
75
  adapter,
72
76
  ctx
73
77
  });
74
78
  }
75
- return definePlugin({
79
+ const plugin = {
76
80
  id: "variants",
77
81
  title: "Variants",
78
82
  icon: hudIcon("layers"),
79
83
  panel: Panel
84
+ };
85
+ if (!VariantBar || !pages || pages.length === 0) return definePlugin(plugin);
86
+ const Bar = VariantBar;
87
+ const barPages = pages;
88
+ function Overlay({ ctx }) {
89
+ return /* @__PURE__ */ jsx(Bar, {
90
+ pages: barPages,
91
+ navigate,
92
+ ctx
93
+ });
94
+ }
95
+ return definePlugin({
96
+ ...plugin,
97
+ overlay: Overlay
80
98
  });
81
99
  }
82
100
  /**
@@ -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-BXG1a4we.js";
2
+ import { i as useForceState } from "./design-BIXY1-Ex.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 HudCapability, c as HudPlugin, s as HudHttpMethod } from "./plugins-BZT-1LBe.js";
1
+ import { a as HudCapability, c as HudPlugin, s as HudHttpMethod } from "./plugins-pL2CoWzI.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
@@ -1,5 +1,5 @@
1
- import { a as HudCapability, c as HudPlugin } from "./plugins-BZT-1LBe.js";
2
- import { o as HudDock } from "./define-hud-DTv3njuU.js";
1
+ import { a as HudCapability, c as HudPlugin } from "./plugins-pL2CoWzI.js";
2
+ import { o as HudDock } from "./define-hud-B0aFXrcK.js";
3
3
  import { ComponentType, ReactNode } from "react";
4
4
  //#region src/core/grabber/outline.d.ts
5
5
  interface ElementOutlineProps {
@@ -1,4 +1,4 @@
1
- import { r as HudBadge } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge } from "./plugins-pL2CoWzI.js";
2
2
  import { Metric } from "web-vitals";
3
3
  //#region src/plugins/vitals/vitals-panel.d.ts
4
4
  declare function VitalsPanel(): import("react").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { l as HudPluginContext, u as HudPluginProps } from "./plugins-pL2CoWzI.js";
2
+ import "./index-5B7foZut.js";
3
+ //#region src/plugins/routes/index.d.ts
4
+ interface RoutesOptions {
5
+ /**
6
+ * Shortcut of the "Go to route" command, which opens the panel with the
7
+ * filter focused and its text selected. Default `mod+shift+r`.
8
+ */
9
+ shortcut?: string;
10
+ /**
11
+ * Path globs listed first, above the groups: `["/*\/dev/*"]` pins every dev
12
+ * page. `*` matches within a segment, `**` across segments. Rows pinned from
13
+ * the panel join them, kept per app in `localStorage`.
14
+ */
15
+ pinned?: readonly string[];
16
+ /**
17
+ * How a row navigates. Default: Next's router (`window.next.router.push`)
18
+ * when the page has one, else `location.assign`.
19
+ */
20
+ navigate?: (url: string) => void;
21
+ }
22
+ /**
23
+ * Route index and quick switcher: every page of the app's `app/` tree,
24
+ * dynamic segments filled from the fixtures the server half knows, pinned
25
+ * and recent routes first, one keystroke away. Client half; the scanner lives
26
+ * in `@hansenexus/hud/plugins/routes/server`, which also feeds the `hud sweep`
27
+ * CLI.
28
+ */
29
+ declare function routes({ shortcut, pinned, navigate }?: RoutesOptions): {
30
+ readonly id: "routes";
31
+ readonly title: "Routes";
32
+ readonly capability: "routes.read";
33
+ readonly icon: import("react").ComponentType;
34
+ readonly badge: ({ ctx }: HudPluginProps) => null;
35
+ readonly panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
36
+ readonly commands: readonly [{
37
+ readonly id: "go";
38
+ readonly title: "Go to route";
39
+ readonly shortcut: string;
40
+ readonly run: (ctx: HudPluginContext) => void;
41
+ }];
42
+ };
43
+ //#endregion
44
+ export { routes as n, RoutesOptions as t };
@@ -1,4 +1,4 @@
1
- import { r as HudBadge } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge } from "./plugins-pL2CoWzI.js";
2
2
  //#region src/plugins/seo/seo-panel.d.ts
3
3
  /** Every check grouped, worst level first in the summary; head changes re-check automatically. */
4
4
  declare function SeoPanel(): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge, u as HudPluginProps } from "./plugins-pL2CoWzI.js";
2
2
  //#region src/plugins/design/force-state-panel.d.ts
3
3
  /**
4
4
  * Toggles every mounted `StateBoundary` between its real state and a forced
@@ -45,6 +45,16 @@ interface HudTokensAdapter {
45
45
  sourceHint?: string;
46
46
  }
47
47
  //#endregion
48
+ //#region src/plugins/design/variant-pages.d.ts
49
+ /** One stop of the variant bar: a page with a `VariantGroup` on it. */
50
+ interface HudVariantPage {
51
+ /** The `VariantGroup` id the page decides. */
52
+ group: string;
53
+ label: string;
54
+ /** Where the page is: `/pricing`, `#/settings` or `/app#/settings`. */
55
+ href: string;
56
+ }
57
+ //#endregion
48
58
  //#region src/plugins/design/variants-panel.d.ts
49
59
  interface HudVariantCategory {
50
60
  id: string;
@@ -74,7 +84,7 @@ interface HudGenerateResult {
74
84
  */
75
85
  interface HudVariantsAdapter {
76
86
  /** The categories, or a loader the panel calls each time it opens. */
77
- categories: readonly HudVariantCategory[] | (() => Promise<readonly HudVariantCategory[]>);
87
+ categories?: readonly HudVariantCategory[] | (() => Promise<readonly HudVariantCategory[]>);
78
88
  /** Deep link to the full review dashboard, where voting happens. */
79
89
  reviewHref?: string;
80
90
  /** Deep link for one category's drill-in page. */
@@ -100,18 +110,36 @@ declare function tokens(adapter: HudTokensAdapter): {
100
110
  readonly icon: import("react").ComponentType;
101
111
  readonly panel: () => import("react").JSX.Element;
102
112
  };
113
+ interface HudVariantsOptions extends HudVariantsAdapter {
114
+ /**
115
+ * The pages with a `VariantGroup`, in the order the owner walks them. With
116
+ * them the variant bar shows at the bottom of the screen, in development
117
+ * builds only. Keep the array stable.
118
+ */
119
+ pages?: readonly HudVariantPage[];
120
+ /** How the bar goes to a page. Default: Next's router when the page has one, else a full load. */
121
+ navigate?: (href: string) => void;
122
+ }
103
123
  /**
104
124
  * The page's live variant groups (`VariantGroup` from `@hansenexus/hud/variants`)
105
- * with a switcher, agent scores from the storage seam and Decide, which
106
- * needs `variants.decide` and `variantsServer()` from
107
- * `@hansenexus/hud/plugins/design/server`. An adapter adds the app's own
108
- * variant registry and the generate-brief queue (`variants.generate`). Client only.
125
+ * with a switcher and agent scores from the storage seam. `pages` adds the
126
+ * variant bar, which steps through them and records picks and notes. Picks
127
+ * need `variants.decide` and `variantsServer()` from
128
+ * `@hansenexus/hud/plugins/design/server`. The adapter fields add the app's
129
+ * own variant registry and the generate-brief queue (`variants.generate`).
130
+ * Client only.
109
131
  */
110
- declare function variants(adapter?: HudVariantsAdapter): {
111
- readonly id: "variants";
112
- readonly title: "Variants";
132
+ declare function variants(options?: HudVariantsOptions): {
133
+ id: string;
134
+ title: string;
135
+ icon: import("react").ComponentType;
136
+ panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
137
+ } | {
138
+ readonly id: string;
139
+ readonly title: string;
113
140
  readonly icon: import("react").ComponentType;
114
141
  readonly panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
142
+ readonly overlay: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
115
143
  };
116
144
  /**
117
145
  * Forces the page's `StateBoundary`s (`@hansenexus/hud/state-boundary`) to
@@ -132,4 +160,4 @@ declare function forceState(): {
132
160
  }];
133
161
  };
134
162
  //#endregion
135
- export { HudGenerateResult as a, HudTokenDescriptor as c, HudTokensAdapter as d, HudGenerateRequest as i, HudTokenGroup as l, tokens as n, HudVariantCategory as o, variants as r, HudVariantsAdapter as s, forceState as t, HudTokenScope as u };
163
+ export { HudGenerateRequest as a, HudVariantsAdapter as c, HudTokenGroup as d, HudTokenScope as f, variants as i, HudVariantPage as l, forceState as n, HudGenerateResult as o, HudTokensAdapter as p, tokens as r, HudVariantCategory as s, HudVariantsOptions as t, HudTokenDescriptor as u };
@@ -1,4 +1,4 @@
1
- import { r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge, u as HudPluginProps } from "./plugins-pL2CoWzI.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
@@ -1,5 +1,5 @@
1
- import { l as HudPluginContext, r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
2
- import "./index-C3wzZS3o.js";
1
+ import { l as HudPluginContext, r as HudBadge, u as HudPluginProps } from "./plugins-pL2CoWzI.js";
2
+ import "./index-5B7foZut.js";
3
3
  //#region src/plugins/a11y/axe.d.ts
4
4
  type AxeImpact = "critical" | "serious" | "moderate" | "minor";
5
5
  /** Element path as axe reports it: selectors per shadow-DOM or frame hop. */
@@ -1,4 +1,4 @@
1
- import { r as HudBadge } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge } from "./plugins-pL2CoWzI.js";
2
2
  import { a as CaptureOptions, t as InspectRequest } from "./requests-CJrUf465.js";
3
3
  import { t as InspectAdapter } from "./adapter-BYoxPYTI.js";
4
4
  //#region src/plugins/observe/redact.d.ts
@@ -1,4 +1,4 @@
1
- import { r as HudBadge, u as HudPluginProps } from "./plugins-BZT-1LBe.js";
1
+ import { r as HudBadge, u as HudPluginProps } from "./plugins-pL2CoWzI.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. */
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as GrabScreenshotImage, i as GrabScreenshot, n as GrabAnchor, o as matchComponentHints, r as GrabPayload, s as GrabComponent, t as ComponentHint } from "./payload-MUQ9ciER.js";
2
- import { _ as HudGrab, a as HudCapability, b as useGrab, c as HudPlugin, g as ratingTone, h as definePlugin, i as HudBadgeTone, l as HudPluginContext, m as PinEdge, n as HudApiError, o as HudCommand, r as HudBadge, t as HudAccessControl, u as HudPluginProps, v as HudGrabState, y as HudHighlight } from "./plugins-BZT-1LBe.js";
3
- import { a as DockSide, i as defineHud, n as HudAutoPlugins, o as HudDock, r as HudMountProps, t as DefineHudOptions } from "./define-hud-DTv3njuU.js";
4
- import { a as hudIcon, c as PICKER_CSS, d as ElementOutlineProps, i as HudIconName, l as PickPoint, n as HudProps, o as ElementPicker, r as HUD_ICON_NAMES, s as ElementPickerProps, t as Hud, u as ElementOutline } from "./index-C3wzZS3o.js";
2
+ import { _ as HudGrab, a as HudCapability, b as useGrab, c as HudPlugin, g as ratingTone, h as definePlugin, i as HudBadgeTone, l as HudPluginContext, m as PinEdge, n as HudApiError, o as HudCommand, r as HudBadge, t as HudAccessControl, u as HudPluginProps, v as HudGrabState, y as HudHighlight } from "./plugins-pL2CoWzI.js";
3
+ import { a as DockSide, i as defineHud, n as HudAutoPlugins, o as HudDock, r as HudMountProps, t as DefineHudOptions } from "./define-hud-B0aFXrcK.js";
4
+ import { a as hudIcon, c as PICKER_CSS, d as ElementOutlineProps, i as HudIconName, l as PickPoint, n as HudProps, o as ElementPicker, r as HUD_ICON_NAMES, s as ElementPickerProps, t as Hud, u as ElementOutline } from "./index-5B7foZut.js";
5
5
  import { n as HUD_HOST_TAG, t as HUD_DEV_MARKER } from "./marker-CMrvxPmS.js";
6
6
  export { type ComponentHint, type DefineHudOptions, type DockSide, ElementOutline, type ElementOutlineProps, ElementPicker, type ElementPickerProps, type GrabAnchor, type GrabComponent, type GrabPayload, type GrabScreenshot, type GrabScreenshotImage, HUD_DEV_MARKER, HUD_HOST_TAG, HUD_ICON_NAMES, Hud, type HudAccessControl, HudApiError, type HudAutoPlugins, type HudBadge, type HudBadgeTone, type HudCapability, type HudCommand, type HudDock, type HudGrab, type HudGrabState, type HudHighlight, type HudIconName, type HudMountProps, type HudPlugin, type HudPluginContext, type HudPluginProps, type HudProps, PICKER_CSS, type PickPoint, type PinEdge, defineHud, definePlugin, hudIcon, matchComponentHints, ratingTone, useGrab };