@hansenexus/hud 0.4.0 → 0.5.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 (157) hide show
  1. package/README.md +603 -9
  2. package/dist/a11y-B5DUaiCs.js +246 -0
  3. package/dist/a11y-panel-p_t4eD7p.js +207 -0
  4. package/dist/{capabilities-CjulXFQX.js → access-C7zlaqj6.js} +1 -90
  5. package/dist/{access-CNvJOwKM.d.ts → access-D_ewAEJG.d.ts} +11 -4
  6. package/dist/access-panel-CEfTr9ZI.js +123 -0
  7. package/dist/adapter-BYoxPYTI.d.ts +33 -0
  8. package/dist/adapter-hcwmJtNx.js +65 -0
  9. package/dist/auto/runtime.d.ts +65 -0
  10. package/dist/auto/runtime.js +50 -0
  11. package/dist/auto.d.ts +15 -0
  12. package/dist/auto.js +33 -0
  13. package/dist/capabilities-rDSKjXpq.js +110 -0
  14. package/dist/capture-CwrIwLqi.js +300 -0
  15. package/dist/capture-buffer-Bbbo6omF.d.ts +35 -0
  16. package/dist/cli.d.ts +1 -0
  17. package/dist/cli.js +275 -0
  18. package/dist/data-panel-DhxAmP91.js +817 -0
  19. package/dist/data-store-ChF1td_P.js +164 -0
  20. package/dist/define-hud-CHPedaQ5.d.ts +50 -0
  21. package/dist/design-D0kGgPoP.js +87 -0
  22. package/dist/detect-BxHZ0pxW.d.ts +25 -0
  23. package/dist/detect-CHZiSeZs.js +63 -0
  24. package/dist/dispatch-panel-B-xr_Giy.js +279 -0
  25. package/dist/{env-vEjyJfPW.d.ts → env-CApnbI0r.d.ts} +2 -0
  26. package/dist/{env-DfxpPfs9.js → env-CaiFPIhF.js} +3 -0
  27. package/dist/file-xdSaQ2uR.js +103 -0
  28. package/dist/flags-DVtaJ8pQ.d.ts +58 -0
  29. package/dist/flags.d.ts +2 -0
  30. package/dist/flags.js +82 -0
  31. package/dist/force-state-panel-_otVYh9i.js +97 -0
  32. package/dist/generate-C8lQl3Eh.js +53 -0
  33. package/dist/handler-BpVhxEmU.js +106 -0
  34. package/dist/{handler-WmE4Lu7l.d.ts → handler-DtYVCZY6.d.ts} +1 -1
  35. package/dist/index-BAV_1W8a.d.ts +43 -0
  36. package/dist/index-BJ26pse9.d.ts +70 -0
  37. package/dist/index-BnQ0dTZf.d.ts +19 -0
  38. package/dist/index-CwfX-W87.d.ts +72 -0
  39. package/dist/index-DcH9V3cU.d.ts +48 -0
  40. package/dist/index-DqOyNf1u.d.ts +65 -0
  41. package/dist/index-DstI_ike.d.ts +66 -0
  42. package/dist/index-Dxz4fn4j.d.ts +42 -0
  43. package/dist/index-Hhh7OXzU.d.ts +129 -0
  44. package/dist/index-ReFbhQ9p.d.ts +25 -0
  45. package/dist/index-RgXfMBuW.d.ts +48 -0
  46. package/dist/{index-BYsdS-7d.d.ts → index-gCZBO53s.d.ts} +21 -3
  47. package/dist/index.d.ts +5 -5
  48. package/dist/index.js +710 -69
  49. package/dist/inspect-C9Ft8fqn.js +142 -0
  50. package/dist/inspect-root-BkaupBMp.js +429 -0
  51. package/dist/meta-Bv0sEao3.js +6 -0
  52. package/dist/meta-C_G7MB5w.d.ts +49 -0
  53. package/dist/mocks-CA-wM2SB.d.ts +109 -0
  54. package/dist/mocks-ESiRqk9o.js +150 -0
  55. package/dist/msw-browser-wjaYgkB7.d.ts +31 -0
  56. package/dist/next/config.d.ts +52 -0
  57. package/dist/next/config.js +78 -0
  58. package/dist/next.d.ts +14 -4
  59. package/dist/next.js +5 -3
  60. package/dist/observe-CdDnDBRP.js +89 -0
  61. package/dist/observe-panel-Cgp1M8oT.js +347 -0
  62. package/dist/ops-panel-CEqDe_UT.js +234 -0
  63. package/dist/{payload-CLKDVZWl.d.ts → payload-MUQ9ciER.d.ts} +25 -1
  64. package/dist/plugins/a11y.d.ts +2 -0
  65. package/dist/plugins/a11y.js +2 -0
  66. package/dist/plugins/access/server.d.ts +5 -5
  67. package/dist/plugins/access/server.js +4 -3
  68. package/dist/plugins/access.d.ts +5 -5
  69. package/dist/plugins/access.js +16 -215
  70. package/dist/plugins/agent/server.d.ts +3 -38
  71. package/dist/plugins/agent/server.js +47 -21
  72. package/dist/plugins/agent.d.ts +4 -4
  73. package/dist/plugins/agent.js +6 -348
  74. package/dist/plugins/capture/server.d.ts +92 -0
  75. package/dist/plugins/capture/server.js +248 -0
  76. package/dist/plugins/capture.d.ts +24 -0
  77. package/dist/plugins/capture.js +70 -0
  78. package/dist/plugins/data/msw-browser.d.ts +2 -0
  79. package/dist/plugins/data/msw-browser.js +39 -0
  80. package/dist/plugins/data/msw-node.d.ts +36 -0
  81. package/dist/plugins/data/msw-node.js +68 -0
  82. package/dist/plugins/data/server.d.ts +257 -0
  83. package/dist/plugins/data/server.js +717 -0
  84. package/dist/plugins/data.d.ts +6 -0
  85. package/dist/plugins/data.js +51 -0
  86. package/dist/plugins/design/server.d.ts +54 -0
  87. package/dist/plugins/design/server.js +198 -0
  88. package/dist/plugins/design.d.ts +4 -124
  89. package/dist/plugins/design.js +4 -619
  90. package/dist/plugins/inspect/convex.d.ts +2 -0
  91. package/dist/plugins/inspect/convex.js +486 -0
  92. package/dist/plugins/inspect/react-query.d.ts +2 -0
  93. package/dist/plugins/inspect/react-query.js +225 -0
  94. package/dist/plugins/inspect/sockets.d.ts +51 -0
  95. package/dist/plugins/inspect/sockets.js +397 -0
  96. package/dist/plugins/inspect/swr.d.ts +2 -0
  97. package/dist/plugins/inspect/swr.js +218 -0
  98. package/dist/plugins/inspect.d.ts +4 -0
  99. package/dist/plugins/inspect.js +3 -0
  100. package/dist/plugins/observe.d.ts +4 -64
  101. package/dist/plugins/observe.js +1 -616
  102. package/dist/plugins/ops/server.d.ts +1 -1
  103. package/dist/plugins/ops/server.js +2 -1
  104. package/dist/plugins/ops.d.ts +2 -1
  105. package/dist/plugins/ops.js +15 -336
  106. package/dist/plugins/routes/server.d.ts +88 -0
  107. package/dist/plugins/routes/server.js +62 -0
  108. package/dist/plugins/routes.d.ts +3 -0
  109. package/dist/plugins/routes.js +216 -0
  110. package/dist/plugins/seo.d.ts +2 -0
  111. package/dist/plugins/seo.js +2 -0
  112. package/dist/plugins/vitals.d.ts +2 -25
  113. package/dist/plugins/vitals.js +3 -2
  114. package/dist/{plugins-CQ_0w1ot.d.ts → plugins-BZvDqGx5.d.ts} +33 -3
  115. package/dist/poll-CjKsWZi8.js +89 -0
  116. package/dist/requests-BwD6MKEq.js +282 -0
  117. package/dist/requests-CJrUf465.d.ts +50 -0
  118. package/dist/review.js +2 -2
  119. package/dist/same-origin-BGet22CC.js +21 -0
  120. package/dist/scan-DzJNXqOk.js +165 -0
  121. package/dist/seo-Dq9q_QkO.js +551 -0
  122. package/dist/seo-panel-CfiY-TnT.js +124 -0
  123. package/dist/server.d.ts +2 -2
  124. package/dist/server.js +2 -105
  125. package/dist/sessions-panel-COvhPAzv.js +98 -0
  126. package/dist/{shortcut-U6ftVY06.js → shortcut-s_mjGeU8.js} +1 -44
  127. package/dist/{types-QJUajwWq.js → state-CjjZPjPJ.js} +13 -8
  128. package/dist/store/convex.d.ts +33 -0
  129. package/dist/store/convex.js +52 -0
  130. package/dist/{vitals-panel-Dvc5dnR-.js → store-CQqIIKTc.js} +1 -29
  131. package/dist/store-Ync9eb1G.js +67 -0
  132. package/dist/store.d.ts +76 -0
  133. package/dist/store.js +188 -0
  134. package/dist/{styles--slk86ZQ.js → styles-BA8ueHoV.js} +13 -3
  135. package/dist/styles-DKU_P8MH.js +139 -0
  136. package/dist/styles-DPpDPmzi.js +68 -0
  137. package/dist/tokens-panel-CbMQfasZ.js +142 -0
  138. package/dist/types-B-ulf2Jp.js +8 -0
  139. package/dist/types-BIgGf-0C.d.ts +25 -0
  140. package/dist/types-BIkI-qN8.js +30 -0
  141. package/dist/{types-DADBRiGk.d.ts → types-Cxh4twqc.d.ts} +1 -1
  142. package/dist/types-DIdPfjtV.js +6 -0
  143. package/dist/types-DaJcsEjO.d.ts +44 -0
  144. package/dist/types-Dn68psVz.d.ts +118 -0
  145. package/dist/types-szkr2QOF.d.ts +39 -0
  146. package/dist/unlock-store-4V3vR4Eg.js +96 -0
  147. package/dist/variant-groups-TIfO3NIj.js +137 -0
  148. package/dist/variant-groups-aAIrcNK5.d.ts +36 -0
  149. package/dist/variants-panel-BDoSkwBJ.js +457 -0
  150. package/dist/variants-types-CcRf119M.d.ts +63 -0
  151. package/dist/variants.d.ts +43 -0
  152. package/dist/variants.js +83 -0
  153. package/dist/vitals-panel-BCmMUntW.js +30 -0
  154. package/dist/vite.d.ts +37 -0
  155. package/dist/vite.js +134 -0
  156. package/package.json +65 -5
  157. package/dist/define-hud-BBzsSl8b.d.ts +0 -36
