cornfield 0.30.0 → 0.32.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.
@@ -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). Only without the Work panel (no forge, or no sign-in): with it, its Specs tab lists them and forge-panel.js hides this -->
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
 
@@ -233,24 +230,27 @@
233
230
  </div>
234
231
  </section>
235
232
 
236
- <!-- Issues and pull requests (forge-panel.js): a slide-over from the left on desktop, a bottom sheet on a phone; hidden and inert until the config names a forge -->
237
- <aside id="forge-panel" class="hx-forge glass" aria-label="Issues and pull requests" inert hidden data-corn="forge-panel">
238
- <div class="hx-forge-body">
233
+ <!-- The Work panel (forge-panel.js): Specs, PRs, Issues, Threads, Runs and Deploys, in the order of the loop. A slide-over from the left on desktop, a bottom sheet on a phone; hidden and inert until the config names a forge. `forge-panel` on the inner box is the old name of the hook, kept for one release (docs/theming.md) -->
234
+ <aside id="forge-panel" class="hx-forge glass" aria-label="Work" inert hidden data-corn="work-panel">
235
+ <div class="hx-forge-body" data-corn="forge-panel">
239
236
  <div class="hx-forge-head">
240
- <h2 id="forge-title" class="hx-drawer-title" tabindex="-1">Issues and pull requests</h2>
237
+ <h2 id="forge-title" class="hx-drawer-title" tabindex="-1">Work</h2>
241
238
  <button type="button" class="hx-btn hx-btn--quiet" data-action="refresh-forge" title="Ask the forge again" data-corn-kind="quiet">Refresh</button>
242
239
  <button type="button" class="hx-close" data-action="close-forge" aria-label="Close" data-corn-kind="icon">✕</button>
243
240
  </div>
244
- <p id="forge-status" class="hx-forge-status hx-faint"></p>
245
- <div class="hx-forge-controls">
246
- <div class="hx-forge-tabs" role="group" aria-label="Show" data-corn="tabs">
247
- <button type="button" class="hx-forge-tab" data-forge-kind="pulls" aria-pressed="true" data-corn="tab" data-corn-string="tabPulls">Pull requests</button>
248
- <button type="button" class="hx-forge-tab" data-forge-kind="issues" aria-pressed="false" data-corn="tab" data-corn-string="tabIssues">Issues</button>
249
- <button type="button" class="hx-forge-tab" data-forge-kind="threads" aria-pressed="false" title="Ideas and spec conversations, with the nodes they mention" data-corn="tab" data-corn-string="tabThreads">Threads</button>
250
- <button type="button" class="hx-forge-tab" data-forge-kind="deploys" aria-pressed="false" data-corn="tab" data-corn-string="tabDeploys">Deploys</button>
251
- <button type="button" class="hx-forge-tab" data-forge-kind="work" aria-pressed="false" title="Work grouped by issue and proposal, agent-made work marked" data-corn="tab" data-corn-string="tabAgents">Agents</button>
252
- <button type="button" class="hx-forge-tab" data-forge-kind="notes" aria-pressed="false" data-corn="tab" data-corn-string="tabNotes">Release notes</button>
253
- </div>
241
+ <div class="hx-forge-tabs" role="group" aria-label="Show" data-corn="tabs">
242
+ <button type="button" class="hx-forge-tab" data-forge-kind="specs" aria-pressed="true" title="The proposals: what a change would add, change and remove" data-corn="tab"><span data-corn-string="tabSpecs">Specs</span><span class="hx-forge-count" hidden></span></button>
243
+ <button type="button" class="hx-forge-tab" data-forge-kind="pulls" aria-pressed="false" title="Pull requests" data-corn="tab"><span data-corn-string="tabPulls">PRs</span><span class="hx-forge-count" hidden></span></button>
244
+ <button type="button" class="hx-forge-tab" data-forge-kind="issues" aria-pressed="false" data-corn="tab"><span data-corn-string="tabIssues">Issues</span><span class="hx-forge-count" hidden></span></button>
245
+ <button type="button" class="hx-forge-tab" data-forge-kind="threads" aria-pressed="false" title="Ideas and spec conversations, with the nodes they mention" data-corn="tab"><span data-corn-string="tabThreads">Threads</span><span class="hx-forge-count" hidden></span></button>
246
+ <button type="button" class="hx-forge-tab" data-forge-kind="work" aria-pressed="false" title="Agent runs, and the work grouped by issue and proposal with agent-made work marked" data-corn="tab"><span data-corn-string="tabRuns">Runs</span><span class="hx-forge-count" hidden></span></button>
247
+ <button type="button" class="hx-forge-tab" data-forge-kind="deploys" aria-pressed="false" data-corn="tab"><span data-corn-string="tabDeploys">Deploys</span><span class="hx-forge-count" hidden></span></button>
248
+ </div>
249
+ <div id="forge-bar" class="hx-forge-bar">
250
+ <p id="forge-status" class="hx-forge-status hx-faint"></p>
251
+ <button type="button" id="forge-filter-chip" class="hx-forge-chip" data-action="toggle-filters" aria-expanded="false" aria-controls="forge-filter-box" hidden>Filter<span class="hx-forge-count" hidden></span></button>
252
+ </div>
253
+ <div id="forge-filter-box" class="hx-forge-controls" hidden>
254
254
  <div id="forge-work-filters" class="hx-forge-work-filters" hidden>
