@popcorn245/cornfield 0.50.0 → 0.50.1
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/explorer/focus-room.js +1 -7
- package/explorer/focusables.js +1 -1
- package/explorer/forge-panel.js +36 -2630
- package/explorer/index.html +15 -147
- package/explorer/instance-state.js +0 -7
- package/explorer/instance.js +16 -1
- package/explorer/page-pieces.js +21 -2
- package/explorer/page.js +3 -3
- package/explorer/panels.js +1 -5
- package/explorer/pieces/layers.js +1 -0
- package/explorer/pieces/node-panel.js +15 -5
- package/explorer/pieces/proposal.js +9 -0
- package/explorer/pieces/work-agent.js +211 -0
- package/explorer/pieces/work-common.js +88 -0
- package/explorer/pieces/work-confirm.js +169 -0
- package/explorer/pieces/work-data.js +178 -0
- package/explorer/pieces/work-deploys.js +104 -0
- package/explorer/pieces/work-events.js +285 -0
- package/explorer/pieces/work-issues.js +43 -0
- package/explorer/pieces/work-markup.js +155 -0
- package/explorer/pieces/work-notes.js +177 -0
- package/explorer/pieces/work-paint.js +312 -0
- package/explorer/pieces/work-prs.js +253 -0
- package/explorer/pieces/work-runs.js +387 -0
- package/explorer/pieces/work-specs.js +71 -0
- package/explorer/pieces/work-threads.js +309 -0
- package/explorer/pieces/work.js +285 -0
- package/explorer/proposal.js +1 -2
- package/explorer/runs-map.js +108 -103
- package/explorer/runs-view.js +8 -6
- package/explorer/strings.js +1 -1
- package/explorer/waiting-model.js +12 -12
- package/explorer/waiting-view.js +6 -6
- package/package.json +1 -1
- package/explorer/feedback.js +0 -15
- package/explorer/waiting-line.js +0 -14
package/explorer/index.html
CHANGED
|
@@ -127,14 +127,15 @@
|
|
|
127
127
|
</div>
|
|
128
128
|
<!--corn-piece:search/field-->
|
|
129
129
|
|
|
130
|
-
<!-- The Work toggle (explorer/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
<!-- The Work toggle (explorer/pieces/work.js): opens the Work panel; shown only when the config names a forge. It is a piece: page.js mounts it here, and until then this stand-in keeps its place (the piece's markup without ids) -->
|
|
131
|
+
<!--corn-placeholder:work/button-->
|
|
132
|
+
<button type="button" class="hx-work" data-action="toggle-forge" aria-expanded="false" 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" part="forge-button">
|
|
133
|
+
<span data-corn-string="issuesAndPrs">Work</span>
|
|
134
|
+
<span class="hx-forge-lit" data-corn="count" part="count" hidden></span>
|
|
135
|
+
<span class="hx-runner-dot" aria-hidden="true" title="No runner online" hidden></span>
|
|
136
|
+
<span class="hx-waiting-badge" data-corn="waiting-badge" part="waiting-badge" aria-hidden="true" hidden></span>
|
|
137
|
+
</button>
|
|
138
|
+
<!--corn-piece:work/button-->
|
|
138
139
|
|
|
139
140
|
<!-- The one account menu (explorer/account-menu.js): who, Theme, Freeform layout, Review tokens, Proposals, the links, Sign out, and what powers it -->
|
|
140
141
|
<div class="hx-menu-wrap hx-account">
|
|
@@ -185,8 +186,8 @@
|
|
|
185
186
|
<div class="hx-stage" role="main" data-corn="stage">
|
|
186
187
|
<!-- The map: its canvas (focusable, its keys read out with its name), the help for its keys, the announcer the keyboard speaks in and the canvas its labels are drawn on, made here by explorer/pieces/map.js -->
|
|
187
188
|
<!--corn-piece:map/stage-->
|
|
188
|
-
<!-- The nodes agent runs are changing, marked over the map (explorer/runs-map.js): a picture; the Runs view says the same in words -->
|
|
189
|
-
|
|
189
|
+
<!-- The nodes agent runs are changing, marked over the map (explorer/runs-map.js): a picture; the Runs view says the same in words. It is part of the Work piece (explorer/pieces/work.js): page.js mounts it here -->
|
|
190
|
+
<!--corn-piece:work/overlay-->
|
|
190
191
|
|
|
191
192
|
<!-- 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 -->
|
|
192
193
|
<div id="sheet-dock" class="hx-dock" data-corn="dock">
|
|
@@ -196,105 +197,9 @@
|
|
|
196
197
|
<!-- The review column (explorer/pieces/changes.js, spec 0006): what the proposal changes, and the personas and the scenarios that apply to them. Docked left of the map from 768px, the expanded proposal sheet's body on a phone. The decision (explorer/pieces/decision.js, spec 0007) is its foot: the column keeps its place -->
|
|
197
198
|
<!--corn-piece:changes/column-->
|
|
198
199
|
|
|
199
|
-
<!-- The Work panel (
|
|
200
|
+
<!-- The Work panel (explorer/pieces/work.js): Specs, PRs, Issues, Threads, Runs and Deploys, in the order of the loop. A slide-over from the left on desktop, a bottom sheet on a phone; hidden and inert until the config names a forge. It is a piece: page.js mounts it here -->
|
|
200
201
|
<p id="offline-banner" class="hx-offline" data-corn="notice" hidden></p>
|
|
201
|
-
|
|
202
|
-
<div class="hx-forge-body" data-corn="forge-panel">
|
|
203
|
-
<div class="hx-forge-top" data-corn="work-top">
|
|
204
|
-
<div class="hx-forge-head" data-corn="work-head">
|
|
205
|
-
<h2 id="forge-title" class="hx-drawer-title" data-corn="work-title" tabindex="-1">Work</h2>
|
|
206
|
-
<button type="button" class="hx-btn hx-btn--quiet" data-action="refresh-forge" title="Ask the forge again" data-corn-kind="quiet">Refresh</button>
|
|
207
|
-
<button type="button" class="hx-close" data-action="close-forge" aria-label="Close" data-corn-kind="icon">✕</button>
|
|
208
|
-
</div>
|
|
209
|
-
<div class="hx-forge-tabs" role="group" aria-label="Show" data-corn="tabs">
|
|
210
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="specs" aria-pressed="true" title="The proposals: what a change would add, change and remove" data-corn="tab"><span data-corn-string="tabSpecs">Specs</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
211
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="pulls" aria-pressed="false" title="Pull requests" data-corn="tab"><span data-corn-string="tabPulls">PRs</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
212
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="issues" aria-pressed="false" data-corn="tab"><span data-corn-string="tabIssues">Issues</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
213
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="threads" aria-pressed="false" title="Ideas and spec conversations, with the nodes they mention" data-corn="tab"><span data-corn-string="tabThreads">Threads</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
214
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="work" aria-pressed="false" title="Agent runs, and the work grouped by issue and proposal with agent-made work marked" data-corn="tab"><span data-corn-string="tabRuns">Runs</span><span class="hx-forge-count" data-corn="count"></span></button>
|
|
215
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="deploys" aria-pressed="false" data-corn="tab"><span data-corn-string="tabDeploys">Deploys</span><span class="hx-forge-count" data-corn="count" hidden></span></button>
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
<div id="forge-bar" class="hx-forge-bar">
|
|
219
|
-
<p id="forge-status" class="hx-forge-status hx-faint"></p>
|
|
220
|
-
<button data-corn="filter-chip" type="button" id="forge-filter-chip" class="hx-forge-chip" data-action="toggle-filters" aria-expanded="false" aria-controls="forge-filter-box" hidden>Filter<span class="hx-forge-count" data-corn="count" hidden></span></button>
|
|
221
|
-
</div>
|
|
222
|
-
<!-- The Specs tab's one search field (spec 0010 D5): titles, slugs and summaries, as you type -->
|
|
223
|
-
<div id="forge-specs-search" class="hx-forge-specsearch" data-corn="specs-search" hidden>
|
|
224
|
-
<label class="hx-forge-field hx-forge-field--text" data-corn="field">Find a spec<input data-corn="control" type="search" id="specs-search" class="hx-forge-input" placeholder="Title, name, summary" autocomplete="off" /></label>
|
|
225
|
-
</div>
|
|
226
|
-
<div id="forge-filter-box" class="hx-forge-controls" data-corn="filters" hidden>
|
|
227
|
-
<div id="forge-work-filters" class="hx-forge-work-filters" hidden>
|
|
228
|
-
<label class="hx-forge-toggle" data-corn="check-field"><input data-corn="control" type="checkbox" id="forge-work-agents" /> Agent-made only</label>
|
|
229
|
-
<label class="hx-forge-toggle" data-corn="check-field"><input data-corn="control" type="checkbox" id="forge-work-finished" /> Include merged and closed</label>
|
|
230
|
-
</div>
|
|
231
|
-
<div id="forge-filters" class="hx-forge-filters">
|
|
232
|
-
<label class="hx-forge-field" data-corn="field">State<select data-corn="control" id="forge-state" class="hx-forge-select"></select></label>
|
|
233
|
-
<label class="hx-forge-field" data-corn="field">Label<select data-corn="control" id="forge-label" class="hx-forge-select"></select></label>
|
|
234
|
-
<label class="hx-forge-field" data-corn="field">Author<select data-corn="control" id="forge-author" class="hx-forge-select"></select></label>
|
|
235
|
-
<label class="hx-forge-field hx-forge-field--text" data-corn="field">Search<input data-corn="control" type="search" id="forge-text" class="hx-forge-input" placeholder="Title, number, label" autocomplete="off" /></label>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
<p id="forge-notice" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
239
|
-
<p id="forge-act-note" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
240
|
-
<!-- Release notes (forge-panel.js), reached from the PRs list: the pull requests merged since a tag, grouped by the map; copy them, or have the forge keep them as a draft release -->
|
|
241
|
-
<section id="forge-notes" class="hx-forge-notes" aria-label="Release notes" hidden>
|
|
242
|
-
<button data-corn="back" type="button" class="hx-forge-back" data-action="close-notes"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="M10 3L5 8l5 5"/></svg><span class="hx-forge-back-text">All pull requests</span></button>
|
|
243
|
-
<h3 id="notes-title" class="hx-forge-notes-title" data-corn="detail-title" tabindex="-1">Release notes</h3>
|
|
244
|
-
<label class="hx-forge-field" data-corn="field">Since tag<select data-corn="control" id="notes-since" class="hx-forge-select"></select></label>
|
|
245
|
-
<label class="hx-forge-field" data-corn="field">Draft, in Markdown<textarea data-corn="control" id="notes-preview" class="hx-forge-preview" rows="14" readonly spellcheck="false"></textarea></label>
|
|
246
|
-
<div class="hx-forge-actions">
|
|
247
|
-
<button data-corn-kind="secondary" type="button" id="notes-copy" class="hx-btn" data-action="copy-notes">Copy</button>
|
|
248
|
-
<button type="button" id="notes-post" class="hx-btn hx-btn--approve" data-action="post-notes" aria-expanded="false" aria-controls="notes-confirm" data-corn-kind="approve">Post as draft …</button>
|
|
249
|
-
</div>
|
|
250
|
-
<p id="notes-message" class="hx-forge-msg" hidden data-corn="message"></p>
|
|
251
|
-
<div id="notes-confirm" class="hx-forge-confirm" data-corn="confirm-form" role="group" aria-labelledby="notes-confirm-title" hidden>
|
|
252
|
-
<h3 id="notes-confirm-title" class="hx-forge-confirm-title">Post as a draft release</h3>
|
|
253
|
-
<p id="notes-confirm-words"></p>
|
|
254
|
-
<label class="hx-forge-field" data-corn="field">Tag for the draft<input data-corn="control" type="text" id="notes-tag" class="hx-forge-input" autocomplete="off" spellcheck="false" /></label>
|
|
255
|
-
<div class="hx-forge-actions">
|
|
256
|
-
<button type="button" id="notes-confirm-yes" class="hx-btn hx-btn--approve" data-action="confirm-notes" data-corn-kind="approve">Create the draft</button>
|
|
257
|
-
<button type="button" class="hx-btn hx-btn--quiet" data-action="cancel-notes" data-corn-kind="quiet">Cancel</button>
|
|
258
|
-
</div>
|
|
259
|
-
</div>
|
|
260
|
-
</section>
|
|
261
|
-
<!-- Agent runs (forge-panel.js, runs-model.js): shown on the Runs tab; each run's state, what it is about, links, and Stop -->
|
|
262
|
-
<section id="forge-runs" class="hx-forge-runs" aria-labelledby="forge-runs-title" hidden>
|
|
263
|
-
<h3 id="forge-runs-title" class="hx-forge-runs-title">Agent runs</h3>
|
|
264
|
-
<p id="forge-runs-runner" class="hx-forge-meta" hidden></p>
|
|
265
|
-
<p id="forge-runs-status" class="hx-forge-meta hx-faint"></p>
|
|
266
|
-
<p id="forge-runs-note" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
267
|
-
<p id="forge-runs-trigger" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
268
|
-
<div id="forge-runs-totals" data-corn="run-totals" role="group" aria-label="Tokens and cost the runners reported" hidden></div>
|
|
269
|
-
<ul id="forge-runs-hand" class="hx-forge-meta" aria-label="Requests written by hand that started nothing" hidden></ul>
|
|
270
|
-
<ul id="forge-runs-list" class="hx-forge-files" aria-label="Runs"></ul>
|
|
271
|
-
</section>
|
|
272
|
-
<section id="forge-detail" class="hx-forge-detail" aria-label="Selected pull request" hidden></section>
|
|
273
|
-
<ul id="forge-list" class="hx-forge-list" aria-label="Results"></ul>
|
|
274
|
-
<!-- The foot of the list: Release notes… on the PRs list, New idea on Specs (and Threads) -->
|
|
275
|
-
<div id="forge-foot" class="hx-forge-foot" data-corn="work-foot">
|
|
276
|
-
<button data-corn-kind="secondary" type="button" id="notes-open" class="hx-btn" data-action="open-notes" hidden>Release notes …</button>
|
|
277
|
-
<!-- New idea (forge-panel.js): opens an issue with the threads label as you, on the forge; the thread itself lives there -->
|
|
278
|
-
<section id="forge-idea" class="hx-forge-notes" aria-label="New idea" data-corn-string-aria-label="newIdea" hidden>
|
|
279
|
-
<div class="hx-forge-actions">
|
|
280
|
-
<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>
|
|
281
|
-
</div>
|
|
282
|
-
<p id="idea-message" class="hx-forge-msg" role="status" hidden data-corn="message"></p>
|
|
283
|
-
<div id="idea-form" data-corn="confirm-form" class="hx-forge-confirm" role="group" aria-labelledby="idea-form-title" hidden>
|
|
284
|
-
<h3 id="idea-form-title" class="hx-forge-confirm-title" data-corn-string="newIdea">New idea</h3>
|
|
285
|
-
<p id="idea-words"></p>
|
|
286
|
-
<label class="hx-forge-field" data-corn="field">Title<input data-corn="control" type="text" id="idea-title" class="hx-forge-input" maxlength="256" autocomplete="off" /></label>
|
|
287
|
-
<label class="hx-forge-field" data-corn="field">What is the idea?<textarea data-corn="control" id="idea-body" class="hx-forge-preview hx-thread-compose" rows="6" maxlength="20000" spellcheck="true"></textarea></label>
|
|
288
|
-
<div class="hx-forge-actions">
|
|
289
|
-
<button type="button" id="idea-send" class="hx-btn hx-btn--approve" data-action="idea-send" data-corn-kind="approve">Open the idea</button>
|
|
290
|
-
<button type="button" class="hx-btn hx-btn--quiet" data-action="idea-cancel" data-corn-kind="quiet">Cancel</button>
|
|
291
|
-
</div>
|
|
292
|
-
</div>
|
|
293
|
-
</section>
|
|
294
|
-
</div>
|
|
295
|
-
<p id="forge-rate" class="hx-forge-rate hx-faint"></p>
|
|
296
|
-
</div>
|
|
297
|
-
</aside>
|
|
202
|
+
<!--corn-piece:work/panel-->
|
|
298
203
|
|
|
299
204
|
<!-- Node panel: a slide-over on desktop, a bottom sheet on mobile. It is a piece (explorer/pieces/node-panel.js): page.js mounts it here -->
|
|
300
205
|
<!--corn-piece:node-panel/drawer-->
|
|
@@ -318,45 +223,8 @@
|
|
|
318
223
|
|
|
319
224
|
</div>
|
|
320
225
|
|
|
321
|
-
<!-- The confirm step of landing a pull request, starting a spec and opening a build issue (
|
|
322
|
-
|
|
323
|
-
<div class="hx-confirm glass" role="dialog" aria-modal="true" aria-labelledby="forge-confirm-title" aria-describedby="forge-confirm-body" data-corn="confirm-dialog">
|
|
324
|
-
<h2 id="forge-confirm-title" class="hx-confirm-title" data-corn="dialog-title"></h2>
|
|
325
|
-
<div id="forge-confirm-body"></div>
|
|
326
|
-
<div class="hx-confirm-actions">
|
|
327
|
-
<button data-corn-kind="secondary" type="button" class="hx-btn" data-action="forge-confirm-cancel">Cancel</button>
|
|
328
|
-
<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>
|
|
329
|
-
</div>
|
|
330
|
-
</div>
|
|
331
|
-
</div>
|
|
332
|
-
|
|
333
|
-
<!-- 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 -->
|
|
334
|
-
<div id="agent-start" class="hx-confirm-scrim" hidden data-corn="dialog-scrim">
|
|
335
|
-
<div class="hx-confirm glass" role="dialog" aria-modal="true" aria-labelledby="agent-start-title" aria-describedby="agent-start-words" data-corn="agent-dialog">
|
|
336
|
-
<h2 id="agent-start-title" class="hx-confirm-title" data-corn="dialog-title" data-corn-string="startAgent">Start an agent</h2>
|
|
337
|
-
<p id="agent-start-about" class="hx-forge-meta"></p>
|
|
338
|
-
<p id="agent-start-runner" class="hx-forge-meta" hidden></p>
|
|
339
|
-
<p id="agent-retry-note" class="hx-forge-meta" hidden></p>
|
|
340
|
-
<form id="agent-start-form" class="hx-forge-confirm" data-corn="confirm-form" novalidate>
|
|
341
|
-
<label class="hx-forge-field" data-corn="field">Kind of run<select data-corn="control" id="agent-kind" class="hx-forge-select"></select></label>
|
|
342
|
-
<label id="agent-profile-field" class="hx-forge-field" hidden data-corn="field">Profile<select data-corn="control" id="agent-profile" class="hx-forge-select"></select></label>
|
|
343
|
-
<fieldset id="agent-limits-edit" class="hx-forge-field hx-forge-limits" data-corn="field"><legend>Limits, hints for the runner (one left blank takes the config's, if any)</legend>
|
|
344
|
-
<label class="hx-forge-field" data-corn="field">Minutes<input data-corn="control" type="number" id="agent-limit-minutes" class="hx-forge-input" min="0" step="any" inputmode="decimal" /></label>
|
|
345
|
-
<label class="hx-forge-field" data-corn="field">Turns<input data-corn="control" type="number" id="agent-limit-turns" class="hx-forge-input" min="0" step="1" inputmode="numeric" /></label>
|
|
346
|
-
<label class="hx-forge-field" data-corn="field">Cost<input data-corn="control" type="number" id="agent-limit-cost" class="hx-forge-input" min="0" step="any" inputmode="decimal" /></label>
|
|
347
|
-
<label class="hx-forge-field" data-corn="field">Tokens<input data-corn="control" type="number" id="agent-limit-tokens" class="hx-forge-input" min="0" step="1" inputmode="numeric" /></label>
|
|
348
|
-
</fieldset>
|
|
349
|
-
<label class="hx-forge-field" data-corn="field">Brief for the runner<textarea data-corn="control" id="agent-brief" class="hx-forge-preview" rows="6" maxlength="20000" spellcheck="true"></textarea></label>
|
|
350
|
-
<label id="agent-force-field" class="hx-forge-toggle" data-corn="check-field" hidden><input data-corn="control" type="checkbox" id="agent-force" /> Ask for another run on purpose</label>
|
|
351
|
-
<p id="agent-start-words" class="hx-confirm-note"></p>
|
|
352
|
-
<p id="agent-start-msg" class="hx-forge-msg hx-forge-msg--bad" role="alert" hidden data-corn="message" data-corn-state="failure"></p>
|
|
353
|
-
<div class="hx-confirm-actions">
|
|
354
|
-
<button data-corn-kind="secondary" type="button" class="hx-btn" data-action="agent-start-cancel">Cancel</button>
|
|
355
|
-
<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>
|
|
356
|
-
</div>
|
|
357
|
-
</form>
|
|
358
|
-
</div>
|
|
359
|
-
</div>
|
|
226
|
+
<!-- The confirm step of landing a pull request, starting a spec and opening a build issue, and Start an agent (explorer/pieces/work.js): modal dialogs over a scrim; the focus stays in them while one is open. Part of the Work piece: page.js mounts them here -->
|
|
227
|
+
<!--corn-piece:work/dialogs-->
|
|
360
228
|
|
|
361
229
|
<!-- Review tokens (review-tokens.js): make one (shown once), list them, revoke; a modal dialog over a scrim, the focus stays in it -->
|
|
362
230
|
<div id="tokens-dialog" class="hx-confirm-scrim" hidden data-corn="dialog-scrim">
|
|
@@ -156,13 +156,6 @@ export function createState() {
|
|
|
156
156
|
*/
|
|
157
157
|
runsMap: null,
|
|
158
158
|
|
|
159
|
-
/**
|
|
160
|
-
* Which threads mention which nodes (forge-panel.js, docs/threads.md), for a node's panel: `{ for(nodeId) -> thread[] | null,
|
|
161
|
-
* ensure(), open(number) }`, or null when threads are off or there is no forge. `for` answers null until the list has been
|
|
162
|
-
* read; `ensure` reads it (once) and repaints the panel's "Threads"; `open` shows a thread in the issues and PRs panel.
|
|
163
|
-
*/
|
|
164
|
-
threadIndex: null,
|
|
165
|
-
|
|
166
159
|
/**
|
|
167
160
|
* Changes whenever anything the scene is built from changes (scene.js). render.js rebuilds the
|
|
168
161
|
* scene only when this moved: never for a camera change or a packet frame.
|
package/explorer/instance.js
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* handlers of `on(name, ...)`, else `undefined`. A piece that finds no answer does without (the Work panel is not part of every page)
|
|
17
17
|
* inst.setSelection(node, edge, { source, quiet }) the one way the converted pieces change what is selected (explorer/engine/selection.js);
|
|
18
18
|
* returns the change, whose `announce()` says it when `quiet` held it back (the caller touches the scene first)
|
|
19
|
-
* inst.offline() whether the browser has no network; inst.onNetwork(fn(offline)), inst.onWindowFocus(fn), inst.onPageHide(fn), inst.onHide(fn): the few window facts the review needs
|
|
19
|
+
* inst.offline() whether the browser has no network; inst.onNetwork(fn(offline)), inst.onWindowFocus(fn), inst.onPageHide(fn), inst.onPageShow(fn), inst.onResize(fn), inst.onHide(fn): the few window facts the review needs;
|
|
20
|
+
* inst.onPageFocus(fn(event)): a focus anywhere in the page, outside the root too (a modal dialog's trap in a host's page)
|
|
20
21
|
* inst.active() the element that has the focus inside the root's tree (a shadow root's own, not the host)
|
|
21
22
|
* inst.el an element of the instance by id, found inside its root and never by document id
|
|
22
23
|
* inst.listen a listener that `destroy()` removes; inst.own: any other clean-up `destroy()` runs; inst.release(fn): takes one back that its owner ran itself
|
|
@@ -54,6 +55,10 @@
|
|
|
54
55
|
* piece:refused { piece, reason, message, host } a piece that cannot have this instance (a second map in a scope); the scope says it as `cornError`
|
|
55
56
|
* and tells `host` to ask again when the root is free
|
|
56
57
|
* attach:released (none) the piece that had the instance's root (`attach`) gave it back
|
|
58
|
+
* work:waiting { total } what waits on the maintainer changed (specs to decide plus runs that need an answer; pieces/work.js): the page puts the number before its title
|
|
59
|
+
* work:available { on } the Work panel started (a forge in the config and somebody signed in), or ended: the account menu's Proposals entry is only for a cornfield without it
|
|
60
|
+
* runs:map { active } runs are on the map, or none is (pieces/work.js, runs-map.js): the Layers menu shows its legend while there are
|
|
61
|
+
* thread:open { number } a thread listed in the node panel was chosen; thread:start { node }: "Start a thread about this" (pieces/node-panel.js; the Work panel opens the thread, or its New idea form)
|
|
57
62
|
* announce text what a screen reader is told (engine/keyboard.js `announce`, which also writes it in the root's `#map-announcer`, if it has one)
|
|
58
63
|
*
|
|
59
64
|
* What a piece is asked to do (`emit`ted to it):
|
|
@@ -74,6 +79,10 @@
|
|
|
74
79
|
* forge:can-start (none) can a run be started from here? -> boolean; forge:start (emit) { slug, returnTo }: open the Start dialog
|
|
75
80
|
* scenario:clear (none) (emit) a selection ends a playing scenario
|
|
76
81
|
* proposal:effective proposal -> proposal the proposal the map is drawn from (the what-if editor's, with its edits in); proposal:before-close -> false keeps it open
|
|
82
|
+
* threads:index nodeId -> { threads: thread[] | null, forge: string, start: true } | undefined the Work panel's list of the threads that mention a node, for the node panel's "Threads"; `threads` is null until the list was read; no answer: no Threads section
|
|
83
|
+
* threads:ensure (none) (emit) the node panel was filled: the Work panel reads the threads list once; threads:changed: it was read, or the map changed, so the node panel draws "Threads" again
|
|
84
|
+
* work:on (none) -> boolean whether the Work panel has started (a piece mounted after it asks rather than waits for `work:available`)
|
|
85
|
+
* work:answer { run } (emit) "Answer" on the proposal bar's line: the Work panel opens on Runs at that run, its reply field focused
|
|
77
86
|
* work:open-specs (none) -> true the Work panel's Specs tab opened for a bad link's way on; map:set { nodes, edges } -> true the page laid the map out from these
|
|
78
87
|
* changes:opened-line title -> string, changes:played-line -> string what the review column says of an opening, and how many scenarios were played
|
|
79
88
|
* whatif:edits -> edits[], whatif:form -> { name } | null, whatif:describe -> string[] what the decision asks of the what-if editor
|
|
@@ -288,6 +297,12 @@ export function createInstance({ root: rootOpt = null, base = '', fetch: fetchOp
|
|
|
288
297
|
onWindowFocus: (fn) => (win ? inst.listen(win, 'focus', () => fn()) : () => {}),
|
|
289
298
|
/** Calls `fn()` when the page is going away (a tab closed, a reload). Removed by destroy(). */
|
|
290
299
|
onPageHide: (fn) => (win ? inst.listen(win, 'pagehide', () => fn()) : () => {}),
|
|
300
|
+
/** Calls `fn()` when the window is resized. Removed by destroy(). */
|
|
301
|
+
onResize: (fn) => (win ? inst.listen(win, 'resize', () => fn()) : () => {}),
|
|
302
|
+
/** Calls `fn()` when the page is shown again, or comes back from the back-forward cache. Removed by destroy(). */
|
|
303
|
+
onPageShow: (fn) => (win ? inst.listen(win, 'pageshow', () => fn()) : () => {}),
|
|
304
|
+
/** Calls `fn(event)` for every focus that lands in the page, outside the root as well (which the root's own `focusin` never hears). Removed by destroy(). */
|
|
305
|
+
onPageFocus: (fn) => (doc ? inst.listen(doc, 'focusin', (e) => fn(e)) : () => {}),
|
|
291
306
|
/** Calls `fn()` when the tab is hidden. Removed by destroy(). */
|
|
292
307
|
onHide(fn) {
|
|
293
308
|
if (!doc) return () => {};
|
package/explorer/page-pieces.js
CHANGED
|
@@ -21,9 +21,10 @@ import * as search from './pieces/search.js';
|
|
|
21
21
|
import * as proposal from './pieces/proposal.js';
|
|
22
22
|
import * as changes from './pieces/changes.js';
|
|
23
23
|
import * as decision from './pieces/decision.js';
|
|
24
|
+
import * as work from './pieces/work.js';
|
|
24
25
|
|
|
25
26
|
/** The pieces of the page, in the order they are mounted (the node panel registers its sheet; search and the Layers menu follow the map) */
|
|
26
|
-
const PIECES = { 'node-panel': nodePanel, layers, search, proposal, changes, decision }; // (the decision's place is inside the changes piece's column: it follows it)
|
|
27
|
+
const PIECES = { 'node-panel': nodePanel, layers, search, proposal, changes, decision, work }; // (the decision's place is inside the changes piece's column: it follows it)
|
|
27
28
|
const mounted = new Map(); // name -> { handle, markers: Comment[] }
|
|
28
29
|
const optionsOf = new Map(); // name -> what the page tells a piece besides its places (a checker, a clock)
|
|
29
30
|
|
|
@@ -39,6 +40,23 @@ function markersOf(doc, name) {
|
|
|
39
40
|
return found;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* The Work panel says what waits on the maintainer (`work:waiting`); the browser tab's title is the page's, so the page puts "(3) " before its own
|
|
45
|
+
* title while something waits. A host app keeps its own title and does not listen.
|
|
46
|
+
*/
|
|
47
|
+
let titleOff = null;
|
|
48
|
+
let baseTitle = null;
|
|
49
|
+
function keepTitle(inst) {
|
|
50
|
+
if (titleOff) titleOff();
|
|
51
|
+
titleOff = inst.on('work:waiting', ({ total }) => {
|
|
52
|
+
const doc = inst.doc;
|
|
53
|
+
if (!doc) return;
|
|
54
|
+
if (baseTitle === null) baseTitle = doc.title.replace(/^\(\d+\) /, '');
|
|
55
|
+
doc.title = total > 0 ? `(${total}) ${baseTitle}` : baseTitle;
|
|
56
|
+
if (!(total > 0)) baseTitle = null;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
42
60
|
/** The places of a piece the page mounts itself (the map: page.js), by slot: `{ stage: Comment }` */
|
|
43
61
|
export function pieceSlots(name) {
|
|
44
62
|
return markersOf(pageInstance().doc, name);
|
|
@@ -58,6 +76,7 @@ export function ensurePagePieces() {
|
|
|
58
76
|
if (!markers.length) continue;
|
|
59
77
|
pageMap(); // the pieces follow the page's map: it is there before they are
|
|
60
78
|
mounted.set(name, { handle: piece.mount(doc.body, inst, { ...(optionsOf.get(name) || {}), slots }), markers });
|
|
79
|
+
if (name === 'work') keepTitle(inst);
|
|
61
80
|
}
|
|
62
81
|
return Object.fromEntries([...mounted].map(([name, { handle }]) => [name, handle]));
|
|
63
82
|
}
|
|
@@ -80,7 +99,7 @@ export function mergePagePieceOptions(name, patch) {
|
|
|
80
99
|
if (have) have.handle.update(patch);
|
|
81
100
|
}
|
|
82
101
|
|
|
83
|
-
/** The page's mounted piece by name ('node-panel', 'layers', 'search', 'proposal', 'changes', 'decision'), or null; `anywhere`: mounted at the end of the body when the page has no place for it */
|
|
102
|
+
/** The page's mounted piece by name ('node-panel', 'layers', 'search', 'proposal', 'changes', 'decision', 'work'), or null; `anywhere`: mounted at the end of the body when the page has no place for it */
|
|
84
103
|
export function pagePiece(name, { anywhere = false } = {}) {
|
|
85
104
|
ensurePagePieces();
|
|
86
105
|
// A caller that needs the piece whether or not the page has a place for it (a test drives the scenario player on a bare stage) has it at the end of the body
|
package/explorer/page.js
CHANGED
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
* keyboard.js the map by keyboard and the screen reader's announcer; keyboard-model.js its pure half
|
|
26
26
|
* live.js the live layer: the chip, polling, laying a live source's answer over the map; live-model.js its pure half
|
|
27
27
|
* review-tokens.js review tokens for the review API, when somebody is signed in: make one (shown once), list, revoke; review-tokens-model.js its pure half
|
|
28
|
-
*
|
|
28
|
+
* pieces/work.js the Work panel (a piece, with a part per tab in pieces/work-*.js), when the config names a forge: a PR lights the nodes it changes; forge-panel-model.js its pure half;
|
|
29
|
+
* forge-panel.js is the page's way in to it (initForgePanel, the deep links)
|
|
29
30
|
* theme.js light or dark: the system setting and the header toggle; theme-model.js the colours (theme-boot.js before the first paint)
|
|
30
31
|
*/
|
|
31
32
|
|
|
@@ -59,7 +60,6 @@ import { initTheme, setThemeChoice } from './theme.js';
|
|
|
59
60
|
import { initAccountMenu } from './account-menu.js';
|
|
60
61
|
import { watchHeaderFit } from './header-fit.js';
|
|
61
62
|
import { watchHint } from './hint.js';
|
|
62
|
-
import { watchFocusRoom } from './focus-room.js';
|
|
63
63
|
|
|
64
64
|
/** The instance and its map: made by `startPage`, the one of this document */
|
|
65
65
|
let inst;
|
|
@@ -189,7 +189,7 @@ export function startPage() {
|
|
|
189
189
|
syncViewUi();
|
|
190
190
|
// /?proposal=<slug> opens a proposal over the map, /?view=dataflow the data-flow preset: both have a link
|
|
191
191
|
// The config is read and applied by engine/source.js, as a scope does it; a page opened without the server reads as no config
|
|
192
|
-
const configReady = fetchConfig(inst).catch(() => ({})).then((config) => { applyBranding(document, config); watchHeaderFit(document); watchHint(document);
|
|
192
|
+
const configReady = fetchConfig(inst).catch(() => ({})).then((config) => { applyBranding(document, config); watchHeaderFit(document); watchHint(document); applyConfig(inst, config); syncViewUi(); return config; }); // the brand, then the theme's icons for the map; the hint again, in the repo's words
|
|
193
193
|
loadTopology().then(async (ok) => {
|
|
194
194
|
if (!ok) return;
|
|
195
195
|
// 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
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
* A bridge (spec 0011 D2 and D3, step 4): the node panel is now a piece (pieces/node-panel.js) and choosing a node is the instance's
|
|
5
5
|
* (engine/selection.js). This file keeps the old names for the modules that are not yet on an instance (forge-panel.js, house.js, proposal.js,
|
|
6
6
|
* review-column.js, page.js), bound to the page's instance, and answers for the unconverted neighbours the piece asks (the live layer's
|
|
7
|
-
* block
|
|
7
|
+
* block). It goes when the last of those callers is converted.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { pageInstance } from './state.js';
|
|
11
11
|
import { liveSection, hydrateLivePhotos } from './live.js';
|
|
12
|
-
import { canStartAgent, openProposalStart } from './forge-panel.js';
|
|
13
12
|
import { selectNode as select, clearSelection } from './engine/selection.js';
|
|
14
13
|
import { diffPillWords as pill, LINES_CAP as CAP, copySpec as copy } from './pieces/node-panel.js';
|
|
15
14
|
import { pagePiece } from './page-pieces.js';
|
|
@@ -20,8 +19,6 @@ export const LINES_CAP = CAP;
|
|
|
20
19
|
const page = pageInstance();
|
|
21
20
|
page.on('live:section', (node) => liveSection(node));
|
|
22
21
|
page.on('live:hydrate', (el) => { hydrateLivePhotos(el); });
|
|
23
|
-
page.on('forge:can-start', () => canStartAgent());
|
|
24
|
-
page.on('forge:start', ({ slug, returnTo }) => { openProposalStart(slug, returnTo); });
|
|
25
22
|
|
|
26
23
|
/** Selects a node: lights what is one edge from it on the map and fills the side panel. `frame`: the camera follows (a search, a list, a link, the keyboard) */
|
|
27
24
|
export async function selectNode(node, { frame = false, source = frame ? 'link' : 'api' } = {}) {
|
|
@@ -36,7 +33,6 @@ export function closeDrawer() {
|
|
|
36
33
|
|
|
37
34
|
/** "Added by Checkout": the pill for a node the open proposal touches; '' for one it leaves alone */
|
|
38
35
|
export const diffPillWords = (node) => pill(node, pageInstance().state.proposal);
|
|
39
|
-
export const repaintThreads = () => { const p = pagePiece('node-panel'); if (p) p.repaintThreads(); };
|
|
40
36
|
export const keepSelectedInView = () => { const p = pagePiece('node-panel'); if (p) p.keepSelectedInView(); };
|
|
41
37
|
export const startRun = () => { const p = pagePiece('node-panel'); if (p) p.startRun(); };
|
|
42
38
|
/** Copies the selected node as JSON (the Copy Spec button); `button` is kept for the old signature */
|
|
@@ -301,6 +301,7 @@ export function mount(root, inst, options = {}) {
|
|
|
301
301
|
scope.on('layers:redraw', renderLayerToggles);
|
|
302
302
|
scope.on('theme', renderLayerToggles); // the dots and the legends are drawn in the theme's colours
|
|
303
303
|
scope.on('view', syncView);
|
|
304
|
+
scope.on('runs:map', ({ active }) => { const legend = own('runs-legend'); if (legend) legend.hidden = !active; }); // runs are on the map (the Work panel): the legend says what each mark is
|
|
304
305
|
// The marks legend is there while a proposal is open (the proposal's bar says so: engine/proposal.js)
|
|
305
306
|
const showLegend = (open) => { const legend = own('proposal-legend'); if (legend) legend.hidden = !open; };
|
|
306
307
|
scope.on('proposal:draw', ({ open }) => showLegend(open));
|
|
@@ -250,11 +250,12 @@ function sectionsOf(inst) {
|
|
|
250
250
|
|
|
251
251
|
/** "Threads": the threads whose text names the node (an idea, or a spec PR's conversation); each opens in the Work panel */
|
|
252
252
|
function threadsSection(node) {
|
|
253
|
-
|
|
253
|
+
// The Work panel answers (threads:index) when threads are on and a maintainer is signed in; nobody answering is no Threads section
|
|
254
|
+
const index = inst.ask('threads:index', node.id);
|
|
254
255
|
if (!index) return '';
|
|
255
|
-
const threads = index.
|
|
256
|
-
// "Start a thread about this" shows whenever threads are on and a maintainer is signed in (the panel only
|
|
257
|
-
const start = index.start ? `<button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet hx-textact" data-thread-start="${escHtml(node.id)}" aria-label="Start a thread about this: opens the New idea form for ${escHtml(index.forge
|
|
256
|
+
const threads = index.threads;
|
|
257
|
+
// "Start a thread about this" shows whenever threads are on and a maintainer is signed in (the panel only answers then)
|
|
258
|
+
const start = index.start ? `<button data-corn-kind="quiet" type="button" class="hx-btn hx-btn--quiet hx-textact" data-thread-start="${escHtml(node.id)}" aria-label="Start a thread about this: opens the New idea form for ${escHtml(index.forge)}, with this node mentioned">Start a thread about this</button>` : '';
|
|
258
259
|
if (!threads || !threads.length) return start;
|
|
259
260
|
const rows = threads.map((th) => {
|
|
260
261
|
const count = Number(th.comments) || 0;
|
|
@@ -410,7 +411,7 @@ export function mount(root, inst, options = {}) {
|
|
|
410
411
|
<div id="drawer-threads">${sections.threadsSection(node)}</div>
|
|
411
412
|
${sections.diffSection(node)}`;
|
|
412
413
|
addParts(metaList);
|
|
413
|
-
|
|
414
|
+
inst.emit('threads:ensure'); // the Work panel reads the threads once, for "Mentioned in"
|
|
414
415
|
inst.emit('live:hydrate', own('drawer-live'));
|
|
415
416
|
|
|
416
417
|
// The actions: Open file (the node's file on the forge) is the primary one; with an address too, Open route is the quiet one.
|
|
@@ -513,6 +514,15 @@ export function mount(root, inst, options = {}) {
|
|
|
513
514
|
// The panel's ✕: the focus would be left on a hidden button, so it goes back to the map
|
|
514
515
|
if (target.dataset.action === 'close-drawer' && state.canvas) scope.timeout(() => state.canvas.focus(), 0);
|
|
515
516
|
});
|
|
517
|
+
// A thread listed in the panel opens in the Work panel, and "Start a thread about this" opens its New idea form (the Work panel hears both)
|
|
518
|
+
scope.listen(drawer, 'click', (e) => {
|
|
519
|
+
const open = e.target.closest && e.target.closest('[data-thread-open]');
|
|
520
|
+
if (open) { inst.emit('thread:open', { number: Number(open.dataset.threadOpen) }); return; }
|
|
521
|
+
const start = e.target.closest && e.target.closest('[data-thread-start]');
|
|
522
|
+
if (start && state.selectedNode) inst.emit('thread:start', { node: state.selectedNode });
|
|
523
|
+
});
|
|
524
|
+
// The threads that mention nodes changed (the list was read, or the map changed): the section is drawn again
|
|
525
|
+
scope.on('threads:changed', () => repaintThreads());
|
|
516
526
|
// The dim layer behind the panel: on a phone a tap there folds the panel to its peek; elsewhere it closes it
|
|
517
527
|
scope.listen(backdrop, 'click', (e) => {
|
|
518
528
|
if (isPhone(inst)) { onBackdrop(inst, e); return; }
|
|
@@ -412,6 +412,15 @@ export function mount(root, inst, options = {}) {
|
|
|
412
412
|
const wrap = own('proposal-wrap');
|
|
413
413
|
if (menuOpen() && wrap && !wrap.contains(e.target) && !(target && target.dataset.action === 'proposal-way')) closeMenu(); // (a bad link's Specs list opens it from outside)
|
|
414
414
|
});
|
|
415
|
+
// Answer, on the bar's line (a run waits on this proposal): the Work panel opens on that run with its reply field focused (work:answer)
|
|
416
|
+
scope.listen(bar, 'click', (e) => {
|
|
417
|
+
const go = e.target.closest && e.target.closest('[data-waiting-answer]');
|
|
418
|
+
if (go) { e.preventDefault(); e.stopPropagation(); inst.emit('work:answer', { run: go.dataset.waitingAnswer }); }
|
|
419
|
+
}, true);
|
|
420
|
+
// With the Work panel on, its Specs tab lists the proposals: the account menu's Proposals entry is only for a cornfield without it (no forge, or no sign-in)
|
|
421
|
+
const proposalsEntry = (workOn) => { const wrap = own('proposal-wrap'); if (wrap) wrap.hidden = !!workOn; };
|
|
422
|
+
scope.on('work:available', ({ on }) => proposalsEntry(on));
|
|
423
|
+
if (inst.ask('work:on')) proposalsEntry(true); // the Work panel started before this piece was mounted: it said so to nobody
|
|
415
424
|
scope.listen(inst.root, 'keydown', (e) => {
|
|
416
425
|
if (e.key === 'Escape' && menuOpen()) closeMenu();
|
|
417
426
|
onMoreKey(e);
|