@hansenexus/hud 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +634 -12
  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.cjs +201 -0
  57. package/dist/next/config.d.cts +87 -0
  58. package/dist/next/config.d.ts +64 -0
  59. package/dist/next/config.js +84 -0
  60. package/dist/next.d.ts +14 -4
  61. package/dist/next.js +5 -3
  62. package/dist/observe-CdDnDBRP.js +89 -0
  63. package/dist/observe-panel-Cgp1M8oT.js +347 -0
  64. package/dist/ops-panel-CEqDe_UT.js +234 -0
  65. package/dist/{payload-CLKDVZWl.d.ts → payload-MUQ9ciER.d.ts} +25 -1
  66. package/dist/plugins/a11y.d.ts +2 -0
  67. package/dist/plugins/a11y.js +2 -0
  68. package/dist/plugins/access/server.d.ts +5 -5
  69. package/dist/plugins/access/server.js +4 -3
  70. package/dist/plugins/access.d.ts +5 -5
  71. package/dist/plugins/access.js +16 -215
  72. package/dist/plugins/agent/server.d.ts +3 -38
  73. package/dist/plugins/agent/server.js +47 -21
  74. package/dist/plugins/agent.d.ts +4 -4
  75. package/dist/plugins/agent.js +6 -348
  76. package/dist/plugins/capture/server.d.ts +92 -0
  77. package/dist/plugins/capture/server.js +248 -0
  78. package/dist/plugins/capture.d.ts +24 -0
  79. package/dist/plugins/capture.js +70 -0
  80. package/dist/plugins/data/msw-browser.d.ts +2 -0
  81. package/dist/plugins/data/msw-browser.js +39 -0
  82. package/dist/plugins/data/msw-node.d.ts +36 -0
  83. package/dist/plugins/data/msw-node.js +68 -0
  84. package/dist/plugins/data/server.d.ts +257 -0
  85. package/dist/plugins/data/server.js +717 -0
  86. package/dist/plugins/data.d.ts +6 -0
  87. package/dist/plugins/data.js +51 -0
  88. package/dist/plugins/design/server.d.ts +54 -0
  89. package/dist/plugins/design/server.js +198 -0
  90. package/dist/plugins/design.d.ts +4 -124
  91. package/dist/plugins/design.js +4 -619
  92. package/dist/plugins/inspect/convex.d.ts +2 -0
  93. package/dist/plugins/inspect/convex.js +486 -0
  94. package/dist/plugins/inspect/react-query.d.ts +2 -0
  95. package/dist/plugins/inspect/react-query.js +237 -0
  96. package/dist/plugins/inspect/sockets.d.ts +51 -0
  97. package/dist/plugins/inspect/sockets.js +397 -0
  98. package/dist/plugins/inspect/swr.d.ts +2 -0
  99. package/dist/plugins/inspect/swr.js +218 -0
  100. package/dist/plugins/inspect.d.ts +4 -0
  101. package/dist/plugins/inspect.js +3 -0
  102. package/dist/plugins/observe.d.ts +4 -64
  103. package/dist/plugins/observe.js +1 -616
  104. package/dist/plugins/ops/server.d.ts +1 -1
  105. package/dist/plugins/ops/server.js +2 -1
  106. package/dist/plugins/ops.d.ts +2 -1
  107. package/dist/plugins/ops.js +15 -336
  108. package/dist/plugins/routes/server.d.ts +88 -0
  109. package/dist/plugins/routes/server.js +62 -0
  110. package/dist/plugins/routes.d.ts +3 -0
  111. package/dist/plugins/routes.js +216 -0
  112. package/dist/plugins/seo.d.ts +2 -0
  113. package/dist/plugins/seo.js +2 -0
  114. package/dist/plugins/vitals.d.ts +2 -25
  115. package/dist/plugins/vitals.js +3 -2
  116. package/dist/{plugins-CQ_0w1ot.d.ts → plugins-BZvDqGx5.d.ts} +33 -3
  117. package/dist/poll-CjKsWZi8.js +89 -0
  118. package/dist/requests-BwD6MKEq.js +282 -0
  119. package/dist/requests-CJrUf465.d.ts +50 -0
  120. package/dist/review.js +2 -2
  121. package/dist/same-origin-BGet22CC.js +21 -0
  122. package/dist/scan-DzJNXqOk.js +165 -0
  123. package/dist/seo-Dq9q_QkO.js +551 -0
  124. package/dist/seo-panel-CfiY-TnT.js +124 -0
  125. package/dist/server.d.ts +2 -2
  126. package/dist/server.js +2 -105
  127. package/dist/sessions-panel-COvhPAzv.js +98 -0
  128. package/dist/{shortcut-U6ftVY06.js → shortcut-s_mjGeU8.js} +1 -44
  129. package/dist/{types-QJUajwWq.js → state-CjjZPjPJ.js} +13 -8
  130. package/dist/store/convex.d.ts +33 -0
  131. package/dist/store/convex.js +52 -0
  132. package/dist/{vitals-panel-Dvc5dnR-.js → store-CQqIIKTc.js} +1 -29
  133. package/dist/store-Ync9eb1G.js +67 -0
  134. package/dist/store.d.ts +76 -0
  135. package/dist/store.js +188 -0
  136. package/dist/{styles--slk86ZQ.js → styles-BA8ueHoV.js} +13 -3
  137. package/dist/styles-DKU_P8MH.js +139 -0
  138. package/dist/styles-DPpDPmzi.js +68 -0
  139. package/dist/tokens-panel-CbMQfasZ.js +142 -0
  140. package/dist/types-B-ulf2Jp.js +8 -0
  141. package/dist/types-BIgGf-0C.d.ts +25 -0
  142. package/dist/types-BIkI-qN8.js +30 -0
  143. package/dist/{types-DADBRiGk.d.ts → types-Cxh4twqc.d.ts} +1 -1
  144. package/dist/types-DIdPfjtV.js +6 -0
  145. package/dist/types-DaJcsEjO.d.ts +44 -0
  146. package/dist/types-Dn68psVz.d.ts +118 -0
  147. package/dist/types-szkr2QOF.d.ts +39 -0
  148. package/dist/unlock-store-4V3vR4Eg.js +96 -0
  149. package/dist/variant-groups-TIfO3NIj.js +137 -0
  150. package/dist/variant-groups-aAIrcNK5.d.ts +36 -0
  151. package/dist/variants-panel-BDoSkwBJ.js +457 -0
  152. package/dist/variants-types-CcRf119M.d.ts +63 -0
  153. package/dist/variants.d.ts +43 -0
  154. package/dist/variants.js +83 -0
  155. package/dist/vitals-panel-BCmMUntW.js +30 -0
  156. package/dist/vite.d.ts +37 -0
  157. package/dist/vite.js +134 -0
  158. package/package.json +72 -5
  159. package/dist/define-hud-BBzsSl8b.d.ts +0 -36