255
255
  <label class="hx-forge-toggle"><input type="checkbox" id="forge-work-agents" /> Agent-made only</label>
256
256
  <label class="hx-forge-toggle"><input type="checkbox" id="forge-work-finished" /> Include merged and closed</label>
@@ -264,25 +264,10 @@
264
264
  </div>
265
265
  <p id="forge-notice" class="hx-forge-notice" hidden data-corn="notice"></p>
266
266
  <p id="forge-act-note" class="hx-forge-notice" hidden data-corn="notice"></p>
267
- <!-- New idea (forge-panel.js): opens an issue with the threads label as you, on the forge; the thread itself lives there -->
268
- <section id="forge-idea" class="hx-forge-notes" aria-label="New idea" data-corn-string-aria-label="newIdea" hidden>
269
- <div class="hx-forge-actions">
270
- <button type="button" id="idea-open" class="hx-btn hx-btn--approve" data-action="idea-open" aria-expanded="false" aria-controls="idea-form" data-corn-kind="approve"><span data-corn-string="newIdea">New idea</span> …</button>
271
- </div>
272
- <p id="idea-message" class="hx-forge-msg" role="status" hidden data-corn="message"></p>
273
- <div id="idea-form" class="hx-forge-confirm" role="group" aria-labelledby="idea-form-title" hidden>
274
- <h3 id="idea-form-title" class="hx-forge-confirm-title" data-corn-string="newIdea">New idea</h3>
275
- <p id="idea-words"></p>
276
- <label class="hx-forge-field" data-corn="field">Title<input type="text" id="idea-title" class="hx-forge-input" maxlength="256" autocomplete="off" /></label>
277
- <label class="hx-forge-field" data-corn="field">What is the idea?<textarea id="idea-body" class="hx-forge-preview hx-thread-compose" rows="6" maxlength="20000" spellcheck="true"></textarea></label>
278
- <div class="hx-forge-actions">
279
- <button type="button" id="idea-send" class="hx-btn hx-btn--approve" data-action="idea-send" data-corn-kind="approve">Open the idea</button>
280
- <button type="button" class="hx-btn hx-btn--quiet" data-action="idea-cancel" data-corn-kind="quiet">Cancel</button>
281
- </div>
282
- </div>
283
- </section>
284
- <!-- Release notes (forge-panel.js): the pull requests merged since a tag, grouped by the map; copy them, or have the forge keep them as a draft release -->
267
+ <!-- Release notes (forge-panel.js), reached from the PRs list: the pull requests merged since a tag, grouped by the map; copy them, or have the forge keep them as a draft release -->
285
268
  <section id="forge-notes" class="hx-forge-notes" aria-label="Release notes" hidden>
