cornfield 0.30.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.
package/core/strings.js CHANGED
@@ -14,10 +14,10 @@
14
14
  export const STRINGS = Object.freeze({
15
15
  // The header
16
16
  layers: 'Layers',
17
- dataFlow: 'Data flow',
17
+ dataFlow: 'Flow',
18
18
  house: 'House',
19
19
  proposals: 'Proposals',
20
- issuesAndPrs: 'Issues & PRs',
20
+ issuesAndPrs: 'Work',
21
21
  searchPlaceholder: 'Search...',
22
22
  signOut: 'Sign out',
23
23
  poweredBy: 'powered by cornfield',
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @module explorer/account-menu
3
+ *
4
+ * The one menu at the right of the header (`#account-btn` and `#account-menu`): who is signed in, Theme, Freeform layout, Review tokens,
5
+ * Proposals, the links, Sign out, and what powers it. A disclosure: `aria-expanded` says whether it is open, Escape closes it with
6
+ * the focus back on the button, and a click outside it or a Tab out of it closes it too. What fills it is in plugins.js (the person, the links,
7
+ * the footer), theme.js (the Theme segment), main.js (Freeform), proposal.js (the list of proposals) and review-tokens.js.
8
+ */
9
+
10
+ const $ = (id) => document.getElementById(id);
11
+
12
+ /** Whether the menu is open */
13
+ export function accountMenuOpen() {
14
+ const menu = $('account-menu');
15
+ return !!menu && !menu.hidden;
16
+ }
17
+
18
+ function set(open) {
19
+ const menu = $('account-menu');
20
+ const btn = $('account-btn');
21
+ if (menu) menu.hidden = !open;
22
+ if (btn) btn.setAttribute('aria-expanded', String(open));
23
+ }
24
+
25
+ /** Opens the menu */
26
+ export function openAccountMenu() {
27
+ set(true);
28
+ }
29
+
30
+ /**
31
+ * Closes the menu
32
+ * @param {{ restoreFocus?: boolean }} [opts] the focus goes back to the button (the default), unless something else takes it (a dialog)
33
+ */
34
+ export function closeAccountMenu({ restoreFocus = true } = {}) {
35
+ if (!accountMenuOpen()) return;
36
+ const had = !!document.activeElement && !!$('account-menu') && $('account-menu').contains(document.activeElement);
37
+ set(false);
38
+ const btn = $('account-btn');
39
+ if (restoreFocus && btn && had) btn.focus();
40
+ }
41
+
42
+ function onClick(e) {
43
+ const btn = $('account-btn');
44
+ const menu = $('account-menu');
45
+ if (!btn || !menu) return;
46
+ const target = e.target;
47
+ if (btn.contains(target)) {
48
+ if (accountMenuOpen()) closeAccountMenu(); else openAccountMenu();
49
+ return;
50
+ }
51
+ if (!accountMenuOpen()) return;
52
+ if (!menu.contains(target)) { closeAccountMenu({ restoreFocus: false }); return; }
53
+ // What opens something of its own takes the focus there; a link or a proposal chosen ends the menu. Theme, Freeform and the list of proposals keep it open
54
+ const item = target.closest ? target.closest('#tokens-btn, [data-action="open-proposal"], a[href], [data-corn="sign-out"]') : null;
55
+ if (!item) return;
56
+ closeAccountMenu({ restoreFocus: !item.matches('#tokens-btn') });
57
+ }
58
+
59
+ function onKey(e) {
60
+ if (e.key !== 'Escape' || !accountMenuOpen()) return;
61
+ e.preventDefault();
62
+ closeAccountMenu();
63
+ }
64
+
65
+ /** Leaving the menu with Tab closes it (focus is not left on a hidden control) */
66
+ function onFocusOut(e) {
67
+ const menu = $('account-menu');
68
+ const btn = $('account-btn');
69
+ if (!accountMenuOpen() || !e.relatedTarget) return;
70
+ if (!menu.contains(e.relatedTarget) && !btn.contains(e.relatedTarget)) closeAccountMenu({ restoreFocus: false });
71
+ }
72
+
73
+ let wired = false;
74
+ /** Wires the button and the menu, once (main.js) */
75
+ export function initAccountMenu() {
76
+ if (wired) return;
77
+ wired = true;
78
+ document.addEventListener('click', onClick);
79
+ document.addEventListener('keydown', onKey);
80
+ const root = $('account-btn') && $('account-btn').parentElement;
81
+ if (root) root.addEventListener('focusout', onFocusOut);
82
+ }
83
+
84
+ /** For tests: wire again on a fresh page */
85
+ export function resetAccountMenuForTests() {
86
+ document.removeEventListener('click', onClick);
87
+ document.removeEventListener('keydown', onKey);
88
+ wired = false;
89
+ }
@@ -42,13 +42,6 @@ h1, h2, h3, p { margin: 0; }
42
42
  -webkit-backdrop-filter: blur(var(--corn-blur));
43
43
  border-bottom: var(--corn-border) solid var(--corn-line);
44
44
  }
45
- .gradient-text {
46
- background: var(--corn-brand-gradient);
47
- -webkit-background-clip: text;
48
- background-clip: text;
49
- -webkit-text-fill-color: transparent;
50
- display: inline-block;
51
- }
52
45
 
53
46
  ::-webkit-scrollbar { width: 5px; height: 5px; }
54
47
  ::-webkit-scrollbar-track { background: transparent; }
@@ -75,32 +68,146 @@ h1, h2, h3, p { margin: 0; }
75
68
  /* Headings and titles take the display family (the same as the body unless a brand sets it) */
76
69
  .hx-title, .hx-drawer-title, .hx-block-title, .hx-menu-title, .hx-confirm-title, .hx-mockup-title { font-family: var(--corn-font-display); }
77
70
 
78
- /* ---- header ------------------------------------------------------------------------------ */
71
+ /* ==== the header (CF-41) ===============================================================================================
72
+ Left to right: the brand, the View switch (Map, Flow, House, Fit), the Layers chip, the live chip; at the right the search,
73
+ the Work toggle and the one account menu (account-menu.js). Everything reads the --corn-* tokens. From 768px it is a desktop
74
+ header; below it is a phone's: Map, Flow, House, a search icon and the account initial, with the Layers chip, the live chip
75
+ and Fit floating on the map (placed from the header's corner). The header has no backdrop-filter of its own: it sits above
76
+ the map, not over it, and one would keep its menus' .glass blur from working (they would show the map through). */
79
77
  .hx-header {
78
+ position: relative;
80
79
  flex: none;
81
80
  height: 56px;
82
81
  display: flex;
83
82
  align-items: center;
84
83
  justify-content: space-between;
85
84
  gap: var(--corn-space-3);
86
- padding: 0 var(--corn-space-3);
85
+ padding: 0 var(--corn-space-4);
87
86
  z-index: 20;
88
- background: color-mix(in srgb, var(--corn-ground) 88%, transparent);
89
- backdrop-filter: blur(var(--corn-blur));
90
- -webkit-backdrop-filter: blur(var(--corn-blur));
87
+ background: var(--corn-surface-1);
91
88
  border-bottom: var(--corn-border) solid var(--corn-line);
92
89
  }
93
90
  .hx-header-left, .hx-header-right { display: flex; align-items: center; gap: var(--corn-space-3); min-width: 0; }
94
- .hx-header-right { flex: none; gap: var(--corn-space-1); }
95
- @media (min-width: 640px) { .hx-header { padding: 0 var(--corn-space-5); } .hx-header-left { gap: var(--corn-space-4); } .hx-header-right { gap: var(--corn-space-3); } }
91
+ .hx-header-right { flex: none; }
92
+ .hx-only-wide { display: none; }
93
+ .hx-only-mobile { display: inline-flex; }
94
+
95
+ /* The brand: logo and wordmark; a click resets the view */
96
+ .hx-brand { display: flex; align-items: center; gap: var(--corn-space-3); flex: none; min-width: 44px; min-height: 44px; padding: 0; border: 0; background: none; }
97
+ .hx-title { font-size: var(--corn-text-base); font-weight: 650; letter-spacing: -0.01em; color: var(--corn-text); }
98
+ .hx-mark { flex: none; }
99
+ .hx-mark-bg { fill: var(--corn-accent); }
100
+ .hx-mark-fg { fill: var(--corn-text-on-accent); }
101
+ .hx-mark-line { fill: none; stroke: var(--corn-text-on-accent); stroke-width: 1.5; }
102
+
103
+ /* The View switch: Map, Flow and House (aria-pressed says which is on), and Fit at its end */
104
+ .hx-view { display: inline-flex; align-items: center; flex: none; padding: var(--corn-space-1); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); }
105
+ .hx-view-btn, .hx-view-fit { display: inline-flex; align-items: center; justify-content: center; height: 28px; border: 0; border-radius: var(--corn-radius-sm); background: transparent; color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 500; white-space: nowrap; }
106
+ .hx-view-btn { padding: 0 var(--corn-space-4); }
107
+ .hx-view-btn:hover, .hx-view-fit:hover { background: var(--corn-surface-3); color: var(--corn-text); }
108
+ .hx-view-btn[aria-pressed="true"] { background: var(--corn-accent); color: var(--corn-text-on-accent); font-weight: 600; }
109
+ .hx-view-fit { width: 28px; margin-left: var(--corn-space-1); border-left: var(--corn-border) solid var(--corn-line); border-radius: 0 var(--corn-radius-sm) var(--corn-radius-sm) 0; color: var(--corn-text-3); }
110
+
111
+ /* The Layers chip: "Layers · 13 of 20" */
112
+ .hx-layers-chip { display: inline-flex; align-items: center; gap: var(--corn-space-1); height: 30px; padding: 0 var(--corn-space-4); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); font-size: var(--corn-text-sm); white-space: nowrap; }
113
+ .hx-layers-chip:hover, .hx-layers-chip[aria-expanded="true"] { background: var(--corn-surface-3); color: var(--corn-text); }
114
+ .hx-layers-count { color: var(--corn-text-3); }
115
+ .hx-layers-chip--dim { border-color: var(--corn-line-soft); }
116
+ .hx-layers-chip--dim, .hx-layers-chip--dim .hx-layers-count { color: var(--corn-text-3); }
117
+
118
+ /* Search: the field with its key hint (a desktop's), an icon on a phone */
119
+ .hx-search { display: none; align-items: center; gap: var(--corn-space-3); width: 260px; min-width: 120px; height: 32px; padding: 0 var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-3); }
120
+ .hx-search:focus-within { border-color: var(--corn-focus); outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
121
+ .hx-search-icon { flex: none; }
122
+ .hx-search-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); outline: none; user-select: text; }
123
+ .hx-search-input::placeholder { color: var(--corn-text-3); }
124
+ .hx-kbd { flex: none; padding: 0 var(--corn-space-1); border-radius: var(--corn-radius-xs); border: var(--corn-border) solid var(--corn-line); font-family: var(--corn-mono); font-size: var(--corn-text-2xs); color: var(--corn-text-3); }
125
+ .hx-search:focus-within .hx-kbd { display: none; }
126
+ .hx-hdr-icon { align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text-2); }
127
+ .hx-hdr-icon:hover { background: var(--corn-surface-3); color: var(--corn-text); }
128
+
129
+ /* The Work toggle: opens the Work panel (forge-panel.js says in the tag which pull request is lit) */
130
+ .hx-work { display: inline-flex; align-items: center; gap: var(--corn-space-2); height: 32px; padding: 0 var(--corn-space-4); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 600; white-space: nowrap; }
131
+ .hx-work:hover { background: var(--corn-surface-3); color: var(--corn-text); }
132
+ .hx-work[aria-expanded="true"] { background: var(--corn-accent); border-color: var(--corn-accent-text); color: var(--corn-text-on-accent); }
133
+ .hx-forge-lit { padding: 0 var(--corn-space-2); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-warn); background: var(--corn-ground); color: var(--corn-warn); font-family: var(--corn-mono); font-size: var(--corn-text-2xs); }
134
+
135
+ /* The account button: the initial of who is signed in (a menu glyph when nobody is) */
136
+ .hx-account-btn { display: inline-flex; align-items: center; gap: var(--corn-space-3); height: 32px; padding: 0 var(--corn-space-2) 0 var(--corn-space-1); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); }
137
+ .hx-account-btn:hover { background: var(--corn-surface-3); color: var(--corn-text); }
138
+ .hx-account-btn[aria-expanded="true"] { border-color: var(--corn-accent-text); }
139
+ .hx-avatar { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--corn-accent); color: var(--corn-text-on-accent); font-size: var(--corn-text-xs); font-weight: 700; }
140
+ .hx-avatar:empty::before { content: "\2630"; }
141
+
142
+ /* The account menu: a panel under the button */
143
+ .hx-menu.hx-account-menu { left: auto; right: 0; display: flex; flex-direction: column; gap: calc(var(--corn-space-1) / 2); width: 264px; padding: var(--corn-space-2); font-size: var(--corn-text-sm); user-select: none; }
144
+ .hx-account-who { padding: var(--corn-space-3) var(--corn-space-4) var(--corn-space-2); color: var(--corn-text-3); font-size: var(--corn-text-sm); overflow-wrap: anywhere; }
145
+ .hx-account-row { display: flex; align-items: center; justify-content: space-between; gap: var(--corn-space-3); padding: var(--corn-space-1) var(--corn-space-4); }
146
+ .hx-account-label { color: var(--corn-text-2); }
147
+ .hx-account-seg { display: inline-flex; padding: calc(var(--corn-space-1) / 2); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); }
148
+ .hx-account-seg-btn { height: 24px; padding: 0 var(--corn-space-3); border: 0; border-radius: var(--corn-radius-xs); background: transparent; color: var(--corn-text-2); font-size: var(--corn-text-xs); font-weight: 500; }
149
+ .hx-account-seg-btn:hover { color: var(--corn-text); }
150
+ .hx-account-seg-btn[aria-pressed="true"] { background: var(--corn-accent); color: var(--corn-text-on-accent); font-weight: 600; }
151
+ .hx-account-select { display: block; width: calc(100% - var(--corn-space-5)); height: 30px; margin: 0 var(--corn-space-3); padding: 0 var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text); font: inherit; font-size: var(--corn-text-sm); }
152
+ .hx-account-item { display: flex; align-items: center; justify-content: space-between; gap: var(--corn-space-3); width: 100%; min-height: 32px; padding: 0 var(--corn-space-4); border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text); font-size: var(--corn-text-sm); text-align: left; text-decoration: none; }
153
+ .hx-account-item:hover { background: var(--corn-surface-3); }
154
+ .hx-account-item--sub { padding-left: var(--corn-space-6); color: var(--corn-text-2); }
155
+ .hx-account-item svg { flex: none; color: var(--corn-text-3); }
156
+ .hx-account-menu .cf-sign-out { margin: 0; }
157
+ .hx-account-menu .cf-sign-out .hx-account-item { color: var(--corn-text-2); }
158
+ .hx-account-menu .hx-links { display: flex; flex-direction: column; margin-top: var(--corn-space-2); padding-top: var(--corn-space-2); border-top: var(--corn-border) solid var(--corn-line); }
159
+ .hx-account-menu .hx-links:empty { display: none; }
160
+ .hx-account-foot { margin: var(--corn-space-1) 0 0; padding: var(--corn-space-2) var(--corn-space-4) var(--corn-space-1); color: var(--corn-text-3); font-size: var(--corn-text-xs); }
161
+ .hx-account-foot a { color: inherit; text-decoration: none; }
162
+ .hx-account-foot a:hover { color: var(--corn-text-2); text-decoration: underline; }
163
+ .hx-account-foot:empty { display: none; }
164
+ /* Freeform layout is a switch */
165
+ .hx-switch { position: relative; flex: none; width: 28px; height: 16px; border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-3); }
166
+ .hx-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--corn-text-3); transition: transform 0.15s; }
167
+ [aria-checked="true"] > .hx-switch { background: var(--corn-accent); border-color: var(--corn-accent); }
168
+ [aria-checked="true"] > .hx-switch::after { background: var(--corn-text-on-accent); transform: translateX(12px); }
169
+ @media (prefers-reduced-motion: reduce) { .hx-switch::after { transition: none; } }
170
+ /* The Proposals list opens inside the menu, under its entry, until the Specs tab of the Work panel takes it over */
171
+ .hx-account-menu .hx-menu--proposals { position: static; width: auto; max-width: none; max-height: 40vh; margin: var(--corn-space-1) 0; padding: var(--corn-space-2); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); box-shadow: none; }
96
172
 