package/dist/vite.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { o as HudPlugin } from "./plugins-BZvDqGx5.js";
2
+ import { r as HudHandlerOptions, t as HudGuard } from "./handler-DtYVCZY6.js";
3
+ import { Plugin } from "vite";
4
+ //#region src/vite/index.d.ts
5
+ export interface HudViteOptions extends HudHandlerOptions {
6
+ /** The plugins' server halves (`@hansenexus/hud/plugins/<id>/server`). Default: none. */
7
+ plugins?: readonly HudPlugin[];
8
+ /**
9
+ * The package.json detection reads for `@hansenexus/hud/auto`. Default:
10
+ * `package.json` in Vite's root.
11
+ */
12
+ packageJson?: string;
13
+ }
14
+ /** What the app imports; the plugin resolves it to the generated module. */
15
+ export declare const AUTO_ID = "@hansenexus/hud/auto";
16
+ /** The source of `@hansenexus/hud/auto` for the package.json at `path`; a missing file detects nothing. */
17
+ export declare function loadAutoModule(path: string): Promise<string>;
18
+ /**
19
+ * Two jobs. In `vite dev` the plugin routes: `createHudHandler` runs as
20
+ * middleware under `basePath` (default `/api/hud`), ahead of Vite's own
21
+ * middlewares, so `/api/hud/<plugin>/<path>` never falls through to
22
+ * `index.html`; `vite build` and `vite preview` never see it, and the client
23
+ * build gate stays the consumer's `import.meta.env.DEV` literal around the
24
+ * `import()`.
25
+ *
26
+ * In dev and build alike, `@hansenexus/hud/auto`: the plugin reads the app's
27
+ * package.json and serves a module that imports only the plugins the
28
+ * dependencies call for (`enforce: "pre"`, so Vite's resolver never reaches
29
+ * the package's stand-in). The file is watched; editing package.json
30
+ * regenerates the module.
31
+ *
32
+ * `guard` and `can` work as in `createHudHandler`. The default guard answers
33
+ * 404 unless `NODE_ENV` is `development`, which Vite sets for `vite dev`.
34
+ */
35
+ export declare function hud(options?: HudViteOptions): Plugin;
36
+ //#endregion
37
+ export type { HudGuard, HudHandlerOptions };
package/dist/vite.js ADDED
@@ -0,0 +1,134 @@
1
+ import { t as createHudHandler } from "./handler-BpVhxEmU.js";
2
+ import { n as detectHudAuto, r as parsePackageJson } from "./detect-CHZiSeZs.js";
3
+ import { t as generateAutoModule } from "./generate-C8lQl3Eh.js";
4
+ //#region src/vite/bridge.ts
5
+ const BODYLESS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
6
+ /** Absolute URL of a Node request; the host header supplies the origin. */
7
+ function requestUrl(req) {
8
+ const host = req.headers.host;
9
+ const origin = `${req.socket?.encrypted ? "https" : "http"}://${typeof host === "string" && host ? host : "localhost"}`;
10
+ return new URL(req.url ?? "/", origin);
11
+ }
12
+ function concat(chunks) {
13
+ const out = new Uint8Array(chunks.reduce((total, chunk) => total + chunk.byteLength, 0));
14
+ let offset = 0;
15
+ for (const chunk of chunks) {
16
+ out.set(chunk, offset);
17
+ offset += chunk.byteLength;
18
+ }
19
+ return out;
20
+ }
21
+ /** A Fetch `Request` with the Node request's method, headers and (buffered) body. */
22
+ async function toRequest(req, url = requestUrl(req)) {
23
+ const method = req.method ?? "GET";
24
+ const headers = new Headers();
25
+ for (const [name, value] of Object.entries(req.headers)) {
26
+ if (value === void 0) continue;
27
+ if (Array.isArray(value)) for (const entry of value) headers.append(name, entry);
28
+ else headers.set(name, value);
29
+ }
30
+ let body;
31
+ if (!BODYLESS.has(method)) {
32
+ const chunks = [];
33
+ for await (const chunk of req) chunks.push(chunk);
34
+ body = concat(chunks);
35
+ }
36
+ return new Request(url, {
37
+ method,
38
+ headers,
39
+ body: body ?? null
40
+ });
41
+ }
42
+ /** Streams a Fetch `Response` into the Node response; every `Set-Cookie` survives. */
43
+ async function writeResponse(response, res) {
44
+ res.statusCode = response.status;
45
+ for (const [name, value] of response.headers) if (name !== "set-cookie") res.setHeader(name, value);
46
+ const cookies = response.headers.getSetCookie();
47
+ if (cookies.length > 0) res.setHeader("set-cookie", cookies);
48
+ if (!response.body) {
49
+ res.end();
50
+ return;
51
+ }
52
+ const reader = response.body.getReader();
53
+ res.on("close", () => {
54
+ reader.cancel().catch(() => {});
55
+ });
56
+ for (;;) {
57
+ const { done, value } = await reader.read();
58
+ if (done) break;
59
+ res.write(value);
60
+ }
61
+ res.end();
62
+ }
63
+ //#endregion
64
+ //#region src/vite/index.ts
65
+ /** What the app imports; the plugin resolves it to the generated module. */
66
+ const AUTO_ID = "@hansenexus/hud/auto";
67
+ const RESOLVED_AUTO_ID = "\0hansenexus-hud:auto";
68
+ function normalizeBase(basePath) {
69
+ return `/${basePath.split("/").filter(Boolean).join("/")}`;
70
+ }
71
+ /** The source of `@hansenexus/hud/auto` for the package.json at `path`; a missing file detects nothing. */
72
+ async function loadAutoModule(path) {
73
+ const { readFile } = await import("node:fs/promises");
74
+ let text = "{}";
75
+ try {
76
+ text = await readFile(path, "utf8");
77
+ } catch {
78
+ console.warn(`hud: ${path} not found; @hansenexus/hud/auto enables the base plugins only`);
79
+ }
80
+ return generateAutoModule(detectHudAuto(parsePackageJson(text)), path);
81
+ }
82
+ /**
83
+ * Two jobs. In `vite dev` the plugin routes: `createHudHandler` runs as
84
+ * middleware under `basePath` (default `/api/hud`), ahead of Vite's own
85
+ * middlewares, so `/api/hud/<plugin>/<path>` never falls through to
86
+ * `index.html`; `vite build` and `vite preview` never see it, and the client
87
+ * build gate stays the consumer's `import.meta.env.DEV` literal around the
88
+ * `import()`.
89
+ *
90
+ * In dev and build alike, `@hansenexus/hud/auto`: the plugin reads the app's
91
+ * package.json and serves a module that imports only the plugins the
92
+ * dependencies call for (`enforce: "pre"`, so Vite's resolver never reaches
93
+ * the package's stand-in). The file is watched; editing package.json
94
+ * regenerates the module.
95
+ *
96
+ * `guard` and `can` work as in `createHudHandler`. The default guard answers
97
+ * 404 unless `NODE_ENV` is `development`, which Vite sets for `vite dev`.
98
+ */
99
+ function hud(options = {}) {
100
+ const { plugins = [], packageJson, ...handlerOptions } = options;
101
+ const basePath = normalizeBase(handlerOptions.basePath ?? "/api/hud");
102
+ const handler = createHudHandler(plugins, {
103
+ ...handlerOptions,
104
+ basePath
105
+ });
106
+ let manifest = packageJson ?? "package.json";
107
+ return {
108
+ name: "hansenexus-hud",
109
+ enforce: "pre",
110
+ configResolved(config) {
111
+ manifest = packageJson ?? `${config.root}/package.json`;
112
+ },
113
+ resolveId(id) {
114
+ return id === "@hansenexus/hud/auto" ? RESOLVED_AUTO_ID : null;
115
+ },
116
+ async load(id) {
117
+ if (id !== RESOLVED_AUTO_ID) return null;
118
+ this.addWatchFile(manifest);
119
+ return loadAutoModule(manifest);
120
+ },
121
+ configureServer(server) {
122
+ server.middlewares.use((req, res, next) => {
123
+ const url = requestUrl(req);
124
+ if (url.pathname !== basePath && !url.pathname.startsWith(`${basePath}/`)) {
125
+ next();
126
+ return;
127
+ }
128
+ toRequest(req, url).then((request) => handler.handle(request)).then((response) => writeResponse(response, res)).catch(next);
129
+ });
130
+ }
131
+ };
132
+ }
133
+ //#endregion
134
+ export { AUTO_ID, hud, loadAutoModule };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hansenexus/hud",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Modular dev HUD for React apps: status pill, floating panels, element grabber, plugin API.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,7 +11,8 @@
11
11
  "workspaces": [
12
12
  ".",
13
13
  "playground",
14
- "fixtures/next-app"
14
+ "fixtures/next-app",
15
+ "fixtures/vite-app"
15
16
  ],
