@popcorn245/cornfield 0.48.0 → 0.49.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.
@@ -1,57 +1,14 @@
1
1
  /**
2
2
  * @module explorer/waiting-line
3
3
  *
4
- * The one line under the proposal bar's buttons when a run is waiting on the open proposal (spec 0010 D2): "A run is waiting on you: Plan
5
- * ready: approve to build, … · Answer". Answer opens Work on Runs at that run with its reply field focused (forge-panel.js). The line is its
6
- * own element, added after the bar's head once, so the bar's own markup is not touched. The runner's words are set as text, never as HTML.
4
+ * A bridge (spec 0011 D3, step 5): the one line under the proposal bar's buttons when a run is waiting on the open proposal (spec 0010 D2) is part of the
5
+ * proposal's bar (pieces/proposal.js). This file keeps the old names for the Work panel, bound to the page's instance.
7
6
  */
8
7
 
9
- import { waitingLineWords } from './waiting-model.js';
10
- import { t } from './strings.js';
11
- import { announce } from './keyboard.js';
12
-
13
- let line = null;
14
- let saidFor = null;
15
-
16
- /** The line, made on first use and kept after the bar's head; null when the bar is not on the page */
17
- function mount() {
18
- const body = document.getElementById('proposal-body');
19
- if (!body) return null;
20
- if (line && line.isConnected) return line;
21
- line = document.createElement('p');
22
- line.className = 'hx-waiting-line';
23
- line.dataset.corn = 'waiting-line';
24
- line.dataset.cornState = 'waiting';
25
- line.hidden = true;
26
- line.innerHTML = '<span data-waiting-words></span> <button type="button" class="hx-btn hx-forge-act" data-waiting-answer data-peek-ok data-corn-kind="secondary"></button>';
27
- const head = body.querySelector('.hx-proposal-head');
28
- if (head) head.after(line); else body.append(line);
29
- return line;
30
- }
31
-
32
- /**
33
- * Shows the line for `run` (the run waiting on the open proposal), or hides it for null. The first time a run is shown for a proposal it is said
34
- * through the live region once; a repaint of the same run says nothing.
35
- * @param {{ runId: string, report?: { note?: string } | null } | null} run
36
- * @param {string | null} key what the line is about (the proposal), so a run is announced once for it
37
- */
38
- export function paintWaitingLine(run, key) {
39
- const el = mount();
40
- if (!el) return;
41
- el.hidden = !run;
42
- if (!run) { saidFor = null; return; }
43
- const words = waitingLineWords(run);
44
- el.querySelector('[data-waiting-words]').textContent = words;
45
- const button = el.querySelector('[data-waiting-answer]');
46
- button.textContent = t('answer');
47
- button.dataset.waitingAnswer = run.runId;
48
- button.setAttribute('aria-label', `${t('answer')}: ${words}`);
49
- const said = `${key}|${run.runId}`;
50
- if (saidFor !== said) { saidFor = said; announce(words); }
51
- }
8
+ import { pageInstance } from './state.js';
9
+ import { ensurePagePieces } from './page-pieces.js';
52
10
 
11
+ /** Shows the line for `run` (the run waiting on the open proposal), or hides it for null; `key` is what the line is about (the proposal), so a run is said once for it */
12
+ export function paintWaitingLine(run, key) { ensurePagePieces(); pageInstance().emit('proposal:waiting', { run, key }); }
53
13
  /** For tests: forget the line */
54
- export function resetWaitingLineForTests() {
55
- line = null;
56
- saidFor = null;
57
- }
14
+ export function resetWaitingLineForTests() { pageInstance().emit('proposal:waiting-reset'); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcorn245/cornfield",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "A self-hostable dev dashboard with the topology map at its centre: proposals on the map, scenarios, outages and what-if edits, for any repo.",
5
5
  "license": "MIT",
6
6
  "author": "popcorn245 (https://github.com/popcorn245)",