astralis-devtools 0.2.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to `astralis-devtools`.
4
4
 
5
+ ## 0.3.0 (2026-11-23)
6
+
7
+ Uses astralis-cli 0.8.0, so findings include `unknown-prop` and `unknown-state-prop` (astralis-ui 0.11.0).
8
+
9
+ ### Changed
10
+
11
+ - **A new page starts with the panel folded.** Reloading, or navigating to another page, minimises it to the launcher and ends picking. Reopening it returns to the same screen. A new query or hash, and a hot reload, leave it open.
12
+ - **Creating an issue clears the form** and opens Your issues, with a confirmation that links to it. The list is refreshed, and shows the new issue even while GitHub's own list catches up.
13
+ - **The Report buttons say what they do:** Create issue from here, and Open GitHub's form instead.
14
+ - An unsent report's words are kept when the page changes or reloads, for the browser tab.
15
+
16
+ ### Fixed
17
+
18
+ - A report cannot be sent twice, and the last words typed before sending are included.
19
+
5
20
  ## 0.2.0 (2026-11-21)
6
21
 
7
22
  Uses astralis-cli 0.6.0 and reads the prop descriptions astralis-ui 0.10.0 puts in its system spec.
package/README.md CHANGED
@@ -22,13 +22,15 @@ screens:
22
22
  you picked with their props, the versions in use, the validator's findings
23
23
  and a small reproduction. You see the exact JSON first, page text is
24
24
  replaced by placeholders unless you include it, and nothing is sent until
25
- you press Send. To add a screenshot or a file, open the issue on GitHub
26
- once it is created and drop it in there. **Your issues** lists the issues
27
- you have opened and where each stands.
25
+ you press **Create issue from here**, which creates it without leaving the
26
+ DevTools and shows it under **Your issues**, with the others you have opened
27
+ and where each stands. To add a screenshot or a file, open the issue on
28
+ GitHub and drop it in there. **Open GitHub's form instead** needs no sign-in.
28
29
 
29
30
  The minimize button in the panel's header, `Shift+Alt+A`, or Escape from
30
31
  inside the panel fold it down to the launcher, so the page is free to use; the
31
- launcher or `Shift+Alt+A` brings it back where it was. `Shift+Alt+C` picks a
32
+ launcher or `Shift+Alt+A` brings it back where it was. Refreshing or going to
33
+ another page folds it too, and keeps a report you have not sent. `Shift+Alt+C` picks a
32
34
  component on the page and opens its page.
33
35
 
34
36
  It runs in development only. Production builds contain none of it, and the
@@ -79,7 +81,7 @@ re-validates each file when you save it. It answers requests from your own
79
81
  machine only. On Next.js it is the route above, and it returns 404 in
80
82
  production. On Vite it is dev-server middleware that `vite build` never loads.
81
83
 
82
- The overlay talks only to your own dev server. The bridge talks to GitHub only for you: to sign you in with a code (through the Astralis DevTools GitHub App, which can only read and write issues on the Astralis repository), to open a report you have read and sent, and, while you are signed in, to list your issues. The token is kept in a file in your user config directory that only you can read, never in the page, and `astralis report` shares it.
84
+ The overlay talks only to your own dev server. The bridge talks to GitHub only for you: to sign you in with a code (through the Astralis DevTools GitHub App, which can only read and write issues on the Astralis repository), to open a report you have read and sent, and, while you are signed in, to list your issues. The token is kept in a file in your user config directory that only you can read, never in the page.
83
85
 
84
86
  ## License
85
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astralis-devtools",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Development overlay for Astralis UI: inspect any component on the page (Server Components included) and see the validator's findings live as you edit. Next.js and Vite.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -48,7 +48,7 @@
48
48
  "node": "^22.18.0 || >=24.11.0"
49
49
  },