@@ -0,0 +1,72 @@
1
+ import { a as CaptureOptions, t as InspectRequest } from "./requests-CJrUf465.js";
2
+ import { t as InspectAdapter } from "./adapter-BYoxPYTI.js";
3
+ //#region src/plugins/observe/redact.d.ts
4
+ /**
5
+ * Redaction for captured requests. Runs at capture time, so a secret never
6
+ * sits in the HUD's buffer: `authorization`, `cookie`, `set-cookie` and every
7
+ * header, query parameter, form field or JSON key whose name looks like a
8
+ * token are replaced with `[redacted]`, as are bearer tokens and JWTs found
9
+ * in free text.
10
+ */
11
+ declare const REDACTED = "[redacted]";
12
+ declare function isSensitiveKey(key: string): boolean;
13
+ /** Headers as a plain lower-cased record, sensitive values replaced. */
14
+ declare function redactHeaders(headers: Headers | Record<string, string> | Iterable<[string, string]>): Record<string, string>;
15
+ /** Replaces the value of every sensitive query parameter; the rest of the URL is untouched. */
16
+ declare function redactUrl(url: string): string;
17
+ /**
18
+ * Redacts a captured body by its content type: JSON is walked by key, a URL
19
+ * encoded form by field, anything else gets the free-text pass.
20
+ */
21
+ declare function redactBody(text: string, contentType?: string): string;
22
+ //#endregion
23
+ //#region src/plugins/inspect/replay.d.ts
24
+ /**
25
+ * Why a request cannot be replayed, or `null` when it can. Bodies the capture
26
+ * could only describe (blobs, streams, files) cannot be rebuilt.
27
+ */
28
+ declare function replayBlocker(entry: InspectRequest): string | null;
29
+ /**
30
+ * Sends the request again through the page's `fetch`, so the capture records
31
+ * the replay as a new entry tagged `replayOf`. Redacted headers and fields
32
+ * are not resent (their values are gone); cookies go along with
33
+ * `credentials: "include"`. Resolves once the response has arrived.
34
+ */
35
+ declare function replay(entry: InspectRequest): Promise<Response>;
36
+ //#endregion
37
+ //#region src/plugins/inspect/view.d.ts
38
+ type InspectFilter = "all" | "fetch" | "xhr" | "actions" | "errors";
39
+ //#endregion
40
+ //#region src/plugins/inspect/index.d.ts
41
+ declare const INSPECT_CAPABILITY = "inspect.read";
42
+ interface InspectOptions extends Pick<CaptureOptions, "ignore"> {
43
+ /**
44
+ * Extra tabs, one per data source: `inspectConvex`, `inspectReactQuery`,
45
+ * `inspectSwr`, `inspectSockets`, each from its own subpath export.
46
+ */
47
+ adapters?: readonly InspectAdapter[];
48
+ }
49
+ /**
50
+ * Data inspector on top of the observe capture: every fetch, XHR and Next
51
+ * Server Action with timing, status, headers and bodies, and a replay
52
+ * button. `authorization`, `cookie`, `set-cookie` and known token fields are
53
+ * redacted before anything is stored. Needs `inspect.read`.
54
+ *
55
+ * Capture starts when the HUD mounts, so requests made before the panel
56
+ * opens are already listed. It works with or without the observe plugin.
57
+ * Adapters add a tab each; without them the panel is the request list alone.
58
+ */
59
+ declare function inspect({ ignore, adapters }?: InspectOptions): {
60
+ readonly id: "inspect";
61
+ readonly title: "Inspect";
62
+ readonly capability: "inspect.read";
63
+ readonly pill: () => import("react").JSX.Element;
64
+ readonly panel: () => import("react").JSX.Element;
65
+ readonly commands: readonly [{
66
+ readonly id: "clear";
67
+ readonly title: "Clear captured requests";
68
+ readonly run: () => void;
69
+ }];
70
+ };
71
+ //#endregion
72
+ export { replay as a, isSensitiveKey as c, redactUrl as d, InspectFilter as i, redactBody as l, InspectOptions as n, replayBlocker as o, inspect as r, REDACTED as s, INSPECT_CAPABILITY as t, redactHeaders as u };
@@ -0,0 +1,48 @@
1
+ //#region src/plugins/seo/seo-panel.d.ts
2
+ /** Every check grouped, worst level first in the summary; head changes re-check automatically. */
3
+ declare function SeoPanel(): import("react").JSX.Element;
4
+ //#endregion
5
+ //#region src/plugins/seo/checks.d.ts
6
+ type SeoLevel = "ok" | "warn" | "error";
7
+ type SeoGroup = "title" | "description" | "canonical" | "og" | "json-ld" | "hreflang" | "robots";
8
+ interface SeoCheck {
9
+ /** Unique within one run, e.g. `og:image` or `json-ld#2`. */
10
+ id: string;
11
+ group: SeoGroup;
12
+ label: string;
13
+ level: SeoLevel;
14
+ /** The value found, or what is wrong with it. */
15
+ detail: string;
16
+ }
17
+ /** Every SEO check for `doc`, with `page` as the page's own URL (for canonical and hreflang). */
18
+ declare function runSeoChecks(doc: Document, page: URL): SeoCheck[];
19
+ //#endregion
20
+ //#region src/plugins/seo/store.d.ts
21
+ interface SeoSnapshot {
22
+ checks: SeoCheck[];
23
+ errors: number;
24
+ warnings: number;
25
+ /** `null` until the first check ran (server render, before mount). */
26
+ checkedAt: number | null;
27
+ url: string;
28
+ }
29
+ //#endregion
30
+ //#region src/plugins/seo/index.d.ts
31
+ /**
32
+ * Checks the page's title, description, canonical, Open Graph, JSON-LD,
33
+ * hreflang and robots meta, from mount on and again whenever `<head>` changes.
34
+ * The pill shows the error count. Client only.
35
+ */
36
+ declare function seo(): {
37
+ readonly id: "seo";
38
+ readonly title: "SEO";
39
+ readonly pill: () => import("react").JSX.Element;
40
+ readonly panel: import("react").LazyExoticComponent<typeof SeoPanel>;
41
+ readonly commands: readonly [{
42
+ readonly id: "recheck";
43
+ readonly title: "Re-check SEO meta";
44
+ readonly run: () => undefined;
45
+ }];
46
+ };
47
+ //#endregion
48
+ export { SeoLevel as a, SeoGroup as i, SeoSnapshot as n, runSeoChecks as o, SeoCheck as r, seo as t };
@@ -0,0 +1,65 @@
1
+ import { c as HudPluginProps, s as HudPluginContext } from "./plugins-BZvDqGx5.js";
2
+ import "./index-gCZBO53s.js";
3
+ //#region src/plugins/a11y/axe.d.ts
4
+ type AxeImpact = "critical" | "serious" | "moderate" | "minor";
5
+ /** Element path as axe reports it: selectors per shadow-DOM or frame hop. */
6
+ type AxeTarget = readonly (string | readonly string[])[];
7
+ /** The axe-core release the default `axeUrl` fetches. */
8
+ declare const AXE_VERSION = "4.14.0";
9
+ declare const AXE_URL = "https://cdn.jsdelivr.net/npm/axe-core@4.14.0/axe.min.js";
10
+ /** One finding per offending element, what the panel lists and the pill counts. */
11
+ interface A11yFinding {
12
+ /** Stable within one run: `<rule>#<index>`. */
13
+ key: string;
14
+ rule: string;
15
+ impact: AxeImpact | null;
16
+ help: string;
17
+ helpUrl: string;
18
+ target: AxeTarget;
19
+ html: string;
20
+ summary: string;
21
+ }
22
+ //#endregion
23
+ //#region src/plugins/a11y/store.d.ts
24
+ type A11yStatus = "idle" | "loading" | "running" | "done" | "error";
25
+ interface A11ySnapshot {
26
+ status: A11yStatus;
27
+ findings: A11yFinding[];
28
+ /** Findings per impact, for the summary line. */
29
+ counts: Record<AxeImpact, number>;
30
+ error: string | null;
31
+ ranAt: number | null;
32
+ }
33
+ interface A11yRunOptions {
34
+ /** Where axe-core is fetched from on Run. Default: axe-core pinned on jsDelivr (`AXE_URL`). */
35
+ axeUrl?: string;
36
+ /**
37
+ * Resolves axe-core yourself instead of fetching a URL, e.g.
38
+ * `() => import("axe-core")`, so a bundler serves it as its own chunk.
39
+ */
40
+ load?: () => Promise<unknown>;
41
+ /** Passed to `axe.run` on top of the HUD's own exclusion. */
42
+ runOptions?: Record<string, unknown>;
43
+ }
44
+ //#endregion
45
+ //#region src/plugins/a11y/index.d.ts
46
+ type A11yOptions = A11yRunOptions;
47
+ /**
48
+ * On-demand axe-core audit. Nothing is fetched until Run: axe-core comes from
49
+ * `axeUrl` (jsDelivr, pinned) or your own `load` (`() => import("axe-core")`).
50
+ * Findings list by impact; clicking one outlines the element with the grabber
51
+ * overlay. Client only.
52
+ */
53
+ declare function a11y(options?: A11yOptions): {
54
+ readonly id: "a11y";
55
+ readonly title: "A11y";
56
+ readonly pill: () => import("react").JSX.Element;
57
+ readonly panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
58
+ readonly commands: readonly [{
59
+ readonly id: "run";
60
+ readonly title: "Run accessibility audit";
61
+ readonly run: (ctx: HudPluginContext) => void;
62
+ }];
63
+ };
64
+ //#endregion
65
+ export { A11yFinding as a, AxeImpact as c, A11yStatus as i, a11y as n, AXE_URL as o, A11ySnapshot as r, AXE_VERSION as s, A11yOptions as t };
@@ -0,0 +1,66 @@
1
+ import { c as HudPluginProps } from "./plugins-BZvDqGx5.js";
2
+ import { s as HudMockScenario } from "./mocks-CA-wM2SB.js";
3
+ import { n as HudMockWorkerModule, r as MockWorkerOptions } from "./msw-browser-wjaYgkB7.js";
4
+ //#region src/plugins/data/data-panel.d.ts
5
+ /**
6
+ * Data panel: the role switch (pick a fixture user; the page reloads signed
7
+ * in as them), feature-flag overrides (cookie or localStorage scope,
8
+ * persisted through the storage seam until reset), the app's seed functions
9
+ * and its mock scenarios (one per endpoint, in the browser and on the
10
+ * server). Needs `data.write` and `dataServer()` in the HUD route.
11
+ */
12
+ declare function DataPanel({ ctx }: HudPluginProps): import("react").JSX.Element;
13
+ //#endregion
14
+ //#region src/plugins/data/data-pill.d.ts
15
+ /** The pill item: who the page is signed in as, how many flags are overridden and how many endpoints are mocked. */
16
+ declare function DataPill({ ctx }: HudPluginProps): import("react").JSX.Element;
17
+ //#endregion
18
+ //#region src/plugins/data/mocks-client.d.ts
19
+ /** `data({ mocks })`: the scenarios and how to start the browser's MSW worker. */
20
+ interface HudMockClientOptions {
21
+ /** The scenarios, the same list `dataServer({ mocks })` and `startMockServer()` get. */
22
+ scenarios: readonly HudMockScenario[];
23
+ /**
24
+ * Loads the worker module on demand: `() => import("@hansenexus/hud/plugins/data/msw-browser")`,
25
+ * or your own `{ startMockWorker }` over a worker the app already runs. Without it client
26
+ * fetches are not mocked and the panel says so.
27
+ */
28
+ worker?: (() => Promise<HudMockWorkerModule>) | undefined;
29
+ /** Passed to `startMockWorker()`. */
30
+ workerOptions?: MockWorkerOptions | undefined;
31
+ }
32
+ interface HudMockClientStatus {
33
+ /** `unconfigured`: no `mocks` on `data()`. `off`: no `worker` loader. `failed`: it rejected; `hint` says why. */
34
+ status: "unconfigured" | "off" | "starting" | "live" | "failed";
35
+ hint?: string;
36
+ }
37
+ //#endregion
38
+ //#region src/plugins/data/index.d.ts
39
+ interface DataOptions {
40
+ /**
41
+ * Mock scenarios in the browser: the scenario list and a loader for the
42
+ * MSW worker module. Without it the panel still toggles scenarios for
43
+ * server fetches and says client fetches are not mocked.
44
+ */
45
+ mocks?: HudMockClientOptions | undefined;
46
+ }
47
+ /**
48
+ * Role switch, feature-flag overrides, seeds and mock scenarios. The pill
49
+ * shows who the page is signed in as, how many flags are overridden and how
50
+ * many endpoints are mocked; the panel picks a fixture user (the page
51
+ * reloads signed in as them, through the auth seam on the server), sets
52
+ * overrides in cookie or localStorage scope, runs the app's seed functions
53
+ * and toggles one scenario per endpoint, persisted through the storage seam
54
+ * until reset. Client half; the server half is `dataServer()` from
55
+ * `@hansenexus/hud/plugins/data/server`. Needs `data.write`, which `access`
56
+ * hard-denies on production.
57
+ */
58
+ declare function data({ mocks }?: DataOptions): {
59
+ readonly id: "data";
60
+ readonly title: "Data";
61
+ readonly capability: "data.write";
62
+ readonly pill: typeof DataPill;
63
+ readonly panel: import("react").LazyExoticComponent<typeof DataPanel>;
64
+ };
65
+ //#endregion
66
+ export { HudMockClientStatus as i, data as n, HudMockClientOptions as r, DataOptions as t };
@@ -0,0 +1,42 @@
1
+ import { t as InspectAdapter } from "./adapter-BYoxPYTI.js";
2
+ //#region src/plugins/inspect/swr/index.d.ts
3
+ /** A key as SWR accepts it: a string, a tuple, an object, or a falsy value. */
4
+ type SwrKey = string | readonly [unknown, ...unknown[]] | Record<string, unknown> | null | undefined | false;
5
+ /** What SWR stores per serialised key; `_k` is the original key, kept for revalidation. */
6
+ interface SwrStateLike {
7
+ data?: unknown;
8
+ error?: unknown;
9
+ isValidating?: boolean;
10
+ isLoading?: boolean;
11
+ _k?: unknown;
12
+ }
13
+ /** The cache from `useSWRConfig()` (a `Map` by default, or the app's provider). */
14
+ interface SwrCacheLike {
15
+ keys(): IterableIterator<string>;
16
+ get(key: string): SwrStateLike | undefined;
17
+ set(key: string, value: SwrStateLike): void;
18
+ delete(key: string): void;
19
+ }
20
+ interface InspectSwrOptions {
21
+ cache: SwrCacheLike;
22
+ /** `mutate` from `useSWRConfig()` or `import { mutate } from "swr"`; called with one key to revalidate it. */
23
+ mutate: (key: SwrKey) => Promise<unknown>;
24
+ }
25
+ interface Stamp {
26
+ updatedAt?: number;
27
+ validatingSince?: number;
28
+ }
29
+ interface SwrEntry {
30
+ key: string;
31
+ state: SwrStateLike;
32
+ stamp: Stamp;
33
+ }
34
+ /**
35
+ * SWR tab for the inspect plugin: every cache key with its data (redacted),
36
+ * error, validation state and age, and Revalidate per key. Wraps the cache's
37
+ * `set` and `delete` when called, so writes are timestamped and the tab
38
+ * re-renders; `dispose()` restores the cache.
39
+ */
40
+ declare function inspectSwr({ cache, mutate }: InspectSwrOptions): InspectAdapter;
41
+ //#endregion
42
+ export { SwrStateLike as a, SwrKey as i, SwrCacheLike as n, inspectSwr as o, SwrEntry as r, InspectSwrOptions as t };
@@ -0,0 +1,129 @@
1
+ import { c as HudPluginProps } from "./plugins-BZvDqGx5.js";
2
+ //#region src/plugins/design/force-state-panel.d.ts
3
+ /**
4
+ * Toggles every mounted `StateBoundary` between its real state and a forced
5
+ * loading, empty or error. Toggles live in memory: a reload returns every
6
+ * boundary to auto, so a forgotten toggle cannot outlive the page.
7
+ */
8
+ declare function ForceStatePanel(): import("react").JSX.Element;
9
+ //#endregion
10
+ //#region src/plugins/design/force-state-pill.d.ts
11
+ /**
12
+ * Pill content: how many boundaries are forced, by toggle or param. Uses the
13
+ * core `.dot`, since the plugin stylesheet only loads with the panel.
14
+ */
15
+ declare function ForceStatePill(): import("react").JSX.Element;
16
+ //#endregion
17
+ //#region src/plugins/design/tokens.d.ts
18
+ interface HudTokenDescriptor {
19
+ /** CSS custom property, including the leading dashes (e.g. `--primary`). */
20
+ cssVar: string;
21
+ /** Short display label; defaults to the var name without its leading dashes. */
22
+ label?: string;
23
+ }
24
+ /**
25
+ * Scope attribute the design system hangs its tokens on, with an optional
26
+ * value: `{ attribute: "data-theme", value: "brand" }` matches
27
+ * `[data-theme="brand"] { --primary: … }`. Omit for `:root`-scoped tokens.
28
+ */
29
+ interface HudTokenScope {
30
+ attribute: string;
31
+ value?: string;
32
+ }
33
+ interface HudTokenGroup {
34
+ label: string;
35
+ /** Var names (`"--primary"`) or descriptors with a label. */
36
+ tokens: readonly (string | HudTokenDescriptor)[];
37
+ scope?: HudTokenScope;
38
+ }
39
+ /** What an app tells the Tokens panel about its design system. */
40
+ interface HudTokensAdapter {
41
+ groups: readonly HudTokenGroup[];
42
+ /** Where the tokens live, shown as a hint (e.g. `src/app/globals.css`). */
43
+ sourceHint?: string;
44
+ }
45
+ //#endregion
46
+ //#region src/plugins/design/variants-panel.d.ts
47
+ interface HudVariantCategory {
48
+ id: string;
49
+ name: string;
50
+ /** Registry status: "active" renders as votable, "decided" as settled. */
51
+ status: string;
52
+ alternativeCount: number;
53
+ /** Domain bucket (marketing, admin, shared …) for grouping. Default "shared". */
54
+ domain?: string;
55
+ }
56
+ interface HudGenerateRequest {
57
+ /** Repo-relative component path. */
58
+ path: string;
59
+ brief: string;
60
+ count: number;
61
+ }
62
+ interface HudGenerateResult {
63
+ ok: boolean;
64
+ /** Where the queued brief landed, on success. */
65
+ markerPath?: string;
66
+ error?: string;
67
+ }
68
+ /**
69
+ * Optional: what an app tells the Variants panel about a variant registry
70
+ * of its own, beyond the live groups on the page. The HUD owns no registry:
71
+ * an app maps its own onto this shape.
72
+ */
73
+ interface HudVariantsAdapter {
74
+ /** The categories, or a loader the panel calls each time it opens. */
75
+ categories: readonly HudVariantCategory[] | (() => Promise<readonly HudVariantCategory[]>);
76
+ /** Deep link to the full review dashboard, where voting happens. */
77
+ reviewHref?: string;
78
+ /** Deep link for one category's drill-in page. */
79
+ categoryHref?: (categoryId: string) => string;
80
+ /** Opens an in-page preview for a category; wins over `categoryHref`. */
81
+ openPreview?: (categoryId: string) => void;
82
+ /**
83
+ * Queues a variant-generation brief. Shown only when the tier grants
84
+ * `variants.generate`. The human stays in the loop: queue, not dispatch.
85
+ */
86
+ generate?: (request: HudGenerateRequest) => Promise<HudGenerateResult>;
87
+ }
88
+ //#endregion
89
+ //#region src/plugins/design/index.d.ts
90
+ /**
91
+ * Live swatches of the host app's design tokens. Values are read from the
92
+ * host document, outside the HUD's shadow root, so scoped and themed tokens
93
+ * show what the page actually renders. Client only.
94
+ */
95
+ declare function tokens(adapter: HudTokensAdapter): {
96
+ readonly id: "tokens";
97
+ readonly title: "Tokens";
98
+ readonly panel: () => import("react").JSX.Element;
99
+ };
100
+ /**
101
+ * The page's live variant groups (`VariantGroup` from `@hansenexus/hud/variants`)
102
+ * with a switcher, agent scores from the storage seam and Decide, which
103
+ * needs `variants.decide` and `variantsServer()` from
104
+ * `@hansenexus/hud/plugins/design/server`. An adapter adds the app's own
105
+ * variant registry and the generate-brief queue (`variants.generate`). Client only.
106
+ */
107
+ declare function variants(adapter?: HudVariantsAdapter): {
108
+ readonly id: "variants";
109
+ readonly title: "Variants";
110
+ readonly panel: ({ ctx }: HudPluginProps) => import("react").JSX.Element;
111
+ };
112
+ /**
113
+ * Forces the page's `StateBoundary`s (`@hansenexus/hud/state-boundary`) to
114
+ * loading, empty or error. The pill shows how many are forced. Client only.
115
+ */
116
+ declare function forceState(): {
117
+ readonly id: "states";
118
+ readonly title: "States";
119
+ readonly capability: "state.force";
120
+ readonly pill: typeof ForceStatePill;
121
+ readonly panel: import("react").LazyExoticComponent<typeof ForceStatePanel>;
122
+ readonly commands: readonly [{
123
+ readonly id: "reset";
124
+ readonly title: "Reset forced states";
125
+ readonly run: () => void;
126
+ }];
127
+ };
128
+ //#endregion
129
+ 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 };
@@ -0,0 +1,25 @@
1
+ import { Metric } from "web-vitals";
2
+ //#region src/plugins/vitals/vitals-panel.d.ts
3
+ declare function VitalsPanel(): import("react").JSX.Element;
4
+ //#endregion
5
+ //#region src/plugins/vitals/store.d.ts
6
+ type VitalName = Metric["name"];
7
+ type VitalRating = Metric["rating"];
8
+ interface Vital {
9
+ name: VitalName;
10
+ value: number;
11
+ rating: VitalRating;
12
+ }
13
+ type VitalsSnapshot = Partial<Record<VitalName, Vital>>;
14
+ //#endregion
15
+ //#region src/plugins/vitals/index.d.ts
16
+ declare function VitalsPill(): import("react").JSX.Element;
17
+ /** Core Web Vitals: LCP in the pill, all five metrics in the panel. Client only. */
18
+ declare function vitals(): {
19
+ readonly id: "vitals";
20
+ readonly title: "Vitals";
21
+ readonly pill: typeof VitalsPill;
22
+ readonly panel: import("react").LazyExoticComponent<typeof VitalsPanel>;
23
+ };
24
+ //#endregion
25
+ export { VitalsSnapshot as a, VitalRating as i, Vital as n, VitalName as r, vitals as t };
@@ -0,0 +1,48 @@
1
+ import { t as InspectAdapter } from "./adapter-BYoxPYTI.js";
2
+ //#region src/plugins/inspect/react-query/index.d.ts
3
+ /**
4
+ * The slice of `@tanstack/query-core` the adapter reads, structurally, so
5
+ * the package is neither imported nor a peer: a real `QueryClient` fits.
6
+ */
7
+ interface QueryLike {
8
+ queryKey: readonly unknown[];
9
+ queryHash: string;
10
+ state: {
11
+ data: unknown;
12
+ error: unknown;
13
+ status: "pending" | "error" | "success";
14
+ fetchStatus: "fetching" | "paused" | "idle";
15
+ dataUpdatedAt: number;
16
+ dataUpdateCount: number;
17
+ isInvalidated: boolean;
18
+ };
19
+ isStale(): boolean;
20
+ isActive(): boolean;
21
+ getObserversCount(): number;
22
+ }
23
+ interface QueryClientLike {
24
+ getQueryCache(): {
25
+ subscribe(listener: (event: unknown) => void): () => void;
26
+ getAll(): QueryLike[];
27
+ };
28
+ invalidateQueries(filters?: {
29
+ queryKey?: readonly unknown[];
30
+ exact?: boolean;
31
+ }): Promise<void>;
32
+ removeQueries(filters?: {
33
+ queryKey?: readonly unknown[];
34
+ exact?: boolean;
35
+ }): void;
36
+ }
37
+ interface InspectReactQueryOptions {
38
+ queryClient: QueryClientLike;
39
+ }
40
+ /**
41
+ * React Query tab for the inspect plugin: every cache entry with its key,
42
+ * status, staleness, observer count and age, data redacted like a response
43
+ * body, and Invalidate / Remove per key. Subscribes to the query cache when
44
+ * called; `dispose()` unsubscribes.
45
+ */
46
+ declare function inspectReactQuery({ queryClient }: InspectReactQueryOptions): InspectAdapter;
47
+ //#endregion
48
+ export { inspectReactQuery as i, QueryClientLike as n, QueryLike as r, InspectReactQueryOptions as t };
@@ -1,5 +1,23 @@
1
- import { o as HudPlugin, r as HudCapability } from "./plugins-CQ_0w1ot.js";
2
- import "./define-hud-BBzsSl8b.js";
1
+ import { o as HudPlugin, r as HudCapability } from "./plugins-BZvDqGx5.js";
2
+ import "./define-hud-CHPedaQ5.js";
3
+ //#region src/core/grabber/outline.d.ts
4
+ interface ElementOutlineProps {
5
+ /** The element to outline; `null` renders nothing. */
6
+ element: Element | null;
7
+ label: string;
8
+ /** Called on Escape, on a pointer press outside the overlay's own root, or once the element leaves the DOM. */
9
+ onDismiss: () => void;
10
+ /** Scroll the element into view when it changes. Default true. */
11
+ reveal?: boolean;
12
+ }
13
+ /**
14
+ * Outlines one element with the grabber's overlay without entering grab mode:
15
+ * findings in a panel point at the page this way. The box follows scrolling
16
+ * and resizes; the outline goes away on Escape, on a press on the page, or
17
+ * when the element is removed.
18
+ */
19
+ declare function ElementOutline({ element, label, onDismiss, reveal }: ElementOutlineProps): import("react").JSX.Element;
20
+ //#endregion
3
21
  //#region src/core/grabber/picker.d.ts