16
17
  "files": [
17
18
  "dist",
@@ -31,6 +32,28 @@
31
32
  "types": "./dist/next.d.ts",
32
33
  "import": "./dist/next.js"
33
34
  },
35
+ "./next/config": {
36
+ "import": {
37
+ "types": "./dist/next/config.d.ts",
38
+ "default": "./dist/next/config.js"
39
+ },
40
+ "require": {
41
+ "types": "./dist/next/config.d.cts",
42
+ "default": "./dist/next/config.cjs"
43
+ }
44
+ },
45
+ "./vite": {
46
+ "types": "./dist/vite.d.ts",
47
+ "import": "./dist/vite.js"
48
+ },
49
+ "./auto": {
50
+ "types": "./dist/auto.d.ts",
51
+ "import": "./dist/auto.js"
52
+ },
53
+ "./auto/runtime": {
54
+ "types": "./dist/auto/runtime.d.ts",
55
+ "import": "./dist/auto/runtime.js"
56
+ },
34
57
  "./plugins/*": {
35
58
  "types": "./dist/plugins/*.d.ts",
36
59
  "import": "./dist/plugins/*.js"
@@ -39,6 +62,22 @@
39
62
  "types": "./dist/state-boundary.d.ts",
40
63
  "import": "./dist/state-boundary.js"
41
64
  },
