@hansenexus/hud 0.3.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 (172) hide show
  1. package/README.md +782 -6
  2. package/dist/a11y-B5DUaiCs.js +246 -0
  3. package/dist/a11y-panel-p_t4eD7p.js +207 -0
  4. package/dist/access-C7zlaqj6.js +100 -0
  5. package/dist/access-D_ewAEJG.d.ts +61 -0
  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-CApnbI0r.d.ts +19 -0
  26. package/dist/env-CaiFPIhF.js +31 -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-BaqWsmrf.js +153 -0
  32. package/dist/force-state-CCqoTfVB.d.ts +23 -0
  33. package/dist/force-state-panel-_otVYh9i.js +97 -0
  34. package/dist/generate-C8lQl3Eh.js +53 -0
  35. package/dist/handler-BpVhxEmU.js +106 -0
  36. package/dist/handler-DtYVCZY6.d.ts +39 -0
  37. package/dist/index-BAV_1W8a.d.ts +43 -0
  38. package/dist/index-BJ26pse9.d.ts +70 -0
  39. package/dist/index-BnQ0dTZf.d.ts +19 -0
  40. package/dist/index-CwfX-W87.d.ts +72 -0
  41. package/dist/index-DcH9V3cU.d.ts +48 -0
  42. package/dist/index-DqOyNf1u.d.ts +65 -0
  43. package/dist/index-DstI_ike.d.ts +66 -0
  44. package/dist/index-Dxz4fn4j.d.ts +42 -0
  45. package/dist/index-Hhh7OXzU.d.ts +129 -0
  46. package/dist/index-ReFbhQ9p.d.ts +25 -0
  47. package/dist/index-RgXfMBuW.d.ts +48 -0
  48. package/dist/index-gCZBO53s.d.ts +73 -0
  49. package/dist/index.d.ts +6 -36
  50. package/dist/index.js +798 -240
  51. package/dist/inspect-C9Ft8fqn.js +142 -0
  52. package/dist/inspect-root-BkaupBMp.js +429 -0
  53. package/dist/marker-C66LxOhJ.d.ts +9 -0
  54. package/dist/marker-CMrvxPmS.d.ts +12 -0
  55. package/dist/marker-DjeGvL-F.js +9 -0
  56. package/dist/marker-uZYPOJ4M.js +12 -0
  57. package/dist/markers.d.ts +3 -0
  58. package/dist/markers.js +3 -0
  59. package/dist/meta-Bv0sEao3.js +6 -0
  60. package/dist/meta-C_G7MB5w.d.ts +49 -0
  61. package/dist/mocks-CA-wM2SB.d.ts +109 -0
  62. package/dist/mocks-ESiRqk9o.js +150 -0
  63. package/dist/msw-browser-wjaYgkB7.d.ts +31 -0
  64. package/dist/next/config.d.ts +52 -0
  65. package/dist/next/config.js +78 -0
  66. package/dist/next.d.ts +14 -19
  67. package/dist/next.js +7 -30
  68. package/dist/observe-CdDnDBRP.js +89 -0
  69. package/dist/observe-panel-Cgp1M8oT.js +347 -0
  70. package/dist/ops-panel-CEqDe_UT.js +234 -0
  71. package/dist/payload-MUQ9ciER.d.ts +92 -0
  72. package/dist/plugins/a11y.d.ts +2 -0
  73. package/dist/plugins/a11y.js +2 -0
  74. package/dist/plugins/access/server.d.ts +122 -0
  75. package/dist/plugins/access/server.js +340 -0
  76. package/dist/plugins/access.d.ts +41 -0
  77. package/dist/plugins/access.js +51 -0
  78. package/dist/plugins/agent/server.d.ts +94 -0
  79. package/dist/plugins/agent/server.js +455 -0
  80. package/dist/plugins/agent.d.ts +37 -0
  81. package/dist/plugins/agent.js +69 -0
  82. package/dist/plugins/capture/server.d.ts +92 -0
  83. package/dist/plugins/capture/server.js +248 -0
  84. package/dist/plugins/capture.d.ts +24 -0
  85. package/dist/plugins/capture.js +70 -0
  86. package/dist/plugins/data/msw-browser.d.ts +2 -0
  87. package/dist/plugins/data/msw-browser.js +39 -0
  88. package/dist/plugins/data/msw-node.d.ts +36 -0
  89. package/dist/plugins/data/msw-node.js +68 -0
  90. package/dist/plugins/data/server.d.ts +257 -0
  91. package/dist/plugins/data/server.js +717 -0
  92. package/dist/plugins/data.d.ts +6 -0
  93. package/dist/plugins/data.js +51 -0
  94. package/dist/plugins/design/server.d.ts +54 -0
  95. package/dist/plugins/design/server.js +198 -0
  96. package/dist/plugins/design.d.ts +5 -0
  97. package/dist/plugins/design.js +4 -0
  98. package/dist/plugins/inspect/convex.d.ts +2 -0
  99. package/dist/plugins/inspect/convex.js +486 -0
  100. package/dist/plugins/inspect/react-query.d.ts +2 -0
  101. package/dist/plugins/inspect/react-query.js +225 -0
  102. package/dist/plugins/inspect/sockets.d.ts +51 -0
  103. package/dist/plugins/inspect/sockets.js +397 -0
  104. package/dist/plugins/inspect/swr.d.ts +2 -0
  105. package/dist/plugins/inspect/swr.js +218 -0
  106. package/dist/plugins/inspect.d.ts +4 -0
  107. package/dist/plugins/inspect.js +3 -0
  108. package/dist/plugins/observe.d.ts +4 -0
  109. package/dist/plugins/observe.js +2 -0
  110. package/dist/plugins/ops/server.d.ts +82 -0
  111. package/dist/plugins/ops/server.js +381 -0
  112. package/dist/plugins/ops.d.ts +27 -0
  113. package/dist/plugins/ops.js +41 -0
  114. package/dist/plugins/routes/server.d.ts +88 -0
  115. package/dist/plugins/routes/server.js +62 -0
  116. package/dist/plugins/routes.d.ts +3 -0
  117. package/dist/plugins/routes.js +216 -0
  118. package/dist/plugins/seo.d.ts +2 -0
  119. package/dist/plugins/seo.js +2 -0
  120. package/dist/plugins/vitals.d.ts +2 -25
  121. package/dist/plugins/vitals.js +4 -86
  122. package/dist/plugins-BZvDqGx5.d.ts +144 -0
  123. package/dist/{plugins-CzUiTn_r.js → plugins-DVy_vaYr.js} +3 -1
  124. package/dist/poll-CjKsWZi8.js +89 -0
  125. package/dist/requests-BwD6MKEq.js +282 -0
  126. package/dist/requests-CJrUf465.d.ts +50 -0
  127. package/dist/review.d.ts +181 -0
  128. package/dist/review.js +1017 -0
  129. package/dist/same-origin-BGet22CC.js +21 -0
  130. package/dist/scan-DzJNXqOk.js +165 -0
  131. package/dist/selector-NSYSe7AZ.js +28 -0
  132. package/dist/seo-Dq9q_QkO.js +551 -0
  133. package/dist/seo-panel-CfiY-TnT.js +124 -0
  134. package/dist/server.d.ts +3 -39
  135. package/dist/server.js +2 -105
  136. package/dist/sessions-panel-COvhPAzv.js +98 -0
  137. package/dist/shortcut-s_mjGeU8.js +179 -0
  138. package/dist/state-CjjZPjPJ.js +40 -0
  139. package/dist/state-boundary.d.ts +26 -0
  140. package/dist/state-boundary.js +61 -0
  141. package/dist/store/convex.d.ts +33 -0
  142. package/dist/store/convex.js +52 -0
  143. package/dist/store-CQqIIKTc.js +59 -0
  144. package/dist/store-Ync9eb1G.js +67 -0
  145. package/dist/store.d.ts +76 -0
  146. package/dist/store.js +188 -0
  147. package/dist/styles-BA8ueHoV.js +342 -0
  148. package/dist/styles-DKU_P8MH.js +139 -0
  149. package/dist/styles-DPpDPmzi.js +68 -0
  150. package/dist/tokens-panel-CbMQfasZ.js +142 -0
  151. package/dist/types-B-ulf2Jp.js +8 -0
  152. package/dist/types-BIgGf-0C.d.ts +25 -0
  153. package/dist/types-BIkI-qN8.js +30 -0
  154. package/dist/types-Cxh4twqc.d.ts +50 -0
  155. package/dist/types-DIdPfjtV.js +6 -0
  156. package/dist/types-DaJcsEjO.d.ts +44 -0
  157. package/dist/types-Dn68psVz.d.ts +118 -0
  158. package/dist/types-f3jlNxzw.d.ts +92 -0
  159. package/dist/types-szkr2QOF.d.ts +39 -0
  160. package/dist/unlock-store-4V3vR4Eg.js +96 -0
  161. package/dist/variant-groups-TIfO3NIj.js +137 -0
  162. package/dist/variant-groups-aAIrcNK5.d.ts +36 -0
  163. package/dist/variants-panel-BDoSkwBJ.js +457 -0
  164. package/dist/variants-types-CcRf119M.d.ts +63 -0
  165. package/dist/variants.d.ts +43 -0
  166. package/dist/variants.js +83 -0
  167. package/dist/vitals-panel-BCmMUntW.js +30 -0
  168. package/dist/vite.d.ts +37 -0
  169. package/dist/vite.js +134 -0
  170. package/package.json +85 -5
  171. package/dist/define-hud-BHQR8Lbv.d.ts +0 -31
  172. package/dist/plugins-1QmTmZyL.d.ts +0 -76
