@hansenexus/hud 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +64 -14
  2. package/dist/{a11y-B5DUaiCs.js → a11y-BGWw4jBr.js} +14 -2
  3. package/dist/{a11y-panel-p_t4eD7p.js → a11y-panel-DcfXnPHk.js} +1 -1
  4. package/dist/{access-D_ewAEJG.d.ts → access-Bc709qpl.d.ts} +1 -1
  5. package/dist/{access-panel-CEfTr9ZI.js → access-panel-grAsMEDk.js} +1 -1
  6. package/dist/auto/runtime.d.ts +9 -9
  7. package/dist/auto.d.ts +2 -2
  8. package/dist/auto.js +5 -5
  9. package/dist/{data-panel-BmcHCQnM.js → data-panel-B6WPNmV6.js} +1 -1
  10. package/dist/{data-store-ChF1td_P.js → data-store-FNTQKMkG.js} +1 -1
  11. package/dist/{define-hud-CHPedaQ5.d.ts → define-hud-DTv3njuU.d.ts} +15 -5
  12. package/dist/{design-D0kGgPoP.js → design-BXG1a4we.js} +21 -5
  13. package/dist/{dispatch-panel-B-xr_Giy.js → dispatch-panel-BDHgMhOk.js} +1 -1
  14. package/dist/{force-state-panel-_otVYh9i.js → force-state-panel-mu-txJnA.js} +1 -1
  15. package/dist/{handler-BpVhxEmU.js → handler-BKzaOhlJ.js} +1 -1
  16. package/dist/{handler-DtYVCZY6.d.ts → handler-DMzSTqyG.d.ts} +1 -1
  17. package/dist/icons-ByDyNq_E.js +71 -0
  18. package/dist/{index-BnQ0dTZf.d.ts → index-B1vHAY9p.d.ts} +2 -1
  19. package/dist/{index-DstI_ike.d.ts → index-BJJoAXJ2.d.ts} +5 -1
  20. package/dist/{index-BAV_1W8a.d.ts → index-BNoPbSYD.d.ts} +3 -1
  21. package/dist/{index-CwfX-W87.d.ts → index-BR5OB7DO.d.ts} +3 -0
  22. package/dist/index-C3wzZS3o.d.ts +116 -0
  23. package/dist/{index-DcH9V3cU.d.ts → index-CQXiuMZQ.d.ts} +3 -0
  24. package/dist/{index-Hhh7OXzU.d.ts → index-Caohnz3B.d.ts} +7 -1
  25. package/dist/{index-ReFbhQ9p.d.ts → index-D-hI-DRJ.d.ts} +5 -0
  26. package/dist/{index-DqOyNf1u.d.ts → index-DLCSLWW4.d.ts} +4 -2
  27. package/dist/index.d.ts +4 -4
  28. package/dist/index.js +1194 -73
  29. package/dist/{inspect-C9Ft8fqn.js → inspect-CSkm8tn3.js} +14 -2
  30. package/dist/{inspect-root-BkaupBMp.js → inspect-root-CmiFX0e5.js} +1 -1
  31. package/dist/next.d.ts +1 -1
  32. package/dist/{observe-CdDnDBRP.js → observe-CBNLU148.js} +12 -2
  33. package/dist/{observe-panel-Cgp1M8oT.js → observe-panel-zU5LD-U9.js} +1 -1
  34. package/dist/{ops-panel-CEqDe_UT.js → ops-panel-DHhAnChL.js} +1 -1
  35. package/dist/plugins/a11y.d.ts +1 -1
  36. package/dist/plugins/a11y.js +1 -1
  37. package/dist/plugins/access/server.d.ts +3 -3
  38. package/dist/plugins/access/server.js +1 -1
  39. package/dist/plugins/access.d.ts +5 -2
  40. package/dist/plugins/access.js +18 -5
  41. package/dist/plugins/agent/server.js +1 -1
  42. package/dist/plugins/agent.d.ts +4 -2
  43. package/dist/plugins/agent.js +6 -3
  44. package/dist/plugins/capture/server.js +1 -1
  45. package/dist/plugins/capture.d.ts +2 -2
  46. package/dist/plugins/capture.js +1 -1
  47. package/dist/plugins/data/server.d.ts +1 -1
  48. package/dist/plugins/data/server.js +1 -1
  49. package/dist/plugins/data.d.ts +1 -1
  50. package/dist/plugins/data.js +30 -9
  51. package/dist/plugins/design/server.d.ts +1 -1
  52. package/dist/plugins/design/server.js +1 -1
  53. package/dist/plugins/design.d.ts +1 -1
  54. package/dist/plugins/design.js +1 -1
  55. package/dist/plugins/inspect.d.ts +1 -1
  56. package/dist/plugins/inspect.js +1 -1
  57. package/dist/plugins/observe.d.ts +1 -1
  58. package/dist/plugins/observe.js +1 -1
  59. package/dist/plugins/ops/server.d.ts +1 -1
  60. package/dist/plugins/ops/server.js +1 -1
  61. package/dist/plugins/ops.d.ts +5 -1
  62. package/dist/plugins/ops.js +16 -4
  63. package/dist/plugins/routes/server.js +1 -1
  64. package/dist/plugins/routes.d.ts +1 -1
  65. package/dist/plugins/routes.js +3 -1
  66. package/dist/plugins/seo.d.ts +1 -1
  67. package/dist/plugins/seo.js +1 -1
  68. package/dist/plugins/vitals.d.ts +1 -1
  69. package/dist/plugins/vitals.js +9 -1
  70. package/dist/{plugins-BZvDqGx5.d.ts → plugins-BZT-1LBe.d.ts} +32 -3
  71. package/dist/{plugins-DVy_vaYr.js → plugins-CcW_K7c2.js} +9 -1
  72. package/dist/{poll-CjKsWZi8.js → poll-Dm0OijM4.js} +1 -1
  73. package/dist/{seo-Dq9q_QkO.js → seo-BnnGq_vj.js} +13 -2
  74. package/dist/{seo-panel-CfiY-TnT.js → seo-panel-BThx56KM.js} +1 -1
  75. package/dist/server.d.ts +2 -2
  76. package/dist/server.js +2 -2
  77. package/dist/{sessions-panel-COvhPAzv.js → sessions-panel-MknKsTge.js} +1 -1
  78. package/dist/store.d.ts +1 -1
  79. package/dist/store.js +1 -1
  80. package/dist/{unlock-store-4V3vR4Eg.js → unlock-store-CrGXQx1V.js} +1 -1
  81. package/dist/{variants-panel-BDoSkwBJ.js → variants-panel-B6zWcknV.js} +1 -1
  82. package/dist/vite.d.ts +2 -2
  83. package/dist/vite.js +1 -1
  84. package/package.json +1 -1
  85. package/dist/index-gCZBO53s.d.ts +0 -73