65
+ "./variants": {
66
+ "types": "./dist/variants.d.ts",
67
+ "import": "./dist/variants.js"
68
+ },
69
+ "./flags": {
70
+ "types": "./dist/flags.d.ts",
71
+ "import": "./dist/flags.js"
72
+ },
73
+ "./store": {
74
+ "types": "./dist/store.d.ts",
75
+ "import": "./dist/store.js"
76
+ },
77
+ "./store/convex": {
78
+ "types": "./dist/store/convex.d.ts",
79
+ "import": "./dist/store/convex.js"
80
+ },
42
81
  "./review": {
43
82
  "types": "./dist/review.d.ts",
44
83
  "import": "./dist/review.js"
@@ -48,6 +87,9 @@
48
87
  "import": "./dist/markers.js"
49
88
  }
50
89
  },
90
+ "bin": {
91
+ "hud": "./dist/cli.js"
92
+ },
51
93
  "sideEffects": false,
52
94
  "scripts": {
53
95
  "dev": "bun run --cwd playground dev",
@@ -57,10 +99,12 @@
57
99
  "format": "biome check --write .",
58
100
  "test": "vitest run",
59
101
  "test:watch": "vitest",
60
- "check": "bun run lint && bun run typecheck && bun run test && bun run build && bun run check:pack",
102
+ "test:e2e": "playwright test",
103
+ "check": "bun run lint && bun run typecheck && bun run test && bun run build && bun run check:pack && bun run check:size",
61
104
  "changeset": "changeset",
62
105
  "version-packages": "changeset version",
63
- "check:pack": "bun scripts/check-pack.ts"
106
+ "check:pack": "bun scripts/check-pack.ts",
107
+ "check:size": "bun scripts/check-size.ts"
64
108
  },