4
22
  interface PickPoint {
5
23
  clientX: number;
@@ -52,4 +70,4 @@ interface HudProps {
52
70
  */
53
71
  declare function Hud({ appSlug, envLabel, plugins, apiBase, can }: HudProps): import("react").JSX.Element;
54
72
  //#endregion
55
- export { PICKER_CSS as a, ElementPickerProps as i, HudProps as n, PickPoint as o, ElementPicker as r, Hud as t };
73
+ export { PICKER_CSS as a, ElementOutlineProps as c, ElementPickerProps as i, HudProps as n, PickPoint as o, ElementPicker as r, ElementOutline as s, Hud as t };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as GrabComponent, i as matchComponentHints, n as GrabAnchor, r as GrabPayload, t as ComponentHint } from "./payload-CLKDVZWl.js";
2
- import { c as HudPluginProps, f as PinEdge, g as useGrab, h as HudGrabState, i as HudCommand, m as HudGrab, n as HudApiError, o as HudPlugin, p as definePlugin, r as HudCapability, s as HudPluginContext, t as HudAccessControl } from "./plugins-CQ_0w1ot.js";
3
- import { n as HudMountProps, r as defineHud, t as DefineHudOptions } from "./define-hud-BBzsSl8b.js";
4
- import { a as PICKER_CSS, i as ElementPickerProps, n as HudProps, o as PickPoint, r as ElementPicker, t as Hud } from "./index-BYsdS-7d.js";
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 useGrab, c as HudPluginProps, f as PinEdge, g as HudHighlight, h as HudGrabState, i as HudCommand, m as HudGrab, n as HudApiError, o as HudPlugin, p as definePlugin, r as HudCapability, s as HudPluginContext, t as HudAccessControl } from "./plugins-BZvDqGx5.js";
3
+ import { i as defineHud, n as HudAutoPlugins, r as HudMountProps, t as DefineHudOptions } from "./define-hud-CHPedaQ5.js";
4
+ import { a as PICKER_CSS, c as ElementOutlineProps, i as ElementPickerProps, n as HudProps, o as PickPoint, r as ElementPicker, s as ElementOutline, t as Hud } from "./index-gCZBO53s.js";
5
5
  import { n as HUD_HOST_TAG, t as HUD_DEV_MARKER } from "./marker-CMrvxPmS.js";
6
- export { type ComponentHint, type DefineHudOptions, ElementPicker, type ElementPickerProps, type GrabAnchor, type GrabComponent, type GrabPayload, HUD_DEV_MARKER, HUD_HOST_TAG, Hud, type HudAccessControl, HudApiError, type HudCapability, type HudCommand, type HudGrab, type HudGrabState, type HudMountProps, type HudPlugin, type HudPluginContext, type HudPluginProps, type HudProps, PICKER_CSS, type PickPoint, type PinEdge, defineHud, definePlugin, matchComponentHints, useGrab };
6
+ export { type ComponentHint, type DefineHudOptions, ElementOutline, type ElementOutlineProps, ElementPicker, type ElementPickerProps, type GrabAnchor, type GrabComponent, type GrabPayload, type GrabScreenshot, type GrabScreenshotImage, HUD_DEV_MARKER, HUD_HOST_TAG, Hud, type HudAccessControl, HudApiError, type HudAutoPlugins, type HudCapability, type HudCommand, type HudGrab, type HudGrabState, type HudHighlight, type HudMountProps, type HudPlugin, type HudPluginContext, type HudPluginProps, type HudProps, PICKER_CSS, type PickPoint, type PinEdge, defineHud, definePlugin, matchComponentHints, useGrab };