@@ -68,6 +68,19 @@ interface HudPluginContext {
68
68
  interface HudPluginProps {
69
69
  ctx: HudPluginContext;
70
70
  }
71
+ /** Colour of a rail badge: the dot on the plugin's icon, or its count bubble. */
72
+ type HudBadgeTone = "good" | "warn" | "poor" | "off";
73
+ /** What a plugin's `badge` hook reports: a tone, and a count for a bubble instead of a dot. */
74
+ interface HudBadge {
75
+ tone: HudBadgeTone;
76
+ /** Shown as a number on the icon when above 0; the dot otherwise. */
77
+ count?: number;
78
+ }
79
+ /**
80
+ * Maps a vitals-style rating (`.dot[data-rating]`, what the built-in pills
81
+ * render) to a badge tone. `undefined` stays undefined: no rating yet.
82
+ */
83
+ declare function ratingTone(rating: "good" | "needs-improvement" | "poor" | undefined): HudBadgeTone | undefined;
71
84
  interface HudCommand {
72
85
  /** Unique within the plugin. */
73
86
  id: string;
@@ -108,12 +121,28 @@ interface HudPlugin {
108
121
  * loading state and contains a panel that fails.
109
122
  */
110
123
  panel?: ComponentType<HudPluginProps>;
111
- /** Live content inside the plugin's pill item. Keep it inline and non-interactive. */
124
+ /**
125
+ * Live content inside the plugin's pill item; on the rail it is the
126
+ * tooltip text beside the icon. Keep it inline and non-interactive.
127
+ */
112
128
  pill?: ComponentType<HudPluginProps>;
129
+ /**
130
+ * The rail's icon for this plugin: `hudIcon("database")` for a built-in
131
+ * shape, or any 24×24 SVG component. Without one the rail shows a plug.
132
+ */
133
+ icon?: ComponentType;
134
+ /**
135
+ * Status on the rail icon, called like a component (hooks are allowed):
136
+ * a 6 px dot in the badge's tone, or a count bubble when `count` is above
137
+ * 0. `null` shows nothing. The three highest-priority badges also make up
138
+ * the folded rail's summary dots.
139
+ */
140
+ badge?: (props: HudPluginProps) => HudBadge | null;
113
141
  /**
114
142
  * When the pill runs out of room, items with a higher priority stay visible
115
143
  * longest; the rest move into the pill menu. Above 0 the item also survives
116
- * compact mode. Default 0.
144
+ * compact mode. On the rail the three highest make the folded summary.
145
+ * Default 0.
117
146
  */
118
147
  pillPriority?: number;
119
148
  commands?: readonly HudCommand[];
@@ -141,4 +170,4 @@ declare class HudApiError extends Error {
141
170
  constructor(status: number, body: unknown, url: string);
142
171
  }
143
172
  //#endregion
144
- export { useGrab as _, HudHttpMethod as a, HudPluginProps as c, HudRoutes as d, PinEdge as f, HudHighlight as g, HudGrabState as h, HudCommand as i, HudRouteContext as l, HudGrab as m, HudApiError as n, HudPlugin as o, definePlugin as p, HudCapability as r, HudPluginContext as s, HudAccessControl as t, HudRouteHandler as u };
173
+ export { HudGrab as _, HudCapability as a, useGrab as b, HudPlugin as c, HudRouteContext as d, HudRouteHandler as f, ratingTone as g, definePlugin as h, HudBadgeTone as i, HudPluginContext as l, PinEdge as m, HudApiError as n, HudCommand as o, HudRoutes as p, HudBadge as r, HudHttpMethod as s, HudAccessControl as t, HudPluginProps as u, HudGrabState as v, HudHighlight as y };
@@ -1,4 +1,12 @@
1
1
  //#region src/core/plugins.ts
2
+ /**
3
+ * Maps a vitals-style rating (`.dot[data-rating]`, what the built-in pills
4
+ * render) to a badge tone. `undefined` stays undefined: no rating yet.
5
+ */
6
+ function ratingTone(rating) {
7
+ if (rating === "needs-improvement") return "warn";
8
+ return rating;
9
+ }
2
10
  const HUD_HTTP_METHODS = [
3
11
  "GET",
4
12
  "POST",
@@ -67,4 +75,4 @@ function parseBody(text) {
67
75
  }
68
76
  }
69
77
  //#endregion
70
- export { resolvePlugins as a, definePlugin as i, HudApiError as n, createPluginContext as r, HUD_HTTP_METHODS as t };
78
+ export { ratingTone as a, definePlugin as i, HudApiError as n, resolvePlugins as o, createPluginContext as r, HUD_HTTP_METHODS as t };
@@ -1,4 +1,4 @@
1
- import { n as HudApiError } from "./plugins-DVy_vaYr.js";
1
+ import { n as HudApiError } from "./plugins-CcW_K7c2.js";
2
2
  import { useCallback, useSyncExternalStore } from "react";
3
3
  //#region src/plugins/ops/poll.ts
4
4
  /** Entries per plugin context, so the pill and the panel share one poller per path. */
@@ -1,4 +1,5 @@
1
- import { i as definePlugin } from "./plugins-DVy_vaYr.js";
1
+ import { i as hudIcon } from "./icons-ByDyNq_E.js";
2
+ import { i as definePlugin } from "./plugins-CcW_K7c2.js";
2
3
  import { lazy, useEffect, useSyncExternalStore } from "react";
3
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
5
  //#region src/plugins/seo/pill.ts
@@ -519,7 +520,7 @@ function useSeo() {
519
520
  }
520
521
  //#endregion
521
522
  //#region src/plugins/seo/index.tsx
522
- const SeoPanel = lazy(() => import("./seo-panel-CfiY-TnT.js"));
523
+ const SeoPanel = lazy(() => import("./seo-panel-BThx56KM.js"));
523
524
  /**
524
525
  * Checks the page's title, description, canonical, Open Graph, JSON-LD,
525
526
  * hreflang and robots meta, from mount on and again whenever `<head>` changes.
@@ -535,9 +536,19 @@ function seo() {
535
536
  "data-rating": rating
536
537
  }), pillText(snapshot)] });
537
538
  }
539
+ function useSeoBadge() {
540
+ const { errors, checkedAt } = useSeo();
541
+ if (checkedAt === null) return null;
542
+ return errors > 0 ? {
543
+ tone: "poor",
544
+ count: errors
545
+ } : { tone: "good" };
546
+ }
538
547
  return definePlugin({
539
548
  id: "seo",
540
549
  title: "SEO",
550
+ icon: hudIcon("search"),
551
+ badge: useSeoBadge,
541
552
  pill: SeoPill,
542
553
  panel: SeoPanel,
543
554
  commands: [{
@@ -1,4 +1,4 @@
1
- import { i as SEO_GROUPS, n as checkSeo, r as useSeo } from "./seo-Dq9q_QkO.js";
1
+ import { i as SEO_GROUPS, n as checkSeo, r as useSeo } from "./seo-BnnGq_vj.js";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  //#region src/plugins/seo/styles.ts
4
4
  /**
package/dist/server.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as HudHttpMethod, d as HudRoutes, l as HudRouteContext, o as HudPlugin, p as definePlugin, u as HudRouteHandler } from "./plugins-BZvDqGx5.js";
2
- import { a as createHudHandler, i as HudRequestHandler, n as HudHandler, o as developmentOnly, r as HudHandlerOptions, t as HudGuard } from "./handler-DtYVCZY6.js";
1
+ import { c as HudPlugin, d as HudRouteContext, f as HudRouteHandler, h as definePlugin, p as HudRoutes, s as HudHttpMethod } from "./plugins-BZT-1LBe.js";
2
+ import { a as createHudHandler, i as HudRequestHandler, n as HudHandler, o as developmentOnly, r as HudHandlerOptions, t as HudGuard } from "./handler-DMzSTqyG.js";
3
3
  export { type HudGuard, type HudHandler, type HudHandlerOptions, type HudHttpMethod, type HudPlugin, type HudRequestHandler, type HudRouteContext, type HudRouteHandler, type HudRoutes, createHudHandler, definePlugin, developmentOnly };
package/dist/server.js CHANGED
@@ -1,3 +1,3 @@
1
- import { i as definePlugin } from "./plugins-DVy_vaYr.js";
2
- import { n as developmentOnly, t as createHudHandler } from "./handler-BpVhxEmU.js";
1
+ import { i as definePlugin } from "./plugins-CcW_K7c2.js";
2
+ import { n as developmentOnly, t as createHudHandler } from "./handler-BKzaOhlJ.js";
3
3
  export { createHudHandler, definePlugin, developmentOnly };
@@ -1,4 +1,4 @@
1
- import { n as HudApiError } from "./plugins-DVy_vaYr.js";
1
+ import { n as HudApiError } from "./plugins-CcW_K7c2.js";
2
2
  import { t as AGENT_CSS } from "./styles-DPpDPmzi.js";
3
3
  import { useCallback, useEffect, useState } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
package/dist/store.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as HudRoutes, r as HudCapability } from "./plugins-BZvDqGx5.js";
1
+ import { a as HudCapability, p as HudRoutes } from "./plugins-BZT-1LBe.js";
2
2
  import { a as STORE_COLLECTION, c as assertId, i as HudStoreValue, l as assertValue, n as HudStoreEntry, o as STORE_ID, r as HudStoreError, s as assertCollection, t as HudStore, u as isStoreValue } from "./types-DaJcsEjO.js";
3
3
  //#region src/store/file.d.ts
4
4
  interface FileStoreOptions {
package/dist/store.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as definePlugin } from "./plugins-DVy_vaYr.js";
1
+ import { i as definePlugin } from "./plugins-CcW_K7c2.js";
2
2
  import { t as refuseCrossSite } from "./same-origin-BGet22CC.js";
3
3
  import { a as assertId, i as assertCollection, n as STORE_COLLECTION, o as assertValue, r as STORE_ID, s as isStoreValue, t as HudStoreError } from "./types-BIkI-qN8.js";
4
4
  import { t as file } from "./file-xdSaQ2uR.js";
@@ -1,4 +1,4 @@
1
- import { n as HudApiError } from "./plugins-DVy_vaYr.js";
1
+ import { n as HudApiError } from "./plugins-CcW_K7c2.js";
2
2
  import { n as hudRequiresUnlock, o as resolveHudAccess } from "./access-C7zlaqj6.js";
3
3
  import { c as toHudEnv } from "./capabilities-rDSKjXpq.js";
4
4
  import { useEffect, useSyncExternalStore } from "react";
@@ -1,4 +1,4 @@
1
- import { n as HudApiError } from "./plugins-DVy_vaYr.js";
1
+ import { n as HudApiError } from "./plugins-CcW_K7c2.js";
2
2
  import { a as getVariantGroupsSnapshot, c as subscribeVariantGroups, i as getVariantGroupStore, s as resolveVariant } from "./variant-groups-TIfO3NIj.js";
3
3
  import { t as DESIGN_CSS } from "./styles-DKU_P8MH.js";
4
4
  import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as HudPlugin } from "./plugins-BZvDqGx5.js";
2
- import { r as HudHandlerOptions, t as HudGuard } from "./handler-DtYVCZY6.js";
1
+ import { c as HudPlugin } from "./plugins-BZT-1LBe.js";
2
+ import { r as HudHandlerOptions, t as HudGuard } from "./handler-DMzSTqyG.js";
3
3
  import { Plugin } from "vite";
4
4
  //#region src/vite/index.d.ts
5
5
  export interface HudViteOptions extends HudHandlerOptions {
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createHudHandler } from "./handler-BpVhxEmU.js";
1
+ import { t as createHudHandler } from "./handler-BKzaOhlJ.js";
2
2
  import { n as detectHudAuto, r as parsePackageJson } from "./detect-CHZiSeZs.js";
3
3
  import { t as generateAutoModule } from "./generate-C8lQl3Eh.js";
4
4
  //#region src/vite/bridge.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hansenexus/hud",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
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",
@@ -1,73 +0,0 @@
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
21
- //#region src/core/grabber/picker.d.ts
22
- interface PickPoint {
23
- clientX: number;
24
- clientY: number;
25
- }
26
- interface ElementPickerProps {
27
- active: boolean;
28
- onPick: (element: Element, point: PickPoint) => void;
29
- onCancel: () => void;
30
- /** Banner text while active. */
31
- hint?: string;
32
- /** Label next to the hover outline. Default: the tag name. */
33
- describe?: (element: Element) => string;
34
- /** Extra elements to leave alone, on top of the picker's own shadow host. */
35
- ignore?: (element: Element) => boolean;
36
- }
37
- /**
38
- * Styles for the picker overlay. The picker renders where it is mounted, so
39
- * the caller puts these into the same (shadow) root. Colours fall back when
40
- * the `--hud-*` tokens are absent.
41
- */
42
- declare const PICKER_CSS = "\n.grab-layer { position: fixed; inset: 0; pointer-events: none; }\n.grab-hint {\n position: fixed;\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n padding: 3px 12px;\n border-radius: 0 0 6px 6px;\n white-space: nowrap;\n background: var(--hud-accent, #0369a1);\n color: var(--hud-accent-fg, #ffffff);\n font: 600 11px/1.5 var(--hud-mono, ui-monospace, monospace);\n}\n.grab-outline {\n position: fixed;\n border: 1.5px solid var(--hud-accent, #0369a1);\n background: color-mix(in srgb, var(--hud-accent, #0369a1) 8%, transparent);\n border-radius: 3px;\n}\n.grab-label {\n position: fixed;\n max-width: min(480px, calc(100vw - 8px));\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 1px 6px;\n border-radius: 3px;\n background: var(--hud-accent, #0369a1);\n color: var(--hud-accent-fg, #ffffff);\n font: 600 10px/1.6 var(--hud-mono, ui-monospace, monospace);\n}\n";
43
- /**
44
- * Click-to-pick controller: crosshair, hover outline with a label, the next
45
- * click picks, Escape cancels. Events inside the picker's own shadow host
46
- * (the HUD's pill and panels) pass through untouched, so panels stay usable
47
- * and mounted during a grab.
48
- */
49
- declare function ElementPicker({ active, onPick, onCancel, hint, describe, ignore }: ElementPickerProps): import("react").JSX.Element;
50
- //#endregion
51
- //#region src/shell/hud.d.ts
52
- interface HudProps {
53
- /** App slug: labels the pill and keys the persisted layout. */
54
- appSlug: string;
55
- /** Badge shown at the start of the pill. Default "DEV". */
56
- envLabel?: string;
57
- /** Client halves of the plugins, in pill order. Keep the array stable across renders. */
58
- plugins?: readonly HudPlugin[];
59
- /** Base path of the plugin routes. Default "/api/hud". */
60
- apiBase?: string;
61
- /** Capability check. Default: grant all (core assumes development). Keep it stable. */
62
- can?: (capability: HudCapability) => boolean;
63
- }
64
- /**
65
- * The HUD shell: a shadow-rooted status pill and floating panels.
66
- *
67
- * It renders unconditionally. Keeping it out of production builds is the
68
- * loader's job, at the import site, so a bundler can drop the whole module
69
- * (see `@hansenexus/hud/next`).
70
- */
71
- declare function Hud({ appSlug, envLabel, plugins, apiBase, can }: HudProps): import("react").JSX.Element;
72
- //#endregion
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 };