65
109
  "dependencies": {
66
110
  "web-vitals": "^6.2.3"
@@ -68,25 +112,48 @@
68
112
  "peerDependencies": {
69
113
  "react": "^19.0.0",
70
114
  "react-dom": "^19.0.0",
71
- "convex": "^1.43.0"
115
+ "convex": "^1.43.0",
116
+ "playwright": ">=1.40.0",
117
+ "@playwright/test": ">=1.40.0",
118
+ "vite": ">=6.0.0",
119
+ "msw": ">=3.0.0"
72
120
  },
73
121
  "peerDependenciesMeta": {
74
122
  "convex": {
75
123
  "optional": true
124
+ },
125
+ "playwright": {
126
+ "optional": true
127
+ },
128
+ "@playwright/test": {
129
+ "optional": true
130
+ },
131
+ "vite": {
132
+ "optional": true
133
+ },
134
+ "msw": {
135
+ "optional": true
76
136
  }
77
137
  },
78
138
  "devDependencies": {
79
139
  "@biomejs/biome": "^2.5.15",
80
140
  "@changesets/changelog-github": "^1.0.1",
81
141
  "@changesets/cli": "^3.0.3",
142
+ "@playwright/test": "1.63.0",
143
+ "@tanstack/react-query": "^5.104.1",
82
144
  "@testing-library/react": "^16.3.3",
83
145
  "@types/react": "^19.3.0",
84
146
  "@types/react-dom": "^19.3.0",
85
147
  "convex": "^1.46.0",
86
148
  "jsdom": "^30.1.2",
149
+ "msw": "^3.0.2",
150
+ "next": "^16.4.0",
151
+ "playwright": "1.63.0",
87
152
  "rolldown": "^1.2.12",
153
+ "swr": "^2.5.1",
88
154
  "tsdown": "^0.23.0",
89
155
  "typescript": "^7.0.2",
156
+ "vite": "^8.3.3",
90
157
  "vitest": "^5.0.3"
91
158
  },
92
159
  "publishConfig": {
@@ -1,36 +0,0 @@
1
- import { o as HudPlugin, r as HudCapability } from "./plugins-CQ_0w1ot.js";
2
- import { ComponentType } from "react";
3
- //#region src/core/define-hud.d.ts
4
- interface DefineHudOptions {
5
- /** App slug: labels the pill and keys the persisted layout. */
6
- app: string;
7
- /** Client halves (`@hansenexus/hud/plugins/<id>`), in pill order. */
8
- plugins: readonly HudPlugin[];
9
- /** Base path of the catch-all route serving `createHudHandler`. Default "/api/hud". */
10
- apiBase?: string;
11
- /** Capability check. Default: grant all (core assumes development). */
12
- can?: (capability: HudCapability) => boolean;
13
- }
14
- /** Props the loader passes in at mount time. */
15
- interface HudMountProps {
16
- /** Badge at the start of the pill. Default "DEV". */
17
- envLabel?: string;
18
- /**
19
- * Tier the loader resolved. Default "development". Any other tier renders
20
- * nothing unless a plugin brings `access`.
21
- */
22
- env?: string;
23
- }
24
- /**
25
- * The app's one HUD file:
26
- *
27
- * ```tsx
28
- * export default defineHud({ app: "hansenexus", plugins: [vitals()] });
29
- * ```
30
- *
31
- * Returns a component. The plugin list is frozen here, so the shell sees a
32
- * stable array across renders.
33
- */
34
- declare function defineHud({ app, plugins, apiBase, can }: DefineHudOptions): ComponentType<HudMountProps>;
35
- //#endregion
36
- export { HudMountProps as n, defineHud as r, DefineHudOptions as t };