97
- .hx-brand { display: flex; align-items: center; gap: var(--corn-space-3); flex: none; padding: 0; border: 0; background: none; }
98
- .hx-title { font-size: var(--corn-text-base); font-weight: 900; letter-spacing: -0.025em; }
99
- .hx-live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--corn-ok); box-shadow: 0 0 var(--corn-glow) color-mix(in srgb, var(--corn-ok) 50%, transparent); animation: hx-pulse 2s ease-in-out infinite; flex: none; }
100
- .hx-live-dot--ping { width: 8px; height: 8px; animation-name: hx-ping; }
101
- @keyframes hx-pulse { 50% { opacity: 0.5; } }
102
- @keyframes hx-ping { 0% { transform: scale(1); opacity: 1; } 75%, 100% { transform: scale(1.8); opacity: 0.2; } }
103
- @media (prefers-reduced-motion: reduce) { .hx-live-dot { animation: none; } }
173
+ @media (min-width: 768px) {
174
+ .hx-header { height: 52px; padding: 0 var(--corn-space-5); gap: var(--corn-space-5); }
175
+ .hx-header-left { gap: var(--corn-space-5); }
176
+ .hx-header-right { gap: var(--corn-space-3); }
177
+ .hx-brand { min-width: 0; min-height: 0; }
178
+ .hx-only-wide { display: inline; }
179
+ .hx-only-mobile { display: none; }
180
+ .hx-search { display: flex; }
181
+ }
182
+ /* Not for a desktop: the brand keeps its logo and shows its wordmark; with no wordmark the logo stands alone (the button keeps its name) */
183
+ @media (max-width: 767px) {
184
+ .hx-title:not(:has([data-corn="brand-wordmark"])) { display: none; }
185
+ .hx-header { padding: 0 var(--corn-space-3); }
186
+ /* Too narrow for the row (320px, or a repo's longer words): the left scrolls sideways rather than run under the right.
187
+ The padding keeps the focus rings inside the scrolled box; what sits on the map is placed from the header, so it is not clipped */
188
+ .hx-header-left { gap: var(--corn-space-1); margin-inline: calc(var(--corn-space-1) * -1); padding: var(--corn-space-1); overflow-x: auto; scrollbar-width: none; }
189
+ .hx-header-left::-webkit-scrollbar { display: none; }
190
+ .hx-header-right { gap: var(--corn-space-1); }
191
+ .hx-view { padding: 0; }
192
+ .hx-view-btn { min-width: 44px; height: 44px; padding: 0 var(--corn-space-2); }
193
+ .hx-view-fit { position: absolute; top: calc(100% + var(--corn-space-4)); right: var(--corn-space-4); width: 44px; height: 44px; margin: 0; border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-pill); background: var(--corn-surface-1); color: var(--corn-text-2); box-shadow: var(--corn-shadow); }
194
+ .hx-header .hx-layers { position: absolute; top: calc(100% + var(--corn-space-4)); left: var(--corn-space-4); }
195
+ .hx-layers-chip { height: 44px; padding: 0 var(--corn-space-5); border-radius: var(--corn-radius-pill); background: var(--corn-surface-1); box-shadow: var(--corn-shadow); }
196
+ .hx-layers .hx-menu { width: min(288px, calc(100vw - 24px)); }
197
+ /* The live chip sits on the map too, left of Fit */
198
+ .hx-header .hx-live { position: absolute; top: calc(100% + var(--corn-space-4)); right: calc(var(--corn-space-4) + var(--corn-space-3) + 44px); }
199
+ .hx-work { height: 44px; min-width: 44px; justify-content: center; padding: 0 var(--corn-space-3); }
200
+ .hx-forge-lit { display: none; }
201
+ .hx-account-btn { width: 44px; height: 44px; justify-content: center; padding: 0; border: 0; background: none; }
202
+ .hx-account-caret { display: none; }
203
+ .hx-avatar { width: 28px; height: 28px; }
204
+ .hx-menu.hx-account-menu { width: min(300px, calc(100vw - 24px)); }
205
+ .hx-account-item, .hx-account-row { min-height: 44px; }
206
+ .hx-account-seg-btn { height: 44px; padding: 0 var(--corn-space-4); }
207
+ .hx-account-select { height: 44px; }
208
+ .hx-stage .hx-hint { top: 68px; }
209
+ }
210
+ /* ==== end of the header ============================================================================================ */
104
211
 