269
+ <button type="button" class="hx-forge-back" data-action="close-notes"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="M10 3L5 8l5 5"/></svg><span class="hx-forge-back-text">All pull requests</span></button>
270
+ <h3 id="notes-title" class="hx-forge-notes-title" tabindex="-1">Release notes</h3>
286
271
  <label class="hx-forge-field" data-corn="field">Since tag<select id="notes-since" class="hx-forge-select"></select></label>
287
272
  <label class="hx-forge-field" data-corn="field">Draft, in Markdown<textarea id="notes-preview" class="hx-forge-preview" rows="14" readonly spellcheck="false"></textarea></label>
288
273
  <div class="hx-forge-actions">
@@ -300,7 +285,7 @@
300
285
  </div>
301
286
  </div>
302
287
  </section>
303
- <!-- Agent runs (forge-panel.js, runs-model.js): shown on the Agents tab; each run's state, what it is about, links, and Stop -->
288
+ <!-- Agent runs (forge-panel.js, runs-model.js): shown on the Runs tab; each run's state, what it is about, links, and Stop -->
304
289
  <section id="forge-runs" class="hx-forge-runs" aria-labelledby="forge-runs-title" hidden>
305
290
  <h3 id="forge-runs-title" class="hx-forge-runs-title">Agent runs</h3>
306
291
  <p id="forge-runs-status" class="hx-forge-meta hx-faint"></p>
@@ -313,6 +298,27 @@
313
298
  </section>
314
299
  <section id="forge-detail" class="hx-forge-detail" aria-label="Selected pull request" hidden></section>
315
300
  <ul id="forge-list" class="hx-forge-list" aria-label="Results"></ul>
301
+ <!-- The foot of the list: Release notes… on the PRs list, New idea on Specs (and Threads) -->
302
+ <div id="forge-foot" class="hx-forge-foot">
303
+ <button type="button" id="notes-open" class="hx-btn" data-action="open-notes" hidden>Release notes …</button>
304
+ <!-- New idea (forge-panel.js): opens an issue with the threads label as you, on the forge; the thread itself lives there -->
305
+ <section id="forge-idea" class="hx-forge-notes" aria-label="New idea" data-corn-string-aria-label="newIdea" hidden>
306
+ <div class="hx-forge-actions">
307
+ <button type="button" id="idea-open" class="hx-btn hx-btn--approve" data-action="idea-open" aria-expanded="false" aria-controls="idea-form" data-corn-kind="approve"><span data-corn-string="newIdea">New idea</span> …</button>
308
+ </div>
309
+ <p id="idea-message" class="hx-forge-msg" role="status" hidden data-corn="message"></p>
310
+ <div id="idea-form" class="hx-forge-confirm" role="group" aria-labelledby="idea-form-title" hidden>
311
+ <h3 id="idea-form-title" class="hx-forge-confirm-title" data-corn-string="newIdea">New idea</h3>
312
+ <p id="idea-words"></p>
313
+ <label class="hx-forge-field" data-corn="field">Title<input type="text" id="idea-title" class="hx-forge-input" maxlength="256" autocomplete="off" /></label>
314
+ <label class="hx-forge-field" data-corn="field">What is the idea?<textarea id="idea-body" class="hx-forge-preview hx-thread-compose" rows="6" maxlength="20000" spellcheck="true"></textarea></label>
315
+ <div class="hx-forge-actions">
316
+ <button type="button" id="idea-send" class="hx-btn hx-btn--approve" data-action="idea-send" data-corn-kind="approve">Open the idea</button>
317
+ <button type="button" class="hx-btn hx-btn--quiet" data-action="idea-cancel" data-corn-kind="quiet">Cancel</button>
318
+ </div>
319
+ </div>
320
+ </section>
321
+ </div>
316
322
  <p id="forge-rate" class="hx-forge-rate hx-faint"></p>
317
323
  </div>
318
324
  </aside>
@@ -343,13 +349,6 @@
343
349
  </aside>
344
350
  </div>
345
351
 