@@ -0,0 +1,342 @@
1
+ import { n as HUD_HOST_TAG } from "./marker-uZYPOJ4M.js";
2
+ import { useEffect, useLayoutEffect, useRef, useState } from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { createPortal } from "react-dom";
5
+ //#region src/core/grabber/picker.tsx
6
+ /**
7
+ * Styles for the picker overlay. The picker renders where it is mounted, so
8
+ * the caller puts these into the same (shadow) root. Colours fall back when
9
+ * the `--hud-*` tokens are absent.
10
+ */
11
+ const PICKER_CSS = `
12
+ .grab-layer { position: fixed; inset: 0; pointer-events: none; }
13
+ .grab-hint {
14
+ position: fixed;
15
+ top: 0;
16
+ left: 50%;
17
+ transform: translateX(-50%);
18
+ padding: 3px 12px;
19
+ border-radius: 0 0 6px 6px;
20
+ white-space: nowrap;
21
+ background: var(--hud-accent, #0369a1);
22
+ color: var(--hud-accent-fg, #ffffff);
23
+ font: 600 11px/1.5 var(--hud-mono, ui-monospace, monospace);
24
+ }
25
+ .grab-outline {
26
+ position: fixed;
27
+ border: 1.5px solid var(--hud-accent, #0369a1);
28
+ background: color-mix(in srgb, var(--hud-accent, #0369a1) 8%, transparent);
29
+ border-radius: 3px;
30
+ }
31
+ .grab-label {
32
+ position: fixed;
33
+ max-width: min(480px, calc(100vw - 8px));
34
+ overflow: hidden;
35
+ text-overflow: ellipsis;
36
+ white-space: nowrap;
37
+ padding: 1px 6px;
38
+ border-radius: 3px;
39
+ background: var(--hud-accent, #0369a1);
40
+ color: var(--hud-accent-fg, #ffffff);
41
+ font: 600 10px/1.6 var(--hud-mono, ui-monospace, monospace);
42
+ }
43
+ `;
44
+ /**
45
+ * Host pages set `cursor` on buttons and links, which beats an inherited
46
+ * crosshair, so grab mode briefly adds one global rule to the document.
47
+ */
48
+ const CURSOR_RULE = "*, *::before, *::after { cursor: crosshair !important; }";
49
+ /** Pointer events the page must not see while picking: they would focus, submit or navigate. */
50
+ const SWALLOWED = [
51
+ "pointerdown",
52
+ "mousedown",
53
+ "pointerup",
54
+ "mouseup",
55
+ "dblclick"
56
+ ];
57
+ function describeTag(element) {
58
+ return element.tagName.toLowerCase();
59
+ }
60
+ /**
61
+ * Click-to-pick controller: crosshair, hover outline with a label, the next
62
+ * click picks, Escape cancels. Events inside the picker's own shadow host
63
+ * (the HUD's pill and panels) pass through untouched, so panels stay usable
64
+ * and mounted during a grab.
65
+ */
66
+ function ElementPicker({ active, onPick, onCancel, hint = "Click an element · Esc cancels", describe = describeTag, ignore }) {
67
+ const layer = useRef(null);
68
+ const [highlight, setHighlight] = useState(null);
69
+ const props = useRef({
70
+ onPick,
71
+ onCancel,
72
+ describe,
73
+ ignore
74
+ });
75
+ props.current = {
76
+ onPick,
77
+ onCancel,
78
+ describe,
79
+ ignore
80
+ };
81
+ useEffect(() => {
82
+ if (!active) {
83
+ setHighlight(null);
84
+ return;
85
+ }
86
+ const root = layer.current?.getRootNode();
87
+ const ownHost = root instanceof ShadowRoot ? root.host : null;
88
+ const doc = layer.current?.ownerDocument ?? document;
89
+ let hovered = null;
90
+ function target(event) {
91
+ const path = event.composedPath();
92
+ if (ownHost && path.includes(ownHost)) return null;
93
+ const el = path[0];
94
+ if (!(el instanceof Element)) return null;
95
+ if (el === doc.documentElement || el === doc.body) return null;
96
+ return props.current.ignore?.(el) ? null : el;
97
+ }
98
+ function measure() {
99
+ if (!hovered?.isConnected) {
100
+ setHighlight(null);
101
+ return;
102
+ }
103
+ const r = hovered.getBoundingClientRect();
104
+ setHighlight({
105
+ left: r.left,
106
+ top: r.top,
107
+ width: r.width,
108
+ height: r.height,
109
+ label: props.current.describe(hovered)
110
+ });
111
+ }
112
+ function onMove(event) {
113
+ const el = target(event);
114
+ if (el === hovered) return;
115
+ hovered = el;
116
+ measure();
117
+ }
118
+ function swallow(event) {
119
+ if (!target(event)) return;
120
+ event.preventDefault();
121
+ event.stopPropagation();
122
+ }
123
+ function onClick(event) {
124
+ const el = target(event);
125
+ if (!el) return;
126
+ event.preventDefault();
127
+ event.stopPropagation();
128
+ props.current.onPick(el, {
129
+ clientX: event.clientX,
130
+ clientY: event.clientY
131
+ });
132
+ }
133
+ function onKey(event) {
134
+ if (event.key !== "Escape") return;
135
+ event.preventDefault();
136
+ event.stopPropagation();
137
+ props.current.onCancel();
138
+ }
139
+ const cursor = doc.createElement("style");
140
+ cursor.textContent = CURSOR_RULE;
141
+ doc.head.appendChild(cursor);
142
+ const win = doc.defaultView ?? window;
143
+ doc.addEventListener("pointermove", onMove, true);
144
+ doc.addEventListener("click", onClick, true);
145
+ for (const type of SWALLOWED) doc.addEventListener(type, swallow, true);
146
+ win.addEventListener("keydown", onKey, true);
147
+ win.addEventListener("scroll", measure, true);
148
+ win.addEventListener("resize", measure);
149
+ return () => {
150
+ cursor.remove();
151
+ doc.removeEventListener("pointermove", onMove, true);
152
+ doc.removeEventListener("click", onClick, true);
153
+ for (const type of SWALLOWED) doc.removeEventListener(type, swallow, true);
154
+ win.removeEventListener("keydown", onKey, true);
155
+ win.removeEventListener("scroll", measure, true);
156
+ win.removeEventListener("resize", measure);
157
+ setHighlight(null);
158
+ };
159
+ }, [active]);
160
+ return /* @__PURE__ */ jsxs("div", {
161
+ ref: layer,
162
+ className: "grab-layer",
163
+ hidden: !active,
164
+ children: [active && /* @__PURE__ */ jsx("div", {
165
+ className: "grab-hint",
166
+ role: "status",
167
+ children: hint
168
+ }), active && highlight && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
169
+ className: "grab-outline",
170
+ style: {
171
+ left: highlight.left - 2,
172
+ top: highlight.top - 2,
173
+ width: highlight.width + 4,
174
+ height: highlight.height + 4
175
+ }
176
+ }), /* @__PURE__ */ jsx("div", {
177
+ className: "grab-label",
178
+ style: {
179
+ left: Math.max(highlight.left - 2, 4),
180
+ top: highlight.top >= 22 ? highlight.top - 20 : highlight.top + highlight.height + 4
181
+ },
182
+ children: highlight.label
183
+ })] })]
184
+ });
185
+ }
186
+ //#endregion
187
+ //#region src/shell/shadow-host.tsx
188
+ /**
189
+ * Inline `!important` on the host element: author `!important` in a host
190
+ * stylesheet (`* { position: static !important }`) loses to inline
191
+ * `!important`, so this is the one set of rules a client site cannot override.
192
+ * The host covers the viewport but lets every click through; HUD surfaces opt
193
+ * back in with `pointer-events: auto`.
194
+ */
195
+ const HOST_STYLE = {
196
+ all: "initial",
197
+ position: "fixed",
198
+ inset: "0",
199
+ "z-index": "2147483000",
200
+ "pointer-events": "none",
201
+ display: "block"
202
+ };
203
+ /**
204
+ * Renders children into a shadow root on a host element appended to <body>.
205
+ * Mounted in an effect, so server rendering emits nothing and hydration never
206
+ * differs.
207
+ */
208
+ function ShadowHost({ css, marker, children }) {
209
+ const [mount, setMount] = useState(null);
210
+ useLayoutEffect(() => {
211
+ const host = document.createElement(HUD_HOST_TAG);
212
+ for (const [prop, value] of Object.entries(HOST_STYLE)) host.style.setProperty(prop, value, "important");
213
+ const shadow = host.attachShadow({ mode: "open" });
214
+ const style = document.createElement("style");
215
+ style.textContent = css;
216
+ const root = document.createElement("div");
217
+ root.className = "hud";
218
+ root.setAttribute("data-hud-marker", marker);
219
+ shadow.append(style, root);
220
+ document.body.appendChild(host);
221
+ setMount(root);
222
+ return () => {
223
+ host.remove();
224
+ setMount(null);
225
+ };
226
+ }, [css, marker]);
227
+ return mount ? createPortal(children, mount) : null;
228
+ }
229
+ //#endregion
230
+ //#region src/shell/styles.ts
231
+ /**
232
+ * The HUD's whole stylesheet. It lives inside the shadow root, so host
233
+ * selectors cannot reach in and these rules cannot leak out. Inherited
234
+ * properties (font, color, line-height) still cross the shadow boundary, which
235
+ * is what `all: initial` on the root resets.
236
+ */
237
+ const HUD_CSS = `
238
+ .hud {
239
+ all: initial;
240
+ --hud-bg: #ffffff;
241
+ --hud-bg-subtle: #f4f4f5;
242
+ --hud-fg: #18181b;
243
+ --hud-fg-muted: #71717a;
244
+ --hud-border: rgba(24, 24, 27, 0.14);
245
+ --hud-accent: #0369a1;
246
+ --hud-accent-fg: #ffffff;
247
+ --hud-good: #15803d;
248
+ --hud-warn: #b45309;
249
+ --hud-poor: #b91c1c;
250
+ --hud-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
251
+ --hud-radius: 8px;
252
+ --hud-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
253
+ --hud-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
254
+
255
+ font-family: var(--hud-font);
256
+ font-size: 12px;
257
+ line-height: 1.5;
258
+ color: var(--hud-fg);
259
+ }
260
+
261
+ @media (prefers-color-scheme: dark) {
262
+ .hud {
263
+ --hud-bg: #18181b;
264
+ --hud-bg-subtle: #27272a;
265
+ --hud-fg: #f4f4f5;
266
+ --hud-fg-muted: #a1a1aa;
267
+ --hud-border: rgba(244, 244, 245, 0.16);
268
+ --hud-accent: #38bdf8;
269
+ --hud-accent-fg: #082f49;
270
+ --hud-good: #4ade80;
271
+ --hud-warn: #fbbf24;
272
+ --hud-poor: #f87171;
273
+ --hud-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
274
+ }
275
+ }
276
+
277
+ .hud *, .hud *::before, .hud *::after { box-sizing: border-box; }
278
+
279
+ .hud button {
280
+ font: inherit;
281
+ color: inherit;
282
+ background: none;
283
+ border: 0;
284
+ margin: 0;
285
+ padding: 0;
286
+ cursor: pointer;
287
+ }
288
+
289
+ .hud :focus-visible { outline: 2px solid var(--hud-accent); outline-offset: 1px; }
290
+
291
+ /* Corner and offsets are inline, from the pill's placement. */
292
+ .pill {
293
+ position: fixed;
294
+ max-width: calc(100vw - 24px);
295
+ display: flex;
296
+ align-items: center;
297
+ gap: 2px;
298
+ padding: 3px;
299
+ background: var(--hud-bg);
300
+ border: 1px solid var(--hud-border);
301
+ border-radius: 999px;
302
+ box-shadow: var(--hud-shadow);
303
+ font-family: var(--hud-mono);
304
+ pointer-events: auto;
305
+ }
306
+
307
+ .hud .pill-item {
308
+ display: flex;
309
+ align-items: center;
310
+ gap: 6px;
311
+ padding: 2px 8px;
312
+ border-radius: 999px;
313
+ white-space: nowrap;
314
+ }
315
+
316
+ .pill-item:hover, .pill-item[aria-pressed="true"] { background: var(--hud-bg-subtle); }
317
+
318
+ /* Out of flow but mounted and measurable: its live content keeps running. */
319
+ .hud .pill-overflow {
320
+ position: absolute;
321
+ visibility: hidden;
322
+ pointer-events: none;
323
+ }
324
+
325
+ .pill[data-dragging] { opacity: 0.85; transition: none; }
326
+
327
+ .env { font-weight: 600; color: var(--hud-accent); cursor: grab; touch-action: none; user-select: none; }
328
+ .pill[data-dragging] .env { cursor: grabbing; }
329
+
330
+ .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hud-fg-muted); }
331
+ .dot[data-rating="good"] { background: var(--hud-good); }
332
+ .dot[data-rating="needs-improvement"] { background: var(--hud-warn); }
333
+ .dot[data-rating="poor"] { background: var(--hud-poor); }
334
+
335
+ .vitals { width: 100%; border-collapse: collapse; font-family: var(--hud-mono); }
336
+ .vitals td { padding: 3px 0; }
337
+ .vitals td:last-child { text-align: right; }
338
+ .vitals .label { color: var(--hud-fg-muted); }
339
+ .empty { color: var(--hud-fg-muted); }
340
+ `;
341
+ //#endregion
342
+ export { PICKER_CSS as i, ShadowHost as n, ElementPicker as r, HUD_CSS as t };
@@ -0,0 +1,139 @@
1
+ //#region src/plugins/design/styles.ts
2
+ /**
3
+ * Design plugin styles. Each panel renders them in a `<style>` inside the
4
+ * HUD's shadow root, so the core stylesheet carries nothing for an app that
5
+ * omits the plugin. Built on the shell's `--hud-*` tokens.
6
+ */
7
+ const DESIGN_CSS = `
8
+ .design { display: flex; flex-direction: column; gap: 12px; }
9
+ .design-section { display: flex; flex-direction: column; gap: 6px; }
10
+ .design-heading {
11
+ display: flex;
12
+ align-items: center;
13
+ justify-content: space-between;
14
+ gap: 8px;
15
+ font-size: 10px;
16
+ font-weight: 600;
17
+ letter-spacing: 0.06em;
18
+ text-transform: uppercase;
19
+ color: var(--hud-fg-muted);
20
+ }
21
+ .design-muted { color: var(--hud-fg-muted); }
22
+ .design-hint { color: var(--hud-fg-muted); font-size: 11px; }
23
+ .design-mono { font-family: var(--hud-mono); }
24
+ .hud .design-link {
25
+ color: var(--hud-accent);
26
+ text-decoration: none;
27
+ cursor: pointer;
28
+ }
29
+ .hud .design-link:hover { text-decoration: underline; }
30
+
31
+ .design-swatches {
32
+ display: grid;
33
+ grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
34
+ gap: 6px;
35
+ }
36
+ .hud .design-swatch {
37
+ display: flex;
38
+ flex-direction: column;
39
+ overflow: hidden;
40
+ border: 1px solid var(--hud-border);
41
+ border-radius: 6px;
42
+ text-align: left;
43
+ }
44
+ .hud .design-swatch:hover { border-color: var(--hud-accent); }
45
+ .design-chip {
46
+ display: block;
47
+ height: 28px;
48
+ border-bottom: 1px solid var(--hud-border);
49
+ background-image: repeating-linear-gradient(
50
+ 45deg, var(--hud-bg-subtle) 0 4px, transparent 4px 8px
51
+ );
52
+ }
53
+ .design-swatch-text {
54
+ display: flex;
55
+ flex-direction: column;
56
+ padding: 3px 6px;
57
+ min-width: 0;
58
+ font-family: var(--hud-mono);
59
+ font-size: 10px;
60
+ }
61
+ .design-swatch-text span {
62
+ overflow: hidden;
63
+ text-overflow: ellipsis;
64
+ white-space: nowrap;
65
+ }
66
+
67
+ .design-row {
68
+ display: flex;
69
+ align-items: center;
70
+ gap: 8px;
71
+ min-width: 0;
72
+ }
73
+ .design-grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
74
+ .design-badge {
75
+ padding: 0 6px;
76
+ border: 1px solid var(--hud-border);
77
+ border-radius: 999px;
78
+ font-family: var(--hud-mono);
79
+ font-size: 10px;
80
+ white-space: nowrap;
81
+ }
82
+ .design-badge[data-tone="active"] { color: var(--hud-good); border-color: currentColor; }
83
+ .design-badge[data-tone="forced"] {
84
+ color: var(--hud-bg);
85
+ background: var(--hud-warn);
86
+ border-color: var(--hud-warn);
87
+ }
88
+
89
+ .design-group { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; }
90
+ .design-variants { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
91
+ .design-variant { display: flex; flex-direction: column; gap: 2px; }
92
+ .design-variant .design-segment { text-align: left; }
93
+ .design-score { font-variant-numeric: tabular-nums; }
94
+ .design-rationale { margin: 0 0 0 8px; color: var(--hud-fg-muted); font-size: 11px; }
95
+ .design code { font-family: var(--hud-mono); font-size: 10px; }
96
+
97
+ .design-boundary { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; }
98
+ .design-segments { display: flex; gap: 2px; margin: 0; padding: 0; border: 0; min-inline-size: 0; }
99
+ .hud .design-segment {
100
+ flex: 1;
101
+ padding: 2px 4px;
102
+ border: 1px solid var(--hud-border);
103
+ border-radius: 4px;
104
+ font-family: var(--hud-mono);
105
+ font-size: 10px;
106
+ text-align: center;
107
+ }
108
+ .hud .design-segment:hover { background: var(--hud-bg-subtle); }
109
+ .hud .design-segment[aria-pressed="true"] {
110
+ background: var(--hud-accent);
111
+ border-color: var(--hud-accent);
112
+ color: var(--hud-bg);
113
+ }
114
+
115
+ .hud .design-button {
116
+ align-self: flex-start;
117
+ padding: 2px 10px;
118
+ border: 1px solid var(--hud-border);
119
+ border-radius: 4px;
120
+ }
121
+ .hud .design-button:hover:not(:disabled) { background: var(--hud-bg-subtle); }
122
+ .hud .design-button:disabled { opacity: 0.5; cursor: default; }
123
+
124
+ .design-field {
125
+ width: 100%;
126
+ padding: 4px 6px;
127
+ border: 1px solid var(--hud-border);
128
+ border-radius: 4px;
129
+ background: var(--hud-bg-subtle);
130
+ color: var(--hud-fg);
131
+ font-family: var(--hud-mono);
132
+ font-size: 11px;
133
+ }
134
+ textarea.design-field { min-height: 44px; resize: vertical; }
135
+ .design-result[data-ok="true"] { color: var(--hud-good); }
136
+ .design-result[data-ok="false"] { color: var(--hud-poor); }
137
+ `;
138
+ //#endregion
139
+ export { DESIGN_CSS as t };
@@ -0,0 +1,68 @@
1
+ //#region src/plugins/agent/styles.ts
2
+ /**
3
+ * The agent panels' styles. Each panel renders them in a `<style>` inside the
4
+ * HUD's shadow root, so the plugin brings its CSS without touching core's.
5
+ */
6
+ const AGENT_CSS = `
7
+ .agent { display: grid; gap: 10px; }
8
+ .agent-row { display: flex; align-items: center; gap: 8px; }
9
+ .agent-grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
10
+ .agent-muted { color: var(--hud-fg-muted); }
11
+ .agent-mono { font-family: var(--hud-mono); font-size: 11px; }
12
+ .hud .agent-btn {
13
+ padding: 3px 10px;
14
+ border: 1px solid var(--hud-border);
15
+ border-radius: 6px;
16
+ background: var(--hud-bg-subtle);
17
+ }
18
+ .hud .agent-btn[data-primary] { background: var(--hud-accent); color: var(--hud-accent-fg); border-color: transparent; }
19
+ .hud .agent-btn:disabled { opacity: 0.5; cursor: not-allowed; }
20
+ .agent-card {
21
+ display: grid;
22
+ gap: 2px;
23
+ padding: 6px 8px;
24
+ border: 1px solid var(--hud-border);
25
+ border-radius: 6px;
26
+ background: var(--hud-bg-subtle);
27
+ }
28
+ .agent textarea {
29
+ font: inherit;
30
+ color: inherit;
31
+ background: var(--hud-bg);
32
+ border: 1px solid var(--hud-border);
33
+ border-radius: 6px;
34
+ padding: 6px 8px;
35
+ min-height: 56px;
36
+ resize: vertical;
37
+ }
38
+ .agent fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
39
+ .agent label.agent-target { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
40
+ .agent label.agent-target[data-disabled] { opacity: 0.55; cursor: not-allowed; }
41
+ .agent-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
42
+ .agent-badge {
43
+ flex: none;
44
+ padding: 0 6px;
45
+ border-radius: 999px;
46
+ border: 1px solid currentColor;
47
+ font-size: 10px;
48
+ line-height: 16px;
49
+ color: var(--hud-fg-muted);
50
+ }
51
+ .agent-badge[data-status="running"], .agent-badge[data-status="dispatched"] { color: var(--hud-good); }
52
+ .agent-badge[data-status="sending"], .agent-badge[data-status="queued"] { color: var(--hud-warn); }
53
+ .agent-badge[data-status="failed"] { color: var(--hud-poor); }
54
+ .agent details pre { max-height: 160px; overflow: auto; margin: 4px 0 0; font-size: 10px; }
55
+ .agent-shot { display: grid; gap: 2px; margin-top: 4px; }
56
+ .agent-thumb {
57
+ max-width: 100%;
58
+ max-height: 140px;
59
+ width: auto;
60
+ justify-self: start;
61
+ border: 1px solid var(--hud-border);
62
+ border-radius: 4px;
63
+ background: var(--hud-bg);
64
+ }
65
+ .agent-hint { display: block; padding: 2px 6px; border-radius: 4px; background: var(--hud-bg); user-select: all; }
66
+ `;
67
+ //#endregion
68
+ export { AGENT_CSS as t };
@@ -0,0 +1,142 @@
1
+ import { t as DESIGN_CSS } from "./styles-DKU_P8MH.js";
2
+ import { useCallback, useEffect, useState } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/plugins/design/tokens.ts
5
+ function describe(token) {
6
+ return typeof token === "string" ? { cssVar: token } : token;
7
+ }
8
+ /**
9
+ * Reads every token's computed value from the host document.
10
+ *
11
+ * The HUD renders in a shadow root, and host selectors such as
12
+ * `[data-theme="brand"]` never match inside it, so painting `var(--x)` there
13
+ * shows the wrong value for scoped tokens. Instead each group gets a hidden
14
+ * probe element in the host `<body>`, carrying the group's scope attribute,
15
+ * and the panel paints the probe's resolved values.
16
+ */
17
+ function readTokens(adapter, doc = document) {
18
+ const view = doc.defaultView;
19
+ if (!view) return [];
20
+ return adapter.groups.map((group) => {
21
+ const probe = doc.createElement("div");
22
+ probe.setAttribute("data-hud-token-probe", "");
23
+ probe.setAttribute("aria-hidden", "true");
24
+ probe.style.setProperty("display", "none", "important");
25
+ if (group.scope) probe.setAttribute(group.scope.attribute, group.scope.value ?? "");
26
+ doc.body.appendChild(probe);
27
+ try {
28
+ const style = view.getComputedStyle(probe);
29
+ return {
30
+ label: group.label,
31
+ tokens: group.tokens.map(describe).map(({ cssVar, label }) => ({
32
+ cssVar,
33
+ label: label ?? cssVar.replace(/^--/, ""),
34
+ value: style.getPropertyValue(cssVar).trim()
35
+ }))
36
+ };
37
+ } finally {
38
+ probe.remove();
39
+ }
40
+ });
41
+ }
42
+ /**
43
+ * The value as a paintable color, or null. shadcn-style themes store bare HSL
44
+ * channels (`222 47% 11%`), which paint once wrapped in `hsl()`.
45
+ */
46
+ function tokenColor(value) {
47
+ if (!value || typeof CSS === "undefined" || typeof CSS.supports !== "function") return null;
48
+ if (CSS.supports("color", value)) return value;
49
+ const hsl = `hsl(${value})`;
50
+ return CSS.supports("color", hsl) ? hsl : null;
51
+ }
52
+ /**
53
+ * Calls `onChange` whenever the host's resolved tokens may have changed: a
54
+ * theme class or attribute flips on `<html>` or `<body>`, a stylesheet is
55
+ * added or removed (HMR), or the OS color scheme changes.
56
+ */
57
+ function watchTokens(onChange, doc = document) {
58
+ const observer = new MutationObserver((records) => {
59
+ if (records.some((record) => record.type === "attributes" || [...record.addedNodes, ...record.removedNodes].some((node) => node.nodeName === "STYLE" || node.nodeName === "LINK"))) onChange();
60
+ });
61
+ observer.observe(doc.documentElement, { attributes: true });
62
+ observer.observe(doc.head, { childList: true });
63
+ observer.observe(doc.body, { attributes: true });
64
+ const media = doc.defaultView?.matchMedia?.("(prefers-color-scheme: dark)");
65
+ media?.addEventListener("change", onChange);
66
+ return () => {
67
+ observer.disconnect();
68
+ media?.removeEventListener("change", onChange);
69
+ };
70
+ }
71
+ //#endregion
72
+ //#region src/plugins/design/tokens-panel.tsx
73
+ /**
74
+ * Live design-token swatches. Values are read from the host document (see
75
+ * `readTokens`), re-read when the host's theme changes, and painted as
76
+ * resolved literals. Click copies `var(<token>)`.
77
+ */
78
+ function TokensPanel({ adapter }) {
79
+ const [groups, setGroups] = useState(() => readTokens(adapter));
80
+ const [copied, setCopied] = useState(null);
81
+ const refresh = useCallback(() => setGroups(readTokens(adapter)), [adapter]);
82
+ useEffect(() => {
83
+ refresh();
84
+ return watchTokens(refresh);
85
+ }, [refresh]);
86
+ useEffect(() => {
87
+ if (copied === null) return;
88
+ const timer = window.setTimeout(() => setCopied(null), 1200);
89
+ return () => window.clearTimeout(timer);
90
+ }, [copied]);
91
+ const copy = (cssVar) => {
92
+ navigator.clipboard?.writeText(`var(${cssVar})`).catch(() => {});
93
+ setCopied(cssVar);
94
+ };
95
+ return /* @__PURE__ */ jsxs("div", {
96
+ className: "design",
97
+ children: [
98
+ /* @__PURE__ */ jsx("style", { children: DESIGN_CSS }),
99
+ groups.map((group) => /* @__PURE__ */ jsxs("section", {
100
+ className: "design-section",
101
+ "aria-label": group.label,
102
+ children: [/* @__PURE__ */ jsxs("div", {
103
+ className: "design-heading",
104
+ children: [/* @__PURE__ */ jsx("span", { children: group.label }), /* @__PURE__ */ jsx("button", {
105
+ type: "button",
106
+ className: "design-link",
107
+ onClick: refresh,
108
+ children: "refresh"
109
+ })]
110
+ }), /* @__PURE__ */ jsx("div", {
111
+ className: "design-swatches",
112
+ children: group.tokens.map((token) => {
113
+ const color = tokenColor(token.value);
114
+ return /* @__PURE__ */ jsxs("button", {
115
+ type: "button",
116
+ className: "design-swatch",
117
+ title: `var(${token.cssVar}) = ${token.value || "unset"} (click to copy)`,
118
+ onClick: () => copy(token.cssVar),
119
+ children: [/* @__PURE__ */ jsx("span", {
120
+ className: "design-chip",
121
+ "data-token-chip": token.cssVar,
122
+ style: color ? { background: color } : void 0
123
+ }), /* @__PURE__ */ jsxs("span", {
124
+ className: "design-swatch-text",
125
+ children: [/* @__PURE__ */ jsx("span", { children: copied === token.cssVar ? "copied" : token.label }), /* @__PURE__ */ jsx("span", {
126
+ className: "design-muted",
127
+ children: token.value || "unset"
128
+ })]
129
+ })]
130
+ }, token.cssVar);
131
+ })
132
+ })]
133
+ }, group.label)),
134
+ adapter.sourceHint && /* @__PURE__ */ jsx("p", {
135
+ className: "design-hint design-mono",
136
+ children: adapter.sourceHint
137
+ })
138
+ ]
139
+ });
140
+ }
141
+ //#endregion
142
+ export { TokensPanel, TokensPanel as default };
@@ -0,0 +1,8 @@
1
+ //#region src/plugins/ops/types.ts
2
+ const TELEMETRY_RANGES = [
3
+ "1h",
4
+ "24h",
5
+ "7d"
6
+ ];
7
+ //#endregion
8
+ export { TELEMETRY_RANGES as t };