105
212
  .hx-btn {
106
213
  display: inline-flex;
@@ -117,21 +224,13 @@ h1, h2, h3, p { margin: 0; }
117
224
  white-space: nowrap;
118
225
  }
119
226
  .hx-btn:hover { background: var(--corn-surface-3); color: var(--corn-text); }
120
- .hx-btn:focus-visible, .hx-toggle-row:focus-visible, .hx-zoom-btn:focus-visible, .hx-textbtn:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
227
+ .hx-btn:focus-visible, .hx-toggle-row:focus-visible, .hx-textbtn:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
121
228
  .hx-btn--active, .hx-btn--active:hover { background: var(--corn-accent); border-color: var(--corn-accent-text); color: var(--corn-text-on-accent); box-shadow: var(--corn-shadow-sm); }
122
- .hx-btn--dim { color: var(--corn-text-3); border-color: var(--corn-line-soft); } /* dimmed by its colours, not by opacity: opacity would take the text below AA */
123
- .hx-btn--dim:hover { color: var(--corn-text-2); }
124
229
  .hx-btn--quiet { font-weight: 500; color: var(--corn-text-3); }
125
230
  .hx-btn--icon { width: 28px; height: 28px; padding: 0; justify-content: center; font-size: var(--corn-text-base); }
126
- .hx-btn--preset { border-color: color-mix(in srgb, var(--corn-hue-orange) 35%, transparent); color: var(--corn-hue-orange); }
127
- .hx-btn--preset:hover { background: color-mix(in srgb, var(--corn-hue-orange) 15%, transparent); color: color-mix(in srgb, var(--corn-hue-orange) 60%, var(--corn-text)); }
128
- .hx-btn--preset.hx-btn--active { background: var(--corn-hue-orange); border-color: var(--corn-hue-orange); color: var(--corn-ground); }
129
231
  .hx-btn--rom { width: 100%; justify-content: center; margin-top: var(--corn-space-1); padding: var(--corn-space-2); background: color-mix(in srgb, var(--corn-hue-fuchsia) 20%, transparent); border-color: color-mix(in srgb, var(--corn-hue-fuchsia) 40%, transparent); color: color-mix(in srgb, var(--corn-hue-fuchsia) 60%, var(--corn-text)); font-weight: 700; }
