cornfield 0.29.0 → 0.31.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.
@@ -627,7 +627,7 @@ async function afterIdea(res) {
627
627
  const shown = ui.thread === n && ui.threadDetail && ui.threadDetail.thread ? ` ${threadSelectionWords()}` : ui.thread === n && ui.threadError ? ` ${ui.threadError}` : '';
628
628
  // Opened from a node: say that its "Mentioned in" lists the new thread
629
629
  const listed = about && (threadsFor(about.id) || []).some((t) => t.number === n);
630
- announce(`${ui.idea.message}${shown}${listed ? ` It is listed under Mentioned in for ${about.label}.` : ''}${trouble}`);
630
+ announce(`${ui.idea.message}${shown}${listed ? ` It is listed under Threads for ${about.label}.` : ''}${trouble}`);
631
631
  }
632
632
 
633
633
  /** The New idea bar and form, from `ui.idea`; typed text and the focus are left alone */
@@ -1242,7 +1242,7 @@ function paintButton() {
1242
1242
  const tag = $('forge-btn-lit');
1243
1243
  tag.hidden = !lit;
1244
1244
  tag.textContent = ui.runSel ? 'run' : ui.thread !== null ? `thread #${ui.thread}` : ui.deployItem ? 'deploy' : lit ? `#${ui.selected}` : '';
1245
- btn.setAttribute('aria-label', ui.runSel ? 'Issues and pull requests, a run lit on the map' : ui.thread !== null ? `Issues and pull requests, thread ${ui.thread} selected` : ui.deployItem ? 'Issues and pull requests, a deploy selected' : lit ? `Issues and pull requests, pull request ${ui.selected} selected` : 'Issues and pull requests');
1245
+ btn.setAttribute('aria-label', `${t('issuesAndPrs')}${ui.runSel ? ', a run lit on the map' : ui.thread !== null ? `, thread ${ui.thread} selected` : ui.deployItem ? ', a deploy selected' : lit ? `, pull request ${ui.selected} selected` : ''}`);
1246
1246
  btn.setAttribute('aria-expanded', String(ui.open));
1247
1247
  }
1248
1248
 
@@ -1561,7 +1561,7 @@ function closeAgent({ restoreFocus = true } = {}) {
1561
1561
  el.hidden = true;
1562
1562
  document.removeEventListener('focusin', keepFocusInAgent);
1563
1563
  if (!restoreFocus) return;
1564
- const back = $('forge-panel').querySelector(opener) || $('forge-title');
1564
+ const back = document.querySelector(opener) || $('forge-title'); // the node panel's Start a run is an opener too
1565
1565
  if (back && !back.disabled) back.focus();
1566
1566
  }
1567
1567
 
@@ -1787,10 +1787,13 @@ async function issueNotListed(n) {
1787
1787
  return linkMissing(res.status === 404 ? `There is no issue ${n}.` : errorWords(res.status, res.body));
1788
1788
  }
1789
1789
 
1790
+ /** Whether the Start dialog can open now: the server runs agents and the page has the dialog (the node panel's "Start a run" asks) */
1791
+ export const canStartAgent = () => !!(ui.config && ui.config.agents && agentEl());
1792
+
1790
1793
  /** `?proposal=<slug>&start=1`: the Start dialog on that proposal (the proposal itself is opened by proposal.js) */
1791
- export async function openProposalStart(slug) {
1794
+ export async function openProposalStart(slug, opener = '#forge-title') {
1792
1795
  if (!ui.config || !agentEl()) return false;
1793
- await openAgent(`proposal:${slug}`, '#forge-title');
1796
+ await openAgent(`proposal:${slug}`, opener);
1794
1797
  return !!ui.agent;
1795
1798
  }
1796
1799
 
@@ -49,16 +49,12 @@
49
49
  .hx-house-more { position: absolute; left: 0; top: 0; min-width: 34px; height: 24px; padding: 0 var(--corn-space-3); border: var(--corn-border) solid var(--corn-added); border-radius: var(--corn-radius-pill); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); color: var(--corn-added-text); font-weight: 700; font-size: var(--corn-text-sm); line-height: 1; font-family: inherit; cursor: pointer; pointer-events: auto; }
50
50
  .hx-house-more:hover, .hx-house-more:focus-visible { background: var(--corn-added-text); color: var(--corn-ground); outline: none; }
51
51
 