50
50
  "dependencies": {
51
- "astralis-cli": "^0.6.0"
51
+ "astralis-cli": "^0.8.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "react": "^19.1.1"
@@ -19,8 +19,8 @@ import {
19
19
  /** How long a search for similar issues is reused: typing in the form must not search GitHub per keystroke. */
20
20
  const SIMILAR_TTL_MS = 60_000;
21
21
 
22
- /* The bridge's GitHub session: signing in with a code, the saved sign-in
23
- (shared with `astralis report`), and the reporter's issues. The token stays
22
+ /* The bridge's GitHub session: signing in with a code, the saved sign-in,
23
+ and the reporter's issues. The token stays
24
24
  in this process and in the user's config file; the page only ever learns
25
25
  the login, the code to enter, and the issues. */
26
26
 
@@ -2,14 +2,14 @@ import { animate, h, icon, store } from "./dom.mjs";
2
2
  import { FONT_FACES } from "./fonts.mjs";
3
3
  import { ICONS, MARK } from "./icons.mjs";
4
4
  import { createLauncher } from "./launcher.mjs";
5
- import { scanPage } from "./page.mjs";
5
+ import { isOnPage, scanPage } from "./page.mjs";
6
6
  import { createPicker } from "./picker.mjs";
7
7
  import { recordConsoleErrors } from "./report.mjs";
8
8
  import { componentScreen } from "./screens/component.mjs";
9
9
  import { componentsScreen } from "./screens/components.mjs";
10
10
  import { findingsScreen } from "./screens/findings.mjs";
11
11
  import { homeScreen } from "./screens/home.mjs";
12
- import { reportScreen } from "./screens/report.mjs";
12
+ import { emptyReport, reportScreen } from "./screens/report.mjs";
13
13
  import { STYLES } from "./styles.mjs";
14
14
 
15
15
  /* The Astralis DevTools overlay: a launcher that can sit anywhere on the
@@ -27,8 +27,9 @@ import { STYLES } from "./styles.mjs";
27
27
 
28
28
  Shift+Alt+A, the launcher's mark and the panel's minimize button fold it
29
29
  down to the launcher and bring it back where it was; Escape folds it from
30
- inside. Whether it is open, and on which screen, lasts the browser tab's
31
- session; where the launcher sits lasts across sessions. Shift+Alt+C picks a
30
+ inside. A new page, loaded or navigated to, starts with it folded; which
31
+ screen it was on, and a report not yet sent, last the browser tab's session,
32
+ and where the launcher sits lasts across sessions. Shift+Alt+C picks a
32
33
  component on the page and opens its page. Plain DOM in a shadow root, so it
33
34
  needs no framework and the page's CSS cannot reach it. Everything from the page or the bridge goes
34
35
  in as text. */
@@ -40,6 +41,8 @@ const SCAN_DEBOUNCE_MS = 200;
40
41
  const PANEL_GAP = 10;
41
42
  /** How often a waiting sign-in is checked. The bridge polls GitHub; this asks the bridge. */
42
43
  const SIGN_IN_POLL_MS = 2000;
44
+ /** GitHub's list can lag a moment behind a new issue, so it is read again after a send. */
45
+ const ISSUES_RETRY_MS = 3000;
43
46
  const EDGE = 12;
44
47
 
45
48
  const NAV = [
@@ -52,6 +55,16 @@ const NAV = [
52
55
 
53
56
  const SHORTCUTS = { open: "KeyA", pick: "KeyC" };
54
57
 
58
+ /** The page a panel was open on when it was unmounted. A hot reload can remount the overlay
59
+ without a page load, and must not close it; a page load starts with a new window. */
60
+ const openWhenUnmounted = new WeakMap();
61
+
62
+ /** A report written on an earlier page in this tab and not sent. Only its words: what to include is asked afresh. */
63
+ function readDraft() {
64
+ const draft = store.read("sessionStorage", "draft") ?? {};
65
+ return Object.fromEntries(["title", "happened", "expected"].filter((key) => typeof draft[key] === "string").map((key) => [key, draft[key]]));
66
+ }
67
+
55
68
  /**
56
69
  * Mount the overlay on this page. Returns a function that removes it and
57
70
  * everything it listens to. Mounting twice is a no-op.
@@ -72,6 +85,8 @@ export function mountOverlay({ base = "/api/astralis-devtools", framework = null
72
85
  }
73
86
 
74
87
  const remembered = store.read("sessionStorage", "panel") ?? {};
88
+ const remountedOpen = openWhenUnmounted.get(window) === location.pathname;
89
+ openWhenUnmounted.delete(window);
75
90
  const state = {
76
91
  open: false,
77
92
  screen: NAV.some((n) => n.screen === remembered.screen) ? remembered.screen : "home",
@@ -85,20 +100,10 @@ export function mountOverlay({ base = "/api/astralis-devtools", framework = null
85
100
  instances: [],
86
101
  github: null, // the bridge's GitHub status: { configured, repo, login, pending, error }
87
102
  issues: { list: null, loading: false, error: null },
103
+ created: [], // issues just opened that GitHub's list does not have yet
104
+ sent: null, // the last report sent, { number, url, added }, until its confirmation has been seen
88
105
  reportTab: "new",
89
- report: {
90
- title: "",
91
- happened: "",
92
- expected: "",
93
- includeText: false,
94
- includeFindings: true,
95
- includeConsole: false,
96
- snapshot: null,
97
- problems: [],
98
- status: "idle", // idle | sending | sent | failed | notice
99
- message: "",
100
- url: null,
101
- },
106
+ report: { ...emptyReport(), ...readDraft() },
102
107
  };
103
108
 
104
109
  const cleanups = [];
@@ -197,6 +202,25 @@ export function mountOverlay({ base = "/api/astralis-devtools", framework = null
197
202
  navigate("component", { open: true });
198
203
  },
199
204
  startPicking: (returnTo) => startPicking(returnTo),
205
+ /** Keep the report form's words for the next page in this tab. */
206
+ keepDraft: ({ title, happened, expected }) => store.write("sessionStorage", "draft", { title, happened, expected }),
207
+ /** A send ended, perhaps on a form that has since been rebuilt: the one on screen must show it. */
208
+ reportChanged: () => refresh("report"),
209
+ /** A report reached GitHub: show it among the reporter's issues. */
210
+ reportSent(sent, title) {
211
+ state.sent = sent;
212
+ if (!sent.added) {
213
+ const now = new Date().toISOString();
214
+ state.created.unshift({ number: sent.number, title, state: "open", stateReason: null, url: sent.url, comments: 0, labels: [], createdAt: now, updatedAt: now });
215
+ if (state.issues.list) state.issues.list = withCreated(state.issues.list);
216
+ }
217
+ state.reportTab = "issues";
218
+ store.write("sessionStorage", "draft", null);
219
+ loadIssues();
220
+ clearTimeout(issuesRetry);
221
+ issuesRetry = setTimeout(loadIssues, ISSUES_RETRY_MS);
222
+ refresh("sent");
223
+ },
200
224
  /** Outline an element on the page while the reader points at its row; null restores the default. */
201
225
  preview: (element) => picker.show(element ?? defaultOutline()),
202
226
  locate: (element) => picker.locate(element),
@@ -300,7 +324,7 @@ export function mountOverlay({ base = "/api/astralis-devtools", framework = null
300
324
  }
301
325
 
302
326
  function remember() {
303
- store.write("sessionStorage", "panel", { open: state.open, screen: state.screen === "component" ? "components" : state.screen });
327
+ store.write("sessionStorage", "panel", { screen: state.screen === "component" ? "components" : state.screen });
304
328
  }
305
329
 
306
330
  /* ---- opening, and where the panel sits ------------------------------------------ */
@@ -331,6 +355,11 @@ export function mountOverlay({ base = "/api/astralis-devtools", framework = null
331
355
  function setOpen(open) {
332
356
  // Focus left inside a panel going inert would fall to the page; the launcher brings it back.
333
357
  if (!open && panel.contains(shadow.activeElement)) launcher.focus();
358
+ if (open && state.selected && !isOnPage(state.selected)) {
359
+ // Picked on a page that is gone, or rendered away while the panel was folded.
360
+ state.selected = null;
361
+ if (state.screen === "component" || state.screen === "report") navigate(state.screen);
362
+ }
334
363
  state.open = open;
335
364
  if (open) placePanel();
336
365
  showPanel(open && !picker.picking);
@@ -340,6 +369,12 @@ export function mountOverlay({ base = "/api/astralis-devtools", framework = null
340
369
  if (open) current?.focus?.();
341
370
  }
342
371
 
372
+ function minimize() {
373
+ pickReturn = null;
374
+ picker.stop();
375
+ if (state.open) setOpen(false);
376
+ }
377
+
343
378
  function startPicking(returnTo = null) {
344
379
  pickReturn = returnTo;
345
380
  picker.start();
@@ -445,13 +480,26 @@ export function mountOverlay({ base = "/api/astralis-devtools", framework = null
445
480
  /* ---- GitHub -------------------------------------------------------------------------- */
446
481
 
447
482
  let signInPoll = null;
448
- cleanups.push(() => clearTimeout(signInPoll));
483
+ let issuesRetry = null;
484
+ cleanups.push(() => {
485
+ clearTimeout(signInPoll);
486
+ clearTimeout(issuesRetry);
487
+ });
488
+
489
+ /** GitHub's list, with the issues it does not show yet first. */
490
+ function withCreated(list) {
491
+ state.created = state.created.filter((issue) => !list.some((known) => known.number === issue.number));
492
+ return [...state.created, ...list];
493
+ }
449
494
 
450
495
  function setGitHub(status) {
451
496
  const before = state.github?.login ?? null;
452
497
  state.github = status;
453
498
  if (status.login !== before) {
454
499
  state.issues = { list: null, loading: false, error: null };
500
+ state.created = [];
501
+ state.sent = null;
502
+ clearTimeout(issuesRetry);
455
503
  if (status.login) loadIssues();
456
504
  }
457
505
  clearTimeout(signInPoll);
@@ -484,7 +532,7 @@ export function mountOverlay({ base = "/api/astralis-devtools", framework = null
484
532
  const result = await response.json();
485
533
  if (response.status === 401) return loadGitHub();
486
534
  if (!response.ok) throw new Error(result?.error ?? `The bridge answered ${response.status}.`);
487
- state.issues = { list: result.issues, loading: false, error: null };
535
+ state.issues = { list: withCreated(result.issues), loading: false, error: null };
488
536
  } catch (error) {
489
537
  state.issues = { ...state.issues, loading: false, error: error.message };
490
538
  }
@@ -505,22 +553,28 @@ export function mountOverlay({ base = "/api/astralis-devtools", framework = null
505
553
  .catch(() => {});
506
554
  }
507
555
  loadRouteFiles();
508
- // Client-side navigation changes the URL without an event to hook reliably.
509
- const routePoll = setInterval(() => {
510
- if (location.pathname !== state.route) {
511
- state.route = location.pathname;
512
- state.routeFiles = [];
513
- loadRouteFiles();
514
- scan();
515
- }
516
- }, ROUTE_POLL_MS);
556
+ function followRoute() {
557
+ if (location.pathname === state.route) return; // a new query or hash is still this page
558
+ state.route = location.pathname;
559
+ state.routeFiles = [];
560
+ minimize();
561
+ loadRouteFiles();
562
+ scan();
563
+ }
564
+ // The Navigation API reports client-side navigation at once; without it, only polling sees a pushState.
565
+ if (window.navigation?.addEventListener) listen(window.navigation, "currententrychange", followRoute);
566
+ listen(window, "popstate", followRoute);
567
+ const routePoll = setInterval(followRoute, ROUTE_POLL_MS);
517
568
  cleanups.push(() => clearInterval(routePoll));
569
+ // The browser can bring a page back, on Back, exactly as it was left.
570
+ listen(window, "pagehide", minimize);
518
571
 
519
572
  state.instances = scanPage(document, host);
520
573
  navigate(state.screen);
521
- if (remembered.open) setOpen(true);
574
+ if (remountedOpen) setOpen(true);
522
575
 
523
576
  return () => {
577
+ if (state.open) openWhenUnmounted.set(window, location.pathname);
524
578
  current?.dispose?.();
525
579
  for (const cleanup of cleanups.splice(0)) cleanup();
526
580
  host.remove();
@@ -17,6 +17,13 @@ export function scanPage(root, skip = null) {
17
17
  return instances;
18
18
  }
19
19
 
20
+ /**
21
+ * Whether an element is part of the page as it stands. React keeps a page left
22
+ * by client-side navigation in the document, hidden this way, where the app
23
+ * turns that on (Next.js cacheComponents).
24
+ */
25
+ export const isOnPage = (element) => element.isConnected && !element.closest('[style*="display: none !important"]');
26
+
20
27
  /** The instances grouped by the component they are, most used first, then by name. */
21
28
  export function groupByComponent(instances) {
22
29
  const groups = new Map();
@@ -9,10 +9,26 @@ import { empty } from "./shared.mjs";
9
9
 
10
10
  A report is an issue snapshot of one component and everything inside it.
11
11
  The exact JSON is shown before anything is sent, and nothing is sent until
12
- the reporter presses Send. The form keeps its input across screens and
13
- while findings stream in. Pictures and files are added on GitHub, in the
12
+ the reporter creates the issue. The form keeps its input across screens and
13
+ pages, and while findings stream in, until the report is sent; then the form
14
+ clears and Your issues shows it. Pictures and files are added on GitHub, in the
14
15
  issue itself: its API cannot attach them. */
15
16
 
17
+ /** A report nobody has written yet. */
18
+ export const emptyReport = () => ({
19
+ title: "",
20
+ happened: "",
21
+ expected: "",
22
+ includeText: false,
23
+ includeFindings: true,
24
+ includeConsole: false,
25
+ snapshot: null,
26
+ problems: [],
27
+ similar: null,
28
+ status: "idle", // idle | sending | failed | notice
29
+ message: "",
30
+ });
31
+
16
32
  /** The form for a new report. */
17
33
  function newReport(app) {
18
34
  const { state } = app;
@@ -20,10 +36,11 @@ function newReport(app) {
20
36
  const element = state.selected?.isConnected ? state.selected : null;
21
37
 
22
38
  if (!element) {
39
+ const written = r.title || r.happened || r.expected;
23
40
  const root = h(
24
41
  "div",
25
42
  {},
26
- empty(ICONS.report, "Which component is it?", "Pick the component the problem is in. The report describes it and everything inside it.", { neutral: true }),
43
+ empty(ICONS.report, "Which component is it?", `Pick the component the problem is in. The report describes it and everything inside it.${written ? " What you wrote is kept." : ""}`, { neutral: true }),
27
44
  h(
28
45
  "div",
29
46
  { class: "row", style: "justify-content:center" },
@@ -36,14 +53,23 @@ function newReport(app) {
36
53
 
37
54
  let timer = null;
38
55
  let request = 0;
56
+ let current = false; // whether r.snapshot holds everything in the form
57
+ let disposed = false;
58
+ if (r.status !== "sending") {
59
+ // It may describe a component picked earlier.
60
+ r.snapshot = null;
61
+ r.problems = [];
62
+ }
39
63
 
40
64
  function schedule() {
65
+ current = false;
41
66
  clearTimeout(timer);
42
67
  timer = setTimeout(assemble, 250);
43
68
  }
44
69
 
45
70
  /** Ask the bridge to complete the snapshot from the page's part. Nothing leaves the machine. */
46
71
  async function assemble() {
72
+ clearTimeout(timer);
47
73
  if (!element.isConnected) return;
48
74
  const mine = ++request;
49
75
  const body = {
@@ -61,6 +87,7 @@ function newReport(app) {
61
87
  if (!response.ok) throw new Error(result?.error ?? `The bridge answered ${response.status}.`);
62
88
  r.snapshot = result.snapshot;
63
89
  r.problems = result.problems;
90
+ current = true;
64
91
  if (r.status === "notice") r.status = "idle";
65
92
  checkSimilar(result.snapshot);
66
93
  } catch (error) {
@@ -77,7 +104,9 @@ function newReport(app) {
77
104
  try {
78
105
  const response = await fetch(`${app.base}/github/similar`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(snapshot) });
79
106
  if (!response.ok) return;
80
- r.similar = await response.json();
107
+ const found = await response.json();
108
+ if (disposed) return;
109
+ r.similar = found;
81
110
  } catch {
82
111
  return; // no check is no reason to stop a report
83
112
  }
@@ -86,30 +115,35 @@ function newReport(app) {
86
115
 
87
116
  /** Open a new issue, or, with `addTo`, add the report to that existing one. */
88
117
  async function send(addTo = null) {
89
- if (!r.snapshot || r.problems.length) return;
118
+ if (r.status === "sending" || !r.snapshot || r.problems.length) return;
90
119
  r.status = "sending";
91
120
  r.message = "";
92
121
  refresh();
122
+ // The last keystrokes may still be waiting to be assembled, and sending clears the form.
123
+ if (!current) await assemble();
124
+ if (!current || !r.snapshot || r.problems.length) {
125
+ r.status = element.isConnected ? "idle" : "notice";
126
+ r.message = element.isConnected ? "" : "That component is no longer on the page. Nothing was sent; pick it again.";
127
+ return app.reportChanged();
128
+ }
129
+ const { snapshot } = r;
93
130
  try {
94
131
  const where = addTo ? `submit?addTo=${addTo}` : "submit";
95
- const response = await fetch(`${app.base}/${where}`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(r.snapshot) });
132
+ const response = await fetch(`${app.base}/${where}`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(snapshot) });
96
133
  const result = await response.json();
97
134
  if (response.status === 401) app.github.reload();
98
135
  if (!response.ok) throw new Error(result?.error ?? `The bridge answered ${response.status}.`);
99
- r.status = "sent";
100
- r.url = result.url;
101
- r.number = result.number;
102
- r.added = Boolean(addTo);
103
- r.similar = null;
104
- app.github.loadIssues();
136
+ Object.assign(r, emptyReport());
137
+ app.reportSent({ number: result.number, url: result.url, added: Boolean(addTo) }, snapshot.description.title);
105
138
  } catch (error) {
106
139
  r.status = "failed";
107
140
  r.message = error.message;
141
+ app.reportChanged();
108
142
  }
109
- refresh();
110
143
  }
111
144
 
112
145
  function notice(message) {
146
+ if (r.status === "sending") return;
113
147
  r.status = "notice";
114
148
  r.message = message;
115
149
  refresh();
@@ -145,11 +179,14 @@ function newReport(app) {
145
179
  }
146
180
  }
147
181
 
182
+ const inputs = [];
148
183
  const field = (label, key, multiline, placeholder) => {
149
184
  const input = h(multiline ? "textarea" : "input", { class: "field", rows: multiline ? 3 : null, maxlength: multiline ? 4000 : 200, "aria-label": label, placeholder });
150
185
  input.value = r[key];
186
+ inputs.push(input);
151
187
  input.addEventListener("input", () => {
152
188
  r[key] = input.value;
189
+ app.keepDraft(r);
153
190
  schedule();
154
191
  });
155
192
  return h("label", { class: "field-label" }, label, input);
@@ -172,8 +209,8 @@ function newReport(app) {
172
209
  const problems = h("ul", { class: "problems" });
173
210
  const status = h("div", { class: "report-status", role: "status" });
174
211
  const similar = h("div", {});
175
- const sendButton = h("button", { class: "btn primary", type: "button", onclick: () => send() }, icon(GITHUB_MARK), h("span", {}, "Open issue on GitHub"));
176
- const linkButton = h("button", { class: "btn", type: "button", title: "Opens GitHub's own form, filled in; you submit it there. No sign-in.", onclick: openOnGitHub }, icon(ICONS.external), "Open on GitHub instead");
212
+ const sendButton = h("button", { class: "btn primary", type: "button", onclick: () => send() }, icon(GITHUB_MARK), h("span", {}, "Create issue from here"));
213
+ const linkButton = h("button", { class: "btn", type: "button", title: "Opens GitHub's own form, filled in; you submit it there. No sign-in.", onclick: openOnGitHub }, icon(ICONS.external), "Open GitHub's form instead");
177
214
  const copyButton = h("button", { class: "btn", type: "button", onclick: copy }, icon(ICONS.copy), "Copy JSON");
178
215
  const downloadButton = h("button", { class: "btn", type: "button", onclick: download }, icon(ICONS.download), "Download");
179
216
 
@@ -184,7 +221,7 @@ function newReport(app) {
184
221
  "div",
185
222
  { class: "card target" },
186
223
  h("span", { class: "detail-icon" }, icon(ICONS.components)),
187
- h("div", { class: "grow" }, h("div", { class: "name" }, readIdentity(element)[0]?.name ?? "Component"), h("div", { class: "muted", style: "font-size:12px" }, "and everything inside it. Nothing is sent until you press Send.")),
224
+ h("div", { class: "grow" }, h("div", { class: "name" }, readIdentity(element)[0]?.name ?? "Component"), h("div", { class: "muted", style: "font-size:12px" }, "and everything inside it. Nothing is sent until you create the issue.")),
188
225
  h("button", { class: "btn ghost", type: "button", onclick: () => app.startPicking("report") }, icon(ICONS.pick), "Change"),
189
226
  ),
190
227
  field("Title", "title", false, "Card loses its border in dark mode"),
@@ -241,33 +278,18 @@ function newReport(app) {
241
278
  preview.textContent = r.snapshot ? JSON.stringify(r.snapshot, null, 2) : "Assembling…";
242
279
  problems.replaceChildren(...r.problems.map((p) => h("li", {}, p)));
243
280
  const signedIn = Boolean(app.state.github?.login);
281
+ // What is typed while a report is on its way would be cleared with it.
282
+ for (const input of inputs) input.readOnly = r.status === "sending";
244
283
  sendButton.disabled = !signedIn || !r.snapshot || r.problems.length > 0 || r.status === "sending";
245
284
  sendButton.title = signedIn ? "" : "Sign in with GitHub first";
246
- linkButton.disabled = !r.snapshot || r.problems.length > 0;
285
+ linkButton.disabled = !r.snapshot || r.problems.length > 0 || r.status === "sending";
247
286
  copyButton.disabled = !r.snapshot;
248
287
  downloadButton.disabled = !r.snapshot;
249
- sendButton.lastChild.textContent = r.status === "sending" ? "Opening…" : "Open issue on GitHub";
288
+ sendButton.lastChild.textContent = r.status === "sending" ? "Creating…" : "Create issue from here";
250
289
  similar.replaceChildren(...[similarCard()].filter(Boolean));
251
290
  status.className = `report-status ${r.status}`;
252
291
  status.replaceChildren(
253
- r.status === "sent"
254
- ? h(
255
- "div",
256
- { class: "card sent-card" },
257
- h("span", { class: "sent-icon" }, icon(ICONS.check)),
258
- h(
259
- "div",
260
- { class: "grow" },
261
- h("div", { class: "sent-title" }, r.added ? `Added your report to #${r.number}` : `Opened #${r.number} on GitHub`),
262
- h("p", { class: "muted small" }, "To add a screenshot or a file, open the issue and drop it into a comment there."),
263
- h("a", { class: "btn primary", href: r.url, target: "_blank", rel: "noreferrer" }, icon(GITHUB_MARK), "Open the issue on GitHub", icon(ICONS.external)),
264
- ),
265
- )
266
- : r.status === "failed"
267
- ? `${r.message} Nothing was sent; Copy JSON or Download keeps the snapshot.`
268
- : r.status === "notice"
269
- ? r.message
270
- : "",
292
+ r.status === "failed" ? `${r.message} Nothing was sent; Copy JSON or Download keeps the snapshot.` : r.status === "notice" ? r.message : "",
271
293
  );
272
294
  }
273
295
 
@@ -280,7 +302,11 @@ function newReport(app) {
280
302
  refresh();
281
303
  if (reason === "findings") schedule();
282
304
  },
283
- dispose: () => clearTimeout(timer),
305
+ dispose() {
306
+ disposed = true;
307
+ request++; // a snapshot still being assembled is for a form that is gone
308
+ clearTimeout(timer);
309
+ },
284
310
  };
285
311
  }
286
312
 
@@ -293,7 +319,7 @@ function accountCard(app) {
293
319
  return h(
294
320
  "div",
295
321
  { class: "notice" },
296
- "GitHub sign-in is not set up in this version of the DevTools. Use Open on GitHub instead below: it fills in GitHub's own form, and you submit it there.",
322
+ "GitHub sign-in is not set up in this version of the DevTools. Use Open GitHub's form instead, in a new report: it opens GitHub's own form, filled in, and you submit it there.",
297
323
  );
298
324
  }
299
325
  if (gh.login) {
@@ -350,7 +376,7 @@ function accountCard(app) {
350
376
  "div",
351
377
  { class: "grow" },
352
378
  h("div", { class: "account-name" }, "Sign in to report"),
353
- h("div", { class: "muted small" }, `Issues open on ${repo} from your own account. The app can only read and write issues there. Or use Open on GitHub instead, with no sign-in.`),
379
+ h("div", { class: "muted small" }, `Issues open on ${repo} from your own account. The app can only read and write issues there. Or use Open GitHub's form instead, with no sign-in.`),
354
380
  gh.error ? h("div", { class: "account-error" }, gh.error) : null,
355
381
  ),
356
382
  h("button", { class: "btn primary", type: "button", onclick: () => app.github.signIn() }, icon(GITHUB_MARK), "Sign in with GitHub"),
@@ -364,12 +390,30 @@ const ago = (iso) => {
364
390
  return "just now";
365
391
  };
366
392
 
393
+ /** What was just sent, where it went, and how to add to it. */
394
+ const sentCard = ({ number, url, added }) =>
395
+ h(
396
+ "div",
397
+ { class: "card sent-card", role: "status", style: "margin-bottom:14px" },
398
+ h("span", { class: "sent-icon" }, icon(ICONS.check)),
399
+ h(
400
+ "div",
401
+ { class: "grow" },
402
+ h("div", { class: "sent-title" }, added ? `Added your report to #${number}` : `Created #${number}`),
403
+ h("p", { class: "muted small" }, "To add a screenshot or a file, open the issue and drop it into a comment there."),
404
+ h("a", { class: "btn primary", href: url, target: "_blank", rel: "noreferrer" }, icon(GITHUB_MARK), `Open #${number} on GitHub`, icon(ICONS.external)),
405
+ ),
406
+ );
407
+
367
408
  /** The issues the reporter has opened, and where each stands. */
368
409
  function yourIssues(app) {
410
+ const sent = app.state.sent;
411
+ const confirmation = h("div", {}, sent && sentCard(sent));
369
412
  const root = h("div", {});
370
413
  function update() {
371
414
  const gh = app.state.github;
372
415
  const issues = app.state.issues;
416
+ if (app.state.sent !== sent) confirmation.replaceChildren();
373
417
  if (!gh?.login) {
374
418
  root.replaceChildren(empty(ICONS.report, "Your issues show here", "Sign in with GitHub to see the issues you have opened and where each stands.", { neutral: true }));
375
419
  return;
@@ -415,7 +459,13 @@ function yourIssues(app) {
415
459
  );
416
460
  }
417
461
  update();
418
- return { root, update };
462
+ return {
463
+ root: h("div", {}, confirmation, root),
464
+ update,
465
+ dispose() {
466
+ if (app.state.sent === sent) app.state.sent = null;
467
+ },
468
+ };
419
469
  }
420
470
 
421
471
  export function reportScreen(app) {
@@ -448,6 +498,7 @@ export function reportScreen(app) {
448
498
  title: [{ label: "Report" }],
449
499
  root,
450
500
  update(reason) {
501
+ if (reason === "sent") return show("issues");
451
502
  if (reason === "github") {
452
503
  account.replaceChildren(accountCard(app));
453
504
  drawTabs();
@@ -51,7 +51,7 @@ export function bridgeMissing(app) {
51
51
  " containing ",
52
52
  h("code", {}, 'export { GET, POST } from "astralis-devtools/next/route";'),
53
53
  ", or run ",
54
- h("code", {}, "astralis init --devtools"),
54
+ h("code", {}, "npx astralis-cli init --devtools"),
55
55
  ".",
56
56
  )
57
57
  : h("p", {}, "Is the dev server running? The bridge answers this machine only."),