130
232
  .hx-btn--rom:hover { background: color-mix(in srgb, var(--corn-hue-fuchsia) 30%, transparent); }
131
233
 
132
- .hx-dots { display: inline-flex; }
133
- .hx-dots span { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 var(--corn-border) var(--corn-ground); margin-left: calc(var(--corn-space-1) * -1); }
134
- .hx-dots span:first-child { margin-left: 0; }
135
234
 
136
235
  .hx-input {
137
236
  width: 128px;
@@ -150,27 +249,7 @@ h1, h2, h3, p { margin: 0; }
150
249
  .hx-input::placeholder { color: var(--corn-text-3); }
151
250
  .hx-input--wide, .hx-input--wide:focus { width: 100%; flex: 1; }
152
251
 
153
- .hx-zoom { display: none; align-items: center; padding: calc(var(--corn-space-1) / 2); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid var(--corn-line); background: color-mix(in srgb, var(--corn-ground) 80%, transparent); }
154
- .hx-zoom-btn { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text-3); font-weight: 700; font-size: var(--corn-text-sm); }
155
- .hx-zoom-btn:hover { background: var(--corn-surface-2); color: var(--corn-text); }
156
- .hx-zoom-btn--accent { color: var(--corn-accent-text); }
157
252
 
158
- .hx-chip-link { display: none; align-items: center; gap: var(--corn-space-1); padding: var(--corn-space-1) var(--corn-space-3); border-radius: var(--corn-radius-sm); border: var(--corn-border) solid; font-size: var(--corn-text-sm); font-weight: 500; text-decoration: none; transition: background 0.15s; }
159
- .hx-dot-sm { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
160
- .hx-chip-link--indigo { color: var(--corn-accent-text); background: color-mix(in srgb, var(--corn-accent-hover) 10%, transparent); border-color: color-mix(in srgb, var(--corn-accent-hover) 20%, transparent); }
161
- .hx-chip-link--pink { color: var(--corn-hue-pink); background: color-mix(in srgb, var(--corn-hue-pink) 10%, transparent); border-color: color-mix(in srgb, var(--corn-hue-pink) 20%, transparent); }
162
- .hx-chip-link--purple { color: var(--corn-edit-text); background: color-mix(in srgb, var(--corn-edit) 10%, transparent); border-color: color-mix(in srgb, var(--corn-edit) 20%, transparent); }
163
- .hx-chip-link:hover { background: var(--corn-line); }
164
-
165
- .hx-search { display: none; }
166
- .hx-only-wide { display: none; }
167
- @media (min-width: 640px) {
168
- .hx-search { display: block; }
169
- .hx-zoom { display: flex; }
170
- .hx-only-mobile { display: none !important; }
171
- }
172
- @media (min-width: 768px) { .hx-only-wide { display: inline; } }
173
- @media (min-width: 1280px) { .hx-chip-link { display: inline-flex; } }
174
253
 
175
254
  /* ---- layers menu ------------------------------------------------------------------------- */
176
255
  .hx-menu-wrap { position: relative; flex: none; }
@@ -233,8 +312,6 @@ h1, h2, h3, p { margin: 0; }
233
312
  .hx-hint span:last-child { overflow: hidden; text-overflow: ellipsis; }
234
313
  @media (min-width: 640px) { .hx-hint { font-size: var(--corn-text-xs); } }
235
314
 
236
- .hx-mobile-zoom { position: absolute; bottom: 16px; right: 12px; display: flex; flex-direction: column; gap: var(--corn-space-1); padding: var(--corn-space-1); border-radius: var(--corn-radius); z-index: 20; }
237
- .hx-mobile-zoom .hx-zoom-btn { width: 32px; height: 32px; background: var(--corn-surface-2); color: var(--corn-text); border-radius: var(--corn-radius-sm); }
238
315
 
239
316
  .hx-mobile-search { position: absolute; top: 56px; left: 0; right: 0; display: flex; align-items: center; gap: var(--corn-space-3); padding: var(--corn-space-3); z-index: 30; }
240
317
 
@@ -310,9 +387,6 @@ h1, h2, h3, p { margin: 0; }
310
387
  .hx-open:hover { background: var(--corn-accent-hover); }
311
388
 
312
389
  /* ---- proposals (proposal.js): picker, bar, marks, panel rows ----------------------------------- */
313
- .hx-btn--proposal { border-color: color-mix(in srgb, var(--corn-added) 35%, transparent); color: var(--corn-added-text); }
314
- .hx-btn--proposal:hover { background: color-mix(in srgb, var(--corn-added) 14%, transparent); color: var(--corn-added-text); }
315
- .hx-btn--proposal[aria-expanded="true"] { background: color-mix(in srgb, var(--corn-added) 20%, transparent); border-color: var(--corn-added); color: var(--corn-added-text); }
316
390
 
317
391
  .hx-menu--proposals { width: 360px; }
318
392
  .hx-proposal-list { display: flex; flex-direction: column; gap: var(--corn-space-1); }
@@ -549,8 +623,6 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
549
623
  .hx-sheet-handle:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: -2px; border-radius: var(--corn-radius); }