346
- <!-- Mobile zoom and fit, within thumb reach -->
347
- <div class="hx-mobile-zoom glass hx-only-mobile" data-corn="zoom">
348
- <button type="button" class="hx-zoom-btn" data-action="zoom-in" aria-label="Zoom In" data-corn-kind="icon">+</button>
349
- <button type="button" class="hx-zoom-btn" data-action="zoom-out" aria-label="Zoom Out" data-corn-kind="icon">−</button>
350
- <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>
351
- </div>
352
-
353
352
  <div class="hx-hint glass" data-corn="hint">
354
353
  <span class="hx-accent" aria-hidden="true">👆</span>
355
354
  <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,7 +24,7 @@
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';
@@ -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');
@@ -138,7 +139,7 @@ const ACTIONS = {
138
139
  'select-node': (el) => selectNode(nodeById(el.dataset.id)),
139
140
  'play-outage': (el) => playOutage(el.dataset.id), // the cloud panel's Play button (spec 0031 section 8)
140
141
  'retry': () => loadTopology(),
141
- 'cycle-theme': () => cycleTheme(),
142
+ 'set-theme': (el) => setThemeChoice(el.dataset.choice),
142
143
  };
143
144
 
144
145
  document.addEventListener('click', (e) => {
@@ -199,6 +200,7 @@ setRenderer(createRenderer(state.canvas)); // WebGL2, or Canvas 2D when it is mi
199
200
  loadFreeformPositions();
200
201
  bindCanvasInput();
201
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)
202
204
  initSheets();
203
205
  initScenarioUi();
204
206
  window.addEventListener('resize', resize);
@@ -69,13 +69,32 @@ function applyBrand(doc, brand, title) {
69
69
  if (heading && brand.appName) heading.textContent = `${brand.appName}: the map`;
70
70
  }
71
71
 
72
- /** The small "powered by cornfield" link that stays in the header when a repo brands cornfield */
73
- function poweredBy(brand) {
74
- if (!brand || typeof brand.poweredBy !== 'string' || !/^https:\/\//.test(brand.poweredBy)) return '';
75
- return `<a class="hx-btn hx-btn--quiet" data-corn="powered-by" href="${escHtml(brand.poweredBy)}" target="_blank" rel="noreferrer">${escHtml(t('poweredBy'))}</a>`;
72
+ /** The footer line of the account menu: "powered by cornfield 0.14.0". A link to cornfield when the brand names where it leads */
73
+ function paintFooter(doc, config) {
74
+ const foot = doc.getElementById('cf-powered');
75
+ if (!foot) return;
76
+ const words = [t('poweredBy'), typeof config.version === 'string' ? config.version : ''].filter(Boolean).join(' ');
77
+ const home = config.brand && typeof config.brand.poweredBy === 'string' && /^https:\/\//.test(config.brand.poweredBy) ? config.brand.poweredBy : '';
78
+ foot.innerHTML = home ? `<a href="${escHtml(home)}" target="_blank" rel="noreferrer">${escHtml(words)}</a>` : escHtml(words);
76
79
  }
77
80
 
78
- /** Puts the repo's title, brand and links in the header, and Sign out when the server says who is signed in */
81
+ const FORGE_NAMES = { github: 'GitHub', forgejo: 'Forgejo' };
82
+
83
+ /** The link rows of the account menu: the config's links, the forge (unless a link already leads there), and cornfield's docs */
84
+ function linkRows(config) {
85
+ const rows = (Array.isArray(config.links) ? config.links : [])
86
+ .filter((l) => l && typeof l.label === 'string' && /^(https?:\/\/|\/)/.test(String(l.href)))
87
+ .map((l) => ({ label: l.label, href: l.href }));
88
+ const forge = config.forge;
89
+ if (forge && typeof forge.url === 'string' && /^https:\/\//.test(forge.url) && typeof forge.repo === 'string') {
90
+ const href = `${forge.url.replace(/\/+$/, '')}/${forge.repo}`;
91
+ if (!rows.some((r) => r.href === href || String(r.href).startsWith(`${href}/`))) rows.push({ label: FORGE_NAMES[forge.type] || 'Forge', href });
92
+ }
93
+ if (typeof config.docs === 'string' && /^https:\/\//.test(config.docs)) rows.push({ label: 'Docs', href: config.docs });
94
+ return rows.map((r) => `<a class="hx-account-item" href="${escHtml(r.href)}" target="_blank" rel="noreferrer" data-corn="link"><span>${escHtml(r.label)}</span><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M6 3h7v7M13 3L7 9" /></svg></a>`).join('');
95
+ }
96
+
97
+ /** Puts the repo's title, brand and links in the header, and who is signed in, with Sign out, in the account menu */
79
98
  export function applyBranding(doc, config) {
80
99
  if (!config || !doc) return;
81
100
  // The repo's words (core/strings.js) first: what is built below reads them, and the static markup is filled now
@@ -87,19 +106,30 @@ export function applyBranding(doc, config) {
87
106
  if (heading && config.title) heading.textContent = `${config.title}: the map`;
88
107
  if (config.brand) applyBrand(doc, config.brand, config.title);
89
108
  initThemePicker(doc, config.theme);
109
+ paintAccount(doc, config);
110
+ }
111
+
112
+ /** The account button's initial, the line saying who is signed in, the links, Sign out and the footer */
113
+ function paintAccount(doc, config) {
114
+ const login = config.signIn && typeof config.signIn.login === 'string' ? config.signIn.login : '';
115
+ const initial = doc.getElementById('account-initial');
116
+ if (initial) initial.textContent = login ? [...login][0].toUpperCase() : '';
117
+ const btn = doc.getElementById('account-btn');
118
+ if (btn) btn.setAttribute('aria-label', login ? `Account menu, signed in as ${login}` : 'Account menu');
119
+ const who = doc.getElementById('account-who');
120
+ if (who) {
121
+ who.hidden = !login;
122
+ // Only a maintainer gets past the sign-in (server/auth.js), so whoever is here is one
123
+ who.textContent = login ? `${login} · maintainer` : '';
124
+ }
125
+ paintFooter(doc, config);
90
126
  const links = doc.getElementById('cf-links');
91
127
  if (!links) return;
92
- const html = Array.isArray(config.links) ? config.links
93
- .filter((l) => l && typeof l.label === 'string' && /^(https?:\/\/|\/)/.test(String(l.href)))
94
- .map((l) => `<a class="hx-chip-link hx-chip-link--indigo hx-only-xl" href="${escHtml(l.href)}" target="_blank" rel="noreferrer" data-corn="link"><span class="hx-dot-sm"></span> ${escHtml(l.label)}</a>`)
95
- .join('') : '';
96
- // A plain form: signing out is a same-origin POST (server/auth.js), no script needed. On a narrow phone only its icon
97
- // shows (explorer.css); the words stay in the button for a screen reader
98
- const signOut = config.signIn && typeof config.signIn.login === 'string'
99
- ? `<form class="cf-sign-out" method="post" action="/auth/sign-out" data-corn="sign-out"><button type="submit" class="hx-btn hx-btn--quiet" title="Signed in as ${escHtml(config.signIn.login)}" data-corn-kind="quiet"><span class="cf-sign-out-icon" aria-hidden="true">⎋</span><span class="cf-sign-out-text">${escHtml(t('signOut'))}</span></button></form>`
128
+ // A plain form: signing out is a same-origin POST (server/auth.js), no script needed
129
+ const signOut = login
130
+ ? `<form class="cf-sign-out" method="post" action="/auth/sign-out" data-corn="sign-out"><button type="submit" class="hx-account-item" title="Signed in as ${escHtml(login)}" data-corn-kind="quiet">${escHtml(t('signOut'))}</button></form>`
100
131
  : '';
101
- const powered = poweredBy(config.brand);
102
- if (html || powered || signOut) links.innerHTML = html + powered + signOut;
132
+ links.innerHTML = linkRows(config) + signOut;
103
133
  }
104
134
 
105
135
  /**