@popcorn245/cornfield 0.62.0 → 0.63.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/release-notes.js +2 -2
- package/explorer/css/changes.css +3 -7
- package/explorer/css/header.css +15 -0
- package/explorer/css/layers.css +11 -2
- package/explorer/css/map.css +0 -1
- package/explorer/css/node-panel.css +45 -0
- package/explorer/css/page.css +2 -7
- package/explorer/css/proposal.css +2 -3
- package/explorer/css/work.css +7 -7
- package/explorer/engine/hint.js +7 -7
- package/explorer/engine/keyboard.js +5 -4
- package/explorer/engine/map-rect.js +2 -2
- package/explorer/engine/render.js +2 -1
- package/explorer/forge-panel-model.js +24 -0
- package/explorer/history-model.js +21 -11
- package/explorer/history-replay.js +13 -5
- package/explorer/history.js +16 -7
- package/explorer/index.html +6 -3
- package/explorer/page.js +1 -2
- package/explorer/panel-model.js +103 -0
- package/explorer/panel-sections.js +140 -0
- package/explorer/pieces/layers.js +27 -6
- package/explorer/pieces/node-panel.js +78 -1
- package/explorer/pieces/search.js +22 -9
- package/explorer/pieces/work-deploys.js +13 -13
- package/explorer/pieces/work-issues.js +10 -5
- package/explorer/pieces/work-list.js +72 -9
- package/explorer/pieces/work-paint.js +45 -10
- package/explorer/pieces/work-prs.js +46 -34
- package/explorer/pieces/work-runs.js +17 -5
- package/explorer/pieces/work-specs.js +24 -4
- package/explorer/pieces/work-threads.js +59 -15
- package/explorer/pieces/work.js +6 -3
- package/explorer/proposal-model.js +3 -6
- package/explorer/runs-view.js +42 -8
- package/explorer/scene.js +5 -1
- package/explorer/work-model.js +266 -55
- package/explorer/work-view.css +9 -16
- package/explorer/work-view.js +107 -34
- package/package.json +1 -1
- package/server/server.js +1 -1
- package/server/work-graph.js +5 -5
package/core/release-notes.js
CHANGED
|
@@ -115,8 +115,8 @@ export function mapIndex(topology) {
|
|
|
115
115
|
return { nodes, byId, order, owner };
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
/** The node's area: the ancestor just below the root (the node itself when it has no owner, or the root owns it) */
|
|
119
|
-
function areaOf(node, index) {
|
|
118
|
+
/** The node's area: the ancestor just below the root (the node itself when it has no owner, or the root owns it); the Work view groups the code it draws by it too (explorer/work-model.js) */
|
|
119
|
+
export function areaOf(node, index) {
|
|
120
120
|
let at = node;
|
|
121
121
|
const seen = new Set();
|
|
122
122
|
while (!seen.has(at.id)) {
|
package/explorer/css/changes.css
CHANGED
|
@@ -83,13 +83,9 @@
|
|
|
83
83
|
@container corn-box (max-width: 1023px) {
|
|
84
84
|
.hx-review-column { width: 320px; }
|
|
85
85
|
}
|
|
86
|
-
@container corn-box (min-width: 1280px) {
|
|
87
|
-
/* The Work list: from 1280px the column moves over to make room for it; narrower, the panel lies over the column while it is open (moving it would leave the map a sliver) */
|
|
88
|
-
.hx-stage:has(.forge-open) .hx-review-column { left: calc(var(--hx-forge-w) + 12px); }
|
|
89
|
-
}
|
|
90
86
|
@container corn-box (min-width: 768px) and (max-width: 1023px) {
|
|
91
|
-
/* The node panel (480px) and the 320px column do not both fit under 1024px: the column gives up its width, so the panel covers none of it */
|
|
92
|
-
.hx-stage:has(.drawer-open) .hx-review-column { width: min(320px, calc(100% - 504px)); }
|
|
87
|
+
/* The node panel (480px) and the 320px column do not both fit under 1024px: the column gives up its width, so the panel covers none of it (the Work list takes the panel's place) */
|
|
88
|
+
.hx-stage:has(.drawer-open) .hx-review-column, .hx-stage:has(.forge-open) .hx-review-column { width: min(320px, calc(100% - 504px)); }
|
|
93
89
|
}
|
|
94
90
|
.hx-rc-scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--corn-space-2); overflow: hidden; padding: var(--corn-space-3) var(--corn-space-4); }
|
|
95
91
|
.hx-rc-lists { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--corn-space-4); }
|
|
@@ -153,7 +149,7 @@
|
|
|
153
149
|
.hx-step-verdict { max-width: 45%; }
|
|
154
150
|
}
|
|
155
151
|
@container corn-box (min-width: 768px) {
|
|
156
|
-
.hx-stage:has(.drawer-open) .hx-player { right: 504px; }
|
|
152
|
+
.hx-stage:has(.drawer-open) .hx-player, .hx-stage:has(.forge-open) .hx-player { right: 504px; }
|
|
157
153
|
}
|
|
158
154
|
.hx-player-as, .hx-player-check { flex: 1 0 100%; }
|
|
159
155
|
.hx-player-speed[data-corn="control"] { color: var(--corn-text); }
|
package/explorer/css/header.css
CHANGED
|
@@ -70,6 +70,21 @@
|
|
|
70
70
|
.hx-view-btn { min-width: var(--hx-control-h); height: var(--hx-seg-inner); padding: 0 var(--corn-space-2); }
|
|
71
71
|
.hx-view-fit { position: absolute; top: calc(100% + var(--corn-space-4)); right: var(--corn-space-4); width: var(--hx-control-h); height: var(--hx-control-h); 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); }
|
|
72
72
|
}
|
|
73
|
+
/* The view's own controls (spec 0015 D5), after the View switch and before the Layers chip: in the Work view Waiting on you (a toggle) and List (work-view.js fills the group).
|
|
74
|
+
From 768px the two are items of the header's row (`display: contents`); on a phone they sit on the map's top-left row, the Layers chip first, and wrap before Fit */
|
|
75
|
+
.hx-view-tools { display: contents; }
|
|
76
|
+
.hx-view-controls { display: flex; align-items: center; flex: none; gap: var(--corn-space-2); }
|
|
77
|
+
.hx-view-controls[hidden] { display: none; }
|
|
78
|
+
.hx-view-control { display: inline-flex; align-items: center; height: var(--hx-control-h); 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; }
|
|
79
|
+
.hx-view-control:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
80
|
+
.hx-view-control[aria-pressed="true"], .hx-view-control[aria-expanded="true"] { background: var(--corn-surface-3); color: var(--corn-text); border-color: var(--corn-accent); font-weight: 600; }
|
|
81
|
+
.hx-view-control[hidden] { display: none; }
|
|
82
|
+
@container corn-box (max-width: 767px) {
|
|
83
|
+
.hx-header .hx-view-tools { position: absolute; top: calc(100% + var(--corn-space-4)); left: var(--corn-space-4); display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2); max-width: calc(100% - var(--corn-space-4) * 2 - var(--hx-control-h) - var(--corn-space-3)); pointer-events: none; }
|
|
84
|
+
.hx-header .hx-view-tools > * { pointer-events: auto; }
|
|
85
|
+
.hx-view-tools > .hx-layers { order: -1; }
|
|
86
|
+
.hx-view-control { padding: 0 var(--corn-space-5); border-radius: var(--corn-radius-pill); background: var(--corn-surface-1); box-shadow: var(--corn-shadow); }
|
|
87
|
+
}
|
|
73
88
|
/* A brand wordmark that does not fit leaves the logo (header-fit.js measures); a row that still scrolls shows it at its edge */
|
|
74
89
|
.hx-header-left[data-brand-short] .hx-title { display: none; }
|
|
75
90
|
.hx-header-left[data-overflow] { -webkit-mask: linear-gradient(to right, var(--corn-text) calc(100% - var(--corn-space-6)), transparent); mask: linear-gradient(to right, var(--corn-text) calc(100% - var(--corn-space-6)), transparent); }
|
package/explorer/css/layers.css
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
.hx-layers-chip--dim { border-color: var(--corn-line-soft); }
|
|
13
13
|
.hx-layers-chip--dim, .hx-layers-chip--dim .hx-layers-count { color: var(--corn-text-3); }
|
|
14
14
|
@container corn-box (max-width: 767px) {
|
|
15
|
+
/* On cornfield's page the chip sits on the map's top-left row with the view's controls (header.css `.hx-view-tools`); in a page with no such row, on the map by itself */
|
|
15
16
|
.hx-header .hx-layers { position: absolute; top: calc(100% + var(--corn-space-4)); left: var(--corn-space-4); }
|
|
17
|
+
.hx-header .hx-view-tools > .hx-layers { position: static; }
|
|
16
18
|
.hx-layers-chip { height: var(--hx-control-h); padding: 0 var(--corn-space-5); border-radius: var(--corn-radius-pill); background: var(--corn-surface-1); box-shadow: var(--corn-shadow); }
|
|
17
19
|
}
|
|
18
20
|
.hx-toggle-row:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
|
|
@@ -46,11 +48,18 @@
|
|
|
46
48
|
@media (prefers-reduced-motion: reduce) {
|
|
47
49
|
.hx-dot { transition: none; animation: none; }
|
|
48
50
|
}
|
|
51
|
+
/* A row's own button beside it (spec 0015 D6: the History row's Replay), pressed while what it opens is open */
|
|
52
|
+
.hx-toggle-line { display: flex; align-items: stretch; gap: var(--corn-space-1); }
|
|
53
|
+
.hx-toggle-line > .hx-toggle-row { flex: 1; min-width: 0; }
|
|
54
|
+
.hx-row-action { flex: none; padding: 0 var(--corn-space-3); border-radius: var(--corn-radius); border: var(--corn-border) solid var(--corn-line); background: var(--corn-surface-2); color: var(--corn-text-2); font-size: var(--corn-text-xs); font-weight: 600; }
|
|
55
|
+
.hx-row-action:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
56
|
+
.hx-row-action[aria-pressed="true"] { background: var(--corn-surface-3); color: var(--corn-text); border-color: var(--corn-accent); }
|
|
57
|
+
.hx-row-action:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
|
|
49
58
|
@container corn-box (max-width: 767px) {
|
|
50
|
-
.hx-toggle-row { min-height: 44px; }
|
|
59
|
+
.hx-toggle-row, .hx-row-action { min-height: 44px; }
|
|
51
60
|
}
|
|
52
61
|
@media (pointer: coarse) {
|
|
53
|
-
.hx-toggle-row { min-height: 44px; }
|
|
62
|
+
.hx-toggle-row, .hx-row-action { min-height: 44px; }
|
|
54
63
|
}
|
|
55
64
|
/* ---------------------------------------------------------------------------
|
|
56
65
|
Project layers and finer kinds (spec 0009): the Layers menu holds its title (with All and None) while the rows scroll, the Overlays heading,
|
package/explorer/css/map.css
CHANGED
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
.hx-history-bar-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
58
58
|
|
|
59
59
|
/* Replay (spec 0014 D1, history-replay.js): the timeline strip along the bottom of the map, and the pulse on what a commit changed */
|
|
60
|
-
.hx-replay-btn[aria-pressed="true"] { background: var(--corn-surface-3); color: var(--corn-text); border-color: var(--corn-accent); }
|
|
61
60
|
.hx-timeline { position: absolute; left: var(--corn-space-4); right: var(--corn-space-4); bottom: var(--corn-space-4); z-index: 3; display: flex; flex-direction: column; gap: var(--corn-space-1); padding: var(--corn-space-2) var(--corn-space-3); border-radius: var(--corn-radius); color: var(--corn-text); font-size: var(--corn-text-sm); }
|
|
62
61
|
.hx-timeline-bar { display: flex; align-items: center; gap: var(--corn-space-2); }
|
|
63
62
|
.hx-timeline-btn { min-width: 28px; height: 26px; padding: 0 var(--corn-space-2); 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; cursor: pointer; }
|
|
@@ -201,3 +201,48 @@
|
|
|
201
201
|
.hx-trail-chip { display: inline-flex; align-items: center; padding: 0 var(--corn-space-2); min-height: 22px; border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-pill); color: var(--corn-text-2); font-size: var(--corn-text-xs); text-decoration: none; white-space: nowrap; }
|
|
202
202
|
a.hx-trail-chip:hover { border-color: var(--corn-accent-hover); color: var(--corn-text); }
|
|
203
203
|
.hx-trail-chip[data-trail="gap"] { border-style: dashed; color: var(--corn-text-3); }
|
|
204
|
+
.hx-history-counts { display: flex; flex-direction: column; align-items: flex-start; gap: var(--corn-space-1); }
|
|
205
|
+
.hx-history-counts [hidden] { display: none; }
|
|
206
|
+
.hx-history-count { font-size: var(--corn-text-xs); }
|
|
207
|
+
.hx-history-count::before, .hx-work-gtoggle::before { content: "▸ "; }
|
|
208
|
+
.hx-history-count[aria-expanded="true"]::before, .hx-work-gtoggle[aria-expanded="true"]::before { content: "▾ "; }
|
|
209
|
+
|
|
210
|
+
/* ---- The panel leads with its action (spec 0015 D4) ----------------------------------------------------------------------------------------------
|
|
211
|
+
The action bar (`actions`): the node's next action as the primary button, one or two beside it, the rest under ⋯; kept in view while the panel scrolls
|
|
212
|
+
(sticky in the place of a piece of work's actions, which runs to the panel's end). Under it, one "Next" line when an action cannot be taken yet. */
|
|
213
|
+
.hx-actions { position: sticky; top: calc(var(--corn-panel-pad) * -1); z-index: 2; display: flex; flex-direction: column; gap: var(--corn-space-2); margin: 0 calc(var(--corn-panel-pad) * -1); padding: var(--corn-space-3) var(--corn-panel-pad); border-bottom: var(--corn-border) solid var(--corn-line-soft); background: color-mix(in srgb, var(--corn-ground) 92%, transparent); backdrop-filter: blur(var(--corn-blur)); -webkit-backdrop-filter: blur(var(--corn-blur)); }
|
|
214
|
+
.hx-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2); }
|
|
215
|
+
.hx-actions-row > .hx-btn, .hx-actions-row > a.hx-btn { flex: none; min-height: var(--hx-control-h); }
|
|
216
|
+
.hx-actions-row > .hx-btn--approve, .hx-actions-row > .hx-btn--primary { flex: 1 1 auto; justify-content: center; }
|
|
217
|
+
.hx-actions-row .hx-foot-btn { align-self: auto; }
|
|
218
|
+
.hx-actions-more { position: relative; flex: none; margin-left: auto; }
|
|
219
|
+
.hx-actions-more-btn { min-width: var(--hx-control-h); font-size: var(--corn-text-md); line-height: 1; }
|
|
220
|
+
.hx-actions-menu { position: absolute; top: calc(100% + var(--corn-space-1)); right: 0; z-index: 3; display: flex; flex-direction: column; align-items: stretch; gap: var(--corn-space-1); min-width: 220px; padding: var(--corn-space-2); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius); box-shadow: var(--corn-shadow-lg); }
|
|
221
|
+
.hx-actions-menu[hidden] { display: none; }
|
|
222
|
+
.hx-actions-menu .hx-btn { justify-content: flex-start; text-align: left; }
|
|
223
|
+
.hx-next { margin: 0; color: var(--corn-text-2); font-size: var(--corn-text-sm); line-height: 1.45; }
|
|
224
|
+
.hx-work-bar:empty, .hx-work-notes:empty, .hx-work-sections:empty { display: none; }
|
|
225
|
+
.hx-work-facts { margin: 0; }
|
|
226
|
+
.hx-work-sum { margin: 0; color: var(--corn-text-2); line-height: 1.5; }
|
|
227
|
+
.hx-work-changes { margin: var(--corn-space-1) 0 0; font-variant-numeric: tabular-nums; }
|
|
228
|
+
.hx-work-sections { display: flex; flex-direction: column; gap: var(--corn-space-3); }
|
|
229
|
+
.hx-work-sub { padding-left: var(--corn-space-4); }
|
|
230
|
+
.hx-work-sub[hidden] { display: none; }
|
|
231
|
+
/* A section: its title and count open and close it; closed unless it holds the action, as it was left for this kind of node */
|
|
232
|
+
.hx-psec { gap: var(--corn-space-2); padding-top: var(--corn-space-3); border-top: var(--corn-border) solid var(--corn-line-soft); }
|
|
233
|
+
.hx-sec-toggle { display: flex; align-items: baseline; gap: var(--corn-space-2); width: 100%; min-height: 32px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
234
|
+
.hx-sec-toggle::before { content: "▸"; flex: none; width: 1ch; color: var(--corn-text-3); }
|
|
235
|
+
.hx-sec-toggle[aria-expanded="true"]::before { content: "▾"; }
|
|
236
|
+
.hx-sec-toggle:hover .hx-sec-name { color: var(--corn-text); }
|
|
237
|
+
.hx-sec-toggle:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
|
|
238
|
+
.hx-sec-count { color: var(--corn-text-2); font-variant-numeric: tabular-nums; }
|
|
239
|
+
.hx-sec-note { color: var(--corn-text-3); font-weight: 400; }
|
|
240
|
+
.hx-sec-body { display: flex; flex-direction: column; gap: var(--corn-space-2); }
|
|
241
|
+
.hx-sec-body[hidden] { display: none; }
|
|
242
|
+
.hx-panel-back[hidden], .hx-drawer-foot[hidden] { display: none; }
|
|
243
|
+
@container corn-box (max-width: 767px) {
|
|
244
|
+
.hx-actions-row > .hx-btn, .hx-actions-more-btn, .hx-sec-toggle { min-height: 44px; }
|
|
245
|
+
}
|
|
246
|
+
@media (pointer: coarse) {
|
|
247
|
+
.hx-actions-row > .hx-btn, .hx-actions-more-btn, .hx-sec-toggle { min-height: 44px; }
|
|
248
|
+
}
|
package/explorer/css/page.css
CHANGED
|
@@ -44,21 +44,16 @@ body {
|
|
|
44
44
|
/* The stage: the map and what lies over it. Not a container (above): the pieces in it ask the body, which is as wide */
|
|
45
45
|
.hx-stage { position: relative; flex: 1; width: 100%; min-height: 0; overflow: hidden; }
|
|
46
46
|
@media (min-width: 768px) {
|
|
47
|
-
/* The
|
|
48
|
-
.hx-stage { --hx-forge-w: min(
|
|
47
|
+
/* The Work list's width is the stage's `--hx-forge-w`, so what makes room for it reads the same number: the node panel's, whose place it takes (spec 0015 D3) */
|
|
48
|
+
.hx-stage { --hx-forge-w: min(480px, calc(100% - 24px)); }
|
|
49
49
|
}
|
|
50
50
|
/* The scenario player is one bar under the map (spec 0006 D6). From 768px it sits at the foot of the map area, to the right of the review column;
|
|
51
51
|
the stage tells it how wide the column is */
|
|
52
52
|
@media (min-width: 768px) {
|
|
53
53
|
.hx-stage:has(.hx-review-column:not([hidden])) { --hx-col-w: 400px; }
|
|
54
|
-
.hx-stage:has(.forge-open):has(.hx-review-column:not([hidden])) { --hx-col-w: max(400px, var(--hx-forge-w)); }
|
|
55
|
-
}
|
|
56
|
-
@media (min-width: 1280px) {
|
|
57
|
-
.hx-stage:has(.forge-open):has(.hx-review-column:not([hidden])) { --hx-col-w: calc(400px + var(--hx-forge-w)); }
|
|
58
54
|
}
|
|
59
55
|
@media (min-width: 768px) and (max-width: 1023px) {
|
|
60
56
|
.hx-stage:has(.hx-review-column:not([hidden])) { --hx-col-w: 320px; }
|
|
61
|
-
.hx-stage:has(.forge-open):has(.hx-review-column:not([hidden])) { --hx-col-w: max(320px, var(--hx-forge-w)); }
|
|
62
57
|
}
|
|
63
58
|
|
|
64
59
|
/* /?bench=1: the run's numbers, bottom left (bench.js) */
|
|
@@ -90,9 +90,8 @@ h2.hx-proposal-name { margin: 0; }
|
|
|
90
90
|
.hx-proposal-bar { max-height: 50cqh; overflow-y: auto; padding: 0 var(--corn-space-4) var(--corn-space-3); }
|
|
91
91
|
}
|
|
92
92
|
@container corn-box (min-width: 768px) {
|
|
93
|
-
/* The
|
|
94
|
-
.hx-stage:has(.forge-open) .hx-proposal-bar {
|
|
95
|
-
.hx-stage:has(.forge-open):has(.drawer-open) .hx-proposal-bar { width: min(960px, calc(100% - var(--hx-forge-w) - 540px)); }
|
|
93
|
+
/* The Work list is in the node panel's place on the right (spec 0015 D3; the two take turns): the bar makes room for it as for the panel */
|
|
94
|
+
.hx-stage:has(.forge-open) .hx-proposal-bar { width: min(960px, calc(100% - var(--hx-forge-w) - 24px)); }
|
|
96
95
|
}
|
|
97
96
|
.hx-proposal-bar { scroll-padding-block: calc(var(--corn-focus-width) + var(--corn-focus-offset) + var(--corn-space-1)); }
|
|
98
97
|
@media (forced-colors: active) {
|
package/explorer/css/work.css
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* work.css: the Work list
|
|
3
|
-
* The Work list (forge-panel.js, runs-view.js) and its tabs (Specs, PRs, Issues, Threads, Runs, Deploys):
|
|
4
|
-
*
|
|
5
|
-
* pieces of their own.
|
|
3
|
+
* The Work list (forge-panel.js, runs-view.js) and its tabs (Specs, PRs, Issues, Threads, Runs, Deploys): from 768px in the node panel's place on the
|
|
4
|
+
* right (the two take turns: spec 0015 D3), a bottom sheet below; the Work toggle in the header; the states, results and skeletons. Read by corn-work (D4);
|
|
5
|
+
* its tabs follow as pieces of their own.
|
|
6
6
|
* No rule here asks what the document says (`:root`, `html`, `body`, `[data-theme]`), sizes from the window (`vw`, `vh`) or is `position: fixed` unless it says why;
|
|
7
7
|
* a width rule is a container query on `corn-box` (page.css), a height rule on `corn-page`. base.css loads first.
|
|
8
8
|
*/
|
|
9
|
-
/* ---- the Work list (pieces/work-list.js; spec 0012 D6; first CF-07's issues and PRs panel)
|
|
10
|
-
A slide-over from the
|
|
11
|
-
Closed, it is inert, and off screen or not displayed. Only the tokens above are used, so it follows the theme. */
|
|
9
|
+
/* ---- the Work list (pieces/work-list.js; spec 0012 D6, spec 0015 D3; first CF-07's issues and PRs panel) ---------------------------
|
|
10
|
+
A slide-over from the right from 768px, in the node panel's place (one side panel at a time: a row opens its node there, with Back to the list), a bottom
|
|
11
|
+
sheet in #sheet-dock below. Closed, it is inert, and off screen or not displayed. Only the tokens above are used, so it follows the theme. */
|
|
12
12
|
.hx-forge { --hx-forge-status-w: 56px; }
|
|
13
13
|
.hx-forge { display: flex; flex-direction: column; z-index: 40; border-color: var(--corn-line); pointer-events: none; touch-action: pan-y; transition: transform 0.2s ease-out; }
|
|
14
14
|
.hx-forge * { touch-action: pan-y; }
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
.hx-forge.forge-open { pointer-events: auto; }
|
|
18
18
|
.hx-forge:not(.forge-open) { box-shadow: none; }
|
|
19
19
|
@container corn-box (min-width: 768px) {
|
|
20
|
-
.hx-forge { position: absolute; top: 0;
|
|
20
|
+
.hx-forge { position: absolute; top: 0; right: 0; bottom: 0; width: var(--hx-forge-w); border-right: 0; transform: translateX(100%); box-shadow: var(--corn-shadow-lg); }
|
|
21
21
|
.hx-forge.forge-open { transform: translateX(0); }
|
|
22
22
|
}
|
|
23
23
|
@container corn-box (max-width: 767px) {
|
package/explorer/engine/hint.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The hint at the map's corner ("Click a node for what it is"; CF review F56), on an instance. Three rules:
|
|
5
5
|
* - its words follow the pointer: `hintInspect` / `hintDrag` for a mouse or a trackpad, `hintInspectTouch` / `hintDragTouch` where the
|
|
6
6
|
* main pointer is coarse (a finger). A repo that sets only `hintInspect` (or `hintDrag`) gets its words on both;
|
|
7
|
-
* - it goes once the person has selected a node,
|
|
7
|
+
* - it goes once the person has selected a node, and does not come back in that browser (localStorage, spec 0015 D5; the Flow view's own description stays,
|
|
8
8
|
* since it says what Flow is, not how to use the map);
|
|
9
9
|
* - it is never shown over an open proposal, a node panel, the Work list or a sheet.
|
|
10
10
|
* The icon is `[data-corn="hint-icon"]`, so a theme can restyle or replace it. explorer/hint.js keeps the old names for the page's instance.
|
|
@@ -32,28 +32,28 @@ export function hintText(inst, coarse = coarsePointer(inst.win)) {
|
|
|
32
32
|
: hintWords({ text: t(inst, 'hintInspect'), set: isOverridden(inst, 'hintInspect') }, { text: t(inst, 'hintInspectTouch'), set: isOverridden(inst, 'hintInspectTouch') }, coarse);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
const
|
|
36
|
-
/** Whether a node was selected in this
|
|
35
|
+
const storeOf = (inst) => { try { return inst.win ? inst.win.localStorage : null; } catch { return null; } };
|
|
36
|
+
/** Whether a node was ever selected in this browser, for this instance */
|
|
37
37
|
const memory = (inst) => inst.slot('hint', () => {
|
|
38
38
|
const m = { dismissed: false };
|
|
39
|
-
try { const store =
|
|
39
|
+
try { const store = storeOf(inst); m.dismissed = !!store && store.getItem(HINT_STORAGE_KEY) === '1'; } catch { m.dismissed = false; }
|
|
40
40
|
return m;
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
/** Remembers that a node was selected: the hint is not shown again this
|
|
43
|
+
/** Remembers that a node was selected: the hint is not shown again in this browser */
|
|
44
44
|
export function dismissHint(inst) {
|
|
45
45
|
const m = memory(inst);
|
|
46
46
|
if (m.dismissed) return;
|
|
47
47
|
m.dismissed = true;
|
|
48
48
|
if (!inst.el('instruction-badge-text')) return; // an instance with no hint (a map in another app's page) writes nothing in that page's storage
|
|
49
|
-
try { const store =
|
|
49
|
+
try { const store = storeOf(inst); if (store) store.setItem(HINT_STORAGE_KEY, '1'); } catch { /* storage blocked: it holds for this page load */ }
|
|
50
50
|
syncHint(inst);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/** For tests: the hint is new again */
|
|
54
54
|
export function resetHint(inst) {
|
|
55
55
|
memory(inst).dismissed = false;
|
|
56
|
-
try { const store =
|
|
56
|
+
try { const store = storeOf(inst); if (store) store.removeItem(HINT_STORAGE_KEY); } catch { /* none */ }
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/** What covers the map: an open proposal, the node panel, the Work list, a sheet of the dock */
|
|
@@ -59,11 +59,12 @@ export function centreTarget(inst, node, zoom = inst.state.camera.zoom) {
|
|
|
59
59
|
const { width, height } = inst.state;
|
|
60
60
|
const visibleHeight = Math.max(160, height - (inst.state.coveredBottom || 0));
|
|
61
61
|
const covers = inst.ask('panel:covers'); // an open slide-over node panel covers the right of the map (pieces/node-panel.js); one in a box of its own covers nothing
|
|
62
|
-
|
|
63
|
-
// The issues and PRs panel slides in from the left (forge-panel.js)
|
|
62
|
+
// The Work list takes the node panel's place on the right while it is open (spec 0015 D3): it covers the same side
|
|
64
63
|
const forge = inst.el('forge-panel');
|
|
65
|
-
const
|
|
66
|
-
|
|
64
|
+
const list = width >= 768 && forge && forge.classList.contains('forge-open') ? forge.offsetWidth || 480 : 0;
|
|
65
|
+
const right = Math.max(width >= 768 && covers ? covers.right || 480 : 0, list);
|
|
66
|
+
const visibleWidth = right ? Math.max(160, width - right) : width;
|
|
67
|
+
return { x: visibleWidth / 2 - node.x * zoom, y: visibleHeight / 2 - node.y * zoom, zoom };
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
/** Moves the camera so `node` is in the middle of the part of the map not under the panels or a phone's sheets */
|
|
@@ -88,8 +88,8 @@ export function visibleMapRect(inst) {
|
|
|
88
88
|
const panel = inst.ask('panel:covers'); // the node panel, when it slides over the map: its width, not its box (it slides in)
|
|
89
89
|
if (panel && panel.right) covers.right = panel.right;
|
|
90
90
|
const forge = inst.el('forge-panel');
|
|
91
|
-
if (shown(forge) && forge.classList.contains('forge-open')) covers.
|
|
92
|
-
// the review column (review-column.js) is docked on the left under the bar: its right edge is what it covers
|
|
91
|
+
if (shown(forge) && forge.classList.contains('forge-open')) covers.right = Math.max(covers.right, forge.offsetWidth); // the Work list, in the node panel's place (spec 0015 D3)
|
|
92
|
+
// the review column (review-column.js) is docked on the left under the bar: its right edge is what it covers
|
|
93
93
|
const column = inst.ask('changes:covers');
|
|
94
94
|
if (column) covers.left = Math.max(covers.left, Math.max(0, column.right - c.left) + 8);
|
|
95
95
|
const player = inst.ask('player:covers');
|
|
@@ -246,12 +246,13 @@ export function createMap(inst, opts = {}) {
|
|
|
246
246
|
|
|
247
247
|
/**
|
|
248
248
|
* The node the pointer is on (or null): a node with no label is named by a chip over the map while it is. Only the label layer
|
|
249
|
-
* draws again (the map has nothing new to show), so moving across the map costs one small redraw per node entered.
|
|
249
|
+
* draws again (the map has nothing new to show), so moving across the map costs one small redraw per node entered; in the Work view the scene too.
|
|
250
250
|
*/
|
|
251
251
|
function setHoverNode(id) {
|
|
252
252
|
const next = id || null;
|
|
253
253
|
if (state.hoverNodeId === next) return;
|
|
254
254
|
state.hoverNodeId = next;
|
|
255
|
+
if (state.view === 'work') { inst.touchScene(); render(); return; } // the Work view draws a node's lines to code while the pointer is on it (spec 0015 D1, scene.js)
|
|
255
256
|
const labels = getLabelLayer();
|
|
256
257
|
if (labels && state.canvas && state.width) labels.draw(getScene(), state.camera, { hover: next });
|
|
257
258
|
}
|
|
@@ -381,6 +381,30 @@ export function mergeBlock(detail) {
|
|
|
381
381
|
return null;
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
+
/**
|
|
385
|
+
* The one "Next" line under the node panel's action bar (spec 0015 D4) for a pull request that cannot land yet, or whose proposal waits on an approval: what comes before
|
|
386
|
+
* Land it, in one sentence ("Then: approve, and Land it once docs finishes (1 check running)."). '' when nothing stands in the way, and for one that has landed or is closed
|
|
387
|
+
* (its state says so). A failed check's Re-run is in Checks: the line names it, the button stays there. Only words: what Land does is `mergeBlock`'s and the server's.
|
|
388
|
+
* @param {{ pull: { state: string, draft?: boolean }, checks: { name: string, state: string, canRerun?: boolean }[], specs?: { slug: string, approved: boolean }[], stale?: string }} detail
|
|
389
|
+
* @param {{ self?: boolean }} [opts] `self`: the panel is the proposal's own, so "approve" needs no name
|
|
390
|
+
*/
|
|
391
|
+
export function nextWords(detail, { self = false } = {}) {
|
|
392
|
+
if (!detail || !detail.pull || detail.pull.state !== 'open') return '';
|
|
393
|
+
const { pull, checks = [] } = detail;
|
|
394
|
+
const open = (detail.specs || []).filter((s) => !s.approved).map((s) => s.slug);
|
|
395
|
+
const steps = open.length ? [self ? 'approve' : `approve ${open.join(' and ')}`] : [];
|
|
396
|
+
const then = (tail) => `Then: ${steps.length ? `${steps.join(', ')}, and ` : ''}${tail}.`;
|
|
397
|
+
if (pull.draft) { steps.push('mark it ready for review on the forge'); return then('Land it'); }
|
|
398
|
+
if (!checks.length) return then('Land it once the forge has run its checks (none yet)');
|
|
399
|
+
const failed = checks.filter((c) => c.state === 'failure' || c.state === 'cancelled');
|
|
400
|
+
const waiting = checks.filter((c) => !GREEN.includes(c.state) && !failed.includes(c));
|
|
401
|
+
if (failed.length) steps.push(`re-run ${failed.map((c) => `${c.name}${c.canRerun ? '' : ' on the forge'}`).join(' and ')}`);
|
|
402
|
+
if (waiting.length) return then(`Land it once ${waiting.map((c) => c.name).join(' and ')} ${waiting.length === 1 ? 'finishes' : 'finish'} (${waiting.length} ${waiting.length === 1 ? 'check' : 'checks'} running)`);
|
|
403
|
+
if (failed.length) return then('Land it');
|
|
404
|
+
if (detail.stale) { steps.push('press Refresh (this is an older answer)'); return then('Land it'); }
|
|
405
|
+
return steps.length ? then('Land it') : '';
|
|
406
|
+
}
|
|
407
|
+
|
|
384
408
|
/**
|
|
385
409
|
* A line of warning for a spec pull request whose proposal is not approved yet ('' when it is, or the pull request is not a spec's). Only words:
|
|
386
410
|
* what Land does is not changed by it.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* specReach(history, spec) the nodes a spec's commits touched, and how many commits named it
|
|
13
13
|
* heatOf(history, at) the History layer (spec 0014 D3): per node, how often it changed and how lately, as of a commit
|
|
14
14
|
* haloWidth(count, max) a halo's width on screen (px) for how often its node changed
|
|
15
|
-
* historyRowOf(status, heat)
|
|
15
|
+
* historyRowOf(status, heat, color, { replaying }) the Layers menu's row under Overlays, with Replay on it (spec 0015 D6)
|
|
16
16
|
* specBarHtml(pick, ctx) the bar on the map while a spec is picked: `Spec 0012 · Work as a view: 6 commits, 72 nodes`
|
|
17
17
|
* commitKind(subject) feat, fix, docs or other: a timeline mark's colour
|
|
18
18
|
* replayFrame(history, edges, at) Replay (spec 0014 D1): what the map holds at a commit, what was born at it and what it changed
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
import { escapeHtml as esc } from '../core/text.js';
|
|
25
25
|
import { fileUrl } from './file-url.js';
|
|
26
|
+
import { sectionHtml } from './panel-model.js';
|
|
26
27
|
|
|
27
|
-
/** The most commits the section lists before "Show all N" */
|
|
28
|
-
export const HISTORY_CAP =
|
|
28
|
+
/** The most commits the section lists before "Show all N" (spec 0015 D4: the last five) */
|
|
29
|
+
export const HISTORY_CAP = 5;
|
|
29
30
|
|
|
30
31
|
/** Where a commit, a pull request and an issue are on each forge's site */
|
|
31
32
|
const SHAPES = {
|
|
@@ -142,14 +143,14 @@ export const dayOf = (iso, locale) => {
|
|
|
142
143
|
* @param {{ history: object | null, status: 'off' | 'loading' | 'ready' | 'error', error?: string, links: ReturnType<typeof forgeLinks>, specs: ReturnType<typeof specFiles>, picked?: string | null, all?: boolean, locale?: string }} ctx
|
|
143
144
|
*/
|
|
144
145
|
export function historySectionHtml(node, ctx) {
|
|
145
|
-
|
|
146
|
-
const wrap = (body) =>
|
|
146
|
+
// A section of the panel (spec 0015 D4): its count is the commits, it starts closed (the browser remembers it open per kind of node: panel-sections.js)
|
|
147
|
+
const wrap = (body, count = null) => sectionHtml({ key: 'history', title: 'History', count, body, extra: ' data-history' }).replace('class="hx-sec-block hx-psec"', 'class="hx-sec-block hx-psec hx-history"');
|
|
147
148
|
if (ctx.status === 'off') return '';
|
|
148
149
|
if (ctx.status === 'loading') return wrap('<p class="hx-faint" data-corn="loading">Reading the history…</p>');
|
|
149
150
|
if (ctx.status === 'error') return wrap(`<p class="hx-faint" data-corn="error">${esc(ctx.error || 'The history could not be read.')}</p>`);
|
|
150
151
|
const t = nodeTrail(ctx.history, node.id);
|
|
151
152
|
if (!t) return wrap('<p class="hx-faint">This node is not in the history yet: run <code class="hx-code">cornfield sync</code> and commit the map.</p>');
|
|
152
|
-
if (!t.commits.length) return wrap('<p class="hx-faint">No commit has changed this node\'s file yet.</p>');
|
|
153
|
+
if (!t.commits.length) return wrap('<p class="hx-faint">No commit has changed this node\'s file yet.</p>', 0);
|
|
153
154
|
const n = t.commits.length;
|
|
154
155
|
const share = Math.round((t.traced / n) * 100);
|
|
155
156
|
const stats = `<p class="hx-history-stats"><span><b class="hx-ms">${n}</b> ${n === 1 ? 'commit' : 'commits'}</span> · <span><b class="hx-ms">${t.pulls.length}</b> ${t.pulls.length === 1 ? 'pull request' : 'pull requests'}</span> · <span><b class="hx-ms">${share}%</b> traced to a spec or issue</span></p>`;
|
|
@@ -158,8 +159,15 @@ export function historySectionHtml(node, ctx) {
|
|
|
158
159
|
const on = ctx.picked === s;
|
|
159
160
|
return `<button type="button" class="hx-lines-kind" data-corn-kind="quiet" data-history-spec="${esc(s)}" aria-pressed="${on}" title="Light every node spec ${esc(s)} reached">Spec ${esc(s)}${spec ? ` <span class="hx-faint">${esc(spec.label)}</span>` : ''}</button>`;
|
|
160
161
|
});
|
|
161
|
-
|
|
162
|
-
const
|
|
162
|
+
// The specs and the issues are counts that open (never all at once: a node of code can name eighty issues); a picked spec keeps its specs open, so its chip is in view
|
|
163
|
+
const counted = (words, rows, open) => `<button type="button" class="hx-textbtn hx-history-count" data-sub-toggle aria-expanded="${open}" data-corn-kind="quiet">${words}</button>${rows.replace(/^<(\w+)/, `<$1${open ? '' : ' hidden'}`)}`;
|
|
164
|
+
const picked = !!ctx.picked && t.specs.includes(ctx.picked);
|
|
165
|
+
const specs = specChips.length
|
|
166
|
+
? counted(`${specChips.length} ${specChips.length === 1 ? 'spec' : 'specs'} behind it`, `<div class="hx-chips" role="group" aria-label="Specs behind it">${specChips.join('')}</div>`, picked)
|
|
167
|
+
: '<p class="hx-faint">No commit to this node names a spec.</p>';
|
|
168
|
+
const issues = t.issues.length
|
|
169
|
+
? counted(`${t.issues.length} ${t.issues.length === 1 ? 'issue' : 'issues'}`, `<p class="hx-history-issues">${t.issues.map((i) => { const href = ctx.links && ctx.links.issue(i); return href ? `<a class="hx-link" data-corn="text-link" href="${esc(href)}" target="_blank" rel="noreferrer">#${esc(i)}</a>` : `#${esc(i)}`; }).join(', ')}</p>`, false)
|
|
170
|
+
: '';
|
|
163
171
|
const shown = ctx.all ? t.commits : t.commits.slice(0, HISTORY_CAP);
|
|
164
172
|
const rows = shown.map((c) => `<li class="hx-history-commit" data-corn="row">`
|
|
165
173
|
+ `<div class="hx-row-meta">${esc(dayOf(c.date, ctx.locale))} · ${c.nodes.length} ${c.nodes.length === 1 ? 'node' : 'nodes'}${t.born && c.index === t.born.index ? ' · <span class="hx-history-born">born here</span>' : ''} · <button type="button" class="hx-textbtn" data-corn-kind="quiet" data-history-at="${c.index}" aria-label="Replay the map at this commit: ${esc(c.subject)}">Replay here</button></div>`
|
|
@@ -167,7 +175,7 @@ export function historySectionHtml(node, ctx) {
|
|
|
167
175
|
+ trailHtml(c, ctx)
|
|
168
176
|
+ '</li>');
|
|
169
177
|
const more = shown.length < n ? `<button type="button" class="hx-btn hx-btn--quiet hx-textact" data-corn="more" data-corn-kind="quiet" data-history-all>Show all ${n}</button>` : '';
|
|
170
|
-
return wrap(`${stats}<
|
|
178
|
+
return wrap(`${stats}<div class="hx-history-counts">${specs}${issues}</div><h4 class="hx-history-k">${shown.length < n ? `The last ${shown.length} commits` : 'Commits'}, newest first</h4><ol class="hx-history-list">${rows.join('')}</ol>${more}`, n);
|
|
171
179
|
}
|
|
172
180
|
|
|
173
181
|
/**
|
|
@@ -230,10 +238,12 @@ export const haloWidth = (count, max) => (max > 0 && count > 0 ? Math.round((1.5
|
|
|
230
238
|
* @param {{ nodes: Map<string, unknown> } | null} heat
|
|
231
239
|
* @param {string} color the dot's colour
|
|
232
240
|
*/
|
|
233
|
-
export function historyRowOf(status, heat, color) {
|
|
241
|
+
export function historyRowOf(status, heat, color, { replaying = false } = {}) {
|
|
234
242
|
const n = heat ? heat.nodes.size : 0;
|
|
235
243
|
const countText = status === 'ready' ? `${n} ${n === 1 ? 'node' : 'nodes'}` : status === 'loading' ? 'reading…' : status === 'error' ? 'not read' : 'not read yet';
|
|
236
|
-
|
|
244
|
+
// Replay is the History layer's (spec 0015 D6): a button on its row, pressed while the timeline is open (page.js turns the layer on and opens it)
|
|
245
|
+
const action = { name: 'history-replay', label: 'Replay', pressed: replaying === true, title: 'Replay the map\'s history, commit by commit' };
|
|
246
|
+
return { key: HISTORY_LAYER, label: 'History', color, overlay: true, countText, action, desc: 'A halo round each node the history changed: the wider, the more often; pink this week, violet this month, grey before. Picking a spec in a node\'s History lights what it reached.' };
|
|
237
247
|
}
|
|
238
248
|
|
|
239
249
|
/**
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import { announce } from './engine/keyboard.js';
|
|
19
19
|
import { SPEEDS, commitKind, dayOf, parentsOf, replayCount, replayFrame, speedMs, stepWords, trailHtml } from './history-model.js';
|
|
20
20
|
import { escapeHtml as esc } from '../core/text.js';
|
|
21
|
+
import { redrawLayers } from './engine/layers.js';
|
|
21
22
|
|
|
22
23
|
/** How long a node takes to bud out of its parent (ms) */
|
|
23
24
|
export const BUD_MS = 520;
|
|
@@ -49,7 +50,15 @@ export function createReplay(inst, source) {
|
|
|
49
50
|
const byId = (id) => state.nodes.find((n) => n.id === id);
|
|
50
51
|
const labelOf = (id) => { const n = byId(id); return n ? String(n.label || n.id) : id; };
|
|
51
52
|
const stage = () => (state.canvas && state.canvas.parentElement) || null;
|
|
52
|
-
|
|
53
|
+
/** Replay's button, on the History row of the Layers menu (spec 0015 D6): it says pressed from `state.replay` each time the menu is drawn. Where the focus goes back when the
|
|
54
|
+
* timeline closes from inside: that button while the menu is open, else the menu's chip, else the map */
|
|
55
|
+
const returnFocus = () => {
|
|
56
|
+
const root = inst.root;
|
|
57
|
+
const find = (sel) => (root && root.querySelector ? root.querySelector(sel) : null);
|
|
58
|
+
const row = find('.hx-row-action[data-action="history-replay"]');
|
|
59
|
+
const to = row && !row.closest('[hidden]') ? row : find('[data-corn="layers-button"]') || state.canvas;
|
|
60
|
+
if (to && typeof to.focus === 'function') to.focus();
|
|
61
|
+
};
|
|
53
62
|
|
|
54
63
|
function wire() {
|
|
55
64
|
if (!inst.map) return;
|
|
@@ -270,9 +279,8 @@ export function createReplay(inst, source) {
|
|
|
270
279
|
parents = parentsOf(state.edges);
|
|
271
280
|
wire();
|
|
272
281
|
buildStrip();
|
|
273
|
-
const btn = button();
|
|
274
|
-
if (btn) btn.setAttribute('aria-pressed', 'true');
|
|
275
282
|
go(at, { say: true });
|
|
283
|
+
redrawLayers(inst); // Replay says pressed
|
|
276
284
|
setPlaying(!inst.reducedMotion && at === 0);
|
|
277
285
|
if (strip) strip.querySelector(playing ? '[data-replay="play"]' : '.hx-timeline-range').focus();
|
|
278
286
|
}
|
|
@@ -287,8 +295,8 @@ export function createReplay(inst, source) {
|
|
|
287
295
|
frame = null;
|
|
288
296
|
if (strip) { strip.remove(); strip = null; }
|
|
289
297
|
if (pulses) { pulses.remove(); pulses = null; }
|
|
290
|
-
|
|
291
|
-
if (
|
|
298
|
+
redrawLayers(inst);
|
|
299
|
+
if (had) returnFocus();
|
|
292
300
|
inst.touchScene();
|
|
293
301
|
inst.emit('history:at');
|
|
294
302
|
if (inst.map) inst.map.render();
|
package/explorer/history.js
CHANGED
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
* history:all (none) (emit) the section lists every commit, not only the newest
|
|
19
19
|
* history:changed (none) (emitted) the read ended, or a pick changed: the open panel draws its History section again
|
|
20
20
|
* history:legend { active } (emitted) the History layer is drawn: the Layers menu shows its legend
|
|
21
|
-
* history:replay at? (emit) open Replay (history-replay.js) at a commit, or close it when it is open and no commit is named
|
|
21
|
+
* history:replay at? (emit) open Replay (history-replay.js) at a commit, or close it when it is open and no commit is named;
|
|
22
|
+
* the Layers menu's Replay (on the History row, spec 0015 D6) asks it, with the History layer turned on first
|
|
22
23
|
* history:at (none) (emitted) the timeline's commit moved (`state.historyAt`): the halos follow it
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
26
|
import { credentialed } from './engine/connection.js';
|
|
26
27
|
import { announce } from './engine/keyboard.js';
|
|
27
|
-
import { onLayersChange, redrawLayers } from './engine/layers.js';
|
|
28
|
+
import { onLayersChange, redrawLayers, setLayer } from './engine/layers.js';
|
|
28
29
|
import { layerOn } from './layer-model.js';
|
|
29
30
|
import { createReplay } from './history-replay.js';
|
|
30
31
|
import { HISTORY_LAYER, MAX_HALOS, forgeLinks, haloWidth, heatOf, historyRowOf, historySectionHtml, specBarHtml, specFiles, specReach } from './history-model.js';
|
|
@@ -186,17 +187,25 @@ export function initHistory(inst, config) {
|
|
|
186
187
|
});
|
|
187
188
|
|
|
188
189
|
if (mem.status !== 'off') {
|
|
189
|
-
const btn = inst.el('replay-btn');
|
|
190
|
-
if (btn) btn.hidden = false;
|
|
191
190
|
stops.push(inst.on('history:replay', (at) => {
|
|
192
191
|
if (Number.isInteger(at)) { if (replay.open()) replay.stop(); replay.start(at); return; }
|
|
193
192
|
if (replay.open()) replay.stop(); else replay.start(0);
|
|
194
193
|
}));
|
|
195
194
|
stops.push(inst.on('view', () => { if (state.view !== 'orbit' && replay.open()) replay.stop(); }));
|
|
196
195
|
stops.push(inst.on('history:changed', () => { if (replay.open()) replay.repaint(); }));
|
|
197
|
-
stops.push(() =>
|
|
198
|
-
//
|
|
199
|
-
|
|
196
|
+
stops.push(() => replay.destroy());
|
|
197
|
+
// Replay on the Layers menu's History row (spec 0015 D6): pressed, it turns the History layer on and opens the timeline; pressed again, it closes it
|
|
198
|
+
// (page.js, which hears the click first, goes to the Map view from another)
|
|
199
|
+
if (inst.root && inst.root.addEventListener) {
|
|
200
|
+
stops.push(inst.listen(inst.root, 'click', (e) => {
|
|
201
|
+
const press = e.target && e.target.closest ? e.target.closest('.hx-row-action[data-action="history-replay"]') : null;
|
|
202
|
+
if (!press) return;
|
|
203
|
+
if (!replay.open()) setLayer(inst, HISTORY_LAYER, true, { viewer: true });
|
|
204
|
+
inst.emit('history:replay');
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
// The Layers menu's row under Overlays (engine/layers.js `layerRows`), in the colour of this week's halo, with Replay on it (spec 0015 D6)
|
|
208
|
+
state.historyRow = () => historyRowOf(mem.status, mem.status === 'ready' ? heatNow() : null, haloColor(), { replaying: replay.open() });
|
|
200
209
|
stops.push(onLayersChange(inst, layerChanged));
|
|
201
210
|
if (inst.map) stops.push(inst.map.onPaint((scene, camera) => syncHalos(scene, camera)));
|
|
202
211
|
stops.push(inst.on('history:at', () => { placed = ''; if (inst.map) inst.map.render(); redrawLayers(inst); }));
|
package/explorer/index.html
CHANGED
|
@@ -63,8 +63,10 @@
|
|
|
63
63
|
</button>
|
|
64
64
|
</div>
|
|
65
65
|
|
|
66
|
-
<!--
|
|
67
|
-
|
|
66
|
+
<!-- The controls of the view that is on (spec 0015 D5), then the Layers chip. In the Work view: Waiting on you (a toggle) and List, which explorer/work-view.js puts in the group;
|
|
67
|
+
the Map's Replay is on the History row of the Layers menu (D6). On a phone the two sit on the map's top-left row, the Layers chip first -->
|
|
68
|
+
<div class="hx-view-tools">
|
|
69
|
+
<div class="hx-view-controls" role="group" aria-label="Work view" data-corn="view-controls" hidden></div>
|
|
68
70
|
|
|
69
71
|
<!-- 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. It is a piece (explorer/pieces/layers.js): page.js mounts it here. Until then a stand-in (its markup without ids) holds its place, so the first paint has the chip and nothing moves when the piece comes; test/explorer/page-pieces.test.js keeps the two the same -->
|
|
70
72
|
<!--corn-placeholder:layers/menu-->
|
|
@@ -72,7 +74,7 @@
|
|
|
72
74
|
<button type="button" class="hx-layers-chip" data-action="toggle-layers-menu" aria-expanded="false" data-corn="layers-button" part="layers-button"><span data-corn-string="layers">Layers</span><span class="hx-layers-count" data-corn="count" part="count"></span></button>
|
|
73
75
|
<div class="hx-menu glass" hidden data-corn="layers-menu" part="layers-menu">
|
|
74
76
|
<div class="hx-menu-title hx-menu-head" data-corn="menu-title" part="menu-title">
|
|
75
|
-
<span>
|
|
77
|
+
<span>Layers</span>
|
|
76
78
|
<span class="hx-menu-links">
|
|
77
79
|
<button type="button" class="hx-textbtn hx-textbtn--accent" data-action="layers-all" data-corn="layers-all" part="layers-all" data-corn-kind="quiet" data-corn-string="layersAll">All</button>
|
|
78
80
|
<span class="hx-faint">•</span>
|
|
@@ -108,6 +110,7 @@
|
|
|
108
110
|
</div>
|
|
109
111
|
</div>
|
|
110
112
|
<!--corn-piece:layers/menu-->
|
|
113
|
+
</div>
|
|
111
114
|
|
|
112
115
|
<!-- 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 -->
|
|
113
116
|
<div id="live-wrap" class="hx-menu-wrap hx-live" data-tone="idle" hidden>
|
package/explorer/page.js
CHANGED
|
@@ -116,9 +116,8 @@ const ACTIONS = {
|
|
|
116
116
|
setView(state.view === 'dataflow' ? 'orbit' : 'dataflow');
|
|
117
117
|
},
|
|
118
118
|
'play-outage': (el) => playOutage(el.dataset.id), // the cloud panel's Play button (spec 0031 section 8)
|
|
119
|
-
'history-replay': () => { // Replay (spec 0014 D1) runs on the Map view: from another view it goes there first
|
|
119
|
+
'history-replay': () => { // Replay (spec 0014 D1), on the Layers menu's History row (spec 0015 D6), runs on the Map view: from another view it goes there first (history.js, which hears the click after this, opens it)
|
|
120
120
|
if (state.view !== 'orbit') { closeDrawer(); setView('orbit'); }
|
|
121
|
-
inst.emit('history:replay');
|
|
122
121
|
},
|
|
123
122
|
'retry': () => loadTopology(),
|
|
124
123
|
'set-theme': (el) => setThemeChoice(el.dataset.choice),
|