550
624
  .hx-backdrop { display: none; }
551
625
  .hx-stage[data-sheet-open="drawer"] .hx-backdrop:not([hidden]) { display: block; }
552
- /* The zoom buttons ride above the sheets */
553
- .hx-mobile-zoom { bottom: calc(16px + var(--hx-covered, 0px)); }
554
626
 
555
627
  /* The proposal bar */
556
628
  .hx-proposal-bar { max-height: 50dvh; overflow-y: auto; padding: 0 var(--corn-space-4) var(--corn-space-3); }
@@ -600,11 +672,11 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
600
672
  .hx-live-help code { font-family: var(--corn-mono); font-size: var(--corn-text-2xs); color: var(--corn-text-2); overflow-wrap: anywhere; }
601
673
  .hx-live-second { font-size: var(--corn-text-xs); }
602
674
  .hx-live-buttons { display: inline-flex; gap: var(--corn-space-2); }
603
- @media (max-width: 639px) {
604
- .hx-menu--live { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; max-width: none; }
675
+ /* On a phone the chip is its dot on the map (its line is in the menu), and the menu spans the screen under it */
676
+ @media (max-width: 767px) {
677
+ .hx-live-chip { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: var(--corn-radius-pill); background: var(--corn-surface-1); box-shadow: var(--corn-shadow); }
678
+ .hx-menu--live { position: fixed; top: calc(56px + var(--corn-space-4) + 44px); left: 12px; right: 12px; width: auto; max-width: none; }
605
679
  }
606
- /* On a phone the chip is its dot (its line is in the menu), and the header keeps one row */
607
- @media (max-width: 767px) { .hx-live-chip { width: 28px; height: 28px; padding: 0; justify-content: center; } }
608
680
 
609
681
  /* ── Checked scenarios (PHY-10, check.js): the step's state on the player bar and the phone's sheet ──
610
682
  The pill sits in the head, so the phone's peek shows it; the line and the As row are the expanded part. */
@@ -662,37 +734,9 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
662
734
  .hx-drawer-title:focus { outline: none; }
663
735
  .hx-drawer-title:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: 2px; }
