@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.
- package/README.md +634 -12
- package/dist/a11y-B5DUaiCs.js +246 -0
- package/dist/a11y-panel-p_t4eD7p.js +207 -0
- package/dist/{capabilities-CjulXFQX.js → access-C7zlaqj6.js} +1 -90
- package/dist/{access-CNvJOwKM.d.ts → access-D_ewAEJG.d.ts} +11 -4
- package/dist/access-panel-CEfTr9ZI.js +123 -0
- package/dist/adapter-BYoxPYTI.d.ts +33 -0
- package/dist/adapter-hcwmJtNx.js +65 -0
- package/dist/auto/runtime.d.ts +65 -0
- package/dist/auto/runtime.js +50 -0
- package/dist/auto.d.ts +15 -0
- package/dist/auto.js +33 -0
- package/dist/capabilities-rDSKjXpq.js +110 -0
- package/dist/capture-CwrIwLqi.js +300 -0
- package/dist/capture-buffer-Bbbo6omF.d.ts +35 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +275 -0
- package/dist/data-panel-DhxAmP91.js +817 -0
- package/dist/data-store-ChF1td_P.js +164 -0
- package/dist/define-hud-CHPedaQ5.d.ts +50 -0
- package/dist/design-D0kGgPoP.js +87 -0
- package/dist/detect-BxHZ0pxW.d.ts +25 -0
- package/dist/detect-CHZiSeZs.js +63 -0
- package/dist/dispatch-panel-B-xr_Giy.js +279 -0
- package/dist/{env-vEjyJfPW.d.ts → env-CApnbI0r.d.ts} +2 -0
- package/dist/{env-DfxpPfs9.js → env-CaiFPIhF.js} +3 -0
- package/dist/file-xdSaQ2uR.js +103 -0
- package/dist/flags-DVtaJ8pQ.d.ts +58 -0
- package/dist/flags.d.ts +2 -0
- package/dist/flags.js +82 -0
- package/dist/force-state-panel-_otVYh9i.js +97 -0
- package/dist/generate-C8lQl3Eh.js +53 -0
- package/dist/handler-BpVhxEmU.js +106 -0
- package/dist/{handler-WmE4Lu7l.d.ts → handler-DtYVCZY6.d.ts} +1 -1
- package/dist/index-BAV_1W8a.d.ts +43 -0
- package/dist/index-BJ26pse9.d.ts +70 -0
- package/dist/index-BnQ0dTZf.d.ts +19 -0
- package/dist/index-CwfX-W87.d.ts +72 -0
- package/dist/index-DcH9V3cU.d.ts +48 -0
- package/dist/index-DqOyNf1u.d.ts +65 -0
- package/dist/index-DstI_ike.d.ts +66 -0
- package/dist/index-Dxz4fn4j.d.ts +42 -0
- package/dist/index-Hhh7OXzU.d.ts +129 -0
- package/dist/index-ReFbhQ9p.d.ts +25 -0
- package/dist/index-RgXfMBuW.d.ts +48 -0
- package/dist/{index-BYsdS-7d.d.ts → index-gCZBO53s.d.ts} +21 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +710 -69
- package/dist/inspect-C9Ft8fqn.js +142 -0
- package/dist/inspect-root-BkaupBMp.js +429 -0
- package/dist/meta-Bv0sEao3.js +6 -0
- package/dist/meta-C_G7MB5w.d.ts +49 -0
- package/dist/mocks-CA-wM2SB.d.ts +109 -0
- package/dist/mocks-ESiRqk9o.js +150 -0
- package/dist/msw-browser-wjaYgkB7.d.ts +31 -0
- package/dist/next/config.cjs +201 -0
- package/dist/next/config.d.cts +87 -0
- package/dist/next/config.d.ts +64 -0
- package/dist/next/config.js +84 -0
- package/dist/next.d.ts +14 -4
- package/dist/next.js +5 -3
- package/dist/observe-CdDnDBRP.js +89 -0
- package/dist/observe-panel-Cgp1M8oT.js +347 -0
- package/dist/ops-panel-CEqDe_UT.js +234 -0
- package/dist/{payload-CLKDVZWl.d.ts → payload-MUQ9ciER.d.ts} +25 -1
- package/dist/plugins/a11y.d.ts +2 -0
- package/dist/plugins/a11y.js +2 -0
- package/dist/plugins/access/server.d.ts +5 -5
- package/dist/plugins/access/server.js +4 -3
- package/dist/plugins/access.d.ts +5 -5
- package/dist/plugins/access.js +16 -215
- package/dist/plugins/agent/server.d.ts +3 -38
- package/dist/plugins/agent/server.js +47 -21
- package/dist/plugins/agent.d.ts +4 -4
- package/dist/plugins/agent.js +6 -348
- package/dist/plugins/capture/server.d.ts +92 -0
- package/dist/plugins/capture/server.js +248 -0
- package/dist/plugins/capture.d.ts +24 -0
- package/dist/plugins/capture.js +70 -0
- package/dist/plugins/data/msw-browser.d.ts +2 -0
- package/dist/plugins/data/msw-browser.js +39 -0
- package/dist/plugins/data/msw-node.d.ts +36 -0
- package/dist/plugins/data/msw-node.js +68 -0
- package/dist/plugins/data/server.d.ts +257 -0
- package/dist/plugins/data/server.js +717 -0
- package/dist/plugins/data.d.ts +6 -0
- package/dist/plugins/data.js +51 -0
- package/dist/plugins/design/server.d.ts +54 -0
- package/dist/plugins/design/server.js +198 -0
- package/dist/plugins/design.d.ts +4 -124
- package/dist/plugins/design.js +4 -619
- package/dist/plugins/inspect/convex.d.ts +2 -0
- package/dist/plugins/inspect/convex.js +486 -0
- package/dist/plugins/inspect/react-query.d.ts +2 -0
- package/dist/plugins/inspect/react-query.js +237 -0
- package/dist/plugins/inspect/sockets.d.ts +51 -0
- package/dist/plugins/inspect/sockets.js +397 -0
- package/dist/plugins/inspect/swr.d.ts +2 -0
- package/dist/plugins/inspect/swr.js +218 -0
- package/dist/plugins/inspect.d.ts +4 -0
- package/dist/plugins/inspect.js +3 -0
- package/dist/plugins/observe.d.ts +4 -64
- package/dist/plugins/observe.js +1 -616
- package/dist/plugins/ops/server.d.ts +1 -1
- package/dist/plugins/ops/server.js +2 -1
- package/dist/plugins/ops.d.ts +2 -1
- package/dist/plugins/ops.js +15 -336
- package/dist/plugins/routes/server.d.ts +88 -0
- package/dist/plugins/routes/server.js +62 -0
- package/dist/plugins/routes.d.ts +3 -0
- package/dist/plugins/routes.js +216 -0
- package/dist/plugins/seo.d.ts +2 -0
- package/dist/plugins/seo.js +2 -0
- package/dist/plugins/vitals.d.ts +2 -25
- package/dist/plugins/vitals.js +3 -2
- package/dist/{plugins-CQ_0w1ot.d.ts → plugins-BZvDqGx5.d.ts} +33 -3
- package/dist/poll-CjKsWZi8.js +89 -0
- package/dist/requests-BwD6MKEq.js +282 -0
- package/dist/requests-CJrUf465.d.ts +50 -0
- package/dist/review.js +2 -2
- package/dist/same-origin-BGet22CC.js +21 -0
- package/dist/scan-DzJNXqOk.js +165 -0
- package/dist/seo-Dq9q_QkO.js +551 -0
- package/dist/seo-panel-CfiY-TnT.js +124 -0
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -105
- package/dist/sessions-panel-COvhPAzv.js +98 -0
- package/dist/{shortcut-U6ftVY06.js → shortcut-s_mjGeU8.js} +1 -44
- package/dist/{types-QJUajwWq.js → state-CjjZPjPJ.js} +13 -8
- package/dist/store/convex.d.ts +33 -0
- package/dist/store/convex.js +52 -0
- package/dist/{vitals-panel-Dvc5dnR-.js → store-CQqIIKTc.js} +1 -29
- package/dist/store-Ync9eb1G.js +67 -0
- package/dist/store.d.ts +76 -0
- package/dist/store.js +188 -0
- package/dist/{styles--slk86ZQ.js → styles-BA8ueHoV.js} +13 -3
- package/dist/styles-DKU_P8MH.js +139 -0
- package/dist/styles-DPpDPmzi.js +68 -0
- package/dist/tokens-panel-CbMQfasZ.js +142 -0
- package/dist/types-B-ulf2Jp.js +8 -0
- package/dist/types-BIgGf-0C.d.ts +25 -0
- package/dist/types-BIkI-qN8.js +30 -0
- package/dist/{types-DADBRiGk.d.ts → types-Cxh4twqc.d.ts} +1 -1
- package/dist/types-DIdPfjtV.js +6 -0
- package/dist/types-DaJcsEjO.d.ts +44 -0
- package/dist/types-Dn68psVz.d.ts +118 -0
- package/dist/types-szkr2QOF.d.ts +39 -0
- package/dist/unlock-store-4V3vR4Eg.js +96 -0
- package/dist/variant-groups-TIfO3NIj.js +137 -0
- package/dist/variant-groups-aAIrcNK5.d.ts +36 -0
- package/dist/variants-panel-BDoSkwBJ.js +457 -0
- package/dist/variants-types-CcRf119M.d.ts +63 -0
- package/dist/variants.d.ts +43 -0
- package/dist/variants.js +83 -0
- package/dist/vitals-panel-BCmMUntW.js +30 -0
- package/dist/vite.d.ts +37 -0
- package/dist/vite.js +134 -0
- package/package.json +72 -5
- package/dist/define-hud-BBzsSl8b.d.ts +0 -36
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { n as HUD_HOST_TAG } from "./marker-uZYPOJ4M.js";
|
|
2
|
+
import { i as definePlugin } from "./plugins-DVy_vaYr.js";
|
|
3
|
+
import { lazy, useSyncExternalStore } from "react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/plugins/a11y/axe.ts
|
|
6
|
+
/** The axe-core release the default `axeUrl` fetches. */
|
|
7
|
+
const AXE_VERSION = "4.14.0";
|
|
8
|
+
const AXE_URL = `https://cdn.jsdelivr.net/npm/axe-core@${AXE_VERSION}/axe.min.js`;
|
|
9
|
+
const IMPACT_ORDER = [
|
|
10
|
+
"critical",
|
|
11
|
+
"serious",
|
|
12
|
+
"moderate",
|
|
13
|
+
"minor"
|
|
14
|
+
];
|
|
15
|
+
function isAxe(value) {
|
|
16
|
+
if (value === null || typeof value !== "object") return false;
|
|
17
|
+
return typeof value.run === "function";
|
|
18
|
+
}
|
|
19
|
+
/** Accepts a module namespace (`import("axe-core")`), its default export, or the axe object itself. */
|
|
20
|
+
function toAxe(loaded) {
|
|
21
|
+
if (isAxe(loaded)) return loaded;
|
|
22
|
+
const def = loaded?.default;
|
|
23
|
+
if (isAxe(def)) return def;
|
|
24
|
+
throw new Error("hud: the a11y loader did not resolve to axe-core (no `run` function)");
|
|
25
|
+
}
|
|
26
|
+
const SCRIPT_ATTR = "data-hud-axe";
|
|
27
|
+
/**
|
|
28
|
+
* Loads axe-core by appending a `<script>` to the host document and resolves
|
|
29
|
+
* the global it defines. A global that already exists (the app ships axe) is
|
|
30
|
+
* reused; a script already in flight is awaited, never duplicated.
|
|
31
|
+
*/
|
|
32
|
+
function loadAxeFromUrl(url, doc = document) {
|
|
33
|
+
const win = doc.defaultView;
|
|
34
|
+
if (win && isAxe(win.axe)) return Promise.resolve(win.axe);
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const settle = () => {
|
|
37
|
+
const axe = win?.axe;
|
|
38
|
+
if (isAxe(axe)) resolve(axe);
|
|
39
|
+
else reject(/* @__PURE__ */ new Error(`hud: ${url} loaded but defined no \`axe\` global`));
|
|
40
|
+
};
|
|
41
|
+
const existing = doc.head.querySelector(`script[${SCRIPT_ATTR}]`);
|
|
42
|
+
const script = existing ?? doc.createElement("script");
|
|
43
|
+
script.addEventListener("load", settle, { once: true });
|
|
44
|
+
script.addEventListener("error", () => reject(/* @__PURE__ */ new Error(`hud: could not load axe-core from ${url}`)), { once: true });
|
|
45
|
+
if (existing) return;
|
|
46
|
+
script.src = url;
|
|
47
|
+
script.async = true;
|
|
48
|
+
script.setAttribute(SCRIPT_ATTR, "");
|
|
49
|
+
doc.head.appendChild(script);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function impactRank(impact) {
|
|
53
|
+
const index = impact ? IMPACT_ORDER.indexOf(impact) : -1;
|
|
54
|
+
return index === -1 ? IMPACT_ORDER.length : index;
|
|
55
|
+
}
|
|
56
|
+
/** Flattens violations to findings, highest impact first; axe's order breaks ties. */
|
|
57
|
+
function toFindings(violations) {
|
|
58
|
+
return violations.flatMap((violation) => violation.nodes.map((node, index) => ({
|
|
59
|
+
key: `${violation.id}#${index}`,
|
|
60
|
+
rule: violation.id,
|
|
61
|
+
impact: violation.impact ?? null,
|
|
62
|
+
help: violation.help,
|
|
63
|
+
helpUrl: violation.helpUrl,
|
|
64
|
+
target: node.target,
|
|
65
|
+
html: node.html,
|
|
66
|
+
summary: node.failureSummary ?? violation.description
|
|
67
|
+
}))).sort((a, b) => impactRank(a.impact) - impactRank(b.impact));
|
|
68
|
+
}
|
|
69
|
+
function queryIn(root, selector) {
|
|
70
|
+
try {
|
|
71
|
+
return root.querySelector(selector);
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Resolves an axe target back to its element. A string hop selects in the
|
|
78
|
+
* current root; the root moves into an iframe's document or, for an array
|
|
79
|
+
* hop, through shadow roots.
|
|
80
|
+
*/
|
|
81
|
+
function resolveTarget(target, doc = document) {
|
|
82
|
+
let root = doc;
|
|
83
|
+
let element = null;
|
|
84
|
+
for (const hop of target) {
|
|
85
|
+
const selectors = typeof hop === "string" ? [hop] : hop;
|
|
86
|
+
for (const [index, selector] of selectors.entries()) {
|
|
87
|
+
if (index > 0) {
|
|
88
|
+
const shadow = element?.shadowRoot;
|
|
89
|
+
if (!shadow) return null;
|
|
90
|
+
root = shadow;
|
|
91
|
+
}
|
|
92
|
+
element = queryIn(root, selector);
|
|
93
|
+
if (!element) return null;
|
|
94
|
+
}
|
|
95
|
+
if (element instanceof HTMLIFrameElement) {
|
|
96
|
+
const inner = element.contentDocument;
|
|
97
|
+
if (!inner) return null;
|
|
98
|
+
root = inner;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return element;
|
|
102
|
+
}
|
|
103
|
+
/** Short selector for a finding row: the last hop of the target. */
|
|
104
|
+
function targetLabel(target) {
|
|
105
|
+
const last = target[target.length - 1];
|
|
106
|
+
if (last === void 0) return "";
|
|
107
|
+
return typeof last === "string" ? last : last[last.length - 1] ?? "";
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/plugins/a11y/store.ts
|
|
111
|
+
const NO_COUNTS = {
|
|
112
|
+
critical: 0,
|
|
113
|
+
serious: 0,
|
|
114
|
+
moderate: 0,
|
|
115
|
+
minor: 0
|
|
116
|
+
};
|
|
117
|
+
let snapshot = {
|
|
118
|
+
status: "idle",
|
|
119
|
+
findings: [],
|
|
120
|
+
counts: NO_COUNTS,
|
|
121
|
+
error: null,
|
|
122
|
+
ranAt: null
|
|
123
|
+
};
|
|
124
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
125
|
+
let axePromise = null;
|
|
126
|
+
let run = 0;
|
|
127
|
+
function set(next) {
|
|
128
|
+
snapshot = {
|
|
129
|
+
...snapshot,
|
|
130
|
+
...next
|
|
131
|
+
};
|
|
132
|
+
for (const listener of listeners) listener();
|
|
133
|
+
}
|
|
134
|
+
function count(findings) {
|
|
135
|
+
const counts = { ...NO_COUNTS };
|
|
136
|
+
for (const finding of findings) if (finding.impact) counts[finding.impact]++;
|
|
137
|
+
return counts;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Fetches axe-core on the first run, never earlier, and audits the document
|
|
141
|
+
* minus the HUD's own host. A run that is overtaken by a newer one discards
|
|
142
|
+
* its result.
|
|
143
|
+
*/
|
|
144
|
+
async function runAudit({ axeUrl = AXE_URL, load, runOptions } = {}) {
|
|
145
|
+
const id = ++run;
|
|
146
|
+
if (!axePromise) {
|
|
147
|
+
set({
|
|
148
|
+
status: "loading",
|
|
149
|
+
error: null
|
|
150
|
+
});
|
|
151
|
+
axePromise = load ? load().then(toAxe) : loadAxeFromUrl(axeUrl);
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
const axe = await axePromise;
|
|
155
|
+
if (id !== run) return;
|
|
156
|
+
set({
|
|
157
|
+
status: "running",
|
|
158
|
+
error: null
|
|
159
|
+
});
|
|
160
|
+
const results = await axe.run({ exclude: [[HUD_HOST_TAG]] }, { ...runOptions });
|
|
161
|
+
if (id !== run) return;
|
|
162
|
+
const findings = toFindings(results.violations);
|
|
163
|
+
set({
|
|
164
|
+
status: "done",
|
|
165
|
+
findings,
|
|
166
|
+
counts: count(findings),
|
|
167
|
+
ranAt: Date.now()
|
|
168
|
+
});
|
|
169
|
+
} catch (error) {
|
|
170
|
+
if (id !== run) return;
|
|
171
|
+
if (snapshot.status === "loading") axePromise = null;
|
|
172
|
+
set({
|
|
173
|
+
status: "error",
|
|
174
|
+
error: error instanceof Error ? error.message : String(error)
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function getA11y() {
|
|
179
|
+
return snapshot;
|
|
180
|
+
}
|
|
181
|
+
function subscribeA11y(listener) {
|
|
182
|
+
listeners.add(listener);
|
|
183
|
+
return () => listeners.delete(listener);
|
|
184
|
+
}
|
|
185
|
+
function useA11y() {
|
|
186
|
+
return useSyncExternalStore(subscribeA11y, getA11y, getA11y);
|
|
187
|
+
}
|
|
188
|
+
/** Pill rating from the worst impact present. */
|
|
189
|
+
function worstImpact(counts) {
|
|
190
|
+
return IMPACT_ORDER.find((impact) => counts[impact] > 0) ?? null;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/plugins/a11y/pill.ts
|
|
194
|
+
/** Short text for the pill: the finding count once a run finished, an ellipsis meanwhile. */
|
|
195
|
+
function pillText({ status, findings }) {
|
|
196
|
+
if (status === "loading" || status === "running") return "A11y …";
|
|
197
|
+
if (status !== "done") return "A11y";
|
|
198
|
+
return `A11y ${findings.length}`;
|
|
199
|
+
}
|
|
200
|
+
function pillRating(snapshot) {
|
|
201
|
+
if (snapshot.status !== "done") return void 0;
|
|
202
|
+
const worst = worstImpact(snapshot.counts);
|
|
203
|
+
if (!worst) return "good";
|
|
204
|
+
return worst === "critical" || worst === "serious" ? "poor" : "needs-improvement";
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/plugins/a11y/index.tsx
|
|
208
|
+
const A11yPanel = lazy(() => import("./a11y-panel-p_t4eD7p.js"));
|
|
209
|
+
/**
|
|
210
|
+
* On-demand axe-core audit. Nothing is fetched until Run: axe-core comes from
|
|
211
|
+
* `axeUrl` (jsDelivr, pinned) or your own `load` (`() => import("axe-core")`).
|
|
212
|
+
* Findings list by impact; clicking one outlines the element with the grabber
|
|
213
|
+
* overlay. Client only.
|
|
214
|
+
*/
|
|
215
|
+
function a11y(options = {}) {
|
|
216
|
+
function A11yPill() {
|
|
217
|
+
const snapshot = useA11y();
|
|
218
|
+
const rating = pillRating(snapshot);
|
|
219
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [rating && /* @__PURE__ */ jsx("span", {
|
|
220
|
+
className: "dot",
|
|
221
|
+
"data-rating": rating
|
|
222
|
+
}), pillText(snapshot)] });
|
|
223
|
+
}
|
|
224
|
+
function Panel({ ctx }) {
|
|
225
|
+
return /* @__PURE__ */ jsx(A11yPanel, {
|
|
226
|
+
ctx,
|
|
227
|
+
options
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return definePlugin({
|
|
231
|
+
id: "a11y",
|
|
232
|
+
title: "A11y",
|
|
233
|
+
pill: A11yPill,
|
|
234
|
+
panel: Panel,
|
|
235
|
+
commands: [{
|
|
236
|
+
id: "run",
|
|
237
|
+
title: "Run accessibility audit",
|
|
238
|
+
run: (ctx) => {
|
|
239
|
+
ctx.open();
|
|
240
|
+
runAudit(options);
|
|
241
|
+
}
|
|
242
|
+
}]
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
export { AXE_VERSION as a, targetLabel as c, AXE_URL as i, runAudit as n, IMPACT_ORDER as o, useA11y as r, resolveTarget as s, a11y as t };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { n as useGrab } from "./store-Ync9eb1G.js";
|
|
2
|
+
import { c as targetLabel, n as runAudit, o as IMPACT_ORDER, r as useA11y, s as resolveTarget } from "./a11y-B5DUaiCs.js";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/plugins/a11y/styles.ts
|
|
6
|
+
/**
|
|
7
|
+
* The a11y panel's styles. Rendered in the panel's own `<style>` inside the
|
|
8
|
+
* HUD's shadow root, so they ship only with this plugin and build on the
|
|
9
|
+
* shell's `--hud-*` tokens.
|
|
10
|
+
*/
|
|
11
|
+
const A11Y_CSS = `
|
|
12
|
+
.a11y { display: flex; flex-direction: column; gap: 8px; width: 396px; max-width: 100%; }
|
|
13
|
+
|
|
14
|
+
.a11y-toolbar { display: flex; align-items: center; gap: 8px; }
|
|
15
|
+
.hud .a11y-run {
|
|
16
|
+
padding: 2px 10px;
|
|
17
|
+
border: 1px solid var(--hud-border);
|
|
18
|
+
border-radius: 4px;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
}
|
|
21
|
+
.hud .a11y-run:hover:not(:disabled) { background: var(--hud-bg-subtle); }
|
|
22
|
+
.hud .a11y-run:disabled { opacity: 0.5; cursor: default; }
|
|
23
|
+
.a11y-summary { flex: 1; min-width: 0; color: var(--hud-fg-muted); }
|
|
24
|
+
.a11y-summary[data-level="error"] { color: var(--hud-poor); }
|
|
25
|
+
|
|
26
|
+
.a11y-list { max-height: 360px; overflow: auto; margin: 0; padding: 0; list-style: none; border: 1px solid var(--hud-border); border-radius: 4px; }
|
|
27
|
+
.a11y-impact {
|
|
28
|
+
position: sticky;
|
|
29
|
+
top: 0;
|
|
30
|
+
padding: 3px 8px;
|
|
31
|
+
background: var(--hud-bg-subtle);
|
|
32
|
+
font-size: 10px;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
letter-spacing: 0.06em;
|
|
35
|
+
text-transform: uppercase;
|
|
36
|
+
color: var(--hud-fg-muted);
|
|
37
|
+
}
|
|
38
|
+
.a11y-impact[data-impact="critical"], .a11y-impact[data-impact="serious"] { color: var(--hud-poor); }
|
|
39
|
+
.a11y-impact[data-impact="moderate"], .a11y-impact[data-impact="minor"] { color: var(--hud-warn); }
|
|
40
|
+
.a11y-row { display: flex; align-items: stretch; border-top: 1px solid var(--hud-border); }
|
|
41
|
+
.hud .a11y-finding {
|
|
42
|
+
flex: 1;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: 1px;
|
|
47
|
+
padding: 4px 8px;
|
|
48
|
+
text-align: left;
|
|
49
|
+
}
|
|
50
|
+
.hud .a11y-finding:hover { background: var(--hud-bg-subtle); }
|
|
51
|
+
.hud .a11y-finding[aria-pressed="true"] { background: var(--hud-bg-subtle); box-shadow: inset 2px 0 var(--hud-accent); }
|
|
52
|
+
.a11y-help { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
53
|
+
.a11y-meta { display: flex; gap: 8px; min-width: 0; font-family: var(--hud-mono); font-size: 10px; color: var(--hud-fg-muted); }
|
|
54
|
+
.a11y-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
55
|
+
.a11y-rule { flex-shrink: 0; }
|
|
56
|
+
.a11y-gone { color: var(--hud-warn); }
|
|
57
|
+
.hud .a11y-doc {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
padding: 0 8px;
|
|
61
|
+
color: var(--hud-fg-muted);
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
font-family: var(--hud-mono);
|
|
64
|
+
font-size: 11px;
|
|
65
|
+
}
|
|
66
|
+
.hud .a11y-doc:hover { color: var(--hud-accent); }
|
|
67
|
+
.a11y .empty { margin: 0; }
|
|
68
|
+
`;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/plugins/a11y/a11y-panel.tsx
|
|
71
|
+
function summary({ status, findings, counts, error, ranAt }) {
|
|
72
|
+
if (status === "idle") return "Fetches axe-core and audits the page, HUD excluded.";
|
|
73
|
+
if (status === "loading") return "Loading axe-core…";
|
|
74
|
+
if (status === "running") return "Auditing…";
|
|
75
|
+
if (status === "error") return error ?? "Audit failed";
|
|
76
|
+
const parts = IMPACT_ORDER.filter((impact) => counts[impact] > 0).map((impact) => `${counts[impact]} ${impact}`);
|
|
77
|
+
const at = ranAt ? new Date(ranAt).toLocaleTimeString(void 0, { hour12: false }) : "";
|
|
78
|
+
const head = findings.length === 1 ? "1 issue" : `${findings.length} issues`;
|
|
79
|
+
return [parts.length > 0 ? `${head}: ${parts.join(", ")}` : head, at].filter(Boolean).join(" · ");
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Run button, a summary line and the findings grouped by impact. A finding
|
|
83
|
+
* outlines its element with the grabber overlay; the outline follows the
|
|
84
|
+
* panel: closing it clears the outline.
|
|
85
|
+
*/
|
|
86
|
+
function A11yPanel({ ctx, options }) {
|
|
87
|
+
const snapshot = useA11y();
|
|
88
|
+
const { highlight } = useGrab(ctx.grab);
|
|
89
|
+
const [gone, setGone] = useState(null);
|
|
90
|
+
const own = useRef(null);
|
|
91
|
+
const activeKey = own.current && highlight?.element === own.current.element ? own.current.key : null;
|
|
92
|
+
useEffect(() => () => {
|
|
93
|
+
if (own.current && ctx.grab.getState().highlight?.element === own.current.element) ctx.grab.clearHighlight();
|
|
94
|
+
}, [ctx]);
|
|
95
|
+
const show = (finding) => {
|
|
96
|
+
const element = resolveTarget(finding.target);
|
|
97
|
+
if (!element) {
|
|
98
|
+
setGone(finding.key);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
setGone(null);
|
|
102
|
+
own.current = {
|
|
103
|
+
key: finding.key,
|
|
104
|
+
element
|
|
105
|
+
};
|
|
106
|
+
ctx.grab.highlight(element, `${finding.rule} · ${finding.impact ?? "n/a"}`);
|
|
107
|
+
};
|
|
108
|
+
const busy = snapshot.status === "loading" || snapshot.status === "running";
|
|
109
|
+
const groups = IMPACT_ORDER.map((impact) => ({
|
|
110
|
+
impact,
|
|
111
|
+
findings: snapshot.findings.filter((finding) => finding.impact === impact)
|
|
112
|
+
})).filter((group) => group.findings.length > 0);
|
|
113
|
+
const unrated = snapshot.findings.filter((finding) => finding.impact === null);
|
|
114
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
115
|
+
className: "a11y",
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ jsx("style", { children: A11Y_CSS }),
|
|
118
|
+
/* @__PURE__ */ jsxs("div", {
|
|
119
|
+
className: "a11y-toolbar",
|
|
120
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
className: "a11y-run",
|
|
123
|
+
disabled: busy,
|
|
124
|
+
onClick: () => void runAudit(options),
|
|
125
|
+
children: snapshot.status === "done" ? "Re-run" : "Run"
|
|
126
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
127
|
+
className: "a11y-summary",
|
|
128
|
+
role: "status",
|
|
129
|
+
"data-level": snapshot.status === "error" ? "error" : void 0,
|
|
130
|
+
children: summary(snapshot)
|
|
131
|
+
})]
|
|
132
|
+
}),
|
|
133
|
+
snapshot.status === "done" && snapshot.findings.length === 0 && /* @__PURE__ */ jsx("p", {
|
|
134
|
+
className: "empty",
|
|
135
|
+
children: "No violations. axe checks what it can see; test with a reader too."
|
|
136
|
+
}),
|
|
137
|
+
snapshot.findings.length > 0 && /* @__PURE__ */ jsxs("ul", {
|
|
138
|
+
className: "a11y-list",
|
|
139
|
+
"aria-label": "Accessibility findings",
|
|
140
|
+
children: [groups.map((group) => /* @__PURE__ */ jsx(Group, {
|
|
141
|
+
impact: group.impact,
|
|
142
|
+
findings: group.findings,
|
|
143
|
+
activeKey,
|
|
144
|
+
gone,
|
|
145
|
+
onShow: show
|
|
146
|
+
}, group.impact)), unrated.length > 0 && /* @__PURE__ */ jsx(Group, {
|
|
147
|
+
impact: null,
|
|
148
|
+
findings: unrated,
|
|
149
|
+
activeKey,
|
|
150
|
+
gone,
|
|
151
|
+
onShow: show
|
|
152
|
+
})]
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function Group({ impact, findings, activeKey, gone, onShow }) {
|
|
158
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("li", {
|
|
159
|
+
className: "a11y-impact",
|
|
160
|
+
"data-impact": impact ?? "none",
|
|
161
|
+
children: [
|
|
162
|
+
impact ?? "unrated",
|
|
163
|
+
" (",
|
|
164
|
+
findings.length,
|
|
165
|
+
")"
|
|
166
|
+
]
|
|
167
|
+
}), findings.map((finding) => {
|
|
168
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
169
|
+
className: "a11y-row",
|
|
170
|
+
"data-impact": finding.impact ?? "none",
|
|
171
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
172
|
+
type: "button",
|
|
173
|
+
className: "a11y-finding",
|
|
174
|
+
"aria-pressed": activeKey === finding.key,
|
|
175
|
+
title: finding.summary,
|
|
176
|
+
onClick: () => onShow(finding),
|
|
177
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
178
|
+
className: "a11y-help",
|
|
179
|
+
children: finding.help
|
|
180
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
181
|
+
className: "a11y-meta",
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ jsx("span", {
|
|
184
|
+
className: "a11y-rule",
|
|
185
|
+
children: finding.rule
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ jsx("span", { children: targetLabel(finding.target) }),
|
|
188
|
+
gone === finding.key && /* @__PURE__ */ jsx("span", {
|
|
189
|
+
className: "a11y-gone",
|
|
190
|
+
children: "element gone"
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
})]
|
|
194
|
+
}), /* @__PURE__ */ jsx("a", {
|
|
195
|
+
className: "a11y-doc",
|
|
196
|
+
href: finding.helpUrl,
|
|
197
|
+
target: "_blank",
|
|
198
|
+
rel: "noreferrer",
|
|
199
|
+
title: `${finding.rule}: rule documentation`,
|
|
200
|
+
"aria-label": `${finding.rule}: rule documentation`,
|
|
201
|
+
children: "?"
|
|
202
|
+
})]
|
|
203
|
+
}, finding.key);
|
|
204
|
+
})] });
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
export { A11yPanel, A11yPanel as default };
|
|
@@ -97,93 +97,4 @@ function hudUnlockCookieString(token, ttlMs) {
|
|
|
97
97
|
return token ? `${base}; Max-Age=${Math.floor(ttlMs / 1e3)}` : `${base}; Max-Age=0`;
|
|
98
98
|
}
|
|
99
99
|
//#endregion
|
|
100
|
-
|
|
101
|
-
/** The capability vocabulary of the default matrix. Development grants these and any other. */
|
|
102
|
-
const HUD_CAPABILITIES = [
|
|
103
|
-
"observe.app",
|
|
104
|
-
"observe.estate",
|
|
105
|
-
"cicd.read",
|
|
106
|
-
"cicd.trigger",
|
|
107
|
-
"inject.seed",
|
|
108
|
-
"mock.toggle",
|
|
109
|
-
"auth.impersonate",
|
|
110
|
-
"dispatch.local",
|
|
111
|
-
"dispatch.hermes",
|
|
112
|
-
"variants.switch",
|
|
113
|
-
"variants.vote",
|
|
114
|
-
"variants.generate",
|
|
115
|
-
"state.force"
|
|
116
|
-
];
|
|
117
|
-
/**
|
|
118
|
-
* The access plugin's own capability. The guard lets the unlock route through
|
|
119
|
-
* on every enabled tier, so it never needs a matrix entry; nothing else may use it.
|
|
120
|
-
*/
|
|
121
|
-
const ACCESS_UNLOCK_CAPABILITY = "access.unlock";
|
|
122
|
-
/**
|
|
123
|
-
* Default-deny capability matrix. Client filtering is convenience only: the
|
|
124
|
-
* guard re-checks every route against the same matrix server side.
|
|
125
|
-
* Staging's `auth.impersonate` is further flag-gated by the plugin that uses it.
|
|
126
|
-
*/
|
|
127
|
-
const CAPABILITY_MATRIX = {
|
|
128
|
-
development: HUD_CAPABILITIES,
|
|
129
|
-
staging: [
|
|
130
|
-
"observe.app",
|
|
131
|
-
"observe.estate",
|
|
132
|
-
"cicd.read",
|
|
133
|
-
"mock.toggle",
|
|
134
|
-
"auth.impersonate",
|
|
135
|
-
"variants.switch",
|
|
136
|
-
"variants.vote"
|
|
137
|
-
],
|
|
138
|
-
preview: [
|
|
139
|
-
"observe.app",
|
|
140
|
-
"observe.estate",
|
|
141
|
-
"cicd.read",
|
|
142
|
-
"mock.toggle",
|
|
143
|
-
"variants.switch",
|
|
144
|
-
"variants.vote"
|
|
145
|
-
],
|
|
146
|
-
production: [
|
|
147
|
-
"observe.app",
|
|
148
|
-
"observe.estate",
|
|
149
|
-
"cicd.read"
|
|
150
|
-
],
|
|
151
|
-
disabled: []
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* The default matrix with an app's tier lists swapped in. `access.unlock` is
|
|
155
|
-
* stripped from them: it is the guard's exemption, never a grant.
|
|
156
|
-
*/
|
|
157
|
-
function resolveMatrix(override = {}) {
|
|
158
|
-
const matrix = { ...CAPABILITY_MATRIX };
|
|
159
|
-
for (const [tier, list] of Object.entries(override)) if (list) matrix[tier] = list.filter((capability) => capability !== ACCESS_UNLOCK_CAPABILITY);
|
|
160
|
-
return matrix;
|
|
161
|
-
}
|
|
162
|
-
/** Core assumes development, so development grants every capability, listed or not. */
|
|
163
|
-
function hasCapability(env, capability, matrix = CAPABILITY_MATRIX) {
|
|
164
|
-
if (env === "disabled") return false;
|
|
165
|
-
if (env === "development") return true;
|
|
166
|
-
return matrix[env].includes(capability);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Whether the HUD exists at all. Outside development a deployed tier also
|
|
170
|
-
* needs its overlay to set `NEXT_PUBLIC_HUD_ENABLED=true`.
|
|
171
|
-
*/
|
|
172
|
-
function isHudVisible(env, enabled = process.env.NEXT_PUBLIC_HUD_ENABLED === "true") {
|
|
173
|
-
if (env === "disabled") return false;
|
|
174
|
-
if (env === "development") return true;
|
|
175
|
-
return enabled;
|
|
176
|
-
}
|
|
177
|
-
const ENVS = [
|
|
178
|
-
"development",
|
|
179
|
-
"preview",
|
|
180
|
-
"staging",
|
|
181
|
-
"production",
|
|
182
|
-
"disabled"
|
|
183
|
-
];
|
|
184
|
-
/** Narrows the loader's env string; anything unrecognised is treated as disabled. */
|
|
185
|
-
function toHudEnv(env) {
|
|
186
|
-
return ENVS.includes(env) ? env : "disabled";
|
|
187
|
-
}
|
|
188
|
-
//#endregion
|
|
189
|
-
export { isHudVisible as a, HUD_UNLOCK_COOKIE as c, hudUnlockTtlMs as d, readCookie as f, verifyHudUnlockToken as g, timingSafeEqual as h, hasCapability as i, hudRequiresUnlock as l, signHudUnlockToken as m, CAPABILITY_MATRIX as n, resolveMatrix as o, resolveHudAccess as p, HUD_CAPABILITIES as r, toHudEnv as s, ACCESS_UNLOCK_CAPABILITY as t, hudUnlockCookieString as u };
|
|
100
|
+
export { readCookie as a, timingSafeEqual as c, hudUnlockTtlMs as i, verifyHudUnlockToken as l, hudRequiresUnlock as n, resolveHudAccess as o, hudUnlockCookieString as r, signHudUnlockToken as s, HUD_UNLOCK_COOKIE as t };
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { r as HudCapability } from "./plugins-
|
|
2
|
-
import { t as HudEnv } from "./env-
|
|
1
|
+
import { r as HudCapability } from "./plugins-BZvDqGx5.js";
|
|
2
|
+
import { t as HudEnv } from "./env-CApnbI0r.js";
|
|
3
3
|
//#region src/plugins/access/capabilities.d.ts
|
|
4
4
|
/** The capability vocabulary of the default matrix. Development grants these and any other. */
|
|
5
|
-
declare const HUD_CAPABILITIES: readonly ["observe.app", "observe.estate", "cicd.read", "cicd.trigger", "inject.seed", "mock.toggle", "auth.impersonate", "dispatch.local", "dispatch.hermes", "variants.switch", "variants.vote", "variants.generate", "state.force"];
|
|
5
|
+
declare const HUD_CAPABILITIES: readonly ["observe.app", "observe.estate", "cicd.read", "cicd.trigger", "inject.seed", "mock.toggle", "auth.impersonate", "dispatch.local", "dispatch.hermes", "variants.switch", "variants.vote", "variants.generate", "state.force", "routes.read", "inspect.read", "data.read", "data.write", "capture.screenshot"];
|
|
6
|
+
/**
|
|
7
|
+
* Capabilities no production matrix may grant. `data.*` switches who the
|
|
8
|
+
* page is signed in as and what the app reads: on production that is a
|
|
9
|
+
* breach, not a tool, so `hasCapability` denies it there whatever an app's
|
|
10
|
+
* `matrix` says, and `resolveMatrix` strips it from a production override.
|
|
11
|
+
*/
|
|
12
|
+
declare function isProductionDenied(capability: HudCapability): boolean;
|
|
6
13
|
/**
|
|
7
14
|
* The access plugin's own capability. The guard lets the unlock route through
|
|
8
15
|
* on every enabled tier, so it never needs a matrix entry; nothing else may use it.
|
|
@@ -51,4 +58,4 @@ interface HudUnlockVerifyOptions {
|
|
|
51
58
|
}
|
|
52
59
|
declare function verifyHudUnlockToken(token: string | undefined, secret: string | undefined, env: HudEnv, options?: HudUnlockVerifyOptions): Promise<boolean>;
|
|
53
60
|
//#endregion
|
|
54
|
-
export { signHudUnlockToken as a, CAPABILITY_MATRIX as c, hasCapability as d, isHudVisible as f, resolveHudAccess as i, CapabilityMatrixOverride as l, HudAccess as n, verifyHudUnlockToken as o, hudRequiresUnlock as r, ACCESS_UNLOCK_CAPABILITY as s, HUD_UNLOCK_COOKIE as t, HUD_CAPABILITIES as u };
|
|
61
|
+
export { signHudUnlockToken as a, CAPABILITY_MATRIX as c, hasCapability as d, isHudVisible as f, resolveHudAccess as i, CapabilityMatrixOverride as l, HudAccess as n, verifyHudUnlockToken as o, isProductionDenied as p, hudRequiresUnlock as r, ACCESS_UNLOCK_CAPABILITY as s, HUD_UNLOCK_COOKIE as t, HUD_CAPABILITIES as u };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { i as hudUnlockTtlMs, o as resolveHudAccess } from "./access-C7zlaqj6.js";
|
|
2
|
+
import { n as useUnlockState, t as submitPassword } from "./unlock-store-4V3vR4Eg.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/plugins/access/access-panel.tsx
|
|
6
|
+
const ACCESS_TEXT = {
|
|
7
|
+
open: "open, no password",
|
|
8
|
+
password: "password",
|
|
9
|
+
flag: "password, observe-only",
|
|
10
|
+
denied: "disabled"
|
|
11
|
+
};
|
|
12
|
+
const field = {
|
|
13
|
+
flex: 1,
|
|
14
|
+
minWidth: 0,
|
|
15
|
+
padding: "3px 6px",
|
|
16
|
+
font: "inherit",
|
|
17
|
+
fontFamily: "var(--hud-mono)",
|
|
18
|
+
color: "var(--hud-fg)",
|
|
19
|
+
background: "var(--hud-bg-subtle)",
|
|
20
|
+
border: "1px solid var(--hud-border)",
|
|
21
|
+
borderRadius: 4
|
|
22
|
+
};
|
|
23
|
+
const button = {
|
|
24
|
+
padding: "3px 10px",
|
|
25
|
+
border: "1px solid var(--hud-border)",
|
|
26
|
+
borderRadius: 4
|
|
27
|
+
};
|
|
28
|
+
/** The panel a locked deployed HUD shows instead of every other plugin. Loaded on first open. */
|
|
29
|
+
function AccessPanel({ ctx, matrix }) {
|
|
30
|
+
const { env, status, error } = useUnlockState();
|
|
31
|
+
const [password, setPassword] = useState("");
|
|
32
|
+
const [submitting, setSubmitting] = useState(false);
|
|
33
|
+
const access = resolveHudAccess(env);
|
|
34
|
+
const ttlHours = hudUnlockTtlMs(access) / 36e5;
|
|
35
|
+
async function onSubmit(event) {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
if (!password || submitting) return;
|
|
38
|
+
setSubmitting(true);
|
|
39
|
+
const ok = await submitPassword(ctx.api, password);
|
|
40
|
+
setSubmitting(false);
|
|
41
|
+
if (ok) setPassword("");
|
|
42
|
+
}
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
44
|
+
style: {
|
|
45
|
+
display: "grid",
|
|
46
|
+
gap: 8
|
|
47
|
+
},
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
50
|
+
/* @__PURE__ */ jsx("strong", { children: env }),
|
|
51
|
+
" ",
|
|
52
|
+
/* @__PURE__ */ jsxs("span", {
|
|
53
|
+
className: "empty",
|
|
54
|
+
children: ["· ", ACCESS_TEXT[access]]
|
|
55
|
+
})
|
|
56
|
+
] }),
|
|
57
|
+
status === "unconfigured" && /* @__PURE__ */ jsx("p", {
|
|
58
|
+
className: "empty",
|
|
59
|
+
style: { margin: 0 },
|
|
60
|
+
children: "No unlock password is configured on this deployment's server, so the HUD cannot be unlocked here."
|
|
61
|
+
}),
|
|
62
|
+
status !== "unconfigured" && access !== "open" && status !== "unlocked" && /* @__PURE__ */ jsxs("form", {
|
|
63
|
+
style: {
|
|
64
|
+
display: "flex",
|
|
65
|
+
gap: 6
|
|
66
|
+
},
|
|
67
|
+
onSubmit,
|
|
68
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
69
|
+
type: "password",
|
|
70
|
+
autoComplete: "off",
|
|
71
|
+
value: password,
|
|
72
|
+
onChange: (event) => setPassword(event.target.value),
|
|
73
|
+
placeholder: "hud password",
|
|
74
|
+
"aria-label": "hud password",
|
|
75
|
+
style: field
|
|
76
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
77
|
+
type: "submit",
|
|
78
|
+
style: button,
|
|
79
|
+
disabled: !password || submitting,
|
|
80
|
+
children: submitting ? "Checking…" : "Unlock"
|
|
81
|
+
})]
|
|
82
|
+
}),
|
|
83
|
+
error && /* @__PURE__ */ jsx("p", {
|
|
84
|
+
role: "alert",
|
|
85
|
+
style: {
|
|
86
|
+
margin: 0,
|
|
87
|
+
color: "var(--hud-poor)"
|
|
88
|
+
},
|
|
89
|
+
children: error
|
|
90
|
+
}),
|
|
91
|
+
access !== "open" && status === "unlocked" && /* @__PURE__ */ jsxs("p", {
|
|
92
|
+
className: "empty",
|
|
93
|
+
style: { margin: 0 },
|
|
94
|
+
children: [
|
|
95
|
+
"Unlocked for up to ",
|
|
96
|
+
ttlHours,
|
|
97
|
+
" h."
|
|
98
|
+
]
|
|
99
|
+
}),
|
|
100
|
+
access !== "open" && status !== "unlocked" && ttlHours > 0 && /* @__PURE__ */ jsxs("p", {
|
|
101
|
+
className: "empty",
|
|
102
|
+
style: { margin: 0 },
|
|
103
|
+
children: [
|
|
104
|
+
"An unlock lasts ",
|
|
105
|
+
ttlHours,
|
|
106
|
+
" h."
|
|
107
|
+
]
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
110
|
+
className: "empty",
|
|
111
|
+
children: "Capabilities"
|
|
112
|
+
}), /* @__PURE__ */ jsx("code", {
|
|
113
|
+
style: {
|
|
114
|
+
fontFamily: "var(--hud-mono)",
|
|
115
|
+
whiteSpace: "pre-wrap"
|
|
116
|
+
},
|
|
117
|
+
children: env === "development" ? "all" : matrix[env].join("\n") || "none"
|
|
118
|
+
})] })
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
export { AccessPanel as default };
|