@popcorn245/cornfield 0.27.0 → 0.29.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/config.js +5 -0
- package/core/strings.js +118 -0
- package/explorer/explorer.css +64 -17
- package/explorer/forge-panel.js +11 -10
- package/explorer/index.html +53 -37
- package/explorer/main.js +1 -1
- package/explorer/panels.js +3 -2
- package/explorer/plugins.js +6 -2
- package/explorer/proposal-model.js +13 -0
- package/explorer/proposal.js +68 -7
- package/explorer/review.js +69 -17
- package/explorer/runs-view.js +6 -5
- package/explorer/scenario-ui.js +26 -7
- package/explorer/sheets.js +1 -1
- package/explorer/strings.js +68 -0
- package/explorer/view.js +2 -1
- package/explorer/whatif.js +20 -3
- package/package.json +1 -1
- package/server/server.js +4 -1
package/explorer/index.html
CHANGED
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
</button>
|
|
33
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" aria-expanded="false" aria-controls="legend-dropdown" title="Toggle Architecture Layers" data-corn="layers-button">
|
|
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
36
|
<span class="hx-dots" aria-hidden="true">
|
|
37
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
38
|
</span>
|
|
39
|
-
<span class="hx-only-wide">Layers</span>
|
|
39
|
+
<span class="hx-only-wide" data-corn-string="layers">Layers</span>
|
|
40
40
|
<span class="hx-faint" aria-hidden="true">▾</span>
|
|
41
41
|
</button>
|
|
42
42
|
|
|
@@ -89,31 +89,31 @@
|
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
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" title="Show only how data moves: browser, app servers, API, tables, services, outside systems" data-corn="preset-dataflow">
|
|
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
93
|
<span aria-hidden="true">⇄</span>
|
|
94
|
-
<span class="hx-only-wide">Data flow</span>
|
|
94
|
+
<span class="hx-only-wide" data-corn-string="dataFlow">Data flow</span>
|
|
95
95
|
</button>
|
|
96
96
|
|
|
97
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" 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">
|
|
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
99
|
<span aria-hidden="true">⌂</span>
|
|
100
|
-
<span class="hx-only-wide">House</span>
|
|
100
|
+
<span class="hx-only-wide" data-corn-string="house">House</span>
|
|
101
101
|
</button>
|
|
102
102
|
|
|
103
103
|
<!-- Proposals: what a change would add, change and remove, drawn on the map (proposal.js) -->
|
|
104
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" title="Open a proposal: what a change would add, change and remove" data-corn="proposals-button">
|
|
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
106
|
<span aria-hidden="true">✎</span>
|
|
107
|
-
<span class="hx-only-wide">Proposals</span>
|
|
107
|
+
<span class="hx-only-wide" data-corn-string="proposals">Proposals</span>
|
|
108
108
|
<span class="hx-faint">▾</span>
|
|
109
109
|
</button>
|
|
110
110
|
<div id="proposal-menu" class="hx-menu hx-menu--proposals glass" hidden data-corn="proposals-menu"></div>
|
|
111
111
|
</div>
|
|
112
112
|
|
|
113
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" 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">
|
|
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
115
|
<span aria-hidden="true">⎇</span>
|
|
116
|
-
<span class="hx-only-wide">Issues & PRs</span>
|
|
116
|
+
<span class="hx-only-wide" data-corn-string="issuesAndPrs">Issues & PRs</span>
|
|
117
117
|
<span id="forge-btn-lit" class="hx-forge-lit" hidden></span>
|
|
118
118
|
</button>
|
|
119
119
|
|
|
@@ -137,7 +137,7 @@
|
|
|
137
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>
|
|
138
138
|
|
|
139
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..." aria-label="Search nodes" data-corn="search-input" />
|
|
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" />
|
|
141
141
|
</div>
|
|
142
142
|
|
|
143
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">
|
|
@@ -193,19 +193,35 @@
|
|
|
193
193
|
|
|
194
194
|
<!-- Below 768px the proposal bar, the scenario player and the node panel stack here as bottom sheets (sheets.js); from 768px the dock is display: contents -->
|
|
195
195
|
<div id="sheet-dock" class="hx-dock" data-corn="dock">
|
|
196
|
-
<!-- The open proposal: counts, Before / Diff / After,
|
|
196
|
+
<!-- The open proposal, a toolbar: title, counts, Before / Diff / After, Play, Edit, Send back, Approve, ⋯ (proposal.js, review.js, whatif.js, scenario-ui.js) -->
|
|
197
197
|
<section id="proposal-bar" class="hx-proposal-bar glass" aria-label="Open proposal" hidden data-corn="proposal-bar">
|
|
198
198
|
<p id="proposal-message" class="hx-proposal-message" role="status" hidden></p>
|
|
199
199
|
<div id="proposal-body">
|
|
200
|
-
<div class="hx-proposal-head">
|
|
200
|
+
<div class="hx-proposal-head" role="group" aria-label="Proposal actions">
|
|
201
201
|
<strong id="proposal-title" class="hx-proposal-name"></strong>
|
|
202
|
-
<
|
|
203
|
-
|
|
204
|
-
<button type="button" class="hx-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
<div class="hx-proposal-counts">
|
|
203
|
+
<button type="button" id="proposal-chip" class="hx-proposal-chip" data-action="toggle-proposal-changes" aria-expanded="false"></button>
|
|
204
|
+
<button type="button" id="proposal-mode" class="hx-proposal-mode" data-action="toggle-proposal-mode" data-peek-ok aria-expanded="false" aria-controls="proposal-seg" title="Before, Diff or After"></button>
|
|
205
|
+
</div>
|
|
206
|
+
<div id="proposal-seg" class="hx-seg" role="group" aria-label="Compare">
|
|
207
|
+
<button type="button" class="hx-seg-btn" data-action="proposal-view" data-view="before" aria-pressed="false" data-corn-string="before">Before</button>
|
|
208
|
+
<button type="button" class="hx-seg-btn" data-action="proposal-view" data-view="diff" aria-pressed="true" data-corn-string="diff">Diff</button>
|
|
209
|
+
<button type="button" class="hx-seg-btn" data-action="proposal-view" data-view="after" aria-pressed="false" data-corn-string="after">After</button>
|
|
210
|
+
</div>
|
|
211
|
+
<div class="hx-proposal-tools">
|
|
212
|
+
<button type="button" id="proposal-play" class="hx-btn" aria-expanded="false" aria-controls="proposal-scenarios" title="Play one of this proposal's scenarios on the map" hidden>Play</button>
|
|
213
|
+
<button type="button" id="proposal-edit" class="hx-btn" aria-expanded="false" aria-controls="whatif" title="Try a change: add a node or an edge, reword a scenario">Edit</button>
|
|
214
|
+
</div>
|
|
215
|
+
<div class="hx-proposal-actions">
|
|
216
|
+
<button type="button" class="hx-btn" data-review="notes" data-peek-ok title="Send it back to the drafting agent with a note and your edits" data-corn-string="sendBack">Send back</button>
|
|
217
|
+
<button type="button" class="hx-btn hx-btn--approve" data-review="approved" data-peek-ok title="Sign this proposal off" data-corn-kind="approve" data-corn-string="approve">Approve</button>
|
|
218
|
+
</div>
|
|
219
|
+
<div class="hx-proposal-more">
|
|
220
|
+
<button type="button" id="proposal-more" class="hx-btn hx-btn--icon" data-action="toggle-proposal-more" aria-haspopup="menu" aria-expanded="false" aria-controls="proposal-more-menu" aria-label="More" data-corn-kind="icon"><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><circle cx="3" cy="8" r="1.5"/><circle cx="8" cy="8" r="1.5"/><circle cx="13" cy="8" r="1.5"/></svg></button>
|
|
221
|
+
<div id="proposal-more-menu" class="hx-proposal-more-menu glass" role="menu" aria-label="More" hidden>
|
|
222
|
+
<button type="button" role="menuitem" class="hx-btn hx-btn--quiet" data-action="close-proposal" title="Close the proposal and go back to the map" data-corn-kind="quiet" data-corn-string="closeProposal">Close</button>
|
|
223
|
+
</div>
|
|
207
224
|
</div>
|
|
208
|
-
<button type="button" class="hx-btn hx-btn--quiet" data-action="close-proposal" title="Close the proposal and go back to the map" data-corn-kind="quiet">Close</button>
|
|
209
225
|
</div>
|
|
210
226
|
<p id="proposal-summary" class="hx-proposal-summary" hidden></p>
|
|
211
227
|
<details id="proposal-errors" class="hx-proposal-errors" hidden>
|
|
@@ -228,12 +244,12 @@
|
|
|
228
244
|
<p id="forge-status" class="hx-forge-status hx-faint"></p>
|
|
229
245
|
<div class="hx-forge-controls">
|
|
230
246
|
<div class="hx-forge-tabs" role="group" aria-label="Show" data-corn="tabs">
|
|
231
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="pulls" aria-pressed="true" data-corn="tab">Pull requests</button>
|
|
232
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="issues" aria-pressed="false" data-corn="tab">Issues</button>
|
|
233
|
-
<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">Threads</button>
|
|
234
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="deploys" aria-pressed="false" data-corn="tab">Deploys</button>
|
|
235
|
-
<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">Agents</button>
|
|
236
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="notes" aria-pressed="false" data-corn="tab">Release notes</button>
|
|
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>
|
|
237
253
|
</div>
|
|
238
254
|
<div id="forge-work-filters" class="hx-forge-work-filters" hidden>
|
|
239
255
|
<label class="hx-forge-toggle"><input type="checkbox" id="forge-work-agents" /> Agent-made only</label>
|
|
@@ -249,13 +265,13 @@
|
|
|
249
265
|
<p id="forge-notice" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
250
266
|
<p id="forge-act-note" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
251
267
|
<!-- New idea (forge-panel.js): opens an issue with the threads label as you, on the forge; the thread itself lives there -->
|
|
252
|
-
<section id="forge-idea" class="hx-forge-notes" aria-label="New idea" hidden>
|
|
268
|
+
<section id="forge-idea" class="hx-forge-notes" aria-label="New idea" data-corn-string-aria-label="newIdea" hidden>
|
|
253
269
|
<div class="hx-forge-actions">
|
|
254
|
-
<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">New idea …</button>
|
|
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>
|
|
255
271
|
</div>
|
|
256
272
|
<p id="idea-message" class="hx-forge-msg" role="status" hidden data-corn="message"></p>
|
|
257
273
|
<div id="idea-form" class="hx-forge-confirm" role="group" aria-labelledby="idea-form-title" hidden>
|
|
258
|
-
<h3 id="idea-form-title" class="hx-forge-confirm-title">New idea</h3>
|
|
274
|
+
<h3 id="idea-form-title" class="hx-forge-confirm-title" data-corn-string="newIdea">New idea</h3>
|
|
259
275
|
<p id="idea-words"></p>
|
|
260
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>
|
|
261
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>
|
|
@@ -315,19 +331,19 @@
|
|
|
315
331
|
<p id="drawer-description" class="hx-faint hx-lead"></p>
|
|
316
332
|
|
|
317
333
|
<div class="hx-block">
|
|
318
|
-
<h3 class="hx-block-title">Properties & Attributes</h3>
|
|
334
|
+
<h3 class="hx-block-title" data-corn-string="propsTitle">Properties & Attributes</h3>
|
|
319
335
|
<div id="drawer-props-list" class="hx-props"></div>
|
|
320
336
|
</div>
|
|
321
337
|
|
|
322
338
|
<div class="hx-block">
|
|
323
|
-
<h3 class="hx-block-title">Details</h3>
|
|
339
|
+
<h3 class="hx-block-title" data-corn-string="detailsTitle">Details</h3>
|
|
324
340
|
<div id="drawer-meta-list" class="hx-meta"></div>
|
|
325
341
|
</div>
|
|
326
342
|
</div>
|
|
327
343
|
|
|
328
344
|
<div class="hx-drawer-foot">
|
|
329
345
|
<a id="drawer-open-btn" class="hx-open" href="#" target="_blank" rel="noreferrer">Open ↗</a>
|
|
330
|
-
<button type="button" class="hx-btn hx-btn--copy" data-action="copy-spec">Copy Spec</button>
|
|
346
|
+
<button type="button" class="hx-btn hx-btn--copy" data-action="copy-spec" data-corn-string="copySpec">Copy Spec</button>
|
|
331
347
|
</div>
|
|
332
348
|
</aside>
|
|
333
349
|
</div>
|
|
@@ -345,12 +361,12 @@
|
|
|
345
361
|
</div>
|
|
346
362
|
|
|
347
363
|
<!-- Loading and error states: a failed load never leaves a blank canvas -->
|
|
348
|
-
<div id="loading-state" class="hx-state" role="status" data-corn="loading">Loading topology.json …</div>
|
|
364
|
+
<div id="loading-state" class="hx-state" role="status" data-corn="loading" data-corn-string="loading">Loading topology.json …</div>
|
|
349
365
|
<div id="error-state" class="hx-state hx-state--error glass" role="alert" hidden data-corn="error">
|
|
350
|
-
<strong>The map could not be loaded</strong>
|
|
366
|
+
<strong data-corn-string="errorTitle">The map could not be loaded</strong>
|
|
351
367
|
<p id="error-message"></p>
|
|
352
368
|
<p class="hx-faint">The explorer reads /topology.json from the cornfield server (cornfield serve). Run cornfield sync if the repo has no map yet, check that the server is up, then retry.</p>
|
|
353
|
-
<button type="button" class="hx-btn hx-btn--active" data-action="retry" data-corn-kind="primary">Retry</button>
|
|
369
|
+
<button type="button" class="hx-btn hx-btn--active" data-action="retry" data-corn-kind="primary" data-corn-string="retry">Retry</button>
|
|
354
370
|
</div>
|
|
355
371
|
|
|
356
372
|
<div id="drawer-backdrop" class="hx-backdrop" data-action="close-drawer" hidden data-corn="backdrop"></div>
|
|
@@ -364,7 +380,7 @@
|
|
|
364
380
|
<div id="forge-confirm-body"></div>
|
|
365
381
|
<div class="hx-confirm-actions">
|
|
366
382
|
<button type="button" class="hx-btn" data-action="forge-confirm-cancel">Cancel</button>
|
|
367
|
-
<button type="button" class="hx-btn hx-btn--approve" data-action="forge-confirm-go" data-corn-kind="approve">Land it</button>
|
|
383
|
+
<button type="button" class="hx-btn hx-btn--approve" data-action="forge-confirm-go" data-corn-kind="approve" data-corn-string="landIt">Land it</button>
|
|
368
384
|
</div>
|
|
369
385
|
</div>
|
|
370
386
|
</div>
|
|
@@ -372,7 +388,7 @@
|
|
|
372
388
|
<!-- Start an agent (forge-panel.js): kind, profile, a brief, and a confirm step; a modal dialog over a scrim, the focus stays in it -->
|
|
373
389
|
<div id="agent-start" class="hx-confirm-scrim" hidden data-corn="dialog-scrim">
|
|
374
390
|
<div class="hx-confirm glass" role="dialog" aria-modal="true" aria-labelledby="agent-start-title" aria-describedby="agent-start-words" data-corn="agent-dialog">
|
|
375
|
-
<h2 id="agent-start-title" class="hx-confirm-title">Start an agent</h2>
|
|
391
|
+
<h2 id="agent-start-title" class="hx-confirm-title" data-corn-string="startAgent">Start an agent</h2>
|
|
376
392
|
<p id="agent-start-about" class="hx-forge-meta"></p>
|
|
377
393
|
<p id="agent-start-runner" class="hx-forge-meta" hidden></p>
|
|
378
394
|
<p id="agent-retry-note" class="hx-forge-meta" hidden></p>
|
|
@@ -391,7 +407,7 @@
|
|
|
391
407
|
<p id="agent-start-msg" class="hx-forge-msg hx-forge-msg--bad" role="alert" hidden data-corn="message" data-corn-state="failure"></p>
|
|
392
408
|
<div class="hx-confirm-actions">
|
|
393
409
|
<button type="button" class="hx-btn" data-action="agent-start-cancel">Cancel</button>
|
|
394
|
-
<button type="submit" class="hx-btn hx-btn--approve" id="agent-start-go" data-corn-kind="approve">Ask the runner</button>
|
|
410
|
+
<button type="submit" class="hx-btn hx-btn--approve" id="agent-start-go" data-corn-kind="approve" data-corn-string="askRunner">Ask the runner</button>
|
|
395
411
|
</div>
|
|
396
412
|
</form>
|
|
397
413
|
</div>
|
package/explorer/main.js
CHANGED
|
@@ -207,7 +207,7 @@ $('mobile-node-search').addEventListener('input', (e) => handleSearch(e.target.v
|
|
|
207
207
|
resize();
|
|
208
208
|
syncViewUi();
|
|
209
209
|
// /?proposal=<slug> opens a proposal over the map, /?view=dataflow the data-flow preset: both have a link
|
|
210
|
-
const configReady = loadClientConfig().then((config) => { applyBranding(document, config); applyMapTheme(document, config.theme); return config; }); // the brand, then the theme's icons for the map
|
|
210
|
+
const configReady = loadClientConfig().then((config) => { applyBranding(document, config); applyMapTheme(document, config.theme); syncViewUi(); return config; }); // the brand, then the theme's icons for the map; the hint again, in the repo's words
|
|
211
211
|
loadTopology().then(async (ok) => {
|
|
212
212
|
if (!ok) return;
|
|
213
213
|
// The sources the repo's cornfield.config.js names (plugins.js): a live layer, a house, devices, a checker; each optional
|
package/explorer/panels.js
CHANGED
|
@@ -15,6 +15,7 @@ import { nodeMockupsHtml } from './mockups-model.js';
|
|
|
15
15
|
import { collapseSheet } from './sheets.js';
|
|
16
16
|
import { liveSection, hydrateLivePhotos } from './live.js';
|
|
17
17
|
import { cloudPanelHtml } from './cloud-model.js';
|
|
18
|
+
import { t } from './strings.js';
|
|
18
19
|
|
|
19
20
|
const $ = (id) => document.getElementById(id);
|
|
20
21
|
|
|
@@ -189,7 +190,7 @@ export async function selectNode(node) {
|
|
|
189
190
|
${dataSummary(node)}`;
|
|
190
191
|
if (node.url && /^https?:\/\//.test(node.url)) {
|
|
191
192
|
openBtn.href = node.url;
|
|
192
|
-
openBtn.textContent = '
|
|
193
|
+
openBtn.textContent = `${t('openRoute')} ↗`;
|
|
193
194
|
} else {
|
|
194
195
|
openBtn.removeAttribute('href');
|
|
195
196
|
openBtn.textContent = 'Internal Workspace Node';
|
|
@@ -238,5 +239,5 @@ export async function copySpec(button) {
|
|
|
238
239
|
} catch {
|
|
239
240
|
button.textContent = 'Copy blocked';
|
|
240
241
|
}
|
|
241
|
-
setTimeout(() => { button.textContent = '
|
|
242
|
+
setTimeout(() => { button.textContent = t('copySpec'); }, 1500);
|
|
242
243
|
}
|
package/explorer/plugins.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { escHtml } from './state.js';
|
|
18
18
|
import { initThemePicker } from './theme-names.js';
|
|
19
|
+
import { setStrings, applyStrings, t } from './strings.js';
|
|
19
20
|
|
|
20
21
|
/** What the live layer shows when the repo names no live source */
|
|
21
22
|
export const NO_SOURCE = Object.freeze({
|
|
@@ -71,12 +72,15 @@ function applyBrand(doc, brand, title) {
|
|
|
71
72
|
/** The small "powered by cornfield" link that stays in the header when a repo brands cornfield */
|
|
72
73
|
function poweredBy(brand) {
|
|
73
74
|
if (!brand || typeof brand.poweredBy !== 'string' || !/^https:\/\//.test(brand.poweredBy)) return '';
|
|
74
|
-
return `<a class="hx-btn hx-btn--quiet" data-corn="powered-by" href="${escHtml(brand.poweredBy)}" target="_blank" rel="noreferrer"
|
|
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>`;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
/** Puts the repo's title, brand and links in the header, and Sign out when the server says who is signed in */
|
|
78
79
|
export function applyBranding(doc, config) {
|
|
79
80
|
if (!config || !doc) return;
|
|
81
|
+
// The repo's words (core/strings.js) first: what is built below reads them, and the static markup is filled now
|
|
82
|
+
setStrings(config.strings);
|
|
83
|
+
applyStrings(doc);
|
|
80
84
|
const title = doc.getElementById('cf-title');
|
|
81
85
|
if (title && config.title) title.textContent = config.title;
|
|
82
86
|
const heading = doc.getElementById('cf-heading');
|
|
@@ -92,7 +96,7 @@ export function applyBranding(doc, config) {
|
|
|
92
96
|
// A plain form: signing out is a same-origin POST (server/auth.js), no script needed. On a narrow phone only its icon
|
|
93
97
|
// shows (explorer.css); the words stay in the button for a screen reader
|
|
94
98
|
const signOut = config.signIn && typeof config.signIn.login === 'string'
|
|
95
|
-
? `<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"
|
|
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>`
|
|
96
100
|
: '';
|
|
97
101
|
const powered = poweredBy(config.brand);
|
|
98
102
|
if (html || powered || signOut) links.innerHTML = html + powered + signOut;
|
|
@@ -109,6 +109,19 @@ export function chipText(counts) {
|
|
|
109
109
|
return parts.length ? parts.join(' · ') : 'No changes';
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* The counts on the toolbar as parts, so each mark can carry its dot: "+4 added", "1 changed", "1 removed", then
|
|
114
|
+
* "3 scenarios". Zero counts are left out; nothing at all reads "No changes".
|
|
115
|
+
* @param {{added?:number, changed?:number, removed?:number, scenarios?:number}} counts `summarize(proposal)`
|
|
116
|
+
* @returns {{mark: string|null, text: string}[]}
|
|
117
|
+
*/
|
|
118
|
+
export function barCounts(counts) {
|
|
119
|
+
const n = (k) => counts?.[k] || 0;
|
|
120
|
+
const parts = MARKS.filter((m) => n(m) > 0).map((m) => ({ mark: m, text: `${m === 'added' ? '+' : ''}${n(m)} ${m}` }));
|
|
121
|
+
if (n('scenarios') > 0) parts.push({ mark: null, text: `${n('scenarios')} ${n('scenarios') === 1 ? 'scenario' : 'scenarios'}` });
|
|
122
|
+
return parts.length ? parts : [{ mark: null, text: 'No changes' }];
|
|
123
|
+
}
|
|
124
|
+
|
|
112
125
|
const SLUG = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
113
126
|
|
|
114
127
|
/**
|
package/explorer/proposal.js
CHANGED
|
@@ -26,11 +26,12 @@ import { edgePoint, looksFor } from './scene.js';
|
|
|
26
26
|
import { onThemeChange } from './theme.js';
|
|
27
27
|
import { looksWith, onMapStyleChange } from './map-style.js';
|
|
28
28
|
import {
|
|
29
|
-
PROPOSAL_VIEWS, MARKS, MARK_WORDS, chipText, parseProposalQuery, proposalPanelHtml, touchedIds,
|
|
29
|
+
PROPOSAL_VIEWS, MARKS, MARK_WORDS, chipText, barCounts, parseProposalQuery, proposalPanelHtml, touchedIds,
|
|
30
30
|
} from './proposal-model.js';
|
|
31
31
|
import { applyProposal, edgeKey, proposalProblems, summarize } from '../core/proposal.js';
|
|
32
32
|
import { reviewWords } from './review-model.js';
|
|
33
33
|
import { collapseSheet } from './sheets.js';
|
|
34
|
+
import { t } from './strings.js';
|
|
34
35
|
|
|
35
36
|
const $ = (id) => document.getElementById(id);
|
|
36
37
|
|
|
@@ -241,7 +242,7 @@ export function renderBar() {
|
|
|
241
242
|
bar.hidden = !open;
|
|
242
243
|
const legend = $('proposal-legend');
|
|
243
244
|
if (legend) legend.hidden = !open;
|
|
244
|
-
if (!open) { collapseSheet('proposal'); if (hooks.bar) hooks.bar(false); return; }
|
|
245
|
+
if (!open) { closeMore(); toggleMode(false); collapseSheet('proposal'); if (hooks.bar) hooks.bar(false); return; }
|
|
245
246
|
|
|
246
247
|
bar.classList.remove('is-error');
|
|
247
248
|
$('proposal-message').hidden = true;
|
|
@@ -250,12 +251,15 @@ export function renderBar() {
|
|
|
250
251
|
$('proposal-title').textContent = (p && typeof p.title === 'string' && p.title) || state.proposalSlug || 'Proposal';
|
|
251
252
|
const summary = $('proposal-summary');
|
|
252
253
|
summary.textContent = (p && typeof p.summary === 'string' && p.summary) || '';
|
|
253
|
-
|
|
254
|
+
const title = $('proposal-title');
|
|
255
|
+
title.title = summary.textContent; // the toolbar stays one row: the summary is the title's tooltip, and shows above the list of changes
|
|
256
|
+
summary.hidden = !summary.textContent || $('proposal-changes').hidden;
|
|
254
257
|
|
|
255
258
|
const counts = summarize(p);
|
|
256
259
|
const chip = $('proposal-chip');
|
|
257
|
-
chip.
|
|
258
|
-
chip.title =
|
|
260
|
+
chip.innerHTML = barCounts(counts).map((c) => `${c.mark ? `<span class="hx-mark-dot hx-mark-dot--${c.mark}" aria-hidden="true"></span>` : ''}${escHtml(c.text)}`).join('<span class="hx-proposal-sep" aria-hidden="true"> · </span>');
|
|
261
|
+
chip.title = 'Click for the list of changes.';
|
|
262
|
+
$('proposal-mode').textContent = t(state.proposalView);
|
|
259
263
|
|
|
260
264
|
for (const btn of bar.querySelectorAll('[data-action="proposal-view"]')) {
|
|
261
265
|
const on = btn.dataset.view === state.proposalView;
|
|
@@ -296,6 +300,7 @@ function toggleChanges() {
|
|
|
296
300
|
const list = $('proposal-changes');
|
|
297
301
|
if (!list) return;
|
|
298
302
|
list.hidden = !list.hidden;
|
|
303
|
+
$('proposal-summary').hidden = list.hidden || !$('proposal-summary').textContent;
|
|
299
304
|
$('proposal-chip').setAttribute('aria-expanded', String(!list.hidden));
|
|
300
305
|
}
|
|
301
306
|
|
|
@@ -313,6 +318,57 @@ function focusChange(kind, key) {
|
|
|
313
318
|
else selectNode(item);
|
|
314
319
|
}
|
|
315
320
|
|
|
321
|
+
// ---------------------------------------------------------------------------
|
|
322
|
+
// The ⋯ menu (a menu button) and the phone's Before / Diff / After switcher
|
|
323
|
+
// ---------------------------------------------------------------------------
|
|
324
|
+
|
|
325
|
+
const moreItems = () => [...document.querySelectorAll('#proposal-more-menu [role="menuitem"]')];
|
|
326
|
+
|
|
327
|
+
function moreOpen() {
|
|
328
|
+
const menu = $('proposal-more-menu');
|
|
329
|
+
return !!menu && !menu.hidden;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** Closes the ⋯ menu; `refocus` puts focus back on its button (Escape, or a choice made) */
|
|
333
|
+
function closeMore(refocus = false) {
|
|
334
|
+
const menu = $('proposal-more-menu');
|
|
335
|
+
const btn = $('proposal-more');
|
|
336
|
+
if (menu) menu.hidden = true;
|
|
337
|
+
if (btn) { btn.setAttribute('aria-expanded', 'false'); if (refocus) btn.focus(); }
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function openMore(which = 'first') {
|
|
341
|
+
const menu = $('proposal-more-menu');
|
|
342
|
+
if (!menu) return;
|
|
343
|
+
menu.hidden = false;
|
|
344
|
+
$('proposal-more').setAttribute('aria-expanded', 'true');
|
|
345
|
+
const items = moreItems();
|
|
346
|
+
(which === 'last' ? items[items.length - 1] : items[0])?.focus();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** On a phone the mode button shows the compare switcher under the counts; from 768px the switcher is always there */
|
|
350
|
+
function toggleMode(force) {
|
|
351
|
+
const bar = $('proposal-bar');
|
|
352
|
+
const on = typeof force === 'boolean' ? force : bar.dataset.modeOpen !== 'true';
|
|
353
|
+
bar.dataset.modeOpen = String(on);
|
|
354
|
+
$('proposal-mode').setAttribute('aria-expanded', String(on));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function onMoreKey(e) {
|
|
358
|
+
const btn = $('proposal-more');
|
|
359
|
+
if (e.target === btn && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); openMore(e.key === 'ArrowUp' ? 'last' : 'first'); return; }
|
|
360
|
+
if (!moreOpen()) return;
|
|
361
|
+
if (e.key === 'Escape') { e.preventDefault(); closeMore(true); return; }
|
|
362
|
+
if (e.key === 'Tab') { closeMore(); return; }
|
|
363
|
+
const items = moreItems();
|
|
364
|
+
const at = items.indexOf(document.activeElement);
|
|
365
|
+
if (at < 0) return;
|
|
366
|
+
const next = { ArrowDown: (at + 1) % items.length, ArrowUp: (at - 1 + items.length) % items.length, Home: 0, End: items.length - 1 }[e.key];
|
|
367
|
+
if (next === undefined) return;
|
|
368
|
+
e.preventDefault();
|
|
369
|
+
items[next].focus();
|
|
370
|
+
}
|
|
371
|
+
|
|
316
372
|
// ---------------------------------------------------------------------------
|
|
317
373
|
// The picker
|
|
318
374
|
// ---------------------------------------------------------------------------
|
|
@@ -370,7 +426,7 @@ function renderMenu(loading = false) {
|
|
|
370
426
|
else if (!listing || listing.length === 0) body = '<p class="hx-faint hx-proposal-empty">No proposals</p>';
|
|
371
427
|
else body = `<div class="hx-proposal-list" role="list">${listing.map((e) => `<div role="listitem">${proposalRowHtml(e, current)}</div>`).join('')}</div>`;
|
|
372
428
|
const forge = forgeProblem && !listingProblem ? `<p class="hx-error-text hx-proposal-empty">The spec PRs could not be listed: ${escHtml(forgeProblem)}</p>` : '';
|
|
373
|
-
menu.innerHTML = `<div class="hx-menu-title hx-menu-head"><span
|
|
429
|
+
menu.innerHTML = `<div class="hx-menu-title hx-menu-head"><span>${escHtml(t('proposals'))}</span></div>${forge}${body}`;
|
|
374
430
|
}
|
|
375
431
|
|
|
376
432
|
// ---------------------------------------------------------------------------
|
|
@@ -451,7 +507,9 @@ const ACTIONS = {
|
|
|
451
507
|
'toggle-proposals-menu': () => toggleMenu(),
|
|
452
508
|
'open-proposal': (el) => openProposal(el.dataset.slug, el.dataset.source || null),
|
|
453
509
|
'close-proposal': () => closeProposal(),
|
|
454
|
-
'proposal-view': (el) => setProposalView(el.dataset.view),
|
|
510
|
+
'proposal-view': (el) => { setProposalView(el.dataset.view); toggleMode(false); },
|
|
511
|
+
'toggle-proposal-mode': () => toggleMode(),
|
|
512
|
+
'toggle-proposal-more': () => (moreOpen() ? closeMore() : openMore()),
|
|
455
513
|
'toggle-proposal-changes': () => toggleChanges(),
|
|
456
514
|
'proposal-focus': (el) => focusChange(el.dataset.kind, el.dataset.key),
|
|
457
515
|
};
|
|
@@ -460,6 +518,8 @@ function onClick(e) {
|
|
|
460
518
|
const target = e.target.closest ? e.target.closest('[data-action]') : null;
|
|
461
519
|
const action = target && ACTIONS[target.dataset.action];
|
|
462
520
|
if (action) action(target);
|
|
521
|
+
// A choice in the ⋯ menu closes it back onto its button (Close may stop at the what-if confirm); a click anywhere else just closes it
|
|
522
|
+
if (moreOpen() && !(target && target.dataset.action === 'toggle-proposal-more')) closeMore(!!(target && target.closest('#proposal-more-menu')));
|
|
463
523
|
// Any click outside the picker closes it
|
|
464
524
|
const wrap = $('proposal-wrap');
|
|
465
525
|
if (menuOpen() && wrap && !wrap.contains(e.target)) closeMenu();
|
|
@@ -467,6 +527,7 @@ function onClick(e) {
|
|
|
467
527
|
|
|
468
528
|
function onKey(e) {
|
|
469
529
|
if (e.key === 'Escape' && menuOpen()) closeMenu();
|
|
530
|
+
onMoreKey(e);
|
|
470
531
|
}
|
|
471
532
|
|
|
472
533
|
/** The marks' colours for the legend and the panel (the --hx-mark-* variables), the same the map draws on this ground */
|