664
736
 
665
- /* Sign out (when sign-in is on): a form in the header, inline with the links */
666
- .cf-sign-out { display: inline-flex; margin: 0; }
667
- .cf-sign-out-icon { display: none; }
668
- /* A narrow phone, signed in, with Issues & PRs: the header keeps one row by showing the brand's dot without its
669
- title (the button keeps its name) and Sign out as its icon (its words stay for a screen reader), so every control
670
- keeps at least a 24px target (WCAG 2.5.8) */
671
- @media (max-width: 479px) {
672
- .hx-brand .hx-title { display: none; }
673
- .hx-brand { min-width: 24px; min-height: 24px; justify-content: center; }
674
- .hx-header .hx-btn { min-width: 24px; }
675
- .cf-sign-out .hx-btn { width: 28px; height: 28px; padding: 0; justify-content: center; }
676
- .cf-sign-out-icon { display: inline; font-size: var(--corn-text-base); }
677
- .cf-sign-out-text { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
678
- }
679
- /* Narrower still (320px, the reflow width): the left of the header scrolls sideways rather than running under the
680
- right, so nothing overlaps; its menus open fixed under the header, as the Proposals and Live menus already do there,
681
- so the scroll cannot clip them. The padding keeps the focus rings inside the scrolled box. */
682
- @media (max-width: 639px) {
683
- .hx-header-left { overflow-x: auto; scrollbar-width: none; padding-block: var(--corn-space-1); }
684
- .hx-header-left::-webkit-scrollbar { display: none; }
685
- #legend-dropdown.hx-menu { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; max-width: none; }
686
- }
687
-
688
737
  /* ---- the issues and PRs panel (forge-panel.js, CF-07) -------------------------------------------
689
738
  A slide-over from the left from 768px (the node panel is the one from the right), a bottom sheet in #sheet-dock below.
690
739
  Closed, it is inert (forge-panel.js), and off screen or not displayed. Only the tokens above are used, so it follows the theme. */
691
- .hx-btn--forge { border-color: var(--corn-line); }
692
- .hx-btn--forge[aria-expanded="true"] { background: var(--corn-accent); border-color: var(--corn-accent-text); color: var(--corn-text-on-accent); }
693
- .hx-forge-lit { padding: 0 var(--corn-space-2); border-radius: var(--corn-radius-pill); border: var(--corn-border) solid var(--corn-warn); background: color-mix(in srgb, var(--corn-ground) 55%, transparent); color: var(--corn-warn); font-family: var(--corn-mono); font-size: var(--corn-text-2xs); }
694
- @media (max-width: 767px) { .hx-btn--forge { width: 28px; height: 28px; padding: 0; justify-content: center; } .hx-forge-lit { display: none; } }
695
- /* A changed file's status column, and the nodes under it that line up past it */
696
740
  .hx-forge { --hx-forge-status-w: 56px; }
697
741
  .hx-forge { display: flex; flex-direction: column; z-index: 40; border-color: var(--corn-surface-2); pointer-events: none; touch-action: pan-y; transition: transform 0.2s ease-out; }
698
742
  .hx-forge * { touch-action: pan-y; }
@@ -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
 
@@ -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
 
@@ -343,13 +340,6 @@
343
340
  </aside>
344
341
  </div>
345
342
 
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
343
  <div class="hx-hint glass" data-corn="hint">
354
344
  <span class="hx-accent" aria-hidden="true">👆</span>
355
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,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
  /**
@@ -132,11 +132,6 @@ export function screenToWorld(sx, sy) {
132
132
  return { x: (sx - state.camera.x) / state.camera.zoom, y: (sy - state.camera.y) / state.camera.zoom };
133
133
  }
134
134
 
135
- export function zoomBy(factor) {
136
- state.camera.zoom = Math.max(0.25, Math.min(3.0, state.camera.zoom * factor));
137
- render();
138
- }
139
-
140
135
  // ---------------------------------------------------------------------------
141
136
  // When to draw (frame.js has the rules): on demand, not on a timer
142
137
  // ---------------------------------------------------------------------------
@@ -161,7 +161,8 @@ export function closeTokens({ restoreFocus = true } = {}) {
161
161
  el.hidden = true;
162
162
  document.removeEventListener('focusin', keepFocusIn);
163
163
  $('tokens-btn').setAttribute('aria-expanded', 'false');
164
- if (restoreFocus) $('tokens-btn').focus();
164
+ // The button is in the account menu, which is shut by now: the focus goes to the menu's button then
165
+ if (restoreFocus) ($('tokens-btn').closest('[hidden]') ? $('account-btn') : $('tokens-btn')).focus();
165
166
  }
166
167
 
167
168
  function onClick(e) {
@@ -90,15 +90,6 @@ export function themeChoiceFrom(search, stored) {
90
90
  return { choice: THEME_CHOICES.includes(stored) ? stored : 'system', fromAddress: false };
91
91
  }
92
92
 
93
- /** The choice after `choice` on the toggle: system, light, dark, then system again */
94
- export const nextChoice = (choice) => THEME_CHOICES[(THEME_CHOICES.indexOf(choice) + 1) % THEME_CHOICES.length];
95
-
96
- /** What the toggle says it is set to, in plain words (its label and title) */
97
- export function themeWords(choice, theme) {
98
- if (choice === 'system') return `Theme: follows the system (${theme} now)`;
99
- return `Theme: ${choice}`;
100
- }
101
-
102
93
  // ---------------------------------------------------------------------------
103
94
  // Colour arithmetic
104
95
  // ---------------------------------------------------------------------------
package/explorer/theme.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * decides which theme is on and tells the page:
6
6
  *
7
7
  * - the choice is `system` (the default: `prefers-color-scheme`, followed live), `light` or `dark`;
8
- * the toggle in the header steps through them and keeps the choice in localStorage
8
+ * the System / Dark / Light segment in the account menu sets it and keeps the choice in localStorage
9
9
  * (THEME_STORAGE_KEY). `?theme=light|dark|system` in the address wins, for that visit, and is not kept;
10
10
  * - the theme in force is `<html data-theme="light|dark">`: explorer.css swaps its tokens on it,
11
11
  * theme-boot.js sets it before the first paint (so a light page never flashes dark), and this module
@@ -19,7 +19,7 @@
19
19
  import { state, touchScene } from './state.js';
20
20
  import { render } from './render.js';
21
21
  import { refreshMapStyle } from './map-style.js';
22
- import { THEME_STORAGE_KEY, nextChoice, resolveTheme, themeChoiceFrom, themeWords } from './theme-model.js';
22
+ import { THEME_STORAGE_KEY, resolveTheme, themeChoiceFrom } from './theme-model.js';
23
23
 
24
24
  const QUERY = '(prefers-color-scheme: light)';
25
25
  let choice = 'system';
@@ -49,14 +49,9 @@ function store(value) {
49
49
  } catch { /* storage blocked: the choice still holds for this visit */ }
50
50
  }
51
51
 
52
- function syncButton(theme) {
53
- const btn = document.getElementById('theme-toggle-btn');
54
- if (!btn) return;
55
- const words = themeWords(choice, theme);
56
- btn.setAttribute('aria-label', `${words}. Change theme`);
57
- btn.title = `${words}. Click for ${nextChoice(choice) === 'system' ? 'the system setting' : nextChoice(choice)}`;
58
- btn.dataset.choice = choice;
59
- btn.querySelectorAll('[data-icon]').forEach((g) => { g.toggleAttribute('hidden', g.dataset.icon !== choice); });
52
+ /** The segment in the account menu says which choice is on (aria-pressed) */
53
+ function syncButtons() {
54
+ for (const b of document.querySelectorAll('[data-action="set-theme"]')) b.setAttribute('aria-pressed', String(b.dataset.choice === choice));
60
55
  }
61
56
 
62
57
  /** Puts the theme in force on the page and the map */
@@ -64,7 +59,7 @@ function apply() {
64
59
  const theme = resolveTheme(choice, prefersLight());
65
60
  const root = document.documentElement;
66
61
  root.dataset.theme = theme;
67
- syncButton(theme);
62
+ syncButtons();
68
63
  refreshMapStyle(); // the map's tokens (--corn-map-*) differ by theme: read them for this one (map-style.js)
69
64
  if (state.theme === theme) return;
70
65
  state.theme = theme;
@@ -101,6 +96,3 @@ export function setThemeChoice(next) {
101
96
  store(choice);
102
97
  apply();
103
98
  }
104
-
105
- /** The header toggle: system, light, dark, system ... */
106
- export const cycleTheme = () => setThemeChoice(nextChoice(choice));
package/explorer/view.js CHANGED
@@ -157,13 +157,13 @@ export function setView(view) {
157
157
 
158
158
  export function syncViewUi() {
159
159
  const preset = state.view === 'dataflow';
160
+ // The View switch: the Map button is on for the map itself; Flow and House say theirs (house.js) in aria-pressed too
161
+ const map = $('preset-map-btn');
162
+ if (map) map.setAttribute('aria-pressed', String(state.view !== 'dataflow' && state.view !== 'house'));
160
163
  const btn = $('preset-dataflow-btn');
161
- if (btn) {
162
- btn.classList.toggle('hx-btn--active', preset);
163
- btn.setAttribute('aria-pressed', String(preset));
164
- }
164
+ if (btn) btn.setAttribute('aria-pressed', String(preset));
165
165
  const layersBtn = $('legend-toggle-btn');
166
- if (layersBtn) layersBtn.classList.toggle('hx-btn--dim', preset);
166
+ if (layersBtn) layersBtn.classList.toggle('hx-layers-chip--dim', preset);
167
167
  const note = $('layers-preset-note');
168
168
  if (note) note.hidden = !preset;
169
169
  const badge = $('instruction-badge-text');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cornfield",
3
- "version": "0.30.0",
3
+ "version": "0.31.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)",
package/server/server.js CHANGED
@@ -259,6 +259,8 @@ export function clientConfig(config, signIn = false) {
259
259
  return {
260
260
  name: 'cornfield',
261
261
  version: PKG.version,
262
+ // Where cornfield's own docs are: the account menu's Docs link
263
+ docs: PKG.homepage,
262
264
  title: config.title,
263
265
  links: config.links || [],
264
266
  // The theme's names and default, never a file's path (docs/config.md#theme)