52
- /* The House button joins the toolbar: up to a wide screen the live chip's line is cut shorter (the whole line is in its
53
- menu and its title), and on a narrow phone the toolbar tightens, so the toolbar still fits on one line */
52
+ /* Up to a wide screen the live chip's line is cut shorter (the whole line is in its menu and its title), so the header still fits on one line */
54
53
  @media (min-width: 768px) and (max-width: 1439px) { .hx-live-chip-text { max-width: 140px; } }
55
- @media (max-width: 420px) {
56
- .hx-header .hx-header-left, .hx-header .hx-header-right { gap: var(--corn-space-1); }
57
- .hx-header .hx-btn { padding-left: var(--corn-space-2); padding-right: var(--corn-space-2); }
58
- }
59
54
 
60
55
  @media (max-width: 767px) {
61
- .hx-house-bar { top: 8px; left: 8px; right: 8px; }
56
+ /* Under the Layers chip, the live chip and Fit, which sit on the map's top edge on a phone (explorer.css) */
57
+ .hx-house-bar { top: calc(var(--corn-space-4) * 2 + 44px); left: 8px; right: 8px; }
62
58
  .hx-house-chip { min-height: 32px; padding: var(--corn-space-1) var(--corn-space-4); }
63
59
  .hx-house-people { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
64
60
  }
package/explorer/house.js CHANGED
@@ -166,7 +166,7 @@ function syncHouse() {
166
166
  repaintLiveChip();
167
167
  }
168
168
  const btn = $('preset-house-btn');
169
- if (btn) { btn.classList.toggle('hx-btn--active', on); btn.setAttribute('aria-pressed', String(on)); }
169
+ if (btn) btn.setAttribute('aria-pressed', String(on));
170
170
  const stage = stageOf();
171
171
  if (stage) stage.classList.toggle('is-house', on);
172
172
  if (!els) return;
@@ -21,24 +21,32 @@
21
21
  <script src="/explorer/theme-boot.js"></script>
22
22
  </head>
23
23
  <body>
24
- <!-- Top bar: layers, data-flow preset, search, layout mode, zoom, links -->
24
+ <!-- Top bar, left to right: brand, the View switch (Map, Flow, House, Fit), the Layers chip, the live chip, search, Work, and the one account menu -->
25
25
  <header class="hx-header" data-corn="header">
26
26
  <!-- The page's one heading, for a screen reader's list of headings (plugins.js puts the config's title in it) -->
27
27
  <h1 id="cf-heading" class="hx-sr-only">cornfield: the map</h1>
28
28
  <div class="hx-header-left">
29
+ <!-- The brand: its logo and wordmark (plugins.js puts the config's in their place); a click resets the view -->
29
30
  <button type="button" id="cf-brand" class="hx-brand" data-corn="brand" data-action="reset-view" title="Reset View" aria-label="cornfield: reset the view">
30
- <span id="cf-mark" class="hx-live-dot"></span>
31
- <span id="cf-title" class="hx-title gradient-text">cornfield</span>
31
+ <svg id="cf-mark" class="hx-mark" viewBox="0 0 24 24" width="22" height="22" aria-hidden="true" focusable="false"><rect class="hx-mark-bg" x="3" y="3" width="18" height="18" rx="5" /><circle class="hx-mark-fg" cx="9" cy="10" r="2" /><circle class="hx-mark-fg" cx="15" cy="14" r="2" /><path class="hx-mark-line" d="M9 10l6 4" /></svg>
32
+ <span id="cf-title" class="hx-title">cornfield</span>
32
33
  </button>
33
34
 
34
- <div class="hx-menu-wrap">
35
- <button type="button" id="legend-toggle-btn" class="hx-btn" data-action="toggle-layers-menu" aria-label="Layers" data-corn-string-aria-label="layers" aria-expanded="false" aria-controls="legend-dropdown" title="Toggle Architecture Layers" data-corn="layers-button">
36
- <span class="hx-dots" aria-hidden="true">
37
- <span style="background:#6366f1"></span><span style="background:#06b6d4"></span><span style="background:#38bdf8"></span><span style="background:#10b981"></span><span style="background:#a855f7"></span><span style="background:#ec4899"></span><span style="background:#fb923c"></span>
38
- </span>
39
- <span class="hx-only-wide" data-corn-string="layers">Layers</span>
40
- <span class="hx-faint" aria-hidden="true">▾</span>
35
+ <!-- The View switch: one of the three is on (aria-pressed); Fit is the small button at its end -->
36
+ <div class="hx-view" role="group" aria-label="View">
37
+ <button type="button" id="preset-map-btn" class="hx-view-btn" data-action="preset-map" aria-pressed="true" title="The map: every node, in its place">Map</button>
38
+ <!-- The data-flow preset: browser -> servers -> API -> tables -> services -> outside, animated -->
39
+ <button type="button" id="preset-dataflow-btn" class="hx-view-btn" data-action="preset-dataflow" aria-pressed="false" data-corn-string="dataFlow" title="Show only how data moves: browser, app servers, API, tables, services, outside systems" data-corn="preset-dataflow">Flow</button>
40
+ <!-- The House preset (explorer/house.js, spec 0029): the floor plan with its devices, machines and people, the software around it -->
41
+ <button type="button" id="preset-house-btn" class="hx-view-btn" data-action="preset-house" aria-pressed="false" data-corn-string="house" title="Show the house: each floor's rooms with their devices and machines, the people beside it, the software around it" data-corn="preset-house">House</button>
42
+ <button type="button" id="fit-btn" class="hx-view-fit" data-action="fit" title="Fit to the screen" aria-label="Fit to the screen" data-corn-kind="icon">
43
+ <svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M2 6V2h4M10 2h4v4M14 10v4h-4M6 14H2v-4" /></svg>
41
44
  </button>
45
+ </div>
46
+
47
+ <!-- The Layers chip: how many of the layers are on; it opens the layers menu. On a phone it sits on the map, top left -->
48
+ <div class="hx-menu-wrap hx-layers">
49
+ <button type="button" id="legend-toggle-btn" class="hx-layers-chip" data-action="toggle-layers-menu" aria-expanded="false" aria-controls="legend-dropdown" data-corn="layers-button"><span data-corn-string="layers">Layers</span><span id="layers-count" class="hx-layers-count"></span></button>
42
50
 
43
51
  <!-- Interactive section toggles and the legend -->
44
52
  <div id="legend-dropdown" class="hx-menu glass" hidden data-corn="layers-menu">
@@ -88,41 +96,6 @@
88
96
  </div>
89
97
  </div>
90
98
 
91
- <!-- The data-flow preset: browser -> servers -> API -> tables -> services -> outside, animated -->
92
- <button type="button" id="preset-dataflow-btn" class="hx-btn hx-btn--preset" data-action="preset-dataflow" aria-pressed="false" aria-label="Data flow" data-corn-string-aria-label="dataFlow" title="Show only how data moves: browser, app servers, API, tables, services, outside systems" data-corn="preset-dataflow">
93
- <span aria-hidden="true">⇄</span>
94
- <span class="hx-only-wide" data-corn-string="dataFlow">Data flow</span>
95
- </button>
96
-
97
- <!-- The House preset (explorer/house.js, spec 0029): the floor plan with its devices, machines and people, the software around it -->
98
- <button type="button" id="preset-house-btn" class="hx-btn hx-btn--preset" data-action="preset-house" aria-pressed="false" aria-label="House" data-corn-string-aria-label="house" title="Show the house: each floor's rooms with their devices and machines, the people beside it, the software around it" data-corn="preset-house">
99
- <span aria-hidden="true">⌂</span>
100
- <span class="hx-only-wide" data-corn-string="house">House</span>
101
- </button>
102
-
103
- <!-- Proposals: what a change would add, change and remove, drawn on the map (proposal.js) -->
104
- <div id="proposal-wrap" class="hx-menu-wrap">
105
- <button type="button" id="proposal-btn" class="hx-btn hx-btn--proposal" data-action="toggle-proposals-menu" aria-haspopup="true" aria-expanded="false" aria-label="Proposals" data-corn-string-aria-label="proposals" title="Open a proposal: what a change would add, change and remove" data-corn="proposals-button">
106
- <span aria-hidden="true">✎</span>
107
- <span class="hx-only-wide" data-corn-string="proposals">Proposals</span>
108
- <span class="hx-faint">▾</span>
109
- </button>
110
- <div id="proposal-menu" class="hx-menu hx-menu--proposals glass" hidden data-corn="proposals-menu"></div>
111
- </div>
112
-
113
- <!-- Issues and pull requests (explorer/forge-panel.js): shown only when the config names a forge -->
114
- <button type="button" id="forge-btn" class="hx-btn hx-btn--forge" data-action="toggle-forge" aria-expanded="false" aria-controls="forge-panel" aria-label="Issues and pull requests" data-corn-string-aria-label="issuesAndPrs" title="Issues, pull requests and deploys: a pull request lights the nodes it changes, a deploy the nodes it restarted" hidden data-corn="forge-button">
115
- <span aria-hidden="true">⎇</span>
116
- <span class="hx-only-wide" data-corn-string="issuesAndPrs">Issues &amp; PRs</span>
117
- <span id="forge-btn-lit" class="hx-forge-lit" hidden></span>
118
- </button>
119
-
120
- <!-- Review tokens (explorer/review-tokens.js): shown only when somebody is signed in to a forge -->
121
- <button type="button" id="tokens-btn" class="hx-btn" aria-haspopup="dialog" aria-expanded="false" aria-controls="tokens-dialog" aria-label="Review tokens" title="Review tokens: let a script or a chat bot approve or send back a proposal as you" hidden data-corn="tokens-button">
122
- <span aria-hidden="true">⚿</span>
123
- <span class="hx-only-wide">Review tokens</span>
124
- </button>
125
-
126
99
  <!-- The live layer's chip (explorer/live.js, spec 0029): shown once a live layer is on; a dot on a phone, its line on tap -->
127
100
  <div id="live-wrap" class="hx-menu-wrap hx-live" data-tone="idle" hidden>
128
101
  <button type="button" id="live-chip" class="hx-btn hx-live-chip" aria-haspopup="true" aria-expanded="false" aria-label="Live layer" data-corn="live-chip">
@@ -134,41 +107,65 @@
134
107
  </div>
135
108
 
136
109
  <div class="hx-header-right">
137
- <button type="button" id="mobile-search-toggle" class="hx-btn hx-btn--icon hx-only-mobile" data-action="toggle-mobile-search" aria-label="Open Search" title="Search nodes" data-corn-kind="icon">⌕</button>
110
+ <!-- Search: a field with its key hint on a desktop; an icon that opens the search bar on a phone -->
111
+ <button type="button" id="mobile-search-toggle" class="hx-hdr-icon hx-only-mobile" data-action="toggle-mobile-search" aria-label="Open Search" title="Search nodes" data-corn-kind="icon">
112
+ <svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="7" cy="7" r="4.5" /><path d="M10.5 10.5L14 14" /></svg>
113
+ </button>
138
114
 
139
- <div class="hx-search hx-only-desktop" role="search" data-corn="search">
140
- <input type="text" id="node-search" class="hx-input" placeholder="Search..." data-corn-string-placeholder="searchPlaceholder" aria-label="Search nodes" data-corn="search-input" />
115
+ <div class="hx-search" role="search" data-corn="search">
116
+ <svg class="hx-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="7" cy="7" r="4.5" /><path d="M10.5 10.5L14 14" /></svg>
117
+ <input type="text" id="node-search" class="hx-search-input" placeholder="Search..." data-corn-string-placeholder="searchPlaceholder" aria-label="Search nodes" aria-keyshortcuts="/" data-corn="search-input" />
118
+ <kbd class="hx-kbd" aria-hidden="true">/</kbd>
141
119
  </div>
142
120
 
143
- <button type="button" id="freeform-toggle-btn" class="hx-btn" data-action="toggle-freeform" title="Toggle between Orbit parent clustering and freeform node dragging" data-corn="layout-toggle">
144
- <span id="freeform-toggle-icon" aria-hidden="true">🔒</span>
145
- <span class="hx-only-wide" id="freeform-toggle-label">Orbit</span>
121
+ <!-- The Work toggle (explorer/forge-panel.js): opens the Work panel; shown only when the config names a forge -->
122
+ <button type="button" id="forge-btn" class="hx-work" data-action="toggle-forge" aria-expanded="false" aria-controls="forge-panel" aria-label="Work" data-corn-string-aria-label="issuesAndPrs" title="Issues, pull requests and deploys: a pull request lights the nodes it changes, a deploy the nodes it restarted" hidden data-corn="forge-button">
123
+ <span data-corn-string="issuesAndPrs">Work</span>
124
+ <span id="forge-btn-lit" class="hx-forge-lit" hidden></span>
146
125
  </button>
147
126
 
148
- <button type="button" id="reset-positions-btn" class="hx-btn hx-btn--quiet" data-action="reset-positions" title="Reset custom dragged positions back to orbit" hidden data-corn-kind="quiet">Reset Layout</button>
149
-
150
- <div class="hx-zoom hx-only-desktop" data-corn="zoom">
151
- <button type="button" class="hx-zoom-btn" data-action="zoom-in" title="Zoom In" aria-label="Zoom in" data-corn-kind="icon">+</button>
152
- <button type="button" class="hx-zoom-btn" data-action="zoom-out" title="Zoom Out" aria-label="Zoom out" data-corn-kind="icon">−</button>
153
- <button type="button" class="hx-zoom-btn" data-action="reset-view" title="Reset View" aria-label="Reset the view" data-corn-kind="icon">⟲</button>
154
- <button type="button" class="hx-zoom-btn hx-zoom-btn--accent" data-action="fit" title="Fit to Screen" aria-label="Fit to the screen" data-corn-kind="icon">⛶</button>
155
- </div>
127
+ <!-- The one account menu (explorer/account-menu.js): who, Theme, Freeform layout, Review tokens, Proposals, the links, Sign out, and what powers it -->
128
+ <div class="hx-menu-wrap hx-account">
129
+ <button type="button" id="account-btn" class="hx-account-btn" aria-expanded="false" aria-controls="account-menu" aria-label="Account menu" data-corn="account-button">
130
+ <span id="account-initial" class="hx-avatar" aria-hidden="true"></span>
131
+ <svg class="hx-account-caret" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 6l4 4 4-4" /></svg>
132
+ </button>
156
133
 
157
- <!-- Light, dark or the system's (theme.js): steps through them; its label says which is on -->
158
- <button type="button" id="theme-toggle-btn" class="hx-btn hx-btn--icon" data-action="cycle-theme" aria-label="Theme: follows the system. Change theme" title="Theme: follows the system" data-corn="theme-toggle" data-corn-kind="icon">
159
- <svg class="hx-theme-icon" viewBox="0 0 16 16" width="15" height="15" aria-hidden="true" focusable="false">
160
- <!-- system: half a disc; light: a sun; dark: a moon (theme.js shows the one for the choice) -->
161
- <g data-icon="system"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.6" /><path d="M8 2a6 6 0 0 1 0 12z" fill="currentColor" /></g>
162
- <g data-icon="light" hidden><circle cx="8" cy="8" r="3" fill="currentColor" /><path d="M8 1v2M8 13v2M1 8h2M13 8h2M3 3l1.4 1.4M11.6 11.6 13 13M3 13l1.4-1.4M11.6 4.4 13 3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></g>
163
- <g data-icon="dark" hidden><path d="M13.5 9.6A5.8 5.8 0 0 1 6.4 2.5a5.8 5.8 0 1 0 7.1 7.1z" fill="currentColor" /></g>
164
- </svg>
165
- </button>
134
+ <div id="account-menu" class="hx-menu hx-account-menu glass" hidden data-corn="account-menu">
135
+ <p id="account-who" class="hx-account-who" hidden></p>
166
136
 
167
- <!-- The named themes of the config (`theme.names`): filled and shown by explorer/theme-names.js; hidden when there are none -->
168
- <select id="theme-name-select" class="hx-forge-select" style="width:auto;max-width:9rem" aria-label="Theme" title="Theme" data-corn="theme-picker" hidden></select>
137
+ <div class="hx-account-row">
138
+ <span id="theme-label" class="hx-account-label">Theme</span>
139
+ <!-- System, Dark or Light (theme.js keeps aria-pressed) -->
140
+ <div class="hx-account-seg" role="group" aria-labelledby="theme-label" data-corn="theme-toggle">
141
+ <button type="button" class="hx-account-seg-btn" data-action="set-theme" data-choice="system" aria-pressed="true">System</button>
142
+ <button type="button" class="hx-account-seg-btn" data-action="set-theme" data-choice="dark" aria-pressed="false">Dark</button>
143
+ <button type="button" class="hx-account-seg-btn" data-action="set-theme" data-choice="light" aria-pressed="false">Light</button>
144
+ </div>
145
+ </div>
146
+ <!-- The named themes of the config (`theme.names`): filled and shown by explorer/theme-names.js; hidden when there are none -->
147
+ <select id="theme-name-select" class="hx-account-select" aria-label="Named theme" title="Named theme" data-corn="theme-picker" hidden></select>
148
+
149
+ <button type="button" id="freeform-toggle-btn" class="hx-account-item" role="switch" aria-checked="false" data-action="toggle-freeform" title="Drag nodes anywhere, instead of the orbit that clusters them by parent" data-corn="layout-toggle">
150
+ <span>Freeform layout</span>
151
+ <span class="hx-switch" aria-hidden="true"></span>
152
+ </button>
153
+ <button type="button" id="reset-positions-btn" class="hx-account-item hx-account-item--sub" data-action="reset-positions" title="Put the dragged nodes back in their orbit" hidden data-corn-kind="quiet">Reset positions</button>
154
+
155
+ <!-- Review tokens (explorer/review-tokens.js): shown only when somebody is signed in to a forge -->
156
+ <button type="button" id="tokens-btn" class="hx-account-item" aria-haspopup="dialog" aria-expanded="false" aria-controls="tokens-dialog" title="Review tokens: let a script or a chat bot approve or send back a proposal as you" hidden data-corn="tokens-button">Review tokens</button>
157
+
158
+ <!-- Proposals: what a change would add, change and remove, drawn on the map (proposal.js). Until they are the Work panel's Specs tab, the list opens here -->
159
+ <div id="proposal-wrap">
160
+ <button type="button" id="proposal-btn" class="hx-account-item" data-action="toggle-proposals-menu" aria-haspopup="true" aria-expanded="false" title="Open a proposal: what a change would add, change and remove" data-corn="proposals-button"><span data-corn-string="proposals">Proposals</span><span class="hx-faint" aria-hidden="true">▾</span></button>
161
+ <div id="proposal-menu" class="hx-menu hx-menu--proposals" hidden data-corn="proposals-menu"></div>
162
+ </div>
169
163
 
170
- <!-- The config's links (cornfield.config.js `links`), filled by explorer/plugins.js -->
171
- <span id="cf-links" class="hx-links" data-corn="links"></span>
164
+ <!-- The config's links (cornfield.config.js `links`), the forge and Docs, then Sign out: filled by explorer/plugins.js -->
165
+ <div id="cf-links" class="hx-links" data-corn="links"></div>
166
+ <p id="cf-powered" class="hx-account-foot" data-corn="powered-by"></p>
167
+ </div>
168
+ </div>
172
169
  </div>
173
170
  </header>
174
171
 
@@ -321,40 +318,28 @@
321
318
  <aside id="spec-drawer" class="hx-drawer glass" aria-label="Node details" inert data-corn="node-panel">
322
319
  <div class="hx-drawer-body">
323
320
  <div class="hx-drawer-head">
324
- <span class="hx-drawer-title-wrap">
325
- <span id="drawer-badge" class="hx-badge" data-corn="badge">ATOM</span>
321
+ <div class="hx-drawer-id">
322
+ <p class="hx-kicker"><span id="drawer-badge" data-corn="badge">Atom</span><span id="drawer-host"></span><span id="drawer-diff" class="hx-diffpill" hidden></span></p>
326
323
  <h2 id="drawer-title" class="hx-drawer-title">&lt;pop-button&gt;</h2>
327
- </span>
324
+ </div>
328
325
  <button type="button" class="hx-close" data-action="close-drawer" aria-label="Close" data-corn-kind="icon">✕</button>
329
326
  </div>
330
327
 
331
- <p id="drawer-description" class="hx-faint hx-lead"></p>
328
+ <p id="drawer-description" class="hx-lead" hidden></p>
332
329
 
333
330
  <div class="hx-block">
334
- <h3 class="hx-block-title" data-corn-string="propsTitle">Properties &amp; Attributes</h3>
335
- <div id="drawer-props-list" class="hx-props"></div>
336
- </div>
337
-
338
- <div class="hx-block">
339
- <h3 class="hx-block-title" data-corn-string="detailsTitle">Details</h3>
340
331
  <div id="drawer-meta-list" class="hx-meta"></div>
341
332
  </div>
342
333
  </div>
343
334
 
344
335
  <div class="hx-drawer-foot">
345
- <a id="drawer-open-btn" class="hx-open" href="#" target="_blank" rel="noreferrer">Open ↗</a>
346
- <button type="button" class="hx-btn hx-btn--copy" data-action="copy-spec" data-corn-string="copySpec">Copy Spec</button>
336
+ <a id="drawer-open-btn" class="hx-open" href="#" target="_blank" rel="noreferrer" hidden>Open route ↗</a>
337
+ <button type="button" id="drawer-run-btn" class="hx-btn hx-foot-btn" data-action="start-run" data-corn-string="startRun" hidden>Start a run</button>
338
+ <button type="button" class="hx-btn hx-btn--quiet hx-foot-btn" data-action="copy-spec" data-corn-string="copySpec">Copy Spec</button>
347
339
  </div>
348
340
  </aside>
349
341
  </div>
350
342
 
351
- <!-- Mobile zoom and fit, within thumb reach -->
352
- <div class="hx-mobile-zoom glass hx-only-mobile" data-corn="zoom">
353
- <button type="button" class="hx-zoom-btn" data-action="zoom-in" aria-label="Zoom In" data-corn-kind="icon">+</button>
354
- <button type="button" class="hx-zoom-btn" data-action="zoom-out" aria-label="Zoom Out" data-corn-kind="icon">−</button>
355
- <button type="button" class="hx-zoom-btn hx-zoom-btn--accent" data-action="fit" title="Fit to Screen" aria-label="Fit View" data-corn-kind="icon">⛶</button>
356
- </div>
357
-
358
343
  <div class="hx-hint glass" data-corn="hint">
359
344
  <span class="hx-accent" aria-hidden="true">👆</span>
360
345
  <span id="instruction-badge-text">Tap node to inspect live spec</span>
@@ -13,7 +13,8 @@
13
13
  * - Enter in the search box selects the first visible match;
14
14
  * - the panel: Escape inside it closes it and gives the focus back to the map; it is `inert` while closed
15
15
  * (panels.js), so its buttons are never tabbed to off screen;
16
- * - the Layers menu says whether it is open (`aria-expanded`), and Escape closes it, back on its button.
16
+ * - the Layers menu says whether it is open (`aria-expanded`), and Escape closes it, back on its button;
17
+ * - `/` goes to the search (anywhere but in a field): the box on a desktop, the search bar on a phone.
17
18
  */
18
19
 
19
20
  import { state, touchScene } from './state.js';
@@ -158,8 +159,27 @@ function onSearchKey(e) {
158
159
  land(hit, order);
159
160
  }
160
161
 
162
+ /** Whether the key went to something that takes typing */
163
+ const typing = (el) => !!el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));
164
+
165
+ /** `/` goes to the search box, or to the phone's search bar where the box is not shown (opening the bar if it is shut) */
166
+ function goToSearch() {
167
+ const input = $('node-search');
168
+ const shown = input && input.closest('.hx-search') && window.getComputedStyle(input.closest('.hx-search')).display !== 'none';
169
+ if (shown) { input.focus(); input.select(); return; }
170
+ const bar = $('mobile-search-bar');
171
+ if (bar && !bar.hidden) { $('mobile-node-search').focus(); return; }
172
+ const open = $('mobile-search-toggle');
173
+ if (open) open.click();
174
+ }
175
+
161
176
  /** Escape with the Layers menu open closes it, and its button has the focus again */
162
177
  function onDocumentKey(e) {
178
+ if (e.key === '/' && !e.ctrlKey && !e.metaKey && !e.altKey && !typing(e.target) && !document.querySelector('[data-corn="dialog-scrim"]:not([hidden]), .hx-mockup-dialog')) {
179
+ e.preventDefault();
180
+ goToSearch();
181
+ return;
182
+ }
163
183
  if (e.key !== 'Escape') return;
164
184
  const menu = $('legend-dropdown');
165
185
  if (!menu || menu.hidden) return;
@@ -62,7 +62,16 @@ export function closeLegendMenu() {
62
62
  setLegendMenu(false);
63
63
  }
64
64
 
65
+ /** The chip says how many layers are on: " · 13 of 20" */
66
+ function paintCount() {
67
+ const el = document.getElementById('layers-count');
68
+ if (!el) return;
69
+ const on = LAYER_DEFS.filter((l) => state.activeLayers[l.key] !== false).length;
70
+ el.textContent = ` · ${on} of ${LAYER_DEFS.length}`;
71
+ }
72
+
65
73
  export function renderLayerToggles() {
74
+ paintCount();
66
75
  const container = document.getElementById('layer-toggles-container');
67
76
  if (!container) return;
68
77
 
package/explorer/main.js CHANGED
@@ -24,11 +24,11 @@
24
24
  */
25
25
 
26
26
  import { state, nodeById, touchScene } from './state.js';
27
- import { render, resize, zoomBy, fitGraphToViewport, fitPadding, isNodeVisible, setRenderer, getRenderer, ensureFlowLoop, renderNow, holdFrames } from './render.js';
27
+ import { render, resize, fitGraphToViewport, fitPadding, isNodeVisible, setRenderer, getRenderer, ensureFlowLoop, renderNow, holdFrames } from './render.js';
28
28
  import { createRenderer } from './renderer.js';
29
29
  import { clearFreeformPositions, layoutOrbit, loadFreeformPositions } from './layout.js';
30
30
  import { closeLegendMenu, toggleAllLayers, toggleLayer, toggleLegendMenu } from './layers.js';
31
- import { closeDrawer, copySpec, selectNode } from './panels.js';
31
+ import { closeDrawer, copySpec, selectNode, startRun } from './panels.js';
32
32
  import { initScenarioUi, maybeStartDemo, playOutage } from './scenario-ui.js';
33
33
  import { initSheets } from './sheets.js';
34
34
  import { loadTopology, setView, syncViewUi } from './view.js';
@@ -46,7 +46,8 @@ import { initKeyboard } from './keyboard.js';
46
46
  import { initForgePanel } from './forge-panel.js';
47
47
  import { initReviewTokens } from './review-tokens.js';
48
48
  import { loadClientConfig, loadSources, applyBranding } from './plugins.js';
49
- import { cycleTheme, initTheme } from './theme.js';
49
+ import { initTheme, setThemeChoice } from './theme.js';
50
+ import { initAccountMenu } from './account-menu.js';
50
51
  import { applyMapTheme, onMapStyleChange, watchMapStyle } from './map-style.js';
51
52
 
52
53
  const $ = (id) => document.getElementById(id);
@@ -56,9 +57,7 @@ const $ = (id) => document.getElementById(id);
56
57
  // ---------------------------------------------------------------------------
57
58
  function updateFreeformUI() {
58
59
  const on = state.isFreeform;
59
- $('freeform-toggle-icon').textContent = on ? '🔓' : '🔒';
60
- $('freeform-toggle-label').textContent = on ? 'Freeform' : 'Orbit';
61
- $('freeform-toggle-btn').classList.toggle('hx-btn--active', on);
60
+ $('freeform-toggle-btn').setAttribute('aria-checked', String(on));
62
61
  $('reset-positions-btn').hidden = !on;
63
62
  syncViewUi();
64
63
  state.canvas.style.cursor = on ? 'default' : 'grab';
@@ -117,14 +116,16 @@ function toggleMobileSearch(open) {
117
116
  const ACTIONS = {
118
117
  'reset-view': () => fitGraphToViewport(fitPadding()),
119
118
  'fit': () => fitGraphToViewport(fitPadding()),
120
- 'zoom-in': () => zoomBy(1.25),
121
- 'zoom-out': () => zoomBy(0.8),
122
119
  'toggle-layers-menu': () => toggleLegendMenu(),
123
120
  'layers-all': () => toggleAllLayers(true),
124
121
  'layers-none': () => toggleAllLayers(false),
125
122
  'toggle-layer': (el) => toggleLayer(el.dataset.layer),
126
123
  'toggle-freeform': () => toggleFreeformMode(),
127
124
  'reset-positions': () => resetFreeformPositions(),
125
+ 'preset-map': () => {
126
+ closeDrawer();
127
+ setView('orbit');
128
+ },
128
129
  'preset-dataflow': () => {
129
130
  closeDrawer();
130
131
  setView(state.view === 'dataflow' ? 'orbit' : 'dataflow');
@@ -134,10 +135,11 @@ const ACTIONS = {
134
135
  'clear-search': () => handleSearch(''),
135
136
  'close-drawer': () => closeDrawer(),
136
137
  'copy-spec': (el) => copySpec(el),
138
+ 'start-run': () => startRun(),
137
139
  'select-node': (el) => selectNode(nodeById(el.dataset.id)),
138
140
  'play-outage': (el) => playOutage(el.dataset.id), // the cloud panel's Play button (spec 0031 section 8)
139
141
  'retry': () => loadTopology(),
140
- 'cycle-theme': () => cycleTheme(),
142
+ 'set-theme': (el) => setThemeChoice(el.dataset.choice),
141
143
  };
142
144
 
143
145
  document.addEventListener('click', (e) => {
@@ -198,6 +200,7 @@ setRenderer(createRenderer(state.canvas)); // WebGL2, or Canvas 2D when it is mi
198
200
  loadFreeformPositions();
199
201
  bindCanvasInput();
200
202
  initKeyboard(); // the map, the panel, the search and the Layers menu by keyboard (keyboard.js)
203
+ initAccountMenu(); // the one menu at the right of the header (account-menu.js)
201
204
  initSheets();
202
205
  initScenarioUi();
203
206
  window.addEventListener('resize', resize);
@@ -61,7 +61,7 @@ export function mockupsSectionHtml(items) {
61
61
  <span class="hx-mockup-state hx-mockup-state--${escHtml(m.state)}" data-corn="state-pill"${cornStateAttr(m.state)}>${escHtml(stateWords(m.state))}</span>
62
62
  </li>`).join('');
63
63
  return `<div class="hx-sec hx-mockups" data-mockups data-corn="section">
64
- <strong class="hx-strong" id="hx-mockups-h">${items.length === 1 ? 'Mockup' : 'Mockups'}</strong>
64
+ <h3 class="hx-sec-title" id="hx-mockups-h">${items.length === 1 ? 'Mockup' : 'Mockups'}</h3>
65
65
  <ul class="hx-mockup-list" aria-labelledby="hx-mockups-h">${rows}</ul>
66
66
  </div>`